@combeenation/3d-viewer 3.1.1-alpha7 → 3.1.2

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 (94) hide show
  1. package/README.md +111 -111
  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 +125 -126
  7. package/dist/lib-cjs/api/classes/element.js +678 -674
  8. package/dist/lib-cjs/api/classes/element.js.map +1 -1
  9. package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -14
  10. package/dist/lib-cjs/api/classes/elementParameterizable.js +134 -134
  11. package/dist/lib-cjs/api/classes/event.d.ts +312 -312
  12. package/dist/lib-cjs/api/classes/event.js +357 -357
  13. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  14. package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
  15. package/dist/lib-cjs/api/classes/parameter.d.ts +165 -165
  16. package/dist/lib-cjs/api/classes/parameter.js +267 -267
  17. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  18. package/dist/lib-cjs/api/classes/parameterObservable.js +126 -126
  19. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
  20. package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
  21. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +38 -38
  22. package/dist/lib-cjs/api/classes/placementAnimation.js +138 -138
  23. package/dist/lib-cjs/api/classes/variant.d.ts +180 -190
  24. package/dist/lib-cjs/api/classes/variant.js +863 -873
  25. package/dist/lib-cjs/api/classes/variant.js.map +1 -1
  26. package/dist/lib-cjs/api/classes/variantInstance.d.ts +41 -41
  27. package/dist/lib-cjs/api/classes/variantInstance.js +98 -98
  28. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
  29. package/dist/lib-cjs/api/classes/variantParameterizable.js +92 -92
  30. package/dist/lib-cjs/api/classes/viewer.d.ts +128 -128
  31. package/dist/lib-cjs/api/classes/viewer.js +486 -486
  32. package/dist/lib-cjs/api/classes/viewerLight.d.ts +65 -66
  33. package/dist/lib-cjs/api/classes/viewerLight.js +322 -389
  34. package/dist/lib-cjs/api/classes/viewerLight.js.map +1 -1
  35. package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
  36. package/dist/lib-cjs/api/internal/debugViewer.js +87 -87
  37. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  38. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  39. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +6 -6
  40. package/dist/lib-cjs/api/internal/sceneSetup.js +227 -227
  41. package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
  42. package/dist/lib-cjs/api/manager/animationManager.js +121 -121
  43. package/dist/lib-cjs/api/manager/sceneManager.d.ts +32 -32
  44. package/dist/lib-cjs/api/manager/sceneManager.js +132 -132
  45. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +90 -90
  46. package/dist/lib-cjs/api/manager/variantInstanceManager.js +321 -321
  47. package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
  48. package/dist/lib-cjs/api/store/specStorage.js +51 -51
  49. package/dist/lib-cjs/api/util/babylonHelper.d.ts +125 -125
  50. package/dist/lib-cjs/api/util/babylonHelper.js +368 -368
  51. package/dist/lib-cjs/api/util/globalTypes.d.ts +275 -275
  52. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  53. package/dist/lib-cjs/api/util/resourceHelper.d.ts +30 -30
  54. package/dist/lib-cjs/api/util/resourceHelper.js +247 -203
  55. package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
  56. package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
  57. package/dist/lib-cjs/api/util/stringHelper.js +25 -25
  58. package/dist/lib-cjs/buildinfo.json +3 -3
  59. package/dist/lib-cjs/index.d.ts +46 -46
  60. package/dist/lib-cjs/index.js +82 -82
  61. package/dist/webpack-stats.json +0 -0
  62. package/package.json +83 -83
  63. package/src/api/classes/animationInterface.ts +11 -11
  64. package/src/api/classes/dottedPath.ts +189 -189
  65. package/src/api/classes/element.ts +608 -606
  66. package/src/api/classes/elementParameterizable.ts +78 -78
  67. package/src/api/classes/event.ts +355 -355
  68. package/src/api/classes/eventBroadcaster.ts +54 -54
  69. package/src/api/classes/parameter.ts +277 -277
  70. package/src/api/classes/parameterObservable.ts +121 -121
  71. package/src/api/classes/placementAnimation.ts +133 -133
  72. package/src/api/classes/variant.ts +659 -670
  73. package/src/api/classes/variantInstance.ts +81 -81
  74. package/src/api/classes/viewer.ts +421 -421
  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 +203 -203
  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 +392 -392
  83. package/src/api/util/globalTypes.ts +314 -314
  84. package/src/api/util/resourceHelper.ts +168 -155
  85. package/src/buildinfo.json +2 -2
  86. package/src/commonjs.tsconfig.json +13 -13
  87. package/src/declaration.tsconfig.json +10 -10
  88. package/src/dev.ts +44 -46
  89. package/src/es6.tsconfig.json +13 -13
  90. package/src/index.ts +87 -87
  91. package/src/pagesconfig.json +47 -47
  92. package/src/tsconfig.json +43 -43
  93. package/src/tsconfig.types.json +9 -9
  94. 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,126 +1,125 @@
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 { DottedPath } from './dottedPath';
5
- import { ElementParameterizable } from './elementParameterizable';
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 ElementParameterizable {
15
- readonly variant: Variant;
16
- readonly name: string;
17
- protected readonly _dottedNodes: Map<DottedPath, TransformNode>;
18
- protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
19
- protected _highlightLayer?: HighlightLayer;
20
- protected _paintableTextureId: number;
21
- readonly nodes: TransformNode[];
22
- /**
23
- * Constructor.
24
- */
25
- constructor(variant: Variant, name: string);
26
- /**
27
- * The {@link DottedPath} in the built tree of {@link Element}s.
28
- * E.g. "_.top-1.sub-2.sub-sub-3.el-1"
29
- */
30
- get dottedPath(): DottedPath;
31
- /**
32
- * The id representing a {@link DottedPath}.
33
- */
34
- get id(): string;
35
- /**
36
- * The {@link ElementDefinition} of the {@link Element}.
37
- */
38
- get definition(): ElementDefinition;
39
- /**
40
- * The {@link PathDefinitions} of the {@link Element}.
41
- */
42
- get pathDefinitions(): PathDefinitions;
43
- /**
44
- * The {@link TraceableDefinitions} of the {@link Element}.
45
- */
46
- get traceableDefinitions(): TraceableDefinitions;
47
- /**
48
- * The {@link PaintableDefinition} of the {@link Element}.
49
- */
50
- get paintableDefinitions(): PaintableDefinitions;
51
- /**
52
- * The inherited {@link ParameterBag}.
53
- * Merges the {@link Variant}'s parameters and those from the {@link Element}.
54
- */
55
- get inheritedParameters(): ParameterBag;
56
- /**
57
- * @protected
58
- */
59
- set highlightLayer(layer: HighlightLayer | undefined);
60
- get highlightLayer(): HighlightLayer | undefined;
61
- /**
62
- * Destroys this {@link Element} and dispose all nodes.
63
- */
64
- destroy(): Element;
65
- /**
66
- * Gets a node by its {@link DottedPath}.
67
- */
68
- getNode(dottedPath: DottedPathArgument): TransformNode;
69
- /**
70
- * Gets a mesh by its {@link DottedPath}.
71
- */
72
- getMesh(dottedPath: DottedPathArgument): Promise<Mesh | null>;
73
- /**
74
- * Gets a {@link PaintableDefinition} by its name.
75
- */
76
- getPaintableDefinition(name: string): PaintableDefinition;
77
- /**
78
- * Gets a {@link TraceableDefinition} by its name.
79
- */
80
- getTraceableDefinition(name: string): TraceableDefinition;
81
- /**
82
- * Gets the paintable Node by its name.
83
- */
84
- getPaintableNode(name: string): TransformNode;
85
- /**
86
- * Gets the traceable Node by its name.
87
- */
88
- getTraceableNode(name: string): TransformNode;
89
- /**
90
- * Places the given {@link ParameterBag} in the {@link Element}'s parameters, replaces all patterns in the
91
- * {@link StructureJson} and broadcasts all {@link ParameterObserver}s.
92
- *
93
- * @emit {@link Event.ELEMENT_PARAMETER_COMMITTED}
94
- */
95
- commitParameters(parameters?: ParameterBag): Promise<Element>;
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 image onto a `paintable` defined via {@link PaintableDefinition}.
103
- */
104
- drawPaintable(paintable: string, imageSource: string): Promise<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
- }
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 { DottedPath } from './dottedPath';
5
+ import { ElementParameterizable } from './elementParameterizable';
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 ElementParameterizable {
15
+ readonly variant: Variant;
16
+ readonly name: string;
17
+ protected readonly _dottedNodes: Map<DottedPath, TransformNode>;
18
+ protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
19
+ protected _highlightLayer?: HighlightLayer;
20
+ readonly nodes: TransformNode[];
21
+ /**
22
+ * Constructor.
23
+ */
24
+ constructor(variant: Variant, name: string);
25
+ /**
26
+ * The {@link DottedPath} in the built tree of {@link Element}s.
27
+ * E.g. "_.top-1.sub-2.sub-sub-3.el-1"
28
+ */
29
+ get dottedPath(): DottedPath;
30
+ /**
31
+ * The id representing a {@link DottedPath}.
32
+ */
33
+ get id(): string;
34
+ /**
35
+ * The {@link ElementDefinition} of the {@link Element}.
36
+ */
37
+ get definition(): ElementDefinition;
38
+ /**
39
+ * The {@link PathDefinitions} of the {@link Element}.
40
+ */
41
+ get pathDefinitions(): PathDefinitions;
42
+ /**
43
+ * The {@link TraceableDefinitions} of the {@link Element}.
44
+ */
45
+ get traceableDefinitions(): TraceableDefinitions;
46
+ /**
47
+ * The {@link PaintableDefinition} of the {@link Element}.
48
+ */
49
+ get paintableDefinitions(): PaintableDefinitions;
50
+ /**
51
+ * The inherited {@link ParameterBag}.
52
+ * Merges the {@link Variant}'s parameters and those from the {@link Element}.
53
+ */
54
+ get inheritedParameters(): ParameterBag;
55
+ /**
56
+ * @protected
57
+ */
58
+ set highlightLayer(layer: HighlightLayer | undefined);
59
+ get highlightLayer(): HighlightLayer | undefined;
60
+ /**
61
+ * Destroys this {@link Element} and dispose all nodes.
62
+ */
63
+ destroy(): Element;
64
+ /**
65
+ * Gets a node by its {@link DottedPath}.
66
+ */
67
+ getNode(dottedPath: DottedPathArgument): TransformNode;
68
+ /**
69
+ * Gets a mesh by its {@link DottedPath}.
70
+ */
71
+ getMesh(dottedPath: DottedPathArgument): Promise<Mesh | null>;
72
+ /**
73
+ * Gets a {@link PaintableDefinition} by its name.
74
+ */
75
+ getPaintableDefinition(name: string): PaintableDefinition;
76
+ /**
77
+ * Gets a {@link TraceableDefinition} by its name.
78
+ */
79
+ getTraceableDefinition(name: string): TraceableDefinition;
80
+ /**
81
+ * Gets the paintable Node by its name.
82
+ */
83
+ getPaintableNode(name: string): TransformNode;
84
+ /**
85
+ * Gets the traceable Node by its name.
86
+ */
87
+ getTraceableNode(name: string): TransformNode;
88
+ /**
89
+ * Places the given {@link ParameterBag} in the {@link Element}'s parameters, replaces all patterns in the
90
+ * {@link StructureJson} and broadcasts all {@link ParameterObserver}s.
91
+ *
92
+ * @emit {@link Event.ELEMENT_PARAMETER_COMMITTED}
93
+ */
94
+ commitParameters(parameters?: ParameterBag): Promise<Element>;
95
+ /**
96
+ * Adds an observer function for camera matrix changes.
97
+ * The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
98
+ */
99
+ addTraceableObserver(traceable: string, observer: CallableFunction, payload?: any): Element;
100
+ /**
101
+ * Draws a `ImageBitmap` or `OffscreenCanvas` onto a `paintable` defined via {@link PaintableDefinition}.
102
+ */
103
+ drawPaintable(paintable: string, imageSource: CanvasImageSource): Element;
104
+ /**
105
+ * Draws a SVG string onto a `paintable` defined via {@link PaintableDefinition}.
106
+ */
107
+ drawPaintableFromSvg(paintable: string, svgSource: string): Promise<Element>;
108
+ /**
109
+ * Draws an Image from source (URL/URI) onto a `paintable` defined via {@link PaintableDefinition}.
110
+ */
111
+ drawPaintableFromImgSrc(paintable: string, imgSource: string): Promise<Element>;
112
+ /**
113
+ * Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
114
+ */
115
+ protected addParameterObservers(): Element;
116
+ /**
117
+ * Filter for nodes that are not defined or excluded in the `pathDefinitions`.
118
+ */
119
+ protected filterNode(node: TransformNode): boolean;
120
+ /**
121
+ * Asserts whether all {@link pathDefinitions} link to a valid `Node` path.
122
+ * @protected
123
+ */
124
+ protected assertPathDefinitions(): void;
125
+ }