@lunora/studio 1.0.0-alpha.4 → 1.0.0-alpha.41

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 (187) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +33 -18
  4. package/dist/index.js +29 -29
  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} +15 -15
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
  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} +158 -387
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
  25. package/dist/packem_chunks/analytics-panel.js +261 -0
  26. package/dist/packem_chunks/auth-config-panel.js +365 -0
  27. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  28. package/dist/packem_chunks/containers-panel.js +247 -0
  29. package/dist/packem_chunks/dashboards-panel.js +780 -0
  30. package/dist/packem_chunks/fanout-panel.js +482 -0
  31. package/dist/packem_chunks/flags-panel.js +176 -0
  32. package/dist/packem_chunks/kv-browser.js +1896 -0
  33. package/dist/packem_chunks/log-drains-panel.js +273 -0
  34. package/dist/packem_chunks/organizations-panel.js +3178 -0
  35. package/dist/packem_chunks/payments-panel.js +186 -0
  36. package/dist/packem_chunks/permissions-panel.js +805 -0
  37. package/dist/packem_chunks/queues-panel.js +1075 -0
  38. package/dist/packem_chunks/rls-panel.js +315 -0
  39. package/dist/packem_chunks/schedule-panel.js +831 -0
  40. package/dist/packem_chunks/sparkline.js +79 -0
  41. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  42. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  43. package/dist/packem_chunks/users-panel.js +1731 -0
  44. package/dist/packem_chunks/vector-browser.js +281 -0
  45. package/dist/packem_chunks/workflows-panel.js +562 -0
  46. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-BHHJi3Gb.js} +7 -0
  47. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-CBma-lnp.js} +2 -2
  48. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-CQM3pPN7.js} +2 -1
  49. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-X2tkbyHk.js} +1 -1
  50. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-D2ywrdId.js} +198 -247
  51. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-BkTPLzAY.js} +37 -66
  52. package/dist/packem_shared/HomePanel-D1Q9LZgK.js +14 -0
  53. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-Dno-hfDb.js} +2 -1
  54. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-Ctw4jYtU.js} +163 -60
  55. package/dist/packem_shared/Studio-lJhzDAze.js +16 -0
  56. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-DiMkupvZ.js} +276 -11
  57. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-BX8OhG0w.js} +6 -6
  58. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  59. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CNLRTrWw.d.ts} +1 -1
  60. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  61. package/dist/packem_shared/browser-storage-BTrX4y3B.js +215 -0
  62. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  63. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-CdXztApG.js} +1 -1
  64. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  65. package/dist/packem_shared/error-alert-CXjqyGw9.js +114 -0
  66. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-BF-KBDFz.js} +131 -163
  67. package/dist/packem_shared/home-panel-TFcRf9Ui.js +1889 -0
  68. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-CYcbqMjX.js} +44 -3
  69. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  70. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUiJcILV.js} +6 -45
  71. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  72. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  73. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  74. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  75. package/dist/packem_shared/studio-Dh9UlaF_.js +4015 -0
  76. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  77. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-UVIXQJdU.js} +1 -1
  78. package/dist/packem_shared/use-admin-query-CfHYWx5n.js +106 -0
  79. package/dist/packem_shared/use-async-submit-DJQiPc-_.js +91 -0
  80. package/dist/standalone/chunk-25AYY4H7.js +2 -0
  81. package/dist/standalone/chunk-2ANAF4ZM.js +1 -0
  82. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  83. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  84. package/dist/standalone/chunk-3CJW6NWG.js +4 -0
  85. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  86. package/dist/standalone/chunk-3OIHOXVV.js +1 -0
  87. package/dist/standalone/chunk-447TAUFD.js +1 -0
  88. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  89. package/dist/standalone/chunk-5C4TSNE6.js +1 -0
  90. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  91. package/dist/standalone/chunk-6HSHEMZV.js +76 -0
  92. package/dist/standalone/chunk-6JIZ34MB.js +3 -0
  93. package/dist/standalone/chunk-6VO23MMW.js +4 -0
  94. package/dist/standalone/chunk-7MVSQS7B.js +1 -0
  95. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  96. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  97. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  98. package/dist/standalone/chunk-BGXOXASQ.js +1 -0
  99. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  100. package/dist/standalone/chunk-BOXSWNXZ.js +1 -0
  101. package/dist/standalone/chunk-BX5MKYOC.js +1 -0
  102. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  103. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  104. package/dist/standalone/chunk-E75ANNWX.js +19 -0
  105. package/dist/standalone/chunk-EQZQOTJY.js +1 -0
  106. package/dist/standalone/chunk-GTLEWM5Y.js +1 -0
  107. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  108. package/dist/standalone/chunk-GUI5GFFI.js +1 -0
  109. package/dist/standalone/chunk-HN6KJXYQ.js +1 -0
  110. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  111. package/dist/standalone/chunk-HYDJNCGW.js +1 -0
  112. package/dist/standalone/chunk-HZK5RQHG.js +1 -0
  113. package/dist/standalone/chunk-IN2SYVJB.js +1 -0
  114. package/dist/standalone/chunk-IOANPSJN.js +1 -0
  115. package/dist/standalone/chunk-ISDZPW3V.js +1 -0
  116. package/dist/standalone/chunk-IXDH4GL5.js +1 -0
  117. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  118. package/dist/standalone/chunk-J73VHFCL.js +1 -0
  119. package/dist/standalone/chunk-JHKMUTIF.js +13 -0
  120. package/dist/standalone/chunk-JPRH6DPK.js +1 -0
  121. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  122. package/dist/standalone/chunk-KA5YB3VP.js +1 -0
  123. package/dist/standalone/chunk-KBB75WNT.js +1 -0
  124. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  125. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  126. package/dist/standalone/chunk-KQV4NGH3.js +1 -0
  127. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  128. package/dist/standalone/chunk-KUH4P5F5.js +1 -0
  129. package/dist/standalone/chunk-KYJPPVGB.js +1 -0
  130. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  131. package/dist/standalone/chunk-L2TJVSDQ.js +1 -0
  132. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  133. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  134. package/dist/standalone/chunk-LBN7LPVK.js +1 -0
  135. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  136. package/dist/standalone/chunk-MJWVMKQ4.js +6 -0
  137. package/dist/standalone/chunk-MLZYX5CQ.js +1 -0
  138. package/dist/standalone/chunk-N2X2OO4V.js +1 -0
  139. package/dist/standalone/chunk-NGKITPQP.js +13 -0
  140. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  141. package/dist/standalone/chunk-OZACQNKG.js +1 -0
  142. package/dist/standalone/chunk-PNDNXS5Z.js +1 -0
  143. package/dist/standalone/chunk-Q7DMUTUE.js +1 -0
  144. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  145. package/dist/standalone/chunk-QBAT52GB.js +1 -0
  146. package/dist/standalone/chunk-RHZ4M2NZ.js +1 -0
  147. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  148. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  149. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  150. package/dist/standalone/chunk-TBMYIZIO.js +1 -0
  151. package/dist/standalone/chunk-TDZ44E5I.js +4 -0
  152. package/dist/standalone/chunk-THNBTMUF.js +1 -0
  153. package/dist/standalone/chunk-TIQISBGK.js +1 -0
  154. package/dist/standalone/chunk-TMYVNQ66.js +1 -0
  155. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  156. package/dist/standalone/chunk-UGUEC6BC.js +1 -0
  157. package/dist/standalone/chunk-UJB2LEI4.js +4 -0
  158. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  159. package/dist/standalone/chunk-UKDJ4H7I.js +1 -0
  160. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  161. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  162. package/dist/standalone/chunk-W3JK4YWR.js +1 -0
  163. package/dist/standalone/chunk-W3SHEIAL.js +3 -0
  164. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  165. package/dist/standalone/chunk-WIHXMNUY.js +1 -0
  166. package/dist/standalone/chunk-WLDVXVI2.js +1 -0
  167. package/dist/standalone/chunk-XLXNLJ4N.js +1 -0
  168. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  169. package/dist/standalone/chunk-YAECF5LW.js +1 -0
  170. package/dist/standalone/chunk-YBGC4PPD.js +1 -0
  171. package/dist/standalone/chunk-YJAPWSDC.js +4 -0
  172. package/dist/standalone/chunk-ZEJB6DXU.js +8 -0
  173. package/dist/standalone/chunk-ZFNBPAIZ.js +1 -0
  174. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  175. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  176. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  177. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  178. package/dist/standalone/studio.js +104 -246
  179. package/dist/styles.css +2 -2
  180. package/package.json +15 -13
  181. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  182. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  183. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  184. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  185. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  186. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  187. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -1,257 +1,18 @@
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 { u as usePersistedList, n as newId, a as usePersistedValue, S as SqlResultChart } from '../packem_shared/browser-storage-BTrX4y3B.js';
5
+ import { ShardInput } from '../packem_shared/ShardInput-gx_DZXXn.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-BHHJi3Gb.js';
10
+ import { f as fireAndForget, c as callOptions, a as adminRef, e as errorMessage } from '../packem_shared/internal-CYcbqMjX.js';
11
+ import { r as recordShard } from '../packem_shared/shard-history-DyebH1R5.js';
12
+ import { C as CellValue } from '../packem_shared/data-grid-CdXztApG.js';
13
+ import { E as ExportMenu } from '../packem_shared/grid-features-BF-KBDFz.js';
14
+ import { c as cn } from '../packem_shared/utils-B05Dmz_H.js';
7
15
  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
16
 
256
17
  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
18
  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 +1050,7 @@ const makeTab = (sql = "", name = "") => {
1289
1050
  };
1290
1051
  };
1291
1052
  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;
1053
+ return usePersistedValue(ACTIVE_KEY, "");
1320
1054
  };
1321
1055
  const usePersistedTabs = (seed) => {
1322
1056
  const [stored, setTabs] = usePersistedList(TABS_KEY);
@@ -1872,6 +1606,7 @@ function _temp$1(node) {
1872
1606
  const RUN_SQL = adminRef(ADMIN_FUNCTIONS.runSql);
1873
1607
  const STORAGE_KEY = "lunora-studio-sql-queries";
1874
1608
  const HISTORY_KEY = "lunora-studio-sql-history";
1609
+ const SPLIT_VIEW_KEY = "lunora-studio-sql-split-view";
1875
1610
  const HISTORY_LIMIT = 25;
1876
1611
  const GUTTER_STYLE = {
1877
1612
  minWidth: "2.75rem",
@@ -1990,6 +1725,7 @@ const SqlEditorPanel = ({
1990
1725
  const [outputs, setOutputs] = useState({});
1991
1726
  const [shardKey, setShardKey] = useState(initialShardKey ?? "");
1992
1727
  const [running, setRunning] = useState(false);
1728
+ const [splitView, setSplitView] = usePersistedValue(SPLIT_VIEW_KEY, false);
1993
1729
  const [tabMenu, setTabMenu] = useState(null);
1994
1730
  const [pendingBulk, setPendingBulk] = useState(null);
1995
1731
  const gutterRef = useRef(null);
@@ -2310,11 +2046,16 @@ const SqlEditorPanel = ({
2310
2046
  const showChart = () => {
2311
2047
  setActivePane("chart");
2312
2048
  };
2049
+ const toggleSplit = () => {
2050
+ setSplitView(!splitView);
2051
+ };
2313
2052
  const lineCount = draft.split("\n").length;
2314
2053
  const onSearchChange = (event_7) => {
2315
2054
  setSearch(event_7.target.value);
2316
2055
  };
2317
2056
  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"}`;
2057
+ const workspaceClass = splitView ? "flex min-h-0 flex-1 flex-row" : "flex min-h-0 flex-1 flex-col";
2058
+ 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
2059
  return /* @__PURE__ */ jsxDEV("div", {
2319
2060
  className: "flex h-full min-w-0",
2320
2061
  "data-testid": "lunora-sql-editor",
@@ -2432,122 +2173,152 @@ const SqlEditorPanel = ({
2432
2173
  )
2433
2174
  }, void 0, false)]
2434
2175
  }, 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",
2176
+ className: workspaceClass,
2474
2177
  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")
2178
+ className: "flex min-h-0 min-w-0 flex-1",
2179
+ children: [/* @__PURE__ */ jsxDEV("div", {
2180
+ "aria-hidden": "true",
2181
+ 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",
2182
+ ref: gutterRef,
2183
+ style: GUTTER_STYLE,
2184
+ children: Array.from({
2185
+ length: lineCount
2186
+ }, (_, index_0) => /* @__PURE__ */ jsxDEV("div", {
2187
+ children: index_0 + 1
2188
+ }, index_0, false))
2494
2189
  }, 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
2190
+ className: "relative min-w-0 flex-1",
2191
+ children: [/* @__PURE__ */ jsxDEV("textarea", {
2192
+ "aria-activedescendant": autocompleteState === null ? void 0 : `${listboxId}-opt-${autocompleteState.active.toString()}`,
2193
+ "aria-autocomplete": "list",
2194
+ "aria-controls": autocompleteState === null ? void 0 : listboxId,
2195
+ "aria-expanded": autocompleteState !== null,
2196
+ "aria-label": t("SQL query"),
2197
+ className: "size-full resize-none bg-background p-3 font-mono text-xs leading-5 outline-none",
2198
+ "data-testid": "sql-input",
2199
+ onBlur: onEditorBlur,
2200
+ onChange: onDraftChange,
2201
+ onKeyDown: onEditorKeyDown,
2202
+ onScroll: onEditorScroll,
2203
+ onSelect: onEditorSelect,
2204
+ placeholder: "SELECT * FROM …",
2205
+ ref: editorRef,
2206
+ role: "combobox",
2207
+ spellCheck: false,
2208
+ value: draft
2209
+ }, void 0, false), /* @__PURE__ */ jsxDEV(AutocompletePopover, {
2210
+ listboxId,
2211
+ onPick: onPickSuggestion,
2212
+ state: autocompleteState
2213
+ }, void 0, false)]
2214
+ }, void 0, true)]
2215
+ }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2216
+ className: resultsClass,
2217
+ children: [/* @__PURE__ */ jsxDEV("div", {
2218
+ className: "flex shrink-0 items-center gap-2 border-b border-border pe-2",
2219
+ children: [/* @__PURE__ */ jsxDEV("button", {
2220
+ className: tabClass(tab === "results"),
2221
+ "data-testid": "sql-tab-results",
2222
+ onClick: showResults,
2223
+ type: "button",
2224
+ children: t("Results")
2500
2225
  }, 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,
2226
+ className: tabClass(tab === "chart"),
2227
+ "data-testid": "sql-tab-chart",
2228
+ onClick: showChart,
2505
2229
  type: "button",
2506
- children: t("Format")
2507
- }, void 0, false), /* @__PURE__ */ jsxDEV(ShardInput, {
2508
- onChange: setShardKey,
2509
- testId: "sql-shard-input",
2510
- value: shardKey
2230
+ children: t("Chart")
2511
2231
  }, 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,
2232
+ className: tabClass(tab === "explain"),
2233
+ "data-testid": "sql-tab-explain",
2234
+ onClick: showExplain,
2516
2235
  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: "⌘↵"
2236
+ children: t("Explain")
2237
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
2238
+ className: "ms-auto flex items-center gap-2",
2239
+ children: [/* @__PURE__ */ jsxDEV("button", {
2240
+ "aria-label": t("Split editor and results"),
2241
+ "aria-pressed": splitView,
2242
+ 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"}`,
2243
+ "data-testid": "sql-split-toggle",
2244
+ onClick: toggleSplit,
2245
+ title: t("Split editor and results"),
2246
+ type: "button",
2247
+ children: /* @__PURE__ */ jsxDEV("svg", {
2248
+ "aria-hidden": "true",
2249
+ className: "size-4",
2250
+ fill: "none",
2251
+ stroke: "currentColor",
2252
+ strokeLinecap: "round",
2253
+ strokeLinejoin: "round",
2254
+ strokeWidth: 1.7,
2255
+ viewBox: "0 0 24 24",
2256
+ children: [/* @__PURE__ */ jsxDEV("rect", {
2257
+ height: "16",
2258
+ rx: "2",
2259
+ width: "18",
2260
+ x: "3",
2261
+ y: "4"
2262
+ }, void 0, false), /* @__PURE__ */ jsxDEV("path", {
2263
+ d: "M12 4v16"
2264
+ }, void 0, false)]
2265
+ }, void 0, true)
2266
+ }, void 0, false), result !== null && result.columns.length > 0 && /* @__PURE__ */ jsxDEV(ExportMenu, {
2267
+ columns: result.columns,
2268
+ name: "query-result",
2269
+ rows: result.rows
2270
+ }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2271
+ 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",
2272
+ "data-testid": "sql-format",
2273
+ disabled: running,
2274
+ onClick: formatDraft,
2275
+ type: "button",
2276
+ children: t("Format")
2277
+ }, void 0, false), /* @__PURE__ */ jsxDEV(ShardInput, {
2278
+ onChange: setShardKey,
2279
+ testId: "sql-shard-input",
2280
+ value: shardKey
2281
+ }, void 0, false), /* @__PURE__ */ jsxDEV("button", {
2282
+ 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",
2283
+ "data-testid": "sql-run",
2284
+ disabled: running,
2285
+ onClick: onRun,
2286
+ type: "button",
2287
+ children: [running ? t("Running…") : t("Run"), /* @__PURE__ */ jsxDEV("kbd", {
2288
+ className: "rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",
2289
+ children: "⌘↵"
2290
+ }, void 0, false)]
2291
+ }, void 0, true)]
2292
+ }, void 0, true)]
2293
+ }, void 0, true), /* @__PURE__ */ jsxDEV("div", {
2294
+ className: "min-h-0 flex-1 overflow-auto",
2295
+ children: [error !== null && /* @__PURE__ */ jsxDEV(Alert, {
2296
+ className: "m-3 font-mono text-xs",
2297
+ testId: "sql-error",
2298
+ variant: "destructive",
2299
+ children: error
2300
+ }, void 0, false), error === null && result === null && /* @__PURE__ */ jsxDEV("p", {
2301
+ className: "p-4 text-sm text-muted-foreground",
2302
+ "data-testid": "sql-empty",
2303
+ children: t("Click Run to execute your query.")
2304
+ }, void 0, false), error === null && result !== null && /* @__PURE__ */ jsxDEV("div", {
2305
+ "data-testid": "sql-result",
2306
+ children: [tab === "chart" ? /* @__PURE__ */ jsxDEV(SqlResultChart, {
2307
+ result
2308
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(SqlResultTable, {
2309
+ result
2310
+ }, void 0, false), /* @__PURE__ */ jsxDEV("p", {
2311
+ className: "border-t border-border px-3 py-1.5 text-xs text-muted-foreground",
2312
+ "data-testid": "sql-count",
2313
+ children: result.truncated ? t("Showing the first {max} of {count} rows.", {
2314
+ count: result.rowCount,
2315
+ max: result.rows.length
2316
+ }) : t("{count} rows", {
2317
+ count: result.rowCount
2318
+ })
2520
2319
  }, void 0, false)]
2521
2320
  }, void 0, true)]
2522
2321
  }, 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
2322
  }, void 0, true)]
2552
2323
  }, void 0, true)]
2553
2324
  }, void 0, true)]
@@ -2559,4 +2330,4 @@ function _temp(column) {
2559
2330
  }, column, false);
2560
2331
  }
2561
2332
 
2562
- export { Alert as A, SqlEditorPanel as S, SqlResultChart as a, newId as n, usePersistedList as u };
2333
+ export { SqlEditorPanel };