@floegence/floe-webapp-core 0.36.26 → 0.36.28

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.
@@ -0,0 +1,22 @@
1
+ import { type JSX } from 'solid-js';
2
+ export type SurfaceFloatingLayerPosition = Readonly<{
3
+ x: number;
4
+ y: number;
5
+ }>;
6
+ export type SurfaceFloatingLayerSize = Readonly<{
7
+ width: number;
8
+ height: number;
9
+ }>;
10
+ export interface SurfaceFloatingLayerProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'style' | 'ref'> {
11
+ position: SurfaceFloatingLayerPosition;
12
+ estimatedSize?: SurfaceFloatingLayerSize;
13
+ clamp?: boolean;
14
+ class?: string;
15
+ style?: JSX.CSSProperties;
16
+ children: JSX.Element;
17
+ layerRef?: (element: HTMLDivElement) => void;
18
+ }
19
+ /**
20
+ * Surface-aware floating layer for point-anchored overlays such as context menus.
21
+ */
22
+ export declare function SurfaceFloatingLayer(props: SurfaceFloatingLayerProps): JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { createComponent as m, Portal as d, use as y, spread as S, mergeProps as P, insert as v, template as R } from "solid-js/web";
2
+ import { splitProps as g, createMemo as i } from "solid-js";
3
+ import { cn as h } from "../../utils/cn.js";
4
+ import { LOCAL_INTERACTION_SURFACE_ATTR as z } from "./localInteractionSurface.js";
5
+ import { clampMenuPosition as _ } from "./menuUtils.js";
6
+ import { resolveSurfacePortalHost as x, resolveSurfacePortalMount as C, resolveSurfacePortalBoundaryRect as M, isSurfacePortalMode as $, projectSurfacePortalPosition as A } from "./dialogSurfaceScope.js";
7
+ var T = /* @__PURE__ */ R("<div>");
8
+ function b() {
9
+ return {
10
+ left: 0,
11
+ top: 0,
12
+ right: 0,
13
+ bottom: 0,
14
+ width: 0,
15
+ height: 0
16
+ };
17
+ }
18
+ function I(n) {
19
+ const [e, l] = g(n, ["position", "estimatedSize", "clamp", "class", "style", "children", "layerRef"]), o = i(() => x()), r = () => $(o()), c = () => M(o()) ?? b(), u = () => e.clamp !== !1 && !!e.estimatedSize, p = i(() => {
20
+ const t = e.position;
21
+ return !u() || !e.estimatedSize ? t : _(t, e.estimatedSize, c());
22
+ }), s = () => A(p(), o()), f = () => ({
23
+ ...e.style ?? {},
24
+ left: `${s().x}px`,
25
+ top: `${s().y}px`
26
+ });
27
+ return m(d, {
28
+ get mount() {
29
+ return C(o());
30
+ },
31
+ get children() {
32
+ var t = T(), a = e.layerRef;
33
+ return typeof a == "function" ? y(a, t) : e.layerRef = t, S(t, P(l, {
34
+ get class() {
35
+ return h(r() ? "absolute z-20" : "fixed z-50", e.class);
36
+ },
37
+ get style() {
38
+ return f();
39
+ }
40
+ }, () => ({
41
+ [z]: r() ? "true" : void 0
42
+ })), !1, !0), v(t, () => e.children), t;
43
+ }
44
+ });
45
+ }
46
+ export {
47
+ I as SurfaceFloatingLayer
48
+ };
@@ -1,62 +1,65 @@
1
- const f = "data-floe-dialog-surface-host", y = f, m = "data-floe-surface-portal-layer", A = "data-floe-dialog-surface-boundary", p = 1600;
1
+ const a = "data-floe-dialog-surface-host", y = a, p = "data-floe-surface-portal-layer", A = "data-floe-dialog-surface-boundary", g = 1600;
2
2
  let r = null, o = null;
3
- function g(t) {
3
+ function E(t) {
4
4
  return typeof Element < "u" && t instanceof Element ? t : typeof Node < "u" && t instanceof Node ? t.parentElement : null;
5
5
  }
6
- function E(t) {
6
+ function T(t) {
7
7
  const e = t?.activeElement;
8
8
  return e instanceof Element ? e : null;
9
9
  }
10
- function d(t) {
10
+ function i(t) {
11
11
  const e = typeof document < "u" ? document : null;
12
12
  r = {
13
- target: g(t),
14
- activeElement: E(e),
13
+ target: E(t),
14
+ activeElement: T(e),
15
15
  recordedAt: Date.now()
16
16
  };
17
17
  }
18
- function i(t) {
19
- d(t.target);
20
- }
21
18
  function l(t) {
22
- d(t.target);
19
+ i(t.target);
23
20
  }
24
- function a() {
25
- T();
21
+ function c(t) {
22
+ i(t.target);
26
23
  }
27
- function T() {
28
- typeof document > "u" || o !== document && (o && (o.removeEventListener("pointerdown", i, !0), o.removeEventListener("focusin", l, !0)), document.addEventListener("pointerdown", i, !0), document.addEventListener("focusin", l, !0), o = document);
24
+ function d(t) {
25
+ i(t.target);
26
+ }
27
+ function s() {
28
+ w();
29
29
  }
30
30
  function w() {
31
- return !r || Date.now() - r.recordedAt > p ? null : r;
31
+ typeof document > "u" || o !== document && (o && (o.removeEventListener("pointerdown", l, !0), o.removeEventListener("focusin", c, !0), o.removeEventListener("contextmenu", d, !0)), document.addEventListener("pointerdown", l, !0), document.addEventListener("focusin", c, !0), document.addEventListener("contextmenu", d, !0), o = document);
32
32
  }
33
- function c(t) {
34
- const e = t?.closest(`[${f}="true"]`);
33
+ function R() {
34
+ return !r || Date.now() - r.recordedAt > g ? null : r;
35
+ }
36
+ function f(t) {
37
+ const e = t?.closest(`[${a}="true"]`);
35
38
  return typeof HTMLElement > "u" ? null : e instanceof HTMLElement && e.isConnected ? e : null;
36
39
  }
37
- function R(t) {
40
+ function S(t) {
38
41
  if (!t) return null;
39
- const e = t.closest(`[${m}="true"]`);
42
+ const e = t.closest(`[${p}="true"]`);
40
43
  return typeof HTMLElement > "u" ? null : e instanceof HTMLElement && e.isConnected ? e : null;
41
44
  }
42
- function v() {
43
- a();
44
- const t = w(), e = c(t?.target ?? null) ?? c(t?.activeElement ?? null);
45
+ function L() {
46
+ s();
47
+ const t = R(), e = f(t?.target ?? null) ?? f(t?.activeElement ?? null);
45
48
  return e ? {
46
49
  host: e,
47
50
  boundaryHost: e,
48
- mountHost: R(e) ?? e,
51
+ mountHost: S(e) ?? e,
49
52
  mode: "surface"
50
53
  } : { host: null, boundaryHost: null, mountHost: null, mode: "global" };
51
54
  }
52
55
  function u(t) {
53
56
  return t.mode === "surface" && !!t.boundaryHost?.isConnected;
54
57
  }
55
- function S(t) {
58
+ function v(t) {
56
59
  if (u(t))
57
60
  return t.mountHost ?? t.boundaryHost ?? void 0;
58
61
  }
59
- function s() {
62
+ function m() {
60
63
  return typeof window > "u" ? {
61
64
  left: 0,
62
65
  top: 0,
@@ -75,7 +78,7 @@ function s() {
75
78
  }
76
79
  function _(t) {
77
80
  if (!u(t) || !t.boundaryHost)
78
- return s();
81
+ return m();
79
82
  const e = t.boundaryHost.getBoundingClientRect();
80
83
  return {
81
84
  left: e.left,
@@ -87,9 +90,9 @@ function _(t) {
87
90
  };
88
91
  }
89
92
  function h(t) {
90
- const e = S(t);
93
+ const e = v(t);
91
94
  if (!e)
92
- return s();
95
+ return m();
93
96
  const n = e.getBoundingClientRect();
94
97
  return {
95
98
  left: n.left,
@@ -109,7 +112,7 @@ function b(t, e) {
109
112
  y: t.y - n.top
110
113
  };
111
114
  }
112
- function L(t, e) {
115
+ function C(t, e) {
113
116
  if (!u(e))
114
117
  return t;
115
118
  const n = h(e);
@@ -125,20 +128,20 @@ function L(t, e) {
125
128
  function P() {
126
129
  r = null;
127
130
  }
128
- typeof document < "u" && a();
131
+ typeof document < "u" && s();
129
132
  export {
130
133
  A as DIALOG_SURFACE_BOUNDARY_ATTR,
131
- f as DIALOG_SURFACE_HOST_ATTR,
134
+ a as DIALOG_SURFACE_HOST_ATTR,
132
135
  y as SURFACE_PORTAL_HOST_ATTR,
133
- m as SURFACE_PORTAL_LAYER_ATTR,
136
+ p as SURFACE_PORTAL_LAYER_ATTR,
134
137
  P as __resetSurfacePortalScopeForTests,
135
- a as ensureDialogSurfaceInteractionTracking,
136
- T as ensureSurfacePortalInteractionTracking,
138
+ s as ensureDialogSurfaceInteractionTracking,
139
+ w as ensureSurfacePortalInteractionTracking,
137
140
  u as isSurfacePortalMode,
138
141
  b as projectSurfacePortalPosition,
139
- L as projectSurfacePortalRect,
142
+ C as projectSurfacePortalRect,
140
143
  _ as resolveSurfacePortalBoundaryRect,
141
- v as resolveSurfacePortalHost,
142
- S as resolveSurfacePortalMount,
144
+ L as resolveSurfacePortalHost,
145
+ v as resolveSurfacePortalMount,
143
146
  h as resolveSurfacePortalMountRect
144
147
  };
@@ -4,6 +4,7 @@ export { Input, Textarea, NumberInput, AffixInput, type InputProps, type InputSi
4
4
  export { Dialog, ConfirmDialog, type DialogProps, type ConfirmDialogProps } from './Dialog';
5
5
  export { FloatingWindow, type FloatingWindowProps } from './FloatingWindow';
6
6
  export { Dropdown, Select, type DropdownProps, type DropdownItem, type SelectProps, } from './Dropdown';
7
+ export { SurfaceFloatingLayer, type SurfaceFloatingLayerPosition, type SurfaceFloatingLayerProps, type SurfaceFloatingLayerSize, } from './SurfaceFloatingLayer';
7
8
  export { Tooltip, type TooltipProps } from './Tooltip';
8
9
  export { CommandPalette } from './CommandPalette';
9
10
  export { InfiniteCanvas, type InfiniteCanvasProps, type InfiniteCanvasPoint, type InfiniteCanvasContextMenuEvent, } from './InfiniteCanvas';
@@ -1,49 +1,49 @@
1
- import { spread as d, mergeProps as v, insert as a, createComponent as s, addEventListener as f, effect as b, className as _, template as c, delegateEvents as p } from "solid-js/web";
2
- import { For as h } from "solid-js";
3
- import { cn as x } from "../../utils/cn.js";
4
- import { WORKBENCH_CONTEXT_MENU_ATTR as k } from "./workbenchContextMenuDismiss.js";
5
- var w = /* @__PURE__ */ c("<div role=menu class=workbench-context-menu data-floe-workbench-boundary=true>"), C = /* @__PURE__ */ c("<div role=separator aria-orientation=horizontal class=workbench-context-menu__separator>"), $ = /* @__PURE__ */ c("<button type=button role=menuitem><span class=workbench-context-menu__label>");
6
- function E(r) {
7
- return r.kind === "action";
1
+ import { spread as _, mergeProps as b, insert as c, createComponent as u, addEventListener as v, effect as f, className as p, template as a, delegateEvents as h } from "solid-js/web";
2
+ import { For as x } from "solid-js";
3
+ import { cn as k } from "../../utils/cn.js";
4
+ import { WORKBENCH_CONTEXT_MENU_ATTR as w } from "./workbenchContextMenuDismiss.js";
5
+ var $ = /* @__PURE__ */ a("<div role=menu class=workbench-context-menu data-floe-workbench-boundary=true>"), g = /* @__PURE__ */ a("<div role=separator aria-orientation=horizontal class=workbench-context-menu__separator>"), C = /* @__PURE__ */ a("<button type=button role=menuitem><span class=workbench-context-menu__icon aria-hidden=true></span><span class=workbench-context-menu__label>");
6
+ function E(t) {
7
+ return t.kind === "action";
8
8
  }
9
- function M(r) {
9
+ function A(t) {
10
10
  return (() => {
11
- var o = w();
12
- return d(o, v({
13
- [k]: "true"
11
+ var o = $();
12
+ return _(o, b({
13
+ [w]: "true"
14
14
  }, {
15
15
  get style() {
16
16
  return {
17
- left: `${r.x}px`,
18
- top: `${r.y}px`
17
+ left: `${t.x}px`,
18
+ top: `${t.y}px`
19
19
  };
20
20
  },
21
21
  onContextMenu: (e) => e.preventDefault()
22
- }), !1, !0), a(o, s(h, {
22
+ }), !1, !0), c(o, u(x, {
23
23
  get each() {
24
- return r.items;
24
+ return t.items;
25
25
  },
26
26
  children: (e) => {
27
27
  if (!E(e))
28
- return C();
28
+ return g();
29
29
  const m = e.icon;
30
30
  return (() => {
31
- var t = $(), l = t.firstChild;
32
- return f(t, "click", e.onSelect, !0), a(t, s(m, {
33
- class: "h-3.5 w-3.5"
34
- }), l), a(l, () => e.label), b((n) => {
35
- var i = x("workbench-context-menu__item", e.destructive && "is-destructive"), u = e.disabled;
36
- return i !== n.e && _(t, n.e = i), u !== n.t && (t.disabled = n.t = u), n;
31
+ var n = C(), i = n.firstChild, d = i.nextSibling;
32
+ return v(n, "click", e.onSelect, !0), c(i, u(m, {
33
+ class: "workbench-context-menu__icon-svg"
34
+ })), c(d, () => e.label), f((r) => {
35
+ var l = k("workbench-context-menu__item", e.destructive && "is-destructive"), s = e.disabled;
36
+ return l !== r.e && p(n, r.e = l), s !== r.t && (n.disabled = r.t = s), r;
37
37
  }, {
38
38
  e: void 0,
39
39
  t: void 0
40
- }), t;
40
+ }), n;
41
41
  })();
42
42
  }
43
43
  })), o;
44
44
  })();
45
45
  }
46
- p(["click"]);
46
+ h(["click"]);
47
47
  export {
48
- M as WorkbenchContextMenu
48
+ A as WorkbenchContextMenu
49
49
  };