@rebasepro/studio 0.7.0 → 0.8.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/{JSEditor-DSucz6wV.js → JSEditor-Ca4XYGRp.js} +4 -4
- package/dist/JSEditor-Ca4XYGRp.js.map +1 -0
- package/dist/{StorageView-CvrnHmDG.js → StorageView-BMhD29YO.js} +33 -5
- package/dist/StorageView-BMhD29YO.js.map +1 -0
- package/dist/index.es.js +105 -77
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +133 -78
- package/dist/index.umd.js.map +1 -1
- package/package.json +17 -17
- package/src/components/JSEditor/JSMonacoEditor.tsx +3 -3
- package/src/components/StorageView/StorageView.tsx +43 -4
- package/src/components/StudioHomePage.tsx +139 -84
- package/src/utils/pgColumnToProperty.ts +2 -2
- package/dist/JSEditor-DSucz6wV.js.map +0 -1
- package/dist/StorageView-CvrnHmDG.js.map +0 -1
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","names":[],"sources":["../src/components/StudioHomePage.tsx","../src/components/RebaseStudio.tsx"],"sourcesContent":["import type { HomePageSection, PluginGenericProps } from \"@rebasepro/types\";\nimport React, { useEffect } from \"react\";\nimport { Card, cls, Container, Typography } from \"@rebasepro/ui\";\nimport { ArrowRightIcon, iconSize } from \"@rebasepro/ui\";\nimport { IconForView, useRebaseContext, useRestoreScroll, useSlot } from \"@rebasepro/core\";\nimport { useNavigate } from \"react-router-dom\";\nimport { useStudioBreadcrumbs, SchemaDriftBanner } from \"@rebasepro/core\";\n\n/* ═══════════════════════════════════════════════════════════════\n Static studio tool definitions\n ═══════════════════════════════════════════════════════════════ */\n\ninterface StudioTool {\n path: string;\n name: string;\n description: string;\n icon: string;\n}\n\ninterface StudioSection {\n label: string;\n dotColor: string;\n iconColor: string;\n tools: StudioTool[];\n}\n\nconst SECTIONS: StudioSection[] = [\n {\n label: \"Database\",\n dotColor: \"bg-emerald-400\",\n iconColor: \"text-emerald-400\",\n tools: [\n { path: \"/schema\",\nname: \"Collections\",\ndescription: \"Define and manage your data model and collection schemas\",\nicon: \"LayoutList\" },\n { path: \"/schema-visualizer\",\nname: \"Schema Visualizer\",\ndescription: \"Interactive ERD showing tables, columns, and relationships\",\nicon: \"Network\" },\n { path: \"/sql\",\nname: \"SQL Console\",\ndescription: \"Execute raw SQL queries directly against your database\",\nicon: \"terminal\" },\n { path: \"/branches\",\nname: \"Branches\",\ndescription: \"Create and manage isolated database copies for development\",\nicon: \"GitBranch\" },\n { path: \"/rls\",\nname: \"RLS Policies\",\ndescription: \"Configure Row Level Security for fine-grained data access\",\nicon: \"ShieldCheck\" },\n { path: \"/logs\",\nname: \"Logs Explorer\",\ndescription: \"Real-time system, query, and authentication logs\",\nicon: \"Activity\" }\n ]\n },\n {\n label: \"Compute\",\n dotColor: \"bg-blue-400\",\n iconColor: \"text-blue-400\",\n tools: [\n { path: \"/js\",\nname: \"JS Console\",\ndescription: \"Run JavaScript with the Rebase SDK in a live sandbox\",\nicon: \"code\" },\n { path: \"/cron\",\nname: \"Cron Jobs\",\ndescription: \"Monitor and manage scheduled background tasks\",\nicon: \"Clock\" }\n ]\n },\n {\n label: \"API\",\n dotColor: \"bg-violet-400\",\n iconColor: \"text-violet-400\",\n tools: [\n { path: \"/api\",\nname: \"API Explorer\",\ndescription: \"Interactive API documentation with live request testing\",\nicon: \"BookOpen\" }\n ]\n },\n {\n label: \"Storage\",\n dotColor: \"bg-amber-400\",\n iconColor: \"text-amber-400\",\n tools: [\n { path: \"/storage\",\nname: \"Storage\",\ndescription: \"Browse, upload, and manage files in your storage bucket\",\nicon: \"HardDrive\" }\n ]\n },\n {\n label: \"Access Control\",\n dotColor: \"bg-rose-400\",\n iconColor: \"text-rose-400\",\n tools: [\n { path: \"/users\",\nname: \"Users\",\ndescription: \"Manage developers and assign roles in your workspace\",\nicon: \"group\" },\n { path: \"/roles\",\nname: \"Roles\",\ndescription: \"Create and configure fine-grained access permissions\",\nicon: \"ShieldEllipsis\" },\n { path: \"/api-keys\",\nname: \"API Keys\",\ndescription: \"Create and manage scoped keys for machine-to-machine access\",\nicon: \"KeyRound\" }\n ]\n }\n];\n\n/* ═══════════════════════════════════════════════════════════════ */\n\nexport function StudioHomePage({\n additionalActions,\n additionalChildrenStart,\n additionalChildrenEnd,\n sections,\n hiddenGroups\n}: {\n additionalActions?: React.ReactNode;\n additionalChildrenStart?: React.ReactNode;\n additionalChildrenEnd?: React.ReactNode;\n sections?: HomePageSection[];\n hiddenGroups?: string[];\n}) {\n const context = useRebaseContext();\n const breadcrumbs = useStudioBreadcrumbs();\n const navigate = useNavigate();\n\n useEffect(() => {\n breadcrumbs.set({ breadcrumbs: [] });\n }, [breadcrumbs.set]);\n\n const { containerRef } = useRestoreScroll();\n\n const sectionProps: PluginGenericProps = { context };\n\n const pluginActions = useSlot(\"home.actions\", sectionProps);\n\n return (\n <div ref={containerRef} className=\"py-2 overflow-auto h-full w-full\">\n <Container maxWidth=\"6xl\">\n <div className=\"mb-4 flex flex-col gap-2\">\n <SchemaDriftBanner />\n </div>\n\n {(additionalActions || pluginActions) && (\n <div className=\"w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4 justify-end\">\n {additionalActions}\n {pluginActions}\n </div>\n )}\n\n {additionalChildrenStart}\n\n {/* ── Tool sections ── */}\n <div className=\"flex flex-col gap-8 pt-2\">\n {SECTIONS.map((section) => (\n <section key={section.label} aria-label={section.label}>\n {/* Section header */}\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className=\"py-2 font-medium uppercase text-sm text-surface-600 dark:text-surface-400\"\n >\n {section.label}\n </Typography>\n\n {/* Card grid */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 mt-2\">\n {section.tools.map((tool) => (\n <Card\n key={tool.path}\n onClick={() => {\n navigate(tool.path);\n context.analyticsController?.onAnalyticsEvent?.(\n \"home_navigate_to_view\",\n { path: tool.path }\n );\n }}\n className={cls(\n \"h-full px-4 py-2.5 cursor-pointer transition-all duration-200 ease-in-out\",\n \"hover:-translate-y-0.5 hover:shadow-md hover:shadow-primary/5\"\n )}\n >\n <div className=\"flex flex-col items-start h-full\">\n <div className=\"grow w-full\">\n {/* Icon */}\n <div className={cls(\"h-6 flex items-center\", section.iconColor)}>\n <IconForView\n collectionOrView={{ slug: tool.path,\nname: tool.name,\nicon: tool.icon }}\n size=\"small\"\n />\n </div>\n\n {/* Title */}\n <Typography\n gutterBottom\n variant=\"subtitle1\"\n className=\"mt-1 font-semibold\"\n component=\"h2\"\n >\n {tool.name}\n </Typography>\n\n {/* Description */}\n <Typography variant=\"caption\" color=\"secondary\" component=\"div\">\n {tool.description}\n </Typography>\n </div>\n\n {/* Arrow */}\n <div style={{ alignSelf: \"flex-end\" }}>\n <div className=\"p-2\">\n <ArrowRightIcon className=\"text-primary\" size={iconSize.small}/>\n </div>\n </div>\n </div>\n </Card>\n ))}\n </div>\n </section>\n ))}\n </div>\n\n {/* ── SDK Quick Start ── */}\n <div className=\"mt-10 mb-6\">\n <div className=\"flex items-center mb-1\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className=\"py-2 font-medium uppercase text-sm text-surface-600 dark:text-surface-400\"\n >\n Quick Start\n </Typography>\n </div>\n\n <Typography variant=\"body2\" color=\"secondary\" className=\"mb-4 max-w-2xl\">\n Generate a fully-typed SDK from your collections with{\" \"}\n <code className=\"text-emerald-400 font-mono text-xs bg-emerald-400/10 px-1.5 py-0.5 rounded\">\n npx rebase generate-sdk\n </code>\n {\" \"}and start querying your data with full TypeScript autocompletion.\n </Typography>\n\n <div className=\"rounded-lg border border-surface-200/40 dark:border-surface-700/40 bg-white dark:bg-surface-950 overflow-hidden\">\n {/* Title bar */}\n <div className=\"flex items-center justify-between px-4 py-2.5 border-b border-surface-200/40 dark:border-surface-700/40 bg-surface-50 dark:bg-surface-900/80\">\n <div className=\"flex items-center gap-2.5\">\n <div className=\"flex gap-1.5\">\n <span className=\"w-2.5 h-2.5 rounded-full bg-red-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-amber-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-emerald-400/60\"/>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500 ml-1\">\n app.ts\n </span>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500\">\n TypeScript\n </span>\n </div>\n\n {/* Syntax-highlighted code */}\n <div className=\"px-5 py-4 overflow-x-auto text-[13px] leading-6 font-mono\">\n <SyntaxHighlightedSnippet/>\n </div>\n </div>\n </div>\n\n {/* ── Extra sections from props ── */}\n {sections?.map((s) => (\n <div key={s.key} className=\"my-10\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className=\"p-4 py-2 rounded font-medium uppercase text-sm text-surface-600 dark:text-surface-400\"\n >\n {s.title}\n </Typography>\n <div className=\"mt-4\">{s.children}</div>\n </div>\n ))}\n\n {additionalChildrenEnd}\n </Container>\n </div>\n );\n}\n\n/* ═══════════════════════════════════════════════════════════════\n Hand-crafted syntax-highlighted code snippet.\n Uses inline spans with Tailwind color classes to avoid\n pulling in a syntax highlighting library.\n ═══════════════════════════════════════════════════════════════ */\n\nfunction SyntaxHighlightedSnippet() {\n const kw = \"text-violet-600 dark:text-violet-400\"; // keywords\n const str = \"text-emerald-600 dark:text-emerald-400\"; // strings\n const typ = \"text-amber-600 dark:text-amber-300\"; // types\n const fn = \"text-blue-600 dark:text-blue-400\"; // functions\n const cm = \"text-surface-500 dark:text-surface-400 italic\"; // comments\n const op = \"text-surface-500 dark:text-surface-400\"; // operators / punctuation\n const tx = \"text-surface-950 dark:text-surface-200\"; // plain text\n\n return (\n <pre className=\"m-0 whitespace-pre\">\n <span className={kw}>import</span>\n <span className={tx}>{\" { \"}</span>\n <span className={fn}>createRebaseClient</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'@rebasepro/client'</span>\n <span className={op}>;</span>\n {\"\\n\"}\n\n <span className={kw}>import</span>\n <span className={tx}> </span>\n <span className={kw}>type</span>\n <span className={tx}>{\" { \"}</span>\n <span className={typ}>Database</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'./database.types'</span>\n <span className={op}>;</span>\n {\"\\n\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}> rebase </span>\n <span className={op}>= </span>\n <span className={fn}>createRebaseClient</span>\n <span className={op}>{\"<\"}</span>\n <span className={typ}>Database</span>\n <span className={op}>{\">(\"}</span>\n <span className={tx}>{\"{\"}</span>\n {\"\\n\"}\n <span className={tx}>{\" baseUrl\"}</span>\n <span className={op}>: </span>\n <span className={str}>'http://localhost:3001'</span>\n <span className={op}>,</span>\n {\"\\n\"}\n <span className={tx}>{\"}\"}</span>\n <span className={op}>);</span>\n {\"\\n\\n\"}\n\n <span className={cm}>{\"// Fully typed — autocompletion for tables and columns\"}</span>\n {\"\\n\"}\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>users</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={tx}>users</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n {\"\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>posts</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={fn}>collection</span>\n <span className={op}>(</span>\n <span className={str}>'posts'</span>\n <span className={op}>)</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n </pre>\n );\n}\n","import React, { lazy, Suspense, useLayoutEffect, useMemo } from \"react\";\nimport { useRebaseRegistryDispatch } from \"@rebasepro/core\";\nimport type { RebaseStudioConfig, AppView } from \"@rebasepro/types\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\n\n// Lazy-loaded studio tools — each fetched only when its route is visited.\n// This keeps Monaco, @xyflow/react, dagre, pgsql-ast-parser etc. out of the initial bundle.\nconst SQLEditor = lazy(() => import(\"./SQLEditor/SQLEditor\").then(m => ({ default: m.SQLEditor })));\nconst JSEditor = lazy(() => import(\"./JSEditor/JSEditor\").then(m => ({ default: m.JSEditor })));\nconst RLSEditor = lazy(() => import(\"./RLSEditor/RLSEditor\").then(m => ({ default: m.RLSEditor })));\nconst StorageView = lazy(() => import(\"./StorageView/StorageView\").then(m => ({ default: m.StorageView })));\nconst CronJobsView = lazy(() => import(\"./CronJobs/CronJobsView\").then(m => ({ default: m.CronJobsView })));\nconst SchemaVisualizer = lazy(() => import(\"./SchemaVisualizer/SchemaVisualizer\").then(m => ({ default: m.SchemaVisualizer })));\nconst BranchesView = lazy(() => import(\"./Branches/BranchesView\").then(m => ({ default: m.BranchesView })));\nconst ApiExplorer = lazy(() => import(\"./ApiExplorer/ApiExplorer\").then(m => ({ default: m.ApiExplorer })));\nconst LogsExplorer = lazy(() => import(\"./LogsExplorer/LogsExplorer\").then(m => ({ default: m.LogsExplorer })));\nconst ApiKeysView = lazy(() => import(\"./ApiKeys/ApiKeysView\").then(m => ({ default: m.ApiKeysView })));\n\nimport { StudioHomePage } from \"./StudioHomePage\";\n\n/**\n * Declarative component to configure the Studio in Rebase.\n * Renders nothing — purely registers config into the RebaseRegistry.\n *\n * The \"schema\" tool (collection editor view) is now a built-in CMS feature.\n * When `<RebaseCMS collectionEditor={...}>` is used, the schema view is\n * automatically injected into Studio — no manual wiring needed.\n */\nconst DEFAULT_HOME_PAGE = <StudioHomePage/>;\n\nexport function RebaseStudio({ tools, homePage }: RebaseStudioConfig) {\n const dispatch = useRebaseRegistryDispatch();\n\n const resolvedHomePage = homePage ?? DEFAULT_HOME_PAGE;\n\n const devViews: AppView[] = useMemo(() => {\n const views: AppView[] = [];\n const activeTools = tools ?? [\"sql\", \"js\", \"rls\", \"storage\", \"cron\", \"schema-visualizer\", \"branches\", \"api\", \"logs\", \"api-keys\"];\n const suspense = (el: React.ReactNode) => <Suspense fallback={<CircularProgressCenter/>}>{el}</Suspense>;\n\n if (activeTools.includes(\"sql\")) {\n views.push({ slug: \"sql\",\nname: \"SQL Console\",\ngroup: \"Database\",\nicon: \"terminal\",\ndescription: \"Execute SQL queries\",\nview: suspense(<SQLEditor/>) });\n }\n if (activeTools.includes(\"js\")) {\n views.push({ slug: \"js\",\nname: \"JS Console\",\ngroup: \"Compute\",\nicon: \"code\",\ndescription: \"Execute JavaScript\",\nview: suspense(<JSEditor/>) });\n }\n if (activeTools.includes(\"rls\")) {\n views.push({ slug: \"rls\",\nname: \"RLS Policies\",\ngroup: \"Database\",\nicon: \"ShieldCheck\",\ndescription: \"Row Level Security\",\nview: suspense(<RLSEditor/>) });\n }\n if (activeTools.includes(\"storage\")) {\n views.push({ slug: \"storage\",\nname: \"Storage\",\ngroup: \"Storage\",\nicon: \"HardDrive\",\ndescription: \"Manage storage files\",\nview: suspense(<StorageView/>) });\n }\n if (activeTools.includes(\"cron\")) {\n views.push({ slug: \"cron\",\nname: \"Cron Jobs\",\ngroup: \"Compute\",\nicon: \"Clock\",\ndescription: \"Manage scheduled tasks\",\nview: suspense(<CronJobsView/>) });\n }\n if (activeTools.includes(\"schema-visualizer\")) {\n views.push({ slug: \"schema-visualizer\",\nname: \"Schema Visualizer\",\ngroup: \"Database\",\nicon: \"Network\",\ndescription: \"Interactive database ERD\",\nview: suspense(<SchemaVisualizer/>) });\n }\n if (activeTools.includes(\"branches\")) {\n views.push({ slug: \"branches\",\nname: \"Branches\",\ngroup: \"Database\",\nicon: \"GitBranch\",\ndescription: \"Create and manage database branches\",\nview: suspense(<BranchesView/>) });\n }\n if (activeTools.includes(\"api\")) {\n views.push({ slug: \"api\",\nname: \"API Explorer\",\ngroup: \"API\",\nicon: \"BookOpen\",\ndescription: \"Interactive API documentation and testing\",\nview: suspense(<ApiExplorer/>) });\n }\n if (activeTools.includes(\"logs\")) {\n views.push({ slug: \"logs\",\nname: \"Logs Explorer\",\ngroup: \"Database\",\nicon: \"Activity\",\ndescription: \"Real-time system and query logs\",\nview: suspense(<LogsExplorer/>) });\n }\n if (activeTools.includes(\"api-keys\")) {\n views.push({ slug: \"api-keys\",\nname: \"API Keys\",\ngroup: \"Access Control\",\nicon: \"KeyRound\",\ndescription: \"Create and manage scoped API keys\",\nview: suspense(<ApiKeysView/>) });\n }\n // Note: \"schema\" tool is auto-injected by RebaseShell when collectionEditor is enabled.\n // It is NOT registered here anymore.\n return views;\n }, [tools]);\n\n // Use a ref for homePage so it never destabilizes the effect.\n // homePage is a React element — its identity doesn't matter for registration.\n const homePageRef = React.useRef(resolvedHomePage);\n homePageRef.current = resolvedHomePage;\n\n useLayoutEffect(() => {\n dispatch.registerStudio({ tools,\nhomePage: homePageRef.current,\ndevViews });\n return () => dispatch.unregisterStudio();\n }, [dispatch, tools, devViews]);\n\n return null;\n}\n"],"mappings":";;;;;;AA0BA,IAAM,WAA4B;CAC9B;EACI,OAAO;EACP,UAAU;EACV,WAAW;EACX,OAAO;GACH;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAa;GACP;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAU;GACJ;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAW;GACL;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAY;GACN;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAc;GACR;IAAE,MAAM;IACpB,M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B,IAAI,YAAY,SAAS,UAAU,GAC/B,MAAM,KAAK;GAAE,MAAM;GAC/B,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM,SAAS,oBAAC,aAAD,CAAa,CAAA,CAAC;EAAE,CAAC;EAIxB,OAAO;CACX,GAAG,CAAC,KAAK,CAAC;CAIV,MAAM,cAAc,MAAM,OAAO,gBAAgB;CACjD,YAAY,UAAU;CAEtB,sBAAsB;EAClB,SAAS,eAAe;GAAE;GAClC,UAAU,YAAY;GACtB;EAAS,CAAC;EACF,aAAa,SAAS,iBAAiB;CAC3C,GAAG;EAAC;EAAU;EAAO;CAAQ,CAAC;CAE9B,OAAO;AACX"}
|
|
1
|
+
{"version":3,"file":"index.es.js","names":[],"sources":["../src/components/StudioHomePage.tsx","../src/components/RebaseStudio.tsx"],"sourcesContent":["import type { HomePageSection, PluginGenericProps } from \"@rebasepro/types\";\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport { Card, cls, Container, ExpandablePanel, Typography } from \"@rebasepro/ui\";\nimport { IconForView, useRebaseContext, useRestoreScroll, useSlot } from \"@rebasepro/core\";\nimport { useNavigate } from \"react-router-dom\";\nimport { useStudioBreadcrumbs, SchemaDriftBanner } from \"@rebasepro/core\";\n\n/* ═══════════════════════════════════════════════════════════════\n Static studio tool definitions\n ═══════════════════════════════════════════════════════════════ */\n\ninterface StudioTool {\n path: string;\n name: string;\n description: string;\n icon: string;\n}\n\ninterface StudioSection {\n label: string;\n tools: StudioTool[];\n}\n\nconst SECTIONS: StudioSection[] = [\n {\n label: \"Database\",\n tools: [\n { path: \"/schema\",\nname: \"Collections\",\ndescription: \"Define and manage your data model and collection schemas\",\nicon: \"LayoutList\" },\n { path: \"/schema-visualizer\",\nname: \"Schema Visualizer\",\ndescription: \"Interactive ERD showing tables, columns, and relationships\",\nicon: \"Network\" },\n { path: \"/sql\",\nname: \"SQL Console\",\ndescription: \"Execute raw SQL queries directly against your database\",\nicon: \"terminal\" },\n { path: \"/branches\",\nname: \"Branches\",\ndescription: \"Create and manage isolated database copies for development\",\nicon: \"GitBranch\" },\n { path: \"/rls\",\nname: \"RLS Policies\",\ndescription: \"Configure Row Level Security for fine-grained data access\",\nicon: \"ShieldCheck\" },\n { path: \"/logs\",\nname: \"Logs Explorer\",\ndescription: \"Real-time system, query, and authentication logs\",\nicon: \"Activity\" }\n ]\n },\n {\n label: \"Compute\",\n tools: [\n { path: \"/js\",\nname: \"JS Console\",\ndescription: \"Run JavaScript with the Rebase SDK in a live sandbox\",\nicon: \"code\" },\n { path: \"/cron\",\nname: \"Cron Jobs\",\ndescription: \"Monitor and manage scheduled background tasks\",\nicon: \"Clock\" }\n ]\n },\n {\n label: \"API\",\n tools: [\n { path: \"/api\",\nname: \"API Explorer\",\ndescription: \"Interactive API documentation with live request testing\",\nicon: \"BookOpen\" }\n ]\n },\n {\n label: \"Storage\",\n tools: [\n { path: \"/storage\",\nname: \"Storage\",\ndescription: \"Browse, upload, and manage files in your storage bucket\",\nicon: \"HardDrive\" }\n ]\n },\n {\n label: \"Access Control\",\n tools: [\n { path: \"/users\",\nname: \"Users\",\ndescription: \"Manage developers and assign roles in your workspace\",\nicon: \"group\" },\n { path: \"/roles\",\nname: \"Roles\",\ndescription: \"Create and configure fine-grained access permissions\",\nicon: \"ShieldEllipsis\" },\n { path: \"/api-keys\",\nname: \"API Keys\",\ndescription: \"Create and manage scoped keys for machine-to-machine access\",\nicon: \"KeyRound\" }\n ]\n }\n];\n\n/* ═══════════════════════════════════════════════════════════════ */\n\nconst COLLAPSED_STORAGE_KEY = \"rebase-studio-home-collapsed\";\n\nfunction useStudioCollapsedGroups(groupNames: string[]) {\n const [collapsed, setCollapsed] = useState<Set<string>>(() => {\n try {\n const stored = localStorage.getItem(COLLAPSED_STORAGE_KEY);\n return stored ? new Set(JSON.parse(stored)) : new Set<string>();\n } catch {\n return new Set<string>();\n }\n });\n\n const isGroupCollapsed = (name: string) => collapsed.has(name);\n\n const toggleGroupCollapsed = (name: string) => {\n setCollapsed(prev => {\n const next = new Set(prev);\n if (next.has(name)) {\n next.delete(name);\n } else {\n next.add(name);\n }\n try {\n localStorage.setItem(COLLAPSED_STORAGE_KEY, JSON.stringify([...next]));\n } catch { /* noop */ }\n return next;\n });\n };\n\n return { isGroupCollapsed, toggleGroupCollapsed };\n}\n\nexport function StudioHomePage({\n additionalActions,\n additionalChildrenStart,\n additionalChildrenEnd,\n sections,\n hiddenGroups\n}: {\n additionalActions?: React.ReactNode;\n additionalChildrenStart?: React.ReactNode;\n additionalChildrenEnd?: React.ReactNode;\n sections?: HomePageSection[];\n hiddenGroups?: string[];\n}) {\n const context = useRebaseContext();\n const breadcrumbs = useStudioBreadcrumbs();\n const navigate = useNavigate();\n\n useEffect(() => {\n breadcrumbs.set({ breadcrumbs: [] });\n }, [breadcrumbs.set]);\n\n const { containerRef } = useRestoreScroll();\n\n const sectionProps: PluginGenericProps = { context };\n\n const pluginActions = useSlot(\"home.actions\", sectionProps);\n\n const filteredSections = useMemo(\n () => SECTIONS.filter(s => !hiddenGroups?.includes(s.label)),\n [hiddenGroups]\n );\n\n const groupNames = useMemo(\n () => filteredSections.map(s => s.label),\n [filteredSections]\n );\n\n const { isGroupCollapsed, toggleGroupCollapsed } = useStudioCollapsedGroups(groupNames);\n\n return (\n <div ref={containerRef} className=\"py-2 overflow-auto h-full w-full bg-surface-50 dark:bg-surface-800\">\n <Container maxWidth=\"6xl\">\n <div className=\"mb-4 flex flex-col gap-2\">\n <SchemaDriftBanner />\n </div>\n\n {(additionalActions || pluginActions) && (\n <div className=\"w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4 justify-end\">\n {additionalActions}\n {pluginActions}\n </div>\n )}\n\n {additionalChildrenStart}\n\n {/* ── Tool sections ── */}\n {filteredSections.map((section) => {\n const sectionCollapsed = isGroupCollapsed(section.label);\n\n return (\n <div key={section.label} className=\"my-10\">\n <ExpandablePanel\n invisible\n expanded={!sectionCollapsed}\n onExpandedChange={(open) => {\n if (open !== !sectionCollapsed) {\n toggleGroupCollapsed(section.label);\n }\n }}\n className=\"mt-6\"\n titleClassName={cls(\n \"min-h-0 p-0 border-none\",\n \"rounded flex items-center justify-between w-full\",\n \"hover:bg-transparent\",\n \"cursor-pointer select-none\",\n sectionCollapsed && \"bg-surface-100 dark:bg-surface-900/50\"\n )}\n innerClassName=\"mt-4 pt-0\"\n title={\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-primary/50 dark:text-primary/70\"\n )}\n >\n {section.label}\n </Typography>\n }\n >\n <div className=\"mt-4 pt-0\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4\">\n {section.tools.map((tool) => (\n <Card\n key={tool.path}\n onClick={() => {\n navigate(tool.path);\n context.analyticsController?.onAnalyticsEvent?.(\n \"home_navigate_to_view\",\n { path: tool.path }\n );\n }}\n className={cls(\n \"group h-full p-4 cursor-pointer transition-colors duration-150 ease-in-out\",\n \"hover:bg-primary/5 dark:hover:bg-primary/5\"\n )}\n >\n <div className=\"flex flex-col h-full\">\n {/* Header: icon + title */}\n <div className=\"flex items-center w-full justify-between mb-1\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 transition-colors duration-150 group-hover:text-primary dark:group-hover:text-primary\">\n <IconForView\n collectionOrView={{ slug: tool.path, name: tool.name, icon: tool.icon }}\n size=\"small\"\n />\n </div>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {tool.name}\n </Typography>\n </div>\n </div>\n\n {/* Description indented to align with title */}\n <div className=\"pl-8\">\n {tool.description && (\n <Typography variant=\"caption\" color=\"secondary\" component=\"div\">\n {tool.description}\n </Typography>\n )}\n </div>\n\n {/* Spacer */}\n <div className=\"grow\"/>\n </div>\n </Card>\n ))}\n </div>\n </div>\n </ExpandablePanel>\n </div>\n );\n })}\n\n {/* ── SDK Quick Start ── */}\n <div className=\"mt-10 mb-6\">\n <div className=\"flex items-center mb-1\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-primary/50 dark:text-primary/70\"\n )}\n >\n Quick Start\n </Typography>\n </div>\n\n <Typography variant=\"body2\" color=\"secondary\" className=\"mb-4 max-w-2xl\">\n Generate a fully-typed SDK from your collections with{\" \"}\n <code className=\"text-emerald-400 font-mono text-xs bg-emerald-400/10 px-1.5 py-0.5 rounded\">\n npx rebase generate-sdk\n </code>\n {\" \"}and start querying your data with full TypeScript autocompletion.\n </Typography>\n\n <div className=\"rounded-lg border border-surface-200/40 dark:border-surface-700/40 bg-white dark:bg-surface-950 overflow-hidden\">\n {/* Title bar */}\n <div className=\"flex items-center justify-between px-4 py-2.5 border-b border-surface-200/40 dark:border-surface-700/40 bg-surface-50 dark:bg-surface-900/80\">\n <div className=\"flex items-center gap-2.5\">\n <div className=\"flex gap-1.5\">\n <span className=\"w-2.5 h-2.5 rounded-full bg-red-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-amber-400/60\"/>\n <span className=\"w-2.5 h-2.5 rounded-full bg-emerald-400/60\"/>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500 ml-1\">\n app.ts\n </span>\n </div>\n <span className=\"text-xs font-mono text-surface-400 dark:text-surface-500\">\n TypeScript\n </span>\n </div>\n\n {/* Syntax-highlighted code */}\n <div className=\"px-5 py-4 overflow-x-auto text-[13px] leading-6 font-mono\">\n <SyntaxHighlightedSnippet/>\n </div>\n </div>\n </div>\n\n {/* ── Extra sections from props ── */}\n {sections?.map((s) => (\n <div key={s.key} className=\"my-10\">\n <Typography\n variant=\"caption\"\n component=\"h2\"\n color=\"secondary\"\n className={cls(\n \"px-4 py-1 rounded\",\n \"font-medium text-[10px] uppercase tracking-[0.08em] text-primary/50 dark:text-primary/70\"\n )}\n >\n {s.title}\n </Typography>\n <div className=\"mt-4\">{s.children}</div>\n </div>\n ))}\n\n {additionalChildrenEnd}\n </Container>\n </div>\n );\n}\n\n/* ═══════════════════════════════════════════════════════════════\n Hand-crafted syntax-highlighted code snippet.\n Uses inline spans with Tailwind color classes to avoid\n pulling in a syntax highlighting library.\n ═══════════════════════════════════════════════════════════════ */\n\nfunction SyntaxHighlightedSnippet() {\n const kw = \"text-violet-600 dark:text-violet-400\"; // keywords\n const str = \"text-emerald-600 dark:text-emerald-400\"; // strings\n const typ = \"text-amber-600 dark:text-amber-300\"; // types\n const fn = \"text-blue-600 dark:text-blue-400\"; // functions\n const cm = \"text-surface-500 dark:text-surface-400 italic\"; // comments\n const op = \"text-surface-500 dark:text-surface-400\"; // operators / punctuation\n const tx = \"text-surface-950 dark:text-surface-200\"; // plain text\n\n return (\n <pre className=\"m-0 whitespace-pre\">\n <span className={kw}>import</span>\n <span className={tx}>{\" { \"}</span>\n <span className={fn}>createRebaseClient</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'@rebasepro/client'</span>\n <span className={op}>;</span>\n {\"\\n\"}\n\n <span className={kw}>import</span>\n <span className={tx}> </span>\n <span className={kw}>type</span>\n <span className={tx}>{\" { \"}</span>\n <span className={typ}>Database</span>\n <span className={tx}>{\" } \"}</span>\n <span className={kw}>from</span>\n <span className={tx}> </span>\n <span className={str}>'./database.types'</span>\n <span className={op}>;</span>\n {\"\\n\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}> rebase </span>\n <span className={op}>= </span>\n <span className={fn}>createRebaseClient</span>\n <span className={op}>{\"<\"}</span>\n <span className={typ}>Database</span>\n <span className={op}>{\">(\"}</span>\n <span className={tx}>{\"{\"}</span>\n {\"\\n\"}\n <span className={tx}>{\" baseUrl\"}</span>\n <span className={op}>: </span>\n <span className={str}>'http://localhost:3001'</span>\n <span className={op}>,</span>\n {\"\\n\"}\n <span className={tx}>{\"}\"}</span>\n <span className={op}>);</span>\n {\"\\n\\n\"}\n\n <span className={cm}>{\"// Fully typed — autocompletion for tables and columns\"}</span>\n {\"\\n\"}\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>users</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={tx}>users</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n {\"\\n\"}\n\n <span className={kw}>const</span>\n <span className={tx}>{\" { \"}</span>\n <span className={tx}>data</span>\n <span className={op}>: </span>\n <span className={tx}>posts</span>\n <span className={tx}>{\" } \"}</span>\n <span className={op}>= </span>\n <span className={kw}>await</span>\n <span className={tx}> rebase</span>\n <span className={op}>.</span>\n <span className={tx}>data</span>\n <span className={op}>.</span>\n <span className={fn}>collection</span>\n <span className={op}>(</span>\n <span className={str}>'posts'</span>\n <span className={op}>)</span>\n <span className={op}>.</span>\n <span className={fn}>find</span>\n <span className={op}>();</span>\n </pre>\n );\n}\n","import React, { lazy, Suspense, useLayoutEffect, useMemo } from \"react\";\nimport { useRebaseRegistryDispatch } from \"@rebasepro/core\";\nimport type { RebaseStudioConfig, AppView } from \"@rebasepro/types\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\n\n// Lazy-loaded studio tools — each fetched only when its route is visited.\n// This keeps Monaco, @xyflow/react, dagre, pgsql-ast-parser etc. out of the initial bundle.\nconst SQLEditor = lazy(() => import(\"./SQLEditor/SQLEditor\").then(m => ({ default: m.SQLEditor })));\nconst JSEditor = lazy(() => import(\"./JSEditor/JSEditor\").then(m => ({ default: m.JSEditor })));\nconst RLSEditor = lazy(() => import(\"./RLSEditor/RLSEditor\").then(m => ({ default: m.RLSEditor })));\nconst StorageView = lazy(() => import(\"./StorageView/StorageView\").then(m => ({ default: m.StorageView })));\nconst CronJobsView = lazy(() => import(\"./CronJobs/CronJobsView\").then(m => ({ default: m.CronJobsView })));\nconst SchemaVisualizer = lazy(() => import(\"./SchemaVisualizer/SchemaVisualizer\").then(m => ({ default: m.SchemaVisualizer })));\nconst BranchesView = lazy(() => import(\"./Branches/BranchesView\").then(m => ({ default: m.BranchesView })));\nconst ApiExplorer = lazy(() => import(\"./ApiExplorer/ApiExplorer\").then(m => ({ default: m.ApiExplorer })));\nconst LogsExplorer = lazy(() => import(\"./LogsExplorer/LogsExplorer\").then(m => ({ default: m.LogsExplorer })));\nconst ApiKeysView = lazy(() => import(\"./ApiKeys/ApiKeysView\").then(m => ({ default: m.ApiKeysView })));\n\nimport { StudioHomePage } from \"./StudioHomePage\";\n\n/**\n * Declarative component to configure the Studio in Rebase.\n * Renders nothing — purely registers config into the RebaseRegistry.\n *\n * The \"schema\" tool (collection editor view) is now a built-in CMS feature.\n * When `<RebaseCMS collectionEditor={...}>` is used, the schema view is\n * automatically injected into Studio — no manual wiring needed.\n */\nconst DEFAULT_HOME_PAGE = <StudioHomePage/>;\n\nexport function RebaseStudio({ tools, homePage }: RebaseStudioConfig) {\n const dispatch = useRebaseRegistryDispatch();\n\n const resolvedHomePage = homePage ?? DEFAULT_HOME_PAGE;\n\n const devViews: AppView[] = useMemo(() => {\n const views: AppView[] = [];\n const activeTools = tools ?? [\"sql\", \"js\", \"rls\", \"storage\", \"cron\", \"schema-visualizer\", \"branches\", \"api\", \"logs\", \"api-keys\"];\n const suspense = (el: React.ReactNode) => <Suspense fallback={<CircularProgressCenter/>}>{el}</Suspense>;\n\n if (activeTools.includes(\"sql\")) {\n views.push({ slug: \"sql\",\nname: \"SQL Console\",\ngroup: \"Database\",\nicon: \"terminal\",\ndescription: \"Execute SQL queries\",\nview: suspense(<SQLEditor/>) });\n }\n if (activeTools.includes(\"js\")) {\n views.push({ slug: \"js\",\nname: \"JS Console\",\ngroup: \"Compute\",\nicon: \"code\",\ndescription: \"Execute JavaScript\",\nview: suspense(<JSEditor/>) });\n }\n if (activeTools.includes(\"rls\")) {\n views.push({ slug: \"rls\",\nname: \"RLS Policies\",\ngroup: \"Database\",\nicon: \"ShieldCheck\",\ndescription: \"Row Level Security\",\nview: suspense(<RLSEditor/>) });\n }\n if (activeTools.includes(\"storage\")) {\n views.push({ slug: \"storage\",\nname: \"Storage\",\ngroup: \"Storage\",\nicon: \"HardDrive\",\ndescription: \"Manage storage files\",\nview: suspense(<StorageView/>) });\n }\n if (activeTools.includes(\"cron\")) {\n views.push({ slug: \"cron\",\nname: \"Cron Jobs\",\ngroup: \"Compute\",\nicon: \"Clock\",\ndescription: \"Manage scheduled tasks\",\nview: suspense(<CronJobsView/>) });\n }\n if (activeTools.includes(\"schema-visualizer\")) {\n views.push({ slug: \"schema-visualizer\",\nname: \"Schema Visualizer\",\ngroup: \"Database\",\nicon: \"Network\",\ndescription: \"Interactive database ERD\",\nview: suspense(<SchemaVisualizer/>) });\n }\n if (activeTools.includes(\"branches\")) {\n views.push({ slug: \"branches\",\nname: \"Branches\",\ngroup: \"Database\",\nicon: \"GitBranch\",\ndescription: \"Create and manage database branches\",\nview: suspense(<BranchesView/>) });\n }\n if (activeTools.includes(\"api\")) {\n views.push({ slug: \"api\",\nname: \"API Explorer\",\ngroup: \"API\",\nicon: \"BookOpen\",\ndescription: \"Interactive API documentation and testing\",\nview: suspense(<ApiExplorer/>) });\n }\n if (activeTools.includes(\"logs\")) {\n views.push({ slug: \"logs\",\nname: \"Logs Explorer\",\ngroup: \"Database\",\nicon: \"Activity\",\ndescription: \"Real-time system and query logs\",\nview: suspense(<LogsExplorer/>) });\n }\n if (activeTools.includes(\"api-keys\")) {\n views.push({ slug: \"api-keys\",\nname: \"API Keys\",\ngroup: \"Access Control\",\nicon: \"KeyRound\",\ndescription: \"Create and manage scoped API keys\",\nview: suspense(<ApiKeysView/>) });\n }\n // Note: \"schema\" tool is auto-injected by RebaseShell when collectionEditor is enabled.\n // It is NOT registered here anymore.\n return views;\n }, [tools]);\n\n // Use a ref for homePage so it never destabilizes the effect.\n // homePage is a React element — its identity doesn't matter for registration.\n const homePageRef = React.useRef(resolvedHomePage);\n homePageRef.current = resolvedHomePage;\n\n useLayoutEffect(() => {\n dispatch.registerStudio({ tools,\nhomePage: homePageRef.current,\ndevViews });\n return () => dispatch.unregisterStudio();\n }, [dispatch, tools, devViews]);\n\n return null;\n}\n"],"mappings":";;;;;;AAuBA,IAAM,WAA4B;CAC9B;EACI,OAAO;EACP,OAAO;GACH;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAa;GACP;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAU;GACJ;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAW;GACL;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAY;GACN;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAc;GACR;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAW;EACT;CACJ;CACA;EACI,OAAO;EACP,OAAO,CACH;GAAE,MAAM;GACpB,MAAM;GACN,aAAa;GACb,MAAM;EAAO,GACD;GAAE,MAAM;GACpB,MAAM;GACN,aAAa;GACb,MAAM;EAAQ,CACN;CACJ;CACA;EACI,OAAO;EACP,OAAO,CACH;GAAE,MAAM;GACpB,MAAM;GACN,aAAa;GACb,MAAM;EAAW,CACT;CACJ;CACA;EACI,OAAO;EACP,OAAO,CACH;GAAE,MAAM;GACpB,MAAM;GACN,aAAa;GACb,MAAM;EAAY,CACV;CACJ;CACA;EACI,OAAO;EACP,OAAO;GACH;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAQ;GACF;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAiB;GACX;IAAE,MAAM;IACpB,MAAM;IACN,aAAa;IACb,MAAM;GAAW;EACT;CACJ;AACJ;A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GAC/B,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM,SAAS,oBAAC,cAAD,CAAc,CAAA,CAAC;EAAE,CAAC;EAEzB,IAAI,YAAY,SAAS,KAAK,GAC1B,MAAM,KAAK;GAAE,MAAM;GAC/B,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM,SAAS,oBAAC,aAAD,CAAa,CAAA,CAAC;EAAE,CAAC;EAExB,IAAI,YAAY,SAAS,MAAM,GAC3B,MAAM,KAAK;GAAE,MAAM;GAC/B,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM,SAAS,oBAAC,cAAD,CAAc,CAAA,CAAC;EAAE,CAAC;EAEzB,IAAI,YAAY,SAAS,UAAU,GAC/B,MAAM,KAAK;GAAE,MAAM;GAC/B,MAAM;GACN,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM,SAAS,oBAAC,aAAD,CAAa,CAAA,CAAC;EAAE,CAAC;EAIxB,OAAO;CACX,GAAG,CAAC,KAAK,CAAC;CAIV,MAAM,cAAc,MAAM,OAAO,gBAAgB;CACjD,YAAY,UAAU;CAEtB,sBAAsB;EAClB,SAAS,eAAe;GAAE;GAClC,UAAU,YAAY;GACtB;EAAS,CAAC;EACF,aAAa,SAAS,iBAAiB;CAC3C,GAAG;EAAC;EAAU;EAAO;CAAQ,CAAC;CAE9B,OAAO;AACX"}
|
package/dist/index.umd.js
CHANGED
|
@@ -60,8 +60,6 @@
|
|
|
60
60
|
var SECTIONS = [
|
|
61
61
|
{
|
|
62
62
|
label: "Database",
|
|
63
|
-
dotColor: "bg-emerald-400",
|
|
64
|
-
iconColor: "text-emerald-400",
|
|
65
63
|
tools: [
|
|
66
64
|
{
|
|
67
65
|
path: "/schema",
|
|
@@ -103,8 +101,6 @@
|
|
|
103
101
|
},
|
|
104
102
|
{
|
|
105
103
|
label: "Compute",
|
|
106
|
-
dotColor: "bg-blue-400",
|
|
107
|
-
iconColor: "text-blue-400",
|
|
108
104
|
tools: [{
|
|
109
105
|
path: "/js",
|
|
110
106
|
name: "JS Console",
|
|
@@ -119,8 +115,6 @@
|
|
|
119
115
|
},
|
|
120
116
|
{
|
|
121
117
|
label: "API",
|
|
122
|
-
dotColor: "bg-violet-400",
|
|
123
|
-
iconColor: "text-violet-400",
|
|
124
118
|
tools: [{
|
|
125
119
|
path: "/api",
|
|
126
120
|
name: "API Explorer",
|
|
@@ -130,8 +124,6 @@
|
|
|
130
124
|
},
|
|
131
125
|
{
|
|
132
126
|
label: "Storage",
|
|
133
|
-
dotColor: "bg-amber-400",
|
|
134
|
-
iconColor: "text-amber-400",
|
|
135
127
|
tools: [{
|
|
136
128
|
path: "/storage",
|
|
137
129
|
name: "Storage",
|
|
@@ -141,8 +133,6 @@
|
|
|
141
133
|
},
|
|
142
134
|
{
|
|
143
135
|
label: "Access Control",
|
|
144
|
-
dotColor: "bg-rose-400",
|
|
145
|
-
iconColor: "text-rose-400",
|
|
146
136
|
tools: [
|
|
147
137
|
{
|
|
148
138
|
path: "/users",
|
|
@@ -165,6 +155,33 @@
|
|
|
165
155
|
]
|
|
166
156
|
}
|
|
167
157
|
];
|
|
158
|
+
var COLLAPSED_STORAGE_KEY = "rebase-studio-home-collapsed";
|
|
159
|
+
function useStudioCollapsedGroups(groupNames) {
|
|
160
|
+
const [collapsed, setCollapsed] = (0, react.useState)(() => {
|
|
161
|
+
try {
|
|
162
|
+
const stored = localStorage.getItem(COLLAPSED_STORAGE_KEY);
|
|
163
|
+
return stored ? new Set(JSON.parse(stored)) : /* @__PURE__ */ new Set();
|
|
164
|
+
} catch {
|
|
165
|
+
return /* @__PURE__ */ new Set();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
const isGroupCollapsed = (name) => collapsed.has(name);
|
|
169
|
+
const toggleGroupCollapsed = (name) => {
|
|
170
|
+
setCollapsed((prev) => {
|
|
171
|
+
const next = new Set(prev);
|
|
172
|
+
if (next.has(name)) next.delete(name);
|
|
173
|
+
else next.add(name);
|
|
174
|
+
try {
|
|
175
|
+
localStorage.setItem(COLLAPSED_STORAGE_KEY, JSON.stringify([...next]));
|
|
176
|
+
} catch {}
|
|
177
|
+
return next;
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
return {
|
|
181
|
+
isGroupCollapsed,
|
|
182
|
+
toggleGroupCollapsed
|
|
183
|
+
};
|
|
184
|
+
}
|
|
168
185
|
function StudioHomePage({ additionalActions, additionalChildrenStart, additionalChildrenEnd, sections, hiddenGroups }) {
|
|
169
186
|
const context = (0, _rebasepro_core.useRebaseContext)();
|
|
170
187
|
const breadcrumbs = (0, _rebasepro_core.useStudioBreadcrumbs)();
|
|
@@ -174,9 +191,11 @@
|
|
|
174
191
|
}, [breadcrumbs.set]);
|
|
175
192
|
const { containerRef } = (0, _rebasepro_core.useRestoreScroll)();
|
|
176
193
|
const pluginActions = (0, _rebasepro_core.useSlot)("home.actions", { context });
|
|
194
|
+
const filteredSections = (0, react.useMemo)(() => SECTIONS.filter((s) => !hiddenGroups?.includes(s.label)), [hiddenGroups]);
|
|
195
|
+
const { isGroupCollapsed, toggleGroupCollapsed } = useStudioCollapsedGroups((0, react.useMemo)(() => filteredSections.map((s) => s.label), [filteredSections]));
|
|
177
196
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
178
197
|
ref: containerRef,
|
|
179
|
-
className: "py-2 overflow-auto h-full w-full",
|
|
198
|
+
className: "py-2 overflow-auto h-full w-full bg-surface-50 dark:bg-surface-800",
|
|
180
199
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_rebasepro_ui.Container, {
|
|
181
200
|
maxWidth: "6xl",
|
|
182
201
|
children: [
|
|
@@ -189,68 +208,77 @@
|
|
|
189
208
|
children: [additionalActions, pluginActions]
|
|
190
209
|
}),
|
|
191
210
|
additionalChildrenStart,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"
|
|
196
|
-
children:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
className: (0, _rebasepro_ui.cls)("
|
|
210
|
-
children:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
211
|
+
filteredSections.map((section) => {
|
|
212
|
+
const sectionCollapsed = isGroupCollapsed(section.label);
|
|
213
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
214
|
+
className: "my-10",
|
|
215
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.ExpandablePanel, {
|
|
216
|
+
invisible: true,
|
|
217
|
+
expanded: !sectionCollapsed,
|
|
218
|
+
onExpandedChange: (open) => {
|
|
219
|
+
if (open !== !sectionCollapsed) toggleGroupCollapsed(section.label);
|
|
220
|
+
},
|
|
221
|
+
className: "mt-6",
|
|
222
|
+
titleClassName: (0, _rebasepro_ui.cls)("min-h-0 p-0 border-none", "rounded flex items-center justify-between w-full", "hover:bg-transparent", "cursor-pointer select-none", sectionCollapsed && "bg-surface-100 dark:bg-surface-900/50"),
|
|
223
|
+
innerClassName: "mt-4 pt-0",
|
|
224
|
+
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.Typography, {
|
|
225
|
+
variant: "caption",
|
|
226
|
+
component: "h2",
|
|
227
|
+
color: "secondary",
|
|
228
|
+
className: (0, _rebasepro_ui.cls)("px-4 py-1 rounded", "font-medium text-[10px] uppercase tracking-[0.08em] text-primary/50 dark:text-primary/70"),
|
|
229
|
+
children: section.label
|
|
230
|
+
}),
|
|
231
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
232
|
+
className: "mt-4 pt-0",
|
|
233
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
234
|
+
className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
235
|
+
children: section.tools.map((tool) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.Card, {
|
|
236
|
+
onClick: () => {
|
|
237
|
+
navigate(tool.path);
|
|
238
|
+
context.analyticsController?.onAnalyticsEvent?.("home_navigate_to_view", { path: tool.path });
|
|
239
|
+
},
|
|
240
|
+
className: (0, _rebasepro_ui.cls)("group h-full p-4 cursor-pointer transition-colors duration-150 ease-in-out", "hover:bg-primary/5 dark:hover:bg-primary/5"),
|
|
241
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
242
|
+
className: "flex flex-col h-full",
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
245
|
+
className: "flex items-center w-full justify-between mb-1",
|
|
246
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
247
|
+
className: "flex items-center gap-3",
|
|
248
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
249
|
+
className: "flex items-center justify-center w-5 h-5 text-surface-400 dark:text-surface-500 transition-colors duration-150 group-hover:text-primary dark:group-hover:text-primary",
|
|
250
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_core.IconForView, {
|
|
251
|
+
collectionOrView: {
|
|
252
|
+
slug: tool.path,
|
|
253
|
+
name: tool.name,
|
|
254
|
+
icon: tool.icon
|
|
255
|
+
},
|
|
256
|
+
size: "small"
|
|
257
|
+
})
|
|
258
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.Typography, {
|
|
259
|
+
variant: "subtitle1",
|
|
260
|
+
component: "h2",
|
|
261
|
+
children: tool.name
|
|
262
|
+
})]
|
|
263
|
+
})
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
266
|
+
className: "pl-8",
|
|
267
|
+
children: tool.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.Typography, {
|
|
268
|
+
variant: "caption",
|
|
269
|
+
color: "secondary",
|
|
270
|
+
component: "div",
|
|
271
|
+
children: tool.description
|
|
272
|
+
})
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "grow" })
|
|
275
|
+
]
|
|
248
276
|
})
|
|
249
|
-
})
|
|
277
|
+
}, tool.path))
|
|
250
278
|
})
|
|
251
|
-
}
|
|
252
|
-
})
|
|
253
|
-
}, section.label)
|
|
279
|
+
})
|
|
280
|
+
})
|
|
281
|
+
}, section.label);
|
|
254
282
|
}),
|
|
255
283
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
256
284
|
className: "mt-10 mb-6",
|
|
@@ -261,7 +289,7 @@
|
|
|
261
289
|
variant: "caption",
|
|
262
290
|
component: "h2",
|
|
263
291
|
color: "secondary",
|
|
264
|
-
className: "py-
|
|
292
|
+
className: (0, _rebasepro_ui.cls)("px-4 py-1 rounded", "font-medium text-[10px] uppercase tracking-[0.08em] text-primary/50 dark:text-primary/70"),
|
|
265
293
|
children: "Quick Start"
|
|
266
294
|
})
|
|
267
295
|
}),
|
|
@@ -314,7 +342,7 @@
|
|
|
314
342
|
variant: "caption",
|
|
315
343
|
component: "h2",
|
|
316
344
|
color: "secondary",
|
|
317
|
-
className: "
|
|
345
|
+
className: (0, _rebasepro_ui.cls)("px-4 py-1 rounded", "font-medium text-[10px] uppercase tracking-[0.08em] text-primary/50 dark:text-primary/70"),
|
|
318
346
|
children: s.title
|
|
319
347
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
320
348
|
className: "mt-4",
|
|
@@ -2865,10 +2893,10 @@ interface FindResponse<M extends Record<string, any> = any> {
|
|
|
2865
2893
|
};
|
|
2866
2894
|
}
|
|
2867
2895
|
|
|
2868
|
-
type
|
|
2896
|
+
type WhereFilterOp = "<" | "<=" | "==" | "!=" | ">=" | ">" | "in" | "not-in" | "array-contains" | "array-contains-any";
|
|
2869
2897
|
|
|
2870
2898
|
interface QueryBuilder<M extends Record<string, any> = any> {
|
|
2871
|
-
where(column: keyof M & string, operator:
|
|
2899
|
+
where(column: keyof M & string, operator: WhereFilterOp, value: any): QueryBuilder<M>;
|
|
2872
2900
|
orderBy(column: keyof M & string, direction?: "asc" | "desc"): QueryBuilder<M>;
|
|
2873
2901
|
limit(count: number): QueryBuilder<M>;
|
|
2874
2902
|
offset(count: number): QueryBuilder<M>;
|
|
@@ -2884,7 +2912,7 @@ interface CollectionClient<M extends Record<string, any> = any> {
|
|
|
2884
2912
|
create(data: Partial<M>, id?: string | number): Promise<Entity<M>>;
|
|
2885
2913
|
update(id: string | number, data: Partial<M>): Promise<Entity<M>>;
|
|
2886
2914
|
delete(id: string | number): Promise<void>;
|
|
2887
|
-
where(column: keyof M & string, operator:
|
|
2915
|
+
where(column: keyof M & string, operator: WhereFilterOp, value: any): QueryBuilder<M>;
|
|
2888
2916
|
orderBy(column: keyof M & string, direction?: "asc" | "desc"): QueryBuilder<M>;
|
|
2889
2917
|
limit(count: number): QueryBuilder<M>;
|
|
2890
2918
|
offset(count: number): QueryBuilder<M>;
|
|
@@ -6418,8 +6446,16 @@ return result;
|
|
|
6418
6446
|
var StorageView$1;
|
|
6419
6447
|
var init_StorageView = __esmMin((() => {
|
|
6420
6448
|
StorageView$1 = () => {
|
|
6421
|
-
const
|
|
6449
|
+
const defaultStorageSource = (0, _rebasepro_core.useStorageSource)();
|
|
6450
|
+
const storageSources = (0, _rebasepro_core.useStorageSources)();
|
|
6422
6451
|
const snackbarController = (0, _rebasepro_core.useSnackbarController)();
|
|
6452
|
+
const sourceKeys = (0, react.useMemo)(() => {
|
|
6453
|
+
const keys = Object.keys(storageSources.sources);
|
|
6454
|
+
if (!keys.includes(_rebasepro_types.DEFAULT_STORAGE_SOURCE_KEY)) keys.unshift(_rebasepro_types.DEFAULT_STORAGE_SOURCE_KEY);
|
|
6455
|
+
return keys;
|
|
6456
|
+
}, [storageSources.sources]);
|
|
6457
|
+
const [selectedSourceKey, setSelectedSourceKey] = (0, react.useState)(_rebasepro_types.DEFAULT_STORAGE_SOURCE_KEY);
|
|
6458
|
+
const storageSource = storageSources.sources[selectedSourceKey] ?? defaultStorageSource;
|
|
6423
6459
|
const [searchParams, setSearchParams] = (0, react_router_dom.useSearchParams)();
|
|
6424
6460
|
const currentPath = searchParams.get("path") || "";
|
|
6425
6461
|
const [loading, setLoading] = (0, react.useState)(true);
|
|
@@ -6483,7 +6519,11 @@ return result;
|
|
|
6483
6519
|
}, []);
|
|
6484
6520
|
(0, react.useEffect)(() => {
|
|
6485
6521
|
fetchContents(currentPath);
|
|
6486
|
-
}, [
|
|
6522
|
+
}, [
|
|
6523
|
+
currentPath,
|
|
6524
|
+
fetchContents,
|
|
6525
|
+
selectedSourceKey
|
|
6526
|
+
]);
|
|
6487
6527
|
const handleNavigate = (0, react.useCallback)((path) => {
|
|
6488
6528
|
if (!path) setSearchParams({});
|
|
6489
6529
|
else setSearchParams({ path });
|
|
@@ -7163,6 +7203,21 @@ return result;
|
|
|
7163
7203
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
7164
7204
|
className: "flex shrink-0 items-center justify-end gap-1.5 pr-1",
|
|
7165
7205
|
children: [
|
|
7206
|
+
sourceKeys.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.Select, {
|
|
7207
|
+
size: "small",
|
|
7208
|
+
position: "item-aligned",
|
|
7209
|
+
value: selectedSourceKey,
|
|
7210
|
+
onValueChange: (value) => {
|
|
7211
|
+
if (value) setSelectedSourceKey(value);
|
|
7212
|
+
},
|
|
7213
|
+
renderValue: (key) => {
|
|
7214
|
+
return storageSources.registry[key]?.label ?? (key === _rebasepro_types.DEFAULT_STORAGE_SOURCE_KEY ? "Default" : key);
|
|
7215
|
+
},
|
|
7216
|
+
children: sourceKeys.map((key) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.SelectItem, {
|
|
7217
|
+
value: key,
|
|
7218
|
+
children: storageSources.registry[key]?.label ?? (key === _rebasepro_types.DEFAULT_STORAGE_SOURCE_KEY ? "Default" : key)
|
|
7219
|
+
}, key))
|
|
7220
|
+
}),
|
|
7166
7221
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.Tooltip, {
|
|
7167
7222
|
title: "Grid view",
|
|
7168
7223
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_rebasepro_ui.IconButton, {
|