@floegence/floe-webapp-core 0.35.17 → 0.35.19

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,13 +1,14 @@
1
- import { use as R, effect as L, className as D, style as O, template as V } from "solid-js/web";
2
- import { onMount as b, createEffect as g, onCleanup as q } from "solid-js";
3
- import { useTheme as A } from "../../context/ThemeContext.js";
4
- import { useResizeObserver as F } from "../../hooks/useResizeObserver.js";
1
+ import { use as L, effect as D, className as F, style as O, template as V } from "solid-js/web";
2
+ import { onMount as b, onCleanup as p, createEffect as g } from "solid-js";
3
+ import { useTheme as q } from "../../context/ThemeContext.js";
4
+ import { useResizeObserver as w } from "../../hooks/useResizeObserver.js";
5
5
  import * as f from "monaco-editor/esm/vs/editor/editor.api.js";
6
6
  import "monaco-editor/min/vs/editor/editor.main.css";
7
- import { resolveCodeEditorLanguageSpec as U } from "./languages.js";
8
- import { ensureMonacoEnvironment as p } from "./monacoEnvironment.js";
9
- var z = /* @__PURE__ */ V("<div>");
10
- const M = {
7
+ import { resolveCodeEditorLanguageSpec as A } from "./languages.js";
8
+ import { ensureMonacoEnvironment as U } from "./monacoEnvironment.js";
9
+ import { ensureMonacoStandaloneRuntime as N } from "./monacoStandaloneRuntime.js";
10
+ var _ = /* @__PURE__ */ V("<div>");
11
+ const E = {
11
12
  readOnly: !0,
12
13
  automaticLayout: !1,
13
14
  minimap: {
@@ -19,100 +20,104 @@ const M = {
19
20
  tabSize: 2,
20
21
  fontFamily: "var(--font-mono)"
21
22
  };
22
- let w = 0;
23
- function N(e, c) {
24
- return f.Uri.parse(`inmemory://model/${e}/${encodeURIComponent(c)}`);
23
+ let $ = 0;
24
+ function k(t, c) {
25
+ return f.Uri.parse(`inmemory://model/${t}/${encodeURIComponent(c)}`);
25
26
  }
26
- function _(e, c) {
27
- if (!e || !c) return "";
28
- const r = e.getSelection();
27
+ function B(t, c) {
28
+ if (!t || !c) return "";
29
+ const r = t.getSelection();
29
30
  return !r || r.isEmpty() ? "" : c.getValueInRange(r);
30
31
  }
31
- function J(e) {
32
- const c = A();
32
+ function X(t) {
33
+ const c = q();
33
34
  let r;
34
- const x = ++w;
35
+ const R = ++$;
35
36
  let n, o, s, S = null, v = 0;
36
- const E = F(() => r), y = () => {
37
+ const x = w(() => r), y = () => {
37
38
  f.editor.setTheme(c.resolvedTheme() === "dark" ? "vs-dark" : "vs");
38
39
  }, m = () => !n || !o ? null : {
39
40
  editor: n,
40
41
  model: o,
41
42
  getValue: () => n.getValue(),
42
- getSelectedText: () => _(n, o),
43
+ getSelectedText: () => B(n, o),
43
44
  focus: () => n.focus()
44
45
  }, C = () => {
45
- const t = m();
46
- if (!t) return;
47
- const a = t.model.uri.toString();
48
- a !== S && (S = a, e.onReady?.(t));
49
- }, I = () => {
50
- const t = m();
51
- t && e.onSelectionChange?.(t.getSelectedText(), t);
52
- }, T = async () => {
46
+ const e = m();
47
+ if (!e) return;
48
+ const a = e.model.uri.toString();
49
+ a !== S && (S = a, t.onReady?.(e));
50
+ }, M = () => {
51
+ const e = m();
52
+ e && t.onSelectionChange?.(e.getSelectedText(), e);
53
+ }, I = async () => {
53
54
  if (!n) return;
54
- const t = ++v, a = U(e.language);
55
+ const e = ++v, a = A(t.language);
55
56
  let i = a.id;
56
57
  try {
57
58
  await a.load?.();
58
59
  } catch {
59
- if (t !== v) return;
60
+ if (e !== v) return;
60
61
  i = "plaintext";
61
62
  }
62
- if (!n || t !== v) return;
63
- const l = N(x, e.path);
64
- if (o && o.uri.toString() === l.toString()) {
65
- o.getLanguageId() !== i && f.editor.setModelLanguage(o, i), o.getValue() !== e.value && o.setValue(e.value), C(), I();
63
+ if (!n || e !== v) return;
64
+ const d = k(R, t.path);
65
+ if (o && o.uri.toString() === d.toString()) {
66
+ o.getLanguageId() !== i && f.editor.setModelLanguage(o, i), o.getValue() !== t.value && o.setValue(t.value), C(), M();
66
67
  return;
67
68
  }
68
- const d = f.editor.createModel(e.value, i, l);
69
- o?.dispose(), o = d, n.setModel(o), C(), I();
69
+ const l = f.editor.createModel(t.value, i, d);
70
+ o?.dispose(), o = l, n.setModel(o), C(), M();
70
71
  };
71
72
  return b(() => {
72
- if (!r) return;
73
- p(), n = f.editor.create(r, {
74
- model: null,
75
- ...M,
76
- ...e.options ?? {}
77
- }), y(), T();
78
- const t = e.onContentChange, a = e.onChange, i = e.onSelectionChange, l = n.onDidChangeModelContent((u) => {
79
- const h = m();
80
- h && (t?.(u, h), a && a(h.getValue()));
81
- }), d = n.onDidChangeCursorSelection(() => {
82
- const u = m();
83
- u && i?.(u.getSelectedText(), u);
84
- });
85
- q(() => {
86
- l.dispose(), d.dispose(), s && cancelAnimationFrame(s), n?.dispose(), o?.dispose(), n = void 0, o = void 0;
73
+ let e = !1, a, i;
74
+ (async () => {
75
+ if (!r || (U(), await N(), e || !r) || (n = f.editor.create(r, {
76
+ model: null,
77
+ ...E,
78
+ ...t.options ?? {}
79
+ }), y(), await I(), e || !n)) return;
80
+ const l = t.onContentChange, T = t.onChange, z = t.onSelectionChange;
81
+ a = n.onDidChangeModelContent((u) => {
82
+ const h = m();
83
+ h && (l?.(u, h), T && T(h.getValue()));
84
+ }), i = n.onDidChangeCursorSelection(() => {
85
+ const u = m();
86
+ u && z?.(u.getSelectedText(), u);
87
+ });
88
+ })().catch((l) => {
89
+ console.error("Failed to initialize Monaco editor runtime", l);
90
+ }), p(() => {
91
+ e = !0, a?.dispose(), i?.dispose(), s && cancelAnimationFrame(s), n?.dispose(), o?.dispose(), n = void 0, o = void 0;
87
92
  });
88
93
  }), g(() => {
89
94
  y();
90
95
  }), g(() => {
91
96
  n && n.updateOptions({
92
- ...M,
93
- ...e.options ?? {}
97
+ ...E,
98
+ ...t.options ?? {}
94
99
  });
95
100
  }), g(() => {
96
- e.path, e.language, e.value, T();
101
+ t.path, t.language, t.value, I();
97
102
  }), g(() => {
98
- const t = E();
99
- !t || !n || (s && cancelAnimationFrame(s), s = requestAnimationFrame(() => {
103
+ const e = x();
104
+ !e || !n || (s && cancelAnimationFrame(s), s = requestAnimationFrame(() => {
100
105
  n?.layout({
101
- width: t.width,
102
- height: t.height
106
+ width: e.width,
107
+ height: e.height
103
108
  });
104
109
  }));
105
110
  }), (() => {
106
- var t = z(), a = r;
107
- return typeof a == "function" ? R(a, t) : r = t, L((i) => {
108
- var l = e.class, d = e.style;
109
- return l !== i.e && D(t, i.e = l), i.t = O(t, d, i.t), i;
111
+ var e = _(), a = r;
112
+ return typeof a == "function" ? L(a, e) : r = e, D((i) => {
113
+ var d = t.class, l = t.style;
114
+ return d !== i.e && F(e, i.e = d), i.t = O(e, l, i.t), i;
110
115
  }, {
111
116
  e: void 0,
112
117
  t: void 0
113
- }), t;
118
+ }), e;
114
119
  })();
115
120
  }
116
121
  export {
117
- J as CodeEditor
122
+ X as CodeEditor
118
123
  };
@@ -44,8 +44,8 @@ const s = {
44
44
  svelte: "plaintext",
45
45
  groovy: "plaintext"
46
46
  }, n = {
47
- javascript: () => import("monaco-editor/esm/vs/language/typescript/monaco.contribution.js"),
48
- typescript: () => import("monaco-editor/esm/vs/language/typescript/monaco.contribution.js"),
47
+ javascript: () => import("monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution.js"),
48
+ typescript: () => import("monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution.js"),
49
49
  json: () => import("monaco-editor/esm/vs/language/json/monaco.contribution.js"),
50
50
  html: () => import("monaco-editor/esm/vs/language/html/monaco.contribution.js"),
51
51
  css: () => import("monaco-editor/esm/vs/language/css/monaco.contribution.js"),
@@ -0,0 +1,4 @@
1
+ type MonacoStandaloneRuntimeLoader = () => Promise<unknown>;
2
+ export declare function createMonacoStandaloneRuntime(loader: MonacoStandaloneRuntimeLoader): () => Promise<void>;
3
+ export declare const ensureMonacoStandaloneRuntime: () => Promise<void>;
4
+ export {};
@@ -0,0 +1,21 @@
1
+ function e(t) {
2
+ let n = null;
3
+ return () => n || (n = t().then(() => {
4
+ }).catch((o) => {
5
+ throw n = null, o;
6
+ }), n);
7
+ }
8
+ function r() {
9
+ return Promise.all([
10
+ import("monaco-editor/esm/vs/editor/edcore.main.js"),
11
+ import("monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory.js"),
12
+ import("monaco-editor/esm/vs/editor/contrib/codelens/browser/codeLensCache.js"),
13
+ import("monaco-editor/esm/vs/editor/common/services/treeViewsDndService.js"),
14
+ import("monaco-editor/esm/vs/platform/actionWidget/browser/actionWidget.js")
15
+ ]);
16
+ }
17
+ const i = e(r);
18
+ export {
19
+ e as createMonacoStandaloneRuntime,
20
+ i as ensureMonacoStandaloneRuntime
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.35.17",
3
+ "version": "0.35.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",