@rebasepro/studio 0.0.1-canary.eae7889 → 0.1.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/{ApiExplorer-gMJt5JrS.js → ApiExplorer-DHVmWYfK.js} +13 -13
- package/dist/ApiExplorer-DHVmWYfK.js.map +1 -0
- package/dist/AuthSimulationSelector-CM488Eei.js +106 -0
- package/dist/AuthSimulationSelector-CM488Eei.js.map +1 -0
- package/dist/{JSEditor-D8nVp3Lp.js → JSEditor-CSHA0t_O.js} +2 -2
- package/dist/{JSEditor-D8nVp3Lp.js.map → JSEditor-CSHA0t_O.js.map} +1 -1
- package/dist/{RLSEditor-DBH09u9v.js → RLSEditor-BzDjqo6w.js} +46 -5
- package/dist/RLSEditor-BzDjqo6w.js.map +1 -0
- package/dist/{SQLEditor-CkVx9vgr.js → SQLEditor-Cr9Kg_Qg.js} +63 -75
- package/dist/SQLEditor-Cr9Kg_Qg.js.map +1 -0
- package/dist/{SchemaVisualizer-BgD5Zb77.js → SchemaVisualizer-BGpmzyXT.js} +5 -5
- package/dist/SchemaVisualizer-BGpmzyXT.js.map +1 -0
- package/dist/StorageView-BYoslzBR.js +870 -0
- package/dist/StorageView-BYoslzBR.js.map +1 -0
- package/dist/core/src/components/BootstrapAdminBanner.d.ts +4 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +22 -0
- package/dist/core/src/components/common/useDataTableController.d.ts +3 -3
- package/dist/core/src/components/index.d.ts +1 -0
- package/dist/core/src/hooks/data/useRelationSelector.d.ts +2 -2
- package/dist/core/src/hooks/index.d.ts +1 -0
- package/dist/core/src/hooks/useCollapsedGroups.d.ts +16 -1
- package/dist/core/src/hooks/useResolvedComponent.d.ts +47 -0
- package/dist/index.es.js +79 -71
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +821 -834
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/controllers/auth.d.ts +8 -2
- package/dist/types/src/controllers/client.d.ts +13 -0
- package/dist/types/src/controllers/collection_registry.d.ts +2 -1
- package/dist/types/src/controllers/data_driver.d.ts +36 -1
- package/dist/types/src/controllers/navigation.d.ts +18 -6
- package/dist/types/src/controllers/registry.d.ts +9 -1
- package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
- package/dist/types/src/rebase_context.d.ts +17 -0
- package/dist/types/src/types/backend_hooks.d.ts +187 -0
- package/dist/types/src/types/collections.d.ts +31 -11
- package/dist/types/src/types/component_ref.d.ts +47 -0
- package/dist/types/src/types/cron.d.ts +1 -1
- package/dist/types/src/types/entity_views.d.ts +6 -7
- package/dist/types/src/types/formex.d.ts +40 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/plugins.d.ts +6 -3
- package/dist/types/src/types/properties.d.ts +72 -88
- package/dist/types/src/types/slots.d.ts +20 -10
- package/dist/types/src/types/translations.d.ts +6 -0
- package/dist/ui/src/components/FileUpload.d.ts +1 -1
- package/dist/ui/src/components/SearchBar.d.ts +5 -1
- package/dist/ui/src/styles.d.ts +2 -2
- package/package.json +10 -10
- package/src/components/ApiExplorer/ApiExplorer.tsx +7 -5
- package/src/components/ApiExplorer/TryItPanel.tsx +29 -53
- package/src/components/AuthSimulationSelector.tsx +13 -17
- package/src/components/RLSEditor/RLSEditor.tsx +82 -3
- package/src/components/SQLEditor/SQLEditor.tsx +16 -18
- package/src/components/SQLEditor/SchemaBrowser.tsx +6 -8
- package/src/components/SchemaVisualizer/SchemaVisualizer.tsx +20 -22
- package/src/components/StorageView/StorageView.tsx +719 -304
- package/src/components/StudioHomePage.tsx +4 -1
- package/dist/ApiExplorer-gMJt5JrS.js.map +0 -1
- package/dist/AuthSimulationSelector-BF4rkRGp.js +0 -118
- package/dist/AuthSimulationSelector-BF4rkRGp.js.map +0 -1
- package/dist/RLSEditor-DBH09u9v.js.map +0 -1
- package/dist/SQLEditor-CkVx9vgr.js.map +0 -1
- package/dist/SchemaVisualizer-BgD5Zb77.js.map +0 -1
- package/dist/StorageView-CTqGFhY9.js +0 -907
- package/dist/StorageView-CTqGFhY9.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { c } from "react-compiler-runtime";
|
|
|
3
3
|
import { useTranslation, ErrorView, useRebaseContext, useStudioSideEntityController, useSnackbarController, useStudioCollectionRegistry, ConfirmationDialog, IconForView } from "@rebasepro/core";
|
|
4
4
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
|
-
import { CircularProgress, Typography, IconButton, iconSize, cls, defaultBorderMixin, Menu, MenuItem, Button, Tabs, Tab, Collapse, ResizablePanels, Tooltip, Dialog, DialogTitle, DialogContent, TextField, DialogActions, VirtualTable } from "@rebasepro/ui";
|
|
6
|
+
import { CircularProgress, Typography, IconButton, iconSize, cls, defaultBorderMixin, Menu, MenuItem, Button, Tabs, Tab, Collapse, ResizablePanels, Tooltip, Checkbox, Dialog, DialogTitle, DialogContent, TextField, DialogActions, VirtualTable, TextareaAutosize } from "@rebasepro/ui";
|
|
7
7
|
import { RefreshCwIcon, CopyIcon, MoreVerticalIcon, Trash2Icon, TerminalIcon, XIcon, PlusIcon, MenuIcon, DatabaseIcon, PlayIcon, PencilIcon } from "lucide-react";
|
|
8
8
|
import { M as MonacoEditor } from "./MonacoEditor-CMYEjiRf.js";
|
|
9
9
|
import { parseFirst } from "pgsql-ast-parser";
|
|
@@ -45,12 +45,12 @@ const SchemaBrowser = ({
|
|
|
45
45
|
/* @__PURE__ */ jsx("svg", { className: cls("w-3 h-3 mr-1 transition-transform shrink-0", expandedTables[`${schemaName}.${table.tableName}`] ? "rotate-90" : ""), fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx("path", { d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" }) }),
|
|
46
46
|
/* @__PURE__ */ jsx("svg", { className: "w-3.5 h-3.5 mr-1 shrink-0 text-text-disabled dark:text-text-disabled-dark", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" }) }),
|
|
47
47
|
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-text-secondary dark:text-text-secondary-dark text-xs truncate flex-1 min-w-0", children: table.tableName }),
|
|
48
|
-
/* @__PURE__ */ jsxs("div", { className: "flex opacity-0 group-hover:opacity-100 focus-within:opacity-100 absolute right-1 items-center bg-surface-100 dark:bg-surface-
|
|
49
|
-
/* @__PURE__ */ jsx(IconButton, { size: "
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: "flex opacity-0 group-hover:opacity-100 focus-within:opacity-100 absolute right-1 items-center bg-surface-100 dark:bg-surface-800 px-1 gap-1 rounded transition-opacity", children: [
|
|
49
|
+
/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
|
|
50
50
|
e.stopPropagation();
|
|
51
51
|
navigator.clipboard.writeText(table.tableName);
|
|
52
|
-
}, title: "CopyIcon table name", children: /* @__PURE__ */ jsx(CopyIcon, { size: iconSize.
|
|
53
|
-
/* @__PURE__ */ jsxs(Menu, { trigger: /* @__PURE__ */ jsx(IconButton, { size: "
|
|
52
|
+
}, title: "CopyIcon table name", children: /* @__PURE__ */ jsx(CopyIcon, { size: iconSize.small }) }),
|
|
53
|
+
/* @__PURE__ */ jsxs(Menu, { trigger: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e_0) => e_0.stopPropagation(), title: "Generate SQL templates", children: /* @__PURE__ */ jsx(MoreVerticalIcon, { size: iconSize.small }) }), children: [
|
|
54
54
|
/* @__PURE__ */ jsx(MenuItem, { dense: true, className: "text-xs", onClick: (e_1) => {
|
|
55
55
|
e_1.stopPropagation();
|
|
56
56
|
onTableClick?.(`SELECT * FROM ${schemaName !== "public" ? `${schemaName}.` : ""}${table.tableName} LIMIT 100;`);
|
|
@@ -87,7 +87,7 @@ WHERE id = ?;`);
|
|
|
87
87
|
/* @__PURE__ */ jsx("svg", { className: "w-3 h-3 mr-1.5 text-text-disabled dark:text-text-disabled-dark shrink-0", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9 4.5v15m6-15v15m-10.5-1.5h15c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125h-15c-.621 0-1.125.504-1.125 1.125v12.75c0 .621.504 1.125 1.125 1.125Z" }) }),
|
|
88
88
|
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-primary dark:text-text-primary-dark text-[11px] truncate flex-grow mr-2", children: col.name }),
|
|
89
89
|
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-text-disabled dark:text-text-disabled-dark text-[9px] truncate mr-1 uppercase shrink-0", title: col.dataType, children: col.dataType }),
|
|
90
|
-
/* @__PURE__ */ jsx(IconButton, { size: "smallest", className: "opacity-0 group-hover:opacity-100 absolute right-1 bg-surface-50 dark:bg-surface-
|
|
90
|
+
/* @__PURE__ */ jsx(IconButton, { size: "smallest", className: "opacity-0 group-hover:opacity-100 absolute right-1 bg-surface-50 dark:bg-surface-800 transition-colors pointer-events-auto", onClick: (e_6) => {
|
|
91
91
|
e_6.stopPropagation();
|
|
92
92
|
navigator.clipboard.writeText(col.name);
|
|
93
93
|
}, title: "CopyIcon column name", children: /* @__PURE__ */ jsx(CopyIcon, { size: iconSize.smallest }) })
|
|
@@ -668,7 +668,7 @@ const ExplainVisualizer = (t0) => {
|
|
|
668
668
|
}
|
|
669
669
|
let t37;
|
|
670
670
|
if ($[67] !== expanded || $[68] !== hasChildren || $[69] !== plan.Plans) {
|
|
671
|
-
t37 = expanded && hasChildren && /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-2 mt-[-4px]", children: plan.Plans.map(_temp) });
|
|
671
|
+
t37 = expanded && hasChildren && /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-2 mt-[-4px]", children: plan.Plans.map(_temp$1) });
|
|
672
672
|
$[67] = expanded;
|
|
673
673
|
$[68] = hasChildren;
|
|
674
674
|
$[69] = plan.Plans;
|
|
@@ -695,7 +695,7 @@ const ExplainVisualizer = (t0) => {
|
|
|
695
695
|
}
|
|
696
696
|
return t38;
|
|
697
697
|
};
|
|
698
|
-
function _temp(childPlan, idx) {
|
|
698
|
+
function _temp$1(childPlan, idx) {
|
|
699
699
|
return /* @__PURE__ */ jsx(ExplainVisualizer, { plan: childPlan, isRoot: false }, idx);
|
|
700
700
|
}
|
|
701
701
|
let VirtualTableInput = null;
|
|
@@ -707,7 +707,7 @@ try {
|
|
|
707
707
|
const STORAGE_KEY_TABS = "rebase_sql_tabs";
|
|
708
708
|
const STORAGE_KEY_ACTIVE_TAB = "rebase_sql_active_tab";
|
|
709
709
|
const FixedEditorOverlay = (t0) => {
|
|
710
|
-
const $ = c(
|
|
710
|
+
const $ = c(26);
|
|
711
711
|
const {
|
|
712
712
|
displayValue,
|
|
713
713
|
onSave,
|
|
@@ -798,90 +798,70 @@ const FixedEditorOverlay = (t0) => {
|
|
|
798
798
|
t7 = $[9];
|
|
799
799
|
}
|
|
800
800
|
let t8;
|
|
801
|
-
if ($[10]
|
|
801
|
+
if ($[10] !== resolvedMaxHeight) {
|
|
802
802
|
t8 = {
|
|
803
|
-
minHeight: "32px"
|
|
803
|
+
minHeight: "32px",
|
|
804
|
+
maxHeight: resolvedMaxHeight
|
|
804
805
|
};
|
|
805
|
-
$[10] =
|
|
806
|
+
$[10] = resolvedMaxHeight;
|
|
807
|
+
$[11] = t8;
|
|
806
808
|
} else {
|
|
807
|
-
t8 = $[
|
|
809
|
+
t8 = $[11];
|
|
808
810
|
}
|
|
809
811
|
let t10;
|
|
810
812
|
let t9;
|
|
811
|
-
if ($[
|
|
812
|
-
t9 = (
|
|
813
|
-
|
|
814
|
-
e.target.value = "";
|
|
815
|
-
e.target.value = val;
|
|
816
|
-
e.target.style.height = "auto";
|
|
817
|
-
e.target.style.height = `${Math.min(e.target.scrollHeight, resolvedMaxHeight)}px`;
|
|
818
|
-
};
|
|
819
|
-
t10 = (e_0) => {
|
|
820
|
-
e_0.target.style.height = "auto";
|
|
821
|
-
e_0.target.style.height = `${Math.min(e_0.target.scrollHeight, resolvedMaxHeight)}px`;
|
|
822
|
-
};
|
|
823
|
-
$[11] = resolvedMaxHeight;
|
|
824
|
-
$[12] = t10;
|
|
825
|
-
$[13] = t9;
|
|
826
|
-
} else {
|
|
827
|
-
t10 = $[12];
|
|
828
|
-
t9 = $[13];
|
|
829
|
-
}
|
|
830
|
-
let t11;
|
|
831
|
-
let t12;
|
|
832
|
-
if ($[14] !== onCancel || $[15] !== onSave) {
|
|
833
|
-
t11 = (e_1) => {
|
|
834
|
-
onSave(e_1.target.value || null);
|
|
813
|
+
if ($[12] !== onCancel || $[13] !== onSave) {
|
|
814
|
+
t9 = (e_0) => {
|
|
815
|
+
onSave(e_0.target.value || null);
|
|
835
816
|
onCancel();
|
|
836
817
|
};
|
|
837
|
-
|
|
838
|
-
if (
|
|
839
|
-
|
|
840
|
-
onSave(
|
|
818
|
+
t10 = (e_1) => {
|
|
819
|
+
if (e_1.key === "Enter" && !e_1.shiftKey) {
|
|
820
|
+
e_1.preventDefault();
|
|
821
|
+
onSave(e_1.currentTarget.value || null);
|
|
841
822
|
onCancel();
|
|
842
823
|
}
|
|
843
|
-
if (
|
|
824
|
+
if (e_1.key === "Escape") {
|
|
844
825
|
onCancel();
|
|
845
826
|
}
|
|
846
827
|
};
|
|
847
|
-
$[
|
|
848
|
-
$[
|
|
849
|
-
$[
|
|
850
|
-
$[
|
|
828
|
+
$[12] = onCancel;
|
|
829
|
+
$[13] = onSave;
|
|
830
|
+
$[14] = t10;
|
|
831
|
+
$[15] = t9;
|
|
851
832
|
} else {
|
|
852
|
-
|
|
853
|
-
|
|
833
|
+
t10 = $[14];
|
|
834
|
+
t9 = $[15];
|
|
854
835
|
}
|
|
855
|
-
let
|
|
856
|
-
if ($[
|
|
857
|
-
|
|
858
|
-
$[
|
|
859
|
-
$[
|
|
836
|
+
let t11;
|
|
837
|
+
if ($[16] !== displayValue || $[17] !== t10 || $[18] !== t8 || $[19] !== t9) {
|
|
838
|
+
t11 = /* @__PURE__ */ jsx(TextareaAutosize, { className: "w-full h-full bg-transparent outline-none border-none ring-0 font-mono text-[13px] text-text-primary dark:text-text-primary-dark px-4 py-1.5 resize-none overflow-y-auto", defaultValue: displayValue, autoFocus: true, style: t8, onFocus: _temp, onBlur: t9, onKeyDown: t10 });
|
|
839
|
+
$[16] = displayValue;
|
|
840
|
+
$[17] = t10;
|
|
841
|
+
$[18] = t8;
|
|
842
|
+
$[19] = t9;
|
|
860
843
|
$[20] = t11;
|
|
861
|
-
$[21] = t12;
|
|
862
|
-
$[22] = t9;
|
|
863
|
-
$[23] = t13;
|
|
864
844
|
} else {
|
|
865
|
-
|
|
845
|
+
t11 = $[20];
|
|
866
846
|
}
|
|
867
|
-
let
|
|
868
|
-
if ($[
|
|
869
|
-
|
|
870
|
-
$[
|
|
871
|
-
$[
|
|
872
|
-
$[
|
|
847
|
+
let t12;
|
|
848
|
+
if ($[21] !== t11 || $[22] !== t7) {
|
|
849
|
+
t12 = createPortal(/* @__PURE__ */ jsx("div", { className: "fixed z-[9999] bg-surface-50 dark:bg-surface-900 border-2 border-primary dark:border-primary-dark shadow-xl flex flex-col", style: t7, children: t11 }), document.body);
|
|
850
|
+
$[21] = t11;
|
|
851
|
+
$[22] = t7;
|
|
852
|
+
$[23] = t12;
|
|
873
853
|
} else {
|
|
874
|
-
|
|
854
|
+
t12 = $[23];
|
|
875
855
|
}
|
|
876
|
-
let
|
|
877
|
-
if ($[
|
|
878
|
-
|
|
879
|
-
$[
|
|
880
|
-
$[
|
|
856
|
+
let t13;
|
|
857
|
+
if ($[24] !== t12) {
|
|
858
|
+
t13 = /* @__PURE__ */ jsx("div", { ref: anchorRef, className: "w-full h-full min-h-[20px]", children: t12 });
|
|
859
|
+
$[24] = t12;
|
|
860
|
+
$[25] = t13;
|
|
881
861
|
} else {
|
|
882
|
-
|
|
862
|
+
t13 = $[25];
|
|
883
863
|
}
|
|
884
|
-
return
|
|
864
|
+
return t13;
|
|
885
865
|
};
|
|
886
866
|
const SQLEditor = () => {
|
|
887
867
|
const {
|
|
@@ -1716,12 +1696,15 @@ const SQLEditor = () => {
|
|
|
1716
1696
|
/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: handleAddTab, className: "ml-2 flex-shrink-0", children: /* @__PURE__ */ jsx(PlusIcon, { size: iconSize.smallest }) })
|
|
1717
1697
|
] }) }),
|
|
1718
1698
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center justify-end pr-2 gap-1.5", children: [
|
|
1719
|
-
/* @__PURE__ */ jsx(Tooltip, { title: t("studio_sql_format_sql"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: handlePrettify,
|
|
1699
|
+
/* @__PURE__ */ jsx(Tooltip, { title: t("studio_sql_format_sql"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: handlePrettify, children: /* @__PURE__ */ jsx(MenuIcon, { size: iconSize.smallest }) }) }),
|
|
1720
1700
|
/* @__PURE__ */ jsx(Button, { variant: "text", size: "small", onClick: handleExplain, disabled: loading, children: t("studio_sql_explain") }),
|
|
1721
1701
|
/* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-surface-200 dark:bg-surface-950 mx-1" }),
|
|
1722
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 px-2
|
|
1702
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2 px-2", onClick: (e_14) => {
|
|
1703
|
+
setAutoLimit(!autoLimit);
|
|
1704
|
+
e_14.stopPropagation();
|
|
1705
|
+
}, children: [
|
|
1723
1706
|
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-[11px] text-text-secondary cursor-pointer select-none", children: t("studio_sql_limit_1000") }),
|
|
1724
|
-
/* @__PURE__ */ jsx("
|
|
1707
|
+
/* @__PURE__ */ jsx("div", { onClick: (e_15) => e_15.stopPropagation(), children: /* @__PURE__ */ jsx(Checkbox, { checked: autoLimit, onCheckedChange: setAutoLimit, size: "smallest", padding: false }) })
|
|
1725
1708
|
] }),
|
|
1726
1709
|
/* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-surface-200 dark:bg-surface-950 mx-1" }),
|
|
1727
1710
|
/* @__PURE__ */ jsx(Tooltip, { title: isFavorite ? t("studio_sql_remove_from_favorites") : t("studio_sql_add_to_favorites"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => {
|
|
@@ -1786,7 +1769,12 @@ const SQLEditor = () => {
|
|
|
1786
1769
|
} })
|
|
1787
1770
|
] });
|
|
1788
1771
|
};
|
|
1772
|
+
function _temp(e) {
|
|
1773
|
+
const val = e.target.value;
|
|
1774
|
+
e.target.value = "";
|
|
1775
|
+
e.target.value = val;
|
|
1776
|
+
}
|
|
1789
1777
|
export {
|
|
1790
1778
|
SQLEditor
|
|
1791
1779
|
};
|
|
1792
|
-
//# sourceMappingURL=SQLEditor-
|
|
1780
|
+
//# sourceMappingURL=SQLEditor-Cr9Kg_Qg.js.map
|