@mml-io/mml-web-client 0.0.0-experimental-929c3a4-20250207 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1895,7 +1895,6 @@
1895
1895
  constructor() {
1896
1896
  super();
1897
1897
  this.mElementGraphics = null;
1898
- this.isMElement = true;
1899
1898
  }
1900
1899
  // This allows switching which document this HTMLElement subclass extends so that it can be placed into iframes
1901
1900
  static overwriteSuperclass(newSuperclass) {
@@ -1904,9 +1903,6 @@
1904
1903
  static get observedAttributes() {
1905
1904
  return [];
1906
1905
  }
1907
- static isMElement(element) {
1908
- return element.isMElement;
1909
- }
1910
1906
  static getMElementFromObject(object) {
1911
1907
  return object[MELEMENT_PROPERTY_NAME] || null;
1912
1908
  }
@@ -2080,7 +2076,7 @@
2080
2076
  getMElementParent() {
2081
2077
  let parentNode = this.parentNode;
2082
2078
  while (parentNode != null) {
2083
- if (_MElement.isMElement(parentNode)) {
2079
+ if (parentNode instanceof _MElement) {
2084
2080
  return parentNode;
2085
2081
  }
2086
2082
  parentNode = parentNode.parentNode;
@@ -2127,10 +2123,6 @@
2127
2123
  animDuration: defaultAnimDuration
2128
2124
  };
2129
2125
  this.registeredParentAttachment = null;
2130
- this.isAttributeAnimation = true;
2131
- }
2132
- static isAttributeAnimation(element) {
2133
- return element.isAttributeAnimation;
2134
2126
  }
2135
2127
  static get observedAttributes() {
2136
2128
  return [..._AttributeAnimation2.attributeHandler.getAttributes()];
@@ -2156,7 +2148,7 @@
2156
2148
  }
2157
2149
  connectedCallback() {
2158
2150
  super.connectedCallback();
2159
- if (this.parentElement && MElement.isMElement(this.parentElement)) {
2151
+ if (this.parentElement && this.parentElement instanceof MElement) {
2160
2152
  this.registeredParentAttachment = this.parentElement;
2161
2153
  if (this.props.attr) {
2162
2154
  this.registeredParentAttachment.addSideEffectChild(this);
@@ -2267,10 +2259,6 @@
2267
2259
  lerpDuration: defaultLerpDuration
2268
2260
  };
2269
2261
  this.registeredParentAttachment = null;
2270
- this.isAttributeLerp = true;
2271
- }
2272
- static isAttributeLerp(element) {
2273
- return element.isAttributeLerp;
2274
2262
  }
2275
2263
  static get observedAttributes() {
2276
2264
  return [..._AttributeLerp2.attributeHandler.getAttributes()];
@@ -2296,7 +2284,7 @@
2296
2284
  }
2297
2285
  connectedCallback() {
2298
2286
  super.connectedCallback();
2299
- if (this.parentElement && MElement.isMElement(this.parentElement)) {
2287
+ if (this.parentElement && this.parentElement instanceof MElement) {
2300
2288
  this.registeredParentAttachment = this.parentElement;
2301
2289
  this.registeredParentAttachment.addSideEffectChild(this);
2302
2290
  }
@@ -2397,12 +2385,12 @@
2397
2385
  this.reset();
2398
2386
  }
2399
2387
  addSideEffectChild(child) {
2400
- if (AttributeAnimation.isAttributeAnimation(child)) {
2388
+ if (child instanceof AttributeAnimation) {
2401
2389
  const attr = child.getAnimatedAttributeName();
2402
2390
  if (attr) {
2403
2391
  this.addAnimation(child, attr);
2404
2392
  }
2405
- } else if (AttributeLerp.isAttributeLerp(child)) {
2393
+ } else if (child instanceof AttributeLerp) {
2406
2394
  const attr = child.getAnimatedAttributeName();
2407
2395
  if (attr) {
2408
2396
  this.addLerp(child, attr);
@@ -2410,12 +2398,12 @@
2410
2398
  }
2411
2399
  }
2412
2400
  removeSideEffectChild(child) {
2413
- if (AttributeAnimation.isAttributeAnimation(child)) {
2401
+ if (child instanceof AttributeAnimation) {
2414
2402
  const attr = child.getAnimatedAttributeName();
2415
2403
  if (attr) {
2416
2404
  this.removeAnimation(child, attr);
2417
2405
  }
2418
- } else if (AttributeLerp.isAttributeLerp(child)) {
2406
+ } else if (child instanceof AttributeLerp) {
2419
2407
  const attr = child.getAnimatedAttributeName();
2420
2408
  if (attr) {
2421
2409
  this.removeLerp(child, attr);
@@ -3542,7 +3530,6 @@
3542
3530
  var _TransformableElement = class _TransformableElement2 extends MElement {
3543
3531
  constructor() {
3544
3532
  super(...arguments);
3545
- this.isTransformableElement = true;
3546
3533
  this.transformableElementProps = {
3547
3534
  socket: null,
3548
3535
  x: 0,
@@ -3663,13 +3650,10 @@
3663
3650
  });
3664
3651
  this.debugHelper = new DebugHelper(this);
3665
3652
  }
3666
- static isTransformableElement(element) {
3667
- return element.isTransformableElement;
3668
- }
3669
3653
  getTransformableElementParent() {
3670
3654
  let parentNode = this.parentNode;
3671
3655
  while (parentNode != null) {
3672
- if (_TransformableElement2.isTransformableElement(parentNode)) {
3656
+ if (parentNode instanceof _TransformableElement2) {
3673
3657
  return parentNode;
3674
3658
  }
3675
3659
  parentNode = parentNode.parentNode;
@@ -3922,7 +3906,7 @@
3922
3906
  var TransformableElement = _TransformableElement;
3923
3907
  function traverseImmediateTransformableElementChildren(element, callback) {
3924
3908
  element.childNodes.forEach((child) => {
3925
- if (TransformableElement.isTransformableElement(child)) {
3909
+ if (child instanceof TransformableElement) {
3926
3910
  callback(child);
3927
3911
  } else {
3928
3912
  traverseImmediateTransformableElementChildren(child, callback);
@@ -4132,12 +4116,9 @@
4132
4116
  castShadows: defaultModelCastShadows,
4133
4117
  debug: defaultModelDebug
4134
4118
  };
4119
+ this.isModel = true;
4135
4120
  this.collideableHelper = new CollideableHelper(this);
4136
4121
  this.modelGraphics = null;
4137
- this.isModel = true;
4138
- }
4139
- static isModel(element) {
4140
- return element.isModel;
4141
4122
  }
4142
4123
  enable() {
4143
4124
  this.collideableHelper.enable();
@@ -4288,7 +4269,7 @@
4288
4269
  tempContainerMatrix.identity();
4289
4270
  const tempMatr4 = new Matr4();
4290
4271
  for (let obj = container; obj; obj = obj.parentNode) {
4291
- if (TransformableElement.isTransformableElement(obj)) {
4272
+ if (obj instanceof TransformableElement) {
4292
4273
  obj.calculateLocalMatrix(tempMatr4);
4293
4274
  tempContainerMatrix.premultiply(tempMatr4);
4294
4275
  }
@@ -6297,7 +6278,7 @@
6297
6278
  return OrientedBoundingBox.fromMatrixWorld(this.transformableElementGraphics.getWorldMatrix());
6298
6279
  }
6299
6280
  addSideEffectChild(child) {
6300
- if (AttributeAnimation.isAttributeAnimation(child)) {
6281
+ if (child instanceof AttributeAnimation) {
6301
6282
  const attr = child.getAnimatedAttributeName();
6302
6283
  if (attr) {
6303
6284
  this.lightAnimatedAttributeHelper.addAnimation(child, attr);
@@ -6306,7 +6287,7 @@
6306
6287
  super.addSideEffectChild(child);
6307
6288
  }
6308
6289
  removeSideEffectChild(child) {
6309
- if (AttributeAnimation.isAttributeAnimation(child)) {
6290
+ if (child instanceof AttributeAnimation) {
6310
6291
  const attr = child.getAnimatedAttributeName();
6311
6292
  if (attr) {
6312
6293
  this.lightAnimatedAttributeHelper.removeAnimation(child, attr);
@@ -8205,7 +8186,7 @@
8205
8186
  var _a2;
8206
8187
  for (const i in element.children) {
8207
8188
  const child = element.children[i];
8208
- if (MElement.isMElement(child)) {
8189
+ if (child instanceof MElement) {
8209
8190
  (_a2 = child.connectedCallback) == null ? void 0 : _a2.call(child);
8210
8191
  }
8211
8192
  traverse(child);
@@ -63496,7 +63477,7 @@ ${DracoWorker.toString()}
63496
63477
  break;
63497
63478
  }
63498
63479
  }
63499
- if (mElement && TransformableElement.isTransformableElement(mElement) && mElement.isClickable()) {
63480
+ if (mElement && mElement instanceof TransformableElement && mElement.isClickable()) {
63500
63481
  const elementRelative = getRelativePositionAndRotationRelativeToObject(
63501
63482
  {
63502
63483
  position: result.point,
@@ -64933,7 +64914,7 @@ ${DracoWorker.toString()}
64933
64914
  this.latestAnimPromise = null;
64934
64915
  if (this.loadedState && !this.registeredParentAttachment) {
64935
64916
  const parent = this.model.parentElement;
64936
- if (parent && Model.isModel(parent)) {
64917
+ if (parent instanceof Model) {
64937
64918
  this.registeredParentAttachment = parent;
64938
64919
  parent.modelGraphics.registerAttachment(this.model);
64939
64920
  }
@@ -65130,7 +65111,7 @@ ${DracoWorker.toString()}
65130
65111
  this.connectAnimationToModel();
65131
65112
  this.updateMeshCallback();
65132
65113
  const parent = this.model.parentElement;
65133
- if (parent && Model.isModel(parent)) {
65114
+ if (parent instanceof Model) {
65134
65115
  if (!this.latestAnimPromise && !this.animState) {
65135
65116
  this.registeredParentAttachment = parent;
65136
65117
  parent.modelGraphics.registerAttachment(this.model);
@@ -65229,7 +65210,7 @@ ${DracoWorker.toString()}
65229
65210
  triggerSocketedChildrenTransformed() {
65230
65211
  this.socketChildrenByBone.forEach((children) => {
65231
65212
  children.forEach((child) => {
65232
- if (TransformableElement.isTransformableElement(child)) {
65213
+ if (child instanceof TransformableElement) {
65233
65214
  child.didUpdateTransformation();
65234
65215
  }
65235
65216
  });
@@ -66553,7 +66534,7 @@ ${DracoWorker.toString()}
66553
66534
  return this.playcanvasApp.root;
66554
66535
  }
66555
66536
  getBoundingBoxForElement(element) {
66556
- if (!TransformableElement.isTransformableElement(element)) {
66537
+ if (!(element instanceof TransformableElement)) {
66557
66538
  return null;
66558
66539
  }
66559
66540
  const bounds = element.getContentBounds();
@@ -97629,7 +97610,7 @@ void main() {
97629
97610
  this.threeLight.castShadow = this.light.props.castShadows;
97630
97611
  this.threeLight.shadow.mapSize.width = 512;
97631
97612
  this.threeLight.shadow.mapSize.height = 512;
97632
- if (this.threeLight.shadow.camera.isPerspectiveCamera) {
97613
+ if (this.threeLight.shadow.camera instanceof PerspectiveCamera) {
97633
97614
  this.threeLight.shadow.camera.near = 0.5;
97634
97615
  this.threeLight.shadow.camera.far = 500;
97635
97616
  }
@@ -97684,7 +97665,7 @@ void main() {
97684
97665
  this.threeLight.castShadow = castShadows;
97685
97666
  }
97686
97667
  setAngle(angle) {
97687
- if (this.threeLight.isSpotLight) {
97668
+ if (this.threeLight instanceof SpotLight) {
97688
97669
  this.threeLight.angle = MathUtils.degToRad(angle);
97689
97670
  }
97690
97671
  }
@@ -97835,7 +97816,7 @@ void main() {
97835
97816
  this.animLoadingInstanceManager.abortIfLoading();
97836
97817
  if (this.loadedState && !this.registeredParentAttachment) {
97837
97818
  const parent = this.model.parentElement;
97838
- if (parent && Model.isModel(parent)) {
97819
+ if (parent instanceof Model) {
97839
97820
  this.registeredParentAttachment = parent;
97840
97821
  parent.modelGraphics.registerAttachment(this.model);
97841
97822
  }
@@ -97952,7 +97933,7 @@ void main() {
97952
97933
  }
97953
97934
  this.updateMeshCallback();
97954
97935
  const parent = this.model.parentElement;
97955
- if (parent && Model.isModel(parent)) {
97936
+ if (parent instanceof Model) {
97956
97937
  if (!this.latestAnimPromise && !this.animState) {
97957
97938
  this.registeredParentAttachment = parent;
97958
97939
  parent.modelGraphics.registerAttachment(this.model);
@@ -98072,7 +98053,7 @@ void main() {
98072
98053
  triggerSocketedChildrenTransformed() {
98073
98054
  this.socketChildrenByBone.forEach((children) => {
98074
98055
  children.forEach((child) => {
98075
- if (TransformableElement.isTransformableElement(child)) {
98056
+ if (child instanceof TransformableElement) {
98076
98057
  child.didUpdateTransformation();
98077
98058
  }
98078
98059
  });
@@ -98783,7 +98764,7 @@ void main() {
98783
98764
  break;
98784
98765
  }
98785
98766
  const mElement = MElement.getMElementFromObject(obj);
98786
- if (mElement && TransformableElement.isTransformableElement(mElement) && mElement.isClickable()) {
98767
+ if (mElement && mElement instanceof TransformableElement && mElement.isClickable()) {
98787
98768
  const elementRelative = getRelativePositionAndRotationRelativeToObject(
98788
98769
  {
98789
98770
  position: intersection.point,
@@ -99414,7 +99395,7 @@ void main() {
99414
99395
  getBoundingBoxForElement(element) {
99415
99396
  const camera = this.camera;
99416
99397
  const renderer = this.renderer;
99417
- if (!MElement.isMElement(element)) {
99398
+ if (!(element instanceof MElement)) {
99418
99399
  return null;
99419
99400
  }
99420
99401
  const object = element.getContainer();