semaphor 0.0.128 → 0.0.130

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 (33) hide show
  1. package/dist/chunks/dashboard-controls-BMLlOkS9.js +1539 -0
  2. package/dist/chunks/dashboard-controls-BdQcYRkf.js +26 -0
  3. package/dist/chunks/dashboard-export-dialog-BpNaUA5x.js +6 -0
  4. package/dist/chunks/dashboard-export-dialog-CbMcLZvW.js +602 -0
  5. package/dist/chunks/dashboard-json-DD-d9gYu.js +66 -0
  6. package/dist/chunks/dashboard-json-DgQozDAv.js +1 -0
  7. package/dist/chunks/edit-dashboard-visual-CR3NqJ7m.js +200 -0
  8. package/dist/chunks/edit-dashboard-visual-CRMhXxdG.js +15517 -0
  9. package/dist/chunks/editor-action-buttons-CNQtSzD5.js +270 -0
  10. package/dist/chunks/editor-action-buttons-DYrSZQhJ.js +6 -0
  11. package/dist/chunks/index-CReqnEJI.js +1081 -0
  12. package/dist/chunks/{index-nm88dVBB.js → index-QdSI9E0a.js} +89207 -74907
  13. package/dist/chunks/resource-management-panel-CBXn6QHi.js +895 -0
  14. package/dist/chunks/resource-management-panel-CXSx9QhW.js +6 -0
  15. package/dist/chunks/use-click-outside-B9T3lmcw.js +1 -0
  16. package/dist/chunks/use-click-outside-CMeO_QFI.js +16 -0
  17. package/dist/chunks/use-visual-utils-BDuNB0Iz.js +1 -0
  18. package/dist/chunks/use-visual-utils-BnCl386t.js +331 -0
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +6 -1
  22. package/dist/index.js +194 -111
  23. package/dist/style.css +1 -1
  24. package/dist/surfboard/index.cjs +1 -1
  25. package/dist/surfboard/index.js +4 -4
  26. package/dist/types/dashboard.d.ts +524 -18
  27. package/dist/types/main.d.ts +948 -105
  28. package/dist/types/surfboard.d.ts +524 -18
  29. package/dist/types/types.d.ts +524 -18
  30. package/package.json +11 -7
  31. package/dist/chunks/dashboard-plus-DuenxiNV.js +0 -335
  32. package/dist/chunks/dashboard-plus-vO1PNFhv.js +0 -22561
  33. package/dist/chunks/index-BRkgsUH0.js +0 -985
@@ -0,0 +1,270 @@
1
+ import { jsxs as u, jsx as y, Fragment as C } from "react/jsx-runtime";
2
+ import { b as K, e as b, f as t, B as S, c as g, C as Q, u as D, g as F, L as z, h as I, i as k, j as E, k as B, X as L, l as h } from "./index-QdSI9E0a.js";
3
+ import { u as M, a as N } from "./use-visual-utils-BnCl386t.js";
4
+ import { useState as V } from "react";
5
+ /**
6
+ * @license lucide-react v0.453.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+ const U = K("Save", [
12
+ [
13
+ "path",
14
+ {
15
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
16
+ key: "1c8476"
17
+ }
18
+ ],
19
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
20
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
21
+ ]);
22
+ function O({
23
+ className: d,
24
+ variant: i = "outline"
25
+ }) {
26
+ var m;
27
+ const { setCardSql: o } = b();
28
+ t((e) => e.frame);
29
+ const l = t((e) => e.card);
30
+ M(
31
+ ((m = l.customCardPreferences) == null ? void 0 : m.url) || ""
32
+ ), t(
33
+ (e) => e.selectedSchemaName
34
+ ), t(
35
+ (e) => e.selectedDatamodelId
36
+ ), t(
37
+ (e) => e.selectedDatabaseName
38
+ ), t((e) => e.selectedTableName), t(
39
+ (e) => e.selectedConnectionId
40
+ ), t((e) => e.isShowingVisual), l.sql;
41
+ const a = t((e) => e.onSave), { getUpdatedFrame: n } = N();
42
+ function c() {
43
+ const e = n();
44
+ a == null || a(e);
45
+ }
46
+ return /* @__PURE__ */ u(
47
+ S,
48
+ {
49
+ onClick: c,
50
+ className: g("h-8", d),
51
+ size: "sm",
52
+ variant: i,
53
+ children: [
54
+ /* @__PURE__ */ y(Q, { className: "mr-2 size-4 font-bold" }),
55
+ "Accept"
56
+ ]
57
+ }
58
+ );
59
+ }
60
+ function w({
61
+ className: d,
62
+ variant: i = "default"
63
+ }) {
64
+ const o = I(), [l, a] = V(!1), n = D(
65
+ (r) => r.actions.setIsDashboardPanelOpen
66
+ ), { setIsVisualEditing: c } = F(), { getUpdatedFrame: m } = N(), e = k(), s = t((r) => r.frame), f = E();
67
+ return /* @__PURE__ */ u(
68
+ S,
69
+ {
70
+ onClick: () => {
71
+ const r = m(), p = (s == null ? void 0 : s.visualId) || (e == null ? void 0 : e.id);
72
+ if (!p) {
73
+ h.error("No visual to save");
74
+ return;
75
+ }
76
+ a(!0), f.mutate(
77
+ {
78
+ visualId: p,
79
+ data: {
80
+ frameObject: r
81
+ }
82
+ },
83
+ {
84
+ onSuccess: () => {
85
+ a(!1), n(!0), h.success("Visual updated successfully"), o.invalidateQueries({
86
+ queryKey: ["resource-by-id", "visual", p],
87
+ exact: !0
88
+ });
89
+ },
90
+ onError: () => {
91
+ a(!1), h.error("Failed to update visual");
92
+ }
93
+ }
94
+ );
95
+ },
96
+ className: g("h-8", d),
97
+ size: "sm",
98
+ variant: i,
99
+ children: [
100
+ l && /* @__PURE__ */ u(C, { children: [
101
+ /* @__PURE__ */ y(z, { className: "mr-2 size-4 animate-spin font-bold" }),
102
+ " Saving"
103
+ ] }),
104
+ !l && /* @__PURE__ */ u(C, { children: [
105
+ /* @__PURE__ */ y(U, { className: "mr-2 size-4 font-bold" }),
106
+ "Save to Library"
107
+ ] })
108
+ ]
109
+ }
110
+ );
111
+ }
112
+ function G({
113
+ className: d
114
+ }) {
115
+ const i = I(), [o, l] = V(!1), a = k(), n = t((r) => r.frame), c = D((r) => r.selectedSheetId), { updateFrame: m, setIsVisualEditing: e } = F(), { getUpdatedFrame: s } = N(), f = E();
116
+ return /* @__PURE__ */ y(
117
+ S,
118
+ {
119
+ onClick: async () => {
120
+ if (!c) {
121
+ h.error("No sheet selected");
122
+ return;
123
+ }
124
+ const r = (n == null ? void 0 : n.visualId) || (a == null ? void 0 : a.id);
125
+ if (!r) {
126
+ h.error("No visual to update");
127
+ return;
128
+ }
129
+ l(!0);
130
+ try {
131
+ const p = s();
132
+ await f.mutateAsync({
133
+ visualId: r,
134
+ data: {
135
+ frameObject: p
136
+ }
137
+ });
138
+ const A = {
139
+ ...p,
140
+ visualId: r
141
+ // Keep the link to library visual
142
+ };
143
+ m(c, A), i.invalidateQueries({ queryKey: ["visuals"] }), i.invalidateQueries({ queryKey: ["visual", r] }), h.success("Saved to library and applied locally"), setTimeout(() => {
144
+ e(!1);
145
+ }, 300);
146
+ } catch (p) {
147
+ console.error("Failed to save and apply:", p), h.error("Failed to save and apply changes");
148
+ } finally {
149
+ l(!1);
150
+ }
151
+ },
152
+ className: g("h-8", d),
153
+ size: "sm",
154
+ variant: "default",
155
+ disabled: o,
156
+ children: o ? /* @__PURE__ */ u(C, { children: [
157
+ /* @__PURE__ */ y(z, { className: "mr-2 size-4 animate-spin font-bold" }),
158
+ " Saving..."
159
+ ] }) : /* @__PURE__ */ u(C, { children: [
160
+ /* @__PURE__ */ y(U, { className: "mr-2 size-4 font-bold" }),
161
+ "Save & Apply"
162
+ ] })
163
+ }
164
+ );
165
+ }
166
+ function H({ className: d }) {
167
+ const { getUpdatedFrame: i } = N();
168
+ t((e) => e.frame);
169
+ const o = D((e) => e.selectedSheetId), { updateFrame: l, setIsVisualEditing: a } = F(), [n, c] = V(!1);
170
+ return /* @__PURE__ */ u(
171
+ S,
172
+ {
173
+ onClick: () => {
174
+ if (!o) {
175
+ h.error("No sheet selected");
176
+ return;
177
+ }
178
+ c(!0);
179
+ const s = {
180
+ ...i(),
181
+ visualId: void 0
182
+ // Remove the link to library visual
183
+ };
184
+ l(o, s), setTimeout(() => {
185
+ c(!1), h.success("Changes applied. Visual is now local to this dashboard"), a(!1);
186
+ }, 300);
187
+ },
188
+ className: g("h-8", d),
189
+ size: "sm",
190
+ variant: "outline",
191
+ children: [
192
+ n && /* @__PURE__ */ u(C, { children: [
193
+ /* @__PURE__ */ y(z, { className: "mr-2 size-4 animate-spin font-bold" }),
194
+ " Applying"
195
+ ] }),
196
+ !n && /* @__PURE__ */ u(C, { children: [
197
+ /* @__PURE__ */ y(Q, { className: "mr-2 size-4 font-bold" }),
198
+ "Apply Locally"
199
+ ] })
200
+ ]
201
+ }
202
+ );
203
+ }
204
+ function R({ className: d }) {
205
+ const { setTempQueryData: i, setSqlGen: o } = b(), l = I(), a = t((s) => s.tempQueryData), n = t((s) => s.onClose), c = t((s) => s.card), { queryKey: m } = B(c);
206
+ function e() {
207
+ if (a) {
208
+ const { queryKey: s, queryData: f } = a;
209
+ s && f && l.setQueryData(s, f);
210
+ }
211
+ o({}), n == null || n();
212
+ }
213
+ return /* @__PURE__ */ u(
214
+ S,
215
+ {
216
+ onClick: e,
217
+ className: g("h-8", d),
218
+ size: "sm",
219
+ variant: "outline",
220
+ children: [
221
+ /* @__PURE__ */ y(L, { className: "mr-2 size-4" }),
222
+ "Close"
223
+ ]
224
+ }
225
+ );
226
+ }
227
+ function X() {
228
+ const { setTempQueryData: d } = b(), i = I();
229
+ t((v) => v.isDevMode);
230
+ const o = t((v) => v.tempQueryData), l = t((v) => v.card), { queryKey: a } = B(l), {
231
+ setCardSql: n,
232
+ setSqlGen: c,
233
+ setCardPython: m,
234
+ setCardCustomCfg: e,
235
+ setCardPreferences: s,
236
+ updateDataSource: f,
237
+ clearQueryConfig: q,
238
+ setCardConfig: r,
239
+ setCardType: p
240
+ } = b();
241
+ function A() {
242
+ const v = i.getQueryData(a);
243
+ o != null && o.queryData || d({
244
+ queryKey: a,
245
+ queryData: v
246
+ }), i.setQueryData(a, null), i.removeQueries({ queryKey: a, exact: !0 }), n(""), c({}), q(), r(void 0), m(""), e(""), s({}), p("bar");
247
+ }
248
+ return /* @__PURE__ */ u(
249
+ S,
250
+ {
251
+ onClick: A,
252
+ className: "h-8",
253
+ size: "sm",
254
+ variant: "secondary",
255
+ children: [
256
+ /* @__PURE__ */ y(L, { className: "mr-2 size-3.5" }),
257
+ "Clear"
258
+ ]
259
+ }
260
+ );
261
+ }
262
+ export {
263
+ O as E,
264
+ U as S,
265
+ H as V,
266
+ w as a,
267
+ G as b,
268
+ R as c,
269
+ X as d
270
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";const s=require("react/jsx-runtime"),e=require("./index-CReqnEJI.js"),v=require("./use-visual-utils-BDuNB0Iz.js"),C=require("react");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const E=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function g({className:d,variant:l="outline"}){var m;const{setCardSql:i}=e.useEditorActions();e.useEditorStore(t=>t.frame);const u=e.useEditorStore(t=>t.card);v.useRemoteChartStore(((m=u.customCardPreferences)==null?void 0:m.url)||""),e.useEditorStore(t=>t.selectedSchemaName),e.useEditorStore(t=>t.selectedDatamodelId),e.useEditorStore(t=>t.selectedDatabaseName),e.useEditorStore(t=>t.selectedTableName),e.useEditorStore(t=>t.selectedConnectionId),e.useEditorStore(t=>t.isShowingVisual),u.sql;const a=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:o}=v.useVisualUtils();function c(){const t=o();a==null||a(t)}return s.jsxs(e.Button,{onClick:c,className:e.cn("h-8",d),size:"sm",variant:l,children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function b({className:d,variant:l="default"}){const i=e.useQueryClient(),[u,a]=C.useState(!1),o=e.useDashboardStore(n=>n.actions.setIsDashboardPanelOpen),{setIsVisualEditing:c}=e.useDashboardActions(),{getUpdatedFrame:m}=v.useVisualUtils(),t=e.useSelectedVisual(),r=e.useEditorStore(n=>n.frame),y=e.useUpdateVisualMutation(),h=()=>{const n=m(),p=(r==null?void 0:r.visualId)||(t==null?void 0:t.id);if(!p){e.ue.error("No visual to save");return}a(!0),y.mutate({visualId:p,data:{frameObject:n}},{onSuccess:()=>{a(!1),o(!0),e.ue.success("Visual updated successfully"),i.invalidateQueries({queryKey:["resource-by-id","visual",p],exact:!0})},onError:()=>{a(!1),e.ue.error("Failed to update visual")}})};return s.jsxs(e.Button,{onClick:h,className:e.cn("h-8",d),size:"sm",variant:l,children:[u&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!u&&s.jsxs(s.Fragment,{children:[s.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function x({className:d}){const l=e.useQueryClient(),[i,u]=C.useState(!1),a=e.useSelectedVisual(),o=e.useEditorStore(n=>n.frame),c=e.useDashboardStore(n=>n.selectedSheetId),{updateFrame:m,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:r}=v.useVisualUtils(),y=e.useUpdateVisualMutation(),h=async()=>{if(!c){e.ue.error("No sheet selected");return}const n=(o==null?void 0:o.visualId)||(a==null?void 0:a.id);if(!n){e.ue.error("No visual to update");return}u(!0);try{const p=r();await y.mutateAsync({visualId:n,data:{frameObject:p}});const f={...p,visualId:n};m(c,f),l.invalidateQueries({queryKey:["visuals"]}),l.invalidateQueries({queryKey:["visual",n]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(p){console.error("Failed to save and apply:",p),e.ue.error("Failed to save and apply changes")}finally{u(!1)}};return s.jsx(e.Button,{onClick:h,className:e.cn("h-8",d),size:"sm",variant:"default",disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):s.jsxs(s.Fragment,{children:[s.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function A({className:d}){const{getUpdatedFrame:l}=v.useVisualUtils();e.useEditorStore(t=>t.frame);const i=e.useDashboardStore(t=>t.selectedSheetId),{updateFrame:u,setIsVisualEditing:a}=e.useDashboardActions(),[o,c]=C.useState(!1),m=()=>{if(!i){e.ue.error("No sheet selected");return}c(!0);const r={...l(),visualId:void 0};u(i,r),setTimeout(()=>{c(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),a(!1)},300)};return s.jsxs(e.Button,{onClick:m,className:e.cn("h-8",d),size:"sm",variant:"outline",children:[o&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Applying"]}),!o&&s.jsxs(s.Fragment,{children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Apply Locally"]})]})}function j({className:d}){const{setTempQueryData:l,setSqlGen:i}=e.useEditorActions(),u=e.useQueryClient(),a=e.useEditorStore(r=>r.tempQueryData),o=e.useEditorStore(r=>r.onClose),c=e.useEditorStore(r=>r.card),{queryKey:m}=e.useDashboardCardQuery(c);function t(){if(a){const{queryKey:r,queryData:y}=a;r&&y&&u.setQueryData(r,y)}i({}),o==null||o()}return s.jsxs(e.Button,{onClick:t,className:e.cn("h-8",d),size:"sm",variant:"outline",children:[s.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function D(){const{setTempQueryData:d}=e.useEditorActions(),l=e.useQueryClient();e.useEditorStore(S=>S.isDevMode);const i=e.useEditorStore(S=>S.tempQueryData),u=e.useEditorStore(S=>S.card),{queryKey:a}=e.useDashboardCardQuery(u),{setCardSql:o,setSqlGen:c,setCardPython:m,setCardCustomCfg:t,setCardPreferences:r,updateDataSource:y,clearQueryConfig:h,setCardConfig:n,setCardType:p}=e.useEditorActions();function f(){const S=l.getQueryData(a);i!=null&&i.queryData||d({queryKey:a,queryData:S}),l.setQueryData(a,null),l.removeQueries({queryKey:a,exact:!0}),o(""),c({}),h(),n(void 0),m(""),t(""),r({}),p("bar")}return s.jsxs(e.Button,{onClick:f,className:"h-8",size:"sm",variant:"secondary",children:[s.jsx(e.X,{className:"mr-2 size-3.5"}),"Clear"]})}exports.EditorAcceptButton=g;exports.EditorCancelButton=j;exports.EditorClearButton=D;exports.Save=E;exports.VisualApplyLocalButton=A;exports.VisualSaveAndApplyButton=x;exports.VisualSaveButton=b;