drizzle-cube 0.1.65 → 0.1.66

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.
@@ -3,8 +3,8 @@ import * as qt from "react";
3
3
  import Q, { createContext as Wc, useContext as Sr, Component as Kx, useRef as ue, useState as Z, useEffect as ce, useLayoutEffect as by, forwardRef as un, useMemo as ke, useImperativeHandle as vy, useCallback as J, memo as Te } from "react";
4
4
  import { useCubeQuery as Qx, useDebounce as Xx, useFilterValues as Zx, useResponsiveDashboard as Jx } from "../hooks.js";
5
5
  import { F as Er, I as Pe, d as e0, a as t0, b as r0, c as n0, e as s0, f as a0, g as i0, h as o0, i as l0, j as c0, k as d0, l as u0, m as f0, n as m0, o as h0, p as xy, q as p0, r as g0, s as y0, t as b0, u as v0, v as x0, w as w0, x as N0, y as _0, z as wy, A as Ny, B as en, C as S0, D as E0, E as je, G as Ld, H as gr, J as Wt, K as Nc, L as ze, M as tt, N as C0, O as it, P as _c, Q as Sc, R as k0, S as _y, T as zt, U as $d, V as T0, W as Bt, X as A0, Y as Sy, Z as tn, _ as R0, $ as Vd, a0 as Ec, a1 as M0, a2 as D0, a3 as Cc, a4 as q0, a5 as I0 } from "./icons-a6fQwcor.js";
6
- import { u as ct } from "./providers-DONuYrGH.js";
7
- import { i as St, b as zd, d as O0, e as Bd, t as F0, g as P0, h as L0, j as Dr, l as $0, k as V0, m as Ey, n as z0, p as Hd, C as jd, o as Gd, q as Cy, r as kc, s as Ud, u as zn, v as B0, w as H0, x as j0, D as ky, T as G0, a as U0, R as W0, S as Y0, P as K0, A as Q0, L as X0, B as Z0 } from "./charts-P7xq59Tl.js";
6
+ import { u as ct } from "./providers-D7zRgZrO.js";
7
+ import { i as St, b as zd, d as O0, e as Bd, t as F0, g as P0, h as L0, j as Dr, l as $0, k as V0, m as Ey, n as z0, p as Hd, C as jd, o as Gd, q as Cy, r as kc, s as Ud, u as zn, v as B0, w as H0, x as j0, D as ky, T as G0, a as U0, R as W0, S as Y0, P as K0, A as Q0, L as X0, B as Z0 } from "./charts-BvRqT6o9.js";
8
8
  import J0 from "react-grid-layout";
9
9
  import { createPortal as ew } from "react-dom";
10
10
  var Tc = /* @__PURE__ */ new Map(), qr = /* @__PURE__ */ new WeakMap(), Wd = 0, tw;
@@ -5509,7 +5509,7 @@ const rd = (e) => ({
5509
5509
  }), kS = (e, t) => pb(hb(wr(e), wr(t))), Pc = (e, t) => {
5510
5510
  const r = Math.max(0, Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)), n = Math.max(0, Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y));
5511
5511
  return Math.ceil(r * n);
5512
- }, TS = (e) => He(e.width) && He(e.height) && He(e.x) && He(e.y), He = (e) => !isNaN(e) && isFinite(e), Me = Symbol.for("internals"), gb = ["Enter", " ", "Escape"], yb = (e, t) => {
5512
+ }, TS = (e) => He(e.width) && He(e.height) && He(e.x) && He(e.y), He = (e) => !isNaN(e) && isFinite(e), Me = /* @__PURE__ */ Symbol.for("internals"), gb = ["Enter", " ", "Escape"], yb = (e, t) => {
5513
5513
  process.env.NODE_ENV === "development" && console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`);
5514
5514
  }, AS = (e) => "nativeEvent" in e;
5515
5515
  function Lc(e) {
@@ -6429,7 +6429,7 @@ function dd() {
6429
6429
  }, []), f = J(({ nodes: y, edges: p }) => {
6430
6430
  const { nodeInternals: b, getNodes: v, edges: _, hasDefaultNodes: N, hasDefaultEdges: A, onNodesDelete: x, onEdgesDelete: k, onNodesChange: T, onEdgesChange: S } = t.getState(), C = (y || []).map((M) => M.id), R = (p || []).map((M) => M.id), F = v().reduce((M, D) => {
6431
6431
  const q = D.parentNode || D.parentId, $ = !C.includes(D.id) && q && M.find((B) => B.id === q);
6432
- return (typeof D.deletable == "boolean" ? D.deletable : !0) && (C.includes(D.id) || $) && M.push(D), M;
6432
+ return (typeof D.deletable != "boolean" || D.deletable) && (C.includes(D.id) || $) && M.push(D), M;
6433
6433
  }, []), I = _.filter((M) => typeof M.deletable == "boolean" ? M.deletable : !0), w = I.filter((M) => R.includes(M.id));
6434
6434
  if (F || w) {
6435
6435
  const M = Cb(F, I), D = [...w, ...M], q = D.reduce(($, O) => ($.includes(O.id) || $.push(O.id), $), []);
@@ -7700,7 +7700,7 @@ const jc = [
7700
7700
  });
7701
7701
  else if (b) {
7702
7702
  const v = rd(p.nodeElement);
7703
- !!(v.width && v.height && (b.width !== v.width || b.height !== v.height || p.forceUpdate)) && (s.set(b.id, {
7703
+ v.width && v.height && (b.width !== v.width || b.height !== v.height || p.forceUpdate) && (s.set(b.id, {
7704
7704
  ...b,
7705
7705
  [Me]: {
7706
7706
  ...b[Me],
@@ -16710,103 +16710,7 @@ const TA = ({
16710
16710
  })), t();
16711
16711
  }, f = (g) => {
16712
16712
  g.key === "Enter" && !g.shiftKey && (g.preventDefault(), i());
16713
- }, m = () => /* @__PURE__ */ E("div", { className: "flex flex-col space-y-4", children: [
16714
- /* @__PURE__ */ u("div", { className: "shrink-0 p-3 bg-dc-surface-secondary border border-dc-border rounded-md", children: /* @__PURE__ */ E("div", { className: "text-sm text-dc-text-muted", children: [
16715
- "Using: ",
16716
- /* @__PURE__ */ u("span", { className: "font-medium", children: "AI Query Generation" }),
16717
- /* @__PURE__ */ u("span", { className: "ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-sm", children: "Server-provided AI (Rate Limited)" })
16718
- ] }) }),
16719
- /* @__PURE__ */ E("div", { className: "flex flex-col md:flex-row gap-6 flex-1 min-h-0", children: [
16720
- /* @__PURE__ */ E("div", { className: "w-full md:w-1/2 flex flex-col", children: [
16721
- /* @__PURE__ */ u("label", { htmlFor: "user-prompt", className: "block text-sm font-medium text-dc-text-secondary mb-2", children: "Describe your query in natural language" }),
16722
- /* @__PURE__ */ u(
16723
- "textarea",
16724
- {
16725
- id: "user-prompt",
16726
- value: s.userPrompt,
16727
- onChange: (g) => a((y) => ({ ...y, userPrompt: g.target.value })),
16728
- onKeyDown: f,
16729
- placeholder: "e.g., Show me the total revenue by month for the last year (Press Enter to generate, Shift+Enter for new line)",
16730
- className: "flex-1 w-full px-3 py-2 border border-dc-border rounded-md shadow-xs focus:outline-none focus:ring-blue-500 focus:border-blue-500 resize-none bg-dc-surface text-dc-text",
16731
- required: !0
16732
- }
16733
- )
16734
- ] }),
16735
- /* @__PURE__ */ E("div", { className: "w-full md:w-1/2 flex flex-col", children: [
16736
- /* @__PURE__ */ E("div", { className: "flex items-center justify-between mb-2", children: [
16737
- /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: s.response ? /* @__PURE__ */ E(Ee, { children: [
16738
- /* @__PURE__ */ u(Bt, { className: "w-5 h-5 text-green-500" }),
16739
- /* @__PURE__ */ u("span", { className: "text-sm font-medium text-green-700", children: "AI Generated Query" })
16740
- ] }) : /* @__PURE__ */ u("span", { className: "text-sm font-medium text-dc-text-muted", children: "Generated Query" }) }),
16741
- s.response && /* @__PURE__ */ u(
16742
- "button",
16743
- {
16744
- onClick: c,
16745
- disabled: s.isValidating,
16746
- className: "text-xs text-blue-600 hover:text-blue-800 disabled:opacity-50",
16747
- title: "Click to re-validate query",
16748
- children: s.isValidating ? "Validating..." : "Re-validate"
16749
- }
16750
- )
16751
- ] }),
16752
- s.response ? /* @__PURE__ */ u("div", { className: "flex-1 bg-green-50 border border-green-200 rounded-md p-3", children: /* @__PURE__ */ u("pre", { className: "text-sm text-dc-text whitespace-pre-wrap overflow-auto bg-dc-surface p-3 rounded-sm border h-full", children: s.response }) }) : /* @__PURE__ */ u("div", { className: "flex-1 flex items-center justify-center text-dc-text-muted border-2 border-dashed border-dc-border rounded-md p-8 min-h-64", children: /* @__PURE__ */ u("div", { className: "text-center", children: /* @__PURE__ */ u(Sc, { className: "w-12 h-12 mx-auto text-dc-text-muted" }) }) })
16753
- ] })
16754
- ] }),
16755
- /* @__PURE__ */ E("div", { className: "shrink-0", children: [
16756
- s.responseError && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-red-50 border border-red-200 rounded-md", children: [
16757
- /* @__PURE__ */ u(zt, { className: "w-5 h-5 text-red-500 mt-0.5 shrink-0" }),
16758
- /* @__PURE__ */ u("div", { className: "text-sm text-red-700", children: s.responseError })
16759
- ] }),
16760
- s.isValidating && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-blue-50 border border-blue-200 rounded-md", children: [
16761
- /* @__PURE__ */ u("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600 mt-0.5 shrink-0" }),
16762
- /* @__PURE__ */ u("div", { className: "text-sm text-blue-700", children: "Validating query..." })
16763
- ] }),
16764
- s.validationResult === "valid" && !s.isValidating && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-green-50 border border-green-200 rounded-md", children: [
16765
- /* @__PURE__ */ u(Bt, { className: "w-5 h-5 text-green-500 mt-0.5 shrink-0" }),
16766
- /* @__PURE__ */ u("div", { className: "text-sm text-green-700", children: "Query is valid and ready to use!" })
16767
- ] }),
16768
- s.validationResult === "invalid" && !s.isValidating && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-red-50 border border-red-200 rounded-md", children: [
16769
- /* @__PURE__ */ u(zt, { className: "w-5 h-5 text-red-500 mt-0.5 shrink-0" }),
16770
- /* @__PURE__ */ E("div", { className: "text-sm text-red-700", children: [
16771
- /* @__PURE__ */ u("div", { className: "font-medium mb-1", children: "Query validation failed:" }),
16772
- /* @__PURE__ */ u("div", { className: "text-xs", children: s.validationError })
16773
- ] })
16774
- ] })
16775
- ] }),
16776
- /* @__PURE__ */ E("div", { className: "shrink-0 flex justify-end space-x-3 pt-3", children: [
16777
- /* @__PURE__ */ u(
16778
- "button",
16779
- {
16780
- type: "submit",
16781
- disabled: !s.userPrompt.trim() || s.isSubmitting,
16782
- onClick: i,
16783
- className: "px-4 py-2 text-white text-sm rounded-md hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed flex items-center",
16784
- style: {
16785
- backgroundColor: "var(--dc-primary)"
16786
- },
16787
- children: s.isSubmitting ? /* @__PURE__ */ E(Ee, { children: [
16788
- /* @__PURE__ */ u("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2" }),
16789
- "Generating..."
16790
- ] }) : /* @__PURE__ */ E(Ee, { children: [
16791
- /* @__PURE__ */ u(Sc, { className: "w-4 h-4 mr-2" }),
16792
- "Generate"
16793
- ] })
16794
- }
16795
- ),
16796
- /* @__PURE__ */ E(
16797
- "button",
16798
- {
16799
- onClick: d,
16800
- disabled: !s.response || !r,
16801
- className: "px-4 py-2 bg-green-600 text-white text-sm rounded-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed flex items-center",
16802
- children: [
16803
- /* @__PURE__ */ u(Bt, { className: "w-4 h-4 mr-2" }),
16804
- "Use Query"
16805
- ]
16806
- }
16807
- )
16808
- ] })
16809
- ] });
16713
+ };
16810
16714
  return /* @__PURE__ */ u(
16811
16715
  ed,
16812
16716
  {
@@ -16814,7 +16718,103 @@ const TA = ({
16814
16718
  onClose: l,
16815
16719
  title: "AI Assistant - Generate Query",
16816
16720
  size: "fullscreen-mobile",
16817
- children: m()
16721
+ children: /* @__PURE__ */ E("div", { className: "flex flex-col space-y-4", children: [
16722
+ /* @__PURE__ */ u("div", { className: "shrink-0 p-3 bg-dc-surface-secondary border border-dc-border rounded-md", children: /* @__PURE__ */ E("div", { className: "text-sm text-dc-text-muted", children: [
16723
+ "Using: ",
16724
+ /* @__PURE__ */ u("span", { className: "font-medium", children: "AI Query Generation" }),
16725
+ /* @__PURE__ */ u("span", { className: "ml-2 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-sm", children: "Server-provided AI (Rate Limited)" })
16726
+ ] }) }),
16727
+ /* @__PURE__ */ E("div", { className: "flex flex-col md:flex-row gap-6 flex-1 min-h-0", children: [
16728
+ /* @__PURE__ */ E("div", { className: "w-full md:w-1/2 flex flex-col", children: [
16729
+ /* @__PURE__ */ u("label", { htmlFor: "user-prompt", className: "block text-sm font-medium text-dc-text-secondary mb-2", children: "Describe your query in natural language" }),
16730
+ /* @__PURE__ */ u(
16731
+ "textarea",
16732
+ {
16733
+ id: "user-prompt",
16734
+ value: s.userPrompt,
16735
+ onChange: (g) => a((y) => ({ ...y, userPrompt: g.target.value })),
16736
+ onKeyDown: f,
16737
+ placeholder: "e.g., Show me the total revenue by month for the last year (Press Enter to generate, Shift+Enter for new line)",
16738
+ className: "flex-1 w-full px-3 py-2 border border-dc-border rounded-md shadow-xs focus:outline-none focus:ring-blue-500 focus:border-blue-500 resize-none bg-dc-surface text-dc-text",
16739
+ required: !0
16740
+ }
16741
+ )
16742
+ ] }),
16743
+ /* @__PURE__ */ E("div", { className: "w-full md:w-1/2 flex flex-col", children: [
16744
+ /* @__PURE__ */ E("div", { className: "flex items-center justify-between mb-2", children: [
16745
+ /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: s.response ? /* @__PURE__ */ E(Ee, { children: [
16746
+ /* @__PURE__ */ u(Bt, { className: "w-5 h-5 text-green-500" }),
16747
+ /* @__PURE__ */ u("span", { className: "text-sm font-medium text-green-700", children: "AI Generated Query" })
16748
+ ] }) : /* @__PURE__ */ u("span", { className: "text-sm font-medium text-dc-text-muted", children: "Generated Query" }) }),
16749
+ s.response && /* @__PURE__ */ u(
16750
+ "button",
16751
+ {
16752
+ onClick: c,
16753
+ disabled: s.isValidating,
16754
+ className: "text-xs text-blue-600 hover:text-blue-800 disabled:opacity-50",
16755
+ title: "Click to re-validate query",
16756
+ children: s.isValidating ? "Validating..." : "Re-validate"
16757
+ }
16758
+ )
16759
+ ] }),
16760
+ s.response ? /* @__PURE__ */ u("div", { className: "flex-1 bg-green-50 border border-green-200 rounded-md p-3", children: /* @__PURE__ */ u("pre", { className: "text-sm text-dc-text whitespace-pre-wrap overflow-auto bg-dc-surface p-3 rounded-sm border h-full", children: s.response }) }) : /* @__PURE__ */ u("div", { className: "flex-1 flex items-center justify-center text-dc-text-muted border-2 border-dashed border-dc-border rounded-md p-8 min-h-64", children: /* @__PURE__ */ u("div", { className: "text-center", children: /* @__PURE__ */ u(Sc, { className: "w-12 h-12 mx-auto text-dc-text-muted" }) }) })
16761
+ ] })
16762
+ ] }),
16763
+ /* @__PURE__ */ E("div", { className: "shrink-0", children: [
16764
+ s.responseError && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-red-50 border border-red-200 rounded-md", children: [
16765
+ /* @__PURE__ */ u(zt, { className: "w-5 h-5 text-red-500 mt-0.5 shrink-0" }),
16766
+ /* @__PURE__ */ u("div", { className: "text-sm text-red-700", children: s.responseError })
16767
+ ] }),
16768
+ s.isValidating && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-blue-50 border border-blue-200 rounded-md", children: [
16769
+ /* @__PURE__ */ u("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600 mt-0.5 shrink-0" }),
16770
+ /* @__PURE__ */ u("div", { className: "text-sm text-blue-700", children: "Validating query..." })
16771
+ ] }),
16772
+ s.validationResult === "valid" && !s.isValidating && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-green-50 border border-green-200 rounded-md", children: [
16773
+ /* @__PURE__ */ u(Bt, { className: "w-5 h-5 text-green-500 mt-0.5 shrink-0" }),
16774
+ /* @__PURE__ */ u("div", { className: "text-sm text-green-700", children: "Query is valid and ready to use!" })
16775
+ ] }),
16776
+ s.validationResult === "invalid" && !s.isValidating && /* @__PURE__ */ E("div", { className: "flex items-start space-x-2 p-3 bg-red-50 border border-red-200 rounded-md", children: [
16777
+ /* @__PURE__ */ u(zt, { className: "w-5 h-5 text-red-500 mt-0.5 shrink-0" }),
16778
+ /* @__PURE__ */ E("div", { className: "text-sm text-red-700", children: [
16779
+ /* @__PURE__ */ u("div", { className: "font-medium mb-1", children: "Query validation failed:" }),
16780
+ /* @__PURE__ */ u("div", { className: "text-xs", children: s.validationError })
16781
+ ] })
16782
+ ] })
16783
+ ] }),
16784
+ /* @__PURE__ */ E("div", { className: "shrink-0 flex justify-end space-x-3 pt-3", children: [
16785
+ /* @__PURE__ */ u(
16786
+ "button",
16787
+ {
16788
+ type: "submit",
16789
+ disabled: !s.userPrompt.trim() || s.isSubmitting,
16790
+ onClick: i,
16791
+ className: "px-4 py-2 text-white text-sm rounded-md hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed flex items-center",
16792
+ style: {
16793
+ backgroundColor: "var(--dc-primary)"
16794
+ },
16795
+ children: s.isSubmitting ? /* @__PURE__ */ E(Ee, { children: [
16796
+ /* @__PURE__ */ u("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2" }),
16797
+ "Generating..."
16798
+ ] }) : /* @__PURE__ */ E(Ee, { children: [
16799
+ /* @__PURE__ */ u(Sc, { className: "w-4 h-4 mr-2" }),
16800
+ "Generate"
16801
+ ] })
16802
+ }
16803
+ ),
16804
+ /* @__PURE__ */ E(
16805
+ "button",
16806
+ {
16807
+ onClick: d,
16808
+ disabled: !s.response || !r,
16809
+ className: "px-4 py-2 bg-green-600 text-white text-sm rounded-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed flex items-center",
16810
+ children: [
16811
+ /* @__PURE__ */ u(Bt, { className: "w-4 h-4 mr-2" }),
16812
+ "Use Query"
16813
+ ]
16814
+ }
16815
+ )
16816
+ ] })
16817
+ ] })
16818
16818
  }
16819
16819
  );
16820
16820
  }, my = "drizzle-cube-query-builder-state", hy = "drizzle-cube-api-config", mx = un(({
@@ -21652,4 +21652,4 @@ export {
21652
21652
  ow as u,
21653
21653
  rb as w
21654
21654
  };
21655
- //# sourceMappingURL=components-BzN5ydzE.js.map
21655
+ //# sourceMappingURL=components-DRsjhKyD.js.map