@floegence/floe-webapp-core 0.94.1 → 0.95.0
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/deck/DeckContextMenu.js +38 -33
- package/dist/components/editor/CodeEditor.js +112 -81
- package/dist/components/file-browser/FileContextMenu.js +215 -202
- package/dist/components/file-browser/types.d.ts +2 -0
- package/dist/components/notes/useNotesOverlayModel.d.ts +8 -1
- package/dist/components/notes/useNotesOverlayModel.js +126 -116
- package/dist/components/ui/ContextMenuActions.d.ts +42 -0
- package/dist/components/ui/ContextMenuActions.js +238 -0
- package/dist/components/ui/index.d.ts +9 -8
- package/dist/components/workbench/WorkbenchSurface.js +121 -111
- package/dist/full.js +587 -583
- package/dist/styles.css +1 -1
- package/dist/ui.css +33 -0
- package/dist/ui.js +194 -190
- package/package.json +1 -1
|
@@ -1,66 +1,71 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createComponent as n, Portal as x, insert as a, effect as v, className as h, setStyleProperty as d, template as s, delegateEvents as g } from "solid-js/web";
|
|
2
|
+
import { ContextMenuActionItems as p } from "../ui/ContextMenuActions.js";
|
|
3
|
+
import { Show as f, For as $ } from "solid-js";
|
|
4
|
+
import { cn as w } from "../../utils/cn.js";
|
|
5
|
+
import { Plus as k } from "../icons/index.js";
|
|
6
|
+
var b = /* @__PURE__ */ s('<div class="fixed inset-0 z-[9998]">'), y = /* @__PURE__ */ s('<div role=menu><div class="px-2 py-1 text-caption font-semibold uppercase tracking-wider text-[var(--floe-ink-quiet)] flex items-center gap-1.5">Add widget here'), C = /* @__PURE__ */ s('<div class="px-3 py-3 text-xs text-[var(--floe-ink-soft)] text-center">No widgets registered'), _ = /* @__PURE__ */ s('<button type=button role=menuitem class="w-full flex items-center gap-2 px-2.5 py-1.5 rounded-xs hover:bg-[var(--floe-state-hover)] transition-colors text-left cursor-pointer"><span class="text-xs text-foreground">'), D = /* @__PURE__ */ s('<div class="w-4 h-4 flex-shrink-0">');
|
|
7
|
+
function M(r) {
|
|
8
|
+
return n(f, {
|
|
8
9
|
get when() {
|
|
9
10
|
return r.open;
|
|
10
11
|
},
|
|
11
12
|
get children() {
|
|
12
|
-
return
|
|
13
|
+
return n(x, {
|
|
13
14
|
get children() {
|
|
14
15
|
return [(() => {
|
|
15
|
-
var
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
},
|
|
16
|
+
var e = b();
|
|
17
|
+
return e.$$contextmenu = (l) => {
|
|
18
|
+
l.preventDefault(), r.onDismiss();
|
|
19
|
+
}, e.$$click = () => r.onDismiss(), e;
|
|
19
20
|
})(), (() => {
|
|
20
|
-
var
|
|
21
|
-
return
|
|
21
|
+
var e = y(), l = e.firstChild, u = l.firstChild;
|
|
22
|
+
return a(e, n(p, {
|
|
23
|
+
get onClose() {
|
|
24
|
+
return r.onDismiss;
|
|
25
|
+
}
|
|
26
|
+
}), l), a(l, n(k, {
|
|
22
27
|
class: "w-2.5 h-2.5"
|
|
23
|
-
}), u),
|
|
28
|
+
}), u), a(e, n(f, {
|
|
24
29
|
get when() {
|
|
25
30
|
return r.items.length > 0;
|
|
26
31
|
},
|
|
27
32
|
get fallback() {
|
|
28
|
-
return
|
|
33
|
+
return C();
|
|
29
34
|
},
|
|
30
35
|
get children() {
|
|
31
|
-
return
|
|
36
|
+
return n($, {
|
|
32
37
|
get each() {
|
|
33
38
|
return r.items;
|
|
34
39
|
},
|
|
35
|
-
children: (
|
|
36
|
-
var
|
|
37
|
-
return
|
|
38
|
-
r.onSelect(
|
|
39
|
-
},
|
|
40
|
+
children: (t) => (() => {
|
|
41
|
+
var o = _(), i = o.firstChild;
|
|
42
|
+
return o.$$click = () => {
|
|
43
|
+
r.onSelect(t.type);
|
|
44
|
+
}, a(o, n(f, {
|
|
40
45
|
get when() {
|
|
41
|
-
return
|
|
46
|
+
return t.icon;
|
|
42
47
|
},
|
|
43
48
|
get fallback() {
|
|
44
|
-
return
|
|
49
|
+
return D();
|
|
45
50
|
},
|
|
46
|
-
children: (
|
|
47
|
-
const m =
|
|
48
|
-
return
|
|
51
|
+
children: (c) => {
|
|
52
|
+
const m = c();
|
|
53
|
+
return n(m, {
|
|
49
54
|
class: "w-4 h-4 text-[var(--floe-ink-soft)] flex-shrink-0"
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
|
-
}),
|
|
57
|
+
}), i), a(i, () => t.name), o;
|
|
53
58
|
})()
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
|
-
}), null), v((
|
|
57
|
-
var
|
|
58
|
-
return
|
|
61
|
+
}), null), v((t) => {
|
|
62
|
+
var o = w("fixed z-[9999] min-w-[180px] max-h-[320px] overflow-y-auto", "bg-popover border border-[var(--floe-line)] rounded-panel shadow-[var(--floe-elevation-float-strong)]", "animate-in fade-in slide-in-from-top-1 duration-[var(--floe-duration-fast)]", "p-1"), i = `${r.y}px`, c = `${r.x}px`;
|
|
63
|
+
return o !== t.e && h(e, t.e = o), i !== t.t && d(e, "top", t.t = i), c !== t.a && d(e, "left", t.a = c), t;
|
|
59
64
|
}, {
|
|
60
65
|
e: void 0,
|
|
61
66
|
t: void 0,
|
|
62
67
|
a: void 0
|
|
63
|
-
}),
|
|
68
|
+
}), e;
|
|
64
69
|
})()];
|
|
65
70
|
}
|
|
66
71
|
});
|
|
@@ -69,5 +74,5 @@ function N(r) {
|
|
|
69
74
|
}
|
|
70
75
|
g(["click", "contextmenu"]);
|
|
71
76
|
export {
|
|
72
|
-
|
|
77
|
+
M as DeckContextMenu
|
|
73
78
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { effect as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { effect as V, className as q, style as U, template as k, use as B } from "solid-js/web";
|
|
2
|
+
import { useContextMenuActions as N } from "../ui/ContextMenuActions.js";
|
|
3
|
+
import { onMount as P, onCleanup as _, createEffect as M } from "solid-js";
|
|
4
|
+
import { useTheme as $ } from "../../context/ThemeContext.js";
|
|
5
|
+
import { useResizeObserver as K } from "../../hooks/useResizeObserver.js";
|
|
6
|
+
import { resolveCodeEditorLanguageSpec as G } from "./languages.js";
|
|
7
|
+
import { applyFloeMonacoTheme as H } from "./monacoTheme.js";
|
|
8
|
+
import { ensureMonacoEnvironment as X } from "./monacoEnvironment.js";
|
|
9
|
+
import { loadMonacoEditorApi as Y } from "./monacoStandaloneRuntime.js";
|
|
10
|
+
var j = /* @__PURE__ */ k("<div>");
|
|
11
|
+
const A = {
|
|
11
12
|
readOnly: !0,
|
|
12
13
|
automaticLayout: !1,
|
|
13
14
|
minimap: {
|
|
@@ -19,99 +20,129 @@ const I = {
|
|
|
19
20
|
tabSize: 2,
|
|
20
21
|
fontFamily: "var(--font-mono)"
|
|
21
22
|
};
|
|
22
|
-
let
|
|
23
|
-
function
|
|
24
|
-
return t.Uri.parse(`inmemory://model/${
|
|
23
|
+
let J = 0;
|
|
24
|
+
function Q(t, f, c) {
|
|
25
|
+
return t.Uri.parse(`inmemory://model/${f}/${encodeURIComponent(c)}`);
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
if (!t || !
|
|
28
|
-
const
|
|
29
|
-
return !
|
|
27
|
+
function R(t, f) {
|
|
28
|
+
if (!t || !f) return "";
|
|
29
|
+
const c = t.getSelection();
|
|
30
|
+
return !c || c.isEmpty() ? "" : f.getValueInRange(c);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
const c =
|
|
33
|
-
let
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
const
|
|
37
|
-
const e =
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
editor:
|
|
41
|
-
model:
|
|
42
|
-
getValue: () =>
|
|
43
|
-
getSelectedText: () =>
|
|
44
|
-
focus: () =>
|
|
45
|
-
},
|
|
46
|
-
const e =
|
|
32
|
+
function se(t) {
|
|
33
|
+
const f = $(), c = N();
|
|
34
|
+
let m;
|
|
35
|
+
const O = ++J;
|
|
36
|
+
let s, o, i, h, p = null, E = 0;
|
|
37
|
+
const F = K(() => m), S = () => {
|
|
38
|
+
const e = f.resolvedTheme(), a = f.shellPreset();
|
|
39
|
+
s && H(s.editor, e, a);
|
|
40
|
+
}, y = () => !o || !i ? null : {
|
|
41
|
+
editor: o,
|
|
42
|
+
model: i,
|
|
43
|
+
getValue: () => o.getValue(),
|
|
44
|
+
getSelectedText: () => R(o, i),
|
|
45
|
+
focus: () => o.focus()
|
|
46
|
+
}, L = () => {
|
|
47
|
+
const e = y();
|
|
47
48
|
if (!e) return;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
const e =
|
|
49
|
+
const a = e.model.uri.toString();
|
|
50
|
+
a !== p && (p = a, t.onReady?.(e));
|
|
51
|
+
}, b = () => {
|
|
52
|
+
const e = y();
|
|
52
53
|
e && t.onSelectionChange?.(e.getSelectedText(), e);
|
|
53
|
-
},
|
|
54
|
-
if (!
|
|
55
|
-
const e = ++
|
|
56
|
-
let
|
|
54
|
+
}, I = async () => {
|
|
55
|
+
if (!o || !s) return;
|
|
56
|
+
const e = ++E, a = G(t.language);
|
|
57
|
+
let l = a.id;
|
|
57
58
|
try {
|
|
58
|
-
await
|
|
59
|
+
await a.load?.();
|
|
59
60
|
} catch {
|
|
60
|
-
if (e !==
|
|
61
|
-
|
|
61
|
+
if (e !== E) return;
|
|
62
|
+
l = "plaintext";
|
|
62
63
|
}
|
|
63
|
-
if (!
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
|
|
64
|
+
if (!o || e !== E) return;
|
|
65
|
+
const u = Q(s, O, t.path);
|
|
66
|
+
if (i && i.uri.toString() === u.toString()) {
|
|
67
|
+
i.getLanguageId() !== l && s.editor.setModelLanguage(i, l), i.getValue() !== t.value && i.setValue(t.value), L(), b();
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
70
|
+
const g = s.editor.createModel(t.value, l, u);
|
|
71
|
+
i?.dispose(), i = g, o.setModel(i), L(), b();
|
|
71
72
|
};
|
|
72
|
-
return
|
|
73
|
-
let e = !1,
|
|
73
|
+
return P(() => {
|
|
74
|
+
let e = !1, a, l, u, g = [], x = [];
|
|
74
75
|
(async () => {
|
|
75
|
-
if (!
|
|
76
|
+
if (!m || (X(), s = await Y(t.runtimeOptions), e || !m)) return;
|
|
77
|
+
o = s.editor.create(m, {
|
|
76
78
|
model: null,
|
|
77
|
-
...
|
|
79
|
+
...A,
|
|
78
80
|
...t.options ?? {}
|
|
79
|
-
}), S(), await T(), e || !n)) return;
|
|
80
|
-
const s = t.onContentChange, E = t.onChange, z = t.onSelectionChange;
|
|
81
|
-
i = n.onDidChangeModelContent((f) => {
|
|
82
|
-
const v = m();
|
|
83
|
-
v && (s?.(f, v), E && E(v.getValue()));
|
|
84
|
-
}), a = n.onDidChangeCursorSelection(() => {
|
|
85
|
-
const f = m();
|
|
86
|
-
f && z?.(f.getSelectedText(), f);
|
|
87
81
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
const r = m, T = r.getBoundingClientRect();
|
|
83
|
+
g = (c?.resolve({
|
|
84
|
+
target: r,
|
|
85
|
+
x: T.left,
|
|
86
|
+
y: T.top,
|
|
87
|
+
selection: ""
|
|
88
|
+
}) ?? []).map((n) => o.addAction({
|
|
89
|
+
id: n.id,
|
|
90
|
+
label: n.label,
|
|
91
|
+
contextMenuGroupId: "navigation",
|
|
92
|
+
contextMenuOrder: 0,
|
|
93
|
+
run: () => {
|
|
94
|
+
const d = x.find((C) => C.id === n.id);
|
|
95
|
+
d && !d.disabled && d.onSelect();
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
const v = (n) => {
|
|
99
|
+
if (n instanceof KeyboardEvent && n.key !== "ContextMenu" && !(n.shiftKey && n.key === "F10") || n instanceof MouseEvent && n.type === "pointerdown" && n.button !== 2) return;
|
|
100
|
+
const d = c?.claim(), C = r.getBoundingClientRect();
|
|
101
|
+
x = d?.actions ?? c?.resolve({
|
|
102
|
+
target: r,
|
|
103
|
+
x: n instanceof MouseEvent ? n.clientX : C.left + 8,
|
|
104
|
+
y: n instanceof MouseEvent ? n.clientY : C.top + 24,
|
|
105
|
+
selection: R(o, i)
|
|
106
|
+
}) ?? [];
|
|
107
|
+
};
|
|
108
|
+
if (r.addEventListener("pointerdown", v, !0), r.addEventListener("contextmenu", v, !0), r.addEventListener("keydown", v, !0), u = () => {
|
|
109
|
+
x = [], r.removeEventListener("pointerdown", v, !0), r.removeEventListener("contextmenu", v, !0), r.removeEventListener("keydown", v, !0);
|
|
110
|
+
}, S(), await I(), e || !o) return;
|
|
111
|
+
const z = t.onContentChange, w = t.onChange, D = t.onSelectionChange;
|
|
112
|
+
a = o.onDidChangeModelContent((n) => {
|
|
113
|
+
const d = y();
|
|
114
|
+
d && (z?.(n, d), w && w(d.getValue()));
|
|
115
|
+
}), l = o.onDidChangeCursorSelection(() => {
|
|
116
|
+
const n = y();
|
|
117
|
+
n && D?.(n.getSelectedText(), n);
|
|
118
|
+
});
|
|
119
|
+
})().catch((r) => {
|
|
120
|
+
console.error("Failed to initialize Monaco editor runtime", r);
|
|
121
|
+
}), _(() => {
|
|
122
|
+
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;
|
|
92
123
|
});
|
|
93
|
-
}),
|
|
124
|
+
}), M(() => {
|
|
94
125
|
S();
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
...
|
|
126
|
+
}), M(() => {
|
|
127
|
+
o && o.updateOptions({
|
|
128
|
+
...A,
|
|
98
129
|
...t.options ?? {}
|
|
99
130
|
});
|
|
100
|
-
}),
|
|
101
|
-
t.path, t.language, t.value,
|
|
102
|
-
}),
|
|
103
|
-
const e =
|
|
104
|
-
!e || !
|
|
105
|
-
|
|
131
|
+
}), M(() => {
|
|
132
|
+
t.path, t.language, t.value, I();
|
|
133
|
+
}), M(() => {
|
|
134
|
+
const e = F();
|
|
135
|
+
!e || !o || (h && cancelAnimationFrame(h), h = requestAnimationFrame(() => {
|
|
136
|
+
o?.layout({
|
|
106
137
|
width: e.width,
|
|
107
138
|
height: e.height
|
|
108
139
|
});
|
|
109
140
|
}));
|
|
110
141
|
}), (() => {
|
|
111
|
-
var e =
|
|
112
|
-
return typeof
|
|
113
|
-
var
|
|
114
|
-
return
|
|
142
|
+
var e = j(), a = m;
|
|
143
|
+
return typeof a == "function" ? B(a, e) : m = e, V((l) => {
|
|
144
|
+
var u = t.class, g = t.style;
|
|
145
|
+
return u !== l.e && q(e, l.e = u), l.t = U(e, g, l.t), l;
|
|
115
146
|
}, {
|
|
116
147
|
e: void 0,
|
|
117
148
|
t: void 0
|
|
@@ -119,5 +150,5 @@ function Y(t) {
|
|
|
119
150
|
})();
|
|
120
151
|
}
|
|
121
152
|
export {
|
|
122
|
-
|
|
153
|
+
se as CodeEditor
|
|
123
154
|
};
|