react-semaphor 0.1.169 → 0.1.171

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 (26) hide show
  1. package/dist/chunks/{dashboard-controls-CrID4nR7.js → dashboard-controls-CNgQS9BW.js} +1 -1
  2. package/dist/chunks/{dashboard-controls-BsUYcBI9.js → dashboard-controls-D7m3nKlW.js} +4 -4
  3. package/dist/chunks/{dashboard-json-B_uiuxzz.js → dashboard-json-CAhDGDMM.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BoCnlkG-.js → dashboard-json-CdEXvNr2.js} +1 -1
  5. package/dist/chunks/{edit-dashboard-visual-CDlZJO6q.js → edit-dashboard-visual-Cdey2oP9.js} +2 -2
  6. package/dist/chunks/{edit-dashboard-visual-BZUVep2z.js → edit-dashboard-visual-DF-Rdpsd.js} +1 -1
  7. package/dist/chunks/{editor-action-buttons-BklKJZw6.js → editor-action-buttons-5J30zd2y.js} +2 -2
  8. package/dist/chunks/{editor-action-buttons-LavnGyBC.js → editor-action-buttons-Cq6JNj3l.js} +1 -1
  9. package/dist/chunks/{index-CQd8PU_U.js → index-D89Vy_ym.js} +112 -112
  10. package/dist/chunks/{index-CENrCRrz.js → index-DDMCK82d.js} +7134 -7119
  11. package/dist/chunks/{resource-management-panel-uNiuIJOI.js → resource-management-panel-CUUY8a9N.js} +3 -3
  12. package/dist/chunks/{resource-management-panel-eqSYDHyG.js → resource-management-panel-CwZQ52ME.js} +1 -1
  13. package/dist/chunks/{schedule-dashboard-Cc07Vqvn.js → schedule-dashboard-26c3ZrMF.js} +1 -1
  14. package/dist/chunks/{schedule-dashboard-CB6iJnpE.js → schedule-dashboard-dUIVld1r.js} +3 -3
  15. package/dist/chunks/{use-role-aware-display-preferences-CuzTSsbg.js → use-role-aware-display-preferences-DkIbMMSm.js} +1 -1
  16. package/dist/chunks/{use-role-aware-display-preferences-CEGdeLQ0.js → use-role-aware-display-preferences-bZFO0mzD.js} +1 -1
  17. package/dist/chunks/{use-visual-utils-BrhNFq24.js → use-visual-utils-CB_Q8ALy.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-BICcUVjF.js → use-visual-utils-D-4J8caE.js} +1 -1
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +2 -2
  22. package/dist/index.js +113 -105
  23. package/dist/surfboard/index.cjs +1 -1
  24. package/dist/surfboard/index.js +1 -1
  25. package/dist/types/main.d.ts +28 -1
  26. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { jsx as e, jsxs as a, Fragment as ge } from "react/jsx-runtime";
2
- import { l as $e, u as me, n as Qe, aB as re, b9 as Xe, ba as Ze, c as X, bb as ke, aS as et, aT as tt, B as _, aU as st, aV as at, aW as W, bc as pe, L as oe, bd as nt, be as it, bf as rt, bg as ve, bh as De, bi as ot, bj as lt, K as dt, bk as ye, e as le, bl as Se, bm as Ve, bn as ct, _ as Ee, V as Le, bo as Ae, a_ as Te, a$ as Oe, b0 as Re, b2 as Pe, b3 as Ue, b4 as Ie, b5 as je, b6 as Me, bp as ut, bq as ht, br as Fe, bs as Be, bt as ze, bu as mt, bv as He, bw as pt, R as ne, aA as ft, bx as _e, by as gt, bz as Dt, aF as xt, aG as Nt, aH as bt, aI as wt, aJ as vt, aK as Ce, aL as fe, aO as Ct, bA as yt, bB as St, bC as Vt, bD as Et } from "./index-CENrCRrz.js";
2
+ import { l as $e, u as me, n as Qe, aB as re, b9 as Xe, ba as Ze, c as X, bb as ke, aS as et, aT as tt, B as _, aU as st, aV as at, aW as W, bc as pe, L as oe, bd as nt, be as it, bf as rt, bg as ve, bh as De, bi as ot, bj as lt, K as dt, bk as ye, e as le, bl as Se, bm as Ve, bn as ct, _ as Ee, V as Le, bo as Ae, a_ as Te, a$ as Oe, b0 as Re, b2 as Pe, b3 as Ue, b4 as Ie, b5 as je, b6 as Me, bp as ut, bq as ht, br as Fe, bs as Be, bt as ze, bu as mt, bv as He, bw as pt, R as ne, aA as ft, bx as _e, by as gt, bz as Dt, aF as xt, aG as Nt, aH as bt, aI as wt, aJ as vt, aK as Ce, aL as fe, aO as Ct, bA as yt, bB as St, bC as Vt, bD as Et } from "./index-DDMCK82d.js";
3
3
  import Lt, { useRef as At, useEffect as ie, useState as x } from "react";
4
- import { a as Ke } from "./use-visual-utils-BICcUVjF.js";
5
- import { u as Tt } from "./use-role-aware-display-preferences-CuzTSsbg.js";
4
+ import { a as Ke } from "./use-visual-utils-D-4J8caE.js";
5
+ import { u as Tt } from "./use-role-aware-display-preferences-DkIbMMSm.js";
6
6
  /**
7
7
  * @license lucide-react v0.453.0 - ISC
8
8
  *
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CQd8PU_U.js"),c=require("react"),de=require("./use-visual-utils-BrhNFq24.js"),pe=require("./use-role-aware-display-preferences-CEGdeLQ0.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-D89Vy_ym.js"),c=require("react"),de=require("./use-visual-utils-CB_Q8ALy.js"),pe=require("./use-role-aware-display-preferences-bZFO0mzD.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("react/jsx-runtime"),e=require("./index-CQd8PU_U.js"),C=require("./editor-action-buttons-LavnGyBC.js"),x=require("react"),y=require("./use-visual-utils-BrhNFq24.js");/**
1
+ "use strict";const s=require("react/jsx-runtime"),e=require("./index-D89Vy_ym.js"),C=require("./editor-action-buttons-Cq6JNj3l.js"),x=require("react"),y=require("./use-visual-utils-CB_Q8ALy.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 a, Fragment as F } from "react/jsx-runtime";
2
- import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-CENrCRrz.js";
3
- import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-BklKJZw6.js";
2
+ import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-DDMCK82d.js";
3
+ import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-5J30zd2y.js";
4
4
  import we, { useState as D, useContext as Ie, useEffect as ke } from "react";
5
- import { a as W } from "./use-visual-utils-BICcUVjF.js";
5
+ import { a as W } from "./use-visual-utils-D-4J8caE.js";
6
6
  /**
7
7
  * @license lucide-react v0.453.0 - ISC
8
8
  *
@@ -1,4 +1,4 @@
1
- import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-CENrCRrz.js";
1
+ import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-DDMCK82d.js";
2
2
  import { useMemo as i } from "react";
3
3
  function S() {
4
4
  const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
@@ -1 +1 @@
1
- "use strict";const a=require("./index-CQd8PU_U.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
1
+ "use strict";const a=require("./index-D89Vy_ym.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
@@ -1 +1 @@
1
- "use strict";const o=require("./index-CQd8PU_U.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-D89Vy_ym.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 { az as z, aA as G, p as Y, q as J, aB as K, m as _, o as X, u as U, aC as Z, aD as q, t as v, aE as ee, n as h } from "./index-CENrCRrz.js";
1
+ import { az as z, aA as G, p as Y, q as J, aB as K, m as _, o as X, u as U, aC as Z, aD as q, t as v, aE as ee, n as h } from "./index-DDMCK82d.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");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CQd8PU_U.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-D89Vy_ym.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-CENrCRrz.js";
1
+ import { D as a } from "../chunks/index-DDMCK82d.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-CQd8PU_U.js"),j=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),E=require("./chunks/resource-management-panel-eqSYDHyG.js"),h=require("./chunks/schedule-dashboard-Cc07Vqvn.js");require("react-dom");function M(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=M(g);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-D89Vy_ym.js"),v=require("./types/index.cjs"),a=require("react/jsx-runtime"),b=require("react"),j=require("./chunks/resource-management-panel-CwZQ52ME.js"),h=require("./chunks/schedule-dashboard-26c3ZrMF.js");require("react-dom");function P(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=P(b);/**
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 N(r){const{displayPreferences:o,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[a.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})]})})}function A({cardId:r}){const o=e.useDashboardStore(n=>{var d;return(d=n.dashboard)==null?void 0:d.sheets}),{card:s,frame:i}=g.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),d=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=d==null?void 0:d.find(t=>(t==null?void 0:t.id)===r),f=n==null?void 0:n.find(t=>{var p;return(p=t==null?void 0:t.cards)==null?void 0:p.find(u=>(u==null?void 0:u.id)===r)});return{card:C,frame:f}},[o,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:d})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:d,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:r,items:o,value:s,onChange:i,isLoading:n,isError:d,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[b,x]=m.useState(!1),[y,v]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&v(u.current.offsetWidth)},[]);function T(){var l;return n?"Loading...":d?"Error":s?(l=o==null?void 0:o.find(c=>c.id===s))==null?void 0:l.name:`Select ${r}`}function S(l,c){i(c),x(!1)}return a.jsxs(e.Popover,{open:b,onOpenChange:x,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,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:[t&&a.jsx("div",{className:"mr-2",children:t}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),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:C,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 ",r==null?void 0:r.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(l=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:l.name,onSelect:c=>S(c,l.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===l.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:l.name,children:l.name})]})},l.id))})]})]})})]})}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;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.cloneDeep=e.cloneDeep;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.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;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.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=j.EMPTY_SELECTION;exports.ResourceManagementPanel=E.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.UnsavedChangesAlert=h.UnsavedChangesAlert;exports.VisualEditingControls=h.VisualEditingControls;exports.usePristineSnapshotInitializer=h.usePristineSnapshotInitializer;exports.Combobox=k;exports.Visual=N;
6
+ */const M=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 _(r){const{displayPreferences:o,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[a.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})]})})}function A({cardId:r}){const o=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=b.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),l=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=l==null?void 0:l.find(t=>(t==null?void 0:t.id)===r),f=n==null?void 0:n.find(t=>{var p;return(p=t==null?void 0:t.cards)==null?void 0:p.find(u=>(u==null?void 0:u.id)===r)});return{card:C,frame:f}},[o,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):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 N({name:r,items:o,value:s,onChange:i,isLoading:n,isError:l,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[x,g]=m.useState(!1),[y,T]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&T(u.current.offsetWidth)},[]);function E(){var d;return n?"Loading...":l?"Error":s?(d=o==null?void 0:o.find(c=>c.id===s))==null?void 0:d.name:`Select ${r}`}function S(d,c){i(c),g(!1)}return a.jsxs(e.Popover,{open:x,onOpenChange:g,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,variant:"outline",role:"combobox","aria-expanded":x,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx("div",{className:"mr-2",children:t}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:E()})]}),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:C,children:a.jsx(M,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.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:c=>S(c,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))})]})]})})]})}function w(r,o){b.useEffect(()=>(r&&o&&(window.__SEMAPHOR_PRINT_STATE__={...o}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,o])}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;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.cloneDeep=e.cloneDeep;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.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;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.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.ResourceManagementPanel=j.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.UnsavedChangesAlert=h.UnsavedChangesAlert;exports.VisualEditingControls=h.VisualEditingControls;exports.usePristineSnapshotInitializer=h.usePristineSnapshotInitializer;exports.Combobox=N;exports.Visual=_;exports.useExposePrintState=w;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { l as N, E as g, F as w, S as M, v as P, U as k, w as A, x as I, u as R, y as D, z as F, P as L, A as V, B as _, c as v, G as B, H as U, I as W, J as j, K as q, M as z, N as O, O as Q, Q as G, C as H } from "./chunks/index-CENrCRrz.js";
2
- import { aa as na, ab as ta, D as ia, a8 as da, a2 as la, af as ca, V as ua, Z as ha, Z as pa, _ as ma, a as fa, a5 as Ca, ay as va, am as ya, a7 as ba, a3 as Da, a4 as ga, ag as xa, ao as Ea, an as Sa, ar as Ta, as as Na, al as wa, a6 as Ma, ak as Pa, ad as ka, ae as Aa, ac as Ia, ap as Ra, aj as Fa, ai as La, ah as Va, at as _a, aq as Ba, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Oa, T as Qa, a9 as Ga, W as Ha, m as Ka, au as Ya, n as $a, R as Za, $ as Ja, Y as Xa } from "./chunks/index-CENrCRrz.js";
3
- import { EMPTY_SELECTION as ee } from "./types/index.js";
1
+ import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-DDMCK82d.js";
2
+ import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-DDMCK82d.js";
3
+ import { EMPTY_SELECTION as oe } from "./types/index.js";
4
4
  import { jsx as a, jsxs as i } from "react/jsx-runtime";
5
5
  import * as p from "react";
6
- import { useMemo as K } from "react";
7
- import { ResourceManagementPanel as oe } from "./chunks/resource-management-panel-uNiuIJOI.js";
8
- import { A as ne, S as te, U as ie, V as de, u as le } from "./chunks/schedule-dashboard-CB6iJnpE.js";
6
+ import { useMemo as K, useEffect as Y } from "react";
7
+ import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-CUUY8a9N.js";
8
+ import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-dUIVld1r.js";
9
9
  import "react-dom";
10
10
  /**
11
11
  * @license lucide-react v0.453.0 - ISC
@@ -13,88 +13,88 @@ import "react-dom";
13
13
  * This source code is licensed under the ISC license.
14
14
  * See the LICENSE file in the root directory of this source tree.
15
15
  */
16
- const Y = N("RefreshCw", [
16
+ const $ = w("RefreshCw", [
17
17
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
18
18
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
19
19
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
20
20
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
21
21
  ]);
22
- function ea(s) {
23
- const { displayPreferences: r, ...d } = s, l = {
22
+ function sa(e) {
23
+ const { displayPreferences: s, ...d } = e, l = {
24
24
  ...d,
25
- id: s.dashboardId
25
+ id: e.dashboardId
26
26
  // override the id to the dashboard id so that the dashboard is not loaded
27
27
  };
28
- return /* @__PURE__ */ a(g, { FallbackComponent: w, children: /* @__PURE__ */ i(M, { dashboardProps: l, children: [
29
- /* @__PURE__ */ a(P, { componentType: "visual", componentId: s.cardId }),
30
- /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(A, { displayPreferences: r, children: /* @__PURE__ */ a(I, { type: "visual", ...l, children: /* @__PURE__ */ a($, { cardId: s.cardId }) }) }) })
28
+ return /* @__PURE__ */ a(T, { FallbackComponent: N, children: /* @__PURE__ */ i(_, { dashboardProps: l, children: [
29
+ /* @__PURE__ */ a(P, { componentType: "visual", componentId: e.cardId }),
30
+ /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(A, { displayPreferences: s, children: /* @__PURE__ */ a(I, { type: "visual", ...l, children: /* @__PURE__ */ a(Z, { cardId: e.cardId }) }) }) })
31
31
  ] }) });
32
32
  }
33
- function $({ cardId: s }) {
34
- const r = R((o) => {
33
+ function Z({ cardId: e }) {
34
+ const s = R((r) => {
35
35
  var n;
36
- return (n = o.dashboard) == null ? void 0 : n.sheets;
36
+ return (n = r.dashboard) == null ? void 0 : n.sheets;
37
37
  }), { card: d, frame: l } = K(() => {
38
- const o = r == null ? void 0 : r.flatMap((e) => e.frames), n = o == null ? void 0 : o.flatMap((e) => e == null ? void 0 : e.cards), m = n == null ? void 0 : n.find((e) => (e == null ? void 0 : e.id) === s), f = o == null ? void 0 : o.find(
39
- (e) => {
38
+ const r = s == null ? void 0 : s.flatMap((o) => o.frames), n = r == null ? void 0 : r.flatMap((o) => o == null ? void 0 : o.cards), m = n == null ? void 0 : n.find((o) => (o == null ? void 0 : o.id) === e), f = r == null ? void 0 : r.find(
39
+ (o) => {
40
40
  var h;
41
- return (h = e == null ? void 0 : e.cards) == null ? void 0 : h.find((c) => (c == null ? void 0 : c.id) === s);
41
+ return (h = o == null ? void 0 : o.cards) == null ? void 0 : h.find((c) => (c == null ? void 0 : c.id) === e);
42
42
  }
43
43
  );
44
44
  return { card: m, frame: f };
45
- }, [r, s]);
45
+ }, [s, e]);
46
46
  return !d || !l ? /* @__PURE__ */ a(
47
47
  D,
48
48
  {
49
49
  error: new Error("Card not found"),
50
50
  resetErrorBoundary: () => {
51
51
  },
52
- customerFacingMessage: `Card not found with ID: ${s}`
52
+ customerFacingMessage: `Card not found with ID: ${e}`
53
53
  }
54
54
  ) : /* @__PURE__ */ a("main", { className: "flex h-full grow flex-col", children: /* @__PURE__ */ a(
55
- g,
55
+ T,
56
56
  {
57
57
  FallbackComponent: ({
58
- error: o,
58
+ error: r,
59
59
  resetErrorBoundary: n
60
60
  }) => /* @__PURE__ */ a(
61
61
  D,
62
62
  {
63
- error: o,
63
+ error: r,
64
64
  resetErrorBoundary: n,
65
65
  customerFacingMessage: "Error creating visual. Please try again."
66
66
  }
67
67
  ),
68
- children: /* @__PURE__ */ a(F, { card: d, frame: l })
68
+ children: /* @__PURE__ */ a(k, { card: d, frame: l })
69
69
  }
70
70
  ) });
71
71
  }
72
- function sa({
73
- name: s,
74
- items: r,
72
+ function oa({
73
+ name: e,
74
+ items: s,
75
75
  value: d,
76
76
  onChange: l,
77
- isLoading: o,
77
+ isLoading: r,
78
78
  isError: n,
79
79
  refetch: m,
80
80
  className: f,
81
- icon: e,
81
+ icon: o,
82
82
  showNone: h = !1
83
83
  }) {
84
- const c = p.useRef(null), [y, b] = p.useState(!1), [x, E] = p.useState("100%"), C = h ? [...r || [], { id: "none", name: "None" }] : r;
84
+ const c = p.useRef(null), [y, b] = p.useState(!1), [g, E] = p.useState("100%"), C = h ? [...s || [], { id: "none", name: "None" }] : s;
85
85
  p.useLayoutEffect(() => {
86
86
  c.current && E(c.current.offsetWidth);
87
87
  }, []);
88
88
  function S() {
89
89
  var t;
90
- return o ? "Loading..." : n ? "Error" : d ? (t = r == null ? void 0 : r.find((u) => u.id === d)) == null ? void 0 : t.name : `Select ${s}`;
90
+ return r ? "Loading..." : n ? "Error" : d ? (t = s == null ? void 0 : s.find((u) => u.id === d)) == null ? void 0 : t.name : `Select ${e}`;
91
91
  }
92
- function T(t, u) {
92
+ function x(t, u) {
93
93
  l(u), b(!1);
94
94
  }
95
- return /* @__PURE__ */ i(L, { open: y, onOpenChange: b, children: [
96
- /* @__PURE__ */ a(V, { asChild: !0, children: /* @__PURE__ */ i(
97
- _,
95
+ return /* @__PURE__ */ i(F, { open: y, onOpenChange: b, children: [
96
+ /* @__PURE__ */ a(L, { asChild: !0, children: /* @__PURE__ */ i(
97
+ V,
98
98
  {
99
99
  ref: c,
100
100
  variant: "outline",
@@ -103,46 +103,46 @@ function sa({
103
103
  className: v("flex h-9 w-full justify-between", f),
104
104
  children: [
105
105
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
106
- e && /* @__PURE__ */ a("div", { className: "mr-2", children: e }),
106
+ o && /* @__PURE__ */ a("div", { className: "mr-2", children: o }),
107
107
  /* @__PURE__ */ a("span", { className: "max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap", children: S() })
108
108
  ] }),
109
- /* @__PURE__ */ a(B, { className: "size-4 opacity-50" })
109
+ /* @__PURE__ */ a(O, { className: "size-4 opacity-50" })
110
110
  ]
111
111
  }
112
112
  ) }),
113
113
  /* @__PURE__ */ a(
114
- U,
114
+ B,
115
115
  {
116
116
  className: "w-full p-0",
117
- style: { minWidth: x },
118
- children: /* @__PURE__ */ i(W, { children: [
117
+ style: { minWidth: g },
118
+ children: /* @__PURE__ */ i(H, { children: [
119
119
  /* @__PURE__ */ i("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
120
- /* @__PURE__ */ a(j, { className: "h-9", placeholder: "Search..." }),
121
- /* @__PURE__ */ a(q, { className: "h-7", onClick: m, children: /* @__PURE__ */ a(
122
- Y,
120
+ /* @__PURE__ */ a(U, { className: "h-9", placeholder: "Search..." }),
121
+ /* @__PURE__ */ a(W, { className: "h-7", onClick: m, children: /* @__PURE__ */ a(
122
+ $,
123
123
  {
124
124
  className: v(
125
125
  "size-3.5 opacity-50",
126
- o && "animate-spin"
126
+ r && "animate-spin"
127
127
  )
128
128
  }
129
129
  ) })
130
130
  ] }),
131
- /* @__PURE__ */ i(z, { children: [
132
- /* @__PURE__ */ i(O, { children: [
131
+ /* @__PURE__ */ i(j, { children: [
132
+ /* @__PURE__ */ i(q, { children: [
133
133
  "No ",
134
- s == null ? void 0 : s.toLowerCase(),
134
+ e == null ? void 0 : e.toLowerCase(),
135
135
  " found."
136
136
  ] }),
137
- /* @__PURE__ */ a(Q, { children: C == null ? void 0 : C.map((t) => /* @__PURE__ */ a(
138
- G,
137
+ /* @__PURE__ */ a(z, { children: C == null ? void 0 : C.map((t) => /* @__PURE__ */ a(
138
+ Q,
139
139
  {
140
140
  className: "overflow-x-auto",
141
141
  value: t.name,
142
- onSelect: (u) => T(u, t.id),
142
+ onSelect: (u) => x(u, t.id),
143
143
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
144
144
  /* @__PURE__ */ a(
145
- H,
145
+ G,
146
146
  {
147
147
  className: v(
148
148
  "size-4",
@@ -161,65 +161,73 @@ function sa({
161
161
  )
162
162
  ] });
163
163
  }
164
+ function ra(e, s) {
165
+ Y(() => (e && s && (window.__SEMAPHOR_PRINT_STATE__ = {
166
+ ...s
167
+ }), () => {
168
+ e && window.__SEMAPHOR_PRINT_STATE__ && delete window.__SEMAPHOR_PRINT_STATE__;
169
+ }), [e, s]);
170
+ }
164
171
  export {
165
- ne as AdvancedModeToggle,
166
- na as CALCULATED_FIELD_ENTITY_MARKER,
167
- sa as Combobox,
168
- ta as DATE_FORMAT_VALUES,
169
- ia as Dashboard,
170
- da as DashboardExportDialog,
171
- la as DashboardWC,
172
- ee as EMPTY_SELECTION,
173
- ca as PivotMarkerEnum,
174
- oe as ResourceManagementPanel,
175
- ua as ResourceType,
176
- te as ScheduleDashboard,
177
- M as SemaphorContextProvider,
178
- ha as SemaphorDataProvider,
179
- pa as SemaphorQueryClient,
180
- ma as ShareDialog,
181
- fa as Surfboard,
182
- ie as UnsavedChangesAlert,
183
- ea as Visual,
184
- de as VisualEditingControls,
185
- Ca as cloneDeep,
186
- va as createEmptyKpiConfig,
187
- ya as createSqlGenConfig,
188
- ba as downloadPdf,
189
- Da as emitDashboardLoad,
190
- ga as emitDashboardUnload,
191
- xa as fmt,
192
- Ea as getColumnDataType,
193
- Sa as getFilterValueType,
194
- Ta as getFormattedTableNameForQuery,
195
- Na as getQualifiedTableName,
196
- wa as getSql,
172
+ ie as AdvancedModeToggle,
173
+ ia as CALCULATED_FIELD_ENTITY_MARKER,
174
+ oa as Combobox,
175
+ da as DATE_FORMAT_VALUES,
176
+ la as Dashboard,
177
+ ca as DashboardExportDialog,
178
+ ua as DashboardWC,
179
+ oe as EMPTY_SELECTION,
180
+ ha as PivotMarkerEnum,
181
+ ne as ResourceManagementPanel,
182
+ pa as ResourceType,
183
+ de as ScheduleDashboard,
184
+ _ as SemaphorContextProvider,
185
+ ma as SemaphorDataProvider,
186
+ fa as SemaphorQueryClient,
187
+ Ca as ShareDialog,
188
+ va as Surfboard,
189
+ le as UnsavedChangesAlert,
190
+ sa as Visual,
191
+ ce as VisualEditingControls,
192
+ ya as cloneDeep,
193
+ ba as createEmptyKpiConfig,
194
+ Da as createSqlGenConfig,
195
+ Ta as downloadPdf,
196
+ ga as emitDashboardLoad,
197
+ Ea as emitDashboardUnload,
198
+ Sa as fmt,
199
+ xa as getColumnDataType,
200
+ wa as getFilterValueType,
201
+ Na as getFormattedTableNameForQuery,
202
+ _a as getQualifiedTableName,
203
+ Pa as getSql,
197
204
  Ma as invalidateToken,
198
- Pa as isBooleanDataType,
199
- ka as isCalculatedDimension,
200
- Aa as isCalculatedField,
201
- Ia as isCalculatedMetric,
202
- Ra as isColumnInSqlGen,
203
- Fa as isDateDataType,
204
- La as isNumberDataType,
205
- Va as isTextDataType,
206
- _a as resolveDataType,
207
- Ba as resolveDatamodelName,
205
+ Aa as isBooleanDataType,
206
+ Ia as isCalculatedDimension,
207
+ Ra as isCalculatedField,
208
+ ka as isCalculatedMetric,
209
+ Fa as isColumnInSqlGen,
210
+ La as isDateDataType,
211
+ Va as isNumberDataType,
212
+ Oa as isTextDataType,
213
+ Ba as resolveDataType,
214
+ Ha as resolveDatamodelName,
208
215
  Ua as useCard,
209
216
  Wa as useCurrentActiveCard,
210
217
  ja as useCurrentCardConfig,
211
218
  qa as useCurrentSheetActiveCards,
212
219
  za as useDashboardActions,
213
- Oa as useDashboardById,
214
- Qa as useDashboardQuery,
220
+ Qa as useDashboardById,
221
+ Ga as useDashboardQuery,
215
222
  R as useDashboardStore,
216
- Ga as useDataColumns,
217
- Ha as useDateFilterHook,
218
- Ka as useEditorActions,
219
- Ya as useEditorAside,
220
- $a as useEditorStore,
221
- Za as useManagementStore,
222
- le as usePristineSnapshotInitializer,
223
- Ja as useResourceManagement,
224
- Xa as useTextFilterHook
223
+ Ka as useDataColumns,
224
+ Ya as useDateFilterHook,
225
+ $a as useEditorActions,
226
+ Za as useEditorAside,
227
+ Ja as useEditorStore,
228
+ ra as useExposePrintState,
229
+ Xa as useManagementStore,
230
+ ue as usePristineSnapshotInitializer,
231
+ ae as useResourceManagement,
232
+ ee as useTextFilterHook
225
233
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CQd8PU_U.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-D89Vy_ym.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-CENrCRrz.js";
1
+ import { a } from "../chunks/index-DDMCK82d.js";
2
2
  import { EMPTY_SELECTION as E } from "../types/index.js";
3
3
  export {
4
4
  E as EMPTY_SELECTION,
@@ -889,7 +889,7 @@ export declare type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | '
889
889
 
890
890
  export declare type DisplayDataType = 'string' | 'date' | 'number' | 'html' | 'none';
891
891
 
892
- export declare function downloadPdf(apiServiceUrl: string, authToken: AuthToken | undefined, password?: string, sheetSelection?: 'current' | 'all'): Promise<void>;
892
+ export declare function downloadPdf(apiServiceUrl: string, authToken: AuthToken | undefined, password?: string, sheetSelection?: 'current' | 'all', expandedState?: Record<string, boolean>): Promise<void>;
893
893
 
894
894
  declare interface DrillActions {
895
895
  updateDrillHierarchies: (h: DrillHierarchy[]) => void;
@@ -1885,6 +1885,13 @@ export declare type Placeholders = {
1885
1885
 
1886
1886
  export declare type PluginType = 'custom' | 'standard';
1887
1887
 
1888
+ /**
1889
+ * Print state structure exposed to window for Lambda/Puppeteer access.
1890
+ */
1891
+ export declare type PrintState = {
1892
+ expandedState?: Record<string, boolean>;
1893
+ };
1894
+
1888
1895
  export declare type QueryColumn = GroupByColumn | MetricColumn | FilterByColumn;
1889
1896
 
1890
1897
  export declare interface QueryConfig {
@@ -3188,6 +3195,26 @@ export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "
3188
3195
  setState(nextStateOrUpdater: EditorStore | Partial<EditorStore> | ((state: WritableDraft<EditorStore>) => void), shouldReplace?: boolean | undefined): void;
3189
3196
  }>;
3190
3197
 
3198
+ /**
3199
+ * Hook that exposes print state to the window object for Lambda/Puppeteer to access.
3200
+ *
3201
+ * Used by visual-view.tsx and view-container.tsx during PDF rendering to make
3202
+ * the captured expanded state available to the PDF generator.
3203
+ *
3204
+ * @param isPdfRender - Whether the current render is for PDF generation
3205
+ * @param printState - The print state to expose (expandedState, etc.)
3206
+ *
3207
+ * @example
3208
+ * // In visual-view.tsx or view-container.tsx:
3209
+ * const expandedState = useMemo(() => {
3210
+ * const param = searchParams.get('expandedState');
3211
+ * return param ? JSON.parse(param) : null;
3212
+ * }, [searchParams]);
3213
+ *
3214
+ * useExposePrintState(isPdfRender, expandedState ? { expandedState } : null);
3215
+ */
3216
+ export declare function useExposePrintState(isPdfRender: boolean, printState: PrintState | null): void;
3217
+
3191
3218
  export declare const useManagementStore: UseBoundStore<Omit<StoreApi<ManagementStore>, "setState"> & {
3192
3219
  setState(nextStateOrUpdater: ManagementStore | Partial<ManagementStore> | ((state: WritableDraft<ManagementStore>) => void), shouldReplace?: boolean | undefined): void;
3193
3220
  }>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.169",
8
+ "version": "0.1.171",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",