@floegence/floe-webapp-core 0.101.30 → 0.101.34

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.
@@ -1,65 +1,66 @@
1
- const E = "data-floe-dialog-surface-host", H = E, b = "data-floe-surface-portal-layer", I = "data-floe-surface-floating-layer", B = "data-floe-dialog-surface-boundary", v = 1600;
1
+ import { composedEventTarget as a, composedClosest as R, deepActiveElement as A } from "../../utils/domScope.js";
2
+ const S = "data-floe-dialog-surface-host", M = S, L = "data-floe-surface-portal-layer", D = "data-floe-surface-floating-layer", N = "data-floe-dialog-surface-boundary", _ = 1600;
2
3
  let l = null, i = null;
3
- function A(t) {
4
+ function x(t) {
4
5
  return typeof Element < "u" && t instanceof Element ? t : typeof Node < "u" && t instanceof Node ? t.parentElement : null;
5
6
  }
6
- function L(t) {
7
- const e = t?.activeElement;
7
+ function C(t) {
8
+ const e = t ? A(t) : null;
8
9
  return e instanceof Element ? e : null;
9
10
  }
10
- function a(t) {
11
+ function s(t) {
11
12
  const e = typeof document < "u" ? document : null;
12
13
  l = {
13
- target: A(t),
14
- activeElement: L(e),
14
+ target: x(t),
15
+ activeElement: C(e),
15
16
  recordedAt: Date.now()
16
17
  };
17
18
  }
18
- function p(t) {
19
- a(t.target);
20
- }
21
19
  function y(t) {
22
- a(t.target);
20
+ s(a(t));
23
21
  }
24
22
  function T(t) {
25
- a(t.target);
23
+ s(a(t));
26
24
  }
27
- function R() {
28
- _();
25
+ function w(t) {
26
+ s(a(t));
29
27
  }
30
- function _() {
31
- typeof document > "u" || i !== document && (i && (i.removeEventListener("pointerdown", p, !0), i.removeEventListener("focusin", y, !0), i.removeEventListener("contextmenu", T, !0)), document.addEventListener("pointerdown", p, !0), document.addEventListener("focusin", y, !0), document.addEventListener("contextmenu", T, !0), i = document);
28
+ function b() {
29
+ P();
32
30
  }
33
- function x() {
34
- return !l || Date.now() - l.recordedAt > v ? null : l;
31
+ function P() {
32
+ typeof document > "u" || i !== document && (i && (i.removeEventListener("pointerdown", y, !0), i.removeEventListener("focusin", T, !0), i.removeEventListener("contextmenu", w, !0)), document.addEventListener("pointerdown", y, !0), document.addEventListener("focusin", T, !0), document.addEventListener("contextmenu", w, !0), i = document);
33
+ }
34
+ function F() {
35
+ return !l || Date.now() - l.recordedAt > _ ? null : l;
35
36
  }
36
37
  function f(t) {
37
- const e = t?.closest(`[${E}="true"]`);
38
+ const e = R(t, `[${S}="true"]`);
38
39
  return typeof HTMLElement > "u" ? null : e instanceof HTMLElement ? e : null;
39
40
  }
40
- function C(t) {
41
+ function H(t) {
41
42
  if (!t) return null;
42
- const e = t.closest(`[${b}="true"]`);
43
+ const e = R(t, `[${L}="true"]`);
43
44
  return typeof HTMLElement > "u" ? null : e instanceof HTMLElement ? e : null;
44
45
  }
45
- function O(t = {}) {
46
- R();
47
- const e = x(), n = t.owner ? f(t.owner) : f(e?.target ?? null) ?? f(e?.activeElement ?? null);
46
+ function U(t = {}) {
47
+ b();
48
+ const e = F(), n = t.owner ? f(t.owner) : f(e?.target ?? null) ?? f(e?.activeElement ?? null);
48
49
  return n ? {
49
50
  host: n,
50
51
  boundaryHost: n,
51
- mountHost: C(n) ?? n,
52
+ mountHost: H(n) ?? n,
52
53
  mode: "surface"
53
54
  } : { host: null, boundaryHost: null, mountHost: null, mode: "global" };
54
55
  }
55
- function c(t) {
56
+ function d(t) {
56
57
  return t.mode === "surface" && !!t.boundaryHost?.isConnected;
57
58
  }
58
- function s(t) {
59
- if (c(t))
59
+ function h(t) {
60
+ if (d(t))
60
61
  return t.mountHost ?? t.boundaryHost ?? void 0;
61
62
  }
62
- function S() {
63
+ function v() {
63
64
  return typeof window > "u" ? {
64
65
  left: 0,
65
66
  top: 0,
@@ -76,9 +77,9 @@ function S() {
76
77
  height: window.innerHeight
77
78
  };
78
79
  }
79
- function M(t) {
80
- if (!c(t) || !t.boundaryHost)
81
- return S();
80
+ function W(t) {
81
+ if (!d(t) || !t.boundaryHost)
82
+ return v();
82
83
  const e = t.boundaryHost.getBoundingClientRect();
83
84
  return {
84
85
  left: e.left,
@@ -89,10 +90,10 @@ function M(t) {
89
90
  height: e.height
90
91
  };
91
92
  }
92
- function P(t) {
93
- const e = s(t);
93
+ function I(t) {
94
+ const e = h(t);
94
95
  if (!e)
95
- return S();
96
+ return v();
96
97
  const n = e.getBoundingClientRect();
97
98
  return {
98
99
  left: n.left,
@@ -103,31 +104,31 @@ function P(t) {
103
104
  height: n.height
104
105
  };
105
106
  }
106
- function F(t) {
107
- const e = s(t);
107
+ function B(t) {
108
+ const e = h(t);
108
109
  if (!e) return { x: 1, y: 1 };
109
- const n = e.getBoundingClientRect(), o = getComputedStyle(e), r = (u) => Number.parseFloat(u) || 0, h = (u) => {
110
- const d = r(o[u]);
111
- return d ? o.boxSizing === "border-box" ? d : d + (u === "width" ? r(o.paddingLeft) + r(o.paddingRight) + r(o.borderLeftWidth) + r(o.borderRightWidth) : r(o.paddingTop) + r(o.paddingBottom) + r(o.borderTopWidth) + r(o.borderBottomWidth)) : u === "width" ? e.offsetWidth : e.offsetHeight;
112
- }, m = h("width"), g = h("height");
110
+ const n = e.getBoundingClientRect(), o = getComputedStyle(e), r = (u) => Number.parseFloat(u) || 0, m = (u) => {
111
+ const c = r(o[u]);
112
+ return c ? o.boxSizing === "border-box" ? c : c + (u === "width" ? r(o.paddingLeft) + r(o.paddingRight) + r(o.borderLeftWidth) + r(o.borderRightWidth) : r(o.paddingTop) + r(o.paddingBottom) + r(o.borderTopWidth) + r(o.borderBottomWidth)) : u === "width" ? e.offsetWidth : e.offsetHeight;
113
+ }, p = m("width"), g = m("height");
113
114
  return {
114
- x: m > 0 && n.width > 0 ? n.width / m : 1,
115
+ x: p > 0 && n.width > 0 ? n.width / p : 1,
115
116
  y: g > 0 && n.height > 0 ? n.height / g : 1
116
117
  };
117
118
  }
118
- function w(t, e) {
119
- if (!c(e))
119
+ function E(t, e) {
120
+ if (!d(e))
120
121
  return t;
121
- const n = s(e), o = P(e), r = F(e);
122
+ const n = h(e), o = I(e), r = B(e);
122
123
  return {
123
124
  x: (t.x - o.left) / r.x - n.clientLeft + n.scrollLeft,
124
125
  y: (t.y - o.top) / r.y - n.clientTop + n.scrollTop
125
126
  };
126
127
  }
127
- function D(t, e) {
128
- if (!c(e))
128
+ function k(t, e) {
129
+ if (!d(e))
129
130
  return t;
130
- const n = w({ x: t.left, y: t.top }, e), o = w({ x: t.right, y: t.bottom }, e);
131
+ const n = E({ x: t.left, y: t.top }, e), o = E({ x: t.right, y: t.bottom }, e);
131
132
  return {
132
133
  left: n.x,
133
134
  top: n.y,
@@ -137,26 +138,26 @@ function D(t, e) {
137
138
  height: o.y - n.y
138
139
  };
139
140
  }
140
- function N() {
141
+ function G() {
141
142
  l = null;
142
143
  }
143
- typeof document < "u" && R();
144
+ typeof document < "u" && b();
144
145
  export {
145
- B as DIALOG_SURFACE_BOUNDARY_ATTR,
146
- E as DIALOG_SURFACE_HOST_ATTR,
147
- I as SURFACE_FLOATING_LAYER_ATTR,
148
- H as SURFACE_PORTAL_HOST_ATTR,
149
- b as SURFACE_PORTAL_LAYER_ATTR,
150
- N as __resetSurfacePortalScopeForTests,
151
- R as ensureDialogSurfaceInteractionTracking,
152
- _ as ensureSurfacePortalInteractionTracking,
153
- c as isSurfacePortalMode,
154
- w as projectSurfacePortalPosition,
155
- D as projectSurfacePortalRect,
156
- x as readFreshInteractionSnapshot,
157
- M as resolveSurfacePortalBoundaryRect,
158
- O as resolveSurfacePortalHost,
159
- s as resolveSurfacePortalMount,
160
- P as resolveSurfacePortalMountRect,
161
- F as resolveSurfacePortalScale
146
+ N as DIALOG_SURFACE_BOUNDARY_ATTR,
147
+ S as DIALOG_SURFACE_HOST_ATTR,
148
+ D as SURFACE_FLOATING_LAYER_ATTR,
149
+ M as SURFACE_PORTAL_HOST_ATTR,
150
+ L as SURFACE_PORTAL_LAYER_ATTR,
151
+ G as __resetSurfacePortalScopeForTests,
152
+ b as ensureDialogSurfaceInteractionTracking,
153
+ P as ensureSurfacePortalInteractionTracking,
154
+ d as isSurfacePortalMode,
155
+ E as projectSurfacePortalPosition,
156
+ k as projectSurfacePortalRect,
157
+ F as readFreshInteractionSnapshot,
158
+ W as resolveSurfacePortalBoundaryRect,
159
+ U as resolveSurfacePortalHost,
160
+ h as resolveSurfacePortalMount,
161
+ I as resolveSurfacePortalMountRect,
162
+ B as resolveSurfacePortalScale
162
163
  };