@vertexvis/viewer 0.18.1 → 0.18.2-testing.0

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 (226) hide show
  1. package/dist/components/_commonjsHelpers.js +41 -0
  2. package/dist/components/_commonjsHelpers.js.map +1 -0
  3. package/dist/components/browser.esm.js +3173 -0
  4. package/dist/components/browser.esm.js.map +1 -0
  5. package/dist/components/bundle.esm.js +2250 -0
  6. package/dist/components/bundle.esm.js.map +1 -0
  7. package/dist/components/bundle.esm2.js +39740 -0
  8. package/dist/components/bundle.esm2.js.map +1 -0
  9. package/dist/components/config.js +81 -0
  10. package/dist/components/config.js.map +1 -0
  11. package/dist/components/controller.js +7627 -0
  12. package/dist/components/controller.js.map +1 -0
  13. package/dist/components/controller2.js +124 -0
  14. package/dist/components/controller2.js.map +1 -0
  15. package/dist/components/controller3.js +111 -0
  16. package/dist/components/controller3.js.map +1 -0
  17. package/dist/components/cursors.js +110 -0
  18. package/dist/components/cursors.js.map +1 -0
  19. package/dist/components/dom.js +43 -0
  20. package/dist/components/dom.js.map +1 -0
  21. package/dist/components/dom2.js +10 -0
  22. package/dist/components/dom2.js.map +1 -0
  23. package/dist/components/elementRectObserver.js +25 -0
  24. package/dist/components/elementRectObserver.js.map +1 -0
  25. package/dist/components/entities.js +179 -0
  26. package/dist/components/entities.js.map +1 -0
  27. package/dist/components/errors.js +80 -0
  28. package/dist/components/errors.js.map +1 -0
  29. package/dist/components/events.js +11 -0
  30. package/dist/components/events.js.map +1 -0
  31. package/dist/components/index.d.ts +26 -0
  32. package/dist/components/index.js +365 -0
  33. package/dist/components/index.js.map +1 -0
  34. package/dist/components/index2.js +63 -0
  35. package/dist/components/index2.js.map +1 -0
  36. package/dist/components/interactions.js +236 -0
  37. package/dist/components/interactions.js.map +1 -0
  38. package/dist/components/mapper.js +9811 -0
  39. package/dist/components/mapper.js.map +1 -0
  40. package/dist/components/markup.js +33 -0
  41. package/dist/components/markup.js.map +1 -0
  42. package/dist/components/model.js +134 -0
  43. package/dist/components/model.js.map +1 -0
  44. package/dist/components/model2.js +157 -0
  45. package/dist/components/model2.js.map +1 -0
  46. package/dist/components/overlays.js +76 -0
  47. package/dist/components/overlays.js.map +1 -0
  48. package/dist/components/png-decoder.js +2405 -0
  49. package/dist/components/png-decoder.js.map +1 -0
  50. package/dist/components/regl-component.js +12582 -0
  51. package/dist/components/regl-component.js.map +1 -0
  52. package/dist/components/results.js +24 -0
  53. package/dist/components/results.js.map +1 -0
  54. package/dist/components/row.js +32 -0
  55. package/dist/components/row.js.map +1 -0
  56. package/dist/components/scene-tree-search.js +146 -0
  57. package/dist/components/scene-tree-search.js.map +1 -0
  58. package/dist/components/scene-tree-table-layout.js +928 -0
  59. package/dist/components/scene-tree-table-layout.js.map +1 -0
  60. package/dist/components/scene-tree-toolbar.js +35 -0
  61. package/dist/components/scene-tree-toolbar.js.map +1 -0
  62. package/dist/components/scene.js +1508 -0
  63. package/dist/components/scene.js.map +1 -0
  64. package/dist/components/stencil.js +25 -0
  65. package/dist/components/stencil.js.map +1 -0
  66. package/dist/components/streamAttributes.js +40833 -0
  67. package/dist/components/streamAttributes.js.map +1 -0
  68. package/dist/components/templates.js +36 -0
  69. package/dist/components/templates.js.map +1 -0
  70. package/dist/components/tslib.es6.js +125 -0
  71. package/dist/components/tslib.es6.js.map +1 -0
  72. package/dist/components/vertex-scene-tree-search.d.ts +11 -0
  73. package/dist/components/vertex-scene-tree-search.js +11 -0
  74. package/dist/components/vertex-scene-tree-search.js.map +1 -0
  75. package/dist/components/vertex-scene-tree-table-cell.d.ts +11 -0
  76. package/dist/components/vertex-scene-tree-table-cell.js +209 -0
  77. package/dist/components/vertex-scene-tree-table-cell.js.map +1 -0
  78. package/dist/components/vertex-scene-tree-table-column.d.ts +11 -0
  79. package/dist/components/vertex-scene-tree-table-column.js +42 -0
  80. package/dist/components/vertex-scene-tree-table-column.js.map +1 -0
  81. package/dist/components/vertex-scene-tree-table-header.d.ts +11 -0
  82. package/dist/components/vertex-scene-tree-table-header.js +38 -0
  83. package/dist/components/vertex-scene-tree-table-header.js.map +1 -0
  84. package/dist/components/vertex-scene-tree-table-layout.d.ts +11 -0
  85. package/dist/components/vertex-scene-tree-table-layout.js +11 -0
  86. package/dist/components/vertex-scene-tree-table-layout.js.map +1 -0
  87. package/dist/components/vertex-scene-tree-table-resize-divider.d.ts +11 -0
  88. package/dist/components/vertex-scene-tree-table-resize-divider.js +57 -0
  89. package/dist/components/vertex-scene-tree-table-resize-divider.js.map +1 -0
  90. package/dist/components/vertex-scene-tree-toolbar-group.d.ts +11 -0
  91. package/dist/components/vertex-scene-tree-toolbar-group.js +38 -0
  92. package/dist/components/vertex-scene-tree-toolbar-group.js.map +1 -0
  93. package/dist/components/vertex-scene-tree-toolbar.d.ts +11 -0
  94. package/dist/components/vertex-scene-tree-toolbar.js +11 -0
  95. package/dist/components/vertex-scene-tree-toolbar.js.map +1 -0
  96. package/dist/components/vertex-scene-tree.d.ts +11 -0
  97. package/dist/components/vertex-scene-tree.js +803 -0
  98. package/dist/components/vertex-scene-tree.js.map +1 -0
  99. package/dist/components/vertex-viewer-box-query-tool.d.ts +11 -0
  100. package/dist/components/vertex-viewer-box-query-tool.js +352 -0
  101. package/dist/components/vertex-viewer-box-query-tool.js.map +1 -0
  102. package/dist/components/vertex-viewer-button.d.ts +11 -0
  103. package/dist/components/vertex-viewer-button.js +11 -0
  104. package/dist/components/vertex-viewer-button.js.map +1 -0
  105. package/dist/components/vertex-viewer-default-toolbar.d.ts +11 -0
  106. package/dist/components/vertex-viewer-default-toolbar.js +99 -0
  107. package/dist/components/vertex-viewer-default-toolbar.js.map +1 -0
  108. package/dist/components/vertex-viewer-dom-element.d.ts +11 -0
  109. package/dist/components/vertex-viewer-dom-element.js +11 -0
  110. package/dist/components/vertex-viewer-dom-element.js.map +1 -0
  111. package/dist/components/vertex-viewer-dom-group.d.ts +11 -0
  112. package/dist/components/vertex-viewer-dom-group.js +11 -0
  113. package/dist/components/vertex-viewer-dom-group.js.map +1 -0
  114. package/dist/components/vertex-viewer-dom-renderer.d.ts +11 -0
  115. package/dist/components/vertex-viewer-dom-renderer.js +11 -0
  116. package/dist/components/vertex-viewer-dom-renderer.js.map +1 -0
  117. package/dist/components/vertex-viewer-hit-result-indicator.d.ts +11 -0
  118. package/dist/components/vertex-viewer-hit-result-indicator.js +335 -0
  119. package/dist/components/vertex-viewer-hit-result-indicator.js.map +1 -0
  120. package/dist/components/vertex-viewer-icon.d.ts +11 -0
  121. package/dist/components/vertex-viewer-icon.js +11 -0
  122. package/dist/components/vertex-viewer-icon.js.map +1 -0
  123. package/dist/components/vertex-viewer-layer.d.ts +11 -0
  124. package/dist/components/vertex-viewer-layer.js +11 -0
  125. package/dist/components/vertex-viewer-layer.js.map +1 -0
  126. package/dist/components/vertex-viewer-markup-arrow.d.ts +11 -0
  127. package/dist/components/vertex-viewer-markup-arrow.js +11 -0
  128. package/dist/components/vertex-viewer-markup-arrow.js.map +1 -0
  129. package/dist/components/vertex-viewer-markup-circle.d.ts +11 -0
  130. package/dist/components/vertex-viewer-markup-circle.js +11 -0
  131. package/dist/components/vertex-viewer-markup-circle.js.map +1 -0
  132. package/dist/components/vertex-viewer-markup-freeform.d.ts +11 -0
  133. package/dist/components/vertex-viewer-markup-freeform.js +11 -0
  134. package/dist/components/vertex-viewer-markup-freeform.js.map +1 -0
  135. package/dist/components/vertex-viewer-markup-tool.d.ts +11 -0
  136. package/dist/components/vertex-viewer-markup-tool.js +257 -0
  137. package/dist/components/vertex-viewer-markup-tool.js.map +1 -0
  138. package/dist/components/vertex-viewer-markup.d.ts +11 -0
  139. package/dist/components/vertex-viewer-markup.js +362 -0
  140. package/dist/components/vertex-viewer-markup.js.map +1 -0
  141. package/dist/components/vertex-viewer-measurement-details.d.ts +11 -0
  142. package/dist/components/vertex-viewer-measurement-details.js +307 -0
  143. package/dist/components/vertex-viewer-measurement-details.js.map +1 -0
  144. package/dist/components/vertex-viewer-measurement-distance.d.ts +11 -0
  145. package/dist/components/vertex-viewer-measurement-distance.js +1067 -0
  146. package/dist/components/vertex-viewer-measurement-distance.js.map +1 -0
  147. package/dist/components/vertex-viewer-measurement-line.d.ts +11 -0
  148. package/dist/components/vertex-viewer-measurement-line.js +11 -0
  149. package/dist/components/vertex-viewer-measurement-line.js.map +1 -0
  150. package/dist/components/vertex-viewer-measurement-overlays.d.ts +11 -0
  151. package/dist/components/vertex-viewer-measurement-overlays.js +11 -0
  152. package/dist/components/vertex-viewer-measurement-overlays.js.map +1 -0
  153. package/dist/components/vertex-viewer-measurement-precise.d.ts +11 -0
  154. package/dist/components/vertex-viewer-measurement-precise.js +362 -0
  155. package/dist/components/vertex-viewer-measurement-precise.js.map +1 -0
  156. package/dist/components/vertex-viewer-pin-group.d.ts +11 -0
  157. package/dist/components/vertex-viewer-pin-group.js +11 -0
  158. package/dist/components/vertex-viewer-pin-group.js.map +1 -0
  159. package/dist/components/vertex-viewer-pin-label-line.d.ts +11 -0
  160. package/dist/components/vertex-viewer-pin-label-line.js +11 -0
  161. package/dist/components/vertex-viewer-pin-label-line.js.map +1 -0
  162. package/dist/components/vertex-viewer-pin-label.d.ts +11 -0
  163. package/dist/components/vertex-viewer-pin-label.js +11 -0
  164. package/dist/components/vertex-viewer-pin-label.js.map +1 -0
  165. package/dist/components/vertex-viewer-pin-tool.d.ts +11 -0
  166. package/dist/components/vertex-viewer-pin-tool.js +430 -0
  167. package/dist/components/vertex-viewer-pin-tool.js.map +1 -0
  168. package/dist/components/vertex-viewer-spinner.d.ts +11 -0
  169. package/dist/components/vertex-viewer-spinner.js +11 -0
  170. package/dist/components/vertex-viewer-spinner.js.map +1 -0
  171. package/dist/components/vertex-viewer-toolbar-group.d.ts +11 -0
  172. package/dist/components/vertex-viewer-toolbar-group.js +11 -0
  173. package/dist/components/vertex-viewer-toolbar-group.js.map +1 -0
  174. package/dist/components/vertex-viewer-toolbar.d.ts +11 -0
  175. package/dist/components/vertex-viewer-toolbar.js +11 -0
  176. package/dist/components/vertex-viewer-toolbar.js.map +1 -0
  177. package/dist/components/vertex-viewer-transform-widget.d.ts +11 -0
  178. package/dist/components/vertex-viewer-transform-widget.js +838 -0
  179. package/dist/components/vertex-viewer-transform-widget.js.map +1 -0
  180. package/dist/components/vertex-viewer-view-cube.d.ts +11 -0
  181. package/dist/components/vertex-viewer-view-cube.js +270 -0
  182. package/dist/components/vertex-viewer-view-cube.js.map +1 -0
  183. package/dist/components/vertex-viewer.d.ts +11 -0
  184. package/dist/components/vertex-viewer.js +3543 -0
  185. package/dist/components/vertex-viewer.js.map +1 -0
  186. package/dist/components/viewer-button.js +35 -0
  187. package/dist/components/viewer-button.js.map +1 -0
  188. package/dist/components/viewer-dom-element.js +250 -0
  189. package/dist/components/viewer-dom-element.js.map +1 -0
  190. package/dist/components/viewer-dom-group.js +214 -0
  191. package/dist/components/viewer-dom-group.js.map +1 -0
  192. package/dist/components/viewer-dom-renderer.js +295 -0
  193. package/dist/components/viewer-dom-renderer.js.map +1 -0
  194. package/dist/components/viewer-icon.js +87 -0
  195. package/dist/components/viewer-icon.js.map +1 -0
  196. package/dist/components/viewer-layer.js +46 -0
  197. package/dist/components/viewer-layer.js.map +1 -0
  198. package/dist/components/viewer-markup-arrow.js +235 -0
  199. package/dist/components/viewer-markup-arrow.js.map +1 -0
  200. package/dist/components/viewer-markup-circle-components.js +42 -0
  201. package/dist/components/viewer-markup-circle-components.js.map +1 -0
  202. package/dist/components/viewer-markup-circle.js +201 -0
  203. package/dist/components/viewer-markup-circle.js.map +1 -0
  204. package/dist/components/viewer-markup-freeform.js +251 -0
  205. package/dist/components/viewer-markup-freeform.js.map +1 -0
  206. package/dist/components/viewer-measurement-line.js +77 -0
  207. package/dist/components/viewer-measurement-line.js.map +1 -0
  208. package/dist/components/viewer-measurement-overlays.js +184 -0
  209. package/dist/components/viewer-measurement-overlays.js.map +1 -0
  210. package/dist/components/viewer-pin-group.js +207 -0
  211. package/dist/components/viewer-pin-group.js.map +1 -0
  212. package/dist/components/viewer-pin-label-line.js +43 -0
  213. package/dist/components/viewer-pin-label-line.js.map +1 -0
  214. package/dist/components/viewer-pin-label.js +427 -0
  215. package/dist/components/viewer-pin-label.js.map +1 -0
  216. package/dist/components/viewer-spinner.js +53 -0
  217. package/dist/components/viewer-spinner.js.map +1 -0
  218. package/dist/components/viewer-toolbar-group.js +42 -0
  219. package/dist/components/viewer-toolbar-group.js.map +1 -0
  220. package/dist/components/viewer-toolbar.js +61 -0
  221. package/dist/components/viewer-toolbar.js.map +1 -0
  222. package/dist/components/viewport.js +188 -0
  223. package/dist/components/viewport.js.map +1 -0
  224. package/dist/components/wrappers_pb.js +1926 -0
  225. package/dist/components/wrappers_pb.js.map +1 -0
  226. package/package.json +7 -7
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
+
6
+ const viewerButtonCss = ":host{cursor:pointer}.viewer-button{align-items:center;background:none;border:none;color:inherit;cursor:inherit;display:flex;padding:0}";
7
+
8
+ const ViewerButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.__registerHost();
12
+ this.__attachShadow();
13
+ }
14
+ render() {
15
+ return (h(Host, null, h("button", { class: "viewer-button" }, h("slot", null))));
16
+ }
17
+ static get style() { return viewerButtonCss; }
18
+ }, [1, "vertex-viewer-button"]);
19
+ function defineCustomElement() {
20
+ if (typeof customElements === "undefined") {
21
+ return;
22
+ }
23
+ const components = ["vertex-viewer-button"];
24
+ components.forEach(tagName => { switch (tagName) {
25
+ case "vertex-viewer-button":
26
+ if (!customElements.get(tagName)) {
27
+ customElements.define(tagName, ViewerButton);
28
+ }
29
+ break;
30
+ } });
31
+ }
32
+
33
+ export { ViewerButton as V, defineCustomElement as d };
34
+
35
+ //# sourceMappingURL=viewer-button.js.map
@@ -0,0 +1 @@
1
+ {"file":"viewer-button.js","mappings":";;;;;AAAA,MAAM,eAAe,GAAG,yIAAyI;;MCOpJ,YAAY;;;;;;EAChB,MAAM;IACX,QACE,EAAC,IAAI,QACH,cAAQ,KAAK,EAAC,eAAe,IAC3B,eAAa,CACN,CACJ,EACP;GACH;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/viewer-button/viewer-button.css?tag=vertex-viewer-button&encapsulation=shadow","./src/components/viewer-button/viewer-button.tsx"],"sourcesContent":[":host {\n cursor: pointer;\n}\n\n.viewer-button {\n align-items: center;\n background: none;\n border: none;\n color: inherit;\n cursor: inherit;\n display: flex;\n padding: 0;\n}\n","import { Component, h, Host } from '@stencil/core';\n\n@Component({\n tag: 'vertex-viewer-button',\n styleUrl: 'viewer-button.css',\n shadow: true,\n})\nexport class ViewerButton {\n public render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <button class=\"viewer-button\">\n <slot></slot>\n </button>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -0,0 +1,250 @@
1
+ /*!
2
+ * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { v as vector3, q as quaternion, m as matrix4, i as euler } from './bundle.esm.js';
6
+ import { o as objects } from './browser.esm.js';
7
+
8
+ const viewerDomElementCss = ":host{position:absolute;pointer-events:none;visibility:hidden}:host(.hydrated){visibility:hidden}:host(.ready){visibility:inherit}:host(:not([interactions-off]))>*{pointer-events:auto}";
9
+
10
+ const ViewerDomElement = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
11
+ constructor() {
12
+ super();
13
+ this.__registerHost();
14
+ this.__attachShadow();
15
+ this.propertyChange = createEvent(this, "propertyChange", 7);
16
+ /**
17
+ * The local 3D position of where this element is located.
18
+ */
19
+ this.position = vector3.origin();
20
+ /**
21
+ * The local 3D position of where this element is located, as a JSON string.
22
+ * JSON representation can either be in the format of `[x, y, z]` or `{"x": 0,
23
+ * "y": 0, "z": 0}`.
24
+ */
25
+ this.positionJson = '';
26
+ /**
27
+ * The local rotation of this element.
28
+ */
29
+ this.quaternion = quaternion.create();
30
+ /**
31
+ * The local quaternion rotation of this element, as a JSON string. JSON
32
+ * representation can either be `[x, y, z, w]` or `{"x": 0, "y": 0, "z":
33
+ * 0, "w": 1}`.
34
+ */
35
+ this.quaternionJson = '';
36
+ /**
37
+ * The local scale of this element.
38
+ */
39
+ this.scale = vector3.create(1, 1, 1);
40
+ /**
41
+ * The local scale of this element, as a JSON string. JSON string
42
+ * representation can either be in the format of `[x, y, z]` or `{"x": 0, "y":
43
+ * 0, "z": 0}`.
44
+ */
45
+ this.scaleJson = '';
46
+ /**
47
+ * The local matrix of this element.
48
+ */
49
+ this.matrix = matrix4.makeIdentity();
50
+ /**
51
+ * Disables occlusion testing for this element. Defaults to enabled. When
52
+ * enabled, the elements position will be tested against the current depth
53
+ * buffer. If the position is occluded, then the `occluded` attribute will be
54
+ * set.
55
+ */
56
+ this.occlusionOff = false;
57
+ /**
58
+ * Indicates if the element is hidden by geometry. This property can be used
59
+ * with a CSS selector to modify the appearance of the element when its
60
+ * occluded.
61
+ *
62
+ * @example
63
+ *
64
+ * ```html
65
+ * <style>
66
+ * vertex-viewer-dom-element[occluded] {
67
+ * opacity: 0;
68
+ * }
69
+ * </style>
70
+ * ```
71
+ */
72
+ this.occluded = false;
73
+ /**
74
+ * Disables the billboarding behavior of the element. When billboarding is
75
+ * enabled, the element will always be oriented towards the screen.
76
+ */
77
+ this.billboardOff = false;
78
+ /**
79
+ * Disables interaction events from children.
80
+ */
81
+ this.interactionsOff = false;
82
+ }
83
+ /**
84
+ * @ignore
85
+ */
86
+ handlePositionChange() {
87
+ this.syncMatrix();
88
+ }
89
+ /**
90
+ * @ignore
91
+ */
92
+ handlePositionJsonChanged() {
93
+ this.syncPosition();
94
+ }
95
+ /**
96
+ * @ignore
97
+ */
98
+ handleRotationChanged() {
99
+ this.syncQuaternionWithRotation();
100
+ }
101
+ /**
102
+ * @ignore
103
+ */
104
+ handleRotationJsonChanged() {
105
+ this.syncRotation();
106
+ }
107
+ /**
108
+ * @ignore
109
+ */
110
+ handleQuaternionChange() {
111
+ this.syncMatrix();
112
+ }
113
+ /**
114
+ * @ignore
115
+ */
116
+ handleQuaternionJsonChanged() {
117
+ this.syncQuaternion();
118
+ }
119
+ /**
120
+ * @ignore
121
+ */
122
+ handleScaleChange() {
123
+ this.syncMatrix();
124
+ }
125
+ /**
126
+ * @ignore
127
+ */
128
+ handleScaleJsonChanged() {
129
+ this.syncScale();
130
+ }
131
+ /**
132
+ * @ignore
133
+ */
134
+ handleMatrixChanged(newMatrix, oldMatrix) {
135
+ if (!objects.isEqual(newMatrix, oldMatrix)) {
136
+ this.propertyChange.emit();
137
+ }
138
+ }
139
+ /**
140
+ * @ignore
141
+ */
142
+ connectedCallback() {
143
+ this.syncProperties();
144
+ }
145
+ /**
146
+ * @ignore
147
+ */
148
+ componentShouldUpdate(newValue, oldValue, prop) {
149
+ return prop === 'occluded';
150
+ }
151
+ syncProperties() {
152
+ this.syncPosition();
153
+ this.syncRotation();
154
+ this.syncQuaternion();
155
+ this.syncScale();
156
+ this.syncMatrix();
157
+ }
158
+ syncPosition() {
159
+ this.position =
160
+ this.positionJson.length > 0
161
+ ? this.parseJson('positionJson', this.positionJson, vector3.fromJson)
162
+ : this.position;
163
+ }
164
+ syncRotation() {
165
+ this.rotation =
166
+ this.rotationJson != null && this.rotationJson.length > 0
167
+ ? this.parseJson('rotationJson', this.rotationJson, euler.fromJson)
168
+ : this.rotation;
169
+ this.syncQuaternionWithRotation();
170
+ }
171
+ syncQuaternionWithRotation() {
172
+ this.quaternion =
173
+ this.rotation != null
174
+ ? quaternion.fromEuler(this.rotation)
175
+ : this.quaternion;
176
+ }
177
+ syncQuaternion() {
178
+ this.quaternion =
179
+ this.quaternionJson.length > 0
180
+ ? this.parseJson('quaternionJson', this.quaternionJson, quaternion.fromJson)
181
+ : this.quaternion;
182
+ }
183
+ syncScale() {
184
+ this.scale =
185
+ this.scaleJson.length > 0
186
+ ? this.parseJson('scaleJson', this.scaleJson, vector3.fromJson)
187
+ : this.scale;
188
+ }
189
+ syncMatrix() {
190
+ this.matrix = matrix4.makeTRS(this.position, this.quaternion, this.scale);
191
+ }
192
+ parseJson(propName, value, parse) {
193
+ try {
194
+ return parse(value);
195
+ }
196
+ catch (e) {
197
+ console.warn(`Could not parse \`${propName}\`. Invalid JSON.`);
198
+ throw e;
199
+ }
200
+ }
201
+ /**
202
+ * @ignore
203
+ */
204
+ render() {
205
+ return (h(Host, null, h("slot", null)));
206
+ }
207
+ static get watchers() { return {
208
+ "position": ["handlePositionChange"],
209
+ "positionJson": ["handlePositionJsonChanged"],
210
+ "rotation": ["handleRotationChanged"],
211
+ "rotationJson": ["handleRotationJsonChanged"],
212
+ "quaternion": ["handleQuaternionChange"],
213
+ "quaternionJson": ["handleQuaternionJsonChanged"],
214
+ "scale": ["handleScaleChange"],
215
+ "scaleJson": ["handleScaleJsonChanged"],
216
+ "matrix": ["handleMatrixChanged"]
217
+ }; }
218
+ static get style() { return viewerDomElementCss; }
219
+ }, [1, "vertex-viewer-dom-element", {
220
+ "position": [1040],
221
+ "positionJson": [1, "position"],
222
+ "rotation": [1040],
223
+ "rotationJson": [1, "rotation"],
224
+ "quaternion": [1040],
225
+ "quaternionJson": [1, "quaternion"],
226
+ "scale": [1040],
227
+ "scaleJson": [1, "scale"],
228
+ "matrix": [1040],
229
+ "occlusionOff": [4, "occlusion-off"],
230
+ "occluded": [516],
231
+ "billboardOff": [4, "billboard-off"],
232
+ "interactionsOff": [516, "interactions-off"]
233
+ }]);
234
+ function defineCustomElement() {
235
+ if (typeof customElements === "undefined") {
236
+ return;
237
+ }
238
+ const components = ["vertex-viewer-dom-element"];
239
+ components.forEach(tagName => { switch (tagName) {
240
+ case "vertex-viewer-dom-element":
241
+ if (!customElements.get(tagName)) {
242
+ customElements.define(tagName, ViewerDomElement);
243
+ }
244
+ break;
245
+ } });
246
+ }
247
+
248
+ export { ViewerDomElement as V, defineCustomElement as d };
249
+
250
+ //# sourceMappingURL=viewer-dom-element.js.map
@@ -0,0 +1 @@
1
+ {"file":"viewer-dom-element.js","mappings":"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","names":["Vector3","Quaternion","Matrix4","Objects","Euler"],"sources":["./src/components/viewer-dom-element/viewer-dom-element.css?tag=vertex-viewer-dom-element&encapsulation=shadow","./src/components/viewer-dom-element/viewer-dom-element.tsx"],"sourcesContent":[":host {\n position: absolute;\n pointer-events: none;\n visibility: hidden;\n}\n\n/* Ignore Stencil's hydrated prop in favor of a custom `ready` selector. This\n * prevents flashing of elements before Stencil has a time to position the\n * element in 3D space.\n */\n:host(.hydrated) {\n visibility: hidden;\n}\n\n:host(.ready) {\n visibility: inherit;\n}\n\n:host(:not([interactions-off])) > * {\n pointer-events: auto;\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\n\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Euler, Matrix4, Quaternion, Vector3 } from '@vertexvis/geometry';\nimport { Objects } from '@vertexvis/utils';\n\nimport { HTMLDomRendererPositionableElement } from '../../interfaces';\n\n/**\n * The `ViewerDomElement` is responsible for managing a\n * `<vertex-viewer-dom-element>` element. These elements are intended to be\n * added as children to a `<vertex-viewer-dom-renderer>` and represent an\n * individual DOM element within a local 3D scene.\n */\n@Component({\n tag: 'vertex-viewer-dom-element',\n styleUrl: 'viewer-dom-element.css',\n shadow: true,\n})\nexport class ViewerDomElement implements HTMLDomRendererPositionableElement {\n /**\n * The local 3D position of where this element is located.\n */\n @Prop({ mutable: true, attribute: null })\n public position: Vector3.Vector3 = Vector3.origin();\n\n /**\n * @ignore\n */\n @Watch('position')\n protected handlePositionChange(): void {\n this.syncMatrix();\n }\n\n /**\n * The local 3D position of where this element is located, as a JSON string.\n * JSON representation can either be in the format of `[x, y, z]` or `{\"x\": 0,\n * \"y\": 0, \"z\": 0}`.\n */\n @Prop({ attribute: 'position' })\n public positionJson = '';\n\n /**\n * @ignore\n */\n @Watch('positionJson')\n protected handlePositionJsonChanged(): void {\n this.syncPosition();\n }\n\n /**\n * The local rotation of this element in Euler angles.\n */\n @Prop({ mutable: true, attribute: null })\n public rotation?: Euler.Euler;\n\n /**\n * @ignore\n */\n @Watch('rotation')\n protected handleRotationChanged(): void {\n this.syncQuaternionWithRotation();\n }\n\n /**\n * The local rotation of this element in Euler angles, as a JSON string. JSON\n * representation can either be `[x, y, z, order]` or `{\"x\": 0, \"y\": 0, \"z\":\n * 0, \"order\": \"xyz\"}`.\n */\n @Prop({ attribute: 'rotation' })\n public rotationJson?: string;\n\n /**\n * @ignore\n */\n @Watch('rotationJson')\n protected handleRotationJsonChanged(): void {\n this.syncRotation();\n }\n\n /**\n * The local rotation of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public quaternion: Quaternion.Quaternion = Quaternion.create();\n\n /**\n * @ignore\n */\n @Watch('quaternion')\n protected handleQuaternionChange(): void {\n this.syncMatrix();\n }\n\n /**\n * The local quaternion rotation of this element, as a JSON string. JSON\n * representation can either be `[x, y, z, w]` or `{\"x\": 0, \"y\": 0, \"z\":\n * 0, \"w\": 1}`.\n */\n @Prop({ attribute: 'quaternion' })\n public quaternionJson = '';\n\n /**\n * @ignore\n */\n @Watch('quaternionJson')\n protected handleQuaternionJsonChanged(): void {\n this.syncQuaternion();\n }\n\n /**\n * The local scale of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public scale: Vector3.Vector3 = Vector3.create(1, 1, 1);\n\n /**\n * @ignore\n */\n @Watch('scale')\n protected handleScaleChange(): void {\n this.syncMatrix();\n }\n\n /**\n * The local scale of this element, as a JSON string. JSON string\n * representation can either be in the format of `[x, y, z]` or `{\"x\": 0, \"y\":\n * 0, \"z\": 0}`.\n */\n @Prop({ attribute: 'scale' })\n public scaleJson = '';\n\n /**\n * @ignore\n */\n @Watch('scaleJson')\n protected handleScaleJsonChanged(): void {\n this.syncScale();\n }\n\n /**\n * @ignore\n */\n @Watch('matrix')\n protected handleMatrixChanged(\n newMatrix: Matrix4.Matrix4,\n oldMatrix: Matrix4.Matrix4\n ): void {\n if (!Objects.isEqual(newMatrix, oldMatrix)) {\n this.propertyChange.emit();\n }\n }\n\n /**\n * The local matrix of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public matrix: Matrix4.Matrix4 = Matrix4.makeIdentity();\n\n /**\n * Disables occlusion testing for this element. Defaults to enabled. When\n * enabled, the elements position will be tested against the current depth\n * buffer. If the position is occluded, then the `occluded` attribute will be\n * set.\n */\n @Prop()\n public occlusionOff = false;\n\n /**\n * Indicates if the element is hidden by geometry. This property can be used\n * with a CSS selector to modify the appearance of the element when its\n * occluded.\n *\n * @example\n *\n * ```html\n * <style>\n * vertex-viewer-dom-element[occluded] {\n * opacity: 0;\n * }\n * </style>\n * ```\n */\n @Prop({ reflect: true })\n public occluded = false;\n\n /**\n * Disables the billboarding behavior of the element. When billboarding is\n * enabled, the element will always be oriented towards the screen.\n */\n @Prop()\n public billboardOff = false;\n\n /**\n * Disables interaction events from children.\n */\n @Prop({ reflect: true })\n public interactionsOff = false;\n\n /**\n * An event that is emitted when any property on the dom group changes\n */\n @Event({ bubbles: true })\n public propertyChange!: EventEmitter<void>;\n\n /**\n * @ignore\n */\n protected connectedCallback(): void {\n this.syncProperties();\n }\n\n /**\n * @ignore\n */\n protected componentShouldUpdate(\n newValue: unknown,\n oldValue: unknown,\n prop: string\n ): boolean {\n return prop === 'occluded';\n }\n\n private syncProperties(): void {\n this.syncPosition();\n this.syncRotation();\n this.syncQuaternion();\n this.syncScale();\n this.syncMatrix();\n }\n\n private syncPosition(): void {\n this.position =\n this.positionJson.length > 0\n ? this.parseJson('positionJson', this.positionJson, Vector3.fromJson)\n : this.position;\n }\n\n private syncRotation(): void {\n this.rotation =\n this.rotationJson != null && this.rotationJson.length > 0\n ? this.parseJson('rotationJson', this.rotationJson, Euler.fromJson)\n : this.rotation;\n this.syncQuaternionWithRotation();\n }\n\n private syncQuaternionWithRotation(): void {\n this.quaternion =\n this.rotation != null\n ? Quaternion.fromEuler(this.rotation)\n : this.quaternion;\n }\n\n private syncQuaternion(): void {\n this.quaternion =\n this.quaternionJson.length > 0\n ? this.parseJson(\n 'quaternionJson',\n this.quaternionJson,\n Quaternion.fromJson\n )\n : this.quaternion;\n }\n\n private syncScale(): void {\n this.scale =\n this.scaleJson.length > 0\n ? this.parseJson('scaleJson', this.scaleJson, Vector3.fromJson)\n : this.scale;\n }\n\n private syncMatrix(): void {\n this.matrix = Matrix4.makeTRS(this.position, this.quaternion, this.scale);\n }\n\n private parseJson<T>(\n propName: string,\n value: string,\n parse: (str: string) => T\n ): T {\n try {\n return parse(value);\n } catch (e) {\n console.warn(`Could not parse \\`${propName}\\`. Invalid JSON.`);\n throw e;\n }\n }\n\n /**\n * @ignore\n */\n protected render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -0,0 +1,214 @@
1
+ /*!
2
+ * Copyright (c) 2023 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { v as vector3, q as quaternion, m as matrix4, i as euler } from './bundle.esm.js';
6
+ import { o as objects } from './browser.esm.js';
7
+
8
+ const viewerDomGroupCss = ":host{display:block;transform-style:preserve-3d}";
9
+
10
+ const ViewerDomGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
11
+ constructor() {
12
+ super();
13
+ this.__registerHost();
14
+ this.__attachShadow();
15
+ this.propertyChange = createEvent(this, "propertyChange", 7);
16
+ /**
17
+ * The local 3D position of where this element is located.
18
+ */
19
+ this.position = vector3.origin();
20
+ /**
21
+ * The local 3D position of where this element is located, as a JSON string.
22
+ * JSON representation can either be in the format of `[x, y, z]` or `{"x": 0,
23
+ * "y": 0, "z": 0}`.
24
+ */
25
+ this.positionJson = '';
26
+ /**
27
+ * The local rotation of this element.
28
+ */
29
+ this.quaternion = quaternion.create();
30
+ /**
31
+ * The local rotation of this element, as a JSON string. JSON
32
+ * representation can either be `[x, y, z, w]` or `{"x": 0, "y": 0, "z":
33
+ * 0, "w": 1}`.
34
+ */
35
+ this.quaternionJson = '';
36
+ /**
37
+ * The local scale of this element.
38
+ */
39
+ this.scale = vector3.create(1, 1, 1);
40
+ /**
41
+ * The local scale of this element, as a JSON string. JSON string
42
+ * representation can either be in the format of `[x, y, z]` or `{"x": 0, "y":
43
+ * 0, "z": 0}`.
44
+ */
45
+ this.scaleJson = '';
46
+ /**
47
+ * The local matrix of this element.
48
+ */
49
+ this.matrix = matrix4.makeIdentity();
50
+ }
51
+ /**
52
+ * @ignore
53
+ */
54
+ handlePositionChange() {
55
+ this.syncMatrix();
56
+ }
57
+ /**
58
+ * @ignore
59
+ */
60
+ handlePositionJsonChanged() {
61
+ this.syncPosition();
62
+ }
63
+ /**
64
+ * @ignore
65
+ */
66
+ handleRotationChanged() {
67
+ this.syncQuaternionWithRotation();
68
+ }
69
+ /**
70
+ * @ignore
71
+ */
72
+ handleRotationJsonChanged() {
73
+ this.syncRotation();
74
+ }
75
+ /**
76
+ * @ignore
77
+ */
78
+ handleQuaternionChange() {
79
+ this.syncMatrix();
80
+ }
81
+ /**
82
+ * @ignore
83
+ */
84
+ handleQuaternionJsonChanged() {
85
+ this.syncQuaternion();
86
+ }
87
+ /**
88
+ * @ignore
89
+ */
90
+ handleScaleChange() {
91
+ this.syncMatrix();
92
+ }
93
+ /**
94
+ * @ignore
95
+ */
96
+ handleScaleJsonChanged() {
97
+ this.syncScale();
98
+ }
99
+ /**
100
+ * @ignore
101
+ */
102
+ handleMatrixChanged(newMatrix, oldMatrix) {
103
+ if (!objects.isEqual(newMatrix, oldMatrix)) {
104
+ this.propertyChange.emit();
105
+ }
106
+ }
107
+ /**
108
+ * @ignore
109
+ */
110
+ componentWillLoad() {
111
+ this.syncProperties();
112
+ }
113
+ /**
114
+ * @ignore
115
+ */
116
+ componentShouldUpdate() {
117
+ return false;
118
+ }
119
+ syncProperties() {
120
+ this.syncPosition();
121
+ this.syncRotation();
122
+ this.syncQuaternion();
123
+ this.syncScale();
124
+ this.syncMatrix();
125
+ }
126
+ syncPosition() {
127
+ this.position =
128
+ this.positionJson.length > 0
129
+ ? this.parseJson('positionJson', this.positionJson, vector3.fromJson)
130
+ : this.position;
131
+ }
132
+ syncRotation() {
133
+ this.rotation =
134
+ this.rotationJson != null && this.rotationJson.length > 0
135
+ ? this.parseJson('rotationJson', this.rotationJson, euler.fromJson)
136
+ : this.rotation;
137
+ this.syncQuaternionWithRotation();
138
+ }
139
+ syncQuaternionWithRotation() {
140
+ this.quaternion =
141
+ this.rotation != null
142
+ ? quaternion.fromEuler(this.rotation)
143
+ : this.quaternion;
144
+ }
145
+ syncQuaternion() {
146
+ this.quaternion =
147
+ this.quaternionJson.length > 0
148
+ ? this.parseJson('quaternionJson', this.quaternionJson, quaternion.fromJson)
149
+ : this.quaternion;
150
+ }
151
+ syncScale() {
152
+ this.scale =
153
+ this.scaleJson.length > 0
154
+ ? this.parseJson('scaleJson', this.scaleJson, vector3.fromJson)
155
+ : this.scale;
156
+ }
157
+ syncMatrix() {
158
+ this.matrix = matrix4.makeTRS(this.position, this.quaternion, this.scale);
159
+ }
160
+ parseJson(propName, value, parse) {
161
+ try {
162
+ return parse(value);
163
+ }
164
+ catch (e) {
165
+ console.warn(`Could not parse \`${propName}\`. Invalid JSON.`);
166
+ throw e;
167
+ }
168
+ }
169
+ /**
170
+ * @ignore
171
+ */
172
+ render() {
173
+ return (h(Host, null, h("slot", null)));
174
+ }
175
+ static get watchers() { return {
176
+ "position": ["handlePositionChange"],
177
+ "positionJson": ["handlePositionJsonChanged"],
178
+ "rotation": ["handleRotationChanged"],
179
+ "rotationJson": ["handleRotationJsonChanged"],
180
+ "quaternion": ["handleQuaternionChange"],
181
+ "quaternionJson": ["handleQuaternionJsonChanged"],
182
+ "scale": ["handleScaleChange"],
183
+ "scaleJson": ["handleScaleJsonChanged"],
184
+ "matrix": ["handleMatrixChanged"]
185
+ }; }
186
+ static get style() { return viewerDomGroupCss; }
187
+ }, [1, "vertex-viewer-dom-group", {
188
+ "position": [1040],
189
+ "positionJson": [1, "position"],
190
+ "rotation": [1040],
191
+ "rotationJson": [1, "rotation"],
192
+ "quaternion": [1040],
193
+ "quaternionJson": [1, "quaternion"],
194
+ "scale": [1040],
195
+ "scaleJson": [1, "scale"],
196
+ "matrix": [1040]
197
+ }]);
198
+ function defineCustomElement() {
199
+ if (typeof customElements === "undefined") {
200
+ return;
201
+ }
202
+ const components = ["vertex-viewer-dom-group"];
203
+ components.forEach(tagName => { switch (tagName) {
204
+ case "vertex-viewer-dom-group":
205
+ if (!customElements.get(tagName)) {
206
+ customElements.define(tagName, ViewerDomGroup);
207
+ }
208
+ break;
209
+ } });
210
+ }
211
+
212
+ export { ViewerDomGroup as V, defineCustomElement as d };
213
+
214
+ //# sourceMappingURL=viewer-dom-group.js.map
@@ -0,0 +1 @@
1
+ {"file":"viewer-dom-group.js","mappings":"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","names":["Vector3","Quaternion","Matrix4","Objects","Euler"],"sources":["./src/components/viewer-dom-group/viewer-dom-group.css?tag=vertex-viewer-dom-group&encapsulation=shadow","./src/components/viewer-dom-group/viewer-dom-group.tsx"],"sourcesContent":[":host {\n display: block;\n transform-style: preserve-3d;\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\n\nimport {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { Euler, Matrix4, Quaternion, Vector3 } from '@vertexvis/geometry';\nimport { Objects } from '@vertexvis/utils';\n\nimport { HTMLDomRendererPositionableElement } from '../../interfaces';\n\n@Component({\n tag: 'vertex-viewer-dom-group',\n styleUrl: 'viewer-dom-group.css',\n shadow: true,\n})\nexport class ViewerDomGroup implements HTMLDomRendererPositionableElement {\n /**\n * The local 3D position of where this element is located.\n */\n @Prop({ mutable: true, attribute: null })\n public position: Vector3.Vector3 = Vector3.origin();\n\n /**\n * @ignore\n */\n @Watch('position')\n protected handlePositionChange(): void {\n this.syncMatrix();\n }\n\n /**\n * The local 3D position of where this element is located, as a JSON string.\n * JSON representation can either be in the format of `[x, y, z]` or `{\"x\": 0,\n * \"y\": 0, \"z\": 0}`.\n */\n @Prop({ attribute: 'position' })\n public positionJson = '';\n\n /**\n * @ignore\n */\n @Watch('positionJson')\n protected handlePositionJsonChanged(): void {\n this.syncPosition();\n }\n\n /**\n * An event that is emitted when any property on the dom group changes\n */\n @Event({ bubbles: true })\n public propertyChange!: EventEmitter<void>;\n\n /**\n * The local rotation of this element in Euler angles.\n */\n @Prop({ mutable: true, attribute: null })\n public rotation?: Euler.Euler;\n\n /**\n * @ignore\n */\n @Watch('rotation')\n protected handleRotationChanged(): void {\n this.syncQuaternionWithRotation();\n }\n\n /**\n * The local rotation of this element in Euler angles, as a JSON string. JSON\n * representation can either be `[x, y, z, order]` or `{\"x\": 0, \"y\": 0, \"z\":\n * 0, \"order\": \"xyz\"}`.\n */\n @Prop({ attribute: 'rotation' })\n public rotationJson?: string;\n\n /**\n * @ignore\n */\n @Watch('rotationJson')\n protected handleRotationJsonChanged(): void {\n this.syncRotation();\n }\n\n /**\n * The local rotation of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public quaternion: Quaternion.Quaternion = Quaternion.create();\n\n /**\n * @ignore\n */\n @Watch('quaternion')\n protected handleQuaternionChange(): void {\n this.syncMatrix();\n }\n\n /**\n * The local rotation of this element, as a JSON string. JSON\n * representation can either be `[x, y, z, w]` or `{\"x\": 0, \"y\": 0, \"z\":\n * 0, \"w\": 1}`.\n */\n @Prop({ attribute: 'quaternion' })\n public quaternionJson = '';\n\n /**\n * @ignore\n */\n @Watch('quaternionJson')\n protected handleQuaternionJsonChanged(): void {\n this.syncQuaternion();\n }\n\n /**\n * The local scale of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public scale: Vector3.Vector3 = Vector3.create(1, 1, 1);\n\n /**\n * @ignore\n */\n @Watch('scale')\n protected handleScaleChange(): void {\n this.syncMatrix();\n }\n\n /**\n * The local scale of this element, as a JSON string. JSON string\n * representation can either be in the format of `[x, y, z]` or `{\"x\": 0, \"y\":\n * 0, \"z\": 0}`.\n */\n @Prop({ attribute: 'scale' })\n public scaleJson = '';\n\n /**\n * @ignore\n */\n @Watch('scaleJson')\n protected handleScaleJsonChanged(): void {\n this.syncScale();\n }\n\n /**\n * @ignore\n */\n @Watch('matrix')\n protected handleMatrixChanged(\n newMatrix: Matrix4.Matrix4,\n oldMatrix: Matrix4.Matrix4\n ): void {\n if (!Objects.isEqual(newMatrix, oldMatrix)) {\n this.propertyChange.emit();\n }\n }\n\n /**\n * The local matrix of this element.\n */\n @Prop({ mutable: true, attribute: null })\n public matrix: Matrix4.Matrix4 = Matrix4.makeIdentity();\n\n /**\n * @ignore\n */\n protected componentWillLoad(): void {\n this.syncProperties();\n }\n\n /**\n * @ignore\n */\n protected componentShouldUpdate(): boolean {\n return false;\n }\n\n private syncProperties(): void {\n this.syncPosition();\n this.syncRotation();\n this.syncQuaternion();\n this.syncScale();\n this.syncMatrix();\n }\n\n private syncPosition(): void {\n this.position =\n this.positionJson.length > 0\n ? this.parseJson('positionJson', this.positionJson, Vector3.fromJson)\n : this.position;\n }\n\n private syncRotation(): void {\n this.rotation =\n this.rotationJson != null && this.rotationJson.length > 0\n ? this.parseJson('rotationJson', this.rotationJson, Euler.fromJson)\n : this.rotation;\n this.syncQuaternionWithRotation();\n }\n\n private syncQuaternionWithRotation(): void {\n this.quaternion =\n this.rotation != null\n ? Quaternion.fromEuler(this.rotation)\n : this.quaternion;\n }\n\n private syncQuaternion(): void {\n this.quaternion =\n this.quaternionJson.length > 0\n ? this.parseJson(\n 'quaternionJson',\n this.quaternionJson,\n Quaternion.fromJson\n )\n : this.quaternion;\n }\n\n private syncScale(): void {\n this.scale =\n this.scaleJson.length > 0\n ? this.parseJson('scaleJson', this.scaleJson, Vector3.fromJson)\n : this.scale;\n }\n\n private syncMatrix(): void {\n this.matrix = Matrix4.makeTRS(this.position, this.quaternion, this.scale);\n }\n\n private parseJson<T>(\n propName: string,\n value: string,\n parse: (str: string) => T\n ): T {\n try {\n return parse(value);\n } catch (e) {\n console.warn(`Could not parse \\`${propName}\\`. Invalid JSON.`);\n throw e;\n }\n }\n\n /**\n * @ignore\n */\n protected render(): h.JSX.IntrinsicElements {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"version":3}