@floegence/floe-webapp-core 0.42.0 → 0.42.2
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,71 +1,71 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as Z, onCleanup as
|
|
3
|
-
import { Motion as
|
|
4
|
-
import { easing as
|
|
5
|
-
import { Plus as
|
|
6
|
-
import { startHotInteraction as
|
|
7
|
-
import { startPointerSession as
|
|
8
|
-
import { clientToCanvasWorld as
|
|
9
|
-
import { createWorkbenchWidgetFrame as
|
|
10
|
-
import { getWidgetEntry as
|
|
11
|
-
import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as
|
|
12
|
-
import { DockLayoutDashboard as
|
|
13
|
-
var
|
|
14
|
-
const
|
|
1
|
+
import { insert as h, createComponent as c, effect as Y, setAttribute as y, memo as Q, className as Xe, template as X, addEventListener as ke, Portal as Ae, setStyleProperty as Ye, use as $e, delegateEvents as Fe } from "solid-js/web";
|
|
2
|
+
import { createSignal as Z, onCleanup as U, createEffect as q, createMemo as H, Show as W, For as ee, Index as Re } from "solid-js";
|
|
3
|
+
import { Motion as $ } 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 F, duration as R } from "../../utils/animations.js";
|
|
5
|
+
import { Plus as pe } from "../icons/index.js";
|
|
6
|
+
import { startHotInteraction as Be } from "../../utils/hotInteraction.js";
|
|
7
|
+
import { startPointerSession as He } from "../ui/pointerSession.js";
|
|
8
|
+
import { clientToCanvasWorld as We } from "../ui/canvasGeometry.js";
|
|
9
|
+
import { createWorkbenchWidgetFrame as Ne } from "./workbenchHelpers.js";
|
|
10
|
+
import { getWidgetEntry as Ke } from "./widgets/widgetRegistry.js";
|
|
11
|
+
import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as be, frameFromElement as _e, createWorkbenchEdgeAutoPanController as Ve } from "./workbenchEdgeAutoPan.js";
|
|
12
|
+
import { DockLayoutDashboard as Ge, DockLayers as Ue, DockRegion as qe, DockText as ze, DockMessageSquare as je } from "../icons/DockIcons.js";
|
|
13
|
+
var Je = /* @__PURE__ */ X("<button type=button class=workbench-dock__item>"), Qe = /* @__PURE__ */ X('<button type=button class="workbench-dock__item workbench-dock__action">'), Ze = /* @__PURE__ */ X('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), et = /* @__PURE__ */ X("<span class=workbench-dock__external-placeholder aria-hidden=true>"), tt = /* @__PURE__ */ X('<div data-floe-canvas-interactive=true><div class=workbench-dock__mode-switcher><button type=button class="workbench-dock__item workbench-dock__mode-trigger"aria-label="Switch canvas mode"aria-haspopup=menu></button></div><span class=workbench-dock__divider aria-hidden=true>'), nt = /* @__PURE__ */ X("<button type=button class=workbench-dock__mode-option role=menuitemradio><span class=workbench-dock__mode-option-icon></span><span class=workbench-dock__mode-option-copy><span class=workbench-dock__mode-option-label></span><span class=workbench-dock__mode-option-description>"), ot = /* @__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>");
|
|
14
|
+
const fe = 5, rt = 1e3, it = ".workbench-dock", te = [{
|
|
15
15
|
mode: "work",
|
|
16
16
|
label: "Work Mode",
|
|
17
17
|
description: "Operate windows and sticky notes",
|
|
18
|
-
icon:
|
|
18
|
+
icon: Ge
|
|
19
19
|
}, {
|
|
20
20
|
mode: "background",
|
|
21
21
|
label: "Composition Mode",
|
|
22
22
|
description: "Arrange regions and canvas text",
|
|
23
|
-
icon:
|
|
24
|
-
}],
|
|
23
|
+
icon: Ue
|
|
24
|
+
}], at = [{
|
|
25
25
|
tool: "sticky-note",
|
|
26
26
|
label: "Sticky",
|
|
27
|
-
icon:
|
|
28
|
-
}],
|
|
27
|
+
icon: je
|
|
28
|
+
}], lt = [{
|
|
29
29
|
tool: "background-region",
|
|
30
30
|
label: "Region",
|
|
31
|
-
icon:
|
|
31
|
+
icon: qe
|
|
32
32
|
}, {
|
|
33
33
|
tool: "text",
|
|
34
34
|
label: "Text",
|
|
35
|
-
icon:
|
|
35
|
+
icon: ze
|
|
36
36
|
}];
|
|
37
|
-
function
|
|
38
|
-
const a = e?.closest(".workbench-surface")?.querySelector(
|
|
39
|
-
return a instanceof HTMLElement ?
|
|
37
|
+
function ct(e) {
|
|
38
|
+
const a = e?.closest(".workbench-surface")?.querySelector(be);
|
|
39
|
+
return a instanceof HTMLElement ? _e(a) : null;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function ne(e, s, a) {
|
|
42
42
|
return e >= a.left && e <= a.right && s >= a.top && s <= a.bottom;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return a ?
|
|
44
|
+
function st(e, s, a) {
|
|
45
|
+
return a ? ne(e, s, a) : !1;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function me(e, s, a) {
|
|
48
48
|
return Math.min(a, Math.max(s, e));
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function dt(e, s, a, l, r) {
|
|
51
51
|
if (!e) return !1;
|
|
52
|
-
if (
|
|
52
|
+
if (ne(s, a, e) || ne(l, r, e))
|
|
53
53
|
return !0;
|
|
54
54
|
const i = l - s, D = r - a;
|
|
55
55
|
let v = 0, E = 1;
|
|
56
|
-
const
|
|
56
|
+
const g = (b, C) => {
|
|
57
57
|
if (b === 0) return C >= 0;
|
|
58
58
|
const k = C / b;
|
|
59
59
|
return b < 0 ? k > E ? !1 : (k > v && (v = k), !0) : k < v ? !1 : (k < E && (E = k), !0);
|
|
60
60
|
};
|
|
61
|
-
return
|
|
61
|
+
return g(-i, s - e.left) && g(i, e.right - s) && g(-D, a - e.top) && g(D, e.bottom - a);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function we(e, s, a) {
|
|
64
64
|
if (!a || typeof document.elementFromPoint != "function") return !1;
|
|
65
65
|
const l = document.elementFromPoint(e, s);
|
|
66
|
-
return l instanceof Element && l.closest(
|
|
66
|
+
return l instanceof Element && l.closest(it) === a;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function he(e) {
|
|
69
69
|
const s = () => e.hoverOffset === -1 ? {
|
|
70
70
|
scale: 1.26,
|
|
71
71
|
y: -6,
|
|
@@ -86,16 +86,16 @@ function me(e) {
|
|
|
86
86
|
r.button === 0 && e.onDragBegin(r, e.kind, e.id, e.label, e.icon, r.currentTarget, e.canvasPlacement, null);
|
|
87
87
|
};
|
|
88
88
|
return (() => {
|
|
89
|
-
var r =
|
|
90
|
-
return r.$$pointerdown = l, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()),
|
|
89
|
+
var r = Je();
|
|
90
|
+
return r.$$pointerdown = l, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()), h(r, c($.span, {
|
|
91
91
|
class: "workbench-dock__tile",
|
|
92
92
|
get animate() {
|
|
93
93
|
return s();
|
|
94
94
|
},
|
|
95
95
|
get transition() {
|
|
96
96
|
return {
|
|
97
|
-
duration:
|
|
98
|
-
easing:
|
|
97
|
+
duration: R.fast,
|
|
98
|
+
easing: F.easeOut
|
|
99
99
|
};
|
|
100
100
|
},
|
|
101
101
|
get children() {
|
|
@@ -106,7 +106,7 @@ function me(e) {
|
|
|
106
106
|
});
|
|
107
107
|
})();
|
|
108
108
|
}
|
|
109
|
-
}), null),
|
|
109
|
+
}), null), h(r, c($.span, {
|
|
110
110
|
class: "workbench-dock__tooltip",
|
|
111
111
|
get animate() {
|
|
112
112
|
return {
|
|
@@ -116,16 +116,16 @@ function me(e) {
|
|
|
116
116
|
},
|
|
117
117
|
get transition() {
|
|
118
118
|
return {
|
|
119
|
-
duration:
|
|
120
|
-
easing:
|
|
119
|
+
duration: R.fast,
|
|
120
|
+
easing: F.easeOut
|
|
121
121
|
};
|
|
122
122
|
},
|
|
123
123
|
get children() {
|
|
124
124
|
return e.label;
|
|
125
125
|
}
|
|
126
|
-
}), null),
|
|
127
|
-
var D = e.kind === "host" ? e.id : void 0, v = !!e.active, E = !!(e.filterable && !e.visible),
|
|
128
|
-
return D !== i.e &&
|
|
126
|
+
}), null), Y((i) => {
|
|
127
|
+
var D = e.kind === "host" ? e.id : void 0, v = !!e.active, E = !!(e.filterable && !e.visible), g = !!a(), b = !!e.isDragging, C = e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, k = e.active;
|
|
128
|
+
return D !== i.e && y(r, "data-workbench-dock-item", i.e = D), v !== i.t && r.classList.toggle("is-active", i.t = v), E !== i.a && r.classList.toggle("is-filter-muted", i.a = E), g !== i.o && r.classList.toggle("is-hovered", i.o = g), b !== i.i && r.classList.toggle("is-source-dragging", i.i = b), C !== i.n && y(r, "aria-label", i.n = C), k !== i.s && y(r, "aria-pressed", i.s = k), i;
|
|
129
129
|
}, {
|
|
130
130
|
e: void 0,
|
|
131
131
|
t: void 0,
|
|
@@ -137,23 +137,23 @@ function me(e) {
|
|
|
137
137
|
}), r;
|
|
138
138
|
})();
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function ut(e) {
|
|
141
141
|
const s = () => e.hoverOffset === -1, a = () => ({
|
|
142
142
|
scale: 1,
|
|
143
143
|
y: 0,
|
|
144
144
|
x: 0
|
|
145
145
|
}), l = e.action.icon;
|
|
146
146
|
return (() => {
|
|
147
|
-
var r =
|
|
148
|
-
return r.$$click = (i) => e.action.onActivate(i.currentTarget), r.addEventListener("dragstart", (i) => i.preventDefault()),
|
|
147
|
+
var r = Qe();
|
|
148
|
+
return r.$$click = (i) => e.action.onActivate(i.currentTarget), r.addEventListener("dragstart", (i) => i.preventDefault()), ke(r, "pointerleave", e.onLeave), ke(r, "pointerenter", e.onEnter), y(r, "draggable", !1), h(r, c($.span, {
|
|
149
149
|
class: "workbench-dock__tile",
|
|
150
150
|
get animate() {
|
|
151
151
|
return a();
|
|
152
152
|
},
|
|
153
153
|
get transition() {
|
|
154
154
|
return {
|
|
155
|
-
duration:
|
|
156
|
-
easing:
|
|
155
|
+
duration: R.fast,
|
|
156
|
+
easing: F.easeOut
|
|
157
157
|
};
|
|
158
158
|
},
|
|
159
159
|
get children() {
|
|
@@ -161,7 +161,7 @@ function lt(e) {
|
|
|
161
161
|
class: "workbench-dock__icon"
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
}), null),
|
|
164
|
+
}), null), h(r, c($.span, {
|
|
165
165
|
class: "workbench-dock__tooltip",
|
|
166
166
|
get animate() {
|
|
167
167
|
return {
|
|
@@ -171,16 +171,16 @@ function lt(e) {
|
|
|
171
171
|
},
|
|
172
172
|
get transition() {
|
|
173
173
|
return {
|
|
174
|
-
duration:
|
|
175
|
-
easing:
|
|
174
|
+
duration: R.fast,
|
|
175
|
+
easing: F.easeOut
|
|
176
176
|
};
|
|
177
177
|
},
|
|
178
178
|
get children() {
|
|
179
179
|
return e.action.label;
|
|
180
180
|
}
|
|
181
|
-
}), null),
|
|
182
|
-
var D = e.action.id, v = !!e.action.active, E = !!s(),
|
|
183
|
-
return D !== i.e &&
|
|
181
|
+
}), null), Y((i) => {
|
|
182
|
+
var D = e.action.id, v = !!e.action.active, E = !!s(), g = e.action.label, b = e.action.active;
|
|
183
|
+
return D !== i.e && y(r, "data-workbench-dock-action", i.e = D), v !== i.t && r.classList.toggle("is-active", i.t = v), E !== i.a && r.classList.toggle("is-hovered", i.a = E), g !== i.o && y(r, "aria-label", i.o = g), b !== i.i && y(r, "aria-pressed", i.i = b), i;
|
|
184
184
|
}, {
|
|
185
185
|
e: void 0,
|
|
186
186
|
t: void 0,
|
|
@@ -190,45 +190,45 @@ function lt(e) {
|
|
|
190
190
|
}), r;
|
|
191
191
|
})();
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Lt(e) {
|
|
194
194
|
const [s, a] = Z(null), [l, r] = Z(null), [i, D] = Z(!1);
|
|
195
|
-
let v, E,
|
|
196
|
-
|
|
195
|
+
let v, E, g, b, C = null;
|
|
196
|
+
U(() => {
|
|
197
197
|
b?.stop(), E?.stop({
|
|
198
198
|
reason: "manual_stop",
|
|
199
199
|
commit: !1
|
|
200
|
-
}), E = void 0,
|
|
201
|
-
}),
|
|
200
|
+
}), E = void 0, g?.clear(), g = void 0, l()?.stopInteraction(), e.onDragPreviewChange?.(null), e.registerExternalDockDragController?.(null);
|
|
201
|
+
}), q(() => {
|
|
202
202
|
e.onDragPreviewChange?.(l()?.preview ?? null);
|
|
203
|
-
}),
|
|
203
|
+
}), q(() => {
|
|
204
204
|
const t = (n) => {
|
|
205
205
|
n.key !== "Escape" || !l() || (n.preventDefault(), E?.stop({
|
|
206
206
|
reason: "manual_stop",
|
|
207
207
|
commit: !1
|
|
208
208
|
}));
|
|
209
209
|
};
|
|
210
|
-
window.addEventListener("keydown", t, !0),
|
|
211
|
-
}),
|
|
210
|
+
window.addEventListener("keydown", t, !0), U(() => window.removeEventListener("keydown", t, !0));
|
|
211
|
+
}), q(() => {
|
|
212
212
|
if (!i() || typeof window > "u") return;
|
|
213
213
|
const t = (f) => {
|
|
214
214
|
v && f.target instanceof Node && v.contains(f.target) || D(!1);
|
|
215
215
|
}, n = (f) => {
|
|
216
216
|
f.key === "Escape" && D(!1);
|
|
217
217
|
};
|
|
218
|
-
window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", n, !0),
|
|
218
|
+
window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", n, !0), U(() => {
|
|
219
219
|
window.removeEventListener("pointerdown", t, !0), window.removeEventListener("keydown", n, !0);
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
const k = (t) => {
|
|
223
223
|
const n = s();
|
|
224
|
-
return n === null || n <=
|
|
225
|
-
},
|
|
224
|
+
return n === null || n <= K().length ? 0 : n === t ? -1 : n === t + 1 ? -2 : n === t - 1 ? 1 : 0;
|
|
225
|
+
}, A = () => {
|
|
226
226
|
b?.stop(), b = void 0, C = null;
|
|
227
|
-
},
|
|
228
|
-
!e.viewport || !e.onViewportCommit || (C = e.viewport, b?.stop(), b =
|
|
227
|
+
}, N = () => {
|
|
228
|
+
!e.viewport || !e.onViewportCommit || (C = e.viewport, b?.stop(), b = Ve({
|
|
229
229
|
readFrame: () => {
|
|
230
|
-
const n = v?.closest(".workbench-surface")?.querySelector(
|
|
231
|
-
return n instanceof HTMLElement ?
|
|
230
|
+
const n = v?.closest(".workbench-surface")?.querySelector(be);
|
|
231
|
+
return n instanceof HTMLElement ? _e(n) : null;
|
|
232
232
|
},
|
|
233
233
|
readViewport: () => C ?? e.viewport ?? null,
|
|
234
234
|
commitViewport: (t) => {
|
|
@@ -237,14 +237,14 @@ function Et(e) {
|
|
|
237
237
|
onPanStart: () => e.onViewportInteractionStart?.("pan"),
|
|
238
238
|
shouldPan: () => {
|
|
239
239
|
const t = l();
|
|
240
|
-
return !!(t?.moved && t.hasEnteredCanvas && !
|
|
240
|
+
return !!(t?.moved && t.hasEnteredCanvas && !we(t.clientX, t.clientY, v));
|
|
241
241
|
}
|
|
242
242
|
}));
|
|
243
|
-
},
|
|
243
|
+
}, Ee = (t) => {
|
|
244
244
|
const n = l();
|
|
245
245
|
if (!n) return;
|
|
246
246
|
const f = !n.moved, P = C ?? e.viewport;
|
|
247
|
-
if (n.stopInteraction(),
|
|
247
|
+
if (n.stopInteraction(), A(), r(null), E = void 0, n.kind === "external" && n.moved && g?.expire(), f) {
|
|
248
248
|
if (n.kind === "external" || !(n.trigger instanceof HTMLButtonElement)) return;
|
|
249
249
|
if (n.kind === "host") {
|
|
250
250
|
e.dockItems?.find((o) => o.id === n.id)?.onActivate?.(n.trigger);
|
|
@@ -256,7 +256,7 @@ function Et(e) {
|
|
|
256
256
|
label: n.label,
|
|
257
257
|
trigger: n.trigger
|
|
258
258
|
})) return;
|
|
259
|
-
|
|
259
|
+
O() !== "background" && e.onSoloFilter(String(n.id), le());
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
262
|
if (t && n.overDock && n.dockDrop) {
|
|
@@ -264,7 +264,7 @@ function Et(e) {
|
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
if (t && n.overCanvas && n.canvasPlacement) {
|
|
267
|
-
const S = n.canvasFrame && P ?
|
|
267
|
+
const S = n.canvasFrame && P ? We(n.canvasFrame, P, {
|
|
268
268
|
clientX: n.clientX,
|
|
269
269
|
clientY: n.clientY
|
|
270
270
|
}) : null, o = n.canvasFrame ? {
|
|
@@ -276,12 +276,12 @@ function Et(e) {
|
|
|
276
276
|
} : void 0;
|
|
277
277
|
n.canvasPlacement.onDrop(n.clientX, n.clientY, o);
|
|
278
278
|
}
|
|
279
|
-
}, z = (t, n, f, P, S, o, _,
|
|
279
|
+
}, z = (t, n, f, P, S, o, _, w) => {
|
|
280
280
|
t.preventDefault(), E?.stop({
|
|
281
281
|
reason: "manual_stop",
|
|
282
282
|
commit: !1
|
|
283
|
-
}),
|
|
284
|
-
const
|
|
283
|
+
}), N();
|
|
284
|
+
const u = ct(v);
|
|
285
285
|
r({
|
|
286
286
|
kind: n,
|
|
287
287
|
id: f,
|
|
@@ -295,11 +295,11 @@ function Et(e) {
|
|
|
295
295
|
moved: !1,
|
|
296
296
|
overCanvas: !1,
|
|
297
297
|
hasEnteredCanvas: !1,
|
|
298
|
-
canvasFrame:
|
|
298
|
+
canvasFrame: u,
|
|
299
299
|
preview: null,
|
|
300
300
|
canvasPlacement: _,
|
|
301
|
-
dockDrop:
|
|
302
|
-
stopInteraction:
|
|
301
|
+
dockDrop: w,
|
|
302
|
+
stopInteraction: Be({
|
|
303
303
|
kind: "drag",
|
|
304
304
|
cursor: "grabbing"
|
|
305
305
|
}),
|
|
@@ -310,44 +310,45 @@ function Et(e) {
|
|
|
310
310
|
let T = !1;
|
|
311
311
|
r((m) => {
|
|
312
312
|
if (!m || m.pointerId !== d.pointerId) return m;
|
|
313
|
-
const
|
|
314
|
-
if (m.kind === "external" &&
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
313
|
+
const M = d.clientX - m.startClientX, V = d.clientY - m.startClientY, x = m.moved || Math.abs(M) > fe || Math.abs(V) > fe;
|
|
314
|
+
if (m.kind === "external" && x && !m.moved) {
|
|
315
|
+
let p;
|
|
316
|
+
const B = () => {
|
|
317
|
+
p !== void 0 && window.clearTimeout(p), m.trigger.removeEventListener("click", ue, !0), window.removeEventListener("pointerdown", ge, !0), g?.clear === B && (g = void 0);
|
|
318
|
+
}, ue = (ve) => {
|
|
319
|
+
ve.preventDefault(), ve.stopImmediatePropagation(), B();
|
|
320
|
+
}, ge = () => B(), Me = () => {
|
|
321
|
+
p !== void 0 && window.clearTimeout(p), p = window.setTimeout(B, rt);
|
|
322
|
+
};
|
|
323
|
+
m.trigger.addEventListener("click", ue, !0), window.addEventListener("pointerdown", ge, !0), g = {
|
|
324
|
+
clear: B,
|
|
325
|
+
expire: Me
|
|
321
326
|
};
|
|
322
|
-
m.trigger.addEventListener("click", de, {
|
|
323
|
-
capture: !0,
|
|
324
|
-
once: !0
|
|
325
|
-
}), u = V;
|
|
326
327
|
}
|
|
327
|
-
const
|
|
328
|
-
T =
|
|
329
|
-
const
|
|
328
|
+
const G = we(d.clientX, d.clientY, v), I = m.canvasFrame, ce = x && st(d.clientX, d.clientY, I), se = ce && !G, Te = x && !G && dt(I, m.clientX, m.clientY, d.clientX, d.clientY), de = m.hasEnteredCanvas || ce || Te;
|
|
329
|
+
T = x && de && !G;
|
|
330
|
+
const xe = I ? me(d.clientX, I.left, I.right) : d.clientX, ye = I ? me(d.clientY, I.top, I.bottom) : d.clientY;
|
|
330
331
|
return {
|
|
331
332
|
...m,
|
|
332
333
|
clientX: d.clientX,
|
|
333
334
|
clientY: d.clientY,
|
|
334
|
-
moved:
|
|
335
|
-
overDock:
|
|
336
|
-
overCanvas:
|
|
337
|
-
hasEnteredCanvas:
|
|
338
|
-
preview:
|
|
335
|
+
moved: x,
|
|
336
|
+
overDock: G,
|
|
337
|
+
overCanvas: se,
|
|
338
|
+
hasEnteredCanvas: de,
|
|
339
|
+
preview: x && I && m.canvasPlacement?.preview ? {
|
|
339
340
|
kind: m.canvasPlacement.preview.kind,
|
|
340
341
|
id: m.canvasPlacement.preview.id,
|
|
341
342
|
label: m.label,
|
|
342
|
-
clientX:
|
|
343
|
-
clientY:
|
|
344
|
-
dropAllowed:
|
|
345
|
-
canvasFrame:
|
|
343
|
+
clientX: xe,
|
|
344
|
+
clientY: ye,
|
|
345
|
+
dropAllowed: se,
|
|
346
|
+
canvasFrame: I
|
|
346
347
|
} : null
|
|
347
348
|
};
|
|
348
349
|
}), T && b?.updatePointer(d.clientX, d.clientY);
|
|
349
350
|
};
|
|
350
|
-
E =
|
|
351
|
+
E = He({
|
|
351
352
|
pointerEvent: t,
|
|
352
353
|
captureEl: t.currentTarget,
|
|
353
354
|
onMove: L,
|
|
@@ -359,41 +360,41 @@ function Et(e) {
|
|
|
359
360
|
pointerId: T.pointerId,
|
|
360
361
|
clientX: T.latestClientX,
|
|
361
362
|
clientY: T.latestClientY
|
|
362
|
-
}),
|
|
363
|
+
}), Ee(d);
|
|
363
364
|
}
|
|
364
365
|
});
|
|
365
|
-
},
|
|
366
|
+
}, oe = (t) => t ? {
|
|
366
367
|
preview: {
|
|
367
368
|
kind: "widget",
|
|
368
369
|
id: t.widgetType
|
|
369
370
|
},
|
|
370
371
|
onDrop: (n, f, P) => {
|
|
371
372
|
if (!P?.worldPoint) return;
|
|
372
|
-
const S =
|
|
373
|
+
const S = Ke(t.widgetType, e.widgetDefinitions);
|
|
373
374
|
t.onDrop({
|
|
374
375
|
widgetType: t.widgetType,
|
|
375
376
|
centerWorld: P.worldPoint,
|
|
376
|
-
frame:
|
|
377
|
+
frame: Ne(S, {
|
|
377
378
|
anchor: "center",
|
|
378
379
|
worldX: P.worldPoint.worldX,
|
|
379
380
|
worldY: P.worldPoint.worldY
|
|
380
381
|
})
|
|
381
382
|
});
|
|
382
383
|
}
|
|
383
|
-
} : null,
|
|
384
|
-
t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (
|
|
384
|
+
} : null, De = (t, n) => {
|
|
385
|
+
t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (g?.clear(), g = void 0, z(t, "external", n.id, n.label, n.icon, t.currentTarget, oe(n.canvasPlacement), n.onDropToDock ?? null));
|
|
385
386
|
};
|
|
386
|
-
|
|
387
|
+
q(() => {
|
|
387
388
|
e.registerExternalDockDragController?.({
|
|
388
|
-
begin:
|
|
389
|
-
}),
|
|
389
|
+
begin: De
|
|
390
|
+
}), U(() => e.registerExternalDockDragController?.(null));
|
|
390
391
|
});
|
|
391
|
-
const
|
|
392
|
+
const Ce = () => l()?.kind === "widget" ? l().id : null, Pe = () => l()?.kind === "tool" ? l().id : null, Le = () => l()?.kind === "external" ? l()?.icon : void 0, O = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", re = H(() => te.find((t) => t.mode === O()) ?? te[0]), ie = H(() => O() === "background" ? lt.map((t) => ({
|
|
392
393
|
id: t.tool,
|
|
393
394
|
kind: "tool",
|
|
394
395
|
label: t.label,
|
|
395
396
|
icon: t.icon
|
|
396
|
-
})) : [...
|
|
397
|
+
})) : [...at.map((t) => ({
|
|
397
398
|
id: t.tool,
|
|
398
399
|
kind: "tool",
|
|
399
400
|
label: t.label,
|
|
@@ -403,40 +404,40 @@ function Et(e) {
|
|
|
403
404
|
kind: "widget",
|
|
404
405
|
label: t.label,
|
|
405
406
|
icon: t.icon
|
|
406
|
-
}))]),
|
|
407
|
+
}))]), ae = H(() => O() === "background" ? [] : [...e.dockItems ?? []]), K = H(() => O() === "background" ? [] : [...e.dockActions ?? []]), le = H(() => ie().map((t) => String(t.id))), j = () => O() !== "background", Se = (t) => !j() || e.filters[t] !== !1, Ie = (t) => {
|
|
407
408
|
if (!j())
|
|
408
409
|
return !1;
|
|
409
|
-
const n =
|
|
410
|
+
const n = le();
|
|
410
411
|
return n.length > 1 && n.every((f) => e.filters[f] !== !1 == (f === t));
|
|
411
|
-
}, J = () => s() === 0,
|
|
412
|
+
}, J = () => s() === 0, Oe = () => ({
|
|
412
413
|
scale: 1,
|
|
413
414
|
y: 0,
|
|
414
415
|
x: 0
|
|
415
416
|
});
|
|
416
417
|
return [(() => {
|
|
417
|
-
var t =
|
|
418
|
+
var t = tt(), n = t.firstChild, f = n.firstChild, P = n.nextSibling;
|
|
418
419
|
t.addEventListener("pointerleave", () => a(null));
|
|
419
420
|
var S = v;
|
|
420
|
-
return typeof S == "function" ? $e(S, t) : v = t, f.$$click = () => D((o) => !o), f.addEventListener("pointerleave", () => a((o) => o === 0 ? null : o)), f.addEventListener("pointerenter", () => a(0)),
|
|
421
|
+
return typeof S == "function" ? $e(S, t) : v = t, f.$$click = () => D((o) => !o), f.addEventListener("pointerleave", () => a((o) => o === 0 ? null : o)), f.addEventListener("pointerenter", () => a(0)), h(f, c($.span, {
|
|
421
422
|
class: "workbench-dock__tile",
|
|
422
423
|
get animate() {
|
|
423
|
-
return
|
|
424
|
+
return Oe();
|
|
424
425
|
},
|
|
425
426
|
get transition() {
|
|
426
427
|
return {
|
|
427
|
-
duration:
|
|
428
|
-
easing:
|
|
428
|
+
duration: R.fast,
|
|
429
|
+
easing: F.easeOut
|
|
429
430
|
};
|
|
430
431
|
},
|
|
431
432
|
get children() {
|
|
432
433
|
return (() => {
|
|
433
|
-
const o =
|
|
434
|
+
const o = re().icon;
|
|
434
435
|
return c(o, {
|
|
435
436
|
class: "workbench-dock__icon"
|
|
436
437
|
});
|
|
437
438
|
})();
|
|
438
439
|
}
|
|
439
|
-
}), null),
|
|
440
|
+
}), null), h(f, c($.span, {
|
|
440
441
|
class: "workbench-dock__tooltip",
|
|
441
442
|
get animate() {
|
|
442
443
|
return {
|
|
@@ -446,80 +447,82 @@ function Et(e) {
|
|
|
446
447
|
},
|
|
447
448
|
get transition() {
|
|
448
449
|
return {
|
|
449
|
-
duration:
|
|
450
|
-
easing:
|
|
450
|
+
duration: R.fast,
|
|
451
|
+
easing: F.easeOut
|
|
451
452
|
};
|
|
452
453
|
},
|
|
453
454
|
get children() {
|
|
454
|
-
return
|
|
455
|
+
return re().label;
|
|
455
456
|
}
|
|
456
|
-
}), null),
|
|
457
|
+
}), null), h(n, c(W, {
|
|
457
458
|
get when() {
|
|
458
459
|
return i();
|
|
459
460
|
},
|
|
460
461
|
get children() {
|
|
461
|
-
var o =
|
|
462
|
-
return
|
|
463
|
-
each:
|
|
462
|
+
var o = Ze();
|
|
463
|
+
return h(o, c(ee, {
|
|
464
|
+
each: te,
|
|
464
465
|
children: (_) => {
|
|
465
|
-
const
|
|
466
|
+
const w = _.icon;
|
|
466
467
|
return (() => {
|
|
467
|
-
var
|
|
468
|
-
return
|
|
468
|
+
var u = nt(), L = u.firstChild, d = L.nextSibling, T = d.firstChild, m = T.nextSibling;
|
|
469
|
+
return u.$$click = () => {
|
|
469
470
|
e.onSelectMode?.(_.mode), D(!1);
|
|
470
|
-
},
|
|
471
|
+
}, h(L, c(w, {
|
|
471
472
|
class: "workbench-dock__mode-icon"
|
|
472
|
-
})),
|
|
473
|
-
var
|
|
474
|
-
return
|
|
473
|
+
})), h(T, () => _.label), h(m, () => _.description), Y((M) => {
|
|
474
|
+
var V = O() === _.mode, x = O() === _.mode;
|
|
475
|
+
return V !== M.e && u.classList.toggle("is-active", M.e = V), x !== M.t && y(u, "aria-checked", M.t = x), M;
|
|
475
476
|
}, {
|
|
476
477
|
e: void 0,
|
|
477
478
|
t: void 0
|
|
478
|
-
}),
|
|
479
|
+
}), u;
|
|
479
480
|
})();
|
|
480
481
|
}
|
|
481
482
|
})), o;
|
|
482
483
|
}
|
|
483
|
-
}), null),
|
|
484
|
+
}), null), h(t, c(Re, {
|
|
484
485
|
get each() {
|
|
485
|
-
return
|
|
486
|
+
return K();
|
|
486
487
|
},
|
|
487
488
|
children: (o, _) => {
|
|
488
|
-
const
|
|
489
|
-
return c(
|
|
490
|
-
action
|
|
489
|
+
const w = () => _ + 1;
|
|
490
|
+
return c(ut, {
|
|
491
|
+
get action() {
|
|
492
|
+
return o();
|
|
493
|
+
},
|
|
491
494
|
get hoverOffset() {
|
|
492
|
-
return k(
|
|
495
|
+
return k(w());
|
|
493
496
|
},
|
|
494
|
-
onEnter: () => a(
|
|
495
|
-
onLeave: () => a((
|
|
497
|
+
onEnter: () => a(w()),
|
|
498
|
+
onLeave: () => a((u) => u === w() ? null : u)
|
|
496
499
|
});
|
|
497
500
|
}
|
|
498
|
-
}), P),
|
|
501
|
+
}), P), h(t, c(W, {
|
|
499
502
|
get when() {
|
|
500
503
|
return !!(l()?.kind === "external" && l()?.moved);
|
|
501
504
|
},
|
|
502
505
|
get children() {
|
|
503
|
-
var o =
|
|
504
|
-
return
|
|
506
|
+
var o = et();
|
|
507
|
+
return h(o, c(W, {
|
|
505
508
|
get when() {
|
|
506
|
-
return
|
|
509
|
+
return Le();
|
|
507
510
|
},
|
|
508
511
|
children: (_) => {
|
|
509
|
-
const
|
|
510
|
-
return c(
|
|
512
|
+
const w = _();
|
|
513
|
+
return c(w, {
|
|
511
514
|
class: "workbench-dock__icon"
|
|
512
515
|
});
|
|
513
516
|
}
|
|
514
|
-
})),
|
|
517
|
+
})), Y(() => o.classList.toggle("is-drop-allowed", !!l()?.overDock)), o;
|
|
515
518
|
}
|
|
516
|
-
}), P),
|
|
519
|
+
}), P), h(t, c(ee, {
|
|
517
520
|
get each() {
|
|
518
|
-
return
|
|
521
|
+
return ae();
|
|
519
522
|
},
|
|
520
523
|
children: (o, _) => {
|
|
521
|
-
const
|
|
522
|
-
return c(
|
|
524
|
+
const w = () => _() + K().length + 1;
|
|
525
|
+
return c(he, {
|
|
523
526
|
get id() {
|
|
524
527
|
return o.id;
|
|
525
528
|
},
|
|
@@ -536,26 +539,26 @@ function Et(e) {
|
|
|
536
539
|
visible: !0,
|
|
537
540
|
filterable: !1,
|
|
538
541
|
get hoverOffset() {
|
|
539
|
-
return k(
|
|
542
|
+
return k(w());
|
|
540
543
|
},
|
|
541
544
|
get isDragging() {
|
|
542
545
|
return Q(() => l()?.kind === "host")() && l()?.id === o.id;
|
|
543
546
|
},
|
|
544
547
|
get canvasPlacement() {
|
|
545
|
-
return
|
|
548
|
+
return oe(o.canvasPlacement);
|
|
546
549
|
},
|
|
547
|
-
onEnter: () => a(
|
|
548
|
-
onLeave: () => a((
|
|
550
|
+
onEnter: () => a(w()),
|
|
551
|
+
onLeave: () => a((u) => u === w() ? null : u),
|
|
549
552
|
onDragBegin: z
|
|
550
553
|
});
|
|
551
554
|
}
|
|
552
|
-
}), P),
|
|
555
|
+
}), P), h(t, c(ee, {
|
|
553
556
|
get each() {
|
|
554
|
-
return
|
|
557
|
+
return ie();
|
|
555
558
|
},
|
|
556
559
|
children: (o, _) => {
|
|
557
|
-
const
|
|
558
|
-
return c(
|
|
560
|
+
const w = () => _() + K().length + ae().length + 1;
|
|
561
|
+
return c(he, {
|
|
559
562
|
get id() {
|
|
560
563
|
return String(o.id);
|
|
561
564
|
},
|
|
@@ -569,19 +572,19 @@ function Et(e) {
|
|
|
569
572
|
return o.icon;
|
|
570
573
|
},
|
|
571
574
|
get active() {
|
|
572
|
-
return
|
|
575
|
+
return Ie(String(o.id));
|
|
573
576
|
},
|
|
574
577
|
get visible() {
|
|
575
|
-
return
|
|
578
|
+
return Se(String(o.id));
|
|
576
579
|
},
|
|
577
580
|
get filterable() {
|
|
578
581
|
return j();
|
|
579
582
|
},
|
|
580
583
|
get hoverOffset() {
|
|
581
|
-
return k(
|
|
584
|
+
return k(w());
|
|
582
585
|
},
|
|
583
586
|
get isDragging() {
|
|
584
|
-
return Q(() => o.kind === "widget")() ?
|
|
587
|
+
return Q(() => o.kind === "widget")() ? Ce() === o.id : Pe() === o.id;
|
|
585
588
|
},
|
|
586
589
|
get canvasPlacement() {
|
|
587
590
|
return Q(() => o.kind === "widget")() ? {
|
|
@@ -589,23 +592,23 @@ function Et(e) {
|
|
|
589
592
|
kind: "widget",
|
|
590
593
|
id: o.id
|
|
591
594
|
},
|
|
592
|
-
onDrop: (
|
|
595
|
+
onDrop: (u, L, d) => e.onCreateAt?.(o.id, u, L, d)
|
|
593
596
|
} : {
|
|
594
597
|
preview: {
|
|
595
598
|
kind: "tool",
|
|
596
599
|
id: o.id
|
|
597
600
|
},
|
|
598
|
-
onDrop: (
|
|
601
|
+
onDrop: (u, L, d) => e.onCreateToolAt?.(o.id, u, L, d)
|
|
599
602
|
};
|
|
600
603
|
},
|
|
601
|
-
onEnter: () => a(
|
|
602
|
-
onLeave: () => a((
|
|
604
|
+
onEnter: () => a(w()),
|
|
605
|
+
onLeave: () => a((u) => u === w() ? null : u),
|
|
603
606
|
onDragBegin: z
|
|
604
607
|
});
|
|
605
608
|
}
|
|
606
|
-
}), null),
|
|
607
|
-
var _ = `workbench-dock workbench-dock-material${l()?.kind === "external" && l()?.moved ? " is-external-drop-target" : ""}${l()?.kind === "external" && l()?.overDock ? " is-external-drop-allowed" : ""}`,
|
|
608
|
-
return _ !== o.e &&
|
|
609
|
+
}), null), Y((o) => {
|
|
610
|
+
var _ = `workbench-dock workbench-dock-material${l()?.kind === "external" && l()?.moved ? " is-external-drop-target" : ""}${l()?.kind === "external" && l()?.overDock ? " is-external-drop-allowed" : ""}`, w = O() === "background", u = !!(J() || i()), L = i();
|
|
611
|
+
return _ !== o.e && Xe(t, o.e = _), w !== o.t && f.classList.toggle("is-active", o.t = w), u !== o.a && f.classList.toggle("is-hovered", o.a = u), L !== o.o && y(f, "aria-expanded", o.o = L), o;
|
|
609
612
|
}, {
|
|
610
613
|
e: void 0,
|
|
611
614
|
t: void 0,
|
|
@@ -617,35 +620,35 @@ function Et(e) {
|
|
|
617
620
|
return !!(l()?.moved && !l()?.preview);
|
|
618
621
|
},
|
|
619
622
|
get children() {
|
|
620
|
-
return c(
|
|
623
|
+
return c(gt, {
|
|
621
624
|
state: l
|
|
622
625
|
});
|
|
623
626
|
}
|
|
624
627
|
})];
|
|
625
628
|
}
|
|
626
|
-
function
|
|
629
|
+
function gt(e) {
|
|
627
630
|
const s = () => {
|
|
628
631
|
const r = e.state();
|
|
629
632
|
return r ? `translate3d(${r.clientX + 14}px, ${r.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
|
|
630
633
|
}, a = () => e.state()?.label ?? "", l = () => e.state()?.icon;
|
|
631
|
-
return c(
|
|
634
|
+
return c(Ae, {
|
|
632
635
|
get children() {
|
|
633
|
-
var r =
|
|
634
|
-
return
|
|
636
|
+
var r = ot(), i = r.firstChild, D = i.nextSibling, v = D.firstChild, E = v.nextSibling, g = E.firstChild, b = g.nextSibling, C = b.firstChild;
|
|
637
|
+
return h(v, c(W, {
|
|
635
638
|
get when() {
|
|
636
639
|
return l();
|
|
637
640
|
},
|
|
638
641
|
children: (k) => {
|
|
639
|
-
const
|
|
640
|
-
return c(
|
|
642
|
+
const A = k();
|
|
643
|
+
return c(A, {
|
|
641
644
|
class: "w-4 h-4"
|
|
642
645
|
});
|
|
643
646
|
}
|
|
644
|
-
})),
|
|
647
|
+
})), h(g, a), h(b, c(pe, {
|
|
645
648
|
class: "w-3 h-3"
|
|
646
|
-
}), C),
|
|
647
|
-
var
|
|
648
|
-
return
|
|
649
|
+
}), C), h(C, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), Y((k) => {
|
|
650
|
+
var A = !!(e.state()?.kind === "external" && e.state()?.overDock), N = s();
|
|
651
|
+
return A !== k.e && r.classList.toggle("is-over-dock", k.e = A), N !== k.t && Ye(r, "transform", k.t = N), k;
|
|
649
652
|
}, {
|
|
650
653
|
e: void 0,
|
|
651
654
|
t: void 0
|
|
@@ -653,7 +656,7 @@ function ct(e) {
|
|
|
653
656
|
}
|
|
654
657
|
});
|
|
655
658
|
}
|
|
656
|
-
|
|
659
|
+
Fe(["pointerdown", "click"]);
|
|
657
660
|
export {
|
|
658
|
-
|
|
661
|
+
Lt as WorkbenchDock
|
|
659
662
|
};
|