geonodes-web-render 0.3.11 → 0.3.12

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/embed.js CHANGED
@@ -7662,6 +7662,7 @@ var Xd = {
7662
7662
  GEOMETRY: "#1d725e",
7663
7663
  INPUT: "#82354c",
7664
7664
  OUTPUT: "#3e232a",
7665
+ COLOR: "#6e6e23",
7665
7666
  ATTRIBUTE: "#1d2546",
7666
7667
  CONVERTER: "#246283",
7667
7668
  GROUP: "#374725",
@@ -7674,11 +7675,32 @@ var Xd = {
7674
7675
  DISTORT: "#3e5a5b",
7675
7676
  SCRIPT: "#203c3c",
7676
7677
  DEFAULT: "#303030"
7678
+ }, Zd = {
7679
+ ShaderNodeVectorMath: "VECTOR",
7680
+ ShaderNodeVectorRotate: "VECTOR",
7681
+ ShaderNodeVectorCurve: "VECTOR",
7682
+ ShaderNodeVectorTransform: "VECTOR",
7683
+ ShaderNodeMapping: "VECTOR",
7684
+ ShaderNodeMixRGB: "COLOR",
7685
+ ShaderNodeRGBCurve: "COLOR",
7686
+ ShaderNodeMath: "CONVERTER",
7687
+ ShaderNodeClamp: "CONVERTER",
7688
+ ShaderNodeValToRGB: "CONVERTER",
7689
+ ShaderNodeFloatCurve: "CONVERTER",
7690
+ ShaderNodeSeparateXYZ: "CONVERTER",
7691
+ ShaderNodeCombineXYZ: "CONVERTER",
7692
+ ShaderNodeSeparateColor: "CONVERTER",
7693
+ ShaderNodeCombineColor: "CONVERTER",
7694
+ ShaderNodeBlackbody: "CONVERTER",
7695
+ ShaderNodeWavelength: "CONVERTER",
7696
+ ShaderNodeRGBToBW: "CONVERTER",
7697
+ ShaderNodeValue: "INPUT",
7698
+ ShaderNodeRGB: "INPUT"
7677
7699
  };
7678
- function Zd(e) {
7679
- return e === "NodeGroupInput" || e === "NodeGroupOutput" ? "INTERFACE" : e.startsWith("NodeGroup") ? "GROUP" : e.startsWith("GeometryNodeSet") || e.startsWith("GeometryNodeTransform") || e.startsWith("GeometryNodeMerge") || e.startsWith("GeometryNodeJoin") || e.startsWith("GeometryNodeDelete") || e.startsWith("GeometryNodeSeparate") || e.startsWith("GeometryNodeDuplicate") || e.startsWith("GeometryNodeExtrude") || e.startsWith("GeometryNodeFlip") || e.startsWith("GeometryNodeSubdivide") || e.startsWith("GeometryNodeTriangulate") || e.startsWith("GeometryNodeMesh") || e.startsWith("GeometryNodeCurve") || e.startsWith("GeometryNodePoints") || e.startsWith("GeometryNodeVolume") || e.startsWith("GeometryNodeInstance") || e.startsWith("GeometryNodeRealize") || e.startsWith("GeometryNodeConvex") || e.startsWith("GeometryNodeFill") || e.startsWith("GeometryNodeSDF") || e.startsWith("GeometryNode") ? "GEOMETRY" : e.startsWith("ShaderNode") ? "SHADER" : e.startsWith("FunctionNode") ? "CONVERTER" : "DEFAULT";
7700
+ function Qd(e) {
7701
+ return e === "NodeGroupInput" || e === "NodeGroupOutput" ? "INTERFACE" : e.startsWith("NodeGroup") ? "GROUP" : e.startsWith("GeometryNodeSet") || e.startsWith("GeometryNodeTransform") || e.startsWith("GeometryNodeMerge") || e.startsWith("GeometryNodeJoin") || e.startsWith("GeometryNodeDelete") || e.startsWith("GeometryNodeSeparate") || e.startsWith("GeometryNodeDuplicate") || e.startsWith("GeometryNodeExtrude") || e.startsWith("GeometryNodeFlip") || e.startsWith("GeometryNodeSubdivide") || e.startsWith("GeometryNodeTriangulate") || e.startsWith("GeometryNodeMesh") || e.startsWith("GeometryNodeCurve") || e.startsWith("GeometryNodePoints") || e.startsWith("GeometryNodeVolume") || e.startsWith("GeometryNodeInstance") || e.startsWith("GeometryNodeRealize") || e.startsWith("GeometryNodeConvex") || e.startsWith("GeometryNodeFill") || e.startsWith("GeometryNodeSDF") || e.startsWith("GeometryNode") ? "GEOMETRY" : e.startsWith("ShaderNode") ? e in Zd ? Zd[e] : e.startsWith("ShaderNodeTex") ? "TEXTURE" : "SHADER" : e.startsWith("FunctionNode") ? e.startsWith("FunctionNodeInput") ? "INPUT" : "CONVERTER" : "DEFAULT";
7680
7702
  }
7681
- var Qd = {
7703
+ var $d = {
7682
7704
  GeometryNodeInputMaterial: "INPUT",
7683
7705
  GeometryNodeInputMaterialIndex: "INPUT",
7684
7706
  GeometryNodeInputRadius: "INPUT",
@@ -7729,12 +7751,16 @@ var Qd = {
7729
7751
  GeometryNodeFieldVariance: "CONVERTER",
7730
7752
  GeometryNodeViewer: "OUTPUT"
7731
7753
  };
7732
- function $d(e) {
7733
- return Xd[Qd[e] ?? Zd(e)] ?? Xd.DEFAULT;
7754
+ function ef(e, t) {
7755
+ if (e === "ShaderNodeMix") return t === "VECTOR" ? "VECTOR" : t === "RGBA" ? "COLOR" : "CONVERTER";
7756
+ if (e === "ShaderNodeMapRange") return t === "FLOAT_VECTOR" ? "VECTOR" : "CONVERTER";
7757
+ }
7758
+ function tf(e, t) {
7759
+ return Xd[ef(e, t) ?? $d[e] ?? Qd(e)] ?? Xd.DEFAULT;
7734
7760
  }
7735
7761
  //#endregion
7736
7762
  //#region src/gn/importer/blenderTree.ts
7737
- var ef = {
7763
+ var nf = {
7738
7764
  NodeSocketGeometry: "GEOMETRY",
7739
7765
  NodeSocketFloat: "FLOAT",
7740
7766
  NodeSocketVector: "VECTOR",
@@ -7751,10 +7777,10 @@ var ef = {
7751
7777
  NodeSocketMatrix: "MATRIX",
7752
7778
  NodeSocketMenu: "MENU"
7753
7779
  };
7754
- function tf(e) {
7755
- return ef[e] ?? "CUSTOM";
7780
+ function rf(e) {
7781
+ return nf[e] ?? "CUSTOM";
7756
7782
  }
7757
- var nf = {
7783
+ var af = {
7758
7784
  HSV: [
7759
7785
  "Hue",
7760
7786
  "Saturation",
@@ -7771,7 +7797,7 @@ var nf = {
7771
7797
  "Blue"
7772
7798
  ]
7773
7799
  };
7774
- function rf(e) {
7800
+ function of(e) {
7775
7801
  let t = e.data.mapping?.data;
7776
7802
  if (!t) return;
7777
7803
  let n = t.curves?.data?.items;
@@ -7789,8 +7815,8 @@ function rf(e) {
7789
7815
  points: r
7790
7816
  };
7791
7817
  }
7792
- function af(e, t) {
7793
- let n = nf[t ?? "RGB"] ?? nf.RGB, r = nf.RGB;
7818
+ function sf(e, t) {
7819
+ let n = af[t ?? "RGB"] ?? af.RGB, r = af.RGB;
7794
7820
  return e.map((e) => {
7795
7821
  let t = r.indexOf(e.name);
7796
7822
  return t === -1 ? e : {
@@ -7799,11 +7825,11 @@ function af(e, t) {
7799
7825
  };
7800
7826
  });
7801
7827
  }
7802
- function of(e) {
7828
+ function cf(e) {
7803
7829
  return e.replace(/\.\d{3}$/, "");
7804
7830
  }
7805
- function sf(e, t) {
7806
- let n = tf(e.data.socket_idname ?? ""), r = Yd(n), i = String(e.data.single_input ?? `${e.id}_in`), a = String(e.data.single_output ?? `${e.id}_out`), o = (e) => ({
7831
+ function lf(e, t) {
7832
+ let n = rf(e.data.socket_idname ?? ""), r = Yd(n), i = String(e.data.single_input ?? `${e.id}_in`), a = String(e.data.single_output ?? `${e.id}_out`), o = (e) => ({
7807
7833
  id: e,
7808
7834
  name: "",
7809
7835
  dataType: n,
@@ -7828,7 +7854,7 @@ function sf(e, t) {
7828
7854
  outputs: [o(a)]
7829
7855
  };
7830
7856
  }
7831
- function cf(e) {
7857
+ function uf(e) {
7832
7858
  return e == null ? null : Array.isArray(e) && e.length >= 2 ? {
7833
7859
  kind: "vec",
7834
7860
  values: e
@@ -7837,20 +7863,20 @@ function cf(e) {
7837
7863
  value: e
7838
7864
  } : null;
7839
7865
  }
7840
- function lf(e, t) {
7866
+ function df(e, t) {
7841
7867
  return {
7842
7868
  id: String(e.id),
7843
7869
  name: e.data.name,
7844
7870
  dataType: e.data.type,
7845
7871
  displayShape: e.data.display_shape,
7846
7872
  color: Yd(e.data.type),
7847
- defaultValue: cf(e.data.default_value),
7873
+ defaultValue: uf(e.data.default_value),
7848
7874
  hideValue: e.data.hide_value ?? !1,
7849
7875
  enabled: e.data.enabled ?? !0,
7850
7876
  index: t
7851
7877
  };
7852
7878
  }
7853
- function uf(e) {
7879
+ function ff(e) {
7854
7880
  if (e.data.bl_idname === "FunctionNodeCompare") {
7855
7881
  let t = {};
7856
7882
  return e.data.data_type && (t.data_type = e.data.data_type), e.data.operation && (t.operation = e.data.operation), Object.keys(t).length > 0 ? t : void 0;
@@ -7860,7 +7886,7 @@ function uf(e) {
7860
7886
  return e.data.operation && (t.operation = e.data.operation), e.data.use_clamp && (t.use_clamp = "true"), Object.keys(t).length > 0 ? t : void 0;
7861
7887
  }
7862
7888
  }
7863
- function df(e, t) {
7889
+ function pf(e, t) {
7864
7890
  if (!e?.data) throw Error(`"node_trees[${t}].data" is missing.`);
7865
7891
  if (!e.data.nodes?.data?.items) throw Error(`"node_trees[${t}].data.nodes.data.items" is missing.`);
7866
7892
  if (!e.data.links?.data?.items) throw Error(`"node_trees[${t}].data.links.data.items" is missing.`);
@@ -7870,10 +7896,10 @@ function df(e, t) {
7870
7896
  nodes: e.data.nodes.data.items.map((e, t) => {
7871
7897
  if (!e?.data) throw Error(`Node at index ${t} is missing ".data".`);
7872
7898
  let n = e.data.location_absolute ?? e.data.location ?? [0, 0];
7873
- if (e.data.bl_idname === "NodeReroute") return sf(e, n);
7899
+ if (e.data.bl_idname === "NodeReroute") return lf(e, n);
7874
7900
  let r = (e.data.outputs?.data?.items ?? []).map((t, n) => {
7875
7901
  if (!t?.data) throw Error(`Node "${e.data.name}" output socket ${n} is missing ".data".`);
7876
- return lf(t, n);
7902
+ return df(t, n);
7877
7903
  });
7878
7904
  e.data.bl_idname === "FunctionNodeInputVector" && Array.isArray(e.data.vector) && (r[0] &&= {
7879
7905
  ...r[0],
@@ -7884,20 +7910,20 @@ function df(e, t) {
7884
7910
  });
7885
7911
  let i = (e.data.inputs?.data?.items ?? []).map((t, n) => {
7886
7912
  if (!t?.data) throw Error(`Node "${e.data.name}" input socket ${n} is missing ".data".`);
7887
- return lf(t, n);
7913
+ return df(t, n);
7888
7914
  });
7889
- (e.data.bl_idname === "ShaderNodeCombineColor" || e.data.bl_idname === "ShaderNodeSeparateColor") && (i = af(i, e.data.mode));
7890
- let a = e.data.bl_idname === "ShaderNodeFloatCurve" ? rf(e) : void 0, o = uf(e);
7915
+ (e.data.bl_idname === "ShaderNodeCombineColor" || e.data.bl_idname === "ShaderNodeSeparateColor") && (i = sf(i, e.data.mode));
7916
+ let a = e.data.bl_idname === "ShaderNodeFloatCurve" ? of(e) : void 0, o = ff(e);
7891
7917
  return {
7892
7918
  id: String(e.id),
7893
7919
  type: e.data.bl_idname,
7894
- label: e.data.label || of(e.data.name),
7920
+ label: e.data.label || cf(e.data.name),
7895
7921
  position: {
7896
7922
  x: n[0],
7897
7923
  y: -n[1]
7898
7924
  },
7899
7925
  width: e.data.width ?? 140,
7900
- headerColor: $d(e.data.bl_idname),
7926
+ headerColor: tf(e.data.bl_idname, e.data.data_type),
7901
7927
  inputs: i,
7902
7928
  outputs: r,
7903
7929
  floatCurve: a,
@@ -7915,12 +7941,12 @@ function df(e, t) {
7915
7941
  })
7916
7942
  };
7917
7943
  }
7918
- function ff(e) {
7944
+ function mf(e) {
7919
7945
  if (!e || typeof e != "object") throw Error("JSON root must be an object.");
7920
7946
  if (!Array.isArray(e.node_trees) || e.node_trees.length === 0) throw Error("Expected \"node_trees\" array with at least one entry.");
7921
7947
  let t = {};
7922
7948
  for (let n = 0; n < e.node_trees.length; n++) {
7923
- let r = df(e.node_trees[n], n);
7949
+ let r = pf(e.node_trees[n], n);
7924
7950
  t[r.id] = r;
7925
7951
  }
7926
7952
  let n = /* @__PURE__ */ new Set();
@@ -7939,21 +7965,21 @@ function ff(e) {
7939
7965
  trees: t
7940
7966
  };
7941
7967
  }
7942
- function pf(e, t) {
7968
+ function hf(e, t) {
7943
7969
  return {
7944
7970
  ...t,
7945
7971
  nodeId: e,
7946
7972
  direction: "input"
7947
7973
  };
7948
7974
  }
7949
- function mf(e, t) {
7975
+ function gf(e, t) {
7950
7976
  return {
7951
7977
  ...t,
7952
7978
  nodeId: e,
7953
7979
  direction: "output"
7954
7980
  };
7955
7981
  }
7956
- function hf(e) {
7982
+ function _f(e) {
7957
7983
  let t = e.nodes.map((e) => ({
7958
7984
  id: e.id,
7959
7985
  type: e.type,
@@ -7961,8 +7987,8 @@ function hf(e) {
7961
7987
  position: e.position,
7962
7988
  width: e.width,
7963
7989
  headerColor: e.headerColor,
7964
- inputs: e.inputs.map((t) => pf(e.id, t)),
7965
- outputs: e.outputs.map((t) => mf(e.id, t)),
7990
+ inputs: e.inputs.map((t) => hf(e.id, t)),
7991
+ outputs: e.outputs.map((t) => gf(e.id, t)),
7966
7992
  floatCurve: e.floatCurve,
7967
7993
  properties: e.properties,
7968
7994
  groupTreeId: e.groupTreeId,
@@ -7986,11 +8012,11 @@ function hf(e) {
7986
8012
  }
7987
8013
  //#endregion
7988
8014
  //#region src/gn/xyflow/mapGraphIRToFlow.ts
7989
- function gf(e) {
8015
+ function vf(e) {
7990
8016
  let t = Math.max(e.inputs.length, e.outputs.length);
7991
8017
  return Math.max(60, 32 + t * 18 + 16);
7992
8018
  }
7993
- function _f(e, t) {
8019
+ function yf(e, t) {
7994
8020
  if (e.type === "NodeReroute") {
7995
8021
  let t = e.outputs[0]?.color ?? e.inputs[0]?.color ?? "#888888";
7996
8022
  return {
@@ -8030,7 +8056,7 @@ function _f(e, t) {
8030
8056
  }
8031
8057
  };
8032
8058
  }
8033
- function vf(e, t, n) {
8059
+ function bf(e, t, n) {
8034
8060
  let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
8035
8061
  for (let e of n.nodes) r.set(e.id, []), i.set(e.id, []);
8036
8062
  for (let e of n.edges) r.has(e.sourceNodeId) || r.set(e.sourceNodeId, []), i.has(e.targetNodeId) || i.set(e.targetNodeId, []), r.get(e.sourceNodeId).push(e.targetNodeId), i.get(e.targetNodeId).push(e.sourceNodeId);
@@ -8054,16 +8080,16 @@ function vf(e, t, n) {
8054
8080
  for (let e of a) s.has(e) && l.add(e);
8055
8081
  return l;
8056
8082
  }
8057
- function yf(e) {
8058
- let t = new Set(e.edges.map((e) => e.targetSocketId)), n = e.nodes.map((e) => _f(e, t)), r = e.nodes.find((e) => e.type === "GeometryNodeSimulationInput"), i = e.nodes.find((e) => e.type === "GeometryNodeSimulationOutput"), a = n;
8083
+ function xf(e) {
8084
+ let t = new Set(e.edges.map((e) => e.targetSocketId)), n = e.nodes.map((e) => yf(e, t)), r = e.nodes.find((e) => e.type === "GeometryNodeSimulationInput"), i = e.nodes.find((e) => e.type === "GeometryNodeSimulationOutput"), a = n;
8059
8085
  if (r && i) {
8060
- let t = vf(r.id, i.id, e);
8086
+ let t = bf(r.id, i.id, e);
8061
8087
  if (t.size > 0) {
8062
8088
  let i = new Map(e.nodes.map((e) => [e.id, e])), o = Infinity, s = Infinity, c = -Infinity, l = -Infinity;
8063
8089
  for (let e of t) {
8064
8090
  let t = i.get(e);
8065
8091
  if (!t) continue;
8066
- let n = t.width, r = gf(t);
8092
+ let n = t.width, r = vf(t);
8067
8093
  o = Math.min(o, t.position.x), s = Math.min(s, t.position.y), c = Math.max(c, t.position.x + n), l = Math.max(l, t.position.y + r);
8068
8094
  }
8069
8095
  if (Number.isFinite(o) && Number.isFinite(s) && Number.isFinite(c) && Number.isFinite(l)) {
@@ -8111,7 +8137,7 @@ function yf(e) {
8111
8137
  }
8112
8138
  //#endregion
8113
8139
  //#region src/gn/exporter/nodebpyExporter.ts
8114
- function bf(e, t) {
8140
+ function Sf(e, t) {
8115
8141
  let n = e.node_trees;
8116
8142
  if (!Array.isArray(n) || t.size === 0) return e;
8117
8143
  let r = new Map(n.map((e) => [e.id, e])), i = /* @__PURE__ */ new Set(), a = [];
@@ -8171,25 +8197,25 @@ function bf(e, t) {
8171
8197
  }
8172
8198
  //#endregion
8173
8199
  //#region src/utils/encodeTreeClipperPayload.ts
8174
- var xf = "TreeClipper::";
8175
- function Sf(e) {
8200
+ var Cf = "TreeClipper::";
8201
+ function wf(e) {
8176
8202
  let t = "", n = 32768;
8177
8203
  for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
8178
8204
  return btoa(t);
8179
8205
  }
8180
- async function Cf(e) {
8206
+ async function Tf(e) {
8181
8207
  let t = new Blob([e]).stream().pipeThrough(new CompressionStream("gzip")), n = await new Response(t).arrayBuffer();
8182
8208
  return new Uint8Array(n);
8183
8209
  }
8184
- async function wf(e) {
8185
- return xf + Sf(await Cf(new TextEncoder().encode(e)));
8210
+ async function Ef(e) {
8211
+ return Cf + wf(await Tf(new TextEncoder().encode(e)));
8186
8212
  }
8187
8213
  //#endregion
8188
8214
  //#region src/gn/ir/curvePath.ts
8189
- function Tf(e, t) {
8215
+ function Df(e, t) {
8190
8216
  return Math.sqrt(e * e + t * t);
8191
8217
  }
8192
- function Ef(e) {
8218
+ function Of(e) {
8193
8219
  let t = e.length, n = e.map(({ location: [n, r], handleType: i }, a) => {
8194
8220
  let o = a > 0 ? e[a - 1].location : null, s = a < t - 1 ? e[a + 1].location : null;
8195
8221
  if (i === "VECTOR") return {
@@ -8199,11 +8225,11 @@ function Ef(e) {
8199
8225
  let c = 0, l = 0, u = 0, d = 0;
8200
8226
  if (o && s) {
8201
8227
  let e = n - o[0], t = r - o[1], i = s[0] - n, a = s[1] - r;
8202
- if (u = Tf(e, t), d = Tf(i, a), u > 1e-8 && d > 1e-8) {
8203
- let n = e / u + i / d, r = t / u + a / d, o = Tf(n, r);
8228
+ if (u = Df(e, t), d = Df(i, a), u > 1e-8 && d > 1e-8) {
8229
+ let n = e / u + i / d, r = t / u + a / d, o = Df(n, r);
8204
8230
  o > 1e-8 && (c = n / o, l = r / o);
8205
8231
  } else d > 1e-8 ? (c = (s[0] - n) / d, l = (s[1] - r) / d) : u > 1e-8 && (c = (n - o[0]) / u, l = (r - o[1]) / u);
8206
- } else s ? (d = Tf(s[0] - n, s[1] - r), d > 1e-8 && (c = (s[0] - n) / d, l = (s[1] - r) / d)) : o && (u = Tf(n - o[0], r - o[1]), u > 1e-8 && (c = (n - o[0]) / u, l = (r - o[1]) / u));
8232
+ } else s ? (d = Df(s[0] - n, s[1] - r), d > 1e-8 && (c = (s[0] - n) / d, l = (s[1] - r) / d)) : o && (u = Df(n - o[0], r - o[1]), u > 1e-8 && (c = (n - o[0]) / u, l = (r - o[1]) / u));
8207
8233
  let f = [n - c * u / 3, r - l * u / 3], p = [n + c * d / 3, r + l * d / 3];
8208
8234
  if (i === "AUTO_CLAMPED") {
8209
8235
  if (o) {
@@ -8248,7 +8274,7 @@ function Ef(e) {
8248
8274
  }
8249
8275
  return n;
8250
8276
  }
8251
- function Df(e, t, n, r, i, a, o) {
8277
+ function kf(e, t, n, r, i, a, o) {
8252
8278
  let s = r - t || 1, c = i - n || 1, l = (e) => (e - t) / s * a, u = (e) => (1 - (e - n) / c) * o;
8253
8279
  if (e.length < 2) return {
8254
8280
  strokePath: "",
@@ -8256,7 +8282,7 @@ function Df(e, t, n, r, i, a, o) {
8256
8282
  zeroLinePath: "",
8257
8283
  dotPositions: []
8258
8284
  };
8259
- let d = Ef(e), [f, p] = e[0].location, m = `M ${l(f).toFixed(2)} ${u(p).toFixed(2)}`;
8285
+ let d = Of(e), [f, p] = e[0].location, m = `M ${l(f).toFixed(2)} ${u(p).toFixed(2)}`;
8260
8286
  for (let t = 0; t < e.length - 1; t++) {
8261
8287
  let n = d[t].right, r = d[t + 1].left, [i, a] = e[t + 1].location;
8262
8288
  m += ` C ${l(n[0]).toFixed(2)} ${u(n[1]).toFixed(2)},`, m += ` ${l(r[0]).toFixed(2)} ${u(r[1]).toFixed(2)},`, m += ` ${l(i).toFixed(2)} ${u(a).toFixed(2)}`;
@@ -8271,18 +8297,18 @@ function Df(e, t, n, r, i, a, o) {
8271
8297
  }
8272
8298
  //#endregion
8273
8299
  //#region src/gn/components/groupNavContext.ts
8274
- var Of = t(null);
8275
- function kf() {
8276
- return o(Of);
8300
+ var Af = t(null);
8301
+ function jf() {
8302
+ return o(Af);
8277
8303
  }
8278
8304
  //#endregion
8279
8305
  //#region src/gn/components/GenericGNNode.tsx
8280
- var Af = [
8306
+ var Mf = [
8281
8307
  "X",
8282
8308
  "Y",
8283
8309
  "Z",
8284
8310
  "W"
8285
- ], jf = {
8311
+ ], Nf = {
8286
8312
  FLOAT: "Float",
8287
8313
  INT: "Integer",
8288
8314
  VECTOR: "Vector",
@@ -8290,7 +8316,7 @@ var Af = [
8290
8316
  STRING: "String",
8291
8317
  BOOLEAN: "Boolean",
8292
8318
  ROTATION: "Rotation"
8293
- }, Mf = {
8319
+ }, Pf = {
8294
8320
  EQUAL: "Equal",
8295
8321
  NOT_EQUAL: "Not Equal",
8296
8322
  LESS_THAN: "Less Than",
@@ -8336,10 +8362,10 @@ var Af = [
8336
8362
  RADIANS: "To Radians",
8337
8363
  DEGREES: "To Degrees"
8338
8364
  };
8339
- function Nf(e, t) {
8340
- return e === "data_type" ? jf[t] ?? t : e === "operation" ? Mf[t] ?? t : e === "use_clamp" ? "Clamp" : t;
8365
+ function Ff(e, t) {
8366
+ return e === "data_type" ? Nf[t] ?? t : e === "operation" ? Pf[t] ?? t : e === "use_clamp" ? "Clamp" : t;
8341
8367
  }
8342
- function Pf(e) {
8368
+ function If(e) {
8343
8369
  switch (e) {
8344
8370
  case "LINE": return "gn-socket--line";
8345
8371
  case "DIAMOND": return "gn-socket--diamond";
@@ -8348,55 +8374,55 @@ function Pf(e) {
8348
8374
  default: return "gn-socket--circle";
8349
8375
  }
8350
8376
  }
8351
- function Ff(e) {
8377
+ function Lf(e) {
8352
8378
  return e === "ROTATION" ? "°" : e === "FLOAT" ? " m" : "";
8353
8379
  }
8354
- function If(e) {
8380
+ function Rf(e) {
8355
8381
  return parseFloat(e.toFixed(3)).toString();
8356
8382
  }
8357
- function Lf(e, t) {
8358
- return typeof e == "boolean" ? e ? "True" : "False" : typeof e == "string" ? e : `${If(e)}${Ff(t)}`;
8383
+ function zf(e, t) {
8384
+ return typeof e == "boolean" ? e ? "True" : "False" : typeof e == "string" ? e : `${Rf(e)}${Lf(t)}`;
8359
8385
  }
8360
- function Rf(e) {
8386
+ function Bf(e) {
8361
8387
  return Math.round(Math.min(1, Math.max(0, e)) * 255);
8362
8388
  }
8363
- function zf(e) {
8389
+ function Vf(e) {
8364
8390
  let [t, n, r, i = 1] = e.values;
8365
8391
  return /* @__PURE__ */ g("div", {
8366
8392
  className: "gn-node__color-swatch",
8367
- style: { background: `rgba(${Rf(t)},${Rf(n)},${Rf(r)},${i.toFixed(2)})` }
8393
+ style: { background: `rgba(${Bf(t)},${Bf(n)},${Bf(r)},${i.toFixed(2)})` }
8368
8394
  });
8369
8395
  }
8370
- function Bf(e) {
8371
- if (e.dataType === "RGBA") return /* @__PURE__ */ g(zf, { values: e.values });
8372
- let t = Ff(e.dataType);
8396
+ function Hf(e) {
8397
+ if (e.dataType === "RGBA") return /* @__PURE__ */ g(Vf, { values: e.values });
8398
+ let t = Lf(e.dataType);
8373
8399
  return /* @__PURE__ */ g("div", {
8374
8400
  className: "gn-node__vec-block",
8375
8401
  children: e.values.slice(0, 4).map((e, n) => /* @__PURE__ */ _("div", {
8376
8402
  className: "gn-node__vec-row",
8377
8403
  children: [/* @__PURE__ */ g("span", {
8378
8404
  className: "gn-node__vec-label",
8379
- children: Af[n]
8405
+ children: Mf[n]
8380
8406
  }), /* @__PURE__ */ _("span", {
8381
8407
  className: "gn-node__vec-value",
8382
- children: [If(e), t]
8408
+ children: [Rf(e), t]
8383
8409
  })]
8384
8410
  }, n))
8385
8411
  });
8386
8412
  }
8387
- function Vf({ properties: e }) {
8413
+ function Uf({ properties: e }) {
8388
8414
  let t = Object.entries(e);
8389
8415
  return t.length === 0 ? null : /* @__PURE__ */ g("div", {
8390
8416
  className: "gn-node__props",
8391
8417
  children: t.map(([e, t]) => /* @__PURE__ */ g("div", {
8392
8418
  className: "gn-node__prop-row",
8393
- children: Nf(e, t)
8419
+ children: Ff(e, t)
8394
8420
  }, e))
8395
8421
  });
8396
8422
  }
8397
- var Hf = 120, Uf = 6;
8398
- function Wf({ curve: e, width: t }) {
8399
- let n = Math.max(10, t - Uf * 2), r = Hf, { strokePath: i, fillPath: a, zeroLinePath: o, dotPositions: s } = Df(e.points, e.clipMinX, e.clipMinY, e.clipMaxX, e.clipMaxY, n, r);
8423
+ var Wf = 120, Gf = 6;
8424
+ function Kf({ curve: e, width: t }) {
8425
+ let n = Math.max(10, t - Gf * 2), r = Wf, { strokePath: i, fillPath: a, zeroLinePath: o, dotPositions: s } = kf(e.points, e.clipMinX, e.clipMinY, e.clipMaxX, e.clipMaxY, n, r);
8400
8426
  return /* @__PURE__ */ g("div", {
8401
8427
  className: "gn-node__curve-wrap",
8402
8428
  children: /* @__PURE__ */ _("svg", {
@@ -8427,7 +8453,7 @@ function Wf({ curve: e, width: t }) {
8427
8453
  })
8428
8454
  });
8429
8455
  }
8430
- function Gf(e) {
8456
+ function qf(e) {
8431
8457
  let { socket: t, position: n, type: r, align: i, suppressDefault: a } = e, o = t.name.trim().length === 0, s = !a && !t.hideValue && t.defaultValue?.kind === "scalar";
8432
8458
  return /* @__PURE__ */ _("div", {
8433
8459
  className: `gn-node__socket-row gn-node__socket-row--${i}`,
@@ -8436,7 +8462,7 @@ function Gf(e) {
8436
8462
  id: t.id,
8437
8463
  type: r,
8438
8464
  position: n,
8439
- className: `gn-socket ${Pf(t.displayShape)}`,
8465
+ className: `gn-socket ${If(t.displayShape)}`,
8440
8466
  style: {
8441
8467
  top: "50%",
8442
8468
  background: t.color,
@@ -8449,15 +8475,15 @@ function Gf(e) {
8449
8475
  }),
8450
8476
  s && t.defaultValue?.kind === "scalar" ? /* @__PURE__ */ g("span", {
8451
8477
  className: "gn-node__value",
8452
- children: Lf(t.defaultValue.value, t.dataType)
8478
+ children: zf(t.defaultValue.value, t.dataType)
8453
8479
  }) : null
8454
8480
  ]
8455
8481
  });
8456
8482
  }
8457
- function Kf(e, t) {
8483
+ function Jf(e, t) {
8458
8484
  return !t && !e.hideValue && e.defaultValue?.kind === "vec";
8459
8485
  }
8460
- function qf() {
8486
+ function Yf() {
8461
8487
  return /* @__PURE__ */ _("div", {
8462
8488
  className: "gn-node__stack",
8463
8489
  "aria-hidden": "true",
@@ -8468,8 +8494,8 @@ function qf() {
8468
8494
  ]
8469
8495
  });
8470
8496
  }
8471
- function Jf(e) {
8472
- let t = e.data, n = kf(), r = new Set(t.connectedInputIds ?? []), i = t.outputs.filter((e) => e.enabled), a = t.inputs.filter((e) => e.enabled), o = t.groupTreeId, s = o !== void 0 && t.groupTreeName !== void 0 && !!n;
8497
+ function Xf(e) {
8498
+ let t = e.data, n = jf(), r = new Set(t.connectedInputIds ?? []), i = t.outputs.filter((e) => e.enabled), a = t.inputs.filter((e) => e.enabled), o = t.groupTreeId, s = o !== void 0 && t.groupTreeName !== void 0 && !!n;
8473
8499
  return /* @__PURE__ */ _("div", {
8474
8500
  className: `gn-node${s ? " gn-node--group nodrag" : ""}`,
8475
8501
  onClick: s ? () => n.openGroup(o) : void 0,
@@ -8484,15 +8510,15 @@ function Jf(e) {
8484
8510
  children: t.label
8485
8511
  })
8486
8512
  }),
8487
- s && /* @__PURE__ */ g(qf, {}),
8488
- t.properties && /* @__PURE__ */ g(Vf, { properties: t.properties }),
8489
- t.floatCurve && /* @__PURE__ */ g(Wf, {
8513
+ s && /* @__PURE__ */ g(Yf, {}),
8514
+ t.properties && /* @__PURE__ */ g(Uf, { properties: t.properties }),
8515
+ t.floatCurve && /* @__PURE__ */ g(Kf, {
8490
8516
  curve: t.floatCurve,
8491
8517
  width: t.width
8492
8518
  }),
8493
8519
  /* @__PURE__ */ _("div", {
8494
8520
  className: "gn-node__body",
8495
- children: [i.map((e) => /* @__PURE__ */ g(Gf, {
8521
+ children: [i.map((e) => /* @__PURE__ */ g(qf, {
8496
8522
  socket: e,
8497
8523
  position: Y.Right,
8498
8524
  type: "source",
@@ -8500,13 +8526,13 @@ function Jf(e) {
8500
8526
  suppressDefault: !0
8501
8527
  }, e.id)), a.map((e) => {
8502
8528
  let t = r.has(e.id);
8503
- return /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(Gf, {
8529
+ return /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(qf, {
8504
8530
  socket: e,
8505
8531
  position: Y.Left,
8506
8532
  type: "target",
8507
8533
  align: "left",
8508
8534
  suppressDefault: t
8509
- }), Kf(e, t) ? /* @__PURE__ */ g(Bf, {
8535
+ }), Jf(e, t) ? /* @__PURE__ */ g(Hf, {
8510
8536
  values: e.defaultValue.values,
8511
8537
  dataType: e.dataType
8512
8538
  }) : null] }, e.id);
@@ -8517,7 +8543,7 @@ function Jf(e) {
8517
8543
  }
8518
8544
  //#endregion
8519
8545
  //#region src/gn/components/RerouteNode.tsx
8520
- function Yf(e) {
8546
+ function Zf(e) {
8521
8547
  let t = e.data;
8522
8548
  return /* @__PURE__ */ _("div", {
8523
8549
  className: "gn-reroute",
@@ -8537,7 +8563,7 @@ function Yf(e) {
8537
8563
  }
8538
8564
  //#endregion
8539
8565
  //#region src/gn/components/SimulationZoneFrame.tsx
8540
- function Xf(e) {
8566
+ function Qf(e) {
8541
8567
  let t = e.data;
8542
8568
  return /* @__PURE__ */ g("div", {
8543
8569
  className: "gn-sim-zone",
@@ -8564,30 +8590,30 @@ function Xf(e) {
8564
8590
  }
8565
8591
  //#endregion
8566
8592
  //#region src/gn/components/GeometryNodesFlow.tsx
8567
- var Zf = {
8568
- gnNode: Jf,
8569
- rerouteNode: Yf,
8570
- simulationZone: Xf
8571
- }, Qf = { padding: .08 }, $f = 120;
8572
- function ep(e) {
8593
+ var $f = {
8594
+ gnNode: Xf,
8595
+ rerouteNode: Zf,
8596
+ simulationZone: Qf
8597
+ }, ep = { padding: .08 }, tp = 120;
8598
+ function np(e) {
8573
8599
  let t = e.style?.height;
8574
8600
  if (typeof t == "number") return t;
8575
8601
  let n = e.data, r = Math.max(n?.inputs?.length ?? 0, n?.outputs?.length ?? 0);
8576
8602
  return Math.max(60, 32 + r * 18 + 16);
8577
8603
  }
8578
- function tp(e) {
8604
+ function rp(e) {
8579
8605
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
8580
8606
  for (let a of e) {
8581
8607
  if (a.parentId) continue;
8582
- let e = a.style?.width ?? a.width ?? 200, o = ep(a);
8608
+ let e = a.style?.width ?? a.width ?? 200, o = np(a);
8583
8609
  t = Math.min(t, a.position.x), n = Math.min(n, a.position.y), r = Math.max(r, a.position.x + e), i = Math.max(i, a.position.y + o);
8584
8610
  }
8585
- return Number.isFinite(t) ? [[t - $f, n - $f], [r + $f, i + $f]] : [[-Infinity, -Infinity], [Infinity, Infinity]];
8611
+ return Number.isFinite(t) ? [[t - tp, n - tp], [r + tp, i + tp]] : [[-Infinity, -Infinity], [Infinity, Infinity]];
8586
8612
  }
8587
- function np(e) {
8588
- let { nodes: t, edges: n, jsonText: r, breadcrumbs: i, onNavigate: o, onSelectionIds: s, onCopiedMagicString: l, zoomOnScroll: p = !0 } = e, { fitView: m } = ll(), h = d(null), v = d(!1), y = d([]), [b, x] = f(null), [S, C] = f(!1), [w, T] = f(!1), E = d([]), [D, O, k] = fd(t), [A, j, M] = pd(n), N = u(() => tp(t), [t]);
8613
+ function ip(e) {
8614
+ let { nodes: t, edges: n, jsonText: r, breadcrumbs: i, onNavigate: o, onSelectionIds: s, onCopiedMagicString: l, zoomOnScroll: p = !0 } = e, { fitView: m } = ll(), h = d(null), v = d(!1), y = d([]), [b, x] = f(null), [S, C] = f(!1), [w, T] = f(!1), E = d([]), [D, O, k] = fd(t), [A, j, M] = pd(n), N = u(() => rp(t), [t]);
8589
8615
  c(() => {
8590
- O(t), s?.([]), v.current = !1, m(Qf);
8616
+ O(t), s?.([]), v.current = !1, m(ep);
8591
8617
  }, [
8592
8618
  t,
8593
8619
  O,
@@ -8599,7 +8625,7 @@ function np(e) {
8599
8625
  let e = h.current;
8600
8626
  if (!e) return;
8601
8627
  let t = new ResizeObserver(() => {
8602
- v.current || m(Qf);
8628
+ v.current || m(ep);
8603
8629
  });
8604
8630
  return t.observe(e), () => t.disconnect();
8605
8631
  }, [m]);
@@ -8616,7 +8642,7 @@ function np(e) {
8616
8642
  }, []), L = a(async () => {
8617
8643
  x(null);
8618
8644
  try {
8619
- let e = JSON.parse(r), t = new Set(y.current.map(Number).filter(Number.isFinite)), n = t.size > 0 ? bf(e, t) : e, i = await wf(JSON.stringify(n));
8645
+ let e = JSON.parse(r), t = new Set(y.current.map(Number).filter(Number.isFinite)), n = t.size > 0 ? Sf(e, t) : e, i = await Ef(JSON.stringify(n));
8620
8646
  if (await navigator.clipboard.writeText(i), l) {
8621
8647
  l();
8622
8648
  return;
@@ -8650,9 +8676,9 @@ function np(e) {
8650
8676
  onEdgesChange: M,
8651
8677
  onSelectionChange: F,
8652
8678
  onMoveStart: P,
8653
- nodeTypes: Zf,
8679
+ nodeTypes: $f,
8654
8680
  fitView: !0,
8655
- fitViewOptions: Qf,
8681
+ fitViewOptions: ep,
8656
8682
  minZoom: .2,
8657
8683
  translateExtent: N,
8658
8684
  nodesDraggable: !1,
@@ -8681,7 +8707,7 @@ function np(e) {
8681
8707
  className: "gn-top-left",
8682
8708
  children: [/* @__PURE__ */ _("span", {
8683
8709
  className: "gn-version-badge",
8684
- children: ["node-web-render v", "0.3.11"]
8710
+ children: ["node-web-render v", "0.3.12"]
8685
8711
  }), i.length > 1 ? /* @__PURE__ */ g("nav", {
8686
8712
  className: "gn-breadcrumbs",
8687
8713
  "aria-label": "Node group path",
@@ -8734,19 +8760,19 @@ function np(e) {
8734
8760
  ]
8735
8761
  });
8736
8762
  }
8737
- function rp(e) {
8763
+ function ap(e) {
8738
8764
  let { jsonText: t, showHeader: n = !0, onSelectionChange: r, onCopiedMagicString: i, zoomOnScroll: o = !0 } = e, [s, l] = f({
8739
8765
  json: t,
8740
8766
  ids: []
8741
8767
  }), d = u(() => {
8742
8768
  if (!t.trim()) return null;
8743
8769
  try {
8744
- let { rootId: e, trees: n } = ff(JSON.parse(t)), r = {};
8770
+ let { rootId: e, trees: n } = mf(JSON.parse(t)), r = {};
8745
8771
  for (let e of Object.values(n)) {
8746
- let t = hf(e);
8772
+ let t = _f(e);
8747
8773
  r[t.id] = {
8748
8774
  graph: t,
8749
- flow: yf(t)
8775
+ flow: xf(t)
8750
8776
  };
8751
8777
  }
8752
8778
  return {
@@ -8810,9 +8836,9 @@ function rp(e) {
8810
8836
  className: "flow-error",
8811
8837
  role: "alert",
8812
8838
  children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children: d.error })]
8813
- }) : m ? /* @__PURE__ */ g(Of.Provider, {
8839
+ }) : m ? /* @__PURE__ */ g(Af.Provider, {
8814
8840
  value: v,
8815
- children: /* @__PURE__ */ g(sd, { children: /* @__PURE__ */ g(np, {
8841
+ children: /* @__PURE__ */ g(sd, { children: /* @__PURE__ */ g(ip, {
8816
8842
  nodes: m.flow.nodes,
8817
8843
  edges: m.flow.edges,
8818
8844
  jsonText: t,
@@ -8834,7 +8860,7 @@ function rp(e) {
8834
8860
  }
8835
8861
  //#endregion
8836
8862
  //#region src/components/TreeClipperLogo.tsx
8837
- function ip({ className: e }) {
8863
+ function op({ className: e }) {
8838
8864
  return /* @__PURE__ */ _("svg", {
8839
8865
  viewBox: "0 0 256 256",
8840
8866
  className: e,
@@ -8895,7 +8921,7 @@ function ip({ className: e }) {
8895
8921
  }
8896
8922
  //#endregion
8897
8923
  //#region src/embed.tsx
8898
- function ap(e) {
8924
+ function sp(e) {
8899
8925
  let { payload: t } = e, [n, r] = f(""), [i, a] = f(null), [o, s] = f(!0), [l, u] = f(!1), [p, m] = f(!1), v = d(!1), y = d(!1), b = d(null), S = d(null), C = d(null), w = () => {
8900
8926
  !y.current || v.current || (m(!0), C.current && clearTimeout(C.current), C.current = setTimeout(() => {
8901
8927
  u(!1), m(!1);
@@ -8934,7 +8960,7 @@ function ap(e) {
8934
8960
  className: "gnwr-loading",
8935
8961
  role: "status",
8936
8962
  "aria-live": "polite",
8937
- children: [/* @__PURE__ */ g(ip, { className: "gnwr-loading__logo" }), /* @__PURE__ */ g("span", {
8963
+ children: [/* @__PURE__ */ g(op, { className: "gnwr-loading__logo" }), /* @__PURE__ */ g("span", {
8938
8964
  className: "gnwr-loading__label",
8939
8965
  children: "Loading graph…"
8940
8966
  })]
@@ -8943,7 +8969,7 @@ function ap(e) {
8943
8969
  role: "alert",
8944
8970
  children: [/* @__PURE__ */ g("strong", { children: "Decode error" }), /* @__PURE__ */ g("span", { children: i })]
8945
8971
  }) : /* @__PURE__ */ _(h, { children: [
8946
- /* @__PURE__ */ g(rp, {
8972
+ /* @__PURE__ */ g(ap, {
8947
8973
  jsonText: n,
8948
8974
  showHeader: !1,
8949
8975
  zoomOnScroll: !1,
@@ -8968,7 +8994,7 @@ function ap(e) {
8968
8994
  strokeLinecap: "round",
8969
8995
  strokeLinejoin: "round"
8970
8996
  })
8971
- }), /* @__PURE__ */ g("span", { children: "Copied!" })] }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(ip, { className: "gnwr-copy-button__logo" }), /* @__PURE__ */ g("span", { children: "Copy TreeClipper Magic String" })] })
8997
+ }), /* @__PURE__ */ g("span", { children: "Copied!" })] }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(op, { className: "gnwr-copy-button__logo" }), /* @__PURE__ */ g("span", { children: "Copy TreeClipper Magic String" })] })
8972
8998
  }),
8973
8999
  (l || p) && /* @__PURE__ */ _("div", {
8974
9000
  className: `gnwr-copy-toast${p ? " gnwr-leaving" : ""}`,
@@ -8993,22 +9019,22 @@ function ap(e) {
8993
9019
  })
8994
9020
  });
8995
9021
  }
8996
- var op = /* @__PURE__ */ new Map(), sp = null;
8997
- function cp(e, t) {
8998
- op.get(e)?.unmount();
9022
+ var cp = /* @__PURE__ */ new Map(), lp = null;
9023
+ function up(e, t) {
9024
+ cp.get(e)?.unmount();
8999
9025
  let r = m(e);
9000
- op.set(e, r), sp = e;
9026
+ cp.set(e, r), lp = e;
9001
9027
  let i = t.onClose;
9002
- return r.render(n(ap, {
9028
+ return r.render(n(sp, {
9003
9029
  ...t,
9004
9030
  onClose: i ? () => {
9005
- lp(e), i();
9031
+ dp(e), i();
9006
9032
  } : void 0
9007
- })), () => lp(e);
9033
+ })), () => dp(e);
9008
9034
  }
9009
- function lp(e) {
9010
- let t = e ?? sp;
9011
- t && (op.get(t)?.unmount(), op.delete(t), t === sp && (sp = null));
9035
+ function dp(e) {
9036
+ let t = e ?? lp;
9037
+ t && (cp.get(t)?.unmount(), cp.delete(t), t === lp && (lp = null));
9012
9038
  }
9013
9039
  //#endregion
9014
- export { ap as GraphView, cp as mountGraphView, lp as unmountGraphView };
9040
+ export { sp as GraphView, up as mountGraphView, dp as unmountGraphView };
@@ -1 +1 @@
1
- export declare function nodeHeaderColor(blIdname: string): string;
1
+ export declare function nodeHeaderColor(blIdname: string, dataType?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonodes-web-render",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Browser-based viewer for Blender Geometry Nodes exported via Tree Clipper. Renders node trees as a read-only, Blender-styled graph.",
5
5
  "type": "module",
6
6
  "exports": {