@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.
Files changed (37) hide show
  1. package/dist/components/icons/index.d.ts +2 -0
  2. package/dist/components/icons/index.js +419 -397
  3. package/dist/components/ui/FloatingWindow.d.ts +3 -0
  4. package/dist/components/ui/FloatingWindow.js +181 -181
  5. package/dist/components/ui/floatingWindowGeometry.d.ts +15 -0
  6. package/dist/components/ui/floatingWindowGeometry.js +80 -48
  7. package/dist/components/ui/index.d.ts +1 -0
  8. package/dist/components/workbench/WorkbenchCanvas.d.ts +45 -2
  9. package/dist/components/workbench/WorkbenchCanvas.js +265 -66
  10. package/dist/components/workbench/WorkbenchCanvasField.d.ts +47 -2
  11. package/dist/components/workbench/WorkbenchCanvasField.js +258 -78
  12. package/dist/components/workbench/WorkbenchFilterBar.d.ts +9 -7
  13. package/dist/components/workbench/WorkbenchFilterBar.js +233 -145
  14. package/dist/components/workbench/WorkbenchLayerObjects.d.ts +136 -0
  15. package/dist/components/workbench/WorkbenchLayerObjects.js +986 -0
  16. package/dist/components/workbench/WorkbenchOverlay.d.ts +4 -1
  17. package/dist/components/workbench/WorkbenchOverlay.js +59 -29
  18. package/dist/components/workbench/WorkbenchSurface.d.ts +23 -11
  19. package/dist/components/workbench/WorkbenchSurface.js +315 -195
  20. package/dist/components/workbench/WorkbenchWidget.js +37 -37
  21. package/dist/components/workbench/index.d.ts +2 -1
  22. package/dist/components/workbench/types.d.ts +96 -1
  23. package/dist/components/workbench/types.js +12 -4
  24. package/dist/components/workbench/useWorkbenchModel.d.ts +62 -4
  25. package/dist/components/workbench/useWorkbenchModel.js +790 -253
  26. package/dist/components/workbench/widgets/widgetRegistry.d.ts +1 -1
  27. package/dist/components/workbench/workbenchHelpers.d.ts +5 -5
  28. package/dist/components/workbench/workbenchHelpers.js +345 -154
  29. package/dist/components/workbench/workbenchOptions.d.ts +43 -0
  30. package/dist/components/workbench/workbenchOptions.js +112 -0
  31. package/dist/full.js +620 -616
  32. package/dist/icons.js +71 -69
  33. package/dist/styles.css +1 -1
  34. package/dist/ui.js +42 -40
  35. package/dist/workbench.css +1117 -26
  36. package/dist/workbench.js +52 -36
  37. 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 l(o, h, e) {
2
- return Math.max(h, Math.min(e, o));
1
+ function x(e, i, m) {
2
+ return Math.max(i, Math.min(m, e));
3
3
  }
4
- function z(o, h, e) {
5
- const a = Math.max(0, e), t = Math.min(o, a), n = Math.max(t, Math.min(h, a));
6
- return { min: t, max: n };
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 S(o) {
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: h,
11
- pointer: e,
12
- dragStartPos: a,
13
- dragStartRect: t,
14
- resizeStartPos: n,
15
- resizeStartRect: i,
16
- resizeHandle: m,
17
- minSize: g,
18
- maxSize: d,
19
- viewport: s,
20
- mobile: x,
21
- mobilePadding: M
22
- } = o, r = e.x - (h === "drag" ? a.x : n.x), w = e.y - (h === "drag" ? a.y : n.y);
23
- if (h === "drag")
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
- ...t,
26
- x: x ? M : Math.max(0, Math.min(s.width - t.width, t.x + r)),
27
- y: Math.max(0, Math.min(s.height - t.height, t.y + w))
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
- if (m.includes("s") && (f = Math.max(g.height, Math.min(d.height, i.height + w))), m.includes("n")) {
35
- const c = i.height - w;
36
- c >= g.height && c <= d.height && (f = c, b = i.y + w);
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: Math.max(0, Math.min(s.width - u, y)),
40
- y: Math.max(0, Math.min(s.height - f, b)),
41
- width: u,
42
- height: f
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 p(o) {
75
+ function V(e) {
46
76
  const {
47
- rect: h,
48
- minSize: e,
49
- maxSize: a,
50
- viewport: t,
77
+ rect: i,
78
+ minSize: m,
79
+ maxSize: s,
80
+ viewport: o,
81
+ viewportInsets: c,
51
82
  mobile: n,
52
- mobilePadding: i,
53
- center: m = !1
54
- } = o, g = n ? Math.max(0, t.width - i * 2) : t.width, d = z(e.width, a.width, g), s = z(e.height, a.height, t.height), x = n ? d.max : l(h.width, d.min, d.max), M = l(h.height, s.min, s.max), r = Math.max(0, t.width - x), w = Math.max(0, t.height - M);
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 ? l(i, 0, r) : m ? Math.max(0, Math.round((t.width - x) / 2)) : l(h.x, 0, r),
57
- y: m ? Math.max(0, Math.round((t.height - M) / 2)) : l(h.y, 0, w),
58
- width: x,
59
- height: M
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
- p as normalizeFloatingWindowRect,
64
- S as resolveFloatingWindowRect
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 { WorkbenchInteractionAdapter, WorkbenchViewport, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
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<WorkbenchWidgetType, boolean>;
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;