drizzle-cube 0.2.11 → 0.2.13

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 (76) hide show
  1. package/dist/adapters/compiler-CMwSRhTS.cjs +22 -0
  2. package/dist/adapters/{compiler-gcKytLwd.js → compiler-DrkCCzf0.js} +16 -11
  3. package/dist/adapters/express/index.cjs +1 -1
  4. package/dist/adapters/express/index.js +8 -8
  5. package/dist/adapters/fastify/index.cjs +1 -1
  6. package/dist/adapters/fastify/index.js +9 -9
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +11 -11
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.js +59 -59
  11. package/dist/client/charts.js +11 -11
  12. package/dist/client/chunks/{chart-activitygridchart-D17Fxiuf.js → chart-activitygridchart-CUGN9Xq9.js} +3 -2
  13. package/dist/client/chunks/chart-activitygridchart-CUGN9Xq9.js.map +1 -0
  14. package/dist/client/chunks/{chart-areachart-udSbAzl1.js → chart-areachart-B4tknnsY.js} +25 -25
  15. package/dist/client/chunks/{chart-areachart-udSbAzl1.js.map → chart-areachart-B4tknnsY.js.map} +1 -1
  16. package/dist/client/chunks/{chart-axisformatcontrols-DqSa245M.js → chart-axisformatcontrols-Ch_IYF94.js} +18 -18
  17. package/dist/client/chunks/chart-axisformatcontrols-Ch_IYF94.js.map +1 -0
  18. package/dist/client/chunks/{chart-barchart-CDIpqCKS.js → chart-barchart-D_op06r-.js} +6 -6
  19. package/dist/client/chunks/{chart-barchart-CDIpqCKS.js.map → chart-barchart-D_op06r-.js.map} +1 -1
  20. package/dist/client/chunks/{chart-bubblechart-CivK_yfh.js → chart-bubblechart-BsaIXUbS.js} +3 -3
  21. package/dist/client/chunks/chart-bubblechart-BsaIXUbS.js.map +1 -0
  22. package/dist/client/chunks/{chart-charttooltip-BVEdz4Q-.js → chart-charttooltip-Bx3I8jQv.js} +2 -2
  23. package/dist/client/chunks/{chart-charttooltip-BVEdz4Q-.js.map → chart-charttooltip-Bx3I8jQv.js.map} +1 -1
  24. package/dist/client/chunks/{chart-datatable-NHE7BTMr.js → chart-datatable-C7MS9q4Y.js} +2 -2
  25. package/dist/client/chunks/{chart-datatable-NHE7BTMr.js.map → chart-datatable-C7MS9q4Y.js.map} +1 -1
  26. package/dist/client/chunks/{chart-kpidelta-D-FR2o4V.js → chart-kpidelta-7-KOmb3w.js} +62 -60
  27. package/dist/client/chunks/chart-kpidelta-7-KOmb3w.js.map +1 -0
  28. package/dist/client/chunks/{chart-kpinumber-DSH8RJxb.js → chart-kpinumber-HOPfcK2N.js} +4 -4
  29. package/dist/client/chunks/{chart-kpinumber-DSH8RJxb.js.map → chart-kpinumber-HOPfcK2N.js.map} +1 -1
  30. package/dist/client/chunks/{chart-kpitext-Z9oh0bJq.js → chart-kpitext-BZkC9u3A.js} +24 -24
  31. package/dist/client/chunks/{chart-kpitext-Z9oh0bJq.js.map → chart-kpitext-BZkC9u3A.js.map} +1 -1
  32. package/dist/client/chunks/{chart-linechart-D4r0uD1j.js → chart-linechart-DqFmLbRe.js} +7 -7
  33. package/dist/client/chunks/{chart-linechart-D4r0uD1j.js.map → chart-linechart-DqFmLbRe.js.map} +1 -1
  34. package/dist/client/chunks/chart-markdownchart-9n_TemoB.js +256 -0
  35. package/dist/client/chunks/chart-markdownchart-9n_TemoB.js.map +1 -0
  36. package/dist/client/chunks/{chart-piechart-BhttUWuH.js → chart-piechart-CrXFd9pE.js} +6 -6
  37. package/dist/client/chunks/{chart-piechart-BhttUWuH.js.map → chart-piechart-CrXFd9pE.js.map} +1 -1
  38. package/dist/client/chunks/{chart-radarchart-DnqlfoGr.js → chart-radarchart-tar2GBkO.js} +5 -5
  39. package/dist/client/chunks/{chart-radarchart-DnqlfoGr.js.map → chart-radarchart-tar2GBkO.js.map} +1 -1
  40. package/dist/client/chunks/{chart-radialbarchart-BFxxiqLw.js → chart-radialbarchart-ab8Swtal.js} +5 -5
  41. package/dist/client/chunks/{chart-radialbarchart-BFxxiqLw.js.map → chart-radialbarchart-ab8Swtal.js.map} +1 -1
  42. package/dist/client/chunks/{chart-scatterchart-MN4SM-w7.js → chart-scatterchart-BP06BeU5.js} +5 -5
  43. package/dist/client/chunks/{chart-scatterchart-MN4SM-w7.js.map → chart-scatterchart-BP06BeU5.js.map} +1 -1
  44. package/dist/client/chunks/{chart-treemapchart-Nozh2m26.js → chart-treemapchart-DAiixITm.js} +31 -31
  45. package/dist/client/chunks/{chart-treemapchart-Nozh2m26.js.map → chart-treemapchart-DAiixITm.js.map} +1 -1
  46. package/dist/client/chunks/{charts-BSDHSv4l.js → charts-CHzWeaY1.js} +26 -26
  47. package/dist/client/chunks/charts-CHzWeaY1.js.map +1 -0
  48. package/dist/client/chunks/{components-CbDovlG-.js → components-DnM9CCUS.js} +2453 -2445
  49. package/dist/client/chunks/components-DnM9CCUS.js.map +1 -0
  50. package/dist/client/chunks/{index-th92_8oL.js → index-DlsvcKXf.js} +135 -135
  51. package/dist/client/chunks/index-DlsvcKXf.js.map +1 -0
  52. package/dist/client/components/AnalysisBuilder/AnalysisAxisDropZone.d.ts +5 -5
  53. package/dist/client/components/AnalysisBuilder/SectionHeading.d.ts +2 -7
  54. package/dist/client/components/AnalysisBuilder/types.d.ts +8 -8
  55. package/dist/client/components.js +2 -2
  56. package/dist/client/hooks/useResponsiveDashboard.d.ts +2 -8
  57. package/dist/client/hooks.js +2 -2
  58. package/dist/client/hooks.js.map +1 -1
  59. package/dist/client/icons/types.d.ts +2 -2
  60. package/dist/client/index.js +3 -3
  61. package/dist/client/providers.js +1 -1
  62. package/dist/client/styles.css +1 -1
  63. package/dist/client-bundle-stats.html +1 -1
  64. package/dist/server/index.cjs +2 -2
  65. package/dist/server/index.js +16 -11
  66. package/package.json +3 -3
  67. package/dist/adapters/compiler-DP1pPIcg.cjs +0 -22
  68. package/dist/client/chunks/chart-activitygridchart-D17Fxiuf.js.map +0 -1
  69. package/dist/client/chunks/chart-axisformatcontrols-DqSa245M.js.map +0 -1
  70. package/dist/client/chunks/chart-bubblechart-CivK_yfh.js.map +0 -1
  71. package/dist/client/chunks/chart-kpidelta-D-FR2o4V.js.map +0 -1
  72. package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js +0 -254
  73. package/dist/client/chunks/chart-markdownchart-C3FAQFuO.js.map +0 -1
  74. package/dist/client/chunks/charts-BSDHSv4l.js.map +0 -1
  75. package/dist/client/chunks/components-CbDovlG-.js.map +0 -1
  76. package/dist/client/chunks/index-th92_8oL.js.map +0 -1
@@ -1,40 +1,40 @@
1
1
  import { jsxs as o, jsx as t, Fragment as J } from "react/jsx-runtime";
2
2
  import { useMemo as j, useState as H, useEffect as T, useCallback as S } from "react";
3
- import Z, { Handle as P, Position as p, getBezierPath as K, BaseEdge as Q, EdgeLabelRenderer as U, useNodesState as _, useEdgesState as ee, addEdge as te, ConnectionMode as se, Controls as re, MiniMap as ne, Background as oe, BackgroundVariant as ae } from "reactflow";
4
- import { u as ie } from "./chart-activitygridchart-D17Fxiuf.js";
3
+ import Z, { Handle as P, Position as g, getBezierPath as K, BaseEdge as Q, EdgeLabelRenderer as U, useNodesState as _, useEdgesState as ee, addEdge as te, ConnectionMode as se, Controls as ne, MiniMap as re, Background as oe, BackgroundVariant as ae } from "reactflow";
4
+ import { u as ie } from "./chart-activitygridchart-CUGN9Xq9.js";
5
5
  import O from "dagre";
6
- function de({ data: i }) {
7
- const { cube: s, onFieldClick: f, isHighlighted: r, highlightedFields: w, searchTerm: m } = i, l = () => {
8
- }, y = (e, n) => {
9
- f && f(s.name, e, n);
10
- }, c = (e) => w.includes(e), b = (e) => {
6
+ function ce({ data: i }) {
7
+ const { cube: s, onFieldClick: f, isHighlighted: n, highlightedFields: w, searchTerm: m } = i, d = () => {
8
+ }, y = (e, r) => {
9
+ f && f(s.name, e, r);
10
+ }, l = (e) => w.includes(e), b = (e) => {
11
11
  if (!m?.trim()) return !0;
12
- const n = m.toLowerCase();
13
- return e.name.toLowerCase().includes(n) || e.title && e.title.toLowerCase().includes(n);
12
+ const r = m.toLowerCase();
13
+ return e.name.toLowerCase().includes(r) || e.title && e.title.toLowerCase().includes(r);
14
14
  }, k = (() => {
15
15
  if (!m?.trim()) return !0;
16
- const e = s.measures.some((d) => b(d)), n = s.dimensions.some((d) => b(d));
17
- return e || n;
18
- })(), N = (e, n, d) => {
16
+ const e = s.measures.some((c) => b(c)), r = s.dimensions.some((c) => b(c));
17
+ return e || r;
18
+ })(), N = (e, r, c) => {
19
19
  const v = b(e), u = "px-4 py-2 text-xs cursor-pointer transition-all border-b border-dc-border last:border-b-0";
20
20
  if (!k && m?.trim()) {
21
- if (n) {
22
- if (d === "measure")
23
- return `${u} bg-amber-100 text-amber-800`;
24
- if (d === "dimension")
25
- return e.type === "time" ? `${u} bg-blue-100 text-blue-800` : `${u} bg-green-100 text-green-800`;
21
+ if (r) {
22
+ if (c === "measure")
23
+ return `${u} bg-dc-warning-bg text-dc-warning`;
24
+ if (c === "dimension")
25
+ return e.type === "time" ? `${u} bg-dc-accent-bg text-dc-accent` : `${u} bg-dc-success-bg text-dc-success`;
26
26
  }
27
27
  return `${u} hover:bg-dc-surface-hover text-dc-text-secondary`;
28
28
  }
29
29
  if (m?.trim() && !v)
30
30
  return `${u} opacity-40 hover:opacity-60 text-dc-text-muted`;
31
- if (m?.trim() && v && !n)
32
- return `${u} font-bold hover:bg-purple-50`;
33
- if (n) {
34
- if (d === "measure")
35
- return `${u} bg-amber-100 text-amber-800 font-semibold`;
36
- if (d === "dimension")
37
- return e.type === "time" ? `${u} bg-blue-100 text-blue-800 font-semibold` : `${u} bg-green-100 text-green-800 font-semibold`;
31
+ if (m?.trim() && v && !r)
32
+ return `${u} font-bold hover:bg-dc-accent-bg`;
33
+ if (r) {
34
+ if (c === "measure")
35
+ return `${u} bg-dc-warning-bg text-dc-warning font-semibold`;
36
+ if (c === "dimension")
37
+ return e.type === "time" ? `${u} bg-dc-accent-bg text-dc-accent font-semibold` : `${u} bg-dc-success-bg text-dc-success font-semibold`;
38
38
  }
39
39
  return `${u} hover:bg-dc-surface-hover text-dc-text-secondary`;
40
40
  };
@@ -44,7 +44,7 @@ function de({ data: i }) {
44
44
  className: `
45
45
  border-2 rounded-lg shadow-lg min-w-[280px] overflow-hidden transition-all
46
46
  ${!k && m?.trim() ? "opacity-30 grayscale" : ""}
47
- ${r ? "border-purple-500 ring-2 ring-purple-200" : "border-dc-border"}
47
+ ${n ? "border-dc-accent ring-2 ring-dc-accent" : "border-dc-border"}
48
48
  `,
49
49
  style: {
50
50
  backgroundColor: "var(--dc-surface)"
@@ -55,9 +55,9 @@ function de({ data: i }) {
55
55
  {
56
56
  className: `
57
57
  px-4 py-3 cursor-pointer transition-colors
58
- ${r ? "bg-purple-100 hover:bg-purple-200" : "bg-dc-surface-secondary hover:bg-dc-surface-hover"}
58
+ ${n ? "bg-dc-accent-bg hover:bg-dc-accent-bg" : "bg-dc-surface-secondary hover:bg-dc-surface-hover"}
59
59
  `,
60
- onClick: l,
60
+ onClick: d,
61
61
  children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
62
62
  /* @__PURE__ */ o("div", { children: [
63
63
  /* @__PURE__ */ t("h3", { className: "font-semibold text-dc-text text-sm", children: s.title || s.name }),
@@ -77,22 +77,22 @@ function de({ data: i }) {
77
77
  }
78
78
  ),
79
79
  s.measures.length > 0 && /* @__PURE__ */ o("div", { className: "border-t border-dc-border", children: [
80
- /* @__PURE__ */ t("div", { className: "px-4 py-2 bg-amber-50 border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-amber-800 flex items-center", children: [
81
- /* @__PURE__ */ t("span", { className: "w-2 h-2 bg-amber-500 rounded-full mr-2" }),
80
+ /* @__PURE__ */ t("div", { className: "px-4 py-2 bg-dc-warning-bg border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-dc-warning flex items-center", children: [
81
+ /* @__PURE__ */ t("span", { className: "w-2 h-2 bg-dc-warning-bg0 rounded-full mr-2" }),
82
82
  "Measures (",
83
83
  s.measures.length,
84
84
  ")"
85
85
  ] }) }),
86
86
  /* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto", children: s.measures.map((e) => {
87
- const n = e.name.split(".")[1] || e.name, d = c(e.name);
87
+ const r = e.name.split(".")[1] || e.name, c = l(e.name);
88
88
  return /* @__PURE__ */ t(
89
89
  "div",
90
90
  {
91
- className: N(e, d, "measure"),
92
- onClick: () => y(n, "measure"),
91
+ className: N(e, c, "measure"),
92
+ onClick: () => y(r, "measure"),
93
93
  title: e.title,
94
94
  children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
95
- /* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || n }),
95
+ /* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || r }),
96
96
  /* @__PURE__ */ t("span", { className: "text-dc-text-muted ml-2 text-[10px] uppercase", children: e.type })
97
97
  ] })
98
98
  },
@@ -101,22 +101,22 @@ function de({ data: i }) {
101
101
  }) })
102
102
  ] }),
103
103
  s.dimensions.filter((e) => e.type === "time").length > 0 && /* @__PURE__ */ o("div", { className: "border-t border-dc-border", children: [
104
- /* @__PURE__ */ t("div", { className: "px-4 py-2 bg-blue-50 border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-blue-800 flex items-center", children: [
105
- /* @__PURE__ */ t("span", { className: "w-2 h-2 bg-blue-500 rounded-full mr-2" }),
104
+ /* @__PURE__ */ t("div", { className: "px-4 py-2 bg-dc-accent-bg border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-dc-accent flex items-center", children: [
105
+ /* @__PURE__ */ t("span", { className: "w-2 h-2 bg-dc-accent-bg0 rounded-full mr-2" }),
106
106
  "Time Dimensions (",
107
107
  s.dimensions.filter((e) => e.type === "time").length,
108
108
  ")"
109
109
  ] }) }),
110
110
  /* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto", children: s.dimensions.filter((e) => e.type === "time").map((e) => {
111
- const n = e.name.split(".")[1] || e.name, d = c(e.name);
111
+ const r = e.name.split(".")[1] || e.name, c = l(e.name);
112
112
  return /* @__PURE__ */ t(
113
113
  "div",
114
114
  {
115
- className: N(e, d, "dimension"),
116
- onClick: () => y(n, "dimension"),
115
+ className: N(e, c, "dimension"),
116
+ onClick: () => y(r, "dimension"),
117
117
  title: e.title,
118
118
  children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
119
- /* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || n }),
119
+ /* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || r }),
120
120
  /* @__PURE__ */ t("span", { className: "text-dc-text-muted ml-2 text-[10px] uppercase", children: e.type })
121
121
  ] })
122
122
  },
@@ -125,22 +125,22 @@ function de({ data: i }) {
125
125
  }) })
126
126
  ] }),
127
127
  s.dimensions.filter((e) => e.type !== "time").length > 0 && /* @__PURE__ */ o("div", { className: "border-t border-dc-border", children: [
128
- /* @__PURE__ */ t("div", { className: "px-4 py-2 bg-green-50 border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-green-800 flex items-center", children: [
129
- /* @__PURE__ */ t("span", { className: "w-2 h-2 bg-green-500 rounded-full mr-2" }),
128
+ /* @__PURE__ */ t("div", { className: "px-4 py-2 bg-dc-success-bg border-b border-dc-border", children: /* @__PURE__ */ o("h4", { className: "text-xs font-medium text-dc-success flex items-center", children: [
129
+ /* @__PURE__ */ t("span", { className: "w-2 h-2 bg-dc-success-bg0 rounded-full mr-2" }),
130
130
  "Dimensions (",
131
131
  s.dimensions.filter((e) => e.type !== "time").length,
132
132
  ")"
133
133
  ] }) }),
134
134
  /* @__PURE__ */ t("div", { className: "max-h-32 overflow-y-auto", children: s.dimensions.filter((e) => e.type !== "time").map((e) => {
135
- const n = e.name.split(".")[1] || e.name, d = c(e.name);
135
+ const r = e.name.split(".")[1] || e.name, c = l(e.name);
136
136
  return /* @__PURE__ */ t(
137
137
  "div",
138
138
  {
139
- className: N(e, d, "dimension"),
140
- onClick: () => y(n, "dimension"),
139
+ className: N(e, c, "dimension"),
140
+ onClick: () => y(r, "dimension"),
141
141
  title: e.title,
142
142
  children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
143
- /* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || n }),
143
+ /* @__PURE__ */ t("span", { className: "font-mono truncate", children: e.shortTitle || e.title || r }),
144
144
  /* @__PURE__ */ t("span", { className: "text-dc-text-muted ml-2 text-[10px] uppercase", children: e.type })
145
145
  ] })
146
146
  },
@@ -152,7 +152,7 @@ function de({ data: i }) {
152
152
  P,
153
153
  {
154
154
  type: "source",
155
- position: p.Right,
155
+ position: g.Right,
156
156
  id: "right",
157
157
  className: "opacity-0",
158
158
  isConnectable: !1
@@ -162,7 +162,7 @@ function de({ data: i }) {
162
162
  P,
163
163
  {
164
164
  type: "target",
165
- position: p.Left,
165
+ position: g.Left,
166
166
  id: "left",
167
167
  className: "opacity-0",
168
168
  isConnectable: !1
@@ -172,7 +172,7 @@ function de({ data: i }) {
172
172
  P,
173
173
  {
174
174
  type: "source",
175
- position: p.Bottom,
175
+ position: g.Bottom,
176
176
  id: "bottom",
177
177
  className: "opacity-0",
178
178
  isConnectable: !1
@@ -182,7 +182,7 @@ function de({ data: i }) {
182
182
  P,
183
183
  {
184
184
  type: "target",
185
- position: p.Top,
185
+ position: g.Top,
186
186
  id: "top",
187
187
  className: "opacity-0",
188
188
  isConnectable: !1
@@ -192,27 +192,27 @@ function de({ data: i }) {
192
192
  }
193
193
  );
194
194
  }
195
- function le({
195
+ function de({
196
196
  sourceX: i,
197
197
  sourceY: s,
198
198
  targetX: f,
199
- targetY: r,
199
+ targetY: n,
200
200
  sourcePosition: w,
201
201
  targetPosition: m,
202
- style: l = {},
202
+ style: d = {},
203
203
  data: y,
204
- markerEnd: c
204
+ markerEnd: l
205
205
  }) {
206
206
  const [b, E, k] = K({
207
207
  sourceX: i,
208
208
  sourceY: s,
209
209
  sourcePosition: w,
210
210
  targetX: f,
211
- targetY: r,
211
+ targetY: n,
212
212
  targetPosition: m
213
213
  });
214
214
  if (!y) return null;
215
- const { relationship: N, joinFields: e } = y, n = (C) => {
215
+ const { relationship: N, joinFields: e } = y, r = (C) => {
216
216
  switch (C) {
217
217
  case "belongsTo":
218
218
  return "∈";
@@ -238,9 +238,9 @@ function le({
238
238
  default:
239
239
  return "#6b7280";
240
240
  }
241
- })(N.relationship), u = n(N.relationship);
241
+ })(N.relationship), u = r(N.relationship);
242
242
  return /* @__PURE__ */ o(J, { children: [
243
- /* @__PURE__ */ t(Q, { path: b, markerEnd: c, style: { ...l, stroke: v } }),
243
+ /* @__PURE__ */ t(Q, { path: b, markerEnd: l, style: { ...d, stroke: v } }),
244
244
  /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(
245
245
  "div",
246
246
  {
@@ -280,7 +280,7 @@ function le({
280
280
  ) })
281
281
  ] });
282
282
  }
283
- const ce = {
283
+ const le = {
284
284
  direction: "TB",
285
285
  nodeWidth: 320,
286
286
  nodeHeight: 220,
@@ -289,82 +289,82 @@ const ce = {
289
289
  ranker: "network-simplex"
290
290
  };
291
291
  function ue(i, s, f = {}) {
292
- const r = j(() => ({ ...ce, ...f }), [f]), { layoutedNodes: w, layoutedEdges: m } = j(() => {
292
+ const n = j(() => ({ ...le, ...f }), [f]), { layoutedNodes: w, layoutedEdges: m } = j(() => {
293
293
  if (i.length === 0)
294
294
  return { layoutedNodes: [], layoutedEdges: [] };
295
- const l = new O.graphlib.Graph();
296
- return l.setDefaultEdgeLabel(() => ({})), l.setGraph({
297
- rankdir: r.direction,
298
- nodesep: r.nodeSep,
299
- ranksep: r.rankSep,
300
- ranker: r.ranker
301
- }), i.forEach((c) => {
302
- l.setNode(c.id, {
303
- width: r.nodeWidth,
304
- height: r.nodeHeight
295
+ const d = new O.graphlib.Graph();
296
+ return d.setDefaultEdgeLabel(() => ({})), d.setGraph({
297
+ rankdir: n.direction,
298
+ nodesep: n.nodeSep,
299
+ ranksep: n.rankSep,
300
+ ranker: n.ranker
301
+ }), i.forEach((l) => {
302
+ d.setNode(l.id, {
303
+ width: n.nodeWidth,
304
+ height: n.nodeHeight
305
305
  });
306
- }), s.forEach((c) => {
307
- l.setEdge(c.source, c.target);
308
- }), O.layout(l), {
309
- layoutedNodes: i.map((c) => {
310
- const b = l.node(c.id);
306
+ }), s.forEach((l) => {
307
+ d.setEdge(l.source, l.target);
308
+ }), O.layout(d), {
309
+ layoutedNodes: i.map((l) => {
310
+ const b = d.node(l.id);
311
311
  return {
312
- ...c,
313
- targetPosition: me(r.direction),
314
- sourcePosition: he(r.direction),
312
+ ...l,
313
+ targetPosition: me(n.direction),
314
+ sourcePosition: he(n.direction),
315
315
  position: {
316
- x: b.x - r.nodeWidth / 2,
317
- y: b.y - r.nodeHeight / 2
316
+ x: b.x - n.nodeWidth / 2,
317
+ y: b.y - n.nodeHeight / 2
318
318
  }
319
319
  };
320
320
  }),
321
321
  layoutedEdges: s
322
322
  };
323
- }, [i, s, r.direction, r.nodeSep, r.rankSep, r.ranker, r.nodeWidth, r.nodeHeight]);
323
+ }, [i, s, n.direction, n.nodeSep, n.rankSep, n.ranker, n.nodeWidth, n.nodeHeight]);
324
324
  return { nodes: w, edges: m };
325
325
  }
326
326
  function me(i) {
327
327
  switch (i) {
328
328
  case "TB":
329
- return p.Top;
329
+ return g.Top;
330
330
  case "BT":
331
- return p.Bottom;
331
+ return g.Bottom;
332
332
  case "LR":
333
- return p.Left;
333
+ return g.Left;
334
334
  case "RL":
335
- return p.Right;
335
+ return g.Right;
336
336
  default:
337
- return p.Top;
337
+ return g.Top;
338
338
  }
339
339
  }
340
340
  function he(i) {
341
341
  switch (i) {
342
342
  case "TB":
343
- return p.Bottom;
343
+ return g.Bottom;
344
344
  case "BT":
345
- return p.Top;
345
+ return g.Top;
346
346
  case "LR":
347
- return p.Right;
347
+ return g.Right;
348
348
  case "RL":
349
- return p.Left;
349
+ return g.Left;
350
350
  default:
351
- return p.Bottom;
351
+ return g.Bottom;
352
352
  }
353
353
  }
354
- const pe = {
355
- cubeNode: de
356
- }, ge = {
357
- relationshipEdge: le
354
+ const ge = {
355
+ cubeNode: ce
356
+ }, pe = {
357
+ relationshipEdge: de
358
358
  };
359
359
  function Ce({
360
360
  className: i = "",
361
361
  onCubeClick: s,
362
362
  onFieldClick: f,
363
- highlightedCubes: r = [],
363
+ highlightedCubes: n = [],
364
364
  highlightedFields: w = [],
365
365
  searchTerm: m
366
366
  }) {
367
- const { meta: l, metaLoading: y, metaError: c } = ie(), [b, E] = H({}), [k, N] = H(!1), [e, n] = H(null);
367
+ const { meta: d, metaLoading: y, metaError: l } = ie(), [b, E] = H({}), [k, N] = H(!1), [e, r] = H(null);
368
368
  T(() => {
369
369
  try {
370
370
  const a = localStorage.getItem("drizzle-cube-erd-node-positions");
@@ -372,14 +372,14 @@ function Ce({
372
372
  } catch {
373
373
  }
374
374
  }, []);
375
- const { nodes: d, edges: v } = j(() => {
376
- if (!l) return { nodes: [], edges: [] };
375
+ const { nodes: c, edges: v } = j(() => {
376
+ if (!d) return { nodes: [], edges: [] };
377
377
  const a = [], x = [];
378
- return l.cubes.forEach((h, g) => {
378
+ return d.cubes.forEach((h, p) => {
379
379
  a.push({
380
380
  id: h.name,
381
381
  type: "cubeNode",
382
- position: b[h.name] || { x: g % 3 * 400, y: Math.floor(g / 3) * 300 },
382
+ position: b[h.name] || { x: p % 3 * 400, y: Math.floor(p / 3) * 300 },
383
383
  data: {
384
384
  cube: h,
385
385
  onCubeClick: s,
@@ -390,45 +390,45 @@ function Ce({
390
390
  // Will be updated separately
391
391
  }
392
392
  });
393
- }), l.cubes.forEach((h) => {
394
- h.relationships && h.relationships.forEach((g, L) => {
395
- if (g.relationship === "belongsTo")
393
+ }), d.cubes.forEach((h) => {
394
+ h.relationships && h.relationships.forEach((p, M) => {
395
+ if (p.relationship === "belongsTo")
396
396
  return;
397
- const q = `${h.name}-${g.targetCube}-${L}`;
397
+ const q = `${h.name}-${p.targetCube}-${M}`;
398
398
  x.push({
399
399
  id: q,
400
400
  source: h.name,
401
- target: g.targetCube,
401
+ target: p.targetCube,
402
402
  type: "relationshipEdge",
403
403
  data: {
404
- relationship: g,
405
- joinFields: g.joinFields
404
+ relationship: p,
405
+ joinFields: p.joinFields
406
406
  },
407
407
  animated: !1,
408
408
  style: {
409
- stroke: be(g.relationship),
409
+ stroke: be(p.relationship),
410
410
  strokeWidth: 2
411
411
  }
412
412
  });
413
413
  });
414
414
  }), { nodes: a, edges: x };
415
- }, [l, s, f, b]), u = k || Object.keys(b).length === 0, { nodes: C, edges: B } = ue(d, v, {
415
+ }, [d, s, f, b]), u = k || Object.keys(b).length === 0, { nodes: C, edges: B } = ue(c, v, {
416
416
  direction: "LR",
417
417
  nodeWidth: 320,
418
418
  nodeHeight: 220,
419
419
  nodeSep: 100,
420
420
  rankSep: 200
421
- }), M = j(() => (u ? C : d).map((x) => ({
421
+ }), L = j(() => (u ? C : c).map((x) => ({
422
422
  ...x,
423
423
  data: {
424
424
  ...x.data,
425
- isHighlighted: r.includes(x.id),
425
+ isHighlighted: n.includes(x.id),
426
426
  highlightedFields: w,
427
427
  searchTerm: m
428
428
  }
429
- })), [u, C, d, r, w, m]), F = u ? B : v;
429
+ })), [u, C, c, n, w, m]), F = u ? B : v;
430
430
  T(() => {
431
- if (k && M.length > 0) {
431
+ if (k && L.length > 0) {
432
432
  E({});
433
433
  try {
434
434
  localStorage.removeItem("drizzle-cube-erd-node-positions");
@@ -436,45 +436,45 @@ function Ce({
436
436
  }
437
437
  N(!1);
438
438
  }
439
- }, [k, M]);
440
- const [D, $, z] = _(M), [W, R, A] = ee(F);
439
+ }, [k, L]);
440
+ const [D, $, z] = _(L), [W, R, A] = ee(F);
441
441
  T(() => {
442
- $(M);
443
- }, [M, $]), T(() => {
442
+ $(L);
443
+ }, [L, $]), T(() => {
444
444
  R(F);
445
445
  }, [F, R]);
446
446
  const I = S((a) => {
447
447
  z(a), a.filter((h) => h.type === "position" && h.dragging === !1).length > 0 && $((h) => {
448
- const g = {};
449
- h.forEach((L) => {
450
- L.position && (g[L.id] = L.position);
448
+ const p = {};
449
+ h.forEach((M) => {
450
+ M.position && (p[M.id] = M.position);
451
451
  });
452
452
  try {
453
- localStorage.setItem("drizzle-cube-erd-node-positions", JSON.stringify(g));
453
+ localStorage.setItem("drizzle-cube-erd-node-positions", JSON.stringify(p));
454
454
  } catch {
455
455
  }
456
- return E(g), h;
456
+ return E(p), h;
457
457
  });
458
458
  }, [z, $]), V = S(
459
459
  (a) => R((x) => te(a, x)),
460
460
  [R]
461
461
  ), G = S((a) => {
462
- a.preventDefault(), a.stopPropagation(), console.log("Context menu triggered at:", a.clientX, a.clientY), n({
462
+ a.preventDefault(), a.stopPropagation(), console.log("Context menu triggered at:", a.clientX, a.clientY), r({
463
463
  x: a.clientX,
464
464
  y: a.clientY
465
465
  });
466
466
  }, []), X = S(() => {
467
- e && n(null);
467
+ e && r(null);
468
468
  }, [e]), Y = S(() => {
469
- N(!0), n(null);
469
+ N(!0), r(null);
470
470
  }, []);
471
471
  return y ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center", children: [
472
- /* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mx-auto mb-2" }),
472
+ /* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-dc-accent mx-auto mb-2" }),
473
473
  /* @__PURE__ */ t("p", { className: "text-dc-text-muted", children: "Loading cube schema..." })
474
- ] }) }) : c ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center text-red-500", children: [
474
+ ] }) }) : l ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center text-dc-error", children: [
475
475
  /* @__PURE__ */ t("p", { className: "font-medium", children: "Failed to load cube schema" }),
476
- /* @__PURE__ */ t("p", { className: "text-sm mt-1", children: c })
477
- ] }) }) : !l || l.cubes.length === 0 ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center text-dc-text-muted", children: [
476
+ /* @__PURE__ */ t("p", { className: "text-sm mt-1", children: l })
477
+ ] }) }) : !d || d.cubes.length === 0 ? /* @__PURE__ */ t("div", { className: `flex items-center justify-center h-96 ${i}`, children: /* @__PURE__ */ o("div", { className: "text-center text-dc-text-muted", children: [
478
478
  /* @__PURE__ */ t("p", { className: "font-medium", children: "No cubes found" }),
479
479
  /* @__PURE__ */ t("p", { className: "text-sm mt-1", children: "Register some cubes to see the relationship diagram" })
480
480
  ] }) }) : /* @__PURE__ */ o("div", { className: `h-full ${i}`, style: { height: "600px" }, children: [
@@ -486,8 +486,8 @@ function Ce({
486
486
  onNodesChange: I,
487
487
  onEdgesChange: A,
488
488
  onConnect: V,
489
- nodeTypes: pe,
490
- edgeTypes: ge,
489
+ nodeTypes: ge,
490
+ edgeTypes: pe,
491
491
  connectionMode: se.Loose,
492
492
  fitView: !0,
493
493
  minZoom: 0.1,
@@ -497,11 +497,11 @@ function Ce({
497
497
  onPaneContextMenu: G,
498
498
  onPaneClick: X,
499
499
  children: [
500
- /* @__PURE__ */ t(re, {}),
500
+ /* @__PURE__ */ t(ne, {}),
501
501
  /* @__PURE__ */ t(
502
- ne,
502
+ re,
503
503
  {
504
- nodeColor: (a) => r.includes(a.id) ? "#8b5cf6" : "#e5e7eb",
504
+ nodeColor: (a) => n.includes(a.id) ? "#8b5cf6" : "#e5e7eb",
505
505
  maskColor: "rgb(240, 242, 246, 0.7)"
506
506
  }
507
507
  ),
@@ -548,4 +548,4 @@ export {
548
548
  Ce as CubeRelationshipDiagram,
549
549
  Ce as default
550
550
  };
551
- //# sourceMappingURL=index-th92_8oL.js.map
551
+ //# sourceMappingURL=index-DlsvcKXf.js.map