@combeenation/3d-viewer 4.0.0-beta4 → 4.0.1-alpha1

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 (106) hide show
  1. package/README.md +114 -112
  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 -125
  7. package/dist/lib-cjs/api/classes/element.js +743 -682
  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 +326 -312
  12. package/dist/lib-cjs/api/classes/event.js +371 -357
  13. package/dist/lib-cjs/api/classes/event.js.map +1 -1
  14. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  15. package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
  16. package/dist/lib-cjs/api/classes/parameter.d.ts +259 -165
  17. package/dist/lib-cjs/api/classes/parameter.js +387 -267
  18. package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
  19. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  20. package/dist/lib-cjs/api/classes/parameterObservable.js +101 -126
  21. package/dist/lib-cjs/api/classes/parameterObservable.js.map +1 -1
  22. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
  23. package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
  24. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +43 -38
  25. package/dist/lib-cjs/api/classes/placementAnimation.js +160 -138
  26. package/dist/lib-cjs/api/classes/placementAnimation.js.map +1 -1
  27. package/dist/lib-cjs/api/classes/variant.d.ts +234 -190
  28. package/dist/lib-cjs/api/classes/variant.js +1147 -873
  29. package/dist/lib-cjs/api/classes/variant.js.map +1 -1
  30. package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -41
  31. package/dist/lib-cjs/api/classes/variantInstance.js +108 -98
  32. package/dist/lib-cjs/api/classes/variantInstance.js.map +1 -1
  33. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
  34. package/dist/lib-cjs/api/classes/variantParameterizable.js +92 -92
  35. package/dist/lib-cjs/api/classes/viewer.d.ts +131 -128
  36. package/dist/lib-cjs/api/classes/viewer.js +567 -486
  37. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  38. package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -65
  39. package/dist/lib-cjs/api/classes/viewerLight.js +389 -322
  40. package/dist/lib-cjs/api/classes/viewerLight.js.map +1 -1
  41. package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
  42. package/dist/lib-cjs/api/internal/debugViewer.js +87 -87
  43. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  44. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  45. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +10 -6
  46. package/dist/lib-cjs/api/internal/sceneSetup.js +231 -227
  47. package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
  48. package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
  49. package/dist/lib-cjs/api/manager/animationManager.js +121 -121
  50. package/dist/lib-cjs/api/manager/sceneManager.d.ts +32 -32
  51. package/dist/lib-cjs/api/manager/sceneManager.js +132 -132
  52. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +90 -90
  53. package/dist/lib-cjs/api/manager/variantInstanceManager.js +321 -321
  54. package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
  55. package/dist/lib-cjs/api/store/specStorage.js +51 -51
  56. package/dist/lib-cjs/api/util/babylonHelper.d.ts +175 -125
  57. package/dist/lib-cjs/api/util/babylonHelper.js +520 -368
  58. package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
  59. package/dist/lib-cjs/api/util/globalTypes.d.ts +333 -279
  60. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  61. package/dist/lib-cjs/api/util/resourceHelper.d.ts +53 -51
  62. package/dist/lib-cjs/api/util/resourceHelper.js +240 -243
  63. package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
  64. package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
  65. package/dist/lib-cjs/api/util/stringHelper.js +25 -25
  66. package/dist/lib-cjs/buildinfo.json +3 -3
  67. package/dist/lib-cjs/index.d.ts +48 -46
  68. package/dist/lib-cjs/index.js +86 -82
  69. package/dist/lib-cjs/index.js.map +1 -1
  70. package/package.json +83 -83
  71. package/src/api/classes/animationInterface.ts +11 -11
  72. package/src/api/classes/dottedPath.ts +189 -189
  73. package/src/api/classes/element.ts +644 -617
  74. package/src/api/classes/event.ts +370 -355
  75. package/src/api/classes/eventBroadcaster.ts +54 -54
  76. package/src/api/classes/parameter.ts +408 -277
  77. package/src/api/classes/parameterObservable.ts +99 -121
  78. package/src/api/classes/{elementParameterizable.ts → parameterizable.ts} +89 -78
  79. package/src/api/classes/placementAnimation.ts +157 -133
  80. package/src/api/classes/variant.ts +817 -670
  81. package/src/api/classes/variantInstance.ts +88 -81
  82. package/src/api/classes/variantParameterizable.ts +73 -0
  83. package/src/api/classes/viewer.ts +487 -421
  84. package/src/api/classes/viewerLight.ts +330 -0
  85. package/src/api/internal/debugViewer.ts +81 -81
  86. package/src/api/internal/lensRendering.ts +10 -10
  87. package/src/api/internal/sceneSetup.ts +194 -204
  88. package/src/api/manager/animationManager.ts +116 -116
  89. package/src/api/manager/sceneManager.ts +105 -105
  90. package/src/api/manager/variantInstanceManager.ts +236 -236
  91. package/src/api/store/specStorage.ts +53 -53
  92. package/src/api/util/babylonHelper.ts +555 -392
  93. package/src/api/util/globalTypes.ts +380 -319
  94. package/src/api/util/resourceHelper.ts +184 -187
  95. package/src/api/util/stringHelper.ts +26 -0
  96. package/src/buildinfo.json +2 -2
  97. package/src/commonjs.tsconfig.json +13 -13
  98. package/src/declaration.tsconfig.json +10 -10
  99. package/src/dev.ts +42 -46
  100. package/src/es6.tsconfig.json +13 -13
  101. package/src/index.ts +91 -87
  102. package/src/pagesconfig.json +61 -57
  103. package/src/tsconfig.json +43 -43
  104. package/src/tsconfig.types.json +9 -9
  105. package/src/types.d.ts +4 -4
  106. package/dist/webpack-stats.json +0 -0
@@ -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,125 +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 { 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
- }
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
+ }