@stackmango/graff 0.1.2 → 0.1.7

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/js/index.js CHANGED
@@ -263,9 +263,40 @@ function CO() {
263
263
  return Yh || (Yh = 1, process.env.NODE_ENV === "production" ? vi.exports = kO() : vi.exports = EO()), vi.exports;
264
264
  }
265
265
  var Pe = CO();
266
- const bx = (e) => {
266
+ const it = {
267
+ magnitude: (e, t) => {
268
+ let n = Math.abs(e.x - t.x), r = Math.abs(e.y - t.y);
269
+ return Math.sqrt(Math.pow(n, 2) + Math.pow(r, 2));
270
+ },
271
+ translateOrigin: (e, t) => {
272
+ let n = 0 - e.x, r = 0 - e.y;
273
+ return { x: t.x + n, y: t.y + r };
274
+ },
275
+ add: (e, t) => ({ x: e.x + t.x, y: e.y + t.y }),
276
+ subtract: (e, t) => ({ x: e.x - t.x, y: e.y - t.y }),
277
+ getAngle: (e, t, n) => {
278
+ let r = it.subtract(t, e), a = Math.atan2(r.y, r.x);
279
+ return n == "radian" ? a : (console.log("Angle", e, t, r, 57.29 * a), 57.29 * a);
280
+ },
281
+ getUnitVector: (e) => {
282
+ let t = Math.sqrt(Math.pow(e.x, 2) + Math.pow(e.y, 2));
283
+ return {
284
+ x: e.x / t,
285
+ y: e.y / t
286
+ };
287
+ },
288
+ getScaledVector: (e, t) => {
289
+ let n = it.getUnitVector(e);
290
+ return {
291
+ x: n.x * t,
292
+ y: n.y * t
293
+ };
294
+ },
295
+ getVectorMagnitude: (e) => Math.sqrt(Math.pow(e.x, 2) + Math.pow(e.y, 2)),
296
+ ORIGIN: { x: 0, y: 0 }
297
+ }, bx = (e) => {
267
298
  const t = Mt((n) => {
268
- console.log("Recieved Event", n, e), e.reducer(e.value, { type: "set-text", payload: n });
299
+ e.reducer(e.value, { type: "set-text", payload: n });
269
300
  }, [e]);
270
301
  return /* @__PURE__ */ Pe.jsx("div", { children: /* @__PURE__ */ Pe.jsx(
271
302
  "input",
@@ -40859,11 +40890,88 @@ const Zz = {
40859
40890
  // component: InputUiElements.date.component,
40860
40891
  // reducer: () => {},
40861
40892
  // },
40862
- }, E4 = (e) => e.oneOf || e.anyOf ? (e.oneOf ?? e.anyOf).map((n) => ({
40893
+ }, E4 = {
40894
+ getPortPosition: (e, t) => {
40895
+ let n = {
40896
+ x: t.id.type == "input" ? 0 : e.dimensions.width - t.dimensions.width,
40897
+ y: (t.id.index - 1) * t.dimensions.height + t.dimensions.height / 2
40898
+ };
40899
+ return it.add(e.position, n);
40900
+ },
40901
+ getAllPortsPositions: (e, t) => {
40902
+ let n = e.dimensions.height / 2 - t.dimensions.slabHeight * t.input.length / 2, r = e.dimensions.height / 2 - t.dimensions.slabHeight * t.output.length / 2, a = t.input.map((s, l) => {
40903
+ let c = {
40904
+ x: t.dimensions.portRadius,
40905
+ y: n + t.dimensions.slabHeight * l + t.dimensions.slabHeight / 2
40906
+ };
40907
+ return { key: s, position: it.add(e.position, c) };
40908
+ }), i = t.output.map((s, l) => {
40909
+ let c = {
40910
+ x: 3 * t.dimensions.portRadius + (e.dimensions.width - 4 * t.dimensions.portRadius),
40911
+ y: r + t.dimensions.slabHeight * l + t.dimensions.slabHeight / 2
40912
+ };
40913
+ return { key: s, position: it.add(e.position, c) };
40914
+ });
40915
+ return { inputPorts: a, outputPorts: i };
40916
+ },
40917
+ // getInputValue:(graph:Graph,port:{nodeId:string,portIndex:number})=>{
40918
+ // let currentNode=graph.nodes.find((item)=>item.id==port.nodeId);
40919
+ // if(currentNode){
40920
+ // let opPort=currentNode.ports.input[port.portIndex];
40921
+ // if(opPort){
40922
+ // let conn=graph.connections.find((item)=>item.id==opPort.connections[0]?.connectionId);
40923
+ // let ipPort=conn?.input?.port;
40924
+ // let ipNode=graph.nodes.find((item)=>item.id==ipPort?.nodeId);
40925
+ // if(ipNode && ipPort?.portId?.index){
40926
+ // return ipNode.ports?.output[ipPort?.portId?.index]?.data?.value
40927
+ // }
40928
+ // }
40929
+ // }
40930
+ // return null
40931
+ // },
40932
+ // executeNode:(nodeId:string,graph:Graph)=>{
40933
+ // let input:any[]=[];
40934
+ // let output:any[]=[];
40935
+ // let currentNode=graph.nodes.find((item)=>item.id==nodeId);
40936
+ // if(currentNode){
40937
+ // input=currentNode.ports.input.map((port)=>NodeUtils.getInputValue(graph,{nodeId:nodeId,portIndex:port.id.index}))
40938
+ // if(currentNode.core.function){
40939
+ // let fn=new Function("input",currentNode.core.function);
40940
+ // output=fn(input);
40941
+ // console.log("Node Execution",nodeId,input,output);
40942
+ // }
40943
+ // }
40944
+ // return {input:input,output:output};
40945
+ // },
40946
+ idDraft: (e) => Object.keys(e).map((n) => ({ id: n, ...e[n] }))
40947
+ // draftNodeMerger:(draftSkeletons:Record<string,any>,draftDesign:Record<string,any>)=>{
40948
+ // let skeletons=NodeUtils.idDraft(draftSkeletons);
40949
+ // return skeletons.map((item)=>({}));
40950
+ // },
40951
+ // convertToForm:(nodeData:Node_Execution_Skeleton_Draft)=>{
40952
+ // }
40953
+ }, Hd = (e) => ({ x: e[0], y: e[1] }), qa = (e) => {
40954
+ let t = (/* @__PURE__ */ new Date()).getTime();
40955
+ return e ? t : t.toString();
40956
+ }, C4 = (e, t) => {
40957
+ let n = {};
40958
+ const r = { ...e.core }, a = r.key;
40959
+ return delete r.key, n[a] = r, r.type == "object" && Object.keys(e.ports.output).forEach((i) => {
40960
+ console.log("Export Details 2", i);
40961
+ const s = Object.keys(t.connections).find((l) => {
40962
+ const c = t.connections[l].from.split("/");
40963
+ return c[0] == e.id && c[2] == i;
40964
+ });
40965
+ if (s) {
40966
+ const l = t.connections[s].to.split("/"), c = { id: l[0], ...t.nodes[l[0]] }, u = C4(c, t);
40967
+ n[a].properties = { ...n[a].properties, ...u };
40968
+ }
40969
+ }), n;
40970
+ }, T4 = (e) => e.oneOf || e.anyOf ? (e.oneOf ?? e.anyOf).map((n) => ({
40863
40971
  value: n.const,
40864
40972
  label: n.title ?? String(n.const)
40865
40973
  })) : [], cO = (e) => {
40866
- const t = Cn(() => E4(e.schema), [e.schema]), n = Mt((r) => {
40974
+ const t = Cn(() => T4(e.schema), [e.schema]), n = Mt((r) => {
40867
40975
  e.reducer(e.value, { type: "add-selection", payload: { selection: r.value, selectType: e.config.isMultiSelect ? "multi" : "single" } });
40868
40976
  }, [e]);
40869
40977
  return /* @__PURE__ */ Pe.jsx("div", { children: /* @__PURE__ */ Pe.jsx("select", { children: t.map(
@@ -40876,7 +40984,7 @@ const Zz = {
40876
40984
  )
40877
40985
  ) }) });
40878
40986
  };
40879
- function C4(e, t, n) {
40987
+ function j4(e, t, n) {
40880
40988
  return Math.max(t, Math.min(e, n));
40881
40989
  }
40882
40990
  const Dt = {
@@ -40900,13 +41008,13 @@ function rx(e, t, n) {
40900
41008
  return t === 0 || Math.abs(t) === 1 / 0 ? Math.pow(e, n * 5) : e * t * n / (t + n * e);
40901
41009
  }
40902
41010
  function ox(e, t, n, r = 0.15) {
40903
- return r === 0 ? C4(e, t, n) : e < t ? -rx(t - e, n - t, r) + t : e > n ? +rx(e - n, n - t, r) + n : e;
41011
+ return r === 0 ? j4(e, t, n) : e < t ? -rx(t - e, n - t, r) + t : e > n ? +rx(e - n, n - t, r) + n : e;
40904
41012
  }
40905
- function T4(e, [t, n], [r, a]) {
41013
+ function D4(e, [t, n], [r, a]) {
40906
41014
  const [[i, s], [l, c]] = e;
40907
41015
  return [ox(t, i, s, r), ox(n, l, c, a)];
40908
41016
  }
40909
- function j4(e, t) {
41017
+ function P4(e, t) {
40910
41018
  if (typeof e != "object" || e === null) return e;
40911
41019
  var n = e[Symbol.toPrimitive];
40912
41020
  if (n !== void 0) {
@@ -40916,12 +41024,12 @@ function j4(e, t) {
40916
41024
  }
40917
41025
  return (t === "string" ? String : Number)(e);
40918
41026
  }
40919
- function D4(e) {
40920
- var t = j4(e, "string");
41027
+ function M4(e) {
41028
+ var t = P4(e, "string");
40921
41029
  return typeof t == "symbol" ? t : String(t);
40922
41030
  }
40923
41031
  function It(e, t, n) {
40924
- return t = D4(t), t in e ? Object.defineProperty(e, t, {
41032
+ return t = M4(t), t in e ? Object.defineProperty(e, t, {
40925
41033
  value: n,
40926
41034
  enumerable: !0,
40927
41035
  configurable: !0,
@@ -40974,27 +41082,27 @@ const uO = {
40974
41082
  function ix(e) {
40975
41083
  return e ? e[0].toUpperCase() + e.slice(1) : "";
40976
41084
  }
40977
- const P4 = ["enter", "leave"];
40978
- function M4(e = !1, t) {
40979
- return e && !P4.includes(t);
41085
+ const R4 = ["enter", "leave"];
41086
+ function N4(e = !1, t) {
41087
+ return e && !R4.includes(t);
40980
41088
  }
40981
- function R4(e, t = "", n = !1) {
41089
+ function I4(e, t = "", n = !1) {
40982
41090
  const r = uO[e], a = r && r[t] || t;
40983
- return "on" + ix(e) + ix(a) + (M4(n, a) ? "Capture" : "");
41091
+ return "on" + ix(e) + ix(a) + (N4(n, a) ? "Capture" : "");
40984
41092
  }
40985
- const N4 = ["gotpointercapture", "lostpointercapture"];
40986
- function I4(e) {
41093
+ const A4 = ["gotpointercapture", "lostpointercapture"];
41094
+ function _4(e) {
40987
41095
  let t = e.substring(2).toLowerCase();
40988
41096
  const n = !!~t.indexOf("passive");
40989
41097
  n && (t = t.replace("passive", ""));
40990
- const r = N4.includes(t) ? "capturecapture" : "capture", a = !!~t.indexOf(r);
41098
+ const r = A4.includes(t) ? "capturecapture" : "capture", a = !!~t.indexOf(r);
40991
41099
  return a && (t = t.replace("capture", "")), {
40992
41100
  device: t,
40993
41101
  capture: a,
40994
41102
  passive: n
40995
41103
  };
40996
41104
  }
40997
- function A4(e, t = "") {
41105
+ function F4(e, t = "") {
40998
41106
  const n = uO[e], r = n && n[t] || t;
40999
41107
  return e + r;
41000
41108
  }
@@ -41004,22 +41112,22 @@ function Sl(e) {
41004
41112
  function dO(e) {
41005
41113
  return Sl(e) ? "touch" : "pointerType" in e ? e.pointerType : "mouse";
41006
41114
  }
41007
- function _4(e) {
41115
+ function $4(e) {
41008
41116
  return Array.from(e.touches).filter((t) => {
41009
41117
  var n, r;
41010
41118
  return t.target === e.currentTarget || ((n = e.currentTarget) === null || n === void 0 || (r = n.contains) === null || r === void 0 ? void 0 : r.call(n, t.target));
41011
41119
  });
41012
41120
  }
41013
- function F4(e) {
41121
+ function V4(e) {
41014
41122
  return e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches : e.targetTouches;
41015
41123
  }
41016
41124
  function pO(e) {
41017
- return Sl(e) ? F4(e)[0] : e;
41125
+ return Sl(e) ? V4(e)[0] : e;
41018
41126
  }
41019
- function $4(e) {
41020
- return _4(e).map((t) => t.identifier);
41127
+ function B4(e) {
41128
+ return $4(e).map((t) => t.identifier);
41021
41129
  }
41022
- function Hd(e) {
41130
+ function Wd(e) {
41023
41131
  const t = pO(e);
41024
41132
  return Sl(e) ? t.identifier : t.pointerId;
41025
41133
  }
@@ -41027,7 +41135,7 @@ function sx(e) {
41027
41135
  const t = pO(e);
41028
41136
  return [t.clientX, t.clientY];
41029
41137
  }
41030
- function V4(e) {
41138
+ function L4(e) {
41031
41139
  const t = {};
41032
41140
  if ("buttons" in e && (t.buttons = e.buttons), "shiftKey" in e) {
41033
41141
  const {
@@ -41048,10 +41156,10 @@ function V4(e) {
41048
41156
  function fs(e, ...t) {
41049
41157
  return typeof e == "function" ? e(...t) : e;
41050
41158
  }
41051
- function B4() {
41159
+ function z4() {
41052
41160
  }
41053
- function L4(...e) {
41054
- return e.length === 0 ? B4 : e.length === 1 ? e[0] : function() {
41161
+ function H4(...e) {
41162
+ return e.length === 0 ? z4 : e.length === 1 ? e[0] : function() {
41055
41163
  let t;
41056
41164
  for (const n of e)
41057
41165
  t = n.apply(this, arguments) || t;
@@ -41061,8 +41169,8 @@ function L4(...e) {
41061
41169
  function lx(e, t) {
41062
41170
  return Object.assign({}, t, e || {});
41063
41171
  }
41064
- const z4 = 32;
41065
- class H4 {
41172
+ const W4 = 32;
41173
+ class q4 {
41066
41174
  constructor(t, n, r) {
41067
41175
  this.ctrl = t, this.args = n, this.key = r, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
41068
41176
  }
@@ -41119,7 +41227,7 @@ class H4 {
41119
41227
  } = this;
41120
41228
  n.args = this.args;
41121
41229
  let i = 0;
41122
- if (t && (n.event = t, r.preventDefault && t.cancelable && n.event.preventDefault(), n.type = t.type, a.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, a.locked = !!document.pointerLockElement, Object.assign(a, V4(t)), a.down = a.pressed = a.buttons % 2 === 1 || a.touches > 0, i = t.timeStamp - n.timeStamp, n.timeStamp = t.timeStamp, n.elapsedTime = n.timeStamp - n.startTime), n._active) {
41230
+ if (t && (n.event = t, r.preventDefault && t.cancelable && n.event.preventDefault(), n.type = t.type, a.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, a.locked = !!document.pointerLockElement, Object.assign(a, L4(t)), a.down = a.pressed = a.buttons % 2 === 1 || a.touches > 0, i = t.timeStamp - n.timeStamp, n.timeStamp = t.timeStamp, n.elapsedTime = n.timeStamp - n.startTime), n._active) {
41123
41231
  const k = n._delta.map(Math.abs);
41124
41232
  Dt.addTo(n._distance, k);
41125
41233
  }
@@ -41141,7 +41249,7 @@ class H4 {
41141
41249
  const [p, g] = n.offset, [[x, w], [S, E]] = n._bounds;
41142
41250
  n.overflow = [p < x ? -1 : p > w ? 1 : 0, g < S ? -1 : g > E ? 1 : 0], n._movementBound[0] = n.overflow[0] ? n._movementBound[0] === !1 ? n._movement[0] : n._movementBound[0] : !1, n._movementBound[1] = n.overflow[1] ? n._movementBound[1] === !1 ? n._movement[1] : n._movementBound[1] : !1;
41143
41251
  const O = n._active ? r.rubberband || [0, 0] : [0, 0];
41144
- if (n.offset = T4(n._bounds, n.offset, O), n.delta = Dt.sub(n.offset, m), this.computeMovement(), b && (!n.last || i > z4)) {
41252
+ if (n.offset = D4(n._bounds, n.offset, O), n.delta = Dt.sub(n.offset, m), this.computeMovement(), b && (!n.last || i > W4)) {
41145
41253
  n.delta = Dt.sub(n.offset, m);
41146
41254
  const k = n.delta.map(Math.abs);
41147
41255
  Dt.addTo(n.distance, k), n.direction = n.delta.map(Math.sign), n._direction = n._delta.map(Math.sign), !n.first && i > 0 && (n.velocity = [k[0] / i, k[1] / i], n.timeDelta = i);
@@ -41159,14 +41267,14 @@ class H4 {
41159
41267
  this.eventStore.clean(), this.timeoutStore.clean();
41160
41268
  }
41161
41269
  }
41162
- function W4([e, t], n) {
41270
+ function U4([e, t], n) {
41163
41271
  const r = Math.abs(e), a = Math.abs(t);
41164
41272
  if (r > a && r > n)
41165
41273
  return "x";
41166
41274
  if (a > r && a > n)
41167
41275
  return "y";
41168
41276
  }
41169
- class q4 extends H4 {
41277
+ class Y4 extends q4 {
41170
41278
  constructor(...t) {
41171
41279
  super(...t), It(this, "aliasKey", "xy");
41172
41280
  }
@@ -41186,7 +41294,7 @@ class q4 extends H4 {
41186
41294
  const n = this.state, r = this.config;
41187
41295
  if (!n.axis && t) {
41188
41296
  const a = typeof r.axisThreshold == "object" ? r.axisThreshold[dO(t)] : r.axisThreshold;
41189
- n.axis = W4(n._movement, a);
41297
+ n.axis = U4(n._movement, a);
41190
41298
  }
41191
41299
  n._blocked = (r.lockDirection || !!r.axis) && !n.axis || !!r.axis && r.axis !== n.axis;
41192
41300
  }
@@ -41261,13 +41369,13 @@ process.env.NODE_ENV === "development" && Object.assign(zh, {
41261
41369
  return NaN;
41262
41370
  }
41263
41371
  });
41264
- const U4 = 0, mi = ht(ht({}, zh), {}, {
41372
+ const K4 = 0, mi = ht(ht({}, zh), {}, {
41265
41373
  axis(e, t, {
41266
41374
  axis: n
41267
41375
  }) {
41268
41376
  if (this.lockDirection = n === "lock", !this.lockDirection) return n;
41269
41377
  },
41270
- axisThreshold(e = U4) {
41378
+ axisThreshold(e = K4) {
41271
41379
  return e;
41272
41380
  },
41273
41381
  bounds(e = {}) {
@@ -41291,7 +41399,7 @@ const U4 = 0, mi = ht(ht({}, zh), {}, {
41291
41399
  ArrowUp: (e, t = 1) => [0, -1 * e * t],
41292
41400
  ArrowDown: (e, t = 1) => [0, e * t]
41293
41401
  };
41294
- class Y4 extends q4 {
41402
+ class G4 extends Y4 {
41295
41403
  constructor(...t) {
41296
41404
  super(...t), It(this, "ingKey", "dragging");
41297
41405
  }
@@ -41328,7 +41436,7 @@ class Y4 extends q4 {
41328
41436
  const n = this.config, r = this.state;
41329
41437
  if (t.buttons != null && (Array.isArray(n.pointerButtons) ? !n.pointerButtons.includes(t.buttons) : n.pointerButtons !== -1 && n.pointerButtons !== t.buttons)) return;
41330
41438
  const a = this.ctrl.setEventIds(t);
41331
- n.pointerCapture && t.target.setPointerCapture(t.pointerId), !(a && a.size > 1 && r._pointerActive) && (this.start(t), this.setupPointer(t), r._pointerId = Hd(t), r._pointerActive = !0, this.computeValues(sx(t)), this.computeInitial(), n.preventScrollAxis && dO(t) !== "mouse" ? (r._active = !1, this.setupScrollPrevention(t)) : n.delay > 0 ? (this.setupDelayTrigger(t), n.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
41439
+ n.pointerCapture && t.target.setPointerCapture(t.pointerId), !(a && a.size > 1 && r._pointerActive) && (this.start(t), this.setupPointer(t), r._pointerId = Wd(t), r._pointerActive = !0, this.computeValues(sx(t)), this.computeInitial(), n.preventScrollAxis && dO(t) !== "mouse" ? (r._active = !1, this.setupScrollPrevention(t)) : n.delay > 0 ? (this.setupDelayTrigger(t), n.triggerAllEvents && (this.compute(t), this.emit())) : this.startPointerDrag(t));
41332
41440
  }
41333
41441
  startPointerDrag(t) {
41334
41442
  const n = this.state;
@@ -41337,7 +41445,7 @@ class Y4 extends q4 {
41337
41445
  pointerMove(t) {
41338
41446
  const n = this.state, r = this.config;
41339
41447
  if (!n._pointerActive) return;
41340
- const a = Hd(t);
41448
+ const a = Wd(t);
41341
41449
  if (n._pointerId !== void 0 && a !== n._pointerId) return;
41342
41450
  const i = sx(t);
41343
41451
  if (document.pointerLockElement === t.target ? n._delta = [t.movementX, t.movementY] : (n._delta = Dt.sub(i, n._values), this.computeValues(i)), Dt.addTo(n._movement, n._delta), this.compute(t), n._delayed && n.intentional) {
@@ -41366,7 +41474,7 @@ class Y4 extends q4 {
41366
41474
  }
41367
41475
  const n = this.state, r = this.config;
41368
41476
  if (!n._active || !n._pointerActive) return;
41369
- const a = Hd(t);
41477
+ const a = Wd(t);
41370
41478
  if (n._pointerId !== void 0 && a !== n._pointerId) return;
41371
41479
  this.state._pointerActive = !1, this.setActive(), this.compute(t);
41372
41480
  const [i, s] = n._distance;
@@ -41403,7 +41511,7 @@ class Y4 extends q4 {
41403
41511
  this.state._preventScroll && t.cancelable && t.preventDefault();
41404
41512
  }
41405
41513
  setupScrollPrevention(t) {
41406
- this.state._preventScroll = !1, K4(t);
41514
+ this.state._preventScroll = !1, X4(t);
41407
41515
  const n = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
41408
41516
  passive: !1
41409
41517
  });
@@ -41432,23 +41540,23 @@ class Y4 extends q4 {
41432
41540
  });
41433
41541
  }
41434
41542
  }
41435
- function K4(e) {
41543
+ function X4(e) {
41436
41544
  "persist" in e && typeof e.persist == "function" && e.persist();
41437
41545
  }
41438
41546
  const bi = typeof window < "u" && window.document && window.document.createElement;
41439
41547
  function fO() {
41440
41548
  return bi && "ontouchstart" in window;
41441
41549
  }
41442
- function G4() {
41550
+ function Z4() {
41443
41551
  return fO() || bi && window.navigator.maxTouchPoints > 1;
41444
41552
  }
41445
- function X4() {
41553
+ function J4() {
41446
41554
  return bi && "onpointerdown" in window;
41447
41555
  }
41448
- function Z4() {
41556
+ function Q4() {
41449
41557
  return bi && "exitPointerLock" in window.document;
41450
41558
  }
41451
- function J4() {
41559
+ function ez() {
41452
41560
  try {
41453
41561
  return "constructor" in GestureEvent;
41454
41562
  } catch {
@@ -41457,12 +41565,12 @@ function J4() {
41457
41565
  }
41458
41566
  const en = {
41459
41567
  isBrowser: bi,
41460
- gesture: J4(),
41568
+ gesture: ez(),
41461
41569
  touch: fO(),
41462
- touchscreen: G4(),
41463
- pointer: X4(),
41464
- pointerLock: Z4()
41465
- }, Q4 = 250, ez = 180, tz = 0.5, nz = 50, rz = 250, oz = 10, px = {
41570
+ touchscreen: Z4(),
41571
+ pointer: J4(),
41572
+ pointerLock: Q4()
41573
+ }, tz = 250, nz = 180, rz = 0.5, oz = 50, az = 250, iz = 10, px = {
41466
41574
  mouse: 0,
41467
41575
  touch: 0,
41468
41576
  pen: 8
@@ -41479,7 +41587,7 @@ const en = {
41479
41587
  preventScrollAxis(e, t, {
41480
41588
  preventScroll: n
41481
41589
  }) {
41482
- if (this.preventScrollDelay = typeof n == "number" ? n : n || n === void 0 && e ? Q4 : void 0, !(!en.touchscreen || n === !1))
41590
+ if (this.preventScrollDelay = typeof n == "number" ? n : n || n === void 0 && e ? tz : void 0, !(!en.touchscreen || n === !1))
41483
41591
  return e || (n !== void 0 ? "y" : void 0);
41484
41592
  },
41485
41593
  pointerCapture(e, t, {
@@ -41500,9 +41608,9 @@ const en = {
41500
41608
  return this.filterTaps = n, this.tapsThreshold = r, i;
41501
41609
  },
41502
41610
  swipe({
41503
- velocity: e = tz,
41504
- distance: t = nz,
41505
- duration: n = rz
41611
+ velocity: e = rz,
41612
+ distance: t = oz,
41613
+ duration: n = az
41506
41614
  } = {}) {
41507
41615
  return {
41508
41616
  velocity: this.transform(Dt.toVector(e)),
@@ -41513,7 +41621,7 @@ const en = {
41513
41621
  delay(e = 0) {
41514
41622
  switch (e) {
41515
41623
  case !0:
41516
- return ez;
41624
+ return nz;
41517
41625
  case !1:
41518
41626
  return 0;
41519
41627
  default:
@@ -41523,7 +41631,7 @@ const en = {
41523
41631
  axisThreshold(e) {
41524
41632
  return e ? ht(ht({}, px), e) : px;
41525
41633
  },
41526
- keyboardDisplacement(e = oz) {
41634
+ keyboardDisplacement(e = iz) {
41527
41635
  return e;
41528
41636
  }
41529
41637
  });
@@ -41604,24 +41712,24 @@ ht(ht({}, mi), {}, {
41604
41712
  mouseOnly: (e = !0) => e
41605
41713
  });
41606
41714
  const mO = /* @__PURE__ */ new Map(), Pp = /* @__PURE__ */ new Map();
41607
- function az(e) {
41715
+ function sz(e) {
41608
41716
  mO.set(e.key, e.engine), Pp.set(e.key, e.resolver);
41609
41717
  }
41610
- const iz = {
41718
+ const lz = {
41611
41719
  key: "drag",
41612
- engine: Y4,
41720
+ engine: G4,
41613
41721
  resolver: hO
41614
41722
  };
41615
- function sz(e, t) {
41723
+ function cz(e, t) {
41616
41724
  if (e == null) return {};
41617
41725
  var n = {}, r = Object.keys(e), a, i;
41618
41726
  for (i = 0; i < r.length; i++)
41619
41727
  a = r[i], !(t.indexOf(a) >= 0) && (n[a] = e[a]);
41620
41728
  return n;
41621
41729
  }
41622
- function lz(e, t) {
41730
+ function uz(e, t) {
41623
41731
  if (e == null) return {};
41624
- var n = sz(e, t), r, a;
41732
+ var n = cz(e, t), r, a;
41625
41733
  if (Object.getOwnPropertySymbols) {
41626
41734
  var i = Object.getOwnPropertySymbols(e);
41627
41735
  for (a = 0; a < i.length; a++)
@@ -41629,7 +41737,7 @@ function lz(e, t) {
41629
41737
  }
41630
41738
  return n;
41631
41739
  }
41632
- const cz = {
41740
+ const dz = {
41633
41741
  target(e) {
41634
41742
  if (e)
41635
41743
  return () => "current" in e ? e.current : e;
@@ -41652,7 +41760,7 @@ const cz = {
41652
41760
  transform(e) {
41653
41761
  return e;
41654
41762
  }
41655
- }, uz = ["target", "eventOptions", "window", "enabled", "transform"];
41763
+ }, pz = ["target", "eventOptions", "window", "enabled", "transform"];
41656
41764
  function Ui(e = {}, t) {
41657
41765
  const n = {};
41658
41766
  for (const [r, a] of Object.entries(t))
@@ -41673,21 +41781,21 @@ function Ui(e = {}, t) {
41673
41781
  }
41674
41782
  return n;
41675
41783
  }
41676
- function dz(e, t, n = {}) {
41784
+ function fz(e, t, n = {}) {
41677
41785
  const r = e, {
41678
41786
  target: a,
41679
41787
  eventOptions: i,
41680
41788
  window: s,
41681
41789
  enabled: l,
41682
41790
  transform: c
41683
- } = r, u = lz(r, uz);
41791
+ } = r, u = uz(r, pz);
41684
41792
  if (n.shared = Ui({
41685
41793
  target: a,
41686
41794
  eventOptions: i,
41687
41795
  window: s,
41688
41796
  enabled: l,
41689
41797
  transform: c
41690
- }, cz), t) {
41798
+ }, dz), t) {
41691
41799
  const d = Pp.get(t);
41692
41800
  n[t] = Ui(ht({
41693
41801
  shared: n.shared
@@ -41712,7 +41820,7 @@ class bO {
41712
41820
  It(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = t, this._gestureKey = n;
41713
41821
  }
41714
41822
  add(t, n, r, a, i) {
41715
- const s = this._listeners, l = A4(n, r), c = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, u = ht(ht({}, c), i);
41823
+ const s = this._listeners, l = F4(n, r), c = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, u = ht(ht({}, c), i);
41716
41824
  t.addEventListener(l, a, u);
41717
41825
  const d = () => {
41718
41826
  t.removeEventListener(l, a, u), s.delete(d);
@@ -41723,7 +41831,7 @@ class bO {
41723
41831
  this._listeners.forEach((t) => t()), this._listeners.clear();
41724
41832
  }
41725
41833
  }
41726
- class pz {
41834
+ class hz {
41727
41835
  constructor() {
41728
41836
  It(this, "_timeouts", /* @__PURE__ */ new Map());
41729
41837
  }
@@ -41740,7 +41848,7 @@ class pz {
41740
41848
  }), this._timeouts.clear();
41741
41849
  }
41742
41850
  }
41743
- class fz {
41851
+ class mz {
41744
41852
  constructor(t) {
41745
41853
  It(this, "gestures", /* @__PURE__ */ new Set()), It(this, "_targetEventStore", new bO(this)), It(this, "gestureEventStores", {}), It(this, "gestureTimeoutStores", {}), It(this, "handlers", {}), It(this, "config", {}), It(this, "pointerIds", /* @__PURE__ */ new Set()), It(this, "touchIds", /* @__PURE__ */ new Set()), It(this, "state", {
41746
41854
  shared: {
@@ -41749,11 +41857,11 @@ class fz {
41749
41857
  ctrlKey: !1,
41750
41858
  altKey: !1
41751
41859
  }
41752
- }), hz(this, t);
41860
+ }), bz(this, t);
41753
41861
  }
41754
41862
  setEventIds(t) {
41755
41863
  if (Sl(t))
41756
- return this.touchIds = new Set($4(t)), this.touchIds;
41864
+ return this.touchIds = new Set(B4(t)), this.touchIds;
41757
41865
  if ("pointerId" in t)
41758
41866
  return t.type === "pointerup" || t.type === "pointercancel" ? this.pointerIds.delete(t.pointerId) : t.type === "pointerdown" && this.pointerIds.add(t.pointerId), this.pointerIds;
41759
41867
  }
@@ -41761,7 +41869,7 @@ class fz {
41761
41869
  this.handlers = t, this.nativeHandlers = n;
41762
41870
  }
41763
41871
  applyConfig(t, n) {
41764
- this.config = dz(t, n, this.config);
41872
+ this.config = fz(t, n, this.config);
41765
41873
  }
41766
41874
  clean() {
41767
41875
  this._targetEventStore.clean();
@@ -41791,14 +41899,14 @@ class fz {
41791
41899
  })), void 0, !0);
41792
41900
  }
41793
41901
  for (const i in r)
41794
- r[i] = L4(...r[i]);
41902
+ r[i] = H4(...r[i]);
41795
41903
  if (!a) return r;
41796
41904
  for (const i in r) {
41797
41905
  const {
41798
41906
  device: s,
41799
41907
  capture: l,
41800
41908
  passive: c
41801
- } = I4(i);
41909
+ } = _4(i);
41802
41910
  this._targetEventStore.add(a, s, "", r[i], {
41803
41911
  capture: l,
41804
41912
  passive: c
@@ -41808,136 +41916,28 @@ class fz {
41808
41916
  }
41809
41917
  }
41810
41918
  function Zr(e, t) {
41811
- e.gestures.add(t), e.gestureEventStores[t] = new bO(e, t), e.gestureTimeoutStores[t] = new pz();
41919
+ e.gestures.add(t), e.gestureEventStores[t] = new bO(e, t), e.gestureTimeoutStores[t] = new hz();
41812
41920
  }
41813
- function hz(e, t) {
41921
+ function bz(e, t) {
41814
41922
  t.drag && Zr(e, "drag"), t.wheel && Zr(e, "wheel"), t.scroll && Zr(e, "scroll"), t.move && Zr(e, "move"), t.pinch && Zr(e, "pinch"), t.hover && Zr(e, "hover");
41815
41923
  }
41816
41924
  const fx = (e, t, n) => (r, a, i, s = {}, l = !1) => {
41817
41925
  var c, u;
41818
41926
  const d = (c = s.capture) !== null && c !== void 0 ? c : t.capture, f = (u = s.passive) !== null && u !== void 0 ? u : t.passive;
41819
- let h = l ? r : R4(r, a, d);
41927
+ let h = l ? r : I4(r, a, d);
41820
41928
  n && f && (h += "Passive"), e[h] = e[h] || [], e[h].push(i);
41821
41929
  };
41822
- function mz(e, t = {}, n, r) {
41823
- const a = F.useMemo(() => new fz(e), []);
41930
+ function gz(e, t = {}, n, r) {
41931
+ const a = F.useMemo(() => new mz(e), []);
41824
41932
  if (a.applyHandlers(e, r), a.applyConfig(t, n), F.useEffect(a.effect.bind(a)), F.useEffect(() => a.clean.bind(a), []), t.target === void 0)
41825
41933
  return a.bind.bind(a);
41826
41934
  }
41827
- function bz(e, t) {
41828
- return az(iz), mz({
41935
+ function yz(e, t) {
41936
+ return sz(lz), gz({
41829
41937
  drag: e
41830
41938
  }, {}, "drag");
41831
41939
  }
41832
- const it = {
41833
- magnitude: (e, t) => {
41834
- let n = Math.abs(e.x - t.x), r = Math.abs(e.y - t.y);
41835
- return Math.sqrt(Math.pow(n, 2) + Math.pow(r, 2));
41836
- },
41837
- translateOrigin: (e, t) => {
41838
- let n = 0 - e.x, r = 0 - e.y;
41839
- return { x: t.x + n, y: t.y + r };
41840
- },
41841
- add: (e, t) => ({ x: e.x + t.x, y: e.y + t.y }),
41842
- subtract: (e, t) => ({ x: e.x - t.x, y: e.y - t.y }),
41843
- getAngle: (e, t, n) => {
41844
- let r = it.subtract(t, e), a = Math.atan2(r.y, r.x);
41845
- return n == "radian" ? a : (console.log("Angle", e, t, r, 57.29 * a), 57.29 * a);
41846
- },
41847
- getUnitVector: (e) => {
41848
- let t = Math.sqrt(Math.pow(e.x, 2) + Math.pow(e.y, 2));
41849
- return {
41850
- x: e.x / t,
41851
- y: e.y / t
41852
- };
41853
- },
41854
- getScaledVector: (e, t) => {
41855
- let n = it.getUnitVector(e);
41856
- return {
41857
- x: n.x * t,
41858
- y: n.y * t
41859
- };
41860
- },
41861
- getVectorMagnitude: (e) => Math.sqrt(Math.pow(e.x, 2) + Math.pow(e.y, 2)),
41862
- ORIGIN: { x: 0, y: 0 }
41863
- }, gz = {
41864
- getPortPosition: (e, t) => {
41865
- let n = {
41866
- x: t.id.type == "input" ? 0 : e.dimensions.width - t.dimensions.width,
41867
- y: (t.id.index - 1) * t.dimensions.height + t.dimensions.height / 2
41868
- };
41869
- return it.add(e.position, n);
41870
- },
41871
- getAllPortsPositions: (e, t) => {
41872
- let n = e.dimensions.height / 2 - t.dimensions.slabHeight * t.input.length / 2, r = e.dimensions.height / 2 - t.dimensions.slabHeight * t.output.length / 2, a = t.input.map((s, l) => {
41873
- let c = {
41874
- x: t.dimensions.portRadius,
41875
- y: n + t.dimensions.slabHeight * l + t.dimensions.slabHeight / 2
41876
- };
41877
- return { key: s, position: it.add(e.position, c) };
41878
- }), i = t.output.map((s, l) => {
41879
- let c = {
41880
- x: 3 * t.dimensions.portRadius + (e.dimensions.width - 4 * t.dimensions.portRadius),
41881
- y: r + t.dimensions.slabHeight * l + t.dimensions.slabHeight / 2
41882
- };
41883
- return { key: s, position: it.add(e.position, c) };
41884
- });
41885
- return { inputPorts: a, outputPorts: i };
41886
- },
41887
- // getInputValue:(graph:Graph,port:{nodeId:string,portIndex:number})=>{
41888
- // let currentNode=graph.nodes.find((item)=>item.id==port.nodeId);
41889
- // if(currentNode){
41890
- // let opPort=currentNode.ports.input[port.portIndex];
41891
- // if(opPort){
41892
- // let conn=graph.connections.find((item)=>item.id==opPort.connections[0]?.connectionId);
41893
- // let ipPort=conn?.input?.port;
41894
- // let ipNode=graph.nodes.find((item)=>item.id==ipPort?.nodeId);
41895
- // if(ipNode && ipPort?.portId?.index){
41896
- // return ipNode.ports?.output[ipPort?.portId?.index]?.data?.value
41897
- // }
41898
- // }
41899
- // }
41900
- // return null
41901
- // },
41902
- // executeNode:(nodeId:string,graph:Graph)=>{
41903
- // let input:any[]=[];
41904
- // let output:any[]=[];
41905
- // let currentNode=graph.nodes.find((item)=>item.id==nodeId);
41906
- // if(currentNode){
41907
- // input=currentNode.ports.input.map((port)=>NodeUtils.getInputValue(graph,{nodeId:nodeId,portIndex:port.id.index}))
41908
- // if(currentNode.core.function){
41909
- // let fn=new Function("input",currentNode.core.function);
41910
- // output=fn(input);
41911
- // console.log("Node Execution",nodeId,input,output);
41912
- // }
41913
- // }
41914
- // return {input:input,output:output};
41915
- // },
41916
- idDraft: (e) => Object.keys(e).map((n) => ({ id: n, ...e[n] }))
41917
- // draftNodeMerger:(draftSkeletons:Record<string,any>,draftDesign:Record<string,any>)=>{
41918
- // let skeletons=NodeUtils.idDraft(draftSkeletons);
41919
- // return skeletons.map((item)=>({}));
41920
- // },
41921
- // convertToForm:(nodeData:Node_Execution_Skeleton_Draft)=>{
41922
- // }
41923
- }, Wd = (e) => ({ x: e[0], y: e[1] }), qa = (e) => {
41924
- let t = (/* @__PURE__ */ new Date()).getTime();
41925
- return e ? t : t.toString();
41926
- }, yz = (e, t) => {
41927
- let n = {};
41928
- const r = { ...e.core }, a = r.key;
41929
- return delete r.key, n[a] = r, console.log("Export Details 1", e.id), r.type == "object" && Object.keys(e.ports.output).forEach((i) => {
41930
- console.log("Export Details 2", i);
41931
- const s = Object.keys(t.connections).find((l) => {
41932
- const c = t.connections[l].from.split("/");
41933
- return c[0] == e.id && c[2] == i;
41934
- });
41935
- if (console.log("Export Details 3", s), s) {
41936
- const l = t.connections[s].to.split("/"), c = { id: l[0], ...t.nodes[l[0]] }, u = yz(c, t);
41937
- console.log("Child Schema", n[a].properties, u), n[a].properties = { ...n[a].properties, ...u };
41938
- }
41939
- }), n;
41940
- }, Mp = {
41940
+ const Mp = {
41941
41941
  shiftPosition: (e, t, n) => {
41942
41942
  let r = {}, a = Object.keys(n);
41943
41943
  return Object.values(n).forEach((i, s) => {
@@ -41977,8 +41977,8 @@ const it = {
41977
41977
  children: e.children
41978
41978
  }
41979
41979
  ), xz = (e) => {
41980
- const { assets: t, view: n, dragSession: r, interaction: a, config: i } = e.config.stateFetcher() ?? {}, s = bz(({ first: p, last: g, down: x, delta: w, xy: S, event: E, initial: O }) => {
41981
- const k = Wd(O), j = Wd(S), N = Wd(w);
41980
+ const { assets: t, view: n, dragSession: r, interaction: a, config: i } = e.config.stateFetcher() ?? {}, s = yz(({ first: p, last: g, down: x, delta: w, xy: S, event: E, initial: O }) => {
41981
+ const k = Hd(O), j = Hd(S), N = Hd(w);
41982
41982
  if (E.stopPropagation(), p) {
41983
41983
  const A = new CustomEvent("dragstart-" + e.id, {
41984
41984
  detail: {
@@ -42189,7 +42189,7 @@ const it = {
42189
42189
  if (j.detail.dragElement?.type == "connection-tip") {
42190
42190
  let N = { workspace: it.ORIGIN, viewspace: { x: -c.data.documentPosition.x, y: -c.data.documentPosition.y }, viewport: c.data.viewportPosition }, A = Mp.shiftPosition({ type: "viewport", position: j.detail.currentDragPosition }, "workspace", N), $ = j.detail.dragElement.id.split("/"), P = u.data.connections[$[0]], y = $[1] == "from" ? P.skeleton.to : P.skeleton.from, _ = qa();
42191
42191
  Object.keys(l.data.nodes).filter((T) => T != y.split("/")[0]).forEach((T) => {
42192
- let D = gz.getAllPortsPositions(
42192
+ let D = E4.getAllPortsPositions(
42193
42193
  {
42194
42194
  position: c.data.nodes[T]?.position,
42195
42195
  dimensions: d.data.nodeDimensions
@@ -43113,13 +43113,13 @@ export {
43113
43113
  s6 as FormInputElements,
43114
43114
  r6 as InteractionReducer,
43115
43115
  i6 as JSONForms,
43116
- gz as NodeUtils,
43116
+ E4 as NodeUtils,
43117
43117
  qa as UIDCreator,
43118
43118
  Zz as UiElementsRegistry_Standard,
43119
43119
  it as VectorApi,
43120
43120
  n6 as ViewReducer,
43121
43121
  Jz as Workspace,
43122
43122
  o6 as getSchemaNode,
43123
- yz as schemaNodeExporter,
43123
+ C4 as schemaNodeExporter,
43124
43124
  a6 as useWorkspace
43125
43125
  };