geonodes-web-render 0.3.29 → 0.3.30

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
@@ -8088,47 +8088,50 @@ function wf(e, t) {
8088
8088
  if (!e?.data) throw Error(`"node_trees[${t}].data" is missing.`);
8089
8089
  if (!e.data.nodes?.data?.items) throw Error(`"node_trees[${t}].data.nodes.data.items" is missing.`);
8090
8090
  if (!e.data.links?.data?.items) throw Error(`"node_trees[${t}].data.links.data.items" is missing.`);
8091
+ let n = /* @__PURE__ */ new Map();
8092
+ for (let t of e.data.nodes.data.items) t?.data?.name && n.set(t.data.name, String(t.id));
8091
8093
  return {
8092
8094
  id: String(e.id),
8093
8095
  label: e.data.name,
8094
8096
  nodes: e.data.nodes.data.items.map((e, t) => {
8095
8097
  if (!e?.data) throw Error(`Node at index ${t} is missing ".data".`);
8096
- let n = e.data.location_absolute ?? e.data.location ?? [0, 0];
8097
- if (e.data.bl_idname === "NodeReroute") return vf(e, n);
8098
- let r = (e.data.outputs?.data?.items ?? []).map((t, n) => {
8098
+ let r = e.data.location_absolute ?? e.data.location ?? [0, 0];
8099
+ if (e.data.bl_idname === "NodeReroute") return vf(e, r);
8100
+ let i = (e.data.outputs?.data?.items ?? []).map((t, n) => {
8099
8101
  if (!t?.data) throw Error(`Node "${e.data.name}" output socket ${n} is missing ".data".`);
8100
8102
  return bf(t, n);
8101
8103
  });
8102
- e.data.bl_idname === "FunctionNodeInputVector" && Array.isArray(e.data.vector) && (r[0] &&= {
8103
- ...r[0],
8104
+ e.data.bl_idname === "FunctionNodeInputVector" && Array.isArray(e.data.vector) && (i[0] &&= {
8105
+ ...i[0],
8104
8106
  defaultValue: {
8105
8107
  kind: "vec",
8106
8108
  values: e.data.vector
8107
8109
  }
8108
8110
  });
8109
- let i = (e.data.inputs?.data?.items ?? []).map((t, n) => {
8111
+ let a = (e.data.inputs?.data?.items ?? []).map((t, n) => {
8110
8112
  if (!t?.data) throw Error(`Node "${e.data.name}" input socket ${n} is missing ".data".`);
8111
8113
  return bf(t, n);
8112
8114
  });
8113
- (e.data.bl_idname === "ShaderNodeCombineColor" || e.data.bl_idname === "ShaderNodeSeparateColor") && (i = gf(i, e.data.mode));
8114
- let a = e.data.bl_idname === "ShaderNodeFloatCurve" ? mf(e) : void 0, o = e.data.bl_idname === "ShaderNodeValToRGB" ? hf(e) : void 0, s = Sf(e);
8115
+ (e.data.bl_idname === "ShaderNodeCombineColor" || e.data.bl_idname === "ShaderNodeSeparateColor") && (a = gf(a, e.data.mode));
8116
+ let o = e.data.bl_idname === "ShaderNodeFloatCurve" ? mf(e) : void 0, s = e.data.bl_idname === "ShaderNodeValToRGB" ? hf(e) : void 0, c = Sf(e);
8115
8117
  return {
8116
8118
  id: String(e.id),
8117
8119
  type: e.data.bl_idname,
8118
8120
  label: Cf(e),
8119
8121
  position: {
8120
- x: n[0],
8121
- y: -n[1]
8122
+ x: r[0],
8123
+ y: -r[1]
8122
8124
  },
8123
8125
  width: e.data.width ?? 140,
8124
8126
  headerColor: cf(e.data.bl_idname, e.data.data_type),
8125
- inputs: i,
8126
- outputs: r,
8127
- floatCurve: a,
8128
- colorRamp: o,
8129
- ...s ? { properties: s } : {},
8127
+ inputs: a,
8128
+ outputs: i,
8129
+ floatCurve: o,
8130
+ colorRamp: s,
8131
+ ...c ? { properties: c } : {},
8130
8132
  ...e.data.node_tree == null ? {} : { groupTreeId: String(e.data.node_tree) },
8131
- ...e.data.parent == null ? {} : { parentFrameId: String(e.data.parent) }
8133
+ ...e.data.parent == null ? {} : { parentFrameId: String(e.data.parent) },
8134
+ ...e.data.paired_output && n.has(e.data.paired_output) ? { pairedOutputId: n.get(e.data.paired_output) } : {}
8132
8135
  };
8133
8136
  }),
8134
8137
  links: e.data.links.data.items.map((e, t) => {
@@ -8194,7 +8197,8 @@ function Of(e) {
8194
8197
  properties: e.properties,
8195
8198
  groupTreeId: e.groupTreeId,
8196
8199
  groupTreeName: e.groupTreeName,
8197
- parentFrameId: e.parentFrameId
8200
+ parentFrameId: e.parentFrameId,
8201
+ pairedOutputId: e.pairedOutputId
8198
8202
  })), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
8199
8203
  for (let e of t) for (let t of [...e.inputs, ...e.outputs]) n.set(t.id, e.id), r.set(t.id, t);
8200
8204
  let i = /* @__PURE__ */ new Map();
@@ -8284,7 +8288,65 @@ function jf(e) {
8284
8288
  }
8285
8289
  return r;
8286
8290
  }
8287
- function Mf(e, t, n) {
8291
+ var Mf = [
8292
+ {
8293
+ input: "GeometryNodeSimulationInput",
8294
+ output: "GeometryNodeSimulationOutput",
8295
+ kind: "simulation"
8296
+ },
8297
+ {
8298
+ input: "GeometryNodeRepeatInput",
8299
+ output: "GeometryNodeRepeatOutput",
8300
+ kind: "repeat"
8301
+ },
8302
+ {
8303
+ input: "GeometryNodeForeachGeometryElementInput",
8304
+ output: "GeometryNodeForeachGeometryElementOutput",
8305
+ kind: "foreach"
8306
+ },
8307
+ {
8308
+ input: "NodeClosureInput",
8309
+ output: "NodeClosureOutput",
8310
+ kind: "closure"
8311
+ }
8312
+ ];
8313
+ function Nf(e) {
8314
+ let t = new Map(e.nodes.map((e) => [e.id, e])), n = [];
8315
+ for (let r of Mf) {
8316
+ let i = e.nodes.filter((e) => e.type === r.input), a = e.nodes.filter((e) => e.type === r.output);
8317
+ for (let o of i) {
8318
+ let i = (o.pairedOutputId === void 0 ? void 0 : t.get(o.pairedOutputId)) ?? (a.length === 1 ? a[0] : void 0);
8319
+ if (!i || i.type !== r.output) continue;
8320
+ let s = Ff(o.id, i.id, e);
8321
+ if (s.size === 0) continue;
8322
+ let c = Infinity, l = -Infinity;
8323
+ for (let e of s) {
8324
+ let n = t.get(e);
8325
+ n && (c = Math.min(c, n.position.y), l = Math.max(l, n.position.y + Af(n).h));
8326
+ }
8327
+ let u = o.position.x + o.width / 2, d = i.position.x + i.width / 2, f = Math.min(u, d), p = Math.max(u, d);
8328
+ !Number.isFinite(c) || !Number.isFinite(l) || !Number.isFinite(f) || !Number.isFinite(p) || n.push({
8329
+ id: `zone:${r.kind}:${o.id}`,
8330
+ type: "simulationZone",
8331
+ position: {
8332
+ x: f,
8333
+ y: c - 26
8334
+ },
8335
+ draggable: !1,
8336
+ selectable: !1,
8337
+ connectable: !1,
8338
+ data: { kind: r.kind },
8339
+ style: {
8340
+ width: p - f,
8341
+ height: l - c + 52,
8342
+ zIndex: -10
8343
+ }
8344
+ });
8345
+ }
8346
+ }
8347
+ return n;
8348
+ }
8349
+ function Pf(e, t, n) {
8288
8350
  if (e.type === "NodeReroute") {
8289
8351
  let t = e.outputs[0]?.color ?? e.inputs[0]?.color ?? "#888888";
8290
8352
  return {
@@ -8326,7 +8388,7 @@ function Mf(e, t, n) {
8326
8388
  }
8327
8389
  };
8328
8390
  }
8329
- function Nf(e, t, n) {
8391
+ function Ff(e, t, n) {
8330
8392
  let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
8331
8393
  for (let e of n.nodes) r.set(e.id, []), i.set(e.id, []);
8332
8394
  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);
@@ -8350,41 +8412,10 @@ function Nf(e, t, n) {
8350
8412
  for (let e of a) s.has(e) && l.add(e);
8351
8413
  return l;
8352
8414
  }
8353
- function Pf(e) {
8354
- let t = new Set(e.edges.map((e) => e.targetSocketId)), n = new Set(e.edges.map((e) => e.sourceSocketId)), r = jf(e), i = e.nodes.filter((e) => e.type !== "NodeFrame").map((e) => Mf(e, t, n)), a = e.nodes.find((e) => e.type === "GeometryNodeSimulationInput"), o = e.nodes.find((e) => e.type === "GeometryNodeSimulationOutput"), s = i;
8355
- if (a && o) {
8356
- let t = Nf(a.id, o.id, e);
8357
- if (t.size > 0) {
8358
- let n = new Map(e.nodes.map((e) => [e.id, e])), r = Infinity, c = -Infinity;
8359
- for (let e of t) {
8360
- let t = n.get(e);
8361
- t && (r = Math.min(r, t.position.y), c = Math.max(c, t.position.y + kf(t)));
8362
- }
8363
- let l = a.position.x + a.width / 2, u = o.position.x + o.width / 2, d = Math.min(l, u), f = Math.max(l, u);
8364
- if (Number.isFinite(r) && Number.isFinite(c) && Number.isFinite(d) && Number.isFinite(f)) {
8365
- let e = d, t = r - 26, n = f - d, o = c - r + 52;
8366
- s = [{
8367
- id: `zone:simulation:${a.id}`,
8368
- type: "simulationZone",
8369
- position: {
8370
- x: e,
8371
- y: t
8372
- },
8373
- draggable: !1,
8374
- selectable: !1,
8375
- connectable: !1,
8376
- data: {},
8377
- style: {
8378
- width: n,
8379
- height: o,
8380
- zIndex: -10
8381
- }
8382
- }, ...i];
8383
- }
8384
- }
8385
- }
8415
+ function If(e) {
8416
+ let t = new Set(e.edges.map((e) => e.targetSocketId)), n = new Set(e.edges.map((e) => e.sourceSocketId)), r = jf(e), i = e.nodes.filter((e) => e.type !== "NodeFrame").map((e) => Pf(e, t, n)), a = [...Nf(e), ...i];
8386
8417
  return {
8387
- nodes: [...r, ...s],
8418
+ nodes: [...r, ...a],
8388
8419
  edges: e.edges.map((e) => ({
8389
8420
  id: e.id,
8390
8421
  source: e.sourceNodeId,
@@ -8398,10 +8429,10 @@ function Pf(e) {
8398
8429
  }
8399
8430
  //#endregion
8400
8431
  //#region src/gn/ir/curvePath.ts
8401
- function Ff(e, t) {
8432
+ function Lf(e, t) {
8402
8433
  return Math.sqrt(e * e + t * t);
8403
8434
  }
8404
- function If(e) {
8435
+ function Rf(e) {
8405
8436
  let t = e.length, n = e.map(({ location: [n, r], handleType: i }, a) => {
8406
8437
  let o = a > 0 ? e[a - 1].location : null, s = a < t - 1 ? e[a + 1].location : null;
8407
8438
  if (i === "VECTOR") return {
@@ -8411,11 +8442,11 @@ function If(e) {
8411
8442
  let c = 0, l = 0, u = 0, d = 0;
8412
8443
  if (o && s) {
8413
8444
  let e = n - o[0], t = r - o[1], i = s[0] - n, a = s[1] - r;
8414
- if (u = Ff(e, t), d = Ff(i, a), u > 1e-8 && d > 1e-8) {
8415
- let n = e / u + i / d, r = t / u + a / d, o = Ff(n, r);
8445
+ if (u = Lf(e, t), d = Lf(i, a), u > 1e-8 && d > 1e-8) {
8446
+ let n = e / u + i / d, r = t / u + a / d, o = Lf(n, r);
8416
8447
  o > 1e-8 && (c = n / o, l = r / o);
8417
8448
  } 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);
8418
- } else s ? (d = Ff(s[0] - n, s[1] - r), d > 1e-8 && (c = (s[0] - n) / d, l = (s[1] - r) / d)) : o && (u = Ff(n - o[0], r - o[1]), u > 1e-8 && (c = (n - o[0]) / u, l = (r - o[1]) / u));
8449
+ } else s ? (d = Lf(s[0] - n, s[1] - r), d > 1e-8 && (c = (s[0] - n) / d, l = (s[1] - r) / d)) : o && (u = Lf(n - o[0], r - o[1]), u > 1e-8 && (c = (n - o[0]) / u, l = (r - o[1]) / u));
8419
8450
  let f = [n - c * u / 3, r - l * u / 3], p = [n + c * d / 3, r + l * d / 3];
8420
8451
  if (i === "AUTO_CLAMPED") {
8421
8452
  if (o) {
@@ -8460,7 +8491,7 @@ function If(e) {
8460
8491
  }
8461
8492
  return n;
8462
8493
  }
8463
- function Lf(e, t, n, r, i, a, o) {
8494
+ function zf(e, t, n, r, i, a, o) {
8464
8495
  let s = r - t || 1, c = i - n || 1, l = (e) => (e - t) / s * a, u = (e) => (1 - (e - n) / c) * o;
8465
8496
  if (e.length < 2) return {
8466
8497
  strokePath: "",
@@ -8468,7 +8499,7 @@ function Lf(e, t, n, r, i, a, o) {
8468
8499
  zeroLinePath: "",
8469
8500
  dotPositions: []
8470
8501
  };
8471
- let d = If(e), [f, p] = e[0].location, m = `M ${l(f).toFixed(2)} ${u(p).toFixed(2)}`;
8502
+ let d = Rf(e), [f, p] = e[0].location, m = `M ${l(f).toFixed(2)} ${u(p).toFixed(2)}`;
8472
8503
  for (let t = 0; t < e.length - 1; t++) {
8473
8504
  let n = d[t].right, r = d[t + 1].left, [i, a] = e[t + 1].location;
8474
8505
  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)}`;
@@ -8483,7 +8514,7 @@ function Lf(e, t, n, r, i, a, o) {
8483
8514
  }
8484
8515
  //#endregion
8485
8516
  //#region src/gn/components/ColorRampViz.tsx
8486
- function Rf([e, t, n]) {
8517
+ function Bf([e, t, n]) {
8487
8518
  let r = Math.max(e, t, n), i = r - Math.min(e, t, n), a = 0;
8488
8519
  i !== 0 && (a = r === e ? (t - n) / i % 6 : r === t ? (n - e) / i + 2 : (e - t) / i + 4, a /= 6, a < 0 && (a += 1));
8489
8520
  let o = r === 0 ? 0 : i / r;
@@ -8493,7 +8524,7 @@ function Rf([e, t, n]) {
8493
8524
  r
8494
8525
  ];
8495
8526
  }
8496
- function zf([e, t, n]) {
8527
+ function Vf([e, t, n]) {
8497
8528
  if (t === 0) return [
8498
8529
  n,
8499
8530
  n,
@@ -8533,7 +8564,7 @@ function zf([e, t, n]) {
8533
8564
  ];
8534
8565
  }
8535
8566
  }
8536
- function Bf([e, t, n]) {
8567
+ function Hf([e, t, n]) {
8537
8568
  let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2, o = r - i, s = 0, c = 0;
8538
8569
  return o !== 0 && (c = a > .5 ? o / (2 - r - i) : o / (r + i), s = r === e ? (t - n) / o % 6 : r === t ? (n - e) / o + 2 : (e - t) / o + 4, s /= 6, s < 0 && (s += 1)), [
8539
8570
  s,
@@ -8541,7 +8572,7 @@ function Bf([e, t, n]) {
8541
8572
  a
8542
8573
  ];
8543
8574
  }
8544
- function Vf([e, t, n]) {
8575
+ function Uf([e, t, n]) {
8545
8576
  if (t === 0) return [
8546
8577
  n,
8547
8578
  n,
@@ -8554,9 +8585,9 @@ function Vf([e, t, n]) {
8554
8585
  a(e - 1 / 3)
8555
8586
  ];
8556
8587
  }
8557
- var Hf = (e) => e < 1 ? e : e - 1;
8558
- function Uf(e, t, n, r, i) {
8559
- let a = Hf((r % 1 + 1) % 1), o = Hf((i % 1 + 1) % 1), s = 0;
8588
+ var Wf = (e) => e < 1 ? e : e - 1;
8589
+ function Gf(e, t, n, r, i) {
8590
+ let a = Wf((r % 1 + 1) % 1), o = Wf((i % 1 + 1) % 1), s = 0;
8560
8591
  switch (e) {
8561
8592
  case "NEAR":
8562
8593
  a < o && o - a > .5 ? s = 1 : a > o && o - a < -.5 && (s = 2);
@@ -8572,9 +8603,9 @@ function Uf(e, t, n, r, i) {
8572
8603
  break;
8573
8604
  }
8574
8605
  let c = (e, r) => t * e + n * r;
8575
- return s === 1 ? Hf(c(a + 1, o)) : s === 2 ? Hf(c(a, o + 1)) : c(a, o);
8606
+ return s === 1 ? Wf(c(a + 1, o)) : s === 2 ? Wf(c(a, o + 1)) : c(a, o);
8576
8607
  }
8577
- function Wf(e, t) {
8608
+ function Kf(e, t) {
8578
8609
  let n = [...e.stops].sort((e, t) => e.position - t.position);
8579
8610
  if (n.length === 0) return [
8580
8611
  0,
@@ -8594,7 +8625,7 @@ function Wf(e, t) {
8594
8625
  r === "EASE" && (c = 3 * c * c - 2 * c * c * c);
8595
8626
  let l = c, u = 1 - c, d = u * a.color[3] + l * o.color[3];
8596
8627
  if (e.colorMode === "HSV" || e.colorMode === "HSL") {
8597
- let t = e.colorMode === "HSV" ? Rf : Bf, n = e.colorMode === "HSV" ? zf : Vf, r = t([
8628
+ let t = e.colorMode === "HSV" ? Bf : Hf, n = e.colorMode === "HSV" ? Vf : Uf, r = t([
8598
8629
  a.color[0],
8599
8630
  a.color[1],
8600
8631
  a.color[2]
@@ -8603,7 +8634,7 @@ function Wf(e, t) {
8603
8634
  o.color[1],
8604
8635
  o.color[2]
8605
8636
  ]), [s, c, f] = n([
8606
- Uf(e.hueInterpolation, l, u, i[0], r[0]),
8637
+ Gf(e.hueInterpolation, l, u, i[0], r[0]),
8607
8638
  u * r[1] + l * i[1],
8608
8639
  u * r[2] + l * i[2]
8609
8640
  ]);
@@ -8621,25 +8652,25 @@ function Wf(e, t) {
8621
8652
  d
8622
8653
  ];
8623
8654
  }
8624
- function Gf(e) {
8655
+ function qf(e) {
8625
8656
  let t = Math.min(1, Math.max(0, e));
8626
8657
  return t <= .0031308 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - .055;
8627
8658
  }
8628
- function Kf([e, t, n, r]) {
8629
- let i = (e) => Math.round(Gf(e) * 255);
8659
+ function Jf([e, t, n, r]) {
8660
+ let i = (e) => Math.round(qf(e) * 255);
8630
8661
  return `rgba(${i(e)}, ${i(t)}, ${i(n)}, ${r.toFixed(3)})`;
8631
8662
  }
8632
- var qf = {
8663
+ var Yf = {
8633
8664
  NEAR: "Near",
8634
8665
  FAR: "Far",
8635
8666
  CW: "CW",
8636
8667
  CCW: "CCW"
8637
- }, Jf = 64;
8638
- function Yf({ data: e, width: t }) {
8668
+ }, Xf = 64;
8669
+ function Zf({ data: e, width: t }) {
8639
8670
  let n = [];
8640
- for (let t = 0; t <= Jf; t++) {
8641
- let r = t / Jf;
8642
- n.push(`${Kf(Wf(e, r))} ${(r * 100).toFixed(1)}%`);
8671
+ for (let t = 0; t <= Xf; t++) {
8672
+ let r = t / Xf;
8673
+ n.push(`${Jf(Kf(e, r))} ${(r * 100).toFixed(1)}%`);
8643
8674
  }
8644
8675
  let r = `linear-gradient(to right, ${n.join(", ")})`, i = [...e.stops].sort((e, t) => e.position - t.position), a = i[i.length - 1];
8645
8676
  return /* @__PURE__ */ _("div", {
@@ -8653,7 +8684,7 @@ function Yf({ data: e, width: t }) {
8653
8684
  children: e.colorMode
8654
8685
  }), /* @__PURE__ */ g("span", {
8655
8686
  className: "gn-color-ramp__select",
8656
- children: qf[e.hueInterpolation] ?? e.hueInterpolation
8687
+ children: Yf[e.hueInterpolation] ?? e.hueInterpolation
8657
8688
  })]
8658
8689
  }),
8659
8690
  /* @__PURE__ */ _("div", {
@@ -8673,7 +8704,7 @@ function Yf({ data: e, width: t }) {
8673
8704
  children: ["Pos ", a.position.toFixed(3)]
8674
8705
  }), /* @__PURE__ */ g("span", {
8675
8706
  className: "gn-color-ramp__swatch",
8676
- style: { background: Kf(a.color) }
8707
+ style: { background: Jf(a.color) }
8677
8708
  })]
8678
8709
  })
8679
8710
  ]
@@ -8681,18 +8712,18 @@ function Yf({ data: e, width: t }) {
8681
8712
  }
8682
8713
  //#endregion
8683
8714
  //#region src/gn/components/groupNavContext.ts
8684
- var Xf = t(null);
8685
- function Zf() {
8686
- return o(Xf);
8715
+ var Qf = t(null);
8716
+ function $f() {
8717
+ return o(Qf);
8687
8718
  }
8688
8719
  //#endregion
8689
8720
  //#region src/gn/components/GenericGNNode.tsx
8690
- var Qf = [
8721
+ var ep = [
8691
8722
  "X",
8692
8723
  "Y",
8693
8724
  "Z",
8694
8725
  "W"
8695
- ], $f = {
8726
+ ], tp = {
8696
8727
  FLOAT: "Float",
8697
8728
  INT: "Integer",
8698
8729
  VECTOR: "Vector",
@@ -8701,10 +8732,10 @@ var Qf = [
8701
8732
  BOOLEAN: "Boolean",
8702
8733
  ROTATION: "Rotation"
8703
8734
  };
8704
- function ep(e, t) {
8705
- return e === "data_type" ? $f[t] ?? t : e === "operation" ? uf(t) : e === "use_clamp" ? "Clamp" : t;
8735
+ function np(e, t) {
8736
+ return e === "data_type" ? tp[t] ?? t : e === "operation" ? uf(t) : e === "use_clamp" ? "Clamp" : t;
8706
8737
  }
8707
- function tp(e) {
8738
+ function rp(e) {
8708
8739
  switch (e) {
8709
8740
  case "LINE": return "gn-socket--line";
8710
8741
  case "DIAMOND": return "gn-socket--diamond";
@@ -8713,55 +8744,55 @@ function tp(e) {
8713
8744
  default: return "gn-socket--circle";
8714
8745
  }
8715
8746
  }
8716
- function np(e) {
8747
+ function ip(e) {
8717
8748
  return e === "ROTATION" ? "°" : e === "FLOAT" ? " m" : "";
8718
8749
  }
8719
- function rp(e) {
8750
+ function ap(e) {
8720
8751
  return parseFloat(e.toFixed(3)).toString();
8721
8752
  }
8722
- function ip(e, t) {
8723
- return typeof e == "boolean" ? e ? "True" : "False" : typeof e == "string" ? e : `${rp(e)}${np(t)}`;
8753
+ function op(e, t) {
8754
+ return typeof e == "boolean" ? e ? "True" : "False" : typeof e == "string" ? e : `${ap(e)}${ip(t)}`;
8724
8755
  }
8725
- function ap(e) {
8756
+ function sp(e) {
8726
8757
  return Math.round(Math.min(1, Math.max(0, e)) * 255);
8727
8758
  }
8728
- function op(e) {
8759
+ function cp(e) {
8729
8760
  let [t, n, r, i = 1] = e.values;
8730
8761
  return /* @__PURE__ */ g("div", {
8731
8762
  className: "gn-node__color-swatch",
8732
- style: { background: `rgba(${ap(t)},${ap(n)},${ap(r)},${i.toFixed(2)})` }
8763
+ style: { background: `rgba(${sp(t)},${sp(n)},${sp(r)},${i.toFixed(2)})` }
8733
8764
  });
8734
8765
  }
8735
- function sp(e) {
8736
- if (e.dataType === "RGBA") return /* @__PURE__ */ g(op, { values: e.values });
8737
- let t = np(e.dataType);
8766
+ function lp(e) {
8767
+ if (e.dataType === "RGBA") return /* @__PURE__ */ g(cp, { values: e.values });
8768
+ let t = ip(e.dataType);
8738
8769
  return /* @__PURE__ */ g("div", {
8739
8770
  className: "gn-node__vec-block",
8740
8771
  children: e.values.slice(0, 4).map((e, n) => /* @__PURE__ */ _("div", {
8741
8772
  className: "gn-node__vec-row",
8742
8773
  children: [/* @__PURE__ */ g("span", {
8743
8774
  className: "gn-node__vec-label",
8744
- children: Qf[n]
8775
+ children: ep[n]
8745
8776
  }), /* @__PURE__ */ _("span", {
8746
8777
  className: "gn-node__vec-value",
8747
- children: [rp(e), t]
8778
+ children: [ap(e), t]
8748
8779
  })]
8749
8780
  }, n))
8750
8781
  });
8751
8782
  }
8752
- function cp({ properties: e }) {
8783
+ function up({ properties: e }) {
8753
8784
  let t = Object.entries(e);
8754
8785
  return t.length === 0 ? null : /* @__PURE__ */ g("div", {
8755
8786
  className: "gn-node__props",
8756
8787
  children: t.map(([e, t]) => /* @__PURE__ */ g("div", {
8757
8788
  className: "gn-node__prop-row",
8758
- children: ep(e, t)
8789
+ children: np(e, t)
8759
8790
  }, e))
8760
8791
  });
8761
8792
  }
8762
- var lp = 120, up = 6;
8763
- function dp({ curve: e, width: t }) {
8764
- let n = Math.max(10, t - up * 2), r = lp, { strokePath: i, fillPath: a, zeroLinePath: o, dotPositions: s } = Lf(e.points, e.clipMinX, e.clipMinY, e.clipMaxX, e.clipMaxY, n, r);
8793
+ var dp = 120, fp = 6;
8794
+ function pp({ curve: e, width: t }) {
8795
+ let n = Math.max(10, t - fp * 2), r = dp, { strokePath: i, fillPath: a, zeroLinePath: o, dotPositions: s } = zf(e.points, e.clipMinX, e.clipMinY, e.clipMaxX, e.clipMaxY, n, r);
8765
8796
  return /* @__PURE__ */ g("div", {
8766
8797
  className: "gn-node__curve-wrap",
8767
8798
  children: /* @__PURE__ */ _("svg", {
@@ -8792,7 +8823,7 @@ function dp({ curve: e, width: t }) {
8792
8823
  })
8793
8824
  });
8794
8825
  }
8795
- function fp(e) {
8826
+ function mp(e) {
8796
8827
  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";
8797
8828
  return /* @__PURE__ */ _("div", {
8798
8829
  className: `gn-node__socket-row gn-node__socket-row--${i}`,
@@ -8801,7 +8832,7 @@ function fp(e) {
8801
8832
  id: t.id,
8802
8833
  type: r,
8803
8834
  position: n,
8804
- className: `gn-socket ${tp(t.displayShape)}`,
8835
+ className: `gn-socket ${rp(t.displayShape)}`,
8805
8836
  style: {
8806
8837
  top: "50%",
8807
8838
  background: t.color,
@@ -8814,15 +8845,15 @@ function fp(e) {
8814
8845
  }),
8815
8846
  s && t.defaultValue?.kind === "scalar" ? /* @__PURE__ */ g("span", {
8816
8847
  className: "gn-node__value",
8817
- children: ip(t.defaultValue.value, t.dataType)
8848
+ children: op(t.defaultValue.value, t.dataType)
8818
8849
  }) : null
8819
8850
  ]
8820
8851
  });
8821
8852
  }
8822
- function pp(e, t) {
8853
+ function hp(e, t) {
8823
8854
  return !t && !e.hideValue && e.defaultValue?.kind === "vec";
8824
8855
  }
8825
- function mp() {
8856
+ function gp() {
8826
8857
  return /* @__PURE__ */ _("div", {
8827
8858
  className: "gn-node__stack",
8828
8859
  "aria-hidden": "true",
@@ -8833,8 +8864,8 @@ function mp() {
8833
8864
  ]
8834
8865
  });
8835
8866
  }
8836
- function hp(e) {
8837
- let t = e.data, n = Zf(), 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;
8867
+ function _p(e) {
8868
+ let t = e.data, n = $f(), 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;
8838
8869
  return /* @__PURE__ */ _("div", {
8839
8870
  className: `gn-node${s ? " gn-node--group nodrag" : ""}`,
8840
8871
  onClick: s ? () => n.openGroup(o) : void 0,
@@ -8849,35 +8880,35 @@ function hp(e) {
8849
8880
  children: t.label
8850
8881
  })
8851
8882
  }),
8852
- s && /* @__PURE__ */ g(mp, {}),
8853
- t.properties && /* @__PURE__ */ g(cp, { properties: t.properties }),
8854
- t.floatCurve && /* @__PURE__ */ g(dp, {
8883
+ s && /* @__PURE__ */ g(gp, {}),
8884
+ t.properties && /* @__PURE__ */ g(up, { properties: t.properties }),
8885
+ t.floatCurve && /* @__PURE__ */ g(pp, {
8855
8886
  curve: t.floatCurve,
8856
8887
  width: t.width
8857
8888
  }),
8858
8889
  /* @__PURE__ */ _("div", {
8859
8890
  className: "gn-node__body",
8860
8891
  children: [
8861
- i.map((e) => /* @__PURE__ */ g(fp, {
8892
+ i.map((e) => /* @__PURE__ */ g(mp, {
8862
8893
  socket: e,
8863
8894
  position: Y.Right,
8864
8895
  type: "source",
8865
8896
  align: "right",
8866
8897
  suppressDefault: !0
8867
8898
  }, e.id)),
8868
- t.colorRamp && /* @__PURE__ */ g(Yf, {
8899
+ t.colorRamp && /* @__PURE__ */ g(Zf, {
8869
8900
  data: t.colorRamp,
8870
8901
  width: t.width
8871
8902
  }),
8872
8903
  a.map((e) => {
8873
8904
  let t = r.has(e.id);
8874
- return /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(fp, {
8905
+ return /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g(mp, {
8875
8906
  socket: e,
8876
8907
  position: Y.Left,
8877
8908
  type: "target",
8878
8909
  align: "left",
8879
8910
  suppressDefault: t
8880
- }), pp(e, t) ? /* @__PURE__ */ g(sp, {
8911
+ }), hp(e, t) ? /* @__PURE__ */ g(lp, {
8881
8912
  values: e.defaultValue.values,
8882
8913
  dataType: e.dataType
8883
8914
  }) : null] }, e.id);
@@ -8889,7 +8920,7 @@ function hp(e) {
8889
8920
  }
8890
8921
  //#endregion
8891
8922
  //#region src/gn/components/RerouteNode.tsx
8892
- function gp(e) {
8923
+ function vp(e) {
8893
8924
  let t = e.data;
8894
8925
  return /* @__PURE__ */ _("div", {
8895
8926
  className: "gn-reroute",
@@ -8909,22 +8940,29 @@ function gp(e) {
8909
8940
  }
8910
8941
  //#endregion
8911
8942
  //#region src/gn/components/SimulationZoneFrame.tsx
8912
- function _p() {
8943
+ var yp = {
8944
+ simulation: "102, 65, 98",
8945
+ repeat: "118, 81, 47",
8946
+ foreach: "51, 82, 127",
8947
+ closure: "125, 125, 58"
8948
+ };
8949
+ function bp(e) {
8950
+ let t = yp[e.data.kind ?? "simulation"] ?? yp.simulation;
8913
8951
  return /* @__PURE__ */ g("div", {
8914
8952
  className: "gn-sim-zone",
8915
8953
  style: {
8916
8954
  width: "100%",
8917
8955
  height: "100%",
8918
8956
  borderRadius: 10,
8919
- border: "1.5px solid rgba(102, 65, 98, 0.85)",
8920
- background: "rgba(102, 65, 98, 0.2)",
8957
+ border: `1.5px solid rgba(${t}, 0.85)`,
8958
+ background: `rgba(${t}, 0.2)`,
8921
8959
  pointerEvents: "none"
8922
8960
  }
8923
8961
  });
8924
8962
  }
8925
8963
  //#endregion
8926
8964
  //#region src/gn/components/NodeFrame.tsx
8927
- function vp(e) {
8965
+ function xp(e) {
8928
8966
  let t = e.data;
8929
8967
  return /* @__PURE__ */ g("div", {
8930
8968
  className: "gn-node-frame",
@@ -8954,13 +8992,13 @@ function vp(e) {
8954
8992
  }
8955
8993
  //#endregion
8956
8994
  //#region src/gn/components/GeometryNodesFlow.tsx
8957
- var yp = {
8958
- gnNode: hp,
8959
- rerouteNode: gp,
8960
- simulationZone: _p,
8961
- nodeFrame: vp
8962
- }, bp = { padding: .08 };
8963
- function xp(e) {
8995
+ var Sp = {
8996
+ gnNode: _p,
8997
+ rerouteNode: vp,
8998
+ simulationZone: bp,
8999
+ nodeFrame: xp
9000
+ }, Cp = { padding: .08 };
9001
+ function wp(e) {
8964
9002
  let { nodes: t, edges: n, jsonText: r, breadcrumbs: i, onNavigate: o, onSelectionIds: s, onCopiedMagicString: l, interaction: u = "always", allowCopy: p = !0, allowSelection: m = !0 } = e, { fitView: h, getNodes: v, getNodesBounds: y } = ml(), b = bd(), x = d(null), S = d(!1), C = d([]), [w, D] = f(null), [O, k] = f(!1), [A, j] = f(!1), M = d(null), [N, P] = f("mouse"), F = d(-Infinity), [I, L] = f(!1), [R, z] = f(!1), B = d([]), [V, H, U] = _d(t), [W, G, ee] = vd(n), [te, ne] = f(void 0);
8965
9003
  c(() => {
8966
9004
  if (!b) return;
@@ -8972,7 +9010,7 @@ function xp(e) {
8972
9010
  v,
8973
9011
  y
8974
9012
  ]), c(() => {
8975
- H(t), s?.([]), S.current = !1, h(bp);
9013
+ H(t), s?.([]), S.current = !1, h(Cp);
8976
9014
  }, [
8977
9015
  t,
8978
9016
  H,
@@ -8984,7 +9022,7 @@ function xp(e) {
8984
9022
  let e = x.current;
8985
9023
  if (!e) return;
8986
9024
  let t = new ResizeObserver(() => {
8987
- S.current || h(bp);
9025
+ S.current || h(Cp);
8988
9026
  });
8989
9027
  return t.observe(e), () => t.disconnect();
8990
9028
  }, [h]);
@@ -9066,9 +9104,9 @@ function xp(e) {
9066
9104
  onEdgesChange: ee,
9067
9105
  onSelectionChange: ie,
9068
9106
  onMoveStart: re,
9069
- nodeTypes: yp,
9107
+ nodeTypes: Sp,
9070
9108
  fitView: !0,
9071
- fitViewOptions: bp,
9109
+ fitViewOptions: Cp,
9072
9110
  minZoom: .2,
9073
9111
  translateExtent: te,
9074
9112
  nodesDraggable: !1,
@@ -9106,7 +9144,7 @@ function xp(e) {
9106
9144
  className: "gn-top-left",
9107
9145
  children: [/* @__PURE__ */ _("span", {
9108
9146
  className: "gn-version-badge",
9109
- children: ["node-web-render v", "0.3.29"]
9147
+ children: ["node-web-render v", "0.3.30"]
9110
9148
  }), i.length > 1 ? /* @__PURE__ */ g("nav", {
9111
9149
  className: "gn-breadcrumbs",
9112
9150
  "aria-label": "Node group path",
@@ -9159,7 +9197,7 @@ function xp(e) {
9159
9197
  ]
9160
9198
  });
9161
9199
  }
9162
- function Sp(e) {
9200
+ function Tp(e) {
9163
9201
  let { jsonText: t, showHeader: n = !0, onSelectionChange: r, onCopiedMagicString: i, interaction: o = "always", allowCopy: s = !0, allowSelection: l = !0 } = e, [d, p] = f({
9164
9202
  json: t,
9165
9203
  ids: []
@@ -9171,7 +9209,7 @@ function Sp(e) {
9171
9209
  let t = Of(e);
9172
9210
  r[t.id] = {
9173
9211
  graph: t,
9174
- flow: Pf(t)
9212
+ flow: If(t)
9175
9213
  };
9176
9214
  }
9177
9215
  return {
@@ -9235,9 +9273,9 @@ function Sp(e) {
9235
9273
  className: "flow-error",
9236
9274
  role: "alert",
9237
9275
  children: [/* @__PURE__ */ g("strong", { children: "Parse error" }), /* @__PURE__ */ g("span", { children: m.error })]
9238
- }) : v ? /* @__PURE__ */ g(Xf.Provider, {
9276
+ }) : v ? /* @__PURE__ */ g(Qf.Provider, {
9239
9277
  value: b,
9240
- children: /* @__PURE__ */ g(fd, { children: /* @__PURE__ */ g(xp, {
9278
+ children: /* @__PURE__ */ g(fd, { children: /* @__PURE__ */ g(wp, {
9241
9279
  nodes: v.flow.nodes,
9242
9280
  edges: v.flow.edges,
9243
9281
  jsonText: t,
@@ -9261,7 +9299,7 @@ function Sp(e) {
9261
9299
  }
9262
9300
  //#endregion
9263
9301
  //#region src/components/TreeClipperLogo.tsx
9264
- function Cp({ className: e }) {
9302
+ function Ep({ className: e }) {
9265
9303
  return /* @__PURE__ */ _("svg", {
9266
9304
  viewBox: "0 0 256 256",
9267
9305
  className: e,
@@ -9322,7 +9360,7 @@ function Cp({ className: e }) {
9322
9360
  }
9323
9361
  //#endregion
9324
9362
  //#region src/embed.tsx
9325
- function wp(e) {
9363
+ function Dp(e) {
9326
9364
  let { payload: t, showCopyButton: n = !0, allowSelection: r = !0 } = e, [i, a] = f(""), [o, s] = f(null), [l, u] = f(!0), [p, m] = f([]), [v, y] = f(!1), [b, S] = f(!1), C = d(!1), w = d(!1), D = d(null), O = d(null), k = d(null), A = () => {
9327
9365
  !w.current || C.current || (S(!0), k.current && clearTimeout(k.current), k.current = setTimeout(() => {
9328
9366
  y(!1), S(!1);
@@ -9366,7 +9404,7 @@ function wp(e) {
9366
9404
  className: "gnwr-loading",
9367
9405
  role: "status",
9368
9406
  "aria-live": "polite",
9369
- children: [/* @__PURE__ */ g(Cp, { className: "gnwr-loading__logo" }), /* @__PURE__ */ g("span", {
9407
+ children: [/* @__PURE__ */ g(Ep, { className: "gnwr-loading__logo" }), /* @__PURE__ */ g("span", {
9370
9408
  className: "gnwr-loading__label",
9371
9409
  children: "Loading graph…"
9372
9410
  })]
@@ -9374,7 +9412,7 @@ function wp(e) {
9374
9412
  className: "flow-error",
9375
9413
  role: "alert",
9376
9414
  children: [/* @__PURE__ */ g("strong", { children: "Decode error" }), /* @__PURE__ */ g("span", { children: o })]
9377
- }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(Sp, {
9415
+ }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(Tp, {
9378
9416
  jsonText: i,
9379
9417
  showHeader: !1,
9380
9418
  interaction: "hybrid",
@@ -9401,7 +9439,7 @@ function wp(e) {
9401
9439
  strokeLinecap: "round",
9402
9440
  strokeLinejoin: "round"
9403
9441
  })
9404
- }), /* @__PURE__ */ g("span", { children: "Copied!" })] }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(Cp, { className: "gnwr-copy-button__logo" }), /* @__PURE__ */ g("span", { children: p.length > 0 ? `Copy Magic String of ${p.length} selected node${p.length === 1 ? "" : "s"}` : "Copy TreeClipper Magic String" })] })
9442
+ }), /* @__PURE__ */ g("span", { children: "Copied!" })] }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(Ep, { className: "gnwr-copy-button__logo" }), /* @__PURE__ */ g("span", { children: p.length > 0 ? `Copy Magic String of ${p.length} selected node${p.length === 1 ? "" : "s"}` : "Copy TreeClipper Magic String" })] })
9405
9443
  }), (v || b) && /* @__PURE__ */ _("div", {
9406
9444
  className: `gnwr-copy-toast${b ? " gnwr-leaving" : ""}`,
9407
9445
  role: "status",
@@ -9424,22 +9462,22 @@ function wp(e) {
9424
9462
  })
9425
9463
  });
9426
9464
  }
9427
- var Tp = /* @__PURE__ */ new Map(), Ep = null;
9428
- function Dp(e, t) {
9429
- Tp.get(e)?.unmount();
9465
+ var Op = /* @__PURE__ */ new Map(), kp = null;
9466
+ function Ap(e, t) {
9467
+ Op.get(e)?.unmount();
9430
9468
  let r = m(e);
9431
- Tp.set(e, r), Ep = e;
9469
+ Op.set(e, r), kp = e;
9432
9470
  let i = t.onClose;
9433
- return r.render(n(wp, {
9471
+ return r.render(n(Dp, {
9434
9472
  ...t,
9435
9473
  onClose: i ? () => {
9436
- Op(e), i();
9474
+ jp(e), i();
9437
9475
  } : void 0
9438
- })), () => Op(e);
9476
+ })), () => jp(e);
9439
9477
  }
9440
- function Op(e) {
9441
- let t = e ?? Ep;
9442
- t && (Tp.get(t)?.unmount(), Tp.delete(t), t === Ep && (Ep = null));
9478
+ function jp(e) {
9479
+ let t = e ?? kp;
9480
+ t && (Op.get(t)?.unmount(), Op.delete(t), t === kp && (kp = null));
9443
9481
  }
9444
9482
  //#endregion
9445
- export { wp as GraphView, Dp as mountGraphView, Op as unmountGraphView };
9483
+ export { Dp as GraphView, Ap as mountGraphView, jp as unmountGraphView };
@@ -1 +1,2 @@
1
- export declare function SimulationZoneFrame(): import("react").JSX.Element;
1
+ import { NodeProps } from '@xyflow/react';
2
+ export declare function SimulationZoneFrame(props: NodeProps): import("react").JSX.Element;
@@ -35,6 +35,7 @@ type BlenderNode = {
35
35
  single_output?: number;
36
36
  vector?: number[];
37
37
  node_tree?: number | null;
38
+ paired_output?: string;
38
39
  mode?: string;
39
40
  operation?: string;
40
41
  data_type?: string;
@@ -145,6 +146,8 @@ export type NormalizedNode = {
145
146
  groupTreeName?: string;
146
147
  /** Id of the NodeFrame this node is parented to (Blender "parent"), if any. */
147
148
  parentFrameId?: string;
149
+ /** For zone input nodes (Simulation/Repeat/…): id of the paired output node. */
150
+ pairedOutputId?: string;
148
151
  };
149
152
  export type NormalizedLink = {
150
153
  id: string;
@@ -67,6 +67,8 @@ export type NodeIR = {
67
67
  groupTreeName?: string;
68
68
  /** Id of the NodeFrame this node is parented to (Blender "parent"), if any. */
69
69
  parentFrameId?: string;
70
+ /** For zone input nodes (Simulation/Repeat/…): id of the paired output node. */
71
+ pairedOutputId?: string;
70
72
  };
71
73
  export type EdgeIR = {
72
74
  id: string;
@@ -19,8 +19,9 @@ export type GNRerouteNodeData = {
19
19
  inputSocketId: string;
20
20
  outputSocketId: string;
21
21
  };
22
+ export type ZoneKind = 'simulation' | 'repeat' | 'foreach' | 'closure';
22
23
  export type SimulationZoneNodeData = {
23
- label: string;
24
+ kind: ZoneKind;
24
25
  };
25
26
  export type NodeFrameData = {
26
27
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonodes-web-render",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
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": {