@floegence/floe-webapp-core 0.36.39 → 0.36.40

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.
@@ -1,26 +1,45 @@
1
- import { insert as f, createComponent as d, effect as O, setAttribute as P, template as A, Portal as R, setStyleProperty as B, delegateEvents as V } from "solid-js/web";
2
- import { createSignal as $, onCleanup as G, createMemo as p, For as W, Show as M } from "solid-js";
3
- import { Motion as S } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
4
- import { easing as D, duration as L } from "../../utils/animations.js";
5
- import { Layers as q, Plus as K } from "../icons/index.js";
6
- import { startHotInteraction as N } from "../../utils/hotInteraction.js";
7
- import { startPointerSession as U } from "../ui/pointerSession.js";
8
- import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as H, createWorkbenchEdgeAutoPanController as z, frameFromElement as j } from "./workbenchEdgeAutoPan.js";
9
- var J = /* @__PURE__ */ A("<button type=button class=workbench-dock__item>"), Q = /* @__PURE__ */ A('<div class=workbench-dock data-floe-canvas-interactive=true><button type=button class=workbench-dock__item aria-label="Show all widgets"></button><span class=workbench-dock__divider aria-hidden=true>'), Z = /* @__PURE__ */ A("<div class=workbench-dock-ghost aria-hidden=true><div class=workbench-dock-ghost__halo></div><div class=workbench-dock-ghost__card><div class=workbench-dock-ghost__icon></div><div class=workbench-dock-ghost__copy><div class=workbench-dock-ghost__title></div><div class=workbench-dock-ghost__hint><span>");
10
- const F = 5, tt = ".workbench-dock";
11
- function et(t, s) {
12
- const l = document.querySelector(H);
13
- if (!(l instanceof HTMLElement)) return !1;
14
- const c = l.getBoundingClientRect();
15
- return t >= c.left && t <= c.right && s >= c.top && s <= c.bottom;
1
+ import { insert as _, createComponent as d, effect as M, setAttribute as I, template as X, Portal as K, setStyleProperty as N, delegateEvents as U } from "solid-js/web";
2
+ import { createSignal as R, onCleanup as q, createMemo as z, For as j, Show as x } from "solid-js";
3
+ import { Motion as D } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
4
+ import { easing as L, duration as P } from "../../utils/animations.js";
5
+ import { Layers as J, Plus as Q } from "../icons/index.js";
6
+ import { startHotInteraction as Z } from "../../utils/hotInteraction.js";
7
+ import { startPointerSession as tt } from "../ui/pointerSession.js";
8
+ import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as B, createWorkbenchEdgeAutoPanController as et, frameFromElement as nt } from "./workbenchEdgeAutoPan.js";
9
+ var ot = /* @__PURE__ */ X("<button type=button class=workbench-dock__item>"), rt = /* @__PURE__ */ X('<div class=workbench-dock data-floe-canvas-interactive=true><button type=button class=workbench-dock__item aria-label="Show all widgets"></button><span class=workbench-dock__divider aria-hidden=true>'), it = /* @__PURE__ */ X("<div class=workbench-dock-ghost aria-hidden=true><div class=workbench-dock-ghost__halo></div><div class=workbench-dock-ghost__card><div class=workbench-dock-ghost__icon></div><div class=workbench-dock-ghost__copy><div class=workbench-dock-ghost__title></div><div class=workbench-dock-ghost__hint><span>");
10
+ const H = 5, at = ".workbench-dock";
11
+ function V() {
12
+ const t = document.querySelector(B);
13
+ return t instanceof HTMLElement ? t.getBoundingClientRect() : null;
16
14
  }
17
- function nt(t, s) {
15
+ function A(t, a, r) {
16
+ return t >= r.left && t <= r.right && a >= r.top && a <= r.bottom;
17
+ }
18
+ function lt(t, a) {
19
+ const r = V();
20
+ return r ? A(t, a, r) : !1;
21
+ }
22
+ function st(t, a, r, u) {
23
+ const o = V();
24
+ if (!o) return !1;
25
+ if (A(t, a, o) || A(r, u, o))
26
+ return !0;
27
+ const n = r - t, c = u - a;
28
+ let v = 0, g = 1;
29
+ const f = (h, E) => {
30
+ if (h === 0) return E >= 0;
31
+ const m = E / h;
32
+ return h < 0 ? m > g ? !1 : (m > v && (v = m), !0) : m < v ? !1 : (m < g && (g = m), !0);
33
+ };
34
+ return f(-n, t - o.left) && f(n, o.right - t) && f(-c, a - o.top) && f(c, o.bottom - a);
35
+ }
36
+ function T(t, a) {
18
37
  if (typeof document.elementFromPoint != "function") return !1;
19
- const l = document.elementFromPoint(t, s);
20
- return l instanceof Element && l.closest(tt) !== null;
38
+ const r = document.elementFromPoint(t, a);
39
+ return r instanceof Element && r.closest(at) !== null;
21
40
  }
22
- function ot(t) {
23
- const s = () => t.hoverOffset === -1 ? {
41
+ function ct(t) {
42
+ const a = () => t.hoverOffset === -1 ? {
24
43
  scale: 1.26,
25
44
  y: -6,
26
45
  x: 0
@@ -36,20 +55,20 @@ function ot(t) {
36
55
  scale: 1,
37
56
  y: 0,
38
57
  x: 0
39
- }, l = () => t.hoverOffset === -1, c = (i) => {
40
- i.button === 0 && t.onDragBegin(i, t.type, t.label, t.icon);
58
+ }, r = () => t.hoverOffset === -1, u = (o) => {
59
+ o.button === 0 && t.onDragBegin(o, t.type, t.label, t.icon);
41
60
  };
42
61
  return (() => {
43
- var i = J();
44
- return i.$$pointerdown = c, i.addEventListener("pointerleave", () => t.onLeave()), i.addEventListener("pointerenter", () => t.onEnter()), f(i, d(S.span, {
62
+ var o = ot();
63
+ return o.$$pointerdown = u, o.addEventListener("pointerleave", () => t.onLeave()), o.addEventListener("pointerenter", () => t.onEnter()), _(o, d(D.span, {
45
64
  class: "workbench-dock__tile",
46
65
  get animate() {
47
- return s();
66
+ return a();
48
67
  },
49
68
  get transition() {
50
69
  return {
51
- duration: L.fast,
52
- easing: D.easeOut
70
+ duration: P.fast,
71
+ easing: L.easeOut
53
72
  };
54
73
  },
55
74
  get children() {
@@ -60,54 +79,54 @@ function ot(t) {
60
79
  });
61
80
  })();
62
81
  }
63
- }), null), f(i, d(S.span, {
82
+ }), null), _(o, d(D.span, {
64
83
  class: "workbench-dock__tooltip",
65
84
  get animate() {
66
85
  return {
67
- opacity: l() ? 1 : 0,
68
- y: l() ? -6 : 0
86
+ opacity: r() ? 1 : 0,
87
+ y: r() ? -6 : 0
69
88
  };
70
89
  },
71
90
  get transition() {
72
91
  return {
73
- duration: L.fast,
74
- easing: D.easeOut
92
+ duration: P.fast,
93
+ easing: L.easeOut
75
94
  };
76
95
  },
77
96
  get children() {
78
97
  return t.label;
79
98
  }
80
- }), null), O((n) => {
81
- var u = !!t.active, v = !!l(), h = !!t.isDragging, _ = `${t.label} — click to solo, drag to canvas to create`, b = t.active;
82
- return u !== n.e && i.classList.toggle("is-active", n.e = u), v !== n.t && i.classList.toggle("is-hovered", n.t = v), h !== n.a && i.classList.toggle("is-source-dragging", n.a = h), _ !== n.o && P(i, "aria-label", n.o = _), b !== n.i && P(i, "aria-pressed", n.i = b), n;
99
+ }), null), M((n) => {
100
+ var c = !!t.active, v = !!r(), g = !!t.isDragging, f = `${t.label} — click to solo, drag to canvas to create`, h = t.active;
101
+ return c !== n.e && o.classList.toggle("is-active", n.e = c), v !== n.t && o.classList.toggle("is-hovered", n.t = v), g !== n.a && o.classList.toggle("is-source-dragging", n.a = g), f !== n.o && I(o, "aria-label", n.o = f), h !== n.i && I(o, "aria-pressed", n.i = h), n;
83
102
  }, {
84
103
  e: void 0,
85
104
  t: void 0,
86
105
  a: void 0,
87
106
  o: void 0,
88
107
  i: void 0
89
- }), i;
108
+ }), o;
90
109
  })();
91
110
  }
92
- function gt(t) {
93
- const [s, l] = $(null), [c, i] = $(null);
94
- let n, u, v = null;
95
- G(() => {
96
- u?.stop(), n?.stop({
111
+ function _t(t) {
112
+ const [a, r] = R(null), [u, o] = R(null);
113
+ let n, c, v = null;
114
+ q(() => {
115
+ c?.stop(), n?.stop({
97
116
  reason: "manual_stop",
98
117
  commit: !1
99
- }), n = void 0, c()?.stopInteraction();
118
+ }), n = void 0, u()?.stopInteraction();
100
119
  });
101
- const h = p(() => t.widgetDefinitions.every((e) => t.filters[e.type])), _ = (e) => {
102
- const o = s();
103
- return o === null ? 0 : o === e ? -1 : o === e + 1 ? -2 : o === e - 1 ? 1 : 0;
104
- }, b = () => {
105
- u?.stop(), u = void 0, v = null;
120
+ const g = z(() => t.widgetDefinitions.every((e) => t.filters[e.type])), f = (e) => {
121
+ const i = a();
122
+ return i === null ? 0 : i === e ? -1 : i === e + 1 ? -2 : i === e - 1 ? 1 : 0;
123
+ }, h = () => {
124
+ c?.stop(), c = void 0, v = null;
106
125
  }, E = () => {
107
- !t.viewport || !t.onViewportCommit || (v = t.viewport, u?.stop(), u = z({
126
+ !t.viewport || !t.onViewportCommit || (v = t.viewport, c?.stop(), c = et({
108
127
  readFrame: () => {
109
- const e = document.querySelector(H);
110
- return e instanceof HTMLElement ? j(e) : null;
128
+ const e = document.querySelector(B);
129
+ return e instanceof HTMLElement ? nt(e) : null;
111
130
  },
112
131
  readViewport: () => v ?? t.viewport ?? null,
113
132
  commitViewport: (e) => {
@@ -115,26 +134,26 @@ function gt(t) {
115
134
  },
116
135
  onPanStart: () => t.onViewportInteractionStart?.("pan"),
117
136
  shouldPan: () => {
118
- const e = c();
119
- return !!(e?.moved && e.overCanvas);
137
+ const e = u();
138
+ return !!(e?.moved && e.hasEnteredCanvas && !T(e.clientX, e.clientY));
120
139
  }
121
140
  }));
122
- }, y = (e) => {
123
- const o = c();
124
- if (!o) return;
125
- const r = !o.moved;
126
- if (o.stopInteraction(), b(), i(null), n = void 0, r) {
127
- t.onSoloFilter(o.type);
141
+ }, m = (e) => {
142
+ const i = u();
143
+ if (!i) return;
144
+ const l = !i.moved;
145
+ if (i.stopInteraction(), h(), o(null), n = void 0, l) {
146
+ t.onSoloFilter(i.type);
128
147
  return;
129
148
  }
130
- e && o.overCanvas && t.onCreateAt?.(o.type, o.clientX, o.clientY);
131
- }, g = (e, o, r, C) => {
149
+ e && i.overCanvas && t.onCreateAt?.(i.type, i.clientX, i.clientY);
150
+ }, k = (e, i, l, C) => {
132
151
  e.preventDefault(), n?.stop({
133
152
  reason: "manual_stop",
134
153
  commit: !1
135
- }), E(), i({
136
- type: o,
137
- label: r,
154
+ }), E(), o({
155
+ type: i,
156
+ label: l,
138
157
  icon: C,
139
158
  pointerId: e.pointerId,
140
159
  startClientX: e.clientX,
@@ -143,144 +162,146 @@ function gt(t) {
143
162
  clientY: e.clientY,
144
163
  moved: !1,
145
164
  overCanvas: !1,
146
- stopInteraction: N({
165
+ hasEnteredCanvas: !1,
166
+ stopInteraction: Z({
147
167
  kind: "drag",
148
168
  cursor: "grabbing"
149
169
  })
150
170
  });
151
- const m = (a) => {
152
- let I = !1;
153
- i((k) => {
154
- if (!k || k.pointerId !== a.pointerId) return k;
155
- const T = a.clientX - k.startClientX, x = a.clientY - k.startClientY, X = k.moved || Math.abs(T) > F || Math.abs(x) > F, Y = X && et(a.clientX, a.clientY) && !nt(a.clientX, a.clientY);
156
- return I = Y, {
157
- ...k,
158
- clientX: a.clientX,
159
- clientY: a.clientY,
160
- moved: X,
161
- overCanvas: Y
171
+ const w = (s) => {
172
+ let F = !1;
173
+ o((b) => {
174
+ if (!b || b.pointerId !== s.pointerId) return b;
175
+ const G = s.clientX - b.startClientX, p = s.clientY - b.startClientY, S = b.moved || Math.abs(G) > H || Math.abs(p) > H, O = T(s.clientX, s.clientY), Y = S && lt(s.clientX, s.clientY) && !O, W = S && !O && st(b.clientX, b.clientY, s.clientX, s.clientY), $ = b.hasEnteredCanvas || Y || W;
176
+ return F = S && $ && !O, {
177
+ ...b,
178
+ clientX: s.clientX,
179
+ clientY: s.clientY,
180
+ moved: S,
181
+ overCanvas: Y,
182
+ hasEnteredCanvas: $
162
183
  };
163
- }), I && u?.updatePointer(a.clientX, a.clientY);
184
+ }), F && c?.updatePointer(s.clientX, s.clientY);
164
185
  };
165
- n = U({
186
+ n = tt({
166
187
  pointerEvent: e,
167
188
  captureEl: e.currentTarget,
168
- onMove: m,
189
+ onMove: w,
169
190
  onEnd: ({
170
- commit: a
171
- }) => y(a)
191
+ commit: s
192
+ }) => m(s)
172
193
  });
173
- }, w = () => c()?.type ?? null;
194
+ }, y = () => u()?.type ?? null;
174
195
  return [(() => {
175
- var e = Q(), o = e.firstChild;
176
- return o.nextSibling, e.addEventListener("pointerleave", () => l(null)), o.$$click = () => t.onShowAll(), o.addEventListener("pointerleave", () => l((r) => r === 0 ? null : r)), o.addEventListener("pointerenter", () => l(0)), f(o, d(S.span, {
196
+ var e = rt(), i = e.firstChild;
197
+ return i.nextSibling, e.addEventListener("pointerleave", () => r(null)), i.$$click = () => t.onShowAll(), i.addEventListener("pointerleave", () => r((l) => l === 0 ? null : l)), i.addEventListener("pointerenter", () => r(0)), _(i, d(D.span, {
177
198
  class: "workbench-dock__tile",
178
199
  get animate() {
179
200
  return {
180
- scale: s() === 0 ? 1.26 : 1,
181
- y: s() === 0 ? -6 : 0,
182
- x: s() === 1 ? -5 : 0
201
+ scale: a() === 0 ? 1.26 : 1,
202
+ y: a() === 0 ? -6 : 0,
203
+ x: a() === 1 ? -5 : 0
183
204
  };
184
205
  },
185
206
  get transition() {
186
207
  return {
187
- duration: L.fast,
188
- easing: D.easeOut
208
+ duration: P.fast,
209
+ easing: L.easeOut
189
210
  };
190
211
  },
191
212
  get children() {
192
- return d(q, {
213
+ return d(J, {
193
214
  class: "workbench-dock__icon"
194
215
  });
195
216
  }
196
- }), null), f(o, d(S.span, {
217
+ }), null), _(i, d(D.span, {
197
218
  class: "workbench-dock__tooltip",
198
219
  get animate() {
199
220
  return {
200
- opacity: s() === 0 ? 1 : 0,
201
- y: s() === 0 ? -6 : 0
221
+ opacity: a() === 0 ? 1 : 0,
222
+ y: a() === 0 ? -6 : 0
202
223
  };
203
224
  },
204
225
  get transition() {
205
226
  return {
206
- duration: L.fast,
207
- easing: D.easeOut
227
+ duration: P.fast,
228
+ easing: L.easeOut
208
229
  };
209
230
  },
210
231
  children: "Show all widgets"
211
- }), null), f(e, d(W, {
232
+ }), null), _(e, d(j, {
212
233
  get each() {
213
234
  return t.widgetDefinitions;
214
235
  },
215
- children: (r, C) => {
216
- const m = () => C() + 1;
217
- return d(ot, {
236
+ children: (l, C) => {
237
+ const w = () => C() + 1;
238
+ return d(ct, {
218
239
  get type() {
219
- return r.type;
240
+ return l.type;
220
241
  },
221
242
  get label() {
222
- return r.label;
243
+ return l.label;
223
244
  },
224
245
  get icon() {
225
- return r.icon;
246
+ return l.icon;
226
247
  },
227
248
  get active() {
228
- return t.filters[r.type];
249
+ return t.filters[l.type];
229
250
  },
230
251
  get hoverOffset() {
231
- return _(m());
252
+ return f(w());
232
253
  },
233
254
  get isDragging() {
234
- return w() === r.type;
255
+ return y() === l.type;
235
256
  },
236
- onEnter: () => l(m()),
237
- onLeave: () => l((a) => a === m() ? null : a),
238
- onSolo: () => t.onSoloFilter(r.type),
239
- onDragBegin: g
257
+ onEnter: () => r(w()),
258
+ onLeave: () => r((s) => s === w() ? null : s),
259
+ onSolo: () => t.onSoloFilter(l.type),
260
+ onDragBegin: k
240
261
  });
241
262
  }
242
- }), null), O((r) => {
243
- var C = !!h(), m = s() === 0, a = h();
244
- return C !== r.e && o.classList.toggle("is-active", r.e = C), m !== r.t && o.classList.toggle("is-hovered", r.t = m), a !== r.a && P(o, "aria-pressed", r.a = a), r;
263
+ }), null), M((l) => {
264
+ var C = !!g(), w = a() === 0, s = g();
265
+ return C !== l.e && i.classList.toggle("is-active", l.e = C), w !== l.t && i.classList.toggle("is-hovered", l.t = w), s !== l.a && I(i, "aria-pressed", l.a = s), l;
245
266
  }, {
246
267
  e: void 0,
247
268
  t: void 0,
248
269
  a: void 0
249
270
  }), e;
250
- })(), d(M, {
271
+ })(), d(x, {
251
272
  get when() {
252
- return c()?.moved ?? !1;
273
+ return u()?.moved ?? !1;
253
274
  },
254
275
  get children() {
255
- return d(rt, {
256
- state: c
276
+ return d(dt, {
277
+ state: u
257
278
  });
258
279
  }
259
280
  })];
260
281
  }
261
- function rt(t) {
262
- const s = () => {
282
+ function dt(t) {
283
+ const a = () => {
263
284
  const n = t.state();
264
285
  return n ? `translate3d(${n.clientX + 14}px, ${n.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
265
- }, l = () => t.state()?.overCanvas ?? !1, c = () => t.state()?.label ?? "", i = () => t.state()?.icon;
266
- return d(R, {
286
+ }, r = () => t.state()?.overCanvas ?? !1, u = () => t.state()?.label ?? "", o = () => t.state()?.icon;
287
+ return d(K, {
267
288
  get children() {
268
- var n = Z(), u = n.firstChild, v = u.nextSibling, h = v.firstChild, _ = h.nextSibling, b = _.firstChild, E = b.nextSibling, y = E.firstChild;
269
- return f(h, d(M, {
289
+ var n = it(), c = n.firstChild, v = c.nextSibling, g = v.firstChild, f = g.nextSibling, h = f.firstChild, E = h.nextSibling, m = E.firstChild;
290
+ return _(g, d(x, {
270
291
  get when() {
271
- return i();
292
+ return o();
272
293
  },
273
- children: (g) => {
274
- const w = g();
275
- return d(w, {
294
+ children: (k) => {
295
+ const y = k();
296
+ return d(y, {
276
297
  class: "w-4 h-4"
277
298
  });
278
299
  }
279
- })), f(b, c), f(E, d(K, {
300
+ })), _(h, u), _(E, d(Q, {
280
301
  class: "w-3 h-3"
281
- }), y), f(y, () => l() ? "Drop to create" : "Drag onto canvas"), O((g) => {
282
- var w = !!l(), e = s();
283
- return w !== g.e && n.classList.toggle("is-over-canvas", g.e = w), e !== g.t && B(n, "transform", g.t = e), g;
302
+ }), m), _(m, () => r() ? "Drop to create" : "Drag onto canvas"), M((k) => {
303
+ var y = !!r(), e = a();
304
+ return y !== k.e && n.classList.toggle("is-over-canvas", k.e = y), e !== k.t && N(n, "transform", k.t = e), k;
284
305
  }, {
285
306
  e: void 0,
286
307
  t: void 0
@@ -288,7 +309,7 @@ function rt(t) {
288
309
  }
289
310
  });
290
311
  }
291
- V(["pointerdown", "click"]);
312
+ U(["pointerdown", "click"]);
292
313
  export {
293
- gt as WorkbenchFilterBar
314
+ _t as WorkbenchFilterBar
294
315
  };
@@ -13,6 +13,10 @@ export interface WorkbenchEdgeAutoPanVelocityOptions {
13
13
  clientX: number;
14
14
  clientY: number;
15
15
  thresholdPx?: number;
16
+ /**
17
+ * Deprecated: edge auto-pan intentionally keeps moving after the pointer leaves
18
+ * the frame during an active drag.
19
+ */
16
20
  outsideTolerancePx?: number;
17
21
  maxSpeedPxPerSecond?: number;
18
22
  }
@@ -35,6 +39,10 @@ export interface WorkbenchEdgeAutoPanControllerOptions {
35
39
  onPanStart?: () => void;
36
40
  shouldPan?: () => boolean;
37
41
  thresholdPx?: number;
42
+ /**
43
+ * Deprecated: edge auto-pan intentionally keeps moving after the pointer leaves
44
+ * the frame during an active drag.
45
+ */
38
46
  outsideTolerancePx?: number;
39
47
  activationDelayMs?: number;
40
48
  maxSpeedPxPerSecond?: number;
@@ -1,34 +1,31 @@
1
- const N = '[data-floe-workbench-canvas-frame="true"]';
2
- function c(e, t) {
1
+ const x = '[data-floe-workbench-canvas-frame="true"]';
2
+ function u(e, t) {
3
3
  return Number.isFinite(e) && Number(e) > 0 ? Number(e) : t;
4
4
  }
5
- function F(e) {
6
- const { frame: t, clientX: i, clientY: r, outsideTolerancePx: n } = e;
7
- return i >= t.left - n && i <= t.right + n && r >= t.top - n && r <= t.bottom + n;
5
+ function w(e) {
6
+ const t = Math.max(0, Math.min(1, e));
7
+ return t * t * (3 - 2 * t);
8
8
  }
9
- function P(e, t) {
10
- const i = (t - Math.max(0, e)) / t, r = Math.max(0, Math.min(1, i));
11
- return r * r;
9
+ function h(e, t) {
10
+ if (e >= t) return 0;
11
+ if (e >= 0) {
12
+ const i = (t - e) / t * 0.78;
13
+ return w(i);
14
+ }
15
+ const r = Math.max(96, t), n = Math.min(1, Math.abs(e) / r);
16
+ return w(0.78 + n * 0.22);
12
17
  }
13
- function X(e) {
14
- const t = c(e.thresholdPx, 36), i = Math.max(0, c(
15
- e.outsideTolerancePx,
16
- 10
17
- )), r = c(
18
+ function p(e) {
19
+ const t = u(e.thresholdPx, 72), r = u(
18
20
  e.maxSpeedPxPerSecond,
19
- 480
21
+ 680
20
22
  ), n = e.frame;
21
- if (!Number.isFinite(n.width) || n.width <= 0 || !Number.isFinite(n.height) || n.height <= 0 || !F({
22
- frame: n,
23
- clientX: e.clientX,
24
- clientY: e.clientY,
25
- outsideTolerancePx: i
26
- }))
23
+ if (!Number.isFinite(n.width) || n.width <= 0 || !Number.isFinite(n.height) || n.height <= 0)
27
24
  return { viewportVelocityX: 0, viewportVelocityY: 0 };
28
- const l = r / 1e3, E = P(e.clientX - n.left, t), f = P(n.right - e.clientX, t), A = P(e.clientY - n.top, t), D = P(n.bottom - e.clientY, t);
25
+ const i = r / 1e3, l = h(e.clientX - n.left, t), s = h(n.right - e.clientX, t), A = h(e.clientY - n.top, t), D = h(n.bottom - e.clientY, t);
29
26
  return {
30
- viewportVelocityX: (E - f) * l,
31
- viewportVelocityY: (A - D) * l
27
+ viewportVelocityX: (l - s) * i,
28
+ viewportVelocityY: (A - D) * i
32
29
  };
33
30
  }
34
31
  function y(e) {
@@ -42,93 +39,89 @@ function y(e) {
42
39
  height: t.height
43
40
  } : null;
44
41
  }
45
- function L(e) {
42
+ function X(e) {
46
43
  return typeof window > "u" || typeof window.requestAnimationFrame != "function" ? null : window.requestAnimationFrame(e);
47
44
  }
48
- function p(e) {
45
+ function L(e) {
49
46
  e === null || typeof window > "u" || typeof window.cancelAnimationFrame != "function" || window.cancelAnimationFrame(e);
50
47
  }
51
48
  function b(e) {
52
- let t = null, i = null, r = null, n = null, l = !1, E = !1;
53
- const f = () => c(e.thresholdPx, 36), A = () => Math.max(0, c(
54
- e.outsideTolerancePx,
55
- 10
56
- )), D = () => Math.max(0, c(
49
+ let t = null, r = null, n = null, i = null, l = !1, s = !1;
50
+ const A = () => u(e.thresholdPx, 72), D = () => Math.max(0, u(
57
51
  e.activationDelayMs,
58
- 100
59
- )), M = () => c(
52
+ 45
53
+ )), F = () => u(
60
54
  e.maxSpeedPxPerSecond,
61
- 480
62
- ), s = () => {
63
- n = null, r = null;
64
- }, a = () => {
65
- l || i !== null || !t || (i = L(w));
66
- }, w = (o) => {
67
- if (i = null, l || !t) return;
55
+ 680
56
+ ), E = () => {
57
+ i = null, n = null;
58
+ }, c = () => {
59
+ l || r !== null || !t || (r = X(T));
60
+ }, T = (o) => {
61
+ if (r = null, l || !t) return;
68
62
  if (e.shouldPan && !e.shouldPan()) {
69
- s();
63
+ E();
70
64
  return;
71
65
  }
72
- const d = e.readFrame(), u = e.readViewport();
73
- if (!d || !u) {
74
- s();
66
+ const _ = e.readFrame(), a = e.readViewport();
67
+ if (!_ || !a) {
68
+ E();
75
69
  return;
76
70
  }
77
- const _ = X({
78
- frame: d,
71
+ const m = p({
72
+ frame: _,
79
73
  clientX: t.clientX,
80
74
  clientY: t.clientY,
81
- thresholdPx: f(),
82
- outsideTolerancePx: A(),
83
- maxSpeedPxPerSecond: M()
75
+ thresholdPx: A(),
76
+ maxSpeedPxPerSecond: F()
84
77
  });
85
- if (_.viewportVelocityX === 0 && _.viewportVelocityY === 0) {
86
- s();
78
+ if (m.viewportVelocityX === 0 && m.viewportVelocityY === 0) {
79
+ E();
87
80
  return;
88
81
  }
89
- if (n === null) {
90
- n = o, r = o, a();
82
+ if (i === null) {
83
+ i = o, n = o, c();
91
84
  return;
92
85
  }
93
- if (o - n < D()) {
94
- r = o, a();
86
+ if (o - i < D()) {
87
+ n = o, c();
95
88
  return;
96
89
  }
97
- const T = Math.max(0, Math.min(48, o - (r ?? o)));
98
- if (r = o, T <= 0) {
99
- a();
90
+ const P = Math.max(0, Math.min(48, o - (n ?? o)));
91
+ if (n = o, P <= 0) {
92
+ c();
100
93
  return;
101
94
  }
102
- const m = _.viewportVelocityX * T, h = _.viewportVelocityY * T;
103
- if (Math.abs(m) < 0.01 && Math.abs(h) < 0.01) {
104
- a();
95
+ const d = m.viewportVelocityX * P, f = m.viewportVelocityY * P;
96
+ if (Math.abs(d) < 0.01 && Math.abs(f) < 0.01) {
97
+ c();
105
98
  return;
106
99
  }
107
- const x = Math.max(Math.abs(Number(u.scale)), 1e-3), S = {
108
- ...u,
109
- x: u.x + m,
110
- y: u.y + h
100
+ const S = Math.max(Math.abs(Number(a.scale)), 1e-3), M = {
101
+ ...a,
102
+ x: a.x + d,
103
+ y: a.y + f
111
104
  };
112
- E || (E = !0, e.onPanStart?.()), e.commitViewport(S), e.onPan?.({
113
- viewportDeltaX: m,
114
- viewportDeltaY: h,
115
- worldDeltaX: -m / x,
116
- worldDeltaY: -h / x,
117
- viewport: S
118
- }), a();
105
+ s || (s = !0, e.onPanStart?.()), e.commitViewport(M), e.onPan?.({
106
+ viewportDeltaX: d,
107
+ viewportDeltaY: f,
108
+ worldDeltaX: -d / S,
109
+ worldDeltaY: -f / S,
110
+ viewport: M
111
+ }), c();
119
112
  };
120
113
  return {
121
- updatePointer: (o, d) => {
122
- t = { clientX: o, clientY: d }, a();
114
+ updatePointer: (o, _) => {
115
+ t = { clientX: o, clientY: _ }, c();
123
116
  },
124
117
  stop: () => {
125
- l = !0, p(i), i = null, t = null, s();
118
+ l = !0, L(r), r = null, t = null, E();
126
119
  }
127
120
  };
128
121
  }
129
122
  export {
130
- N as WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR,
123
+ x as WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR,
131
124
  b as createWorkbenchEdgeAutoPanController,
132
125
  y as frameFromElement,
133
- X as resolveWorkbenchEdgeAutoPanVelocity
126
+ p as resolveWorkbenchEdgeAutoPanVelocity
134
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.36.39",
3
+ "version": "0.36.40",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",