@reifydb/console 0.4.2 → 0.4.7
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/index.d.ts +7 -4
- package/dist/index.js +234 -97
- package/dist/index.js.map +1 -1
- package/dist/styles.css +108 -85
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { Diagnostic } from '@reifydb/core';
|
|
3
2
|
import * as monaco_editor from 'monaco-editor';
|
|
4
|
-
import {
|
|
3
|
+
import { editor, languages } from 'monaco-editor';
|
|
4
|
+
export { editor } from 'monaco-editor';
|
|
5
|
+
import { Diagnostic } from '@reifydb/core';
|
|
5
6
|
|
|
6
7
|
interface ExecutionResult {
|
|
7
8
|
success: boolean;
|
|
@@ -35,8 +36,9 @@ interface ConsoleProps {
|
|
|
35
36
|
historyKey?: string;
|
|
36
37
|
connection?: ConnectionConfig;
|
|
37
38
|
theme?: RdbTheme;
|
|
39
|
+
monacoTheme?: string | editor.IStandaloneThemeData;
|
|
38
40
|
}
|
|
39
|
-
declare function Console({ executor, initialCode, historyKey, connection, theme }: ConsoleProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare function Console({ executor, initialCode, historyKey, connection, theme, monacoTheme }: ConsoleProps): react_jsx_runtime.JSX.Element;
|
|
40
42
|
|
|
41
43
|
interface SnippetProps {
|
|
42
44
|
executor: Executor;
|
|
@@ -45,8 +47,9 @@ interface SnippetProps {
|
|
|
45
47
|
description?: string;
|
|
46
48
|
className?: string;
|
|
47
49
|
theme?: RdbTheme;
|
|
50
|
+
monacoTheme?: string | editor.IStandaloneThemeData;
|
|
48
51
|
}
|
|
49
|
-
declare function Snippet({ executor, initialCode, title, description, className, theme, }: SnippetProps): react_jsx_runtime.JSX.Element;
|
|
52
|
+
declare function Snippet({ executor, initialCode, title, description, className, theme, monacoTheme, }: SnippetProps): react_jsx_runtime.JSX.Element;
|
|
50
53
|
|
|
51
54
|
interface WasmDB {
|
|
52
55
|
admin(rql: string): Promise<unknown> | unknown;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/Console.tsx
|
|
2
|
-
import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef4, useState as useState5 } from "react";
|
|
2
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState5 } from "react";
|
|
3
3
|
import { Client } from "@reifydb/client";
|
|
4
4
|
|
|
5
5
|
// src/executor/ws-executor.ts
|
|
@@ -538,21 +538,21 @@ var brutalistLightTheme = {
|
|
|
538
538
|
base: "vs",
|
|
539
539
|
inherit: true,
|
|
540
540
|
rules: [
|
|
541
|
-
{ token: "keyword", foreground: "
|
|
541
|
+
{ token: "keyword", foreground: "6366F1", fontStyle: "bold" },
|
|
542
542
|
{ token: "string", foreground: "16A34A" },
|
|
543
543
|
{ token: "string.quote", foreground: "16A34A" },
|
|
544
544
|
{ token: "number", foreground: "B91C1C", fontStyle: "bold" },
|
|
545
545
|
{ token: "comment", foreground: "6B7280", fontStyle: "italic" },
|
|
546
546
|
{ token: "operator", foreground: "383838" },
|
|
547
547
|
{ token: "identifier", foreground: "1A1A1A" },
|
|
548
|
-
{ token: "key", foreground: "
|
|
548
|
+
{ token: "key", foreground: "6366F1", fontStyle: "bold" }
|
|
549
549
|
],
|
|
550
550
|
colors: {
|
|
551
551
|
"editor.background": "#FFFFFF",
|
|
552
552
|
"editor.foreground": "#1A1A1A",
|
|
553
553
|
"editor.lineHighlightBackground": "#F8F8F7",
|
|
554
|
-
"editor.selectionBackground": "#
|
|
555
|
-
"editorCursor.foreground": "#
|
|
554
|
+
"editor.selectionBackground": "#818CF840",
|
|
555
|
+
"editorCursor.foreground": "#818CF8",
|
|
556
556
|
"editorLineNumber.foreground": "#9CA3AF",
|
|
557
557
|
"editorLineNumber.activeForeground": "#383838"
|
|
558
558
|
}
|
|
@@ -561,7 +561,7 @@ var brutalistDarkTheme = {
|
|
|
561
561
|
base: "vs-dark",
|
|
562
562
|
inherit: true,
|
|
563
563
|
rules: [
|
|
564
|
-
{ token: "keyword", foreground: "
|
|
564
|
+
{ token: "keyword", foreground: "818CF8", fontStyle: "bold" },
|
|
565
565
|
{ token: "string", foreground: "4ADE80" },
|
|
566
566
|
{ token: "string.quote", foreground: "4ADE80" },
|
|
567
567
|
{ token: "number", foreground: "F87171", fontStyle: "bold" },
|
|
@@ -574,8 +574,8 @@ var brutalistDarkTheme = {
|
|
|
574
574
|
"editor.background": "#1A1A1A",
|
|
575
575
|
"editor.foreground": "#F3F4F6",
|
|
576
576
|
"editor.lineHighlightBackground": "#2A2A2A",
|
|
577
|
-
"editor.selectionBackground": "#
|
|
578
|
-
"editorCursor.foreground": "#
|
|
577
|
+
"editor.selectionBackground": "#818CF830",
|
|
578
|
+
"editorCursor.foreground": "#818CF8",
|
|
579
579
|
"editorLineNumber.foreground": "#6B7280",
|
|
580
580
|
"editorLineNumber.activeForeground": "#E5E7EB"
|
|
581
581
|
}
|
|
@@ -584,21 +584,21 @@ var premiumLightTheme = {
|
|
|
584
584
|
base: "vs",
|
|
585
585
|
inherit: true,
|
|
586
586
|
rules: [
|
|
587
|
-
{ token: "keyword", foreground: "
|
|
587
|
+
{ token: "keyword", foreground: "6366F1", fontStyle: "bold" },
|
|
588
588
|
{ token: "string", foreground: "059669" },
|
|
589
589
|
{ token: "string.quote", foreground: "059669" },
|
|
590
590
|
{ token: "number", foreground: "DB2777", fontStyle: "bold" },
|
|
591
591
|
{ token: "comment", foreground: "9CA3AF", fontStyle: "italic" },
|
|
592
592
|
{ token: "operator", foreground: "525252" },
|
|
593
593
|
{ token: "identifier", foreground: "1A1A1A" },
|
|
594
|
-
{ token: "key", foreground: "
|
|
594
|
+
{ token: "key", foreground: "6366F1", fontStyle: "bold" }
|
|
595
595
|
],
|
|
596
596
|
colors: {
|
|
597
597
|
"editor.background": "#FFFFFF",
|
|
598
598
|
"editor.foreground": "#1A1A1A",
|
|
599
599
|
"editor.lineHighlightBackground": "#F5F5F5",
|
|
600
|
-
"editor.selectionBackground": "#
|
|
601
|
-
"editorCursor.foreground": "#
|
|
600
|
+
"editor.selectionBackground": "#818CF840",
|
|
601
|
+
"editorCursor.foreground": "#6366F1",
|
|
602
602
|
"editorLineNumber.foreground": "#9CA3AF",
|
|
603
603
|
"editorLineNumber.activeForeground": "#525252"
|
|
604
604
|
}
|
|
@@ -607,23 +607,23 @@ var premiumDarkTheme = {
|
|
|
607
607
|
base: "vs-dark",
|
|
608
608
|
inherit: true,
|
|
609
609
|
rules: [
|
|
610
|
-
{ token: "keyword", foreground: "
|
|
611
|
-
{ token: "string", foreground: "
|
|
612
|
-
{ token: "string.quote", foreground: "
|
|
613
|
-
{ token: "number", foreground: "
|
|
614
|
-
{ token: "comment", foreground: "
|
|
615
|
-
{ token: "operator", foreground: "
|
|
616
|
-
{ token: "identifier", foreground: "
|
|
617
|
-
{ token: "key", foreground: "
|
|
610
|
+
{ token: "keyword", foreground: "818cf8", fontStyle: "bold" },
|
|
611
|
+
{ token: "string", foreground: "22d3ee" },
|
|
612
|
+
{ token: "string.quote", foreground: "22d3ee" },
|
|
613
|
+
{ token: "number", foreground: "22d3ee", fontStyle: "bold" },
|
|
614
|
+
{ token: "comment", foreground: "666666", fontStyle: "italic" },
|
|
615
|
+
{ token: "operator", foreground: "A0A0A0" },
|
|
616
|
+
{ token: "identifier", foreground: "F0F0F0" },
|
|
617
|
+
{ token: "key", foreground: "818cf8", fontStyle: "bold" }
|
|
618
618
|
],
|
|
619
619
|
colors: {
|
|
620
|
-
"editor.background": "#
|
|
621
|
-
"editor.foreground": "#
|
|
622
|
-
"editor.lineHighlightBackground": "#
|
|
623
|
-
"editor.selectionBackground": "#
|
|
624
|
-
"editorCursor.foreground": "#
|
|
625
|
-
"editorLineNumber.foreground": "#
|
|
626
|
-
"editorLineNumber.activeForeground": "#
|
|
620
|
+
"editor.background": "#1a1a1a",
|
|
621
|
+
"editor.foreground": "#F0F0F0",
|
|
622
|
+
"editor.lineHighlightBackground": "#222222",
|
|
623
|
+
"editor.selectionBackground": "#818cf840",
|
|
624
|
+
"editorCursor.foreground": "#818cf8",
|
|
625
|
+
"editorLineNumber.foreground": "#666666",
|
|
626
|
+
"editorLineNumber.activeForeground": "#A0A0A0"
|
|
627
627
|
}
|
|
628
628
|
};
|
|
629
629
|
|
|
@@ -643,10 +643,11 @@ function registerRqlLanguage(monaco) {
|
|
|
643
643
|
|
|
644
644
|
// src/components/editor/QueryEditor.tsx
|
|
645
645
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
646
|
-
function QueryEditor({ code, onChange, onRun, theme = "light" }) {
|
|
646
|
+
function QueryEditor({ code, onChange, onRun, theme = "light", monacoThemeName, monacoThemeData }) {
|
|
647
647
|
const editorRef = useRef2(null);
|
|
648
648
|
const onRunRef = useRef2(onRun);
|
|
649
649
|
onRunRef.current = onRun;
|
|
650
|
+
const resolvedTheme = monacoThemeName ?? (theme === "light" ? "premium-light" : "premium-dark");
|
|
650
651
|
const handleMount = (editor, monaco) => {
|
|
651
652
|
editorRef.current = editor;
|
|
652
653
|
registerRqlLanguage(monaco);
|
|
@@ -661,13 +662,16 @@ function QueryEditor({ code, onChange, onRun, theme = "light" }) {
|
|
|
661
662
|
};
|
|
662
663
|
const handleBeforeMount = (monaco) => {
|
|
663
664
|
registerRqlLanguage(monaco);
|
|
665
|
+
if (monacoThemeName && monacoThemeData) {
|
|
666
|
+
monaco.editor.defineTheme(monacoThemeName, monacoThemeData);
|
|
667
|
+
}
|
|
664
668
|
};
|
|
665
669
|
return /* @__PURE__ */ jsx4(
|
|
666
670
|
Editor,
|
|
667
671
|
{
|
|
668
672
|
height: "100%",
|
|
669
673
|
language: "rql",
|
|
670
|
-
theme:
|
|
674
|
+
theme: resolvedTheme,
|
|
671
675
|
value: code,
|
|
672
676
|
onChange: (value) => onChange(value || ""),
|
|
673
677
|
beforeMount: handleBeforeMount,
|
|
@@ -739,7 +743,7 @@ function EditorToolbar({
|
|
|
739
743
|
className: "rdb-editor-toolbar__btn rdb-editor-toolbar__btn--secondary",
|
|
740
744
|
onClick: onClear,
|
|
741
745
|
disabled: isExecuting,
|
|
742
|
-
children: "
|
|
746
|
+
children: "Clear"
|
|
743
747
|
}
|
|
744
748
|
),
|
|
745
749
|
/* @__PURE__ */ jsx5(
|
|
@@ -748,7 +752,7 @@ function EditorToolbar({
|
|
|
748
752
|
className: "rdb-editor-toolbar__btn",
|
|
749
753
|
onClick: onRun,
|
|
750
754
|
disabled: isExecuting,
|
|
751
|
-
children: isExecuting ? "
|
|
755
|
+
children: isExecuting ? "Running..." : "Run"
|
|
752
756
|
}
|
|
753
757
|
)
|
|
754
758
|
] })
|
|
@@ -1466,7 +1470,7 @@ var TABS = [
|
|
|
1466
1470
|
{ id: "schema", label: "Schema" }
|
|
1467
1471
|
];
|
|
1468
1472
|
var WS_URL_STORAGE_KEY = "rdb-console-ws-url";
|
|
1469
|
-
function ConsoleInner({ executor, historyKey, connection, theme = "light" }) {
|
|
1473
|
+
function ConsoleInner({ executor, historyKey, connection, theme = "light", monacoTheme }) {
|
|
1470
1474
|
const { state, dispatch } = useConsoleStore();
|
|
1471
1475
|
const connectionLocked = connection != null;
|
|
1472
1476
|
const lockedWsUrl = connection?.mode === "websocket" ? connection.url : null;
|
|
@@ -1602,6 +1606,15 @@ function ConsoleInner({ executor, historyKey, connection, theme = "light" }) {
|
|
|
1602
1606
|
}
|
|
1603
1607
|
setConnectionMode(mode);
|
|
1604
1608
|
}, [connectionMode, executor]);
|
|
1609
|
+
const resolvedMonacoThemeName = useMemo(() => {
|
|
1610
|
+
if (!monacoTheme) return void 0;
|
|
1611
|
+
if (typeof monacoTheme === "string") return monacoTheme;
|
|
1612
|
+
return "rdb-custom";
|
|
1613
|
+
}, [monacoTheme]);
|
|
1614
|
+
const resolvedMonacoThemeData = useMemo(() => {
|
|
1615
|
+
if (!monacoTheme || typeof monacoTheme === "string") return void 0;
|
|
1616
|
+
return monacoTheme;
|
|
1617
|
+
}, [monacoTheme]);
|
|
1605
1618
|
const connectionLabel = connectionMode === "wasm" ? "wasm" : wsUrl;
|
|
1606
1619
|
const handleRun = useCallback3(async () => {
|
|
1607
1620
|
if (state.isExecuting || !state.code.trim()) return;
|
|
@@ -1666,7 +1679,9 @@ function ConsoleInner({ executor, historyKey, connection, theme = "light" }) {
|
|
|
1666
1679
|
code: state.code,
|
|
1667
1680
|
onChange: (code) => dispatch({ type: "SET_CODE", code }),
|
|
1668
1681
|
onRun: handleRun,
|
|
1669
|
-
theme
|
|
1682
|
+
theme,
|
|
1683
|
+
monacoThemeName: resolvedMonacoThemeName,
|
|
1684
|
+
monacoThemeData: resolvedMonacoThemeData
|
|
1670
1685
|
}
|
|
1671
1686
|
) })
|
|
1672
1687
|
] });
|
|
@@ -1683,12 +1698,12 @@ function ConsoleInner({ executor, historyKey, connection, theme = "light" }) {
|
|
|
1683
1698
|
] });
|
|
1684
1699
|
return /* @__PURE__ */ jsx16("div", { className: `rdb-console${theme === "light" ? " rdb-theme-light" : ""}`, children: /* @__PURE__ */ jsx16("div", { className: "rdb-console__main", children: /* @__PURE__ */ jsx16(SplitPane, { top: editorPane, bottom: bottomPane, initialSplit: 45 }) }) });
|
|
1685
1700
|
}
|
|
1686
|
-
function Console({ executor, initialCode, historyKey, connection, theme }) {
|
|
1687
|
-
return /* @__PURE__ */ jsx16(ConsoleProvider, { initialCode, children: /* @__PURE__ */ jsx16(ConsoleInner, { executor, historyKey, connection, theme }) });
|
|
1701
|
+
function Console({ executor, initialCode, historyKey, connection, theme, monacoTheme }) {
|
|
1702
|
+
return /* @__PURE__ */ jsx16(ConsoleProvider, { initialCode, children: /* @__PURE__ */ jsx16(ConsoleInner, { executor, historyKey, connection, theme, monacoTheme }) });
|
|
1688
1703
|
}
|
|
1689
1704
|
|
|
1690
1705
|
// src/components/Snippet.tsx
|
|
1691
|
-
import { useState as useState6, useCallback as useCallback4, useEffect as useEffect5, useRef as useRef5 } from "react";
|
|
1706
|
+
import { useState as useState6, useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef5 } from "react";
|
|
1692
1707
|
import Editor2 from "@monaco-editor/react";
|
|
1693
1708
|
|
|
1694
1709
|
// src/components/SnippetResults.tsx
|
|
@@ -1726,14 +1741,15 @@ function SnippetResults({ data, columns, maxKeyLength }) {
|
|
|
1726
1741
|
}
|
|
1727
1742
|
|
|
1728
1743
|
// src/components/Snippet.tsx
|
|
1729
|
-
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1744
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1730
1745
|
function Snippet({
|
|
1731
1746
|
executor,
|
|
1732
1747
|
initialCode,
|
|
1733
1748
|
title = "reifydb playground",
|
|
1734
1749
|
description,
|
|
1735
1750
|
className,
|
|
1736
|
-
theme = "light"
|
|
1751
|
+
theme = "light",
|
|
1752
|
+
monacoTheme
|
|
1737
1753
|
}) {
|
|
1738
1754
|
const [code, setCode] = useState6(initialCode);
|
|
1739
1755
|
const [result, setResult] = useState6(null);
|
|
@@ -1741,22 +1757,34 @@ function Snippet({
|
|
|
1741
1757
|
const [copied, setCopied] = useState6(false);
|
|
1742
1758
|
const [isFullscreen, setIsFullscreen] = useState6(false);
|
|
1743
1759
|
const editorRef = useRef5(null);
|
|
1760
|
+
const containerRef = useRef5(null);
|
|
1744
1761
|
const handleRunRef = useRef5(() => {
|
|
1745
1762
|
});
|
|
1763
|
+
const resolvedMonacoThemeName = useMemo2(() => {
|
|
1764
|
+
if (!monacoTheme) return void 0;
|
|
1765
|
+
if (typeof monacoTheme === "string") return monacoTheme;
|
|
1766
|
+
return "rdb-custom";
|
|
1767
|
+
}, [monacoTheme]);
|
|
1768
|
+
const resolvedMonacoThemeData = useMemo2(() => {
|
|
1769
|
+
if (!monacoTheme || typeof monacoTheme === "string") return void 0;
|
|
1770
|
+
return monacoTheme;
|
|
1771
|
+
}, [monacoTheme]);
|
|
1772
|
+
const resolvedTheme = resolvedMonacoThemeName ?? (theme === "light" ? "premium-light" : "premium-dark");
|
|
1746
1773
|
const lineCount = code.split("\n").length;
|
|
1747
1774
|
const editorHeight = Math.max(lineCount * 20 + 16, 80);
|
|
1775
|
+
const toggleFullscreen = useCallback4(() => {
|
|
1776
|
+
if (!containerRef.current) return;
|
|
1777
|
+
if (!document.fullscreenElement) {
|
|
1778
|
+
containerRef.current.requestFullscreen();
|
|
1779
|
+
} else {
|
|
1780
|
+
document.exitFullscreen();
|
|
1781
|
+
}
|
|
1782
|
+
}, []);
|
|
1748
1783
|
useEffect5(() => {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
document.addEventListener("keydown", handleEsc);
|
|
1754
|
-
document.body.style.overflow = "hidden";
|
|
1755
|
-
return () => {
|
|
1756
|
-
document.removeEventListener("keydown", handleEsc);
|
|
1757
|
-
document.body.style.overflow = "";
|
|
1758
|
-
};
|
|
1759
|
-
}, [isFullscreen]);
|
|
1784
|
+
const onFsChange = () => setIsFullscreen(!!document.fullscreenElement);
|
|
1785
|
+
document.addEventListener("fullscreenchange", onFsChange);
|
|
1786
|
+
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
1787
|
+
}, []);
|
|
1760
1788
|
const handleRun = useCallback4(async () => {
|
|
1761
1789
|
if (isExecuting) return;
|
|
1762
1790
|
setResult(null);
|
|
@@ -1799,10 +1827,13 @@ function Snippet({
|
|
|
1799
1827
|
};
|
|
1800
1828
|
const handleBeforeMount = (monaco) => {
|
|
1801
1829
|
registerRqlLanguage(monaco);
|
|
1830
|
+
if (resolvedMonacoThemeName && resolvedMonacoThemeData) {
|
|
1831
|
+
monaco.editor.defineTheme(resolvedMonacoThemeName, resolvedMonacoThemeData);
|
|
1832
|
+
}
|
|
1802
1833
|
};
|
|
1803
1834
|
const columns = result?.data && result.data.length > 0 ? Object.keys(result.data[0]) : [];
|
|
1804
1835
|
const maxKeyLength = columns.length > 0 ? Math.max(...columns.map((c) => c.length)) : 0;
|
|
1805
|
-
const content = /* @__PURE__ */ jsxs13("div", { className: `rdb-snippet${isFullscreen ? " rdb-snippet--fullscreen" : ""}${theme === "light" ? " rdb-theme-light" : ""}${className ? ` ${className}` : ""}`, children: [
|
|
1836
|
+
const content = /* @__PURE__ */ jsxs13("div", { ref: containerRef, className: `rdb-snippet${isFullscreen ? " rdb-snippet--fullscreen" : ""}${theme === "light" ? " rdb-theme-light" : ""}${className ? ` ${className}` : ""}`, children: [
|
|
1806
1837
|
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__header", children: [
|
|
1807
1838
|
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__title", children: [
|
|
1808
1839
|
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__title-marker", children: "$" }),
|
|
@@ -1813,10 +1844,26 @@ function Snippet({
|
|
|
1813
1844
|
/* @__PURE__ */ jsx18(
|
|
1814
1845
|
"button",
|
|
1815
1846
|
{
|
|
1816
|
-
onClick:
|
|
1847
|
+
onClick: toggleFullscreen,
|
|
1817
1848
|
className: "rdb-snippet__action-btn",
|
|
1818
1849
|
title: isFullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
1819
|
-
children: isFullscreen ?
|
|
1850
|
+
children: isFullscreen ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
1851
|
+
/* @__PURE__ */ jsxs13("svg", { className: "rdb-snippet__action-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1852
|
+
/* @__PURE__ */ jsx18("polyline", { points: "4 14 10 14 10 20" }),
|
|
1853
|
+
/* @__PURE__ */ jsx18("polyline", { points: "20 10 14 10 14 4" }),
|
|
1854
|
+
/* @__PURE__ */ jsx18("line", { x1: "14", y1: "10", x2: "21", y2: "3" }),
|
|
1855
|
+
/* @__PURE__ */ jsx18("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
1856
|
+
] }),
|
|
1857
|
+
"Exit"
|
|
1858
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
1859
|
+
/* @__PURE__ */ jsxs13("svg", { className: "rdb-snippet__action-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1860
|
+
/* @__PURE__ */ jsx18("polyline", { points: "15 3 21 3 21 9" }),
|
|
1861
|
+
/* @__PURE__ */ jsx18("polyline", { points: "9 21 3 21 3 15" }),
|
|
1862
|
+
/* @__PURE__ */ jsx18("line", { x1: "21", y1: "3", x2: "14", y2: "10" }),
|
|
1863
|
+
/* @__PURE__ */ jsx18("line", { x1: "3", y1: "21", x2: "10", y2: "14" })
|
|
1864
|
+
] }),
|
|
1865
|
+
"Expand"
|
|
1866
|
+
] })
|
|
1820
1867
|
}
|
|
1821
1868
|
),
|
|
1822
1869
|
/* @__PURE__ */ jsx18(
|
|
@@ -1825,16 +1872,31 @@ function Snippet({
|
|
|
1825
1872
|
onClick: handleCopy,
|
|
1826
1873
|
className: "rdb-snippet__action-btn",
|
|
1827
1874
|
title: "Copy code",
|
|
1828
|
-
children: copied ?
|
|
1875
|
+
children: copied ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
1876
|
+
/* @__PURE__ */ jsx18("svg", { className: "rdb-snippet__action-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx18("polyline", { points: "20 6 9 17 4 12" }) }),
|
|
1877
|
+
"Copied"
|
|
1878
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
1879
|
+
/* @__PURE__ */ jsxs13("svg", { className: "rdb-snippet__action-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1880
|
+
/* @__PURE__ */ jsx18("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
1881
|
+
/* @__PURE__ */ jsx18("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
1882
|
+
] }),
|
|
1883
|
+
"Copy"
|
|
1884
|
+
] })
|
|
1829
1885
|
}
|
|
1830
1886
|
),
|
|
1831
|
-
/* @__PURE__ */
|
|
1887
|
+
/* @__PURE__ */ jsxs13(
|
|
1832
1888
|
"button",
|
|
1833
1889
|
{
|
|
1834
1890
|
onClick: handleReset,
|
|
1835
1891
|
className: "rdb-snippet__action-btn",
|
|
1836
1892
|
title: "Reset code",
|
|
1837
|
-
children:
|
|
1893
|
+
children: [
|
|
1894
|
+
/* @__PURE__ */ jsxs13("svg", { className: "rdb-snippet__action-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1895
|
+
/* @__PURE__ */ jsx18("polyline", { points: "1 4 1 10 7 10" }),
|
|
1896
|
+
/* @__PURE__ */ jsx18("path", { d: "M3.51 15a9 9 0 1 0 2.13-9.36L1 10" })
|
|
1897
|
+
] }),
|
|
1898
|
+
"Reset"
|
|
1899
|
+
]
|
|
1838
1900
|
}
|
|
1839
1901
|
)
|
|
1840
1902
|
] })
|
|
@@ -1843,17 +1905,16 @@ function Snippet({
|
|
|
1843
1905
|
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__description-marker", children: "// " }),
|
|
1844
1906
|
description
|
|
1845
1907
|
] }) }),
|
|
1846
|
-
/* @__PURE__ */ jsx18(
|
|
1847
|
-
|
|
1908
|
+
isFullscreen ? /* @__PURE__ */ jsx18(
|
|
1909
|
+
SplitPane,
|
|
1848
1910
|
{
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
children: /* @__PURE__ */ jsx18(
|
|
1911
|
+
initialSplit: 50,
|
|
1912
|
+
top: /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__editor--fullscreen", children: /* @__PURE__ */ jsx18(
|
|
1852
1913
|
Editor2,
|
|
1853
1914
|
{
|
|
1854
1915
|
height: "100%",
|
|
1855
1916
|
language: "rql",
|
|
1856
|
-
theme:
|
|
1917
|
+
theme: resolvedTheme,
|
|
1857
1918
|
value: code,
|
|
1858
1919
|
onChange: (value) => setCode(value || ""),
|
|
1859
1920
|
beforeMount: handleBeforeMount,
|
|
@@ -1866,10 +1927,7 @@ function Snippet({
|
|
|
1866
1927
|
lineDecorationsWidth: 16,
|
|
1867
1928
|
lineNumbersMinChars: 3,
|
|
1868
1929
|
scrollBeyondLastLine: false,
|
|
1869
|
-
scrollbar: {
|
|
1870
|
-
vertical: isFullscreen ? "auto" : "hidden",
|
|
1871
|
-
horizontal: isFullscreen ? "auto" : "hidden"
|
|
1872
|
-
},
|
|
1930
|
+
scrollbar: { vertical: "auto", horizontal: "auto" },
|
|
1873
1931
|
overviewRulerLanes: 0,
|
|
1874
1932
|
hideCursorInOverviewRuler: true,
|
|
1875
1933
|
overviewRulerBorder: false,
|
|
@@ -1881,43 +1939,122 @@ function Snippet({
|
|
|
1881
1939
|
automaticLayout: true
|
|
1882
1940
|
}
|
|
1883
1941
|
}
|
|
1884
|
-
)
|
|
1942
|
+
) }),
|
|
1943
|
+
bottom: /* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__fullscreen-bottom", children: [
|
|
1944
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__toolbar", children: [
|
|
1945
|
+
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__hint", children: isExecuting ? "$ running..." : "$ ctrl+enter to run" }),
|
|
1946
|
+
/* @__PURE__ */ jsx18(
|
|
1947
|
+
"button",
|
|
1948
|
+
{
|
|
1949
|
+
onClick: handleRun,
|
|
1950
|
+
disabled: isExecuting,
|
|
1951
|
+
className: `rdb-snippet__run-btn${isExecuting ? " rdb-snippet__run-btn--loading" : ""}`,
|
|
1952
|
+
children: isExecuting ? "Running..." : "Run"
|
|
1953
|
+
}
|
|
1954
|
+
)
|
|
1955
|
+
] }),
|
|
1956
|
+
result && /* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results rdb-snippet__results--fullscreen", children: [
|
|
1957
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results-header", children: [
|
|
1958
|
+
/* @__PURE__ */ jsx18("span", { children: result.error ? "--- error ---" : "--- output ---" }),
|
|
1959
|
+
result.data && !result.error && /* @__PURE__ */ jsxs13("span", { children: [
|
|
1960
|
+
"(",
|
|
1961
|
+
result.data.length,
|
|
1962
|
+
" row",
|
|
1963
|
+
result.data.length !== 1 ? "s" : "",
|
|
1964
|
+
")"
|
|
1965
|
+
] })
|
|
1966
|
+
] }),
|
|
1967
|
+
result.error && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__error", children: /* @__PURE__ */ jsxs13("pre", { className: "rdb-snippet__error-text", children: [
|
|
1968
|
+
"ERR: ",
|
|
1969
|
+
result.error
|
|
1970
|
+
] }) }),
|
|
1971
|
+
result.data && result.data.length > 0 && !result.error && /* @__PURE__ */ jsx18(SnippetResults, { data: result.data, columns, maxKeyLength }),
|
|
1972
|
+
result.data && result.data.length === 0 && !result.error && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__empty", children: "$ 0 rows returned." })
|
|
1973
|
+
] })
|
|
1974
|
+
] })
|
|
1885
1975
|
}
|
|
1886
|
-
),
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1976
|
+
) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
1977
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__editor-wrap", style: { height: editorHeight }, children: [
|
|
1978
|
+
/* @__PURE__ */ jsx18(
|
|
1979
|
+
Editor2,
|
|
1980
|
+
{
|
|
1981
|
+
height: "100%",
|
|
1982
|
+
language: "rql",
|
|
1983
|
+
theme: resolvedTheme,
|
|
1984
|
+
value: code,
|
|
1985
|
+
onChange: (value) => setCode(value || ""),
|
|
1986
|
+
beforeMount: handleBeforeMount,
|
|
1987
|
+
onMount: handleEditorDidMount,
|
|
1988
|
+
options: {
|
|
1989
|
+
minimap: { enabled: false },
|
|
1990
|
+
lineNumbers: "on",
|
|
1991
|
+
glyphMargin: false,
|
|
1992
|
+
folding: false,
|
|
1993
|
+
lineDecorationsWidth: 16,
|
|
1994
|
+
lineNumbersMinChars: 3,
|
|
1995
|
+
scrollBeyondLastLine: false,
|
|
1996
|
+
scrollbar: { vertical: "hidden", horizontal: "hidden" },
|
|
1997
|
+
overviewRulerLanes: 0,
|
|
1998
|
+
hideCursorInOverviewRuler: true,
|
|
1999
|
+
overviewRulerBorder: false,
|
|
2000
|
+
renderLineHighlight: "none",
|
|
2001
|
+
fontFamily: "'IBM Plex Mono', monospace",
|
|
2002
|
+
fontSize: 13,
|
|
2003
|
+
padding: { top: 8, bottom: 8 },
|
|
2004
|
+
wordWrap: "on",
|
|
2005
|
+
automaticLayout: true
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
),
|
|
2009
|
+
result && /* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results-overlay", children: [
|
|
2010
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results-header", children: [
|
|
2011
|
+
/* @__PURE__ */ jsx18("span", { children: result.error ? "--- error ---" : "--- output ---" }),
|
|
2012
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results-header-right", children: [
|
|
2013
|
+
result.data && !result.error && /* @__PURE__ */ jsxs13("span", { children: [
|
|
2014
|
+
"(",
|
|
2015
|
+
result.data.length,
|
|
2016
|
+
" row",
|
|
2017
|
+
result.data.length !== 1 ? "s" : "",
|
|
2018
|
+
")"
|
|
2019
|
+
] }),
|
|
2020
|
+
/* @__PURE__ */ jsx18(
|
|
2021
|
+
"button",
|
|
2022
|
+
{
|
|
2023
|
+
onClick: () => setResult(null),
|
|
2024
|
+
className: "rdb-snippet__action-btn",
|
|
2025
|
+
title: "Close results",
|
|
2026
|
+
children: /* @__PURE__ */ jsxs13("svg", { className: "rdb-snippet__action-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx18("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
2028
|
+
/* @__PURE__ */ jsx18("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
2029
|
+
] })
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
] })
|
|
2033
|
+
] }),
|
|
2034
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__results-body", children: [
|
|
2035
|
+
result.error && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__error", children: /* @__PURE__ */ jsxs13("pre", { className: "rdb-snippet__error-text", children: [
|
|
2036
|
+
"ERR: ",
|
|
2037
|
+
result.error
|
|
2038
|
+
] }) }),
|
|
2039
|
+
result.data && result.data.length > 0 && !result.error && /* @__PURE__ */ jsx18(SnippetResults, { data: result.data, columns, maxKeyLength }),
|
|
2040
|
+
result.data && result.data.length === 0 && !result.error && /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__empty", children: "$ 0 rows returned." })
|
|
2041
|
+
] })
|
|
1908
2042
|
] })
|
|
1909
2043
|
] }),
|
|
1910
|
-
|
|
1911
|
-
"
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2044
|
+
/* @__PURE__ */ jsxs13("div", { className: "rdb-snippet__toolbar", children: [
|
|
2045
|
+
/* @__PURE__ */ jsx18("span", { className: "rdb-snippet__hint", children: isExecuting ? "$ running..." : "$ ctrl+enter to run" }),
|
|
2046
|
+
/* @__PURE__ */ jsx18(
|
|
2047
|
+
"button",
|
|
2048
|
+
{
|
|
2049
|
+
onClick: handleRun,
|
|
2050
|
+
disabled: isExecuting,
|
|
2051
|
+
className: `rdb-snippet__run-btn${isExecuting ? " rdb-snippet__run-btn--loading" : ""}`,
|
|
2052
|
+
children: isExecuting ? "Running..." : "Run"
|
|
2053
|
+
}
|
|
2054
|
+
)
|
|
2055
|
+
] })
|
|
1916
2056
|
] })
|
|
1917
2057
|
] });
|
|
1918
|
-
if (isFullscreen) {
|
|
1919
|
-
return /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__overlay", children: /* @__PURE__ */ jsx18("div", { className: "rdb-snippet__overlay-inner", children: content }) });
|
|
1920
|
-
}
|
|
1921
2058
|
return content;
|
|
1922
2059
|
}
|
|
1923
2060
|
|