@lunora/studio 1.0.0-alpha.5 → 1.0.0-alpha.50

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.
Files changed (198) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +45 -23
  4. package/dist/index.js +31 -31
  5. package/dist/mount.d.ts +1 -1
  6. package/dist/mount.js +3 -2
  7. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  8. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
  9. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
  10. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +55 -32
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +15 -32
  12. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
  13. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  14. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
  15. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
  16. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
  17. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  18. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
  19. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  20. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
  21. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
  22. package/dist/packem_chunks/SettingsPanel.js +391 -0
  23. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +159 -387
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +13 -94
  25. package/dist/packem_chunks/agents-panel.js +326 -0
  26. package/dist/packem_chunks/analytics-panel.js +261 -0
  27. package/dist/packem_chunks/auth-config-panel.js +365 -0
  28. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  29. package/dist/packem_chunks/containers-panel.js +261 -0
  30. package/dist/packem_chunks/dashboards-panel.js +781 -0
  31. package/dist/packem_chunks/fanout-panel.js +482 -0
  32. package/dist/packem_chunks/flags-panel.js +176 -0
  33. package/dist/packem_chunks/issues-panel.js +188 -0
  34. package/dist/packem_chunks/kv-browser.js +1896 -0
  35. package/dist/packem_chunks/log-drains-panel.js +273 -0
  36. package/dist/packem_chunks/organizations-panel.js +3178 -0
  37. package/dist/packem_chunks/payments-panel.js +186 -0
  38. package/dist/packem_chunks/permissions-panel.js +805 -0
  39. package/dist/packem_chunks/queues-panel.js +1075 -0
  40. package/dist/packem_chunks/rls-panel.js +315 -0
  41. package/dist/packem_chunks/schedule-panel.js +831 -0
  42. package/dist/packem_chunks/sparkline.js +79 -0
  43. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  44. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  45. package/dist/packem_chunks/users-panel.js +1731 -0
  46. package/dist/packem_chunks/vector-browser.js +281 -0
  47. package/dist/packem_chunks/workflows-panel.js +562 -0
  48. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-DNeyYtUN.js} +8 -0
  49. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-_aEZxAMX.js} +2 -2
  50. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Dd8pcswz.js} +2 -1
  51. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-BXV4eKf5.js} +1 -1
  52. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-C8hejnub.js} +201 -250
  53. package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
  54. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CxJxRRf2.js} +37 -66
  55. package/dist/packem_shared/HomePanel-Ye8PaqQL.js +14 -0
  56. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CWaf0ZtX.js} +2 -1
  57. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-dHMgnJbx.js} +163 -60
  58. package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
  59. package/dist/packem_shared/Studio-xJLTlLpf.js +16 -0
  60. package/dist/packem_shared/{StudioApp-D4azxYBu.js → StudioApp-oCQholCL.js} +6 -21
  61. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-Cx21PS_T.js} +6 -6
  62. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  63. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CGdOmLTm.d.ts} +1 -1
  64. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  65. package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
  66. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  67. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-C9I16KWr.js} +1 -1
  68. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  69. package/dist/packem_shared/error-alert-vIPQoN3Y.js +114 -0
  70. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-B_fZH4iQ.js} +133 -164
  71. package/dist/packem_shared/home-panel-D62G8108.js +1889 -0
  72. package/dist/packem_shared/internal-zwBoOv24.js +122 -0
  73. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  74. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUULLuOi.js} +8 -61
  75. package/dist/packem_shared/result-chart-DZradBAS.js +119 -0
  76. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  77. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  78. package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
  79. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  80. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  81. package/dist/packem_shared/studio-WZUOecDv.js +4069 -0
  82. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  83. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-huX4VmgI.js} +19 -9
  84. package/dist/packem_shared/use-admin-query-BGJ010yZ.js +106 -0
  85. package/dist/packem_shared/use-async-submit-DGCtuDyz.js +91 -0
  86. package/dist/standalone/chunk-22C6COGE.js +13 -0
  87. package/dist/standalone/chunk-2CCWLKQW.js +1 -0
  88. package/dist/standalone/chunk-2JTPX3CV.js +1 -0
  89. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  90. package/dist/standalone/chunk-2MLA6WFH.js +1 -0
  91. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  92. package/dist/standalone/chunk-3CPQ5IQU.js +1 -0
  93. package/dist/standalone/chunk-3GXGLNKW.js +1 -0
  94. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  95. package/dist/standalone/chunk-4AXW2ECS.js +13 -0
  96. package/dist/standalone/chunk-4BVRLBEW.js +1 -0
  97. package/dist/standalone/chunk-4PC7IXNY.js +1 -0
  98. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  99. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  100. package/dist/standalone/chunk-5OZQHQ26.js +1 -0
  101. package/dist/standalone/chunk-6RREMPQX.js +2 -0
  102. package/dist/standalone/chunk-6ZBU3JWR.js +3 -0
  103. package/dist/standalone/chunk-7LDYSHOU.js +1 -0
  104. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  105. package/dist/standalone/chunk-A2DBMISD.js +1 -0
  106. package/dist/standalone/chunk-A3ZJACVT.js +4 -0
  107. package/dist/standalone/chunk-A66LI6OV.js +4 -0
  108. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  109. package/dist/standalone/chunk-AITOCPML.js +1 -0
  110. package/dist/standalone/chunk-APSSZB6Z.js +1 -0
  111. package/dist/standalone/chunk-BGG56IF5.js +1 -0
  112. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  113. package/dist/standalone/chunk-CJXJIRSN.js +1 -0
  114. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  115. package/dist/standalone/chunk-DR6LGPXE.js +1 -0
  116. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  117. package/dist/standalone/chunk-EEWKIQUE.js +1 -0
  118. package/dist/standalone/chunk-EOE5NDMK.js +1 -0
  119. package/dist/standalone/chunk-FAUN4Z72.js +1 -0
  120. package/dist/standalone/chunk-G7ZBM54M.js +1 -0
  121. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  122. package/dist/standalone/chunk-HAJSYWFT.js +8 -0
  123. package/dist/standalone/chunk-HQM6MBPS.js +1 -0
  124. package/dist/standalone/chunk-HTQNZXDT.js +1 -0
  125. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  126. package/dist/standalone/chunk-IO2XEI6T.js +1 -0
  127. package/dist/standalone/chunk-ITQKVEP7.js +19 -0
  128. package/dist/standalone/chunk-IZN4TYMN.js +1 -0
  129. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  130. package/dist/standalone/chunk-JM7XBQVK.js +1 -0
  131. package/dist/standalone/chunk-JPILGFXT.js +1 -0
  132. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  133. package/dist/standalone/chunk-JUDPYSJZ.js +1 -0
  134. package/dist/standalone/chunk-K4S652EQ.js +4 -0
  135. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  136. package/dist/standalone/chunk-KJFFID72.js +1 -0
  137. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  138. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  139. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  140. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  141. package/dist/standalone/chunk-LJAAZNQ6.js +1 -0
  142. package/dist/standalone/chunk-LUP4YTBS.js +1 -0
  143. package/dist/standalone/chunk-LX7KONE3.js +1 -0
  144. package/dist/standalone/chunk-MDTNVR3G.js +1 -0
  145. package/dist/standalone/chunk-NS23QR4W.js +1 -0
  146. package/dist/standalone/chunk-NW6SZZ5O.js +1 -0
  147. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  148. package/dist/standalone/chunk-P2ERTKMB.js +1 -0
  149. package/dist/standalone/chunk-PS3XCCZD.js +1 -0
  150. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  151. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  152. package/dist/standalone/chunk-RS7S7XVP.js +1 -0
  153. package/dist/standalone/chunk-S5NTGHCG.js +1 -0
  154. package/dist/standalone/chunk-S7AB7Y75.js +1 -0
  155. package/dist/standalone/chunk-SDMZKBTD.js +1 -0
  156. package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
  157. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  158. package/dist/standalone/chunk-SHERR7ZP.js +1 -0
  159. package/dist/standalone/chunk-SHJUAHC6.js +1 -0
  160. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  161. package/dist/standalone/chunk-TO6D2PJC.js +6 -0
  162. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  163. package/dist/standalone/chunk-TYN6SQ73.js +1 -0
  164. package/dist/standalone/chunk-U26QNHMO.js +1 -0
  165. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  166. package/dist/standalone/chunk-UTHHHJYS.js +1 -0
  167. package/dist/standalone/chunk-V43BLH4J.js +1 -0
  168. package/dist/standalone/chunk-VL23Y44O.js +4 -0
  169. package/dist/standalone/chunk-VL6HOZHF.js +1 -0
  170. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  171. package/dist/standalone/chunk-W666BB6V.js +1 -0
  172. package/dist/standalone/chunk-W6JKUZKD.js +1 -0
  173. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  174. package/dist/standalone/chunk-WUFVFVHJ.js +1 -0
  175. package/dist/standalone/chunk-WVTPZ6CM.js +1 -0
  176. package/dist/standalone/chunk-X2TQRMQV.js +1 -0
  177. package/dist/standalone/chunk-X4676IX6.js +1 -0
  178. package/dist/standalone/chunk-X4QFAAZ5.js +76 -0
  179. package/dist/standalone/chunk-XJU5SRNL.js +4 -0
  180. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  181. package/dist/standalone/chunk-XWPZBZSZ.js +3 -0
  182. package/dist/standalone/chunk-YLHDKM2P.js +1 -0
  183. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  184. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  185. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  186. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  187. package/dist/standalone/studio.js +104 -246
  188. package/dist/styles.css +2 -2
  189. package/package.json +17 -15
  190. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  191. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  192. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  193. package/dist/packem_shared/Studio-BmSGSIuY.js +0 -33
  194. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  195. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  196. package/dist/packem_shared/studio-H9fuQgSj.js +0 -10303
  197. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  198. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -1,257 +1,19 @@
1
1
  import { c } from 'react/compiler-runtime';
2
2
  import { useLunora } from '@lunora/react';
3
- import { useState, useEffect, useRef, useId } from 'react';
4
- import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
5
- import { h as formatCell, f as fireAndForget, c as callOptions, a as adminRef, e as errorMessage } from './internal-rXJEAhXS.js';
6
- import { X as XAxis, B as Bar, T as Tooltip, E as EvilBarChart } from './bar-chart-CzJAgqkp.js';
3
+ import { useState, useRef, useEffect, useId } from 'react';
4
+ import { S as SqlResultChart } from '../packem_shared/result-chart-DZradBAS.js';
5
+ import { ShardInput } from '../packem_shared/ShardInput-CZnpHILL.js';
6
+ import { A as Alert } from '../packem_shared/alert-CdAET2K_.js';
7
+ import { c as TableHead, a as TableHeader, b as TableRow, e as TableCell, d as TableBody, T as Table } from '../packem_shared/table-DsCa9Qp9.js';
8
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
9
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-DNeyYtUN.js';
10
+ import { u as usePersistedList, n as newId, b as usePersistedValue } from '../packem_shared/browser-storage-L4gOP5gJ.js';
11
+ import { f as fireAndForget, c as callOptions, a as adminRef, e as errorMessage } from '../packem_shared/internal-zwBoOv24.js';
12
+ import { r as recordShard } from '../packem_shared/shard-history-AxiJ1WPP.js';
13
+ import { C as CellValue } from '../packem_shared/data-grid-C9I16KWr.js';
14
+ import { E as ExportMenu } from '../packem_shared/grid-features-B_fZH4iQ.js';
15
+ import { c as cn } from '../packem_shared/utils-B05Dmz_H.js';
7
16
  import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
8
- import { ShardInput } from './ShardInput-gx_DZXXn.js';
9
- import { cva } from 'class-variance-authority';
10
- import { c as cn } from './utils-B05Dmz_H.js';
11
- import { c as TableHead, a as TableHeader, b as TableRow, e as TableCell, d as TableBody, T as Table } from './table-_RzNvy3R.js';
12
- import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTIONS-DmBqMZ-z.js';
13
- import { r as recordShard } from './shard-history-DyebH1R5.js';
14
- import { C as CellValue } from './data-grid-B5CaV3wS.js';
15
- import { E as ExportMenu } from './grid-features-CzUfqgsM.js';
16
-
17
- const MAX_BARS = 50;
18
- const RESULT_CHART_CONFIG = {
19
- value: {
20
- colors: {
21
- dark: ["var(--chart-1)"],
22
- light: ["var(--chart-1)"]
23
- },
24
- label: "value"
25
- }
26
- };
27
- const pickColumns = (result) => {
28
- const value = result.columns.find((column) => result.rows.length > 0 && result.rows.every((row) => typeof row[column] === "number")) ?? null;
29
- const label = result.columns.find((column) => column !== value) ?? null;
30
- return {
31
- label,
32
- value
33
- };
34
- };
35
- const SqlResultChart = (t0) => {
36
- const $ = c(15);
37
- const {
38
- result
39
- } = t0;
40
- const t = useT();
41
- let t1;
42
- if ($[0] !== result) {
43
- t1 = pickColumns(result);
44
- $[0] = result;
45
- $[1] = t1;
46
- } else {
47
- t1 = $[1];
48
- }
49
- const {
50
- label,
51
- value
52
- } = t1;
53
- let t2;
54
- if ($[2] !== label || $[3] !== result || $[4] !== value) {
55
- t2 = value === null ? [] : result.rows.slice(0, MAX_BARS).map((row, index) => ({
56
- label: label === null ? `#${(index + 1).toString()}` : formatCell(row[label]),
57
- value: Number(row[value]) || 0
58
- }));
59
- $[2] = label;
60
- $[3] = result;
61
- $[4] = value;
62
- $[5] = t2;
63
- } else {
64
- t2 = $[5];
65
- }
66
- const data = t2;
67
- if (value === null) {
68
- let t32;
69
- if ($[6] !== t) {
70
- t32 = t("No numeric column to chart.");
71
- $[6] = t;
72
- $[7] = t32;
73
- } else {
74
- t32 = $[7];
75
- }
76
- let t42;
77
- if ($[8] !== t32) {
78
- t42 = /* @__PURE__ */ jsxDEV("p", {
79
- className: "p-4 text-sm text-muted-foreground",
80
- "data-testid": "sql-chart-empty",
81
- children: t32
82
- }, void 0, false);
83
- $[8] = t32;
84
- $[9] = t42;
85
- } else {
86
- t42 = $[9];
87
- }
88
- return t42;
89
- }
90
- let t3;
91
- let t4;
92
- let t5;
93
- if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
94
- t3 = /* @__PURE__ */ jsxDEV(XAxis, {
95
- dataKey: "label"
96
- }, void 0, false);
97
- t4 = /* @__PURE__ */ jsxDEV(Bar, {
98
- dataKey: "value"
99
- }, void 0, false);
100
- t5 = /* @__PURE__ */ jsxDEV(Tooltip, {}, void 0, false);
101
- $[10] = t3;
102
- $[11] = t4;
103
- $[12] = t5;
104
- } else {
105
- t3 = $[10];
106
- t4 = $[11];
107
- t5 = $[12];
108
- }
109
- let t6;
110
- if ($[13] !== data) {
111
- t6 = /* @__PURE__ */ jsxDEV("div", {
112
- className: "h-80 w-full p-3",
113
- "data-testid": "sql-chart",
114
- children: /* @__PURE__ */ jsxDEV(EvilBarChart, {
115
- className: "h-full w-full",
116
- config: RESULT_CHART_CONFIG,
117
- data,
118
- children: [t3, t4, t5]
119
- }, void 0, true)
120
- }, void 0, false);
121
- $[13] = data;
122
- $[14] = t6;
123
- } else {
124
- t6 = $[14];
125
- }
126
- return t6;
127
- };
128
-
129
- const alertVariants = cva("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0", {
130
- defaultVariants: {
131
- variant: "default"
132
- },
133
- variants: {
134
- variant: {
135
- default: "border-border bg-muted/40 text-foreground",
136
- destructive: "border-destructive/40 bg-destructive/5 text-destructive",
137
- warning: "border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"
138
- }
139
- }
140
- });
141
- const Alert = (t0) => {
142
- const $ = c(10);
143
- const {
144
- children,
145
- className,
146
- icon,
147
- testId,
148
- variant
149
- } = t0;
150
- let t1;
151
- if ($[0] !== className || $[1] !== variant) {
152
- t1 = cn(alertVariants({
153
- variant
154
- }), className);
155
- $[0] = className;
156
- $[1] = variant;
157
- $[2] = t1;
158
- } else {
159
- t1 = $[2];
160
- }
161
- let t2;
162
- if ($[3] !== children) {
163
- t2 = /* @__PURE__ */ jsxDEV("div", {
164
- className: "min-w-0 flex-1",
165
- children
166
- }, void 0, false);
167
- $[3] = children;
168
- $[4] = t2;
169
- } else {
170
- t2 = $[4];
171
- }
172
- let t3;
173
- if ($[5] !== icon || $[6] !== t1 || $[7] !== t2 || $[8] !== testId) {
174
- t3 = /* @__PURE__ */ jsxDEV("div", {
175
- className: t1,
176
- "data-testid": testId,
177
- role: "alert",
178
- children: [icon, t2]
179
- }, void 0, true);
180
- $[5] = icon;
181
- $[6] = t1;
182
- $[7] = t2;
183
- $[8] = testId;
184
- $[9] = t3;
185
- } else {
186
- t3 = $[9];
187
- }
188
- return t3;
189
- };
190
-
191
- const store = () => {
192
- try {
193
- return globalThis.localStorage;
194
- } catch {
195
- return void 0;
196
- }
197
- };
198
- const loadJsonArray = function(key) {
199
- try {
200
- const raw = store()?.getItem(key) ?? void 0;
201
- const parsed = raw === void 0 ? [] : JSON.parse(raw);
202
- return Array.isArray(parsed) ? parsed : [];
203
- } catch {
204
- return [];
205
- }
206
- };
207
- const saveJson = (key, value) => {
208
- const storage = store();
209
- if (storage === void 0) {
210
- return;
211
- }
212
- try {
213
- storage.setItem(key, JSON.stringify(value));
214
- } catch {
215
- }
216
- };
217
- const usePersistedList = function(key) {
218
- const $ = c(8);
219
- let t0;
220
- if ($[0] !== key) {
221
- t0 = () => loadJsonArray(key);
222
- $[0] = key;
223
- $[1] = t0;
224
- } else {
225
- t0 = $[1];
226
- }
227
- const [value, setValue] = useState(t0);
228
- let t1;
229
- let t2;
230
- if ($[2] !== key || $[3] !== value) {
231
- t1 = () => {
232
- saveJson(key, value);
233
- };
234
- t2 = [key, value];
235
- $[2] = key;
236
- $[3] = value;
237
- $[4] = t1;
238
- $[5] = t2;
239
- } else {
240
- t1 = $[4];
241
- t2 = $[5];
242
- }
243
- useEffect(t1, t2);
244
- let t3;
245
- if ($[6] !== value) {
246
- t3 = [value, setValue];
247
- $[6] = value;
248
- $[7] = t3;
249
- } else {
250
- t3 = $[7];
251
- }
252
- return t3;
253
- };
254
- const newId = (prefix) => globalThis.crypto?.randomUUID?.() ?? `${prefix}-${globalThis.performance.now().toString(36)}`;
255
17
 
256
18
  const SQL_KEYWORDS = ["ORDER BY", "GROUP BY", "LEFT JOIN", "RIGHT JOIN", "INNER JOIN", "OUTER JOIN", "CROSS JOIN", "EXPLAIN QUERY PLAN", "SELECT", "DISTINCT", "FROM", "WHERE", "HAVING", "LIMIT", "OFFSET", "JOIN", "ON", "AND", "OR", "AS", "ASC", "DESC", "WITH", "UNION", "EXPLAIN"];
257
19
  const SQL_NEWLINE_CLAUSES = ["FROM", "WHERE", "ORDER BY", "GROUP BY", "HAVING", "LIMIT", "OFFSET", "UNION", "JOIN", "LEFT JOIN", "RIGHT JOIN", "INNER JOIN", "OUTER JOIN", "CROSS JOIN"];
@@ -1289,34 +1051,7 @@ const makeTab = (sql = "", name = "") => {
1289
1051
  };
1290
1052
  };
1291
1053
  const usePersistedActive = () => {
1292
- const $ = c(5);
1293
- const [list, setList] = usePersistedList(ACTIVE_KEY);
1294
- let t0;
1295
- if ($[0] !== setList) {
1296
- t0 = (action) => {
1297
- setList((current) => {
1298
- const previous = current[0] ?? "";
1299
- const next = typeof action === "function" ? action(previous) : action;
1300
- return [next];
1301
- });
1302
- };
1303
- $[0] = setList;
1304
- $[1] = t0;
1305
- } else {
1306
- t0 = $[1];
1307
- }
1308
- const setActive = t0;
1309
- const t1 = list[0] ?? "";
1310
- let t2;
1311
- if ($[2] !== setActive || $[3] !== t1) {
1312
- t2 = [t1, setActive];
1313
- $[2] = setActive;
1314
- $[3] = t1;
1315
- $[4] = t2;
1316
- } else {
1317
- t2 = $[4];
1318
- }
1319
- return t2;
1054
+ return usePersistedValue(ACTIVE_KEY, "");
1320
1055
  };
1321
1056
  const usePersistedTabs = (seed) => {
1322
1057
  const [stored, setTabs] = usePersistedList(TABS_KEY);
@@ -1872,6 +1607,7 @@ function _temp$1(node) {
1872
1607
  const RUN_SQL = adminRef(ADMIN_FUNCTIONS.runSql);
1873
1608
  const STORAGE_KEY = "lunora-studio-sql-queries";
1874
1609
  const HISTORY_KEY = "lunora-studio-sql-history";
1610
+ const SPLIT_VIEW_KEY = "lunora-studio-sql-split-view";
1875
1611
  const HISTORY_LIMIT = 25;
1876
1612
  const GUTTER_STYLE = {
1877
1613
  minWidth: "2.75rem",
@@ -1990,6 +1726,7 @@ const SqlEditorPanel = ({
1990
1726
  const [outputs, setOutputs] = useState({});
1991
1727
  const [shardKey, setShardKey] = useState(initialShardKey ?? "");
1992
1728
  const [running, setRunning] = useState(false);
1729
+ const [splitView, setSplitView] = usePersistedValue(SPLIT_VIEW_KEY, false);
1993
1730
  const [tabMenu, setTabMenu] = useState(null);
1994
1731
  const [pendingBulk, setPendingBulk] = useState(null);
1995
1732
  const gutterRef = useRef(null);
@@ -2310,11 +2047,16 @@ const SqlEditorPanel = ({
2310
2047
  const showChart = () => {
2311
2048
  setActivePane("chart");
2312
2049
  };
2050
+ const toggleSplit = () => {
2051
+ setSplitView(!splitView);
2052
+ };
2313
2053
  const lineCount = draft.split("\n").length;
2314
2054
  const onSearchChange = (event_7) => {
2315
2055
  setSearch(event_7.target.value);
2316
2056
  };
2317
2057
  const tabClass = (selected) => `border-b-2 px-3 py-2 text-sm outline-none transition-colors ${selected ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"}`;
2058
+ const workspaceClass = splitView ? "flex min-h-0 flex-1 flex-row" : "flex min-h-0 flex-1 flex-col";
2059
+ const resultsClass = splitView ? "flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border" : "flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border";
2318
2060
  return /* @__PURE__ */ jsxDEV("div", {
2319
2061
  className: "flex h-full min-w-0",
2320
2062
  "data-testid": "lunora-sql-editor",
@@ -2432,122 +2174,152 @@ const SqlEditorPanel = ({
2432
2174
  )
2433
2175
  }, void 0, false)]
2434
2176
  }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2435
- className: "flex min-h-0 flex-1",
2436
- children: [/* @__PURE__ */ jsxDEV("div", {
2437
- "aria-hidden": "true",
2438
- className: "shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",
2439
- ref: gutterRef,
2440
- style: GUTTER_STYLE,
2441
- children: Array.from({
2442
- length: lineCount
2443
- }, (_, index_0) => /* @__PURE__ */ jsxDEV("div", {
2444
- children: index_0 + 1
2445
- }, index_0, false))
2446
- }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
2447
- className: "relative min-w-0 flex-1",
2448
- children: [/* @__PURE__ */ jsxDEV("textarea", {
2449
- "aria-activedescendant": autocompleteState === null ? void 0 : `${listboxId}-opt-${autocompleteState.active.toString()}`,
2450
- "aria-autocomplete": "list",
2451
- "aria-controls": autocompleteState === null ? void 0 : listboxId,
2452
- "aria-expanded": autocompleteState !== null,
2453
- "aria-label": t("SQL query"),
2454
- className: "size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none",
2455
- "data-testid": "sql-input",
2456
- onBlur: onEditorBlur,
2457
- onChange: onDraftChange,
2458
- onKeyDown: onEditorKeyDown,
2459
- onScroll: onEditorScroll,
2460
- onSelect: onEditorSelect,
2461
- placeholder: "SELECT * FROM …",
2462
- ref: editorRef,
2463
- role: "combobox",
2464
- spellCheck: false,
2465
- value: draft
2466
- }, void 0, false), /* @__PURE__ */ jsxDEV(AutocompletePopover, {
2467
- listboxId,
2468
- onPick: onPickSuggestion,
2469
- state: autocompleteState
2470
- }, void 0, false)]
2471
- }, void 0, true)]
2472
- }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2473
- className: "flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border",
2177
+ className: workspaceClass,
2474
2178
  children: [/* @__PURE__ */ jsxDEV("div", {
2475
- className: "flex shrink-0 items-center gap-2 border-b border-border pe-2",
2476
- children: [/* @__PURE__ */ jsxDEV("button", {
2477
- className: tabClass(tab === "results"),
2478
- "data-testid": "sql-tab-results",
2479
- onClick: showResults,
2480
- type: "button",
2481
- children: t("Results")
2482
- }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2483
- className: tabClass(tab === "chart"),
2484
- "data-testid": "sql-tab-chart",
2485
- onClick: showChart,
2486
- type: "button",
2487
- children: t("Chart")
2488
- }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2489
- className: tabClass(tab === "explain"),
2490
- "data-testid": "sql-tab-explain",
2491
- onClick: showExplain,
2492
- type: "button",
2493
- children: t("Explain")
2179
+ className: "flex min-h-0 min-w-0 flex-1",
2180
+ children: [/* @__PURE__ */ jsxDEV("div", {
2181
+ "aria-hidden": "true",
2182
+ className: "shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",
2183
+ ref: gutterRef,
2184
+ style: GUTTER_STYLE,
2185
+ children: Array.from({
2186
+ length: lineCount
2187
+ }, (_, index_0) => /* @__PURE__ */ jsxDEV("div", {
2188
+ children: index_0 + 1
2189
+ }, index_0, false))
2494
2190
  }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
2495
- className: "ms-auto flex items-center gap-2",
2496
- children: [result !== null && result.columns.length > 0 && /* @__PURE__ */ jsxDEV(ExportMenu, {
2497
- columns: result.columns,
2498
- name: "query-result",
2499
- rows: result.rows
2191
+ className: "relative min-w-0 flex-1",
2192
+ children: [/* @__PURE__ */ jsxDEV("textarea", {
2193
+ "aria-activedescendant": autocompleteState === null ? void 0 : `${listboxId}-opt-${autocompleteState.active.toString()}`,
2194
+ "aria-autocomplete": "list",
2195
+ "aria-controls": autocompleteState === null ? void 0 : listboxId,
2196
+ "aria-expanded": autocompleteState !== null,
2197
+ "aria-label": t("SQL query"),
2198
+ className: "size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none",
2199
+ "data-testid": "sql-input",
2200
+ onBlur: onEditorBlur,
2201
+ onChange: onDraftChange,
2202
+ onKeyDown: onEditorKeyDown,
2203
+ onScroll: onEditorScroll,
2204
+ onSelect: onEditorSelect,
2205
+ placeholder: "SELECT * FROM …",
2206
+ ref: editorRef,
2207
+ role: "combobox",
2208
+ spellCheck: false,
2209
+ value: draft
2210
+ }, void 0, false), /* @__PURE__ */ jsxDEV(AutocompletePopover, {
2211
+ listboxId,
2212
+ onPick: onPickSuggestion,
2213
+ state: autocompleteState
2214
+ }, void 0, false)]
2215
+ }, void 0, true)]
2216
+ }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2217
+ className: resultsClass,
2218
+ children: [/* @__PURE__ */ jsxDEV("div", {
2219
+ className: "flex shrink-0 items-center gap-2 border-b border-border pe-2",
2220
+ children: [/* @__PURE__ */ jsxDEV("button", {
2221
+ className: tabClass(tab === "results"),
2222
+ "data-testid": "sql-tab-results",
2223
+ onClick: showResults,
2224
+ type: "button",
2225
+ children: t("Results")
2500
2226
  }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2501
- className: "inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",
2502
- "data-testid": "sql-format",
2503
- disabled: running,
2504
- onClick: formatDraft,
2227
+ className: tabClass(tab === "chart"),
2228
+ "data-testid": "sql-tab-chart",
2229
+ onClick: showChart,
2505
2230
  type: "button",
2506
- children: t("Format")
2507
- }, void 0, false), /* @__PURE__ */ jsxDEV(ShardInput, {
2508
- onChange: setShardKey,
2509
- testId: "sql-shard-input",
2510
- value: shardKey
2231
+ children: t("Chart")
2511
2232
  }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2512
- className: "inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",
2513
- "data-testid": "sql-run",
2514
- disabled: running,
2515
- onClick: onRun,
2233
+ className: tabClass(tab === "explain"),
2234
+ "data-testid": "sql-tab-explain",
2235
+ onClick: showExplain,
2516
2236
  type: "button",
2517
- children: [running ? t("Running…") : t("Run"), /* @__PURE__ */ jsxDEV("kbd", {
2518
- className: "rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",
2519
- children: "⌘↵"
2237
+ children: t("Explain")
2238
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
2239
+ className: "ms-auto flex items-center gap-2",
2240
+ children: [/* @__PURE__ */ jsxDEV("button", {
2241
+ "aria-label": t("Split editor and results"),
2242
+ "aria-pressed": splitView,
2243
+ className: `inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${splitView ? "bg-accent text-foreground" : "text-muted-foreground"}`,
2244
+ "data-testid": "sql-split-toggle",
2245
+ onClick: toggleSplit,
2246
+ title: t("Split editor and results"),
2247
+ type: "button",
2248
+ children: /* @__PURE__ */ jsxDEV("svg", {
2249
+ "aria-hidden": "true",
2250
+ className: "size-4",
2251
+ fill: "none",
2252
+ stroke: "currentColor",
2253
+ strokeLinecap: "round",
2254
+ strokeLinejoin: "round",
2255
+ strokeWidth: 1.7,
2256
+ viewBox: "0 0 24 24",
2257
+ children: [/* @__PURE__ */ jsxDEV("rect", {
2258
+ height: "16",
2259
+ rx: "2",
2260
+ width: "18",
2261
+ x: "3",
2262
+ y: "4"
2263
+ }, void 0, false), /* @__PURE__ */ jsxDEV("path", {
2264
+ d: "M12 4v16"
2265
+ }, void 0, false)]
2266
+ }, void 0, true)
2267
+ }, void 0, false), result !== null && result.columns.length > 0 && /* @__PURE__ */ jsxDEV(ExportMenu, {
2268
+ columns: result.columns,
2269
+ name: "query-result",
2270
+ rows: result.rows
2271
+ }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2272
+ className: "inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",
2273
+ "data-testid": "sql-format",
2274
+ disabled: running,
2275
+ onClick: formatDraft,
2276
+ type: "button",
2277
+ children: t("Format")
2278
+ }, void 0, false), /* @__PURE__ */ jsxDEV(ShardInput, {
2279
+ onChange: setShardKey,
2280
+ testId: "sql-shard-input",
2281
+ value: shardKey
2282
+ }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2283
+ className: "inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",
2284
+ "data-testid": "sql-run",
2285
+ disabled: running,
2286
+ onClick: onRun,
2287
+ type: "button",
2288
+ children: [running ? t("Running…") : t("Run"), /* @__PURE__ */ jsxDEV("kbd", {
2289
+ className: "rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",
2290
+ children: "⌘↵"
2291
+ }, void 0, false)]
2292
+ }, void 0, true)]
2293
+ }, void 0, true)]
2294
+ }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2295
+ className: "min-h-0 flex-1 overflow-auto",
2296
+ children: [error !== null && /* @__PURE__ */ jsxDEV(Alert, {
2297
+ className: "m-3 font-mono text-xs",
2298
+ testId: "sql-error",
2299
+ variant: "destructive",
2300
+ children: error
2301
+ }, void 0, false), error === null && result === null && /* @__PURE__ */ jsxDEV("p", {
2302
+ className: "p-4 text-sm text-muted-foreground",
2303
+ "data-testid": "sql-empty",
2304
+ children: t("Click Run to execute your query.")
2305
+ }, void 0, false), error === null && result !== null && /* @__PURE__ */ jsxDEV("div", {
2306
+ "data-testid": "sql-result",
2307
+ children: [tab === "chart" ? /* @__PURE__ */ jsxDEV(SqlResultChart, {
2308
+ result
2309
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(SqlResultTable, {
2310
+ result
2311
+ }, void 0, false), /* @__PURE__ */ jsxDEV("p", {
2312
+ className: "border-t border-border px-3 py-1.5 text-xs text-muted-foreground",
2313
+ "data-testid": "sql-count",
2314
+ children: result.truncated ? t("Showing the first {max} of {count} rows.", {
2315
+ count: result.rowCount,
2316
+ max: result.rows.length
2317
+ }) : t("{count} rows", {
2318
+ count: result.rowCount
2319
+ })
2520
2320
  }, void 0, false)]
2521
2321
  }, void 0, true)]
2522
2322
  }, void 0, true)]
2523
- }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2524
- className: "min-h-0 flex-1 overflow-auto",
2525
- children: [error !== null && /* @__PURE__ */ jsxDEV(Alert, {
2526
- className: "m-3 font-mono text-xs",
2527
- testId: "sql-error",
2528
- variant: "destructive",
2529
- children: error
2530
- }, void 0, false), error === null && result === null && /* @__PURE__ */ jsxDEV("p", {
2531
- className: "p-4 text-sm text-muted-foreground",
2532
- "data-testid": "sql-empty",
2533
- children: t("Click Run to execute your query.")
2534
- }, void 0, false), error === null && result !== null && /* @__PURE__ */ jsxDEV("div", {
2535
- "data-testid": "sql-result",
2536
- children: [tab === "chart" ? /* @__PURE__ */ jsxDEV(SqlResultChart, {
2537
- result
2538
- }, void 0, false) : /* @__PURE__ */ jsxDEV(SqlResultTable, {
2539
- result
2540
- }, void 0, false), /* @__PURE__ */ jsxDEV("p", {
2541
- className: "border-t border-border px-3 py-1.5 text-xs text-muted-foreground",
2542
- "data-testid": "sql-count",
2543
- children: result.truncated ? t("Showing the first {max} of {count} rows.", {
2544
- count: result.rowCount,
2545
- max: result.rows.length
2546
- }) : t("{count} rows", {
2547
- count: result.rowCount
2548
- })
2549
- }, void 0, false)]
2550
- }, void 0, true)]
2551
2323
  }, void 0, true)]
2552
2324
  }, void 0, true)]
2553
2325
  }, void 0, true)]
@@ -2559,4 +2331,4 @@ function _temp(column) {
2559
2331
  }, column, false);
2560
2332
  }
2561
2333
 
2562
- export { Alert as A, SqlEditorPanel as S, SqlResultChart as a, newId as n, usePersistedList as u };
2334
+ export { SqlEditorPanel };