@floegence/floe-webapp-core 0.55.2 → 0.56.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.
@@ -3,6 +3,14 @@ export interface SurfaceAnchoredLayerProps {
3
3
  anchor: HTMLElement | undefined;
4
4
  /** Changes when the anchor moves through a transform; no idle polling is used. */
5
5
  revision?: unknown;
6
+ /** Screen-space clearance above labels outside the object bounds. */
7
+ topOffset?: number;
8
+ /** Preferred clearance for surface navigation; object visibility takes priority. */
9
+ reservedSpace?: {
10
+ top: number;
11
+ narrowTop?: number;
12
+ bottom: number;
13
+ };
6
14
  children: JSX.Element;
7
15
  class?: string;
8
16
  }
@@ -1,81 +1,93 @@
1
- import { createComponent as u, memo as L } from "solid-js/web";
2
- import { createSignal as c, createEffect as p, onMount as R, onCleanup as h, Show as S } from "solid-js";
3
- import { SurfaceFloatingLayer as A } from "./SurfaceFloatingLayer.js";
4
- import { resolveFloatingBoundary as C } from "./surfaceFloatingBoundary.js";
5
- import { resolveSurfacePortalHost as f } from "./dialogSurfaceScope.js";
6
- function W(n) {
7
- const [v, b] = c(!1), [w, g] = c({
1
+ import { createComponent as p, memo as k } from "solid-js/web";
2
+ import { createSignal as l, createEffect as z, onCleanup as g, onMount as T, Show as V } from "solid-js";
3
+ import { SurfaceFloatingLayer as $ } from "./SurfaceFloatingLayer.js";
4
+ import { resolveFloatingBoundary as j } from "./surfaceFloatingBoundary.js";
5
+ import { resolveSurfacePortalHost as E } from "./dialogSurfaceScope.js";
6
+ function N(n) {
7
+ const [O, R] = l(!1), [S, F] = l({
8
8
  x: 0,
9
9
  y: 0
10
- }), [y, d] = c(!1), [x, M] = c(480);
11
- let s, a;
12
- const E = () => {
13
- a = void 0;
14
- const r = n.anchor;
15
- if (!r || !s) return;
16
- const e = C(f({
17
- owner: r
10
+ }), [L, A] = l("above"), [x, y] = l(!1), [C, P] = l(480), [M, B] = l();
11
+ let d;
12
+ const Y = () => {
13
+ d = void 0;
14
+ const o = n.anchor, r = M();
15
+ if (!o || !r) return;
16
+ const t = j(E({
17
+ owner: o
18
18
  }));
19
- if (!e) {
20
- d(!1);
19
+ if (!t) {
20
+ y(!1);
21
21
  return;
22
22
  }
23
- const t = r.getBoundingClientRect(), i = Math.max(120, e.width - 24);
24
- M(i);
25
- const l = s.getBoundingClientRect(), z = Math.max(e.left + 12, Math.min(t.left, e.right - l.width - 12)), m = t.top - l.height - 12, F = m >= e.top + 12 ? m : Math.max(e.top + 12, Math.min(t.bottom + 12, e.bottom - l.height - 12));
26
- g({
27
- x: z,
28
- y: F
29
- }), d(t.right > e.left && t.left < e.right && t.bottom > e.top && t.top < e.bottom);
30
- }, o = () => {
31
- a === void 0 && typeof requestAnimationFrame == "function" && (a = requestAnimationFrame(E));
23
+ const e = o.getBoundingClientRect(), q = Math.max(120, t.width - 24);
24
+ P(q);
25
+ const a = r.getBoundingClientRect(), H = (Math.max(t.left, e.left) + Math.min(t.right, e.right)) / 2;
26
+ let f = Math.max(t.left + 12, Math.min(H - a.width / 2, t.right - a.width - 12));
27
+ const u = e.top - (n.topOffset ?? 0), m = u - a.height - 12, h = n.reservedSpace, v = t.top + (window.matchMedia("(max-width:760px)").matches ? h?.narrowTop ?? h?.top ?? 12 : h?.top ?? 12), b = Math.max(v, t.bottom - (h?.bottom ?? 12) - a.height), w = (W) => Math.max(v, Math.min(W, b));
28
+ let s = m, c = "above";
29
+ m < v ? e.bottom + 12 <= b ? (s = e.bottom + 12, c = "below") : m >= t.top + 12 ? c = "above" : e.bottom + a.height + 12 <= t.bottom - 12 ? (s = e.bottom + 12, c = "below") : e.right + a.width + 24 <= t.right ? (f = e.right + 12, s = w(u), c = "right") : e.left - a.width - 24 >= t.left ? (f = e.left - a.width - 12, s = w(u), c = "left") : (s = w(m), c = "edge") : s = Math.min(s, b), A(c), F({
30
+ x: Math.round(f),
31
+ y: Math.round(s)
32
+ }), y(e.right > t.left && e.left < t.right && e.bottom > t.top && e.top < t.bottom);
33
+ }, i = () => {
34
+ d === void 0 && typeof requestAnimationFrame == "function" && (d = requestAnimationFrame(Y));
32
35
  };
33
- return p(() => {
34
- n.anchor, n.revision, o();
35
- }), R(() => {
36
- b(!0);
37
- const r = typeof ResizeObserver == "function" ? new ResizeObserver(o) : void 0;
38
- s && r?.observe(s);
39
- const e = f({
36
+ return z(() => {
37
+ n.anchor, n.revision, n.topOffset, n.reservedSpace, i();
38
+ }), z(() => {
39
+ const o = M();
40
+ if (!o || typeof ResizeObserver > "u") return;
41
+ const r = new ResizeObserver(i);
42
+ r.observe(o), g(() => r.disconnect());
43
+ }), T(() => {
44
+ R(!0);
45
+ const o = typeof ResizeObserver == "function" ? new ResizeObserver(i) : void 0, r = E({
40
46
  owner: n.anchor
41
47
  }).boundaryHost;
42
- e && r?.observe(e);
43
- const t = new MutationObserver(o);
44
- let i = n.anchor?.parentElement;
45
- for (; i && (t.observe(i, {
48
+ r && o?.observe(r);
49
+ const t = new MutationObserver(i);
50
+ let e = n.anchor?.parentElement;
51
+ for (; e && (t.observe(e, {
46
52
  attributes: !0,
47
53
  attributeFilter: ["style"]
48
- }), i !== e); )
49
- i = i.parentElement;
50
- window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), o(), h(() => {
51
- r?.disconnect(), t.disconnect(), window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
54
+ }), e !== r); )
55
+ e = e.parentElement;
56
+ window.addEventListener("resize", i), window.addEventListener("scroll", i, !0), i(), g(() => {
57
+ o?.disconnect(), t.disconnect(), window.removeEventListener("resize", i), window.removeEventListener("scroll", i, !0);
52
58
  });
53
- }), h(() => {
54
- a !== void 0 && cancelAnimationFrame(a);
55
- }), u(S, {
59
+ }), g(() => {
60
+ d !== void 0 && cancelAnimationFrame(d);
61
+ }), p(V, {
56
62
  get when() {
57
- return L(() => !!v())() && n.anchor;
63
+ return k(() => !!O())() && n.anchor;
58
64
  },
59
65
  get children() {
60
- return u(A, {
66
+ return p($, {
61
67
  get owner() {
62
68
  return n.anchor;
63
69
  },
64
70
  get position() {
65
- return w();
71
+ return S();
66
72
  },
67
73
  get class() {
68
74
  return n.class;
69
75
  },
76
+ get "data-placement"() {
77
+ return L();
78
+ },
79
+ get inert() {
80
+ return !x();
81
+ },
70
82
  get style() {
71
83
  return {
72
- visibility: y() ? "visible" : "hidden",
73
- "max-width": `${x()}px`,
84
+ visibility: x() ? "visible" : "hidden",
85
+ "max-width": `${C()}px`,
74
86
  "z-index": 60
75
87
  };
76
88
  },
77
- layerRef: (r) => {
78
- s = r, o();
89
+ layerRef: (o) => {
90
+ B(o), i();
79
91
  },
80
92
  get children() {
81
93
  return n.children;
@@ -85,5 +97,5 @@ function W(n) {
85
97
  });
86
98
  }
87
99
  export {
88
- W as SurfaceAnchoredLayer
100
+ N as SurfaceAnchoredLayer
89
101
  };
@@ -52,7 +52,7 @@ export interface WorkbenchCanvasProps {
52
52
  width: number;
53
53
  height: number;
54
54
  }) => void;
55
- onUpdateStickyNote?: (noteId: string, patch: Partial<Pick<WorkbenchStickyNoteItem, 'body' | 'color' | 'material'>>) => void;
55
+ onUpdateStickyNote?: (noteId: string, patch: Partial<Pick<WorkbenchStickyNoteItem, 'title' | 'body' | 'color' | 'material'>>) => void;
56
56
  onDeleteStickyNote?: (noteId: string) => void;
57
57
  onSelectAnnotation?: (annotationId: string) => void;
58
58
  onAnnotationContextMenu?: (event: MouseEvent, item: WorkbenchAnnotationItem) => void;