@floegence/floe-webapp-core 0.36.41 → 0.36.43
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/icons/index.d.ts +2 -0
- package/dist/components/icons/index.js +419 -397
- package/dist/components/ui/FloatingWindow.d.ts +3 -0
- package/dist/components/ui/FloatingWindow.js +181 -181
- package/dist/components/ui/floatingWindowGeometry.d.ts +15 -0
- package/dist/components/ui/floatingWindowGeometry.js +80 -48
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvas.d.ts +45 -2
- package/dist/components/workbench/WorkbenchCanvas.js +265 -66
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +47 -2
- package/dist/components/workbench/WorkbenchCanvasField.js +258 -78
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +9 -7
- package/dist/components/workbench/WorkbenchFilterBar.js +233 -145
- package/dist/components/workbench/WorkbenchLayerObjects.d.ts +136 -0
- package/dist/components/workbench/WorkbenchLayerObjects.js +986 -0
- package/dist/components/workbench/WorkbenchOverlay.d.ts +4 -1
- package/dist/components/workbench/WorkbenchOverlay.js +59 -29
- package/dist/components/workbench/WorkbenchSurface.d.ts +23 -11
- package/dist/components/workbench/WorkbenchSurface.js +315 -195
- package/dist/components/workbench/WorkbenchWidget.js +37 -37
- package/dist/components/workbench/index.d.ts +2 -1
- package/dist/components/workbench/types.d.ts +96 -1
- package/dist/components/workbench/types.js +12 -4
- package/dist/components/workbench/useWorkbenchModel.d.ts +62 -4
- package/dist/components/workbench/useWorkbenchModel.js +790 -253
- package/dist/components/workbench/widgets/widgetRegistry.d.ts +1 -1
- package/dist/components/workbench/workbenchHelpers.d.ts +5 -5
- package/dist/components/workbench/workbenchHelpers.js +345 -154
- package/dist/components/workbench/workbenchOptions.d.ts +43 -0
- package/dist/components/workbench/workbenchOptions.js +112 -0
- package/dist/full.js +620 -616
- package/dist/icons.js +71 -69
- package/dist/styles.css +1 -1
- package/dist/ui.js +42 -40
- package/dist/workbench.css +1117 -26
- package/dist/workbench.js +52 -36
- package/package.json +1 -1
|
@@ -5,6 +5,18 @@ export interface FloatingWindowRect {
|
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
}
|
|
8
|
+
export interface FloatingWindowViewportInsets {
|
|
9
|
+
top?: number;
|
|
10
|
+
right?: number;
|
|
11
|
+
bottom?: number;
|
|
12
|
+
left?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FloatingWindowViewport {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
8
20
|
interface PointerPosition {
|
|
9
21
|
x: number;
|
|
10
22
|
y: number;
|
|
@@ -24,6 +36,7 @@ interface ResolveFloatingWindowRectOptions {
|
|
|
24
36
|
minSize: Size;
|
|
25
37
|
maxSize: Size;
|
|
26
38
|
viewport: Size;
|
|
39
|
+
viewportInsets?: FloatingWindowViewportInsets;
|
|
27
40
|
mobile: boolean;
|
|
28
41
|
mobilePadding: number;
|
|
29
42
|
}
|
|
@@ -32,10 +45,12 @@ interface NormalizeFloatingWindowRectOptions {
|
|
|
32
45
|
minSize: Size;
|
|
33
46
|
maxSize: Size;
|
|
34
47
|
viewport: Size;
|
|
48
|
+
viewportInsets?: FloatingWindowViewportInsets;
|
|
35
49
|
mobile: boolean;
|
|
36
50
|
mobilePadding: number;
|
|
37
51
|
center?: boolean;
|
|
38
52
|
}
|
|
53
|
+
export declare function resolveFloatingWindowViewport(viewport: Size, insets?: FloatingWindowViewportInsets): FloatingWindowViewport;
|
|
39
54
|
export declare function resolveFloatingWindowRect(options: ResolveFloatingWindowRectOptions): FloatingWindowRect;
|
|
40
55
|
export declare function normalizeFloatingWindowRect(options: NormalizeFloatingWindowRectOptions): FloatingWindowRect;
|
|
41
56
|
export {};
|
|
@@ -1,65 +1,97 @@
|
|
|
1
|
-
function
|
|
2
|
-
return Math.max(
|
|
1
|
+
function x(e, i, m) {
|
|
2
|
+
return Math.max(i, Math.min(m, e));
|
|
3
3
|
}
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
return { min:
|
|
4
|
+
function l(e, i, m) {
|
|
5
|
+
const s = Math.max(0, m), o = Math.min(e, s), c = Math.max(o, Math.min(i, s));
|
|
6
|
+
return { min: o, max: c };
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function z(e) {
|
|
9
|
+
const i = Number(e);
|
|
10
|
+
return Number.isFinite(i) && i > 0 ? i : 0;
|
|
11
|
+
}
|
|
12
|
+
function X(e, i = {}) {
|
|
13
|
+
const m = Math.max(0, e.width), s = Math.max(0, e.height), o = Math.min(z(i.left), m), c = Math.min(z(i.top), s), n = Math.min(z(i.right), Math.max(0, m - o)), d = Math.min(z(i.bottom), Math.max(0, s - c));
|
|
14
|
+
return {
|
|
15
|
+
x: o,
|
|
16
|
+
y: c,
|
|
17
|
+
width: Math.max(0, m - o - n),
|
|
18
|
+
height: Math.max(0, s - c - d)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function Y(e) {
|
|
22
|
+
return e.x + e.width;
|
|
23
|
+
}
|
|
24
|
+
function H(e) {
|
|
25
|
+
return e.y + e.height;
|
|
26
|
+
}
|
|
27
|
+
function I(e) {
|
|
9
28
|
const {
|
|
10
|
-
mode:
|
|
11
|
-
pointer:
|
|
12
|
-
dragStartPos:
|
|
13
|
-
dragStartRect:
|
|
14
|
-
resizeStartPos:
|
|
15
|
-
resizeStartRect:
|
|
16
|
-
resizeHandle:
|
|
17
|
-
minSize:
|
|
18
|
-
maxSize:
|
|
19
|
-
viewport:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
mode: i,
|
|
30
|
+
pointer: m,
|
|
31
|
+
dragStartPos: s,
|
|
32
|
+
dragStartRect: o,
|
|
33
|
+
resizeStartPos: c,
|
|
34
|
+
resizeStartRect: n,
|
|
35
|
+
resizeHandle: d,
|
|
36
|
+
minSize: r,
|
|
37
|
+
maxSize: t,
|
|
38
|
+
viewport: R,
|
|
39
|
+
viewportInsets: S,
|
|
40
|
+
mobile: y,
|
|
41
|
+
mobilePadding: f
|
|
42
|
+
} = e, a = X(R, S), g = Y(a), w = H(a), u = m.x - (i === "drag" ? s.x : c.x), p = m.y - (i === "drag" ? s.y : c.y);
|
|
43
|
+
if (i === "drag") {
|
|
44
|
+
const h = Math.max(a.x, g - o.width), M = Math.max(a.y, w - o.height);
|
|
24
45
|
return {
|
|
25
|
-
...
|
|
26
|
-
x: x ?
|
|
27
|
-
y:
|
|
46
|
+
...o,
|
|
47
|
+
x: x(y ? a.x + f : o.x + u, a.x, h),
|
|
48
|
+
y: x(o.y + p, a.y, M)
|
|
28
49
|
};
|
|
29
|
-
let u = i.width, f = i.height, y = i.x, b = i.y;
|
|
30
|
-
if (!x && m.includes("e") && (u = Math.max(g.width, Math.min(d.width, i.width + r))), !x && m.includes("w")) {
|
|
31
|
-
const c = i.width - r;
|
|
32
|
-
c >= g.width && c <= d.width && (u = c, y = i.x + r);
|
|
33
50
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
let b = n.width, v = n.height, W = n.x, F = n.y;
|
|
52
|
+
if (!y && d.includes("e")) {
|
|
53
|
+
const h = l(r.width, t.width, g - n.x);
|
|
54
|
+
b = x(n.width + u, h.min, h.max);
|
|
55
|
+
}
|
|
56
|
+
if (!y && d.includes("w")) {
|
|
57
|
+
const h = n.x + n.width, M = l(r.width, t.width, h - a.x), B = h - M.max, P = Math.max(B, h - M.min);
|
|
58
|
+
W = x(n.x + u, B, P), b = Math.max(0, h - W);
|
|
59
|
+
}
|
|
60
|
+
if (d.includes("s")) {
|
|
61
|
+
const h = l(r.height, t.height, w - n.y);
|
|
62
|
+
v = x(n.height + p, h.min, h.max);
|
|
63
|
+
}
|
|
64
|
+
if (d.includes("n")) {
|
|
65
|
+
const h = n.y + n.height, M = l(r.height, t.height, h - a.y), B = h - M.max, P = Math.max(B, h - M.min);
|
|
66
|
+
F = x(n.y + p, B, P), v = Math.max(0, h - F);
|
|
37
67
|
}
|
|
38
68
|
return {
|
|
39
|
-
x:
|
|
40
|
-
y:
|
|
41
|
-
width:
|
|
42
|
-
height:
|
|
69
|
+
x: x(W, a.x, Math.max(a.x, g - b)),
|
|
70
|
+
y: x(F, a.y, Math.max(a.y, w - v)),
|
|
71
|
+
width: b,
|
|
72
|
+
height: v
|
|
43
73
|
};
|
|
44
74
|
}
|
|
45
|
-
function
|
|
75
|
+
function V(e) {
|
|
46
76
|
const {
|
|
47
|
-
rect:
|
|
48
|
-
minSize:
|
|
49
|
-
maxSize:
|
|
50
|
-
viewport:
|
|
77
|
+
rect: i,
|
|
78
|
+
minSize: m,
|
|
79
|
+
maxSize: s,
|
|
80
|
+
viewport: o,
|
|
81
|
+
viewportInsets: c,
|
|
51
82
|
mobile: n,
|
|
52
|
-
mobilePadding:
|
|
53
|
-
center:
|
|
54
|
-
} = o,
|
|
83
|
+
mobilePadding: d,
|
|
84
|
+
center: r = !1
|
|
85
|
+
} = e, t = X(o, c), R = Y(t), S = H(t), y = n ? Math.max(0, t.width - d * 2) : t.width, f = l(m.width, s.width, y), a = l(m.height, s.height, t.height), g = n ? f.max : x(i.width, f.min, f.max), w = x(i.height, a.min, a.max), u = Math.max(t.x, R - g), p = Math.max(t.y, S - w);
|
|
55
86
|
return {
|
|
56
|
-
x: n ?
|
|
57
|
-
y:
|
|
58
|
-
width:
|
|
59
|
-
height:
|
|
87
|
+
x: n ? x(t.x + d, t.x, u) : r ? Math.max(t.x, Math.round(t.x + (t.width - g) / 2)) : x(i.x, t.x, u),
|
|
88
|
+
y: r ? Math.max(t.y, Math.round(t.y + (t.height - w) / 2)) : x(i.y, t.y, p),
|
|
89
|
+
width: g,
|
|
90
|
+
height: w
|
|
60
91
|
};
|
|
61
92
|
}
|
|
62
93
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
94
|
+
V as normalizeFloatingWindowRect,
|
|
95
|
+
I as resolveFloatingWindowRect,
|
|
96
|
+
X as resolveFloatingWindowViewport
|
|
65
97
|
};
|
|
@@ -3,6 +3,7 @@ export { Tag, type TagProps, type TagVariant, type TagSize } from './Tag';
|
|
|
3
3
|
export { Input, Textarea, NumberInput, AffixInput, type InputProps, type InputSize, type TextareaProps, type NumberInputProps, type AffixInputProps, type AffixOption, } from './Input';
|
|
4
4
|
export { Dialog, ConfirmDialog, type DialogProps, type ConfirmDialogProps } from './Dialog';
|
|
5
5
|
export { FloatingWindow, type FloatingWindowProps } from './FloatingWindow';
|
|
6
|
+
export { resolveFloatingWindowViewport, type FloatingWindowRect, type FloatingWindowViewport, type FloatingWindowViewportInsets, } from './floatingWindowGeometry';
|
|
6
7
|
export { Dropdown, Select, type DropdownProps, type DropdownItem, type SelectProps, } from './Dropdown';
|
|
7
8
|
export { SurfaceFloatingLayer, type SurfaceFloatingLayerPosition, type SurfaceFloatingLayerProps, type SurfaceFloatingLayerSize, } from './SurfaceFloatingLayer';
|
|
8
9
|
export { Tooltip, type TooltipProps } from './Tooltip';
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { type InfiniteCanvasContextMenuEvent } from '../../ui';
|
|
2
2
|
import { type ResolvedWorkbenchInteractionAdapter } from './workbenchInteractionAdapter';
|
|
3
|
-
import type
|
|
3
|
+
import { type WorkbenchAnnotationItem, type WorkbenchBackgroundLayer, type WorkbenchInteractionMode, type WorkbenchInteractionAdapter, type WorkbenchSelection, type WorkbenchStickyNoteItem, type WorkbenchTextAnnotationPatch, type WorkbenchViewport, type WorkbenchWidgetDefinition, type WorkbenchWidgetItem } from './types';
|
|
4
4
|
export interface WorkbenchCanvasProps {
|
|
5
5
|
widgetDefinitions: readonly WorkbenchWidgetDefinition[];
|
|
6
6
|
widgets: readonly WorkbenchWidgetItem[];
|
|
7
|
+
stickyNotes?: readonly WorkbenchStickyNoteItem[];
|
|
8
|
+
annotations?: readonly WorkbenchAnnotationItem[];
|
|
9
|
+
backgroundLayers?: readonly WorkbenchBackgroundLayer[];
|
|
7
10
|
viewport: WorkbenchViewport;
|
|
8
11
|
canvasFrameSize: {
|
|
9
12
|
width: number;
|
|
10
13
|
height: number;
|
|
11
14
|
};
|
|
12
15
|
selectedWidgetId: string | null;
|
|
16
|
+
selectedObject?: WorkbenchSelection | null;
|
|
17
|
+
mode?: WorkbenchInteractionMode;
|
|
13
18
|
optimisticFrontWidgetId: string | null;
|
|
14
19
|
locked: boolean;
|
|
15
|
-
filters: Record<
|
|
20
|
+
filters: Record<string, boolean>;
|
|
16
21
|
interactionAdapter?: WorkbenchInteractionAdapter | ResolvedWorkbenchInteractionAdapter;
|
|
17
22
|
setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
|
|
18
23
|
onViewportCommit: (viewport: WorkbenchViewport) => void;
|
|
@@ -31,6 +36,44 @@ export interface WorkbenchCanvasProps {
|
|
|
31
36
|
width: number;
|
|
32
37
|
height: number;
|
|
33
38
|
}) => void;
|
|
39
|
+
onSelectStickyNote?: (noteId: string) => void;
|
|
40
|
+
onStickyNoteContextMenu?: (event: MouseEvent, item: WorkbenchStickyNoteItem) => void;
|
|
41
|
+
onStartStickyOptimisticFront?: (noteId: string) => void;
|
|
42
|
+
onCommitStickyFront?: (noteId: string) => void;
|
|
43
|
+
onCommitStickyMove?: (noteId: string, position: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}) => void;
|
|
47
|
+
onCommitStickyResize?: (noteId: string, size: {
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}) => void;
|
|
51
|
+
onUpdateStickyNote?: (noteId: string, patch: Partial<Pick<WorkbenchStickyNoteItem, 'body' | 'color'>>) => void;
|
|
52
|
+
onDeleteStickyNote?: (noteId: string) => void;
|
|
53
|
+
onSelectAnnotation?: (annotationId: string) => void;
|
|
54
|
+
onAnnotationContextMenu?: (event: MouseEvent, item: WorkbenchAnnotationItem) => void;
|
|
55
|
+
onCommitAnnotationMove?: (annotationId: string, position: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}) => void;
|
|
59
|
+
onCommitAnnotationResize?: (annotationId: string, size: {
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
}) => void;
|
|
63
|
+
onUpdateTextAnnotation?: (annotationId: string, patch: WorkbenchTextAnnotationPatch) => void;
|
|
64
|
+
onDeleteAnnotation?: (annotationId: string) => void;
|
|
65
|
+
onSelectBackgroundLayer?: (layerId: string) => void;
|
|
66
|
+
onBackgroundLayerContextMenu?: (event: MouseEvent, item: WorkbenchBackgroundLayer) => void;
|
|
67
|
+
onCommitBackgroundMove?: (layerId: string, position: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
}) => void;
|
|
71
|
+
onCommitBackgroundResize?: (layerId: string, size: {
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
}) => void;
|
|
75
|
+
onUpdateBackgroundLayer?: (layerId: string, patch: Partial<Pick<WorkbenchBackgroundLayer, 'fill' | 'opacity' | 'material' | 'name'>>) => void;
|
|
76
|
+
onDeleteBackgroundLayer?: (layerId: string) => void;
|
|
34
77
|
onRequestOverview: (item: WorkbenchWidgetItem) => void;
|
|
35
78
|
onRequestFit: (item: WorkbenchWidgetItem) => void;
|
|
36
79
|
onRequestDelete: (widgetId: string) => void;
|