@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createComponent as u, use as q, insert as v, memo as S, effect as C, setAttribute as a, template as D, delegateEvents as I } from "solid-js/web";
|
|
2
|
+
import { Show as T } from "solid-js";
|
|
3
|
+
import { ChevronUp as A, ChevronDown as B, X as E } from "../icons/index.js";
|
|
4
|
+
var K = /* @__PURE__ */ D("<div class=floe-text-search role=search><input type=search><span role=status aria-live=polite aria-atomic=true></span><button type=button></button><button type=button></button><button type=button>");
|
|
5
|
+
function X(t) {
|
|
6
|
+
return u(T, {
|
|
7
|
+
get when() {
|
|
8
|
+
return t.search.open();
|
|
9
|
+
},
|
|
10
|
+
get children() {
|
|
11
|
+
var r = K(), l = r.firstChild, o = l.nextSibling, n = o.nextSibling, i = n.nextSibling, c = i.nextSibling;
|
|
12
|
+
r.$$keydown = (e) => t.search.onKeyDown(e), l.$$input = (e) => t.search.setQuery(e.currentTarget.value);
|
|
13
|
+
var b = t.search.bindInput;
|
|
14
|
+
return typeof b == "function" ? q(b, l) : t.search.bindInput = l, v(o, (() => {
|
|
15
|
+
var e = S(() => !!t.search.query());
|
|
16
|
+
return () => e() ? S(() => !!t.search.count())() ? t.labels.matches(t.search.current(), t.search.count()) : t.labels.noMatches : "";
|
|
17
|
+
})()), n.$$click = () => t.search.previous(), v(n, u(A, {})), i.$$click = () => t.search.next(), v(i, u(B, {})), c.$$click = () => t.search.close(), v(c, u(E, {})), C((e) => {
|
|
18
|
+
var h = t.labels.find, d = t.labels.find, s = t.labels.find, f = t.labels.previous, m = t.labels.previous, y = !t.search.count(), x = t.labels.next, g = t.labels.next, $ = !t.search.count(), k = t.labels.close, w = t.labels.close;
|
|
19
|
+
return h !== e.e && a(r, "aria-label", e.e = h), d !== e.t && a(l, "aria-label", e.t = d), s !== e.a && a(l, "placeholder", e.a = s), f !== e.o && a(n, "title", e.o = f), m !== e.i && a(n, "aria-label", e.i = m), y !== e.n && (n.disabled = e.n = y), x !== e.s && a(i, "title", e.s = x), g !== e.h && a(i, "aria-label", e.h = g), $ !== e.r && (i.disabled = e.r = $), k !== e.d && a(c, "title", e.d = k), w !== e.l && a(c, "aria-label", e.l = w), e;
|
|
20
|
+
}, {
|
|
21
|
+
e: void 0,
|
|
22
|
+
t: void 0,
|
|
23
|
+
a: void 0,
|
|
24
|
+
o: void 0,
|
|
25
|
+
i: void 0,
|
|
26
|
+
n: void 0,
|
|
27
|
+
s: void 0,
|
|
28
|
+
h: void 0,
|
|
29
|
+
r: void 0,
|
|
30
|
+
d: void 0,
|
|
31
|
+
l: void 0
|
|
32
|
+
}), C(() => l.value = t.search.query()), r;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
I(["keydown", "input", "click"]);
|
|
37
|
+
export {
|
|
38
|
+
X as TextSearchBar
|
|
39
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Accessor } from 'solid-js';
|
|
2
|
+
/** Literal rendered-text matching; inline markup can split a match, blocks cannot. */
|
|
3
|
+
export declare function findTextRanges(root: HTMLElement, query: string): Range[];
|
|
4
|
+
export interface TextSearchOptions {
|
|
5
|
+
content: Accessor<HTMLElement | undefined>;
|
|
6
|
+
viewport?: Accessor<HTMLElement | undefined>;
|
|
7
|
+
active?: Accessor<boolean>;
|
|
8
|
+
identity?: Accessor<unknown>;
|
|
9
|
+
}
|
|
10
|
+
export declare function createTextSearch(options: TextSearchOptions): {
|
|
11
|
+
open: Accessor<boolean>;
|
|
12
|
+
query: Accessor<string>;
|
|
13
|
+
setQuery: import("solid-js").Setter<string>;
|
|
14
|
+
show: (trigger?: HTMLElement) => void;
|
|
15
|
+
close: () => void;
|
|
16
|
+
next: () => void;
|
|
17
|
+
previous: () => void;
|
|
18
|
+
count: () => number;
|
|
19
|
+
current: () => number;
|
|
20
|
+
bindInput: (element: HTMLInputElement) => void;
|
|
21
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
22
|
+
};
|
|
23
|
+
export type TextSearchController = ReturnType<typeof createTextSearch>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createSignal as C, createUniqueId as K, createEffect as E, batch as k, onCleanup as D, on as L, untrack as M } from "solid-js";
|
|
2
|
+
function N(l, s) {
|
|
3
|
+
if (!s) return [];
|
|
4
|
+
const x = new RegExp(s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "giu"), y = [];
|
|
5
|
+
let f = "", c = [];
|
|
6
|
+
const b = () => {
|
|
7
|
+
let i = 0, a = 0;
|
|
8
|
+
for (const g of f.matchAll(x)) {
|
|
9
|
+
const r = g.index, u = r + g[0].length;
|
|
10
|
+
for (; c[i].end <= r; ) i++;
|
|
11
|
+
for (a = Math.max(i, a); c[a].end < u; ) a++;
|
|
12
|
+
const m = c[i], p = c[a], h = l.ownerDocument.createRange();
|
|
13
|
+
h.setStart(m.node, r - m.start), h.setEnd(p.node, u - p.start), y.push(h);
|
|
14
|
+
}
|
|
15
|
+
f = "", c = [];
|
|
16
|
+
}, w = (i) => {
|
|
17
|
+
if (i.nodeType === Node.TEXT_NODE) {
|
|
18
|
+
const r = i.textContent ?? "";
|
|
19
|
+
r && (c.push({ node: i, start: f.length, end: f.length + r.length }), f += r);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!(i instanceof HTMLElement)) return;
|
|
23
|
+
if (i.matches('script,style,button,input,textarea,select,[hidden],[aria-hidden="true"],[data-floe-text-search-exclude]')) {
|
|
24
|
+
b();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const a = getComputedStyle(i);
|
|
28
|
+
if (a.display === "none" || a.visibility === "hidden") return;
|
|
29
|
+
const g = !["inline", "contents"].includes(a.display) || i.tagName === "BR";
|
|
30
|
+
g && b(), i.childNodes.forEach(w), g && b();
|
|
31
|
+
};
|
|
32
|
+
return l.childNodes.forEach(w), b(), y;
|
|
33
|
+
}
|
|
34
|
+
function $(l) {
|
|
35
|
+
const [s, x] = C(!1), [y, f] = C(""), [c, b] = C([]), [w, i] = C(0), [a, g] = C(0), r = "floe-find-" + K().replace(/[^a-zA-Z0-9-]/g, "");
|
|
36
|
+
let u, m, p = 0, h;
|
|
37
|
+
const A = () => l.identity?.(), d = () => l.active?.() !== !1, S = () => {
|
|
38
|
+
globalThis.CSS?.highlights?.delete(r), globalThis.CSS?.highlights?.delete(r + "-current");
|
|
39
|
+
}, H = (t) => {
|
|
40
|
+
const n = l.viewport?.() ?? l.content();
|
|
41
|
+
if (!t || !n || !d()) return;
|
|
42
|
+
const e = n.getBoundingClientRect(), o = t.getBoundingClientRect(), F = e.width / n.offsetWidth || 1, I = e.height / n.offsetHeight || 1;
|
|
43
|
+
(o.top < e.top + 8 || o.bottom > e.bottom - 8) && (n.scrollTop += (o.top - e.top - e.height / 2) / I), (o.left < e.left || o.right > e.right) && (n.scrollLeft += (o.left - e.left - e.width / 2) / F);
|
|
44
|
+
}, T = () => {
|
|
45
|
+
x(!1), S(), d() && m?.isConnected && !m.closest("[inert]") && m.focus({ preventScroll: !0 });
|
|
46
|
+
}, R = (t) => {
|
|
47
|
+
d() && (s() || (m = t ?? (document.activeElement instanceof HTMLElement ? document.activeElement : void 0)), x(!0), queueMicrotask(() => {
|
|
48
|
+
M(s) && M(d) && u?.isConnected && (u.focus(), u.select());
|
|
49
|
+
}));
|
|
50
|
+
}, v = (t) => {
|
|
51
|
+
const n = c().length;
|
|
52
|
+
n && i((e) => (e + t + n) % n);
|
|
53
|
+
};
|
|
54
|
+
return E(() => {
|
|
55
|
+
A(), k(() => {
|
|
56
|
+
x(!1), f(""), i(0);
|
|
57
|
+
});
|
|
58
|
+
}), E(() => {
|
|
59
|
+
const t = l.content();
|
|
60
|
+
if (!t || !s() || !d()) return;
|
|
61
|
+
const n = new MutationObserver(() => {
|
|
62
|
+
cancelAnimationFrame(p), p = requestAnimationFrame(() => g((e) => e + 1));
|
|
63
|
+
});
|
|
64
|
+
n.observe(t, { childList: !0, characterData: !0, subtree: !0 }), D(() => {
|
|
65
|
+
n.disconnect(), cancelAnimationFrame(p);
|
|
66
|
+
});
|
|
67
|
+
}), E(() => {
|
|
68
|
+
const t = l.content();
|
|
69
|
+
a();
|
|
70
|
+
const n = y();
|
|
71
|
+
if (!s() || !d()) return;
|
|
72
|
+
const e = t ? N(t, n) : [];
|
|
73
|
+
k(() => {
|
|
74
|
+
b(e), i((o) => Math.min(o, Math.max(0, e.length - 1)));
|
|
75
|
+
});
|
|
76
|
+
}), E(L(y, () => i(0))), E(() => {
|
|
77
|
+
S();
|
|
78
|
+
const t = c(), n = t[w()];
|
|
79
|
+
if (!(!s() || !d())) {
|
|
80
|
+
if (typeof Highlight < "u" && CSS.highlights) {
|
|
81
|
+
h || (h = document.createElement("style"), h.textContent = `::highlight(${r}){background:color-mix(in srgb,var(--warning,#eab308) 35%,transparent);color:inherit}::highlight(${r}-current){background:var(--primary,#2563eb);color:var(--primary-foreground,#fff)}`, document.head.append(h));
|
|
82
|
+
const e = new Highlight();
|
|
83
|
+
if (t.forEach((o) => e.add(o)), CSS.highlights.set(r, e), n) {
|
|
84
|
+
const o = new Highlight(n);
|
|
85
|
+
o.priority = 1, CSS.highlights.set(r + "-current", o);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
H(n);
|
|
89
|
+
}
|
|
90
|
+
}), D(() => {
|
|
91
|
+
S(), h?.remove(), cancelAnimationFrame(p);
|
|
92
|
+
}), {
|
|
93
|
+
open: s,
|
|
94
|
+
query: y,
|
|
95
|
+
setQuery: f,
|
|
96
|
+
show: R,
|
|
97
|
+
close: T,
|
|
98
|
+
next: () => v(1),
|
|
99
|
+
previous: () => v(-1),
|
|
100
|
+
count: () => c().length,
|
|
101
|
+
current: () => c().length ? w() + 1 : 0,
|
|
102
|
+
bindInput: (t) => {
|
|
103
|
+
u = t;
|
|
104
|
+
},
|
|
105
|
+
onKeyDown: (t) => {
|
|
106
|
+
!d() || t.isComposing || t.defaultPrevented || ((t.ctrlKey || t.metaKey) && !t.altKey && t.key.toLowerCase() === "f" ? (t.preventDefault(), t.stopPropagation(), R()) : s() && t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), T()) : s() && t.target === u && t.key === "Enter" && (t.preventDefault(), t.stopPropagation(), v(t.shiftKey ? -1 : 1)));
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
$ as createTextSearch,
|
|
112
|
+
N as findTextRanges
|
|
113
|
+
};
|
package/dist/editor.css
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* Monaco measures a hover before moving its context view to the anchor. Keep
|
|
2
|
+
* the measured intrinsic width at the editor edge, so wrapping cannot enlarge
|
|
3
|
+
* the tooltip over its trigger and repeatedly retrigger pointer enter/leave. */
|
|
4
|
+
.floe-code-editor .workbench-hover-container {
|
|
5
|
+
width: max-content;
|
|
6
|
+
max-width: calc(100vw - 8px);
|
|
7
|
+
}
|