@combeenation/3d-viewer 5.0.1 → 5.0.3-beta2
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/README.md +111 -114
- package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-cjs/api/classes/animationInterface.js +1 -1
- package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-cjs/api/classes/dottedPath.js +187 -187
- package/dist/lib-cjs/api/classes/element.d.ts +139 -139
- package/dist/lib-cjs/api/classes/element.js +794 -794
- package/dist/lib-cjs/api/classes/element.js.map +1 -1
- package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -0
- package/dist/lib-cjs/api/classes/elementParameterizable.js +135 -0
- package/dist/lib-cjs/api/classes/elementParameterizable.js.map +1 -0
- package/dist/lib-cjs/api/classes/event.d.ts +326 -326
- package/dist/lib-cjs/api/classes/event.js +371 -371
- package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
- package/dist/lib-cjs/api/classes/parameter.d.ts +316 -259
- package/dist/lib-cjs/api/classes/parameter.js +451 -388
- package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
- package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
- package/dist/lib-cjs/api/classes/parameterObservable.js +101 -101
- package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +44 -44
- package/dist/lib-cjs/api/classes/placementAnimation.js +163 -163
- package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
- package/dist/lib-cjs/api/classes/variant.js +1154 -1154
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -45
- package/dist/lib-cjs/api/classes/variantInstance.js +108 -108
- package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-cjs/api/classes/variantParameterizable.js +99 -99
- package/dist/lib-cjs/api/classes/viewer.d.ts +177 -175
- package/dist/lib-cjs/api/classes/viewer.js +717 -701
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
- package/dist/lib-cjs/api/classes/viewerLight.js +392 -392
- package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
- package/dist/lib-cjs/api/internal/debugViewer.js +86 -86
- package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
- package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
- package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -10
- package/dist/lib-cjs/api/internal/sceneSetup.js +238 -234
- package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
- package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
- package/dist/lib-cjs/api/manager/animationManager.js +130 -130
- package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +65 -65
- package/dist/lib-cjs/api/manager/gltfExportManager.js +223 -222
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/sceneManager.d.ts +31 -32
- package/dist/lib-cjs/api/manager/sceneManager.js +153 -132
- package/dist/lib-cjs/api/manager/sceneManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +92 -92
- package/dist/lib-cjs/api/manager/variantInstanceManager.js +335 -335
- package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
- package/dist/lib-cjs/api/store/specStorage.js +51 -51
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +174 -166
- package/dist/lib-cjs/api/util/babylonHelper.js +575 -497
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +366 -356
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -53
- package/dist/lib-cjs/api/util/resourceHelper.js +257 -242
- package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/stringHelper.js +25 -25
- package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/structureHelper.js +48 -44
- package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +3 -3
- package/dist/lib-cjs/index.d.ts +49 -49
- package/dist/lib-cjs/index.js +89 -89
- package/dist/webpack-stats.json +0 -0
- package/package.json +87 -87
- package/src/api/classes/animationInterface.ts +10 -10
- package/src/api/classes/dottedPath.ts +181 -181
- package/src/api/classes/element.ts +690 -692
- package/src/api/classes/event.ts +367 -367
- package/src/api/classes/eventBroadcaster.ts +52 -52
- package/src/api/classes/parameter.ts +474 -405
- package/src/api/classes/parameterObservable.ts +100 -100
- package/src/api/classes/parameterizable.ts +87 -87
- package/src/api/classes/placementAnimation.ts +160 -160
- package/src/api/classes/variant.ts +845 -845
- package/src/api/classes/variantInstance.ts +97 -97
- package/src/api/classes/variantParameterizable.ts +85 -85
- package/src/api/classes/viewer.ts +650 -624
- package/src/api/classes/viewerLight.ts +334 -334
- package/src/api/internal/debugViewer.ts +90 -90
- package/src/api/internal/lensRendering.ts +10 -10
- package/src/api/internal/sceneSetup.ts +204 -201
- package/src/api/manager/animationManager.ts +142 -142
- package/src/api/manager/gltfExportManager.ts +191 -191
- package/src/api/manager/sceneManager.ts +128 -102
- package/src/api/manager/variantInstanceManager.ts +265 -265
- package/src/api/store/specStorage.ts +51 -51
- package/src/api/util/babylonHelper.ts +628 -538
- package/src/api/util/globalTypes.ts +413 -402
- package/src/api/util/resourceHelper.ts +189 -173
- package/src/api/util/stringHelper.ts +23 -23
- package/src/api/util/structureHelper.ts +49 -43
- package/src/buildinfo.json +3 -3
- package/src/commonjs.tsconfig.json +10 -10
- package/src/declaration.tsconfig.json +8 -8
- package/src/dev.ts +42 -42
- package/src/es6.tsconfig.json +10 -10
- package/src/index.ts +94 -94
- package/src/pagesconfig.json +77 -73
- package/src/tsconfig.json +32 -32
- package/src/tsconfig.types.json +9 -9
- package/src/types.d.ts +3 -3
|
@@ -1,188 +1,188 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DottedPath = void 0;
|
|
4
|
-
var DottedPath = /** @class */ (function () {
|
|
5
|
-
/**
|
|
6
|
-
* Constructor
|
|
7
|
-
*/
|
|
8
|
-
function DottedPath() {
|
|
9
|
-
this.parts = [];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Magic factory function that creates a DottedPath based on the argument type.
|
|
13
|
-
*/
|
|
14
|
-
DottedPath.create = function (dottedPath) {
|
|
15
|
-
if ((dottedPath === null || dottedPath === void 0 ? void 0 : dottedPath.constructor) === DottedPath) {
|
|
16
|
-
return dottedPath.clone();
|
|
17
|
-
}
|
|
18
|
-
if ((dottedPath === null || dottedPath === void 0 ? void 0 : dottedPath.constructor) === String) {
|
|
19
|
-
return DottedPath.createFromPath(dottedPath);
|
|
20
|
-
}
|
|
21
|
-
if ((dottedPath === null || dottedPath === void 0 ? void 0 : dottedPath.constructor) === Array) {
|
|
22
|
-
return DottedPath.createFromParts(dottedPath);
|
|
23
|
-
}
|
|
24
|
-
return DottedPath.createEmpty();
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Creates a DottedPath from a string.
|
|
28
|
-
* Allows patterns with unsafe characters wrapped in apostrophes or quotes.
|
|
29
|
-
* E.g. "part1.part2.'part.3'.part_4"
|
|
30
|
-
*/
|
|
31
|
-
DottedPath.createFromPath = function (path) {
|
|
32
|
-
if (path.length === 0) {
|
|
33
|
-
return this.createEmpty();
|
|
34
|
-
}
|
|
35
|
-
if (path.indexOf("'") > -1 || path.indexOf('"') > -1) {
|
|
36
|
-
var bd = '[\'|"]';
|
|
37
|
-
var search = new RegExp(bd + "(.*)" + bd, 'g');
|
|
38
|
-
var matches = search.exec(path);
|
|
39
|
-
while (matches !== null) {
|
|
40
|
-
var _search = new RegExp("" + bd + matches[1] + bd, 'g');
|
|
41
|
-
path = path.replace(_search, this.sanitizePart(matches[1]));
|
|
42
|
-
matches = search.exec(path);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return this.createFromParts(path.split(DottedPath.DELIMITER));
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Creates a DottedPath from a string list.
|
|
49
|
-
*/
|
|
50
|
-
DottedPath.createFromParts = function (parts) {
|
|
51
|
-
var dottedPath = new DottedPath();
|
|
52
|
-
parts.forEach(function (part) { return dottedPath.addPart(part); });
|
|
53
|
-
return dottedPath;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Creates an empty DottedPath.
|
|
57
|
-
*/
|
|
58
|
-
DottedPath.createEmpty = function () {
|
|
59
|
-
return new DottedPath();
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Sanitizes given part: replaces all characters like {@link DottedPath.DELIMITER}
|
|
63
|
-
* with a "safe" character like {@link DottedPath.SAFE_CHAR}.
|
|
64
|
-
* (i) Does not trim whitespace.
|
|
65
|
-
*/
|
|
66
|
-
DottedPath.sanitizePart = function (part) {
|
|
67
|
-
return part.split(DottedPath.DELIMITER).join(DottedPath.SAFE_CHAR);
|
|
68
|
-
};
|
|
69
|
-
Object.defineProperty(DottedPath.prototype, "path", {
|
|
70
|
-
/**
|
|
71
|
-
* The path.
|
|
72
|
-
* (i) Does not return an empty dot for no path.
|
|
73
|
-
*/
|
|
74
|
-
get: function () {
|
|
75
|
-
return this.parts.length > 0 ? this.parts.join(DottedPath.DELIMITER) : '';
|
|
76
|
-
},
|
|
77
|
-
enumerable: false,
|
|
78
|
-
configurable: true
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(DottedPath.prototype, "firstPart", {
|
|
81
|
-
/**
|
|
82
|
-
* The first part.
|
|
83
|
-
*/
|
|
84
|
-
get: function () {
|
|
85
|
-
if (this.parts.length > 0) {
|
|
86
|
-
return this.parts[0];
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
},
|
|
90
|
-
enumerable: false,
|
|
91
|
-
configurable: true
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(DottedPath.prototype, "lastPart", {
|
|
94
|
-
/**
|
|
95
|
-
* The last part.
|
|
96
|
-
*/
|
|
97
|
-
get: function () {
|
|
98
|
-
if (this.parts.length > 0) {
|
|
99
|
-
return this.parts[this.parts.length - 1];
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
},
|
|
103
|
-
enumerable: false,
|
|
104
|
-
configurable: true
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(DottedPath.prototype, "leafTokens", {
|
|
107
|
-
/**
|
|
108
|
-
* Gets the tokens to each leaf of the DottedPath tree.
|
|
109
|
-
* E.g. "part1.part2.part_3" will return an array like
|
|
110
|
-
* ["part1", "part1.part2", "part1.part2.part_3"]
|
|
111
|
-
*/
|
|
112
|
-
get: function () {
|
|
113
|
-
var parents = [];
|
|
114
|
-
return this.parts.map(function (part) {
|
|
115
|
-
parents.push(part);
|
|
116
|
-
return DottedPath.create(parents).path;
|
|
117
|
-
});
|
|
118
|
-
},
|
|
119
|
-
enumerable: false,
|
|
120
|
-
configurable: true
|
|
121
|
-
});
|
|
122
|
-
/**
|
|
123
|
-
* Removes the first part and returns it.
|
|
124
|
-
*/
|
|
125
|
-
DottedPath.prototype.shiftPart = function () {
|
|
126
|
-
return this.parts.shift();
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Adds part to the beginning of parts list.
|
|
130
|
-
*/
|
|
131
|
-
DottedPath.prototype.unshiftPart = function (part, duplicateCheck) {
|
|
132
|
-
if (duplicateCheck === void 0) { duplicateCheck = false; }
|
|
133
|
-
part = DottedPath.sanitizePart(part);
|
|
134
|
-
if (duplicateCheck && this.firstPart === part) {
|
|
135
|
-
return this;
|
|
136
|
-
}
|
|
137
|
-
this.parts.unshift(part);
|
|
138
|
-
return this;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Adds part to the end of parts list.
|
|
142
|
-
* (i) Does not add a part if the last char already is the delimiter or if an empty string was passed.
|
|
143
|
-
*/
|
|
144
|
-
DottedPath.prototype.addPart = function (part, duplicateCheck) {
|
|
145
|
-
if (duplicateCheck === void 0) { duplicateCheck = false; }
|
|
146
|
-
if (part.length < 1 || this.lastPart === DottedPath.DELIMITER) {
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
part = DottedPath.sanitizePart(part);
|
|
150
|
-
if (duplicateCheck && this.lastPart === part) {
|
|
151
|
-
return this;
|
|
152
|
-
}
|
|
153
|
-
this.parts.push(part);
|
|
154
|
-
return this;
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Adds multiple parts to the end of parts list.
|
|
158
|
-
*/
|
|
159
|
-
DottedPath.prototype.addParts = function (parts, duplicateCheck) {
|
|
160
|
-
var _this = this;
|
|
161
|
-
if (duplicateCheck === void 0) { duplicateCheck = false; }
|
|
162
|
-
parts.forEach(function (part) { return _this.addPart(part, duplicateCheck); });
|
|
163
|
-
return this;
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Removes the last part and returns it.
|
|
167
|
-
*/
|
|
168
|
-
DottedPath.prototype.popPart = function () {
|
|
169
|
-
return this.parts.pop();
|
|
170
|
-
};
|
|
171
|
-
DottedPath.prototype.toString = function () {
|
|
172
|
-
return this.path;
|
|
173
|
-
};
|
|
174
|
-
DottedPath.prototype.valueOf = function () {
|
|
175
|
-
return this.path;
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* Clones the DottedPath.
|
|
179
|
-
*/
|
|
180
|
-
DottedPath.prototype.clone = function () {
|
|
181
|
-
return DottedPath.createFromParts(this.parts);
|
|
182
|
-
};
|
|
183
|
-
DottedPath.DELIMITER = '.';
|
|
184
|
-
DottedPath.SAFE_CHAR = '·';
|
|
185
|
-
return DottedPath;
|
|
186
|
-
}());
|
|
187
|
-
exports.DottedPath = DottedPath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DottedPath = void 0;
|
|
4
|
+
var DottedPath = /** @class */ (function () {
|
|
5
|
+
/**
|
|
6
|
+
* Constructor
|
|
7
|
+
*/
|
|
8
|
+
function DottedPath() {
|
|
9
|
+
this.parts = [];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Magic factory function that creates a DottedPath based on the argument type.
|
|
13
|
+
*/
|
|
14
|
+
DottedPath.create = function (dottedPath) {
|
|
15
|
+
if ((dottedPath === null || dottedPath === void 0 ? void 0 : dottedPath.constructor) === DottedPath) {
|
|
16
|
+
return dottedPath.clone();
|
|
17
|
+
}
|
|
18
|
+
if ((dottedPath === null || dottedPath === void 0 ? void 0 : dottedPath.constructor) === String) {
|
|
19
|
+
return DottedPath.createFromPath(dottedPath);
|
|
20
|
+
}
|
|
21
|
+
if ((dottedPath === null || dottedPath === void 0 ? void 0 : dottedPath.constructor) === Array) {
|
|
22
|
+
return DottedPath.createFromParts(dottedPath);
|
|
23
|
+
}
|
|
24
|
+
return DottedPath.createEmpty();
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Creates a DottedPath from a string.
|
|
28
|
+
* Allows patterns with unsafe characters wrapped in apostrophes or quotes.
|
|
29
|
+
* E.g. "part1.part2.'part.3'.part_4"
|
|
30
|
+
*/
|
|
31
|
+
DottedPath.createFromPath = function (path) {
|
|
32
|
+
if (path.length === 0) {
|
|
33
|
+
return this.createEmpty();
|
|
34
|
+
}
|
|
35
|
+
if (path.indexOf("'") > -1 || path.indexOf('"') > -1) {
|
|
36
|
+
var bd = '[\'|"]';
|
|
37
|
+
var search = new RegExp(bd + "(.*)" + bd, 'g');
|
|
38
|
+
var matches = search.exec(path);
|
|
39
|
+
while (matches !== null) {
|
|
40
|
+
var _search = new RegExp("" + bd + matches[1] + bd, 'g');
|
|
41
|
+
path = path.replace(_search, this.sanitizePart(matches[1]));
|
|
42
|
+
matches = search.exec(path);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return this.createFromParts(path.split(DottedPath.DELIMITER));
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Creates a DottedPath from a string list.
|
|
49
|
+
*/
|
|
50
|
+
DottedPath.createFromParts = function (parts) {
|
|
51
|
+
var dottedPath = new DottedPath();
|
|
52
|
+
parts.forEach(function (part) { return dottedPath.addPart(part); });
|
|
53
|
+
return dottedPath;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates an empty DottedPath.
|
|
57
|
+
*/
|
|
58
|
+
DottedPath.createEmpty = function () {
|
|
59
|
+
return new DottedPath();
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Sanitizes given part: replaces all characters like {@link DottedPath.DELIMITER}
|
|
63
|
+
* with a "safe" character like {@link DottedPath.SAFE_CHAR}.
|
|
64
|
+
* (i) Does not trim whitespace.
|
|
65
|
+
*/
|
|
66
|
+
DottedPath.sanitizePart = function (part) {
|
|
67
|
+
return part.split(DottedPath.DELIMITER).join(DottedPath.SAFE_CHAR);
|
|
68
|
+
};
|
|
69
|
+
Object.defineProperty(DottedPath.prototype, "path", {
|
|
70
|
+
/**
|
|
71
|
+
* The path.
|
|
72
|
+
* (i) Does not return an empty dot for no path.
|
|
73
|
+
*/
|
|
74
|
+
get: function () {
|
|
75
|
+
return this.parts.length > 0 ? this.parts.join(DottedPath.DELIMITER) : '';
|
|
76
|
+
},
|
|
77
|
+
enumerable: false,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(DottedPath.prototype, "firstPart", {
|
|
81
|
+
/**
|
|
82
|
+
* The first part.
|
|
83
|
+
*/
|
|
84
|
+
get: function () {
|
|
85
|
+
if (this.parts.length > 0) {
|
|
86
|
+
return this.parts[0];
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
},
|
|
90
|
+
enumerable: false,
|
|
91
|
+
configurable: true
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(DottedPath.prototype, "lastPart", {
|
|
94
|
+
/**
|
|
95
|
+
* The last part.
|
|
96
|
+
*/
|
|
97
|
+
get: function () {
|
|
98
|
+
if (this.parts.length > 0) {
|
|
99
|
+
return this.parts[this.parts.length - 1];
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
},
|
|
103
|
+
enumerable: false,
|
|
104
|
+
configurable: true
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(DottedPath.prototype, "leafTokens", {
|
|
107
|
+
/**
|
|
108
|
+
* Gets the tokens to each leaf of the DottedPath tree.
|
|
109
|
+
* E.g. "part1.part2.part_3" will return an array like
|
|
110
|
+
* ["part1", "part1.part2", "part1.part2.part_3"]
|
|
111
|
+
*/
|
|
112
|
+
get: function () {
|
|
113
|
+
var parents = [];
|
|
114
|
+
return this.parts.map(function (part) {
|
|
115
|
+
parents.push(part);
|
|
116
|
+
return DottedPath.create(parents).path;
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
enumerable: false,
|
|
120
|
+
configurable: true
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* Removes the first part and returns it.
|
|
124
|
+
*/
|
|
125
|
+
DottedPath.prototype.shiftPart = function () {
|
|
126
|
+
return this.parts.shift();
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Adds part to the beginning of parts list.
|
|
130
|
+
*/
|
|
131
|
+
DottedPath.prototype.unshiftPart = function (part, duplicateCheck) {
|
|
132
|
+
if (duplicateCheck === void 0) { duplicateCheck = false; }
|
|
133
|
+
part = DottedPath.sanitizePart(part);
|
|
134
|
+
if (duplicateCheck && this.firstPart === part) {
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
this.parts.unshift(part);
|
|
138
|
+
return this;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Adds part to the end of parts list.
|
|
142
|
+
* (i) Does not add a part if the last char already is the delimiter or if an empty string was passed.
|
|
143
|
+
*/
|
|
144
|
+
DottedPath.prototype.addPart = function (part, duplicateCheck) {
|
|
145
|
+
if (duplicateCheck === void 0) { duplicateCheck = false; }
|
|
146
|
+
if (part.length < 1 || this.lastPart === DottedPath.DELIMITER) {
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
part = DottedPath.sanitizePart(part);
|
|
150
|
+
if (duplicateCheck && this.lastPart === part) {
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
this.parts.push(part);
|
|
154
|
+
return this;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Adds multiple parts to the end of parts list.
|
|
158
|
+
*/
|
|
159
|
+
DottedPath.prototype.addParts = function (parts, duplicateCheck) {
|
|
160
|
+
var _this = this;
|
|
161
|
+
if (duplicateCheck === void 0) { duplicateCheck = false; }
|
|
162
|
+
parts.forEach(function (part) { return _this.addPart(part, duplicateCheck); });
|
|
163
|
+
return this;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Removes the last part and returns it.
|
|
167
|
+
*/
|
|
168
|
+
DottedPath.prototype.popPart = function () {
|
|
169
|
+
return this.parts.pop();
|
|
170
|
+
};
|
|
171
|
+
DottedPath.prototype.toString = function () {
|
|
172
|
+
return this.path;
|
|
173
|
+
};
|
|
174
|
+
DottedPath.prototype.valueOf = function () {
|
|
175
|
+
return this.path;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Clones the DottedPath.
|
|
179
|
+
*/
|
|
180
|
+
DottedPath.prototype.clone = function () {
|
|
181
|
+
return DottedPath.createFromParts(this.parts);
|
|
182
|
+
};
|
|
183
|
+
DottedPath.DELIMITER = '.';
|
|
184
|
+
DottedPath.SAFE_CHAR = '·';
|
|
185
|
+
return DottedPath;
|
|
186
|
+
}());
|
|
187
|
+
exports.DottedPath = DottedPath;
|
|
188
188
|
//# sourceMappingURL=dottedPath.js.map
|
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import { HighlightLayer } from '@babylonjs/core/Layers/highlightLayer';
|
|
2
|
-
import { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
3
|
-
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
4
|
-
import { VariantParameterizable } from './../classes/variantParameterizable';
|
|
5
|
-
import { DottedPath } from './dottedPath';
|
|
6
|
-
import { Variant } from './variant';
|
|
7
|
-
/**
|
|
8
|
-
* An {@link Element} of a {@link Variant}. Acts as a container for diverse definitions. Lives only in the context of a
|
|
9
|
-
* {@link Variant}.
|
|
10
|
-
*
|
|
11
|
-
* When used in typings, refer to via its alias {@link VariantElement} to prevent name clashes with the web APIs
|
|
12
|
-
* [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) class
|
|
13
|
-
*/
|
|
14
|
-
export declare class Element extends VariantParameterizable {
|
|
15
|
-
readonly variant: Variant;
|
|
16
|
-
readonly name: string;
|
|
17
|
-
readonly nodes: TransformNode[];
|
|
18
|
-
protected readonly _dottedNodes: Map<DottedPath, TransformNode>;
|
|
19
|
-
protected _highlightLayer?: HighlightLayer;
|
|
20
|
-
/**
|
|
21
|
-
* Constructor.
|
|
22
|
-
*/
|
|
23
|
-
protected constructor(variant: Variant, name: string);
|
|
24
|
-
/**
|
|
25
|
-
* Creates an {@link Element} with given name.
|
|
26
|
-
*/
|
|
27
|
-
static create(variant: Variant, name: string): Promise<Element>;
|
|
28
|
-
/**
|
|
29
|
-
* The {@link DottedPath} in the built tree of {@link Element}s.
|
|
30
|
-
* E.g. "_.top-1.sub-2.sub-sub-3.el-1"
|
|
31
|
-
*/
|
|
32
|
-
get dottedPath(): DottedPath;
|
|
33
|
-
/**
|
|
34
|
-
* The id representing a {@link DottedPath}.
|
|
35
|
-
*/
|
|
36
|
-
get id(): string;
|
|
37
|
-
/**
|
|
38
|
-
* The {@link ElementDefinition} of the {@link Element}.
|
|
39
|
-
*/
|
|
40
|
-
get definition(): ElementDefinition;
|
|
41
|
-
/**
|
|
42
|
-
* The {@link PathDefinitions} of the {@link Element}.
|
|
43
|
-
*/
|
|
44
|
-
get pathDefinitions(): PathDefinitions;
|
|
45
|
-
/**
|
|
46
|
-
* The {@link TraceableDefinitions} of the {@link Element}.
|
|
47
|
-
*/
|
|
48
|
-
get traceableDefinitions(): TraceableDefinitions;
|
|
49
|
-
/**
|
|
50
|
-
* The {@link PaintableDefinition} of the {@link Element}.
|
|
51
|
-
*/
|
|
52
|
-
get paintableDefinitions(): PaintableDefinitions;
|
|
53
|
-
/**
|
|
54
|
-
* The inherited {@link ParameterBag}.
|
|
55
|
-
* Merges the {@link Variant}'s parameters and those from the {@link Element}.
|
|
56
|
-
*/
|
|
57
|
-
get inheritedParameters(): ParameterBag;
|
|
58
|
-
/**
|
|
59
|
-
* The actual {@link Mesh}es that make up this {@link Element}.
|
|
60
|
-
* Handy for e.g. creating a bounding box around an entire element.
|
|
61
|
-
*/
|
|
62
|
-
get meshesFlat(): Mesh[];
|
|
63
|
-
/**
|
|
64
|
-
* The meshes of this {@link Element}.
|
|
65
|
-
*/
|
|
66
|
-
get meshes(): Mesh[];
|
|
67
|
-
/**
|
|
68
|
-
* @protected
|
|
69
|
-
*/
|
|
70
|
-
set highlightLayer(layer: HighlightLayer | undefined);
|
|
71
|
-
get highlightLayer(): HighlightLayer | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Destroys this {@link Element} and dispose all nodes.
|
|
74
|
-
*/
|
|
75
|
-
destroy(): Element;
|
|
76
|
-
/**
|
|
77
|
-
* Gets a node by its {@link DottedPath}.
|
|
78
|
-
*/
|
|
79
|
-
getNode(dottedPath: DottedPathArgument): TransformNode;
|
|
80
|
-
/**
|
|
81
|
-
* Gets a mesh by its {@link DottedPath}.
|
|
82
|
-
*/
|
|
83
|
-
getMesh(dottedPath: DottedPathArgument): Promise<Mesh | null>;
|
|
84
|
-
/**
|
|
85
|
-
* Gets a {@link PaintableDefinition} by its name.
|
|
86
|
-
*/
|
|
87
|
-
getPaintableDefinition(name: string): PaintableDefinition;
|
|
88
|
-
/**
|
|
89
|
-
* Gets a {@link TraceableDefinition} by its name.
|
|
90
|
-
*/
|
|
91
|
-
getTraceableDefinition(name: string): TraceableDefinition;
|
|
92
|
-
/**
|
|
93
|
-
* Gets the paintable Node by its name.
|
|
94
|
-
*/
|
|
95
|
-
getPaintableNode(name: string): TransformNode;
|
|
96
|
-
/**
|
|
97
|
-
* Gets the traceable Node by its name.
|
|
98
|
-
*/
|
|
99
|
-
getTraceableNode(name: string): TransformNode;
|
|
100
|
-
/**
|
|
101
|
-
* @see {@link VariantParameterizable.commitParameters}
|
|
102
|
-
* @emit {@link Event.ELEMENT_PARAMETER_COMMITTED}
|
|
103
|
-
*/
|
|
104
|
-
commitParameters(parameters?: ParameterBag): Promise<VariantParameterizable>;
|
|
105
|
-
/**
|
|
106
|
-
* Adds an observer function for camera matrix changes.
|
|
107
|
-
* The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
|
|
108
|
-
*/
|
|
109
|
-
addTraceableObserver(traceable: string, observer: CallableFunction, payload?: any): Element;
|
|
110
|
-
/**
|
|
111
|
-
* Draws a `ImageBitmap` or `OffscreenCanvas` onto a `paintable` defined via {@link PaintableDefinition}.
|
|
112
|
-
*/
|
|
113
|
-
drawPaintable(paintable: string, imageSource: CanvasImageSource): Element;
|
|
114
|
-
/**
|
|
115
|
-
* Draws a SVG string onto a `paintable` defined via {@link PaintableDefinition}.
|
|
116
|
-
*/
|
|
117
|
-
drawPaintableFromSvg(paintable: string, svgSource: string): Promise<Element>;
|
|
118
|
-
/**
|
|
119
|
-
* Draws an Image from source (URL/URI) onto a `paintable` defined via {@link PaintableDefinition}.
|
|
120
|
-
*/
|
|
121
|
-
drawPaintableFromImgSrc(paintable: string, imgSource: string): Promise<Element>;
|
|
122
|
-
/**
|
|
123
|
-
* Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
|
|
124
|
-
*/
|
|
125
|
-
protected addParameterObservers(): Element;
|
|
126
|
-
/**
|
|
127
|
-
* Filter for nodes that are not defined or excluded in the `pathDefinitions`.
|
|
128
|
-
*/
|
|
129
|
-
protected filterNode(node: TransformNode): boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Asserts whether all {@link pathDefinitions} link to a valid `Node` path.
|
|
132
|
-
* @protected
|
|
133
|
-
*/
|
|
134
|
-
protected assertPathDefinitions(): void;
|
|
135
|
-
/**
|
|
136
|
-
* Handles callback for given light parameter.
|
|
137
|
-
*/
|
|
138
|
-
private castShadowValueHandler;
|
|
139
|
-
}
|
|
1
|
+
import { HighlightLayer } from '@babylonjs/core/Layers/highlightLayer';
|
|
2
|
+
import { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
3
|
+
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
4
|
+
import { VariantParameterizable } from './../classes/variantParameterizable';
|
|
5
|
+
import { DottedPath } from './dottedPath';
|
|
6
|
+
import { Variant } from './variant';
|
|
7
|
+
/**
|
|
8
|
+
* An {@link Element} of a {@link Variant}. Acts as a container for diverse definitions. Lives only in the context of a
|
|
9
|
+
* {@link Variant}.
|
|
10
|
+
*
|
|
11
|
+
* When used in typings, refer to via its alias {@link VariantElement} to prevent name clashes with the web APIs
|
|
12
|
+
* [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) class
|
|
13
|
+
*/
|
|
14
|
+
export declare class Element extends VariantParameterizable {
|
|
15
|
+
readonly variant: Variant;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly nodes: TransformNode[];
|
|
18
|
+
protected readonly _dottedNodes: Map<DottedPath, TransformNode>;
|
|
19
|
+
protected _highlightLayer?: HighlightLayer;
|
|
20
|
+
/**
|
|
21
|
+
* Constructor.
|
|
22
|
+
*/
|
|
23
|
+
protected constructor(variant: Variant, name: string);
|
|
24
|
+
/**
|
|
25
|
+
* Creates an {@link Element} with given name.
|
|
26
|
+
*/
|
|
27
|
+
static create(variant: Variant, name: string): Promise<Element>;
|
|
28
|
+
/**
|
|
29
|
+
* The {@link DottedPath} in the built tree of {@link Element}s.
|
|
30
|
+
* E.g. "_.top-1.sub-2.sub-sub-3.el-1"
|
|
31
|
+
*/
|
|
32
|
+
get dottedPath(): DottedPath;
|
|
33
|
+
/**
|
|
34
|
+
* The id representing a {@link DottedPath}.
|
|
35
|
+
*/
|
|
36
|
+
get id(): string;
|
|
37
|
+
/**
|
|
38
|
+
* The {@link ElementDefinition} of the {@link Element}.
|
|
39
|
+
*/
|
|
40
|
+
get definition(): ElementDefinition;
|
|
41
|
+
/**
|
|
42
|
+
* The {@link PathDefinitions} of the {@link Element}.
|
|
43
|
+
*/
|
|
44
|
+
get pathDefinitions(): PathDefinitions;
|
|
45
|
+
/**
|
|
46
|
+
* The {@link TraceableDefinitions} of the {@link Element}.
|
|
47
|
+
*/
|
|
48
|
+
get traceableDefinitions(): TraceableDefinitions;
|
|
49
|
+
/**
|
|
50
|
+
* The {@link PaintableDefinition} of the {@link Element}.
|
|
51
|
+
*/
|
|
52
|
+
get paintableDefinitions(): PaintableDefinitions;
|
|
53
|
+
/**
|
|
54
|
+
* The inherited {@link ParameterBag}.
|
|
55
|
+
* Merges the {@link Variant}'s parameters and those from the {@link Element}.
|
|
56
|
+
*/
|
|
57
|
+
get inheritedParameters(): ParameterBag;
|
|
58
|
+
/**
|
|
59
|
+
* The actual {@link Mesh}es that make up this {@link Element}.
|
|
60
|
+
* Handy for e.g. creating a bounding box around an entire element.
|
|
61
|
+
*/
|
|
62
|
+
get meshesFlat(): Mesh[];
|
|
63
|
+
/**
|
|
64
|
+
* The meshes of this {@link Element}.
|
|
65
|
+
*/
|
|
66
|
+
get meshes(): Mesh[];
|
|
67
|
+
/**
|
|
68
|
+
* @protected
|
|
69
|
+
*/
|
|
70
|
+
set highlightLayer(layer: HighlightLayer | undefined);
|
|
71
|
+
get highlightLayer(): HighlightLayer | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Destroys this {@link Element} and dispose all nodes.
|
|
74
|
+
*/
|
|
75
|
+
destroy(): Element;
|
|
76
|
+
/**
|
|
77
|
+
* Gets a node by its {@link DottedPath}.
|
|
78
|
+
*/
|
|
79
|
+
getNode(dottedPath: DottedPathArgument): TransformNode;
|
|
80
|
+
/**
|
|
81
|
+
* Gets a mesh by its {@link DottedPath}.
|
|
82
|
+
*/
|
|
83
|
+
getMesh(dottedPath: DottedPathArgument): Promise<Mesh | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Gets a {@link PaintableDefinition} by its name.
|
|
86
|
+
*/
|
|
87
|
+
getPaintableDefinition(name: string): PaintableDefinition;
|
|
88
|
+
/**
|
|
89
|
+
* Gets a {@link TraceableDefinition} by its name.
|
|
90
|
+
*/
|
|
91
|
+
getTraceableDefinition(name: string): TraceableDefinition;
|
|
92
|
+
/**
|
|
93
|
+
* Gets the paintable Node by its name.
|
|
94
|
+
*/
|
|
95
|
+
getPaintableNode(name: string): TransformNode;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the traceable Node by its name.
|
|
98
|
+
*/
|
|
99
|
+
getTraceableNode(name: string): TransformNode;
|
|
100
|
+
/**
|
|
101
|
+
* @see {@link VariantParameterizable.commitParameters}
|
|
102
|
+
* @emit {@link Event.ELEMENT_PARAMETER_COMMITTED}
|
|
103
|
+
*/
|
|
104
|
+
commitParameters(parameters?: ParameterBag): Promise<VariantParameterizable>;
|
|
105
|
+
/**
|
|
106
|
+
* Adds an observer function for camera matrix changes.
|
|
107
|
+
* The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
|
|
108
|
+
*/
|
|
109
|
+
addTraceableObserver(traceable: string, observer: CallableFunction, payload?: any): Element;
|
|
110
|
+
/**
|
|
111
|
+
* Draws a `ImageBitmap` or `OffscreenCanvas` onto a `paintable` defined via {@link PaintableDefinition}.
|
|
112
|
+
*/
|
|
113
|
+
drawPaintable(paintable: string, imageSource: CanvasImageSource): Element;
|
|
114
|
+
/**
|
|
115
|
+
* Draws a SVG string onto a `paintable` defined via {@link PaintableDefinition}.
|
|
116
|
+
*/
|
|
117
|
+
drawPaintableFromSvg(paintable: string, svgSource: string): Promise<Element>;
|
|
118
|
+
/**
|
|
119
|
+
* Draws an Image from source (URL/URI) onto a `paintable` defined via {@link PaintableDefinition}.
|
|
120
|
+
*/
|
|
121
|
+
drawPaintableFromImgSrc(paintable: string, imgSource: string): Promise<Element>;
|
|
122
|
+
/**
|
|
123
|
+
* Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
|
|
124
|
+
*/
|
|
125
|
+
protected addParameterObservers(): Element;
|
|
126
|
+
/**
|
|
127
|
+
* Filter for nodes that are not defined or excluded in the `pathDefinitions`.
|
|
128
|
+
*/
|
|
129
|
+
protected filterNode(node: TransformNode): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Asserts whether all {@link pathDefinitions} link to a valid `Node` path.
|
|
132
|
+
* @protected
|
|
133
|
+
*/
|
|
134
|
+
protected assertPathDefinitions(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Handles callback for given light parameter.
|
|
137
|
+
*/
|
|
138
|
+
private castShadowValueHandler;
|
|
139
|
+
}
|