@floegence/floe-webapp-core 0.36.16 → 0.36.18
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/components/ui/InfiniteCanvas.js +79 -71
- package/dist/components/ui/index.d.ts +2 -1
- package/dist/components/ui/localInteractionSurface.d.ts +2 -0
- package/dist/components/ui/localInteractionSurface.js +51 -26
- package/dist/components/ui/pointerSession.d.ts +35 -0
- package/dist/components/ui/pointerSession.js +85 -0
- package/dist/components/workbench/WorkbenchFilterBar.js +119 -117
- package/dist/components/workbench/WorkbenchWidget.js +157 -135
- package/dist/components/workbench/types.d.ts +7 -0
- package/dist/full.js +461 -458
- package/dist/ui.js +106 -103
- package/package.json +1 -1
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { Motion as
|
|
4
|
-
import { easing as y, duration as
|
|
5
|
-
import { Layers as
|
|
6
|
-
import { startHotInteraction as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { insert as g, createComponent as d, effect as D, setAttribute as S, template as L, Portal as Y, setStyleProperty as M, delegateEvents as A } from "solid-js/web";
|
|
2
|
+
import { createSignal as I, onCleanup as F, createMemo as H, For as P, Show as x } from "solid-js";
|
|
3
|
+
import { Motion as w } 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 y, duration as C } from "../../utils/animations.js";
|
|
5
|
+
import { Layers as R, Plus as T } from "../icons/index.js";
|
|
6
|
+
import { startHotInteraction as B } from "../../utils/hotInteraction.js";
|
|
7
|
+
import { startPointerSession as G } from "../ui/pointerSession.js";
|
|
8
|
+
var q = /* @__PURE__ */ L("<button type=button class=workbench-dock__item>"), z = /* @__PURE__ */ L('<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>'), N = /* @__PURE__ */ L("<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>");
|
|
9
|
+
const O = 5, V = '[data-floe-workbench-canvas-frame="true"]';
|
|
10
|
+
function W(t, l) {
|
|
11
|
+
const a = document.querySelector(V);
|
|
11
12
|
if (!(a instanceof HTMLElement)) return !1;
|
|
12
|
-
const
|
|
13
|
-
return
|
|
13
|
+
const c = a.getBoundingClientRect();
|
|
14
|
+
return t >= c.left && t <= c.right && l >= c.top && l <= c.bottom;
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
const l = () =>
|
|
16
|
+
function j(t) {
|
|
17
|
+
const l = () => t.hoverOffset === -1 ? {
|
|
17
18
|
scale: 1.26,
|
|
18
19
|
y: -6,
|
|
19
20
|
x: 0
|
|
20
|
-
} :
|
|
21
|
+
} : t.hoverOffset === 1 ? {
|
|
21
22
|
scale: 1.08,
|
|
22
23
|
y: -2,
|
|
23
24
|
x: 5
|
|
24
|
-
} :
|
|
25
|
+
} : t.hoverOffset === -2 ? {
|
|
25
26
|
scale: 1.08,
|
|
26
27
|
y: -2,
|
|
27
28
|
x: -5
|
|
@@ -29,31 +30,31 @@ function p(e) {
|
|
|
29
30
|
scale: 1,
|
|
30
31
|
y: 0,
|
|
31
32
|
x: 0
|
|
32
|
-
}, a = () =>
|
|
33
|
-
|
|
33
|
+
}, a = () => t.hoverOffset === -1, c = (i) => {
|
|
34
|
+
i.button === 0 && t.onDragBegin(i, t.type, t.label, t.icon);
|
|
34
35
|
};
|
|
35
36
|
return (() => {
|
|
36
|
-
var
|
|
37
|
-
return
|
|
37
|
+
var i = q();
|
|
38
|
+
return i.$$pointerdown = c, i.addEventListener("pointerleave", () => t.onLeave()), i.addEventListener("pointerenter", () => t.onEnter()), g(i, d(w.span, {
|
|
38
39
|
class: "workbench-dock__tile",
|
|
39
40
|
get animate() {
|
|
40
41
|
return l();
|
|
41
42
|
},
|
|
42
43
|
get transition() {
|
|
43
44
|
return {
|
|
44
|
-
duration:
|
|
45
|
+
duration: C.fast,
|
|
45
46
|
easing: y.easeOut
|
|
46
47
|
};
|
|
47
48
|
},
|
|
48
49
|
get children() {
|
|
49
50
|
return (() => {
|
|
50
|
-
const
|
|
51
|
-
return d(
|
|
51
|
+
const n = t.icon;
|
|
52
|
+
return d(n, {
|
|
52
53
|
class: "workbench-dock__icon"
|
|
53
54
|
});
|
|
54
55
|
})();
|
|
55
56
|
}
|
|
56
|
-
}), null),
|
|
57
|
+
}), null), g(i, d(w.span, {
|
|
57
58
|
class: "workbench-dock__tooltip",
|
|
58
59
|
get animate() {
|
|
59
60
|
return {
|
|
@@ -63,90 +64,91 @@ function p(e) {
|
|
|
63
64
|
},
|
|
64
65
|
get transition() {
|
|
65
66
|
return {
|
|
66
|
-
duration:
|
|
67
|
+
duration: C.fast,
|
|
67
68
|
easing: y.easeOut
|
|
68
69
|
};
|
|
69
70
|
},
|
|
70
71
|
get children() {
|
|
71
|
-
return
|
|
72
|
+
return t.label;
|
|
72
73
|
}
|
|
73
|
-
}), null), D((
|
|
74
|
-
var
|
|
75
|
-
return
|
|
74
|
+
}), null), D((n) => {
|
|
75
|
+
var f = !!t.active, k = !!a(), h = !!t.isDragging, _ = `${t.label} — click to solo, drag to canvas to create`, b = t.active;
|
|
76
|
+
return f !== n.e && i.classList.toggle("is-active", n.e = f), k !== n.t && i.classList.toggle("is-hovered", n.t = k), h !== n.a && i.classList.toggle("is-source-dragging", n.a = h), _ !== n.o && S(i, "aria-label", n.o = _), b !== n.i && S(i, "aria-pressed", n.i = b), n;
|
|
76
77
|
}, {
|
|
77
78
|
e: void 0,
|
|
78
79
|
t: void 0,
|
|
79
80
|
a: void 0,
|
|
80
81
|
o: void 0,
|
|
81
82
|
i: void 0
|
|
82
|
-
}),
|
|
83
|
+
}), i;
|
|
83
84
|
})();
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
-
const [l, a] =
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
function nt(t) {
|
|
87
|
+
const [l, a] = I(null), [c, i] = I(null);
|
|
88
|
+
let n;
|
|
89
|
+
F(() => {
|
|
90
|
+
n?.stop({
|
|
91
|
+
reason: "manual_stop",
|
|
92
|
+
commit: !1
|
|
93
|
+
}), n = void 0, c()?.stopInteraction();
|
|
90
94
|
});
|
|
91
|
-
const
|
|
95
|
+
const f = H(() => t.widgetDefinitions.every((o) => t.filters[o.type])), k = (o) => {
|
|
92
96
|
const r = l();
|
|
93
|
-
return r === null ? 0 : r ===
|
|
94
|
-
},
|
|
95
|
-
const r =
|
|
97
|
+
return r === null ? 0 : r === o ? -1 : r === o + 1 ? -2 : r === o - 1 ? 1 : 0;
|
|
98
|
+
}, h = (o) => {
|
|
99
|
+
const r = c();
|
|
96
100
|
if (!r) return;
|
|
97
|
-
const
|
|
98
|
-
if (r.stopInteraction(),
|
|
99
|
-
|
|
101
|
+
const e = !r.moved;
|
|
102
|
+
if (r.stopInteraction(), i(null), n = void 0, e) {
|
|
103
|
+
t.onSoloFilter(r.type);
|
|
100
104
|
return;
|
|
101
105
|
}
|
|
102
|
-
|
|
103
|
-
}, _ = (
|
|
104
|
-
|
|
106
|
+
o && r.overCanvas && t.onCreateAt?.(r.type, r.clientX, r.clientY);
|
|
107
|
+
}, _ = (o, r, e, u) => {
|
|
108
|
+
o.preventDefault(), n?.stop({
|
|
109
|
+
reason: "manual_stop",
|
|
110
|
+
commit: !1
|
|
111
|
+
}), i({
|
|
105
112
|
type: r,
|
|
106
|
-
label:
|
|
113
|
+
label: e,
|
|
107
114
|
icon: u,
|
|
108
|
-
pointerId:
|
|
109
|
-
startClientX:
|
|
110
|
-
startClientY:
|
|
111
|
-
clientX:
|
|
112
|
-
clientY:
|
|
115
|
+
pointerId: o.pointerId,
|
|
116
|
+
startClientX: o.clientX,
|
|
117
|
+
startClientY: o.clientY,
|
|
118
|
+
clientX: o.clientX,
|
|
119
|
+
clientY: o.clientY,
|
|
113
120
|
moved: !1,
|
|
114
121
|
overCanvas: !1,
|
|
115
|
-
stopInteraction:
|
|
122
|
+
stopInteraction: B({
|
|
116
123
|
kind: "drag",
|
|
117
124
|
cursor: "grabbing"
|
|
118
125
|
})
|
|
119
126
|
});
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!w || w.pointerId !== g.pointerId) return w;
|
|
125
|
-
const Y = g.clientX - w.startClientX, M = g.clientY - w.startClientY, E = w.moved || Math.abs(Y) > x || Math.abs(M) > x;
|
|
127
|
+
const v = (s) => {
|
|
128
|
+
i((m) => {
|
|
129
|
+
if (!m || m.pointerId !== s.pointerId) return m;
|
|
130
|
+
const X = s.clientX - m.startClientX, $ = s.clientY - m.startClientY, E = m.moved || Math.abs(X) > O || Math.abs($) > O;
|
|
126
131
|
return {
|
|
127
|
-
...
|
|
128
|
-
clientX:
|
|
129
|
-
clientY:
|
|
132
|
+
...m,
|
|
133
|
+
clientX: s.clientX,
|
|
134
|
+
clientY: s.clientY,
|
|
130
135
|
moved: E,
|
|
131
|
-
overCanvas: E &&
|
|
136
|
+
overCanvas: E && W(s.clientX, s.clientY)
|
|
132
137
|
};
|
|
133
138
|
});
|
|
134
|
-
}, $ = (g) => {
|
|
135
|
-
g.pointerId === i.pointerId && f(!0);
|
|
136
|
-
}, A = (g) => {
|
|
137
|
-
g.pointerId === i.pointerId && f(!1);
|
|
138
139
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
n = G({
|
|
141
|
+
pointerEvent: o,
|
|
142
|
+
captureEl: o.currentTarget,
|
|
143
|
+
onMove: v,
|
|
144
|
+
onEnd: ({
|
|
145
|
+
commit: s
|
|
146
|
+
}) => h(s)
|
|
145
147
|
});
|
|
146
|
-
}, b = () =>
|
|
148
|
+
}, b = () => c()?.type ?? null;
|
|
147
149
|
return [(() => {
|
|
148
|
-
var
|
|
149
|
-
return r.nextSibling,
|
|
150
|
+
var o = z(), r = o.firstChild;
|
|
151
|
+
return r.nextSibling, o.addEventListener("pointerleave", () => a(null)), r.$$click = () => t.onShowAll(), r.addEventListener("pointerleave", () => a((e) => e === 0 ? null : e)), r.addEventListener("pointerenter", () => a(0)), g(r, d(w.span, {
|
|
150
152
|
class: "workbench-dock__tile",
|
|
151
153
|
get animate() {
|
|
152
154
|
return {
|
|
@@ -157,16 +159,16 @@ function re(e) {
|
|
|
157
159
|
},
|
|
158
160
|
get transition() {
|
|
159
161
|
return {
|
|
160
|
-
duration:
|
|
162
|
+
duration: C.fast,
|
|
161
163
|
easing: y.easeOut
|
|
162
164
|
};
|
|
163
165
|
},
|
|
164
166
|
get children() {
|
|
165
|
-
return d(
|
|
167
|
+
return d(R, {
|
|
166
168
|
class: "workbench-dock__icon"
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
|
-
}), null),
|
|
171
|
+
}), null), g(r, d(w.span, {
|
|
170
172
|
class: "workbench-dock__tooltip",
|
|
171
173
|
get animate() {
|
|
172
174
|
return {
|
|
@@ -176,92 +178,92 @@ function re(e) {
|
|
|
176
178
|
},
|
|
177
179
|
get transition() {
|
|
178
180
|
return {
|
|
179
|
-
duration:
|
|
181
|
+
duration: C.fast,
|
|
180
182
|
easing: y.easeOut
|
|
181
183
|
};
|
|
182
184
|
},
|
|
183
185
|
children: "Show all widgets"
|
|
184
|
-
}), null),
|
|
186
|
+
}), null), g(o, d(P, {
|
|
185
187
|
get each() {
|
|
186
|
-
return
|
|
188
|
+
return t.widgetDefinitions;
|
|
187
189
|
},
|
|
188
|
-
children: (
|
|
189
|
-
const
|
|
190
|
-
return d(
|
|
190
|
+
children: (e, u) => {
|
|
191
|
+
const v = () => u() + 1;
|
|
192
|
+
return d(j, {
|
|
191
193
|
get type() {
|
|
192
|
-
return
|
|
194
|
+
return e.type;
|
|
193
195
|
},
|
|
194
196
|
get label() {
|
|
195
|
-
return
|
|
197
|
+
return e.label;
|
|
196
198
|
},
|
|
197
199
|
get icon() {
|
|
198
|
-
return
|
|
200
|
+
return e.icon;
|
|
199
201
|
},
|
|
200
202
|
get active() {
|
|
201
|
-
return
|
|
203
|
+
return t.filters[e.type];
|
|
202
204
|
},
|
|
203
205
|
get hoverOffset() {
|
|
204
|
-
return
|
|
206
|
+
return k(v());
|
|
205
207
|
},
|
|
206
208
|
get isDragging() {
|
|
207
|
-
return b() ===
|
|
209
|
+
return b() === e.type;
|
|
208
210
|
},
|
|
209
|
-
onEnter: () => a(
|
|
210
|
-
onLeave: () => a((
|
|
211
|
-
onSolo: () =>
|
|
211
|
+
onEnter: () => a(v()),
|
|
212
|
+
onLeave: () => a((s) => s === v() ? null : s),
|
|
213
|
+
onSolo: () => t.onSoloFilter(e.type),
|
|
212
214
|
onDragBegin: _
|
|
213
215
|
});
|
|
214
216
|
}
|
|
215
|
-
}), null), D((
|
|
216
|
-
var u = !!
|
|
217
|
-
return u !==
|
|
217
|
+
}), null), D((e) => {
|
|
218
|
+
var u = !!f(), v = l() === 0, s = f();
|
|
219
|
+
return u !== e.e && r.classList.toggle("is-active", e.e = u), v !== e.t && r.classList.toggle("is-hovered", e.t = v), s !== e.a && S(r, "aria-pressed", e.a = s), e;
|
|
218
220
|
}, {
|
|
219
221
|
e: void 0,
|
|
220
222
|
t: void 0,
|
|
221
223
|
a: void 0
|
|
222
|
-
}),
|
|
223
|
-
})(), d(
|
|
224
|
+
}), o;
|
|
225
|
+
})(), d(x, {
|
|
224
226
|
get when() {
|
|
225
|
-
return
|
|
227
|
+
return c()?.moved ?? !1;
|
|
226
228
|
},
|
|
227
229
|
get children() {
|
|
228
230
|
return d(J, {
|
|
229
|
-
state:
|
|
231
|
+
state: c
|
|
230
232
|
});
|
|
231
233
|
}
|
|
232
234
|
})];
|
|
233
235
|
}
|
|
234
|
-
function J(
|
|
236
|
+
function J(t) {
|
|
235
237
|
const l = () => {
|
|
236
|
-
const
|
|
237
|
-
return
|
|
238
|
-
}, a = () =>
|
|
239
|
-
return d(
|
|
238
|
+
const n = t.state();
|
|
239
|
+
return n ? `translate3d(${n.clientX + 14}px, ${n.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
|
|
240
|
+
}, a = () => t.state()?.overCanvas ?? !1, c = () => t.state()?.label ?? "", i = () => t.state()?.icon;
|
|
241
|
+
return d(Y, {
|
|
240
242
|
get children() {
|
|
241
|
-
var
|
|
242
|
-
return
|
|
243
|
+
var n = N(), f = n.firstChild, k = f.nextSibling, h = k.firstChild, _ = h.nextSibling, b = _.firstChild, o = b.nextSibling, r = o.firstChild;
|
|
244
|
+
return g(h, d(x, {
|
|
243
245
|
get when() {
|
|
244
|
-
return
|
|
246
|
+
return i();
|
|
245
247
|
},
|
|
246
|
-
children: (
|
|
247
|
-
const u =
|
|
248
|
+
children: (e) => {
|
|
249
|
+
const u = e();
|
|
248
250
|
return d(u, {
|
|
249
251
|
class: "w-4 h-4"
|
|
250
252
|
});
|
|
251
253
|
}
|
|
252
|
-
})),
|
|
254
|
+
})), g(b, c), g(o, d(T, {
|
|
253
255
|
class: "w-3 h-3"
|
|
254
|
-
}), r),
|
|
255
|
-
var u = !!a(),
|
|
256
|
-
return u !==
|
|
256
|
+
}), r), g(r, () => a() ? "Drop to create" : "Drag onto canvas"), D((e) => {
|
|
257
|
+
var u = !!a(), v = l();
|
|
258
|
+
return u !== e.e && n.classList.toggle("is-over-canvas", e.e = u), v !== e.t && M(n, "transform", e.t = v), e;
|
|
257
259
|
}, {
|
|
258
260
|
e: void 0,
|
|
259
261
|
t: void 0
|
|
260
|
-
}),
|
|
262
|
+
}), n;
|
|
261
263
|
}
|
|
262
264
|
});
|
|
263
265
|
}
|
|
264
|
-
|
|
266
|
+
A(["pointerdown", "click"]);
|
|
265
267
|
export {
|
|
266
|
-
|
|
268
|
+
nt as WorkbenchFilterBar
|
|
267
269
|
};
|