@combeenation/3d-viewer 4.0.0-beta5 → 4.0.0-rc1

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.
Files changed (95) hide show
  1. package/README.md +114 -114
  2. package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
  3. package/dist/lib-cjs/api/classes/animationInterface.js +1 -1
  4. package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
  5. package/dist/lib-cjs/api/classes/dottedPath.js +190 -190
  6. package/dist/lib-cjs/api/classes/element.d.ts +130 -130
  7. package/dist/lib-cjs/api/classes/element.js +743 -743
  8. package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -14
  9. package/dist/lib-cjs/api/classes/elementParameterizable.js +134 -134
  10. package/dist/lib-cjs/api/classes/event.d.ts +326 -326
  11. package/dist/lib-cjs/api/classes/event.js +371 -371
  12. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  13. package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
  14. package/dist/lib-cjs/api/classes/parameter.d.ts +259 -259
  15. package/dist/lib-cjs/api/classes/parameter.js +387 -387
  16. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  17. package/dist/lib-cjs/api/classes/parameterObservable.js +101 -101
  18. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
  19. package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
  20. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +38 -38
  21. package/dist/lib-cjs/api/classes/placementAnimation.js +149 -149
  22. package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
  23. package/dist/lib-cjs/api/classes/variant.js +1147 -1147
  24. package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -45
  25. package/dist/lib-cjs/api/classes/variantInstance.js +108 -108
  26. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
  27. package/dist/lib-cjs/api/classes/variantParameterizable.js +92 -92
  28. package/dist/lib-cjs/api/classes/viewer.d.ts +131 -131
  29. package/dist/lib-cjs/api/classes/viewer.js +567 -560
  30. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  31. package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
  32. package/dist/lib-cjs/api/classes/viewerLight.js +389 -389
  33. package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
  34. package/dist/lib-cjs/api/internal/debugViewer.js +87 -87
  35. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  36. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  37. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +10 -10
  38. package/dist/lib-cjs/api/internal/sceneSetup.js +231 -231
  39. package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
  40. package/dist/lib-cjs/api/manager/animationManager.js +121 -121
  41. package/dist/lib-cjs/api/manager/sceneManager.d.ts +32 -32
  42. package/dist/lib-cjs/api/manager/sceneManager.js +132 -132
  43. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +90 -90
  44. package/dist/lib-cjs/api/manager/variantInstanceManager.js +321 -321
  45. package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
  46. package/dist/lib-cjs/api/store/specStorage.js +51 -51
  47. package/dist/lib-cjs/api/util/babylonHelper.d.ts +175 -175
  48. package/dist/lib-cjs/api/util/babylonHelper.js +520 -520
  49. package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
  50. package/dist/lib-cjs/api/util/globalTypes.d.ts +333 -333
  51. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  52. package/dist/lib-cjs/api/util/resourceHelper.d.ts +53 -53
  53. package/dist/lib-cjs/api/util/resourceHelper.js +240 -240
  54. package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
  55. package/dist/lib-cjs/api/util/stringHelper.js +25 -25
  56. package/dist/lib-cjs/buildinfo.json +3 -3
  57. package/dist/lib-cjs/index.d.ts +48 -48
  58. package/dist/lib-cjs/index.js +86 -86
  59. package/dist/webpack-stats.json +0 -0
  60. package/package.json +83 -83
  61. package/src/api/classes/animationInterface.ts +11 -11
  62. package/src/api/classes/dottedPath.ts +189 -189
  63. package/src/api/classes/element.ts +644 -644
  64. package/src/api/classes/event.ts +370 -370
  65. package/src/api/classes/eventBroadcaster.ts +54 -54
  66. package/src/api/classes/parameter.ts +408 -408
  67. package/src/api/classes/parameterObservable.ts +99 -99
  68. package/src/api/classes/parameterizable.ts +89 -89
  69. package/src/api/classes/placementAnimation.ts +143 -143
  70. package/src/api/classes/variant.ts +817 -817
  71. package/src/api/classes/variantInstance.ts +88 -88
  72. package/src/api/classes/variantParameterizable.ts +73 -73
  73. package/src/api/classes/viewer.ts +487 -478
  74. package/src/api/classes/viewerLight.ts +330 -330
  75. package/src/api/internal/debugViewer.ts +81 -81
  76. package/src/api/internal/lensRendering.ts +10 -10
  77. package/src/api/internal/sceneSetup.ts +193 -193
  78. package/src/api/manager/animationManager.ts +116 -116
  79. package/src/api/manager/sceneManager.ts +105 -105
  80. package/src/api/manager/variantInstanceManager.ts +236 -236
  81. package/src/api/store/specStorage.ts +53 -53
  82. package/src/api/util/babylonHelper.ts +555 -553
  83. package/src/api/util/globalTypes.ts +379 -379
  84. package/src/api/util/resourceHelper.ts +184 -184
  85. package/src/api/util/stringHelper.ts +25 -25
  86. package/src/buildinfo.json +2 -2
  87. package/src/commonjs.tsconfig.json +13 -13
  88. package/src/declaration.tsconfig.json +10 -10
  89. package/src/dev.ts +42 -42
  90. package/src/es6.tsconfig.json +13 -13
  91. package/src/index.ts +91 -91
  92. package/src/pagesconfig.json +61 -61
  93. package/src/tsconfig.json +43 -43
  94. package/src/tsconfig.types.json +9 -9
  95. package/src/types.d.ts +4 -4
@@ -1,191 +1,191 @@
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
76
- ? this.parts.join(DottedPath.DELIMITER)
77
- : '';
78
- },
79
- enumerable: false,
80
- configurable: true
81
- });
82
- Object.defineProperty(DottedPath.prototype, "firstPart", {
83
- /**
84
- * The first part.
85
- */
86
- get: function () {
87
- if (this.parts.length > 0) {
88
- return this.parts[0];
89
- }
90
- return null;
91
- },
92
- enumerable: false,
93
- configurable: true
94
- });
95
- Object.defineProperty(DottedPath.prototype, "lastPart", {
96
- /**
97
- * The last part.
98
- */
99
- get: function () {
100
- if (this.parts.length > 0) {
101
- return this.parts[this.parts.length - 1];
102
- }
103
- return null;
104
- },
105
- enumerable: false,
106
- configurable: true
107
- });
108
- Object.defineProperty(DottedPath.prototype, "leafTokens", {
109
- /**
110
- * Gets the tokens to each leaf of the DottedPath tree.
111
- * E.g. "part1.part2.part_3" will return an array like
112
- * ["part1", "part1.part2", "part1.part2.part_3"]
113
- */
114
- get: function () {
115
- var parents = [];
116
- return this.parts.map(function (part) {
117
- parents.push(part);
118
- return DottedPath.create(parents).path;
119
- });
120
- },
121
- enumerable: false,
122
- configurable: true
123
- });
124
- /**
125
- * Removes the first part and returns it.
126
- */
127
- DottedPath.prototype.shiftPart = function () {
128
- return this.parts.shift();
129
- };
130
- /**
131
- * Adds part to the beginning of parts list.
132
- */
133
- DottedPath.prototype.unshiftPart = function (part, duplicateCheck) {
134
- if (duplicateCheck === void 0) { duplicateCheck = false; }
135
- part = DottedPath.sanitizePart(part);
136
- if (duplicateCheck && this.firstPart === part) {
137
- return this;
138
- }
139
- this.parts.unshift(part);
140
- return this;
141
- };
142
- /**
143
- * Adds part to the end of parts list.
144
- * (i) Does not add a part if the last char already is the delimiter or if an empty string was passed.
145
- */
146
- DottedPath.prototype.addPart = function (part, duplicateCheck) {
147
- if (duplicateCheck === void 0) { duplicateCheck = false; }
148
- if (part.length < 1
149
- || this.lastPart === DottedPath.DELIMITER) {
150
- return this;
151
- }
152
- part = DottedPath.sanitizePart(part);
153
- if (duplicateCheck && this.lastPart === part) {
154
- return this;
155
- }
156
- this.parts.push(part);
157
- return this;
158
- };
159
- /**
160
- * Adds multiple parts to the end of parts list.
161
- */
162
- DottedPath.prototype.addParts = function (parts, duplicateCheck) {
163
- var _this = this;
164
- if (duplicateCheck === void 0) { duplicateCheck = false; }
165
- parts.forEach(function (part) { return _this.addPart(part, duplicateCheck); });
166
- return this;
167
- };
168
- /**
169
- * Removes the last part and returns it.
170
- */
171
- DottedPath.prototype.popPart = function () {
172
- return this.parts.pop();
173
- };
174
- DottedPath.prototype.toString = function () {
175
- return this.path;
176
- };
177
- DottedPath.prototype.valueOf = function () {
178
- return this.path;
179
- };
180
- /**
181
- * Clones the DottedPath.
182
- */
183
- DottedPath.prototype.clone = function () {
184
- return DottedPath.createFromParts(this.parts);
185
- };
186
- DottedPath.DELIMITER = '.';
187
- DottedPath.SAFE_CHAR = '·';
188
- return DottedPath;
189
- }());
190
- 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
76
+ ? this.parts.join(DottedPath.DELIMITER)
77
+ : '';
78
+ },
79
+ enumerable: false,
80
+ configurable: true
81
+ });
82
+ Object.defineProperty(DottedPath.prototype, "firstPart", {
83
+ /**
84
+ * The first part.
85
+ */
86
+ get: function () {
87
+ if (this.parts.length > 0) {
88
+ return this.parts[0];
89
+ }
90
+ return null;
91
+ },
92
+ enumerable: false,
93
+ configurable: true
94
+ });
95
+ Object.defineProperty(DottedPath.prototype, "lastPart", {
96
+ /**
97
+ * The last part.
98
+ */
99
+ get: function () {
100
+ if (this.parts.length > 0) {
101
+ return this.parts[this.parts.length - 1];
102
+ }
103
+ return null;
104
+ },
105
+ enumerable: false,
106
+ configurable: true
107
+ });
108
+ Object.defineProperty(DottedPath.prototype, "leafTokens", {
109
+ /**
110
+ * Gets the tokens to each leaf of the DottedPath tree.
111
+ * E.g. "part1.part2.part_3" will return an array like
112
+ * ["part1", "part1.part2", "part1.part2.part_3"]
113
+ */
114
+ get: function () {
115
+ var parents = [];
116
+ return this.parts.map(function (part) {
117
+ parents.push(part);
118
+ return DottedPath.create(parents).path;
119
+ });
120
+ },
121
+ enumerable: false,
122
+ configurable: true
123
+ });
124
+ /**
125
+ * Removes the first part and returns it.
126
+ */
127
+ DottedPath.prototype.shiftPart = function () {
128
+ return this.parts.shift();
129
+ };
130
+ /**
131
+ * Adds part to the beginning of parts list.
132
+ */
133
+ DottedPath.prototype.unshiftPart = function (part, duplicateCheck) {
134
+ if (duplicateCheck === void 0) { duplicateCheck = false; }
135
+ part = DottedPath.sanitizePart(part);
136
+ if (duplicateCheck && this.firstPart === part) {
137
+ return this;
138
+ }
139
+ this.parts.unshift(part);
140
+ return this;
141
+ };
142
+ /**
143
+ * Adds part to the end of parts list.
144
+ * (i) Does not add a part if the last char already is the delimiter or if an empty string was passed.
145
+ */
146
+ DottedPath.prototype.addPart = function (part, duplicateCheck) {
147
+ if (duplicateCheck === void 0) { duplicateCheck = false; }
148
+ if (part.length < 1
149
+ || this.lastPart === DottedPath.DELIMITER) {
150
+ return this;
151
+ }
152
+ part = DottedPath.sanitizePart(part);
153
+ if (duplicateCheck && this.lastPart === part) {
154
+ return this;
155
+ }
156
+ this.parts.push(part);
157
+ return this;
158
+ };
159
+ /**
160
+ * Adds multiple parts to the end of parts list.
161
+ */
162
+ DottedPath.prototype.addParts = function (parts, duplicateCheck) {
163
+ var _this = this;
164
+ if (duplicateCheck === void 0) { duplicateCheck = false; }
165
+ parts.forEach(function (part) { return _this.addPart(part, duplicateCheck); });
166
+ return this;
167
+ };
168
+ /**
169
+ * Removes the last part and returns it.
170
+ */
171
+ DottedPath.prototype.popPart = function () {
172
+ return this.parts.pop();
173
+ };
174
+ DottedPath.prototype.toString = function () {
175
+ return this.path;
176
+ };
177
+ DottedPath.prototype.valueOf = function () {
178
+ return this.path;
179
+ };
180
+ /**
181
+ * Clones the DottedPath.
182
+ */
183
+ DottedPath.prototype.clone = function () {
184
+ return DottedPath.createFromParts(this.parts);
185
+ };
186
+ DottedPath.DELIMITER = '.';
187
+ DottedPath.SAFE_CHAR = '·';
188
+ return DottedPath;
189
+ }());
190
+ exports.DottedPath = DottedPath;
191
191
  //# sourceMappingURL=dottedPath.js.map
@@ -1,130 +1,130 @@
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
- * @protected
60
- */
61
- set highlightLayer(layer: HighlightLayer | undefined);
62
- get highlightLayer(): HighlightLayer | undefined;
63
- /**
64
- * Destroys this {@link Element} and dispose all nodes.
65
- */
66
- destroy(): Element;
67
- /**
68
- * Gets a node by its {@link DottedPath}.
69
- */
70
- getNode(dottedPath: DottedPathArgument): TransformNode;
71
- /**
72
- * Gets a mesh by its {@link DottedPath}.
73
- */
74
- getMesh(dottedPath: DottedPathArgument): Promise<Mesh | null>;
75
- /**
76
- * Gets a {@link PaintableDefinition} by its name.
77
- */
78
- getPaintableDefinition(name: string): PaintableDefinition;
79
- /**
80
- * Gets a {@link TraceableDefinition} by its name.
81
- */
82
- getTraceableDefinition(name: string): TraceableDefinition;
83
- /**
84
- * Gets the paintable Node by its name.
85
- */
86
- getPaintableNode(name: string): TransformNode;
87
- /**
88
- * Gets the traceable Node by its name.
89
- */
90
- getTraceableNode(name: string): TransformNode;
91
- /**
92
- * @see {@link VariantParameterizable.commitParameters}
93
- * @emit {@link Event.ELEMENT_PARAMETER_COMMITTED}
94
- */
95
- commitParameters(parameters?: ParameterBag): Promise<VariantParameterizable>;
96
- /**
97
- * Adds an observer function for camera matrix changes.
98
- * The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
99
- */
100
- addTraceableObserver(traceable: string, observer: CallableFunction, payload?: any): Element;
101
- /**
102
- * Draws a `ImageBitmap` or `OffscreenCanvas` onto a `paintable` defined via {@link PaintableDefinition}.
103
- */
104
- drawPaintable(paintable: string, imageSource: CanvasImageSource): Element;
105
- /**
106
- * Draws a SVG string onto a `paintable` defined via {@link PaintableDefinition}.
107
- */
108
- drawPaintableFromSvg(paintable: string, svgSource: string): Promise<Element>;
109
- /**
110
- * Draws an Image from source (URL/URI) onto a `paintable` defined via {@link PaintableDefinition}.
111
- */
112
- drawPaintableFromImgSrc(paintable: string, imgSource: string): Promise<Element>;
113
- /**
114
- * Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
115
- */
116
- protected addParameterObservers(): Element;
117
- /**
118
- * Filter for nodes that are not defined or excluded in the `pathDefinitions`.
119
- */
120
- protected filterNode(node: TransformNode): boolean;
121
- /**
122
- * Asserts whether all {@link pathDefinitions} link to a valid `Node` path.
123
- * @protected
124
- */
125
- protected assertPathDefinitions(): void;
126
- /**
127
- * Handles callback for given light parameter.
128
- */
129
- private castShadowValueHandler;
130
- }
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
+ * @protected
60
+ */
61
+ set highlightLayer(layer: HighlightLayer | undefined);
62
+ get highlightLayer(): HighlightLayer | undefined;
63
+ /**
64
+ * Destroys this {@link Element} and dispose all nodes.
65
+ */
66
+ destroy(): Element;
67
+ /**
68
+ * Gets a node by its {@link DottedPath}.
69
+ */
70
+ getNode(dottedPath: DottedPathArgument): TransformNode;
71
+ /**
72
+ * Gets a mesh by its {@link DottedPath}.
73
+ */
74
+ getMesh(dottedPath: DottedPathArgument): Promise<Mesh | null>;
75
+ /**
76
+ * Gets a {@link PaintableDefinition} by its name.
77
+ */
78
+ getPaintableDefinition(name: string): PaintableDefinition;
79
+ /**
80
+ * Gets a {@link TraceableDefinition} by its name.
81
+ */
82
+ getTraceableDefinition(name: string): TraceableDefinition;
83
+ /**
84
+ * Gets the paintable Node by its name.
85
+ */
86
+ getPaintableNode(name: string): TransformNode;
87
+ /**
88
+ * Gets the traceable Node by its name.
89
+ */
90
+ getTraceableNode(name: string): TransformNode;
91
+ /**
92
+ * @see {@link VariantParameterizable.commitParameters}
93
+ * @emit {@link Event.ELEMENT_PARAMETER_COMMITTED}
94
+ */
95
+ commitParameters(parameters?: ParameterBag): Promise<VariantParameterizable>;
96
+ /**
97
+ * Adds an observer function for camera matrix changes.
98
+ * The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
99
+ */
100
+ addTraceableObserver(traceable: string, observer: CallableFunction, payload?: any): Element;
101
+ /**
102
+ * Draws a `ImageBitmap` or `OffscreenCanvas` onto a `paintable` defined via {@link PaintableDefinition}.
103
+ */
104
+ drawPaintable(paintable: string, imageSource: CanvasImageSource): Element;
105
+ /**
106
+ * Draws a SVG string onto a `paintable` defined via {@link PaintableDefinition}.
107
+ */
108
+ drawPaintableFromSvg(paintable: string, svgSource: string): Promise<Element>;
109
+ /**
110
+ * Draws an Image from source (URL/URI) onto a `paintable` defined via {@link PaintableDefinition}.
111
+ */
112
+ drawPaintableFromImgSrc(paintable: string, imgSource: string): Promise<Element>;
113
+ /**
114
+ * Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
115
+ */
116
+ protected addParameterObservers(): Element;
117
+ /**
118
+ * Filter for nodes that are not defined or excluded in the `pathDefinitions`.
119
+ */
120
+ protected filterNode(node: TransformNode): boolean;
121
+ /**
122
+ * Asserts whether all {@link pathDefinitions} link to a valid `Node` path.
123
+ * @protected
124
+ */
125
+ protected assertPathDefinitions(): void;
126
+ /**
127
+ * Handles callback for given light parameter.
128
+ */
129
+ private castShadowValueHandler;
130
+ }