@floegence/floe-webapp-core 0.41.4 → 0.42.1
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/workbench/WorkbenchDockPopoverSurface.d.ts +20 -0
- package/dist/components/workbench/WorkbenchDockPopoverSurface.js +90 -0
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +20 -2
- package/dist/components/workbench/WorkbenchFilterBar.js +328 -332
- package/dist/components/workbench/WorkbenchSurface.d.ts +1 -2
- package/dist/components/workbench/WorkbenchSurface.js +57 -54
- package/dist/components/workbench/index.d.ts +4 -3
- package/dist/styles.css +1 -1
- package/dist/workbench-themes.css +34 -17
- package/dist/workbench.css +46 -7
- package/dist/workbench.js +38 -36
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
export interface WorkbenchDockPopoverSurfaceProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'style' | 'ref'> {
|
|
3
|
+
owner: Element;
|
|
4
|
+
estimatedSize?: Readonly<{
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}>;
|
|
8
|
+
gap?: number;
|
|
9
|
+
boundaryPadding?: number;
|
|
10
|
+
class?: string;
|
|
11
|
+
style?: JSX.CSSProperties;
|
|
12
|
+
children: JSX.Element;
|
|
13
|
+
surfaceRef?: (element: HTMLDivElement) => void;
|
|
14
|
+
onOwnerDisconnect?: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Surface-aware companion panel anchored above a Workbench Dock item.
|
|
18
|
+
* It owns viewport projection and clamping while the caller owns panel content.
|
|
19
|
+
*/
|
|
20
|
+
export declare function WorkbenchDockPopoverSurface(props: WorkbenchDockPopoverSurfaceProps): JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createComponent as $, use as C, spread as B, mergeProps as X, insert as q, effect as H, setStyleProperty as U, template as P } from "solid-js/web";
|
|
2
|
+
import { splitProps as W, createSignal as d, createEffect as Y, onCleanup as I } from "solid-js";
|
|
3
|
+
import { SurfaceFloatingLayer as T } from "../ui/SurfaceFloatingLayer.js";
|
|
4
|
+
import { cn as Z } from "../../utils/cn.js";
|
|
5
|
+
import { resolveSurfacePortalBoundaryRect as j, resolveSurfacePortalHost as G } from "../ui/dialogSurfaceScope.js";
|
|
6
|
+
var J = /* @__PURE__ */ P("<div>"), K = /* @__PURE__ */ P("<span class=workbench-dock-popover__arrow aria-hidden=true>");
|
|
7
|
+
const f = {
|
|
8
|
+
width: 320,
|
|
9
|
+
height: 320
|
|
10
|
+
};
|
|
11
|
+
function p(l, t, m) {
|
|
12
|
+
return Math.max(t, Math.min(m, l));
|
|
13
|
+
}
|
|
14
|
+
function ne(l) {
|
|
15
|
+
const [t, m] = W(l, ["owner", "estimatedSize", "gap", "boundaryPadding", "class", "style", "children", "surfaceRef", "onOwnerDisconnect"]), [x, z] = d({
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0
|
|
18
|
+
}), [k, R] = d(f.width / 2), [O, h] = d(!1), [E, L] = d(0);
|
|
19
|
+
let i, u = !1;
|
|
20
|
+
const _ = () => ({
|
|
21
|
+
owner: t.owner,
|
|
22
|
+
estimatedSize: t.estimatedSize ?? f,
|
|
23
|
+
gap: Math.max(0, t.gap ?? 16),
|
|
24
|
+
boundaryPadding: Math.max(0, t.boundaryPadding ?? 12),
|
|
25
|
+
onOwnerDisconnect: t.onOwnerDisconnect
|
|
26
|
+
}), g = (e) => {
|
|
27
|
+
const n = e.owner;
|
|
28
|
+
if (!n.isConnected) {
|
|
29
|
+
h(!1), u || (u = !0, e.onOwnerDisconnect?.());
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
u = !1;
|
|
33
|
+
const r = e.estimatedSize, o = i?.offsetWidth || r.width, s = i?.offsetHeight || r.height, D = e.gap, a = e.boundaryPadding, w = n.getBoundingClientRect(), c = j(G({
|
|
34
|
+
owner: n
|
|
35
|
+
})), v = c.left + a, F = Math.max(v, c.right - a - o), y = c.top + a, M = Math.max(y, c.bottom - a - s), b = w.left + w.width / 2, S = p(b - o / 2, v, F), A = p(w.top - D - s, y, M);
|
|
36
|
+
z({
|
|
37
|
+
x: S,
|
|
38
|
+
y: A
|
|
39
|
+
}), R(p(b - S, 18, Math.max(18, o - 18))), h(!!i);
|
|
40
|
+
};
|
|
41
|
+
return Y(() => {
|
|
42
|
+
E();
|
|
43
|
+
const e = _(), n = e.owner;
|
|
44
|
+
let r = window.requestAnimationFrame(() => g(e));
|
|
45
|
+
const o = () => {
|
|
46
|
+
window.cancelAnimationFrame(r), r = window.requestAnimationFrame(() => g(e));
|
|
47
|
+
}, s = typeof ResizeObserver == "function" ? new ResizeObserver(o) : null;
|
|
48
|
+
s?.observe(n), i && s?.observe(i), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), I(() => {
|
|
49
|
+
window.cancelAnimationFrame(r), s?.disconnect(), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
|
|
50
|
+
});
|
|
51
|
+
}), $(T, {
|
|
52
|
+
get owner() {
|
|
53
|
+
return t.owner;
|
|
54
|
+
},
|
|
55
|
+
get position() {
|
|
56
|
+
return x();
|
|
57
|
+
},
|
|
58
|
+
get estimatedSize() {
|
|
59
|
+
return t.estimatedSize ?? f;
|
|
60
|
+
},
|
|
61
|
+
clamp: !1,
|
|
62
|
+
class: "workbench-dock-popover-layer",
|
|
63
|
+
get style() {
|
|
64
|
+
return {
|
|
65
|
+
visibility: O() ? "visible" : "hidden"
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
get children() {
|
|
69
|
+
return [(() => {
|
|
70
|
+
var e = J();
|
|
71
|
+
return C((n) => {
|
|
72
|
+
i = n, t.surfaceRef?.(n), L((r) => r + 1);
|
|
73
|
+
}, e), B(e, X(m, {
|
|
74
|
+
get class() {
|
|
75
|
+
return Z("workbench-dock-popover workbench-dock-material", t.class);
|
|
76
|
+
},
|
|
77
|
+
get style() {
|
|
78
|
+
return t.style;
|
|
79
|
+
}
|
|
80
|
+
}), !1, !0), q(e, () => t.children), e;
|
|
81
|
+
})(), (() => {
|
|
82
|
+
var e = K();
|
|
83
|
+
return H((n) => U(e, "left", `${k()}px`)), e;
|
|
84
|
+
})()];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
ne as WorkbenchDockPopoverSurface
|
|
90
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Component, type JSX } from 'solid-js';
|
|
2
|
+
import { type WorkbenchWidgetFrame } from './workbenchHelpers';
|
|
2
3
|
import { type WorkbenchEdgeAutoPanFrame } from './workbenchEdgeAutoPan';
|
|
3
4
|
import type { WorkbenchDockToolId, WorkbenchInteractionMode, WorkbenchViewport, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
4
5
|
export interface WorkbenchFilterBarProps {
|
|
@@ -12,7 +13,6 @@ export interface WorkbenchFilterBarProps {
|
|
|
12
13
|
dockActions?: readonly WorkbenchDockAction[];
|
|
13
14
|
dockItems?: readonly WorkbenchHostDockItem[];
|
|
14
15
|
registerExternalDockDragController?: (controller: WorkbenchExternalDockDragController | null) => void;
|
|
15
|
-
onExternalDockDrop?: (item: WorkbenchExternalDockDragItem) => void;
|
|
16
16
|
/**
|
|
17
17
|
* Called when the user drags a widget pill onto the canvas to create a
|
|
18
18
|
* new widget of that type. Coordinates are in client space (clientX/Y).
|
|
@@ -46,7 +46,7 @@ export type WorkbenchHostDockItem = Readonly<{
|
|
|
46
46
|
}>;
|
|
47
47
|
active?: boolean;
|
|
48
48
|
onActivate?: (trigger: HTMLButtonElement) => void;
|
|
49
|
-
|
|
49
|
+
canvasPlacement?: WorkbenchDockCanvasPlacement;
|
|
50
50
|
}>;
|
|
51
51
|
export type WorkbenchDockItemActivation = Readonly<{
|
|
52
52
|
kind: 'widget' | 'tool';
|
|
@@ -60,6 +60,8 @@ export type WorkbenchExternalDockDragItem = Readonly<{
|
|
|
60
60
|
icon: Component<{
|
|
61
61
|
class?: string;
|
|
62
62
|
}>;
|
|
63
|
+
canvasPlacement?: WorkbenchDockCanvasPlacement;
|
|
64
|
+
onDropToDock?: () => void;
|
|
63
65
|
}>;
|
|
64
66
|
export type WorkbenchExternalDockDragController = Readonly<{
|
|
65
67
|
begin: (event: PointerEvent, item: WorkbenchExternalDockDragItem) => void;
|
|
@@ -76,6 +78,22 @@ export type WorkbenchDockDragPreview = Readonly<{
|
|
|
76
78
|
export type WorkbenchDockDropContext = Readonly<{
|
|
77
79
|
dropAllowed: boolean;
|
|
78
80
|
canvasFrame: WorkbenchEdgeAutoPanFrame;
|
|
81
|
+
worldPoint?: Readonly<{
|
|
82
|
+
worldX: number;
|
|
83
|
+
worldY: number;
|
|
84
|
+
}>;
|
|
85
|
+
}>;
|
|
86
|
+
export type WorkbenchDockCanvasPlacement = Readonly<{
|
|
87
|
+
widgetType: WorkbenchWidgetType;
|
|
88
|
+
onDrop: (placement: WorkbenchCanvasWidgetPlacement) => void;
|
|
89
|
+
}>;
|
|
90
|
+
export type WorkbenchCanvasWidgetPlacement = Readonly<{
|
|
91
|
+
widgetType: WorkbenchWidgetType;
|
|
92
|
+
centerWorld: Readonly<{
|
|
93
|
+
worldX: number;
|
|
94
|
+
worldY: number;
|
|
95
|
+
}>;
|
|
96
|
+
frame: WorkbenchWidgetFrame;
|
|
79
97
|
}>;
|
|
80
98
|
export declare function WorkbenchDock(props: WorkbenchFilterBarProps): JSX.Element;
|
|
81
99
|
export declare const WorkbenchFilterBar: typeof WorkbenchDock;
|