@threepipe/plugin-svg-renderer 0.3.0 → 0.4.0-r172.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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @threepipe/plugin-svg-renderer v0.3.0
3
+ * @threepipe/plugin-svg-renderer v0.4.0-r172.1
4
4
  * Copyright 2022-2026 repalash <palash@shaders.app>
5
5
  * GPLV3 License
6
6
  * See ./dependencies.txt for any bundled third-party dependencies and licenses.
@@ -715,7 +715,7 @@ var SVGRenderer$1 = class {
715
715
  // ../../node_modules/ts-browser-helpers/dist/bundle.esm.js
716
716
  /**
717
717
  * @license
718
- * ts-browser-helpers v0.23.0
718
+ * ts-browser-helpers v0.24.0
719
719
  * Copyright 2022-2026 repalash <palash@shaders.app>
720
720
  * MIT License
721
721
  * See ./dependencies.txt for bundled third-party dependencies and licenses.
@@ -734,22 +734,22 @@ var SVGRenderer$1 = class {
734
734
  * See the License for the specific language governing permissions and
735
735
  * limitations under the License.
736
736
  */
737
- var y$5 = class y {
738
- constructor(e = y.DECAY_MILLISECONDS) {
737
+ var k$1 = class k {
738
+ constructor(e = k.DECAY_MILLISECONDS) {
739
739
  this.velocity = 0, this.naturalFrequency = 0, this.setDecayTime(e);
740
740
  }
741
741
  setDecayTime(e) {
742
- this.naturalFrequency = 1 / Math.max(y.MIN_DECAY_MILLISECONDS, e);
742
+ this.naturalFrequency = 1 / Math.max(k.MIN_DECAY_MILLISECONDS, e);
743
743
  }
744
744
  update(e, t, n, r) {
745
745
  const o = 2e-4 * this.naturalFrequency;
746
746
  if (e == null || r === 0 || e === t && this.velocity === 0) return t;
747
747
  if (n < 0) return e;
748
- const s = e - t, a = this.velocity + this.naturalFrequency * s, l = s + n * a, d = Math.exp(-this.naturalFrequency * n), c = (a - this.naturalFrequency * l) * d, f = -this.naturalFrequency * (c + a * d);
749
- return Math.abs(c) < o * Math.abs(r) && f * s >= 0 ? (this.velocity = 0, t) : (this.velocity = c, t + l * d);
748
+ const s = e - t, a = this.velocity + this.naturalFrequency * s, l = s + n * a, d = Math.exp(-this.naturalFrequency * n), c = (a - this.naturalFrequency * l) * d, u = -this.naturalFrequency * (c + a * d);
749
+ return Math.abs(c) < o * Math.abs(r) && u * s >= 0 ? (this.velocity = 0, t) : (this.velocity = c, t + l * d);
750
750
  }
751
751
  };
752
- y$5.SETTLING_TIME = 1e4, y$5.MIN_DECAY_MILLISECONDS = .001, y$5.DECAY_MILLISECONDS = 50;
752
+ k$1.SETTLING_TIME = 1e4, k$1.MIN_DECAY_MILLISECONDS = .001, k$1.DECAY_MILLISECONDS = 50;
753
753
  function re(i, e) {
754
754
  let t;
755
755
  do
@@ -777,24 +777,24 @@ function R(i, e) {
777
777
  var O = {
778
778
  priority: 1 / 0,
779
779
  type: "Object",
780
- serialize: (i, e) => R(i, ([t, n]) => [t, m$1.Serialize(n, e, !1)]),
781
- deserialize: (i, e, t) => Object.assign(e || {}, R(i, ([n, r]) => [n, m$1.Deserialize(r, e == null ? void 0 : e[n], t, !1)])),
780
+ serialize: (i, e) => R(i, ([t, n]) => [t, x$4.Serialize(n, e, !1)]),
781
+ deserialize: (i, e, t) => Object.assign(e || {}, R(i, ([n, r]) => [n, x$4.Deserialize(r, e == null ? void 0 : e[n], t, !1)])),
782
782
  isType: (i) => (i.constructor || Object) === Object
783
783
  };
784
- var u = class u {
784
+ var f = class f {
785
785
  static GetSerializer(e) {
786
- return u.Serializers.find((t) => t.isType(e));
786
+ return f.Serializers.find((t) => t.isType(e));
787
787
  }
788
788
  static RegisterSerializer(...e) {
789
789
  for (const t of e) {
790
- const n = t.priority ?? 1e10, r = se(u.Serializers, (o) => o.priority !== void 0 && o.priority < n);
791
- r >= 0 ? u.Serializers.splice(r + 1, 0, t) : u.Serializers.push(t);
790
+ const n = t.priority ?? 1e10, r = se(f.Serializers, (o) => o.priority !== void 0 && o.priority < n);
791
+ r >= 0 ? f.Serializers.splice(r + 1, 0, t) : f.Serializers.push(t);
792
792
  }
793
793
  }
794
794
  static UnregisterSerializer(...e) {
795
795
  for (const t of e) {
796
- const n = u.Serializers.indexOf(t);
797
- n >= 0 && u.Serializers.splice(n, 1);
796
+ const n = f.Serializers.indexOf(t);
797
+ n >= 0 && f.Serializers.splice(n, 1);
798
798
  }
799
799
  }
800
800
  /**
@@ -806,7 +806,7 @@ var u = class u {
806
806
  static Serialize(e, t, n = !1) {
807
807
  if (typeof e == "function") return;
808
808
  if (!n) {
809
- const s = u.GetSerializer(e);
809
+ const s = f.GetSerializer(e);
810
810
  if (s) return s.serialize(e, t);
811
811
  if (typeof e.toJSON == "function") {
812
812
  const a = e.toJSON(t, !0);
@@ -816,8 +816,8 @@ var u = class u {
816
816
  let r = e.constructor ?? Object;
817
817
  const o = {};
818
818
  for (; r && r !== Object;) {
819
- const s = u.TypeMap.get(r) ?? [];
820
- for (const [a, l] of s) o[a] = u.Serialize(e[l], t, !1);
819
+ const s = f.TypeMap.get(r) ?? [];
820
+ for (const [a, l] of s) o[a] = f.Serialize(e[l], t, !1);
821
821
  r = Object.getPrototypeOf(r);
822
822
  }
823
823
  return e.serializableClassId && (o.serializableClassId = e.serializableClassId), o;
@@ -852,14 +852,14 @@ var u = class u {
852
852
  }
853
853
  if (e && typeof e == "object") {
854
854
  const s = (a) => {
855
- const l = u.SerializableClasses.get(a);
855
+ const l = f.SerializableClasses.get(a);
856
856
  l && (l.DataInConstructor ? t = new l(e) : t = new l());
857
857
  };
858
858
  e.serializableClassId && (!t || t.serializableClassId !== e.serializableClassId) && s(e.serializableClassId), e.type && (!t || t.type !== e.type) && s(e.type), !Array.isArray(t) && Array.isArray(e) ? t = [] : typeof t != "object" && (e.constructor || Object) === Object && (t = {});
859
859
  }
860
860
  if (typeof t == "function") return console.error("Serialization: Cannot deserialize into a function", t, e), t;
861
861
  if (!r) {
862
- const s = u.GetSerializer(e);
862
+ const s = f.GetSerializer(e);
863
863
  if (s && s !== O) return s.deserialize(e, t, n);
864
864
  }
865
865
  if (!e || t === void 0 || t === null || typeof t != "object") return e;
@@ -867,9 +867,9 @@ var u = class u {
867
867
  let o = t.constructor ?? Object;
868
868
  if (o === Object) return O.deserialize(e, t, n);
869
869
  for (; o && o !== Object;) {
870
- const s = u.TypeMap.get(o) ?? [];
870
+ const s = f.TypeMap.get(o) ?? [];
871
871
  for (const [a, l] of s) {
872
- const d = t[l], c = u.Deserialize(e[a], d, n, !1);
872
+ const d = t[l], c = f.Deserialize(e[a], d, n, !1);
873
873
  c !== d && P(t, l, c, !0);
874
874
  }
875
875
  o = Object.getPrototypeOf(o);
@@ -877,17 +877,17 @@ var u = class u {
877
877
  return t;
878
878
  }
879
879
  };
880
- u.TypeMap = /* @__PURE__ */ new WeakMap(), u.SerializableClasses = /* @__PURE__ */ new Map(), u.Serializers = [
880
+ f.TypeMap = /* @__PURE__ */ new WeakMap(), f.SerializableClasses = /* @__PURE__ */ new Map(), f.Serializers = [
881
881
  {
882
882
  priority: 0,
883
883
  type: "Array",
884
884
  isType: (e) => Array.isArray(e),
885
- serialize: (e, t) => e.map((n) => u.Serialize(n, t, !1)),
885
+ serialize: (e, t) => e.map((n) => f.Serialize(n, t, !1)),
886
886
  deserialize: (e, t, n) => {
887
887
  const r = e.length;
888
888
  Array.isArray(t) || (t = []);
889
889
  for (let o = 0; o < r; o++) {
890
- const s = e[o], a = t.length > o ? u.Deserialize(s, t[o], n, !1) : u.Deserialize(s, void 0, n, !1);
890
+ const s = e[o], a = t.length > o ? f.Deserialize(s, t[o], n, !1) : f.Deserialize(s, void 0, n, !1);
891
891
  t.length <= o ? t.push(a) : t[o] = a;
892
892
  }
893
893
  return t;
@@ -916,13 +916,13 @@ u.TypeMap = /* @__PURE__ */ new WeakMap(), u.SerializableClasses = /* @__PURE__
916
916
  },
917
917
  O
918
918
  ];
919
- var m$1 = u;
920
- var k$1 = class k {
919
+ var x$4 = f;
920
+ var _ = class _ {
921
921
  static callFunction(e, t, n = []) {
922
922
  if (!t) return e(...n);
923
923
  if (e.name && t[e.name] === e) return e.call(t, ...n);
924
- k.methodMap.has(t) || k.methodMap.set(t, /* @__PURE__ */ new WeakMap());
925
- const r = k.methodMap.get(t);
924
+ _.methodMap.has(t) || _.methodMap.set(t, /* @__PURE__ */ new WeakMap());
925
+ const r = _.methodMap.get(t);
926
926
  if (!r.has(e)) {
927
927
  let o = t;
928
928
  for (; o;) {
@@ -935,8 +935,8 @@ var k$1 = class k {
935
935
  return r.get(e) ? e.call(t, ...n) : e(...n);
936
936
  }
937
937
  };
938
- k$1.methodMap = /* @__PURE__ */ new WeakMap();
939
- var D$1 = k$1;
938
+ _.methodMap = /* @__PURE__ */ new WeakMap();
939
+ var T = _;
940
940
  function I(i, e = "param") {
941
941
  if (!i) throw new Error("onChange: fnKey is undefined, make sure the function exists or provide a string");
942
942
  return (t, n, r) => {
@@ -960,7 +960,7 @@ function I(i, e = "param") {
960
960
  oldValue: a,
961
961
  target: this
962
962
  }] : [];
963
- typeof i == "string" ? (d = this[i]) == null || d.call(this, ...l) : typeof i == "function" && D$1.callFunction(i, this, l);
963
+ typeof i == "string" ? (d = this[i]) == null || d.call(this, ...l) : typeof i == "function" && T.callFunction(i, this, l);
964
964
  }
965
965
  };
966
966
  if (r) return U(r, "value") && delete r.value, U(r, "writable") && delete r.writable, U(r, "initializer") && delete r.initializer, Object.assign(r, o);
@@ -4318,7 +4318,7 @@ function assignPolygons(viewmap, options, info = new AssignPolygonInfo()) {
4318
4318
  if (intersections.length > 0) {
4319
4319
  const intersection = intersections[0];
4320
4320
  const faceIndex = intersection.faceIndex;
4321
- if (faceIndex !== void 0) {
4321
+ if (faceIndex !== void 0 && faceIndex !== null) {
4322
4322
  const intersectionMesh = intersection.object;
4323
4323
  polygon.mesh = svgMeshesMap.get(intersectionMesh);
4324
4324
  if (polygon.mesh) {