react-semaphor 0.1.121 → 0.1.123

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 (24) hide show
  1. package/dist/chunks/{dashboard-controls-CzcAbxpr.js → dashboard-controls-4-hApe-r.js} +1 -1
  2. package/dist/chunks/{dashboard-controls-CyhTMpZ2.js → dashboard-controls-D3NUafF1.js} +71 -71
  3. package/dist/chunks/{dashboard-json-BcB9WzEx.js → dashboard-json-BWrMOlwz.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BQPFtG3z.js → dashboard-json-DUat0hoS.js} +1 -1
  5. package/dist/chunks/{edit-dashboard-visual-CLdMn0FN.js → edit-dashboard-visual-ClzaW7MR.js} +3 -3
  6. package/dist/chunks/{edit-dashboard-visual-D6KBQgRc.js → edit-dashboard-visual-Du049yu_.js} +1 -1
  7. package/dist/chunks/{editor-action-buttons-D8lG5LwM.js → editor-action-buttons-CVUUl8IQ.js} +1 -1
  8. package/dist/chunks/{editor-action-buttons-CEzZTeqn.js → editor-action-buttons-FUlZ__xi.js} +2 -2
  9. package/dist/chunks/{index-CJrseB0V.js → index-C9xqgHpT.js} +185 -185
  10. package/dist/chunks/{index-Cyic0UlN.js → index-Ci1UbzGA.js} +9057 -8996
  11. package/dist/chunks/{resource-management-panel-BNDpfKQl.js → resource-management-panel-Gn5D4PEs.js} +1 -1
  12. package/dist/chunks/{resource-management-panel-DDLB-UWe.js → resource-management-panel-rBUF-JVD.js} +139 -139
  13. package/dist/chunks/{schedule-dashboard-CqFcuP5E.js → schedule-dashboard-CHuBJfod.js} +1 -1
  14. package/dist/chunks/{schedule-dashboard-BEV7hj7t.js → schedule-dashboard-Xn9bMPcv.js} +22 -22
  15. package/dist/chunks/{use-visual-utils-BzfETcB4.js → use-visual-utils-BTE9nvU2.js} +1 -1
  16. package/dist/chunks/{use-visual-utils-GI2MN0MK.js → use-visual-utils-Dk9v6ZRs.js} +11 -11
  17. package/dist/dashboard/index.cjs +1 -1
  18. package/dist/dashboard/index.js +1 -1
  19. package/dist/index.cjs +2 -2
  20. package/dist/index.js +70 -68
  21. package/dist/surfboard/index.cjs +1 -1
  22. package/dist/surfboard/index.js +1 -1
  23. package/dist/types/main.d.ts +4 -0
  24. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("react/jsx-runtime"),e=require("./index-CJrseB0V.js"),f=require("./editor-action-buttons-D8lG5LwM.js"),p=require("react"),y=require("./use-visual-utils-BzfETcB4.js");/**
1
+ "use strict";const s=require("react/jsx-runtime"),e=require("./index-C9xqgHpT.js"),f=require("./editor-action-buttons-CVUUl8IQ.js"),p=require("react"),y=require("./use-visual-utils-BTE9nvU2.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,8 +1,8 @@
1
1
  import { jsx as e, jsxs as r, Fragment as E } from "react/jsx-runtime";
2
- import { b as W, ao as _, ap as $, aq as G, ar as J, as as K, at as M, au as R, av as X, aw as T, ax as Q, B as k, L as Y, f as N, i as Z, u as g, ak as ee, g as q, ay as ae, az as B, l as w, aA as se, aB as te, c as y, aC as O, aD as P, aE as L, aF as z, aG as j, e as ne, aH as de, aI as le, aJ as re, I as ie, aK as oe, aL as ce } from "./index-Cyic0UlN.js";
3
- import { E as he, V as ue, a as me, b as ve, S as U, c as pe } from "./editor-action-buttons-CEzZTeqn.js";
2
+ import { b as W, aq as _, ar as $, as as G, at as J, au as K, av as V, aw as R, ax as X, ay as T, az as Q, B as N, L as Y, f as k, i as Z, u as g, am as ee, g as q, aA as ae, aB as B, l as w, aC as se, aD as te, c as y, aE as O, aF as P, aG as L, aH as z, aI as j, e as ne, aJ as de, aK as le, aL as re, I as ie, aM as oe, aN as ce } from "./index-Ci1UbzGA.js";
3
+ import { E as he, V as ue, a as me, b as ve, S as U, c as pe } from "./editor-action-buttons-FUlZ__xi.js";
4
4
  import fe, { useState as C, useContext as be } from "react";
5
- import { a as H } from "./use-visual-utils-GI2MN0MK.js";
5
+ import { a as H } from "./use-visual-utils-Dk9v6ZRs.js";
6
6
  /**
7
7
  * @license lucide-react v0.453.0 - ISC
8
8
  *
@@ -45,7 +45,7 @@ function De({
45
45
  ] }),
46
46
  /* @__PURE__ */ r("div", { className: "grid gap-4 py-4", children: [
47
47
  /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
48
- /* @__PURE__ */ e(M, { htmlFor: "name", children: "Name" }),
48
+ /* @__PURE__ */ e(V, { htmlFor: "name", children: "Name" }),
49
49
  /* @__PURE__ */ e(
50
50
  R,
51
51
  {
@@ -58,7 +58,7 @@ function De({
58
58
  )
59
59
  ] }),
60
60
  /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
61
- /* @__PURE__ */ e(M, { htmlFor: "description", children: "Description (optional)" }),
61
+ /* @__PURE__ */ e(V, { htmlFor: "description", children: "Description (optional)" }),
62
62
  /* @__PURE__ */ e(
63
63
  X,
64
64
  {
@@ -72,7 +72,7 @@ function De({
72
72
  )
73
73
  ] }),
74
74
  /* @__PURE__ */ r("div", { className: "space-y-4", children: [
75
- /* @__PURE__ */ e(M, { children: "Save to:" }),
75
+ /* @__PURE__ */ e(V, { children: "Save to:" }),
76
76
  /* @__PURE__ */ r("div", { className: "space-y-2", children: [
77
77
  /* @__PURE__ */ r("div", { className: "flex items-center space-x-2", children: [
78
78
  /* @__PURE__ */ e(
@@ -124,7 +124,7 @@ function De({
124
124
  ] }),
125
125
  /* @__PURE__ */ r(Q, { children: [
126
126
  /* @__PURE__ */ e(
127
- k,
127
+ N,
128
128
  {
129
129
  variant: "outline",
130
130
  onClick: () => d(!1),
@@ -132,7 +132,7 @@ function De({
132
132
  children: "Cancel"
133
133
  }
134
134
  ),
135
- /* @__PURE__ */ r(k, { onClick: I, disabled: !A || o, children: [
135
+ /* @__PURE__ */ r(N, { onClick: I, disabled: !A || o, children: [
136
136
  o && /* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4 animate-spin" }),
137
137
  o ? "Saving..." : "Save"
138
138
  ] })
@@ -140,7 +140,7 @@ function De({
140
140
  ] }) });
141
141
  }
142
142
  function Ce() {
143
- const [a, d] = C(!1), [s, t] = C(!1), [o, u] = C(null), i = N((l) => l.frame), n = N((l) => l.card), c = Z(), v = g((l) => l.selectedSheetId), f = g(
143
+ const [a, d] = C(!1), [s, t] = C(!1), [o, u] = C(null), i = k((l) => l.frame), n = k((l) => l.card), c = Z(), v = g((l) => l.selectedSheetId), f = g(
144
144
  (l) => l.actions.setIsDashboardPanelOpen
145
145
  ), { getUpdatedFrame: D } = H(), { selectVisual: b } = ee(), { addFrame: S, setSelectedFrameId: I, setIsVisualEditing: A } = q(), m = !!(i != null && i.visualId), F = (() => {
146
146
  var l, p;
@@ -167,7 +167,7 @@ function Ce() {
167
167
  w.error("No sheet selected");
168
168
  return;
169
169
  }
170
- const p = D(), V = p.cards.length === 1 ? {
170
+ const p = D(), M = p.cards.length === 1 ? {
171
171
  ...p,
172
172
  cards: p.cards.map((x) => ({
173
173
  ...x,
@@ -176,18 +176,18 @@ function Ce() {
176
176
  }))
177
177
  } : p;
178
178
  if (l.saveToLibrary) {
179
- t(l.saveToCurrentDashboard), u(V);
179
+ t(l.saveToCurrentDashboard), u(M);
180
180
  const x = {
181
181
  title: l.name,
182
182
  description: l.description,
183
- frameObject: V,
183
+ frameObject: M,
184
184
  // Card title synced for single-card frames
185
185
  isPrivate: !1
186
186
  };
187
187
  h.mutate(x);
188
188
  } else if (l.saveToCurrentDashboard) {
189
189
  const x = {
190
- ...V,
190
+ ...M,
191
191
  // Card title already synced
192
192
  id: B(),
193
193
  visualId: void 0
@@ -201,10 +201,10 @@ function Ce() {
201
201
  isSaving: h.isPending
202
202
  };
203
203
  }
204
- function Ve({
204
+ function Me({
205
205
  className: a
206
206
  }) {
207
- const d = N((h) => h.frame), s = N((h) => h.card), t = se((h) => h.selectedVisual), o = g((h) => h.selectedFrameId), u = g((h) => h.selectedSheetId), { setIsVisualEditing: i } = q(), n = !!(d != null && d.visualId || t != null && t.id), c = !!(d != null && d.visualId && o), v = n && !c, {
207
+ const d = k((h) => h.frame), s = k((h) => h.card), t = se((h) => h.selectedVisual), o = g((h) => h.selectedFrameId), u = g((h) => h.selectedSheetId), { setIsVisualEditing: i } = q(), n = !!(d != null && d.visualId || t != null && t.id), c = !!(d != null && d.visualId && o), v = n && !c, {
208
208
  saveAsDialogOpen: f,
209
209
  setSaveAsDialogOpen: D,
210
210
  handleSaveAs: b,
@@ -228,7 +228,7 @@ function Ve({
228
228
  n && /* @__PURE__ */ r(E, { children: [
229
229
  c && /* @__PURE__ */ e(ue, { className: a }),
230
230
  v && u && s && (s.sql || te(s.config)) && /* @__PURE__ */ r(
231
- k,
231
+ N,
232
232
  {
233
233
  onClick: F,
234
234
  className: y(a),
@@ -244,7 +244,7 @@ function Ve({
244
244
  c && /* @__PURE__ */ e(ve, { className: a }),
245
245
  /* @__PURE__ */ r(O, { modal: !1, children: [
246
246
  /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
247
- k,
247
+ N,
248
248
  {
249
249
  variant: "outline",
250
250
  size: "sm",
@@ -268,7 +268,7 @@ function Ve({
268
268
  ] }),
269
269
  !n && /* @__PURE__ */ r(O, { modal: !1, children: [
270
270
  /* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
271
- k,
271
+ N,
272
272
  {
273
273
  variant: "outline",
274
274
  size: "sm",
@@ -297,12 +297,12 @@ function Ve({
297
297
  )
298
298
  ] });
299
299
  }
300
- function Me({
300
+ function Ve({
301
301
  className: a,
302
302
  //labelClassName,
303
303
  switchClassName: d
304
304
  }) {
305
- const s = N((n) => n.isDevMode), t = g((n) => n.isVisualEditing), { setIsDevMode: o } = ne(), { config: u } = be(de).tokenProps, i = (u == null ? void 0 : u.showAdvancedMode) !== !1;
305
+ const s = k((n) => n.isDevMode), t = g((n) => n.isVisualEditing), { setIsDevMode: o } = ne(), { config: u } = be(de).tokenProps, i = (u == null ? void 0 : u.showAdvancedMode) !== !1;
306
306
  return !t || !i ? null : /* @__PURE__ */ r("div", { className: y("flex items-center space-x-2", a), children: [
307
307
  /* @__PURE__ */ e(
308
308
  le,
@@ -407,9 +407,9 @@ function Te({
407
407
  ] }) : null;
408
408
  }
409
409
  export {
410
- Me as A,
410
+ Ve as A,
411
411
  Te as S,
412
- Ve as V,
412
+ Me as V,
413
413
  Se as c,
414
414
  Ee as g
415
415
  };
@@ -1 +1 @@
1
- "use strict";const o=require("./index-CJrseB0V.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
1
+ "use strict";const o=require("./index-C9xqgHpT.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
@@ -1,4 +1,4 @@
1
- import { ai as G, aj as z, h as Y, i as J, ak as K, e as _, g as X, u as U, al as Z, am as q, l as v, an as ee, f as h } from "./index-Cyic0UlN.js";
1
+ import { ak as G, al as z, h as Y, i as J, am as K, e as _, g as X, u as U, an as Z, ao as q, l as v, ap as ee, f as h } from "./index-Ci1UbzGA.js";
2
2
  import { useState as T, useEffect as te, useCallback as V } from "react";
3
3
  function re(e) {
4
4
  const o = e.toUpperCase().indexOf("WHERE"), r = e.toUpperCase().indexOf("GROUP BY"), t = e.toUpperCase().indexOf("LIMIT"), i = e.toUpperCase().indexOf("ORDER BY");
@@ -207,7 +207,7 @@ function de() {
207
207
  clearSelectedFrameId: O,
208
208
  addFrame: x,
209
209
  setIsDashboardPanelOpen: R
210
- } = X(), I = U((l) => l.selectedSheetId), W = U((l) => l.selectedFrameId), j = U((l) => l.dashboard), D = U((l) => l.filterValues), y = Z((t == null ? void 0 : t.id) || "", {
210
+ } = X(), I = U((l) => l.selectedSheetId), W = U((l) => l.selectedFrameId), D = U((l) => l.dashboard), L = U((l) => l.filterValues), y = Z((t == null ? void 0 : t.id) || "", {
211
211
  enabled: !!(t != null && t.id) && !!(e != null && e.accessToken)
212
212
  }), H = V(
213
213
  async (l) => {
@@ -235,10 +235,10 @@ function de() {
235
235
  setApplyFilters: C,
236
236
  setIsDashboardEditing: p,
237
237
  setIsVisualEditing: N,
238
- dashboard: j,
238
+ dashboard: D,
239
239
  selectedSheetId: I,
240
240
  selectedFrameId: W,
241
- filterValues: D
241
+ filterValues: L
242
242
  }))
243
243
  throw new Error("Failed to setup editor with visual data");
244
244
  return { success: !0, fromCache: f };
@@ -267,10 +267,10 @@ function de() {
267
267
  w,
268
268
  C,
269
269
  O,
270
- j,
270
+ D,
271
271
  I,
272
272
  W,
273
- D
273
+ L
274
274
  ]
275
275
  ), Q = V(
276
276
  async (l) => {
@@ -281,15 +281,15 @@ function de() {
281
281
  success: !1,
282
282
  error: "No sheet selected. Please select a sheet first."
283
283
  };
284
- const { data: f, fromCache: L } = await M(
284
+ const { data: f, fromCache: P } = await M(
285
285
  o.apiServiceUrl,
286
286
  (e == null ? void 0 : e.accessToken) || "",
287
287
  l.id,
288
288
  r
289
- ), P = (f == null ? void 0 : f.frameObject) ?? ((g = f == null ? void 0 : f.visual) == null ? void 0 : g.frameObject);
290
- if (!P)
289
+ ), j = (f == null ? void 0 : f.frameObject) ?? ((g = f == null ? void 0 : f.visual) == null ? void 0 : g.frameObject);
290
+ if (!j)
291
291
  return { success: !1, error: "Visual has no frame data" };
292
- const E = k(P);
292
+ const E = k(j);
293
293
  if (!(E != null && E.cards) || E.cards.length === 0)
294
294
  return { success: !1, error: "Visual frame is malformed" };
295
295
  const B = {
@@ -297,7 +297,7 @@ function de() {
297
297
  visualId: l.id
298
298
  // Link this frame to the library visual
299
299
  };
300
- return x(I, B, "end"), p(!0), A(B.id), R(!1), { success: !0, fromCache: L };
300
+ return x(I, B, "end"), p(!0), A(B.id), R(!1), { success: !0, fromCache: P };
301
301
  } catch (f) {
302
302
  return console.error("Error adding visual:", f), { success: !1, error: "Failed to add visual to dashboard" };
303
303
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CJrseB0V.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-C9xqgHpT.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-Cyic0UlN.js";
1
+ import { D as a } from "../chunks/index-Ci1UbzGA.js";
2
2
  import { EMPTY_SELECTION as e } from "../types/index.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CJrseB0V.js"),j=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),E=require("./chunks/resource-management-panel-BNDpfKQl.js"),h=require("./chunks/schedule-dashboard-CqFcuP5E.js");require("react-dom");function N(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const p=N(g);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-C9xqgHpT.js"),j=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),E=require("./chunks/resource-management-panel-Gn5D4PEs.js"),h=require("./chunks/schedule-dashboard-CHuBJfod.js");require("react-dom");function N(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const p=N(g);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const P=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function M(t){const{displayPreferences:r,...n}=t,i={...n,id:t.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsx(e.SemaphorContextProvider,{dashboardProps:i,children:a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:t.cardId})})})})})})}function A({cardId:t}){const r=e.useDashboardStore(s=>{var l;return(l=s.dashboard)==null?void 0:l.sheets}),{card:n,frame:i}=g.useMemo(()=>{const s=r==null?void 0:r.flatMap(o=>o.frames),l=s==null?void 0:s.flatMap(o=>o==null?void 0:o.cards),m=l==null?void 0:l.find(o=>(o==null?void 0:o.id)===t),f=s==null?void 0:s.find(o=>{var C;return(C=o==null?void 0:o.cards)==null?void 0:C.find(c=>(c==null?void 0:c.id)===t)});return{card:m,frame:f}},[r,t]);return!n||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${t}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:n,frame:i})})})}function k({name:t,items:r,value:n,onChange:i,isLoading:s,isError:l,refetch:m,className:f,icon:o,showNone:C=!1}){const c=p.useRef(null),[D,b]=p.useState(!1),[y,T]=p.useState("100%"),x=C?[...r||[],{id:"none",name:"None"}]:r;p.useLayoutEffect(()=>{c.current&&T(c.current.offsetWidth)},[]);function v(){var d;return s?"Loading...":l?"Error":n?(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.name:`Select ${t}`}function S(d,u){i(u),b(!1)}return a.jsxs(e.Popover,{open:D,onOpenChange:b,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:c,variant:"outline",role:"combobox","aria-expanded":D,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"mr-2",children:o}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:v()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:m,children:a.jsx(P,{className:e.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",t==null?void 0:t.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:x==null?void 0:x.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:u=>S(u,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",n===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=j.EMPTY_SELECTION;exports.ResourceManagementPanel=E.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.VisualEditingControls=h.VisualEditingControls;exports.cleanCard=h.cleanCard;exports.getDashbaordStateWithoutData=h.getDashbaordStateWithoutData;exports.Combobox=k;exports.Visual=M;
6
+ */const P=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function M(t){const{displayPreferences:r,...s}=t,i={...s,id:t.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsx(e.SemaphorContextProvider,{dashboardProps:i,children:a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:t.cardId})})})})})})}function A({cardId:t}){const r=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=g.useMemo(()=>{const n=r==null?void 0:r.flatMap(o=>o.frames),l=n==null?void 0:n.flatMap(o=>o==null?void 0:o.cards),m=l==null?void 0:l.find(o=>(o==null?void 0:o.id)===t),f=n==null?void 0:n.find(o=>{var C;return(C=o==null?void 0:o.cards)==null?void 0:C.find(c=>(c==null?void 0:c.id)===t)});return{card:m,frame:f}},[r,t]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${t}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:t,items:r,value:s,onChange:i,isLoading:n,isError:l,refetch:m,className:f,icon:o,showNone:C=!1}){const c=p.useRef(null),[b,x]=p.useState(!1),[y,T]=p.useState("100%"),D=C?[...r||[],{id:"none",name:"None"}]:r;p.useLayoutEffect(()=>{c.current&&T(c.current.offsetWidth)},[]);function v(){var d;return n?"Loading...":l?"Error":s?(d=r==null?void 0:r.find(u=>u.id===s))==null?void 0:d.name:`Select ${t}`}function S(d,u){i(u),x(!1)}return a.jsxs(e.Popover,{open:b,onOpenChange:x,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:c,variant:"outline",role:"combobox","aria-expanded":b,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"mr-2",children:o}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:v()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:m,children:a.jsx(P,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",t==null?void 0:t.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:u=>S(u,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=j.EMPTY_SELECTION;exports.ResourceManagementPanel=E.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.VisualEditingControls=h.VisualEditingControls;exports.cleanCard=h.cleanCard;exports.getDashbaordStateWithoutData=h.getDashbaordStateWithoutData;exports.Combobox=k;exports.Visual=M;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { b as S, E as D, F as w, S as P, U as M, m as k, n as A, u as F, o as b, p as L, P as R, q as I, B as V, c as v, r as _, s as W, t as B, v as q, I as H, w as O, x as j, y as z, z as G, C as Q } from "./chunks/index-Cyic0UlN.js";
2
- import { T as oa, V as ta, D as na, M as ia, _ as la, R as da, H as ca, H as ua, J as ha, a as pa, ah as fa, a5 as ma, O as Ca, $ as va, a7 as ga, a6 as ya, aa as ba, ab as Da, a4 as xa, N as Ea, a3 as Na, Y as Ta, Z as Sa, W as wa, a8 as Pa, a2 as Ma, a1 as ka, a0 as Aa, ac as Fa, a9 as La, K as Ra, ae as Ia, ag as Va, af as _a, g as Wa, Q as Ba, A as qa, e as Ha, ad as Oa, f as ja, G as za } from "./chunks/index-Cyic0UlN.js";
3
- import { EMPTY_SELECTION as Qa } from "./types/index.js";
4
- import { jsx as a, jsxs as l } from "react/jsx-runtime";
1
+ import { b as S, E as D, F as w, S as P, U as M, m as k, n as A, u as F, o as y, p as L, P as R, q as I, B as V, c as v, r as _, s as W, t as B, v as j, I as q, w as H, x as O, y as U, z, C as G } from "./chunks/index-Ci1UbzGA.js";
2
+ import { W as oa, Y as ta, D as na, M as ia, a0 as da, R as la, H as ca, H as ua, J as ha, a as pa, aj as fa, a7 as ma, T as Ca, N as va, O as ba, a1 as ga, a9 as ya, a8 as Da, ac as xa, ad as Ea, a6 as Na, Q as Ta, a5 as Sa, _ as wa, $ as Pa, Z as Ma, aa as ka, a4 as Aa, a3 as Fa, a2 as La, ae as Ra, ab as Ia, K as Va, ag as _a, ai as Wa, ah as Ba, g as ja, V as qa, A as Ha, e as Oa, af as Ua, f as za, G as Ga } from "./chunks/index-Ci1UbzGA.js";
3
+ import { EMPTY_SELECTION as Ka } from "./types/index.js";
4
+ import { jsx as a, jsxs as d } from "react/jsx-runtime";
5
5
  import * as p from "react";
6
- import { useMemo as U } from "react";
7
- import { ResourceManagementPanel as Ka } from "./chunks/resource-management-panel-DDLB-UWe.js";
8
- import { A as $a, S as Ja, V as Xa, c as Za, g as ae } from "./chunks/schedule-dashboard-BEV7hj7t.js";
6
+ import { useMemo as Q } from "react";
7
+ import { ResourceManagementPanel as $a } from "./chunks/resource-management-panel-rBUF-JVD.js";
8
+ import { A as Xa, S as Za, V as ae, c as ee, g as se } from "./chunks/schedule-dashboard-Xn9bMPcv.js";
9
9
  import "react-dom";
10
10
  /**
11
11
  * @license lucide-react v0.453.0 - ISC
@@ -20,18 +20,18 @@ const K = S("RefreshCw", [
20
20
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
21
21
  ]);
22
22
  function aa(s) {
23
- const { displayPreferences: o, ...i } = s, d = {
23
+ const { displayPreferences: o, ...i } = s, l = {
24
24
  ...i,
25
25
  id: s.dashboardId
26
26
  // override the id to the dashboard id so that the dashboard is not loaded
27
27
  };
28
- return /* @__PURE__ */ a(D, { FallbackComponent: w, children: /* @__PURE__ */ a(P, { dashboardProps: d, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(k, { displayPreferences: o, children: /* @__PURE__ */ a(A, { type: "visual", ...d, children: /* @__PURE__ */ a(Y, { cardId: s.cardId }) }) }) }) }) });
28
+ return /* @__PURE__ */ a(D, { FallbackComponent: w, children: /* @__PURE__ */ a(P, { dashboardProps: l, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(k, { displayPreferences: o, children: /* @__PURE__ */ a(A, { type: "visual", ...l, children: /* @__PURE__ */ a(Y, { cardId: s.cardId }) }) }) }) }) });
29
29
  }
30
30
  function Y({ cardId: s }) {
31
31
  const o = F((r) => {
32
32
  var t;
33
33
  return (t = r.dashboard) == null ? void 0 : t.sheets;
34
- }), { card: i, frame: d } = U(() => {
34
+ }), { card: i, frame: l } = Q(() => {
35
35
  const r = o == null ? void 0 : o.flatMap((e) => e.frames), t = r == null ? void 0 : r.flatMap((e) => e == null ? void 0 : e.cards), f = t == null ? void 0 : t.find((e) => (e == null ? void 0 : e.id) === s), m = r == null ? void 0 : r.find(
36
36
  (e) => {
37
37
  var h;
@@ -40,8 +40,8 @@ function Y({ cardId: s }) {
40
40
  );
41
41
  return { card: f, frame: m };
42
42
  }, [o, s]);
43
- return !i || !d ? /* @__PURE__ */ a(
44
- b,
43
+ return !i || !l ? /* @__PURE__ */ a(
44
+ y,
45
45
  {
46
46
  error: new Error("Card not found"),
47
47
  resetErrorBoundary: () => {
@@ -55,14 +55,14 @@ function Y({ cardId: s }) {
55
55
  error: r,
56
56
  resetErrorBoundary: t
57
57
  }) => /* @__PURE__ */ a(
58
- b,
58
+ y,
59
59
  {
60
60
  error: r,
61
61
  resetErrorBoundary: t,
62
62
  customerFacingMessage: "Error creating visual. Please try again."
63
63
  }
64
64
  ),
65
- children: /* @__PURE__ */ a(L, { card: i, frame: d })
65
+ children: /* @__PURE__ */ a(L, { card: i, frame: l })
66
66
  }
67
67
  ) });
68
68
  }
@@ -70,7 +70,7 @@ function ea({
70
70
  name: s,
71
71
  items: o,
72
72
  value: i,
73
- onChange: d,
73
+ onChange: l,
74
74
  isLoading: r,
75
75
  isError: t,
76
76
  refetch: f,
@@ -78,7 +78,7 @@ function ea({
78
78
  icon: e,
79
79
  showNone: h = !1
80
80
  }) {
81
- const c = p.useRef(null), [g, y] = p.useState(!1), [x, E] = p.useState("100%"), C = h ? [...o || [], { id: "none", name: "None" }] : o;
81
+ const c = p.useRef(null), [b, g] = p.useState(!1), [x, E] = p.useState("100%"), C = h ? [...o || [], { id: "none", name: "None" }] : o;
82
82
  p.useLayoutEffect(() => {
83
83
  c.current && E(c.current.offsetWidth);
84
84
  }, []);
@@ -87,19 +87,19 @@ function ea({
87
87
  return r ? "Loading..." : t ? "Error" : i ? (n = o == null ? void 0 : o.find((u) => u.id === i)) == null ? void 0 : n.name : `Select ${s}`;
88
88
  }
89
89
  function T(n, u) {
90
- d(u), y(!1);
90
+ l(u), g(!1);
91
91
  }
92
- return /* @__PURE__ */ l(R, { open: g, onOpenChange: y, children: [
93
- /* @__PURE__ */ a(I, { asChild: !0, children: /* @__PURE__ */ l(
92
+ return /* @__PURE__ */ d(R, { open: b, onOpenChange: g, children: [
93
+ /* @__PURE__ */ a(I, { asChild: !0, children: /* @__PURE__ */ d(
94
94
  V,
95
95
  {
96
96
  ref: c,
97
97
  variant: "outline",
98
98
  role: "combobox",
99
- "aria-expanded": g,
99
+ "aria-expanded": b,
100
100
  className: v("flex h-9 w-full justify-between", m),
101
101
  children: [
102
- /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
102
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
103
103
  e && /* @__PURE__ */ a("div", { className: "mr-2", children: e }),
104
104
  /* @__PURE__ */ a("span", { className: "max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap", children: N() })
105
105
  ] }),
@@ -112,10 +112,10 @@ function ea({
112
112
  {
113
113
  className: "w-full p-0",
114
114
  style: { minWidth: x },
115
- children: /* @__PURE__ */ l(B, { children: [
116
- /* @__PURE__ */ l("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
117
- /* @__PURE__ */ a(q, { className: "h-9", placeholder: "Search..." }),
118
- /* @__PURE__ */ a(H, { className: "h-7", onClick: f, children: /* @__PURE__ */ a(
115
+ children: /* @__PURE__ */ d(B, { children: [
116
+ /* @__PURE__ */ d("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
117
+ /* @__PURE__ */ a(j, { className: "h-9", placeholder: "Search..." }),
118
+ /* @__PURE__ */ a(q, { className: "h-7", onClick: f, children: /* @__PURE__ */ a(
119
119
  K,
120
120
  {
121
121
  className: v(
@@ -125,21 +125,21 @@ function ea({
125
125
  }
126
126
  ) })
127
127
  ] }),
128
- /* @__PURE__ */ l(O, { children: [
129
- /* @__PURE__ */ l(j, { children: [
128
+ /* @__PURE__ */ d(H, { children: [
129
+ /* @__PURE__ */ d(O, { children: [
130
130
  "No ",
131
131
  s == null ? void 0 : s.toLowerCase(),
132
132
  " found."
133
133
  ] }),
134
- /* @__PURE__ */ a(z, { children: C == null ? void 0 : C.map((n) => /* @__PURE__ */ a(
135
- G,
134
+ /* @__PURE__ */ a(U, { children: C == null ? void 0 : C.map((n) => /* @__PURE__ */ a(
135
+ z,
136
136
  {
137
137
  className: "overflow-x-auto",
138
138
  value: n.name,
139
139
  onSelect: (u) => T(u, n.id),
140
- children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
140
+ children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
141
141
  /* @__PURE__ */ a(
142
- Q,
142
+ G,
143
143
  {
144
144
  className: v(
145
145
  "size-4",
@@ -159,56 +159,58 @@ function ea({
159
159
  ] });
160
160
  }
161
161
  export {
162
- $a as AdvancedModeToggle,
162
+ Xa as AdvancedModeToggle,
163
163
  oa as CALCULATED_FIELD_ENTITY_MARKER,
164
164
  ea as Combobox,
165
165
  ta as DATE_FORMAT_VALUES,
166
166
  na as Dashboard,
167
167
  ia as DashboardWC,
168
- Qa as EMPTY_SELECTION,
169
- la as PivotMarkerEnum,
170
- Ka as ResourceManagementPanel,
171
- da as ResourceType,
172
- Ja as ScheduleDashboard,
168
+ Ka as EMPTY_SELECTION,
169
+ da as PivotMarkerEnum,
170
+ $a as ResourceManagementPanel,
171
+ la as ResourceType,
172
+ Za as ScheduleDashboard,
173
173
  P as SemaphorContextProvider,
174
174
  ca as SemaphorDataProvider,
175
175
  ua as SemaphorQueryClient,
176
176
  ha as ShareDialog,
177
177
  pa as Surfboard,
178
178
  aa as Visual,
179
- Xa as VisualEditingControls,
180
- Za as cleanCard,
179
+ ae as VisualEditingControls,
180
+ ee as cleanCard,
181
181
  fa as createEmptyKpiConfig,
182
182
  ma as createSqlGenConfig,
183
183
  Ca as downloadPdf,
184
- va as fmt,
185
- ga as getColumnDataType,
186
- ae as getDashbaordStateWithoutData,
187
- ya as getFilterValueType,
188
- ba as getFormattedTableNameForQuery,
189
- Da as getQualifiedTableName,
190
- xa as getSql,
191
- Ea as invalidateToken,
192
- Na as isBooleanDataType,
193
- Ta as isCalculatedDimension,
194
- Sa as isCalculatedField,
195
- wa as isCalculatedMetric,
196
- Pa as isColumnInSqlGen,
197
- Ma as isDateDataType,
198
- ka as isNumberDataType,
199
- Aa as isTextDataType,
200
- Fa as resolveDataType,
201
- La as resolveDatamodelName,
202
- Ra as useCard,
203
- Ia as useCurrentActiveCard,
204
- Va as useCurrentCardConfig,
205
- _a as useCurrentSheetActiveCards,
206
- Wa as useDashboardActions,
184
+ va as emitDashboardLoad,
185
+ ba as emitDashboardUnload,
186
+ ga as fmt,
187
+ ya as getColumnDataType,
188
+ se as getDashbaordStateWithoutData,
189
+ Da as getFilterValueType,
190
+ xa as getFormattedTableNameForQuery,
191
+ Ea as getQualifiedTableName,
192
+ Na as getSql,
193
+ Ta as invalidateToken,
194
+ Sa as isBooleanDataType,
195
+ wa as isCalculatedDimension,
196
+ Pa as isCalculatedField,
197
+ Ma as isCalculatedMetric,
198
+ ka as isColumnInSqlGen,
199
+ Aa as isDateDataType,
200
+ Fa as isNumberDataType,
201
+ La as isTextDataType,
202
+ Ra as resolveDataType,
203
+ Ia as resolveDatamodelName,
204
+ Va as useCard,
205
+ _a as useCurrentActiveCard,
206
+ Wa as useCurrentCardConfig,
207
+ Ba as useCurrentSheetActiveCards,
208
+ ja as useDashboardActions,
207
209
  F as useDashboardStore,
208
- Ba as useDataColumns,
209
- qa as useDateFilterHook,
210
- Ha as useEditorActions,
211
- Oa as useEditorAside,
212
- ja as useEditorStore,
213
- za as useTextFilterHook
210
+ qa as useDataColumns,
211
+ Ha as useDateFilterHook,
212
+ Oa as useEditorActions,
213
+ Ua as useEditorAside,
214
+ za as useEditorStore,
215
+ Ga as useTextFilterHook
214
216
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CJrseB0V.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-C9xqgHpT.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { a } from "../chunks/index-Cyic0UlN.js";
1
+ import { a } from "../chunks/index-Ci1UbzGA.js";
2
2
  import { EMPTY_SELECTION as E } from "../types/index.js";
3
3
  export {
4
4
  E as EMPTY_SELECTION,
@@ -1185,6 +1185,10 @@ export declare type EmailSettings = {
1185
1185
  senderTitle: string;
1186
1186
  };
1187
1187
 
1188
+ export declare const emitDashboardLoad: () => void;
1189
+
1190
+ export declare const emitDashboardUnload: () => void;
1191
+
1188
1192
  export declare const EMPTY_SELECTION: SelectionState;
1189
1193
 
1190
1194
  export declare type EntityColumnGroup = {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.121",
8
+ "version": "0.1.123",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",