@floegence/floe-webapp-core 0.97.3 → 0.99.1
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/editor/CodeEditor.js +30 -29
- package/dist/components/editor/monacoHover.d.ts +1 -0
- package/dist/components/editor/monacoHover.js +32 -0
- package/dist/components/ui/ContextMenuActions.d.ts +2 -0
- package/dist/components/ui/ContextMenuActions.js +111 -103
- package/dist/components/ui/RetainedPanel.js +1 -0
- package/dist/components/ui/SurfaceFloatingLayer.d.ts +2 -0
- package/dist/components/ui/SurfaceFloatingLayer.js +13 -13
- package/dist/components/ui/TextSearchBar.d.ts +13 -0
- package/dist/components/ui/TextSearchBar.js +39 -0
- package/dist/components/ui/textSearch.d.ts +23 -0
- package/dist/components/ui/textSearch.js +113 -0
- package/dist/editor.css +7 -0
- package/dist/floe.css +2 -0
- package/dist/full.js +971 -966
- package/dist/styles.css +1 -1
- package/dist/text-search.css +7 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.js +243 -238
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { effect as V, className as q, style as U, template as
|
|
2
|
-
import { useContextMenuActions as
|
|
3
|
-
import { onMount as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { useResizeObserver as
|
|
6
|
-
import { resolveCodeEditorLanguageSpec as
|
|
7
|
-
import { applyFloeMonacoTheme as
|
|
1
|
+
import { effect as V, className as q, style as U, template as $, use as k } from "solid-js/web";
|
|
2
|
+
import { useContextMenuActions as B } from "../ui/ContextMenuActions.js";
|
|
3
|
+
import { onMount as N, onCleanup as P, createEffect as M } from "solid-js";
|
|
4
|
+
import { useTheme as _ } from "../../context/ThemeContext.js";
|
|
5
|
+
import { useResizeObserver as H } from "../../hooks/useResizeObserver.js";
|
|
6
|
+
import { resolveCodeEditorLanguageSpec as K } from "./languages.js";
|
|
7
|
+
import { applyFloeMonacoTheme as G } from "./monacoTheme.js";
|
|
8
8
|
import { ensureMonacoEnvironment as X } from "./monacoEnvironment.js";
|
|
9
9
|
import { loadMonacoEditorApi as Y } from "./monacoStandaloneRuntime.js";
|
|
10
|
-
|
|
10
|
+
import { ensureFloeMonacoHover as j } from "./monacoHover.js";
|
|
11
|
+
var J = /* @__PURE__ */ $("<div>");
|
|
11
12
|
const A = {
|
|
12
13
|
readOnly: !0,
|
|
13
14
|
automaticLayout: !1,
|
|
@@ -20,8 +21,8 @@ const A = {
|
|
|
20
21
|
tabSize: 2,
|
|
21
22
|
fontFamily: "var(--font-mono)"
|
|
22
23
|
};
|
|
23
|
-
let
|
|
24
|
-
function
|
|
24
|
+
let Q = 0;
|
|
25
|
+
function W(t, f, c) {
|
|
25
26
|
return t.Uri.parse(`inmemory://model/${f}/${encodeURIComponent(c)}`);
|
|
26
27
|
}
|
|
27
28
|
function R(t, f) {
|
|
@@ -29,14 +30,14 @@ function R(t, f) {
|
|
|
29
30
|
const c = t.getSelection();
|
|
30
31
|
return !c || c.isEmpty() ? "" : f.getValueInRange(c);
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
const f =
|
|
33
|
+
function ue(t) {
|
|
34
|
+
const f = _(), c = B();
|
|
34
35
|
let m;
|
|
35
|
-
const
|
|
36
|
-
let s, o, i, h,
|
|
37
|
-
const
|
|
36
|
+
const F = ++Q;
|
|
37
|
+
let s, o, i, h, S = null, E = 0;
|
|
38
|
+
const O = H(() => m), p = () => {
|
|
38
39
|
const e = f.resolvedTheme(), a = f.shellPreset();
|
|
39
|
-
s &&
|
|
40
|
+
s && G(s.editor, e, a);
|
|
40
41
|
}, y = () => !o || !i ? null : {
|
|
41
42
|
editor: o,
|
|
42
43
|
model: i,
|
|
@@ -47,13 +48,13 @@ function se(t) {
|
|
|
47
48
|
const e = y();
|
|
48
49
|
if (!e) return;
|
|
49
50
|
const a = e.model.uri.toString();
|
|
50
|
-
a !==
|
|
51
|
+
a !== S && (S = a, t.onReady?.(e));
|
|
51
52
|
}, b = () => {
|
|
52
53
|
const e = y();
|
|
53
54
|
e && t.onSelectionChange?.(e.getSelectedText(), e);
|
|
54
55
|
}, I = async () => {
|
|
55
56
|
if (!o || !s) return;
|
|
56
|
-
const e = ++E, a =
|
|
57
|
+
const e = ++E, a = K(t.language);
|
|
57
58
|
let l = a.id;
|
|
58
59
|
try {
|
|
59
60
|
await a.load?.();
|
|
@@ -62,7 +63,7 @@ function se(t) {
|
|
|
62
63
|
l = "plaintext";
|
|
63
64
|
}
|
|
64
65
|
if (!o || e !== E) return;
|
|
65
|
-
const u =
|
|
66
|
+
const u = W(s, F, t.path);
|
|
66
67
|
if (i && i.uri.toString() === u.toString()) {
|
|
67
68
|
i.getLanguageId() !== l && s.editor.setModelLanguage(i, l), i.getValue() !== t.value && i.setValue(t.value), L(), b();
|
|
68
69
|
return;
|
|
@@ -70,10 +71,10 @@ function se(t) {
|
|
|
70
71
|
const g = s.editor.createModel(t.value, l, u);
|
|
71
72
|
i?.dispose(), i = g, o.setModel(i), L(), b();
|
|
72
73
|
};
|
|
73
|
-
return
|
|
74
|
+
return N(() => {
|
|
74
75
|
let e = !1, a, l, u, g = [], x = [];
|
|
75
76
|
(async () => {
|
|
76
|
-
if (!m || (X(), s = await Y(t.runtimeOptions), e || !m)) return;
|
|
77
|
+
if (!m || (X(), j(), s = await Y(t.runtimeOptions), e || !m)) return;
|
|
77
78
|
o = s.editor.create(m, {
|
|
78
79
|
model: null,
|
|
79
80
|
...A,
|
|
@@ -107,7 +108,7 @@ function se(t) {
|
|
|
107
108
|
};
|
|
108
109
|
if (r.addEventListener("pointerdown", v, !0), r.addEventListener("contextmenu", v, !0), r.addEventListener("keydown", v, !0), u = () => {
|
|
109
110
|
x = [], r.removeEventListener("pointerdown", v, !0), r.removeEventListener("contextmenu", v, !0), r.removeEventListener("keydown", v, !0);
|
|
110
|
-
},
|
|
111
|
+
}, p(), await I(), e || !o) return;
|
|
111
112
|
const z = t.onContentChange, w = t.onChange, D = t.onSelectionChange;
|
|
112
113
|
a = o.onDidChangeModelContent((n) => {
|
|
113
114
|
const d = y();
|
|
@@ -118,11 +119,11 @@ function se(t) {
|
|
|
118
119
|
});
|
|
119
120
|
})().catch((r) => {
|
|
120
121
|
console.error("Failed to initialize Monaco editor runtime", r);
|
|
121
|
-
}),
|
|
122
|
+
}), P(() => {
|
|
122
123
|
e = !0, a?.dispose(), l?.dispose(), u?.(), g.forEach((r) => r.dispose()), h && cancelAnimationFrame(h), o?.dispose(), i?.dispose(), s = void 0, o = void 0, i = void 0;
|
|
123
124
|
});
|
|
124
125
|
}), M(() => {
|
|
125
|
-
|
|
126
|
+
p();
|
|
126
127
|
}), M(() => {
|
|
127
128
|
o && o.updateOptions({
|
|
128
129
|
...A,
|
|
@@ -131,7 +132,7 @@ function se(t) {
|
|
|
131
132
|
}), M(() => {
|
|
132
133
|
t.path, t.language, t.value, I();
|
|
133
134
|
}), M(() => {
|
|
134
|
-
const e =
|
|
135
|
+
const e = O();
|
|
135
136
|
!e || !o || (h && cancelAnimationFrame(h), h = requestAnimationFrame(() => {
|
|
136
137
|
o?.layout({
|
|
137
138
|
width: e.width,
|
|
@@ -139,9 +140,9 @@ function se(t) {
|
|
|
139
140
|
});
|
|
140
141
|
}));
|
|
141
142
|
}), (() => {
|
|
142
|
-
var e =
|
|
143
|
-
return typeof a == "function" ?
|
|
144
|
-
var u = t.class
|
|
143
|
+
var e = J(), a = m;
|
|
144
|
+
return typeof a == "function" ? k(a, e) : m = e, V((l) => {
|
|
145
|
+
var u = `floe-code-editor${t.class ? ` ${t.class}` : ""}`, g = t.style;
|
|
145
146
|
return u !== l.e && q(e, l.e = u), l.t = U(e, g, l.t), l;
|
|
146
147
|
}, {
|
|
147
148
|
e: void 0,
|
|
@@ -150,5 +151,5 @@ function se(t) {
|
|
|
150
151
|
})();
|
|
151
152
|
}
|
|
152
153
|
export {
|
|
153
|
-
|
|
154
|
+
ue as CodeEditor
|
|
154
155
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureFloeMonacoHover(): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HoverService as s } from "monaco-editor/platform/hover/browser/hoverService.js";
|
|
2
|
+
import { IHoverService as c } from "monaco-editor/platform/hover/browser/hover.js";
|
|
3
|
+
import { registerSingleton as l } from "monaco-editor/platform/instantiation/common/extensions.js";
|
|
4
|
+
class a extends s {
|
|
5
|
+
scopeOptions(e) {
|
|
6
|
+
const r = e.target instanceof HTMLElement ? e.target : e.target.targetElements[0], t = r?.closest(".floe-code-editor");
|
|
7
|
+
if (!t) return e;
|
|
8
|
+
const o = t.getBoundingClientRect(), n = r.getBoundingClientRect();
|
|
9
|
+
return {
|
|
10
|
+
...e,
|
|
11
|
+
container: t,
|
|
12
|
+
...e.style === 1 || e.appearance?.showPointer ? { position: {
|
|
13
|
+
...e.position,
|
|
14
|
+
hoverPosition: 2,
|
|
15
|
+
anchorAlignment: n.left + n.width / 2 > o.left + o.width / 2 ? 1 : 0
|
|
16
|
+
} } : {}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
showInstantHover(...e) {
|
|
20
|
+
return e[0] = this.scopeOptions(e[0]), super.showInstantHover(...e);
|
|
21
|
+
}
|
|
22
|
+
showDelayedHover(...e) {
|
|
23
|
+
return e[0] = this.scopeOptions(e[0]), super.showDelayedHover(...e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let i = !1;
|
|
27
|
+
function f() {
|
|
28
|
+
i || (i = !0, l(c, a, !0));
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
f as ensureFloeMonacoHover
|
|
32
|
+
};
|
|
@@ -32,6 +32,8 @@ export declare function ContextMenuActions(props: {
|
|
|
32
32
|
actions: (request: ContextMenuRequest) => readonly ContextMenuAction[];
|
|
33
33
|
enabled?: boolean;
|
|
34
34
|
zIndex?: number;
|
|
35
|
+
/** Only the fallback menu changes scope; contributed local menus keep their owner. */
|
|
36
|
+
portalScope?: 'surface' | 'viewport';
|
|
35
37
|
editing?: {
|
|
36
38
|
labels: ContextMenuEditingLabels;
|
|
37
39
|
onError: (error: unknown) => void;
|
|
@@ -1,77 +1,80 @@
|
|
|
1
|
-
import { createComponent as f, insert as b, effect as E, className as k, setAttribute as M, memo as
|
|
1
|
+
import { createComponent as f, insert as b, effect as E, className as k, setAttribute as M, memo as $, template as S, delegateEvents as F } from "solid-js/web";
|
|
2
2
|
import { useResizeObserver as H } from "../../hooks/useResizeObserver.js";
|
|
3
|
-
import { Show as T, useContext as A, For as p, createSignal as D, onMount as R, onCleanup as
|
|
4
|
-
import { SurfaceFloatingLayer as
|
|
3
|
+
import { Show as T, useContext as A, For as p, createSignal as D, onMount as R, onCleanup as q, createContext as N, createMemo as P } from "solid-js";
|
|
4
|
+
import { SurfaceFloatingLayer as K } from "./SurfaceFloatingLayer.js";
|
|
5
5
|
import { handleMenuKeyboardNavigation as _ } from "./menuUtils.js";
|
|
6
|
-
var B = /* @__PURE__ */
|
|
7
|
-
const
|
|
8
|
-
function
|
|
6
|
+
var B = /* @__PURE__ */ S("<span aria-hidden=true>"), O = /* @__PURE__ */ S("<button type=button role=menuitem><span>"), X = /* @__PURE__ */ S("<button type=button role=menuitem class=floe-context-action><span>");
|
|
7
|
+
const L = N(), W = () => A(L);
|
|
8
|
+
function z(e) {
|
|
9
9
|
return f(T, {
|
|
10
10
|
get when() {
|
|
11
11
|
return e.icon;
|
|
12
12
|
},
|
|
13
|
-
children: (
|
|
14
|
-
var
|
|
15
|
-
return b(
|
|
13
|
+
children: (r) => (() => {
|
|
14
|
+
var s = B();
|
|
15
|
+
return b(s, () => r()()), E(() => k(s, `floe-context-action-icon ${e.class ?? ""}`)), s;
|
|
16
16
|
})()
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
function Z(e) {
|
|
20
|
-
let
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
if (e.enabled === !1 ||
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
const g =
|
|
20
|
+
let r, s, c;
|
|
21
|
+
const i = /* @__PURE__ */ new Set(), [n, o] = D(), u = () => {
|
|
22
|
+
const t = r;
|
|
23
|
+
return r = void 0, s = void 0, c = void 0, t;
|
|
24
|
+
}, l = (t) => {
|
|
25
|
+
if (e.enabled === !1 || t.defaultPrevented || t instanceof KeyboardEvent && t.key !== "ContextMenu" && !(t.shiftKey && t.key === "F10")) return;
|
|
26
|
+
const a = t.composedPath().find((h) => h instanceof HTMLElement);
|
|
27
|
+
if (!a || a.closest('[inert], [hidden], [role="menu"], [data-floe-context-menu-native]')) return;
|
|
28
|
+
const g = a.getBoundingClientRect(), d = t instanceof MouseEvent && (t.clientX !== 0 || t.clientY !== 0), v = a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement ? a instanceof HTMLInputElement && a.type === "password" ? "" : a.value.slice(a.selectionStart ?? 0, a.selectionEnd ?? 0) : (() => {
|
|
29
29
|
const h = document.getSelection();
|
|
30
|
-
return h?.rangeCount && h.getRangeAt(0).intersectsNode(
|
|
30
|
+
return h?.rangeCount && h.getRangeAt(0).intersectsNode(a) ? h.toString() : "";
|
|
31
31
|
})(), w = {
|
|
32
|
-
target:
|
|
33
|
-
x: d ?
|
|
34
|
-
y: d ?
|
|
32
|
+
target: a,
|
|
33
|
+
x: d ? t.clientX : g.left + 8,
|
|
34
|
+
y: d ? t.clientY : g.bottom,
|
|
35
35
|
selection: v
|
|
36
|
-
},
|
|
36
|
+
}, C = e.actions(w), x = {
|
|
37
37
|
origin: w,
|
|
38
|
-
actions:
|
|
39
|
-
},
|
|
38
|
+
actions: C
|
|
39
|
+
}, I = {
|
|
40
40
|
origin: w,
|
|
41
|
-
actions: [...
|
|
41
|
+
actions: [...C, ...e.editing ? j(w, e.editing.labels, e.editing.onError) : []]
|
|
42
42
|
};
|
|
43
43
|
if (!x.actions.length) return;
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
r = x, s = t, c = I;
|
|
45
|
+
const y = setTimeout(() => {
|
|
46
|
+
r === x && (r = void 0, s = void 0, c = void 0), i.delete(y);
|
|
47
47
|
}, 0);
|
|
48
|
-
|
|
49
|
-
}, m = (
|
|
50
|
-
|
|
48
|
+
i.add(y);
|
|
49
|
+
}, m = (t) => {
|
|
50
|
+
r && s === t && !t.defaultPrevented && (t.preventDefault(), o(c), u());
|
|
51
51
|
};
|
|
52
52
|
return R(() => {
|
|
53
|
-
document.addEventListener("contextmenu",
|
|
54
|
-
|
|
53
|
+
document.addEventListener("contextmenu", l, !0), document.addEventListener("keydown", l, !0), window.addEventListener("contextmenu", m), window.addEventListener("keydown", m), q(() => {
|
|
54
|
+
i.forEach(clearTimeout), r = void 0, s = void 0, c = void 0, document.removeEventListener("contextmenu", l, !0), document.removeEventListener("keydown", l, !0), window.removeEventListener("contextmenu", m), window.removeEventListener("keydown", m);
|
|
55
55
|
});
|
|
56
|
-
}), f(
|
|
56
|
+
}), f(L.Provider, {
|
|
57
57
|
value: {
|
|
58
58
|
claim: u,
|
|
59
|
-
resolve: (
|
|
59
|
+
resolve: (t) => e.enabled === !1 ? [] : e.actions(t)
|
|
60
60
|
},
|
|
61
61
|
get children() {
|
|
62
|
-
return [
|
|
62
|
+
return [$(() => e.children), f(T, {
|
|
63
63
|
get when() {
|
|
64
|
-
return
|
|
64
|
+
return n();
|
|
65
65
|
},
|
|
66
66
|
keyed: !0,
|
|
67
|
-
children: (
|
|
68
|
-
request:
|
|
67
|
+
children: (t) => f(Y, {
|
|
68
|
+
request: t,
|
|
69
69
|
get label() {
|
|
70
70
|
return e.label;
|
|
71
71
|
},
|
|
72
72
|
get zIndex() {
|
|
73
73
|
return e.zIndex;
|
|
74
74
|
},
|
|
75
|
+
get portalScope() {
|
|
76
|
+
return e.portalScope;
|
|
77
|
+
},
|
|
75
78
|
onClose: () => o(void 0)
|
|
76
79
|
})
|
|
77
80
|
})];
|
|
@@ -79,73 +82,78 @@ function Z(e) {
|
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
function ee(e) {
|
|
82
|
-
const
|
|
85
|
+
const r = A(L)?.claim(), s = () => r?.actions.filter((c) => !e.excludeIds?.includes(c.id)) ?? [];
|
|
83
86
|
return f(p, {
|
|
84
87
|
get each() {
|
|
85
|
-
return
|
|
88
|
+
return s();
|
|
86
89
|
},
|
|
87
|
-
children: (
|
|
88
|
-
var
|
|
89
|
-
return
|
|
90
|
-
e.onClose(),
|
|
91
|
-
}, b(
|
|
90
|
+
children: (c) => (() => {
|
|
91
|
+
var i = O(), n = i.firstChild;
|
|
92
|
+
return i.$$click = () => {
|
|
93
|
+
e.onClose(), c.onSelect();
|
|
94
|
+
}, b(i, f(z, {
|
|
92
95
|
get icon() {
|
|
93
|
-
return
|
|
96
|
+
return c.icon;
|
|
94
97
|
}
|
|
95
|
-
}),
|
|
96
|
-
var u = e.itemClass ?? "floe-context-action",
|
|
97
|
-
return u !== o.e && k(
|
|
98
|
+
}), n), b(n, () => c.label), E((o) => {
|
|
99
|
+
var u = e.itemClass ?? "floe-context-action", l = c.id, m = c.disabled;
|
|
100
|
+
return u !== o.e && k(i, o.e = u), l !== o.t && M(i, "data-context-action-id", o.t = l), m !== o.a && (i.disabled = o.a = m), o;
|
|
98
101
|
}, {
|
|
99
102
|
e: void 0,
|
|
100
103
|
t: void 0,
|
|
101
104
|
a: void 0
|
|
102
|
-
}),
|
|
105
|
+
}), i;
|
|
103
106
|
})()
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
function Y(e) {
|
|
107
|
-
let
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
+
let r;
|
|
111
|
+
const s = H(() => r), c = P(() => {
|
|
112
|
+
if (!s() || !r) return {
|
|
110
113
|
width: 208,
|
|
111
114
|
height: 8 + e.request.actions.length * 30
|
|
112
115
|
};
|
|
113
|
-
const
|
|
116
|
+
const n = r.getBoundingClientRect();
|
|
114
117
|
return {
|
|
115
|
-
width:
|
|
116
|
-
height:
|
|
118
|
+
width: n.width,
|
|
119
|
+
height: n.height
|
|
117
120
|
};
|
|
118
|
-
}),
|
|
119
|
-
e.onClose(),
|
|
121
|
+
}), i = (n = !1) => {
|
|
122
|
+
e.onClose(), n && e.request.origin.target.isConnected && e.request.origin.target.focus({
|
|
120
123
|
preventScroll: !0
|
|
121
124
|
});
|
|
122
125
|
};
|
|
123
126
|
return R(() => {
|
|
124
|
-
|
|
127
|
+
r.querySelector('[role="menuitem"]:not(:disabled)')?.focus({
|
|
125
128
|
preventScroll: !0
|
|
126
129
|
});
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
}, o = () =>
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
const n = (l) => {
|
|
131
|
+
l.target instanceof Node && !r.contains(l.target) && i();
|
|
132
|
+
}, o = (l) => {
|
|
133
|
+
l.target instanceof Node && l.target.contains(e.request.origin.target) && i();
|
|
134
|
+
}, u = () => i();
|
|
135
|
+
document.addEventListener("pointerdown", n, !0), document.addEventListener("focusin", n, !0), document.addEventListener("scroll", o, !0), window.addEventListener("resize", u), window.addEventListener("blur", u), q(() => {
|
|
136
|
+
document.removeEventListener("pointerdown", n, !0), document.removeEventListener("focusin", n, !0), document.removeEventListener("scroll", o, !0), window.removeEventListener("resize", u), window.removeEventListener("blur", u);
|
|
132
137
|
});
|
|
133
|
-
}), f(
|
|
138
|
+
}), f(K, {
|
|
134
139
|
get owner() {
|
|
135
140
|
return e.request.origin.target;
|
|
136
141
|
},
|
|
142
|
+
get portalScope() {
|
|
143
|
+
return e.portalScope;
|
|
144
|
+
},
|
|
137
145
|
get position() {
|
|
138
146
|
return e.request.origin;
|
|
139
147
|
},
|
|
140
148
|
get estimatedSize() {
|
|
141
|
-
return
|
|
149
|
+
return c();
|
|
142
150
|
},
|
|
143
151
|
role: "menu",
|
|
144
152
|
get "aria-label"() {
|
|
145
153
|
return e.label;
|
|
146
154
|
},
|
|
147
|
-
layerRef: (
|
|
148
|
-
|
|
155
|
+
layerRef: (n) => {
|
|
156
|
+
r = n;
|
|
149
157
|
},
|
|
150
158
|
class: "floe-context-actions",
|
|
151
159
|
get style() {
|
|
@@ -153,10 +161,10 @@ function Y(e) {
|
|
|
153
161
|
"z-index": e.zIndex
|
|
154
162
|
};
|
|
155
163
|
},
|
|
156
|
-
onContextMenu: (
|
|
157
|
-
onKeyDown: (
|
|
164
|
+
onContextMenu: (n) => n.preventDefault(),
|
|
165
|
+
onKeyDown: (n) => _(n, {
|
|
158
166
|
onActivate: (o) => o.click(),
|
|
159
|
-
onDismiss: () =>
|
|
167
|
+
onDismiss: () => i(!0),
|
|
160
168
|
preventDefaultOnTab: !0
|
|
161
169
|
}),
|
|
162
170
|
get children() {
|
|
@@ -164,17 +172,17 @@ function Y(e) {
|
|
|
164
172
|
get each() {
|
|
165
173
|
return e.request.actions;
|
|
166
174
|
},
|
|
167
|
-
children: (
|
|
175
|
+
children: (n) => (() => {
|
|
168
176
|
var o = X(), u = o.firstChild;
|
|
169
177
|
return o.$$click = () => {
|
|
170
|
-
|
|
171
|
-
}, b(o, f(
|
|
178
|
+
i(), n.onSelect();
|
|
179
|
+
}, b(o, f(z, {
|
|
172
180
|
get icon() {
|
|
173
|
-
return
|
|
181
|
+
return n.icon;
|
|
174
182
|
}
|
|
175
|
-
}), u), b(u, () =>
|
|
176
|
-
var m =
|
|
177
|
-
return m !==
|
|
183
|
+
}), u), b(u, () => n.label), E((l) => {
|
|
184
|
+
var m = n.id, t = n.disabled;
|
|
185
|
+
return m !== l.e && M(o, "data-context-action-id", l.e = m), t !== l.t && (o.disabled = l.t = t), l;
|
|
178
186
|
}, {
|
|
179
187
|
e: void 0,
|
|
180
188
|
t: void 0
|
|
@@ -184,58 +192,58 @@ function Y(e) {
|
|
|
184
192
|
}
|
|
185
193
|
});
|
|
186
194
|
}
|
|
187
|
-
function j(e,
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
195
|
+
function j(e, r, s) {
|
|
196
|
+
const c = e.target.closest('input, textarea, [contenteditable]:not([contenteditable="false"])'), i = c instanceof HTMLInputElement || c instanceof HTMLTextAreaElement ? c : null, n = document.getSelection()?.rangeCount ? document.getSelection().getRangeAt(0).cloneRange() : void 0, o = i?.selectionStart, u = i?.selectionEnd, l = () => {
|
|
197
|
+
if (c?.focus({
|
|
190
198
|
preventScroll: !0
|
|
191
|
-
}),
|
|
192
|
-
else if (
|
|
199
|
+
}), i && o != null && u != null) i.setSelectionRange(o, u);
|
|
200
|
+
else if (n) {
|
|
193
201
|
const d = document.getSelection();
|
|
194
|
-
d?.removeAllRanges(), d?.addRange(
|
|
202
|
+
d?.removeAllRanges(), d?.addRange(n);
|
|
195
203
|
}
|
|
196
204
|
}, m = (d) => () => {
|
|
197
205
|
try {
|
|
198
|
-
Promise.resolve(d()).catch(
|
|
206
|
+
Promise.resolve(d()).catch(s);
|
|
199
207
|
} catch (v) {
|
|
200
|
-
|
|
208
|
+
s(v);
|
|
201
209
|
}
|
|
202
|
-
},
|
|
210
|
+
}, t = (d) => ({
|
|
203
211
|
id: `edit.${d}`,
|
|
204
|
-
label:
|
|
212
|
+
label: r[d],
|
|
205
213
|
onSelect: m(async () => {
|
|
206
|
-
if (
|
|
207
|
-
|
|
214
|
+
if (l(), d === "selectAll" && i) {
|
|
215
|
+
i.select();
|
|
208
216
|
return;
|
|
209
217
|
}
|
|
210
218
|
if (document.execCommand(d) || d !== "paste") return;
|
|
211
219
|
const v = await navigator.clipboard.readText();
|
|
212
|
-
if (
|
|
220
|
+
if (c?.isConnected && (l(), !document.execCommand("insertText", !1, v)))
|
|
213
221
|
throw new Error("Clipboard insertion is unavailable.");
|
|
214
222
|
})
|
|
215
|
-
}),
|
|
216
|
-
|
|
223
|
+
}), a = [];
|
|
224
|
+
c && a.push(t("undo"), t("redo"), t("cut")), e.selection && a.push({
|
|
217
225
|
id: "edit.copy",
|
|
218
|
-
label:
|
|
226
|
+
label: r.copy,
|
|
219
227
|
onSelect: m(() => navigator.clipboard.writeText(e.selection))
|
|
220
|
-
}),
|
|
228
|
+
}), c && a.push(t("paste"), t("selectAll"));
|
|
221
229
|
const g = e.target.closest("a[href]");
|
|
222
230
|
if (g && ["http:", "https:", "mailto:"].includes(g.protocol)) {
|
|
223
231
|
const d = g.href;
|
|
224
|
-
|
|
232
|
+
a.push({
|
|
225
233
|
id: "link.open",
|
|
226
|
-
label:
|
|
234
|
+
label: r.openLink,
|
|
227
235
|
onSelect: () => window.open(d, "_blank", "noopener,noreferrer")
|
|
228
|
-
}),
|
|
236
|
+
}), a.push({
|
|
229
237
|
id: "link.copy",
|
|
230
|
-
label:
|
|
238
|
+
label: r.copyLink,
|
|
231
239
|
onSelect: m(() => navigator.clipboard.writeText(d))
|
|
232
240
|
});
|
|
233
241
|
}
|
|
234
|
-
return
|
|
242
|
+
return a;
|
|
235
243
|
}
|
|
236
244
|
F(["click"]);
|
|
237
245
|
export {
|
|
238
|
-
|
|
246
|
+
z as ContextMenuActionIcon,
|
|
239
247
|
ee as ContextMenuActionItems,
|
|
240
248
|
Z as ContextMenuActions,
|
|
241
249
|
W as useContextMenuActions
|
|
@@ -12,6 +12,8 @@ export interface SurfaceFloatingLayerProps extends Omit<JSX.HTMLAttributes<HTMLD
|
|
|
12
12
|
position: SurfaceFloatingLayerPosition;
|
|
13
13
|
/** Stable trigger or anchor used to resolve the owning projected surface. */
|
|
14
14
|
owner?: Element | null;
|
|
15
|
+
/** Global commands may escape their source surface without changing the owner. */
|
|
16
|
+
portalScope?: 'surface' | 'viewport';
|
|
15
17
|
boundary?: SurfaceFloatingBoundary;
|
|
16
18
|
estimatedSize?: SurfaceFloatingLayerSize;
|
|
17
19
|
clamp?: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createComponent as S, Portal as v, use as h, spread as g, mergeProps as
|
|
2
|
-
import { observeViewport as
|
|
1
|
+
import { createComponent as S, Portal as v, use as h, spread as g, mergeProps as w, insert as A, template as P } from "solid-js/web";
|
|
2
|
+
import { observeViewport as R } from "../../viewport.js";
|
|
3
3
|
import { splitProps as _, createSignal as b, onMount as x, onCleanup as C, createMemo as s } from "solid-js";
|
|
4
4
|
import { cn as T } from "../../utils/cn.js";
|
|
5
5
|
import { LOCAL_INTERACTION_SURFACE_ATTR as z } from "./localInteractionSurface.js";
|
|
6
6
|
import { clampMenuPosition as M } from "./menuUtils.js";
|
|
7
|
-
import { readSurfaceSafeArea as
|
|
8
|
-
import { resolveSurfacePortalHost as
|
|
9
|
-
var N = /* @__PURE__ */
|
|
7
|
+
import { readSurfaceSafeArea as E, resolveFloatingBoundary as F } from "./surfaceFloatingBoundary.js";
|
|
8
|
+
import { resolveSurfacePortalHost as L, SURFACE_FLOATING_LAYER_ATTR as $, resolveSurfacePortalMount as O, isSurfacePortalMode as B, projectSurfacePortalPosition as I } from "./dialogSurfaceScope.js";
|
|
9
|
+
var N = /* @__PURE__ */ P("<div>");
|
|
10
10
|
function j() {
|
|
11
11
|
return {
|
|
12
12
|
left: 0,
|
|
@@ -18,11 +18,11 @@ function j() {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function J(c) {
|
|
21
|
-
const [e,
|
|
22
|
-
x(() => C(
|
|
23
|
-
const r = s(() =>
|
|
24
|
-
owner: e.owner ?? null
|
|
25
|
-
})), n = () => B(r()),
|
|
21
|
+
const [e, p] = _(c, ["position", "owner", "portalScope", "boundary", "estimatedSize", "clamp", "class", "style", "children", "layerRef"]), [a, u] = b();
|
|
22
|
+
x(() => C(R(window, u)));
|
|
23
|
+
const r = s(() => L({
|
|
24
|
+
owner: e.portalScope === "viewport" ? document.documentElement : e.owner ?? null
|
|
25
|
+
})), n = () => B(r()), f = s(() => (e.position, a()?.safeArea ?? E())), i = () => F(r(), e.boundary, f()) ?? j(), m = () => e.clamp !== !1 && !!e.estimatedSize, d = s(() => {
|
|
26
26
|
const t = e.position;
|
|
27
27
|
return !m() || !e.estimatedSize ? t : M(t, e.estimatedSize, i());
|
|
28
28
|
}), l = () => {
|
|
@@ -46,7 +46,7 @@ function J(c) {
|
|
|
46
46
|
},
|
|
47
47
|
get children() {
|
|
48
48
|
var t = N(), o = e.layerRef;
|
|
49
|
-
return typeof o == "function" ? h(o, t) : e.layerRef = t, g(t,
|
|
49
|
+
return typeof o == "function" ? h(o, t) : e.layerRef = t, g(t, w(p, {
|
|
50
50
|
get class() {
|
|
51
51
|
return T(n() ? "absolute z-20" : "fixed z-50", e.class);
|
|
52
52
|
},
|
|
@@ -54,10 +54,10 @@ function J(c) {
|
|
|
54
54
|
return y();
|
|
55
55
|
}
|
|
56
56
|
}, {
|
|
57
|
-
[
|
|
57
|
+
[$]: "true"
|
|
58
58
|
}, () => ({
|
|
59
59
|
[z]: n() ? "true" : void 0
|
|
60
|
-
})), !1, !0),
|
|
60
|
+
})), !1, !0), A(t, () => e.children), t;
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TextSearchController } from './textSearch';
|
|
2
|
+
export interface TextSearchLabels {
|
|
3
|
+
find: string;
|
|
4
|
+
previous: string;
|
|
5
|
+
next: string;
|
|
6
|
+
close: string;
|
|
7
|
+
noMatches: string;
|
|
8
|
+
matches: (current: number, total: number) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare function TextSearchBar(props: {
|
|
11
|
+
search: TextSearchController;
|
|
12
|
+
labels: TextSearchLabels;
|
|
13
|
+
}): import("solid-js").JSX.Element;
|