react-semaphor 0.1.208 → 0.1.209

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 (36) hide show
  1. package/dist/chunks/{dashboard-controls-yOzrvYwI.js → dashboard-controls-BNTI4r0_.js} +30 -30
  2. package/dist/chunks/{dashboard-controls-K5zNLdtH.js → dashboard-controls-Dcpx9_an.js} +1 -1
  3. package/dist/chunks/{dashboard-json-DqChvVCF.js → dashboard-json-BjOqpGbW.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BuLoVNV4.js → dashboard-json-kIoBtmBF.js} +1 -1
  5. package/dist/chunks/{dashboard-summary-settings-dialog-tJueBNph.js → dashboard-summary-settings-dialog-BoX18wiA.js} +1 -1
  6. package/dist/chunks/{dashboard-summary-settings-dialog-DmccX33N.js → dashboard-summary-settings-dialog-CO1SwHHD.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-CKNlwaCO.js → edit-dashboard-visual-B9HuGExj.js} +1 -1
  8. package/dist/chunks/{edit-dashboard-visual-CV4JsCTg.js → edit-dashboard-visual-DG4VLoJF.js} +2 -2
  9. package/dist/chunks/editor-action-buttons-CDTIx_Jc.js +11 -0
  10. package/dist/chunks/editor-action-buttons-CszdZ4Fw.js +345 -0
  11. package/dist/chunks/{index-CBcPi9pm.js → index-D0TdW88i.js} +24289 -23875
  12. package/dist/chunks/index-DSA80lEg.js +1104 -0
  13. package/dist/chunks/{notification-bell-DyzIftQU.js → notification-bell-D2V1-ARa.js} +1 -1
  14. package/dist/chunks/{notification-bell-B-OVf20Q.js → notification-bell-DFiRaeJQ.js} +52 -52
  15. package/dist/chunks/resource-management-panel-BhiWNPcw.js +6 -0
  16. package/dist/chunks/resource-management-panel-DS_WEv1x.js +902 -0
  17. package/dist/chunks/{use-role-aware-display-preferences-B4QJkliF.js → use-role-aware-display-preferences-D8j5_cnK.js} +1 -1
  18. package/dist/chunks/{use-role-aware-display-preferences-DTSpe_ZT.js → use-role-aware-display-preferences-DfihB5pN.js} +1 -1
  19. package/dist/chunks/{use-visual-utils-CCT3ABI5.js → use-visual-utils-BfLXO_vi.js} +34 -34
  20. package/dist/chunks/{use-visual-utils-ChR-Jti8.js → use-visual-utils-CzcVz3zB.js} +1 -1
  21. package/dist/dashboard/index.cjs +1 -1
  22. package/dist/dashboard/index.js +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +5 -5
  25. package/dist/surfboard/index.cjs +1 -1
  26. package/dist/surfboard/index.js +2 -2
  27. package/dist/types/dashboard.d.ts +12 -1
  28. package/dist/types/main.d.ts +13 -1
  29. package/dist/types/surfboard.d.ts +12 -1
  30. package/dist/types/types.d.ts +12 -1
  31. package/package.json +1 -1
  32. package/dist/chunks/editor-action-buttons-CAjqJiT_.js +0 -340
  33. package/dist/chunks/editor-action-buttons-DQVh7L5i.js +0 -11
  34. package/dist/chunks/index-DQOwJyRp.js +0 -1104
  35. package/dist/chunks/resource-management-panel-D_mSi7Cm.js +0 -914
  36. package/dist/chunks/resource-management-panel-NqaNfAq3.js +0 -6
@@ -0,0 +1,345 @@
1
+ import { bP as O, bA as n, bQ as j, bR as ae, bS as te, bT as se, bU as re, bV as ne, by as A, B as N, E as X, c as g, u as T, bs as k, H as E, bJ as F, bK as w, bW as H, bX as G, X as R, I as C } from "./index-D0TdW88i.js";
2
+ import { jsxs as f, jsx as h, Fragment as I } from "react/jsx-runtime";
3
+ import { u as oe, a as V } from "./use-visual-utils-BfLXO_vi.js";
4
+ import { useMemo as S, useState as P } 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 me = O("CircleX", [
12
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
13
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
14
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
15
+ ]);
16
+ /**
17
+ * @license lucide-react v0.453.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */
22
+ const J = O("Save", [
23
+ [
24
+ "path",
25
+ {
26
+ 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",
27
+ key: "1c8476"
28
+ }
29
+ ],
30
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
31
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
32
+ ]);
33
+ function W() {
34
+ var e, p;
35
+ const s = n((m) => m.card), o = n((m) => m.frame), a = S(
36
+ () => j(o, s),
37
+ [o, s]
38
+ ), { manifest: r } = ae(
39
+ ((e = a == null ? void 0 : a.customCardPreferences) == null ? void 0 : e.url) || ""
40
+ ), t = S(
41
+ () => {
42
+ var m;
43
+ return (m = r == null ? void 0 : r.visuals) == null ? void 0 : m.find(
44
+ (d) => {
45
+ var i;
46
+ return d.name === ((i = a == null ? void 0 : a.customCardPreferences) == null ? void 0 : i.componentName);
47
+ }
48
+ );
49
+ },
50
+ [r, (p = a == null ? void 0 : a.customCardPreferences) == null ? void 0 : p.componentName]
51
+ ), c = te(a, t), l = S(
52
+ () => se({
53
+ frame: o,
54
+ configCard: a,
55
+ isMultiInputVisual: c === "multiple"
56
+ }),
57
+ [o, a, c]
58
+ ), u = S(() => {
59
+ const m = l.findIndex(
60
+ (d) => (d == null ? void 0 : d.id) === s.id
61
+ );
62
+ return m < 0 ? -1 : re(s, m);
63
+ }, [l, s]);
64
+ return S(() => !a || c !== "multiple" || u < 0 ? s.type : ne(
65
+ s,
66
+ u,
67
+ t == null ? void 0 : t.slots
68
+ ) ?? s.type, [a, c, u, s, t == null ? void 0 : t.slots]);
69
+ }
70
+ function ce(s, o) {
71
+ return {
72
+ ...s,
73
+ sql: "",
74
+ python: "",
75
+ config: void 0,
76
+ customCfg: "",
77
+ preferences: {},
78
+ interactionConfig: void 0,
79
+ linkedInteractionTargetOverrides: void 0,
80
+ customCardPreferences: o ? s.customCardPreferences : void 0,
81
+ type: o ? s.type : "bar"
82
+ };
83
+ }
84
+ function pe({
85
+ className: s,
86
+ variant: o = "outline"
87
+ }) {
88
+ var u;
89
+ const { setCardSql: a } = A();
90
+ n((e) => e.frame);
91
+ const r = n((e) => e.card);
92
+ oe(
93
+ ((u = r.customCardPreferences) == null ? void 0 : u.url) || ""
94
+ ), n(
95
+ (e) => e.selectedSchemaName
96
+ ), n(
97
+ (e) => e.selectedDatamodelId
98
+ ), n(
99
+ (e) => e.selectedDatabaseName
100
+ ), n((e) => e.selectedTableName), n(
101
+ (e) => e.selectedConnectionId
102
+ ), n((e) => e.isShowingVisual), r.sql;
103
+ const t = n((e) => e.onSave), { getUpdatedFrame: c } = V();
104
+ function l() {
105
+ const e = c();
106
+ t == null || t(e);
107
+ }
108
+ return /* @__PURE__ */ f(
109
+ N,
110
+ {
111
+ onClick: l,
112
+ className: g("h-8", s),
113
+ size: "sm",
114
+ variant: o,
115
+ children: [
116
+ /* @__PURE__ */ h(X, { className: "mr-2 size-4 font-bold" }),
117
+ "Accept"
118
+ ]
119
+ }
120
+ );
121
+ }
122
+ function ye({
123
+ className: s,
124
+ variant: o = "default"
125
+ }) {
126
+ const a = F(), [r, t] = P(!1), c = T(
127
+ (i) => i.actions.setIsDashboardPanelOpen
128
+ ), { setIsVisualEditing: l } = k(), { getUpdatedFrame: u } = V(), e = w(), p = n((i) => i.frame), m = H();
129
+ return /* @__PURE__ */ f(
130
+ N,
131
+ {
132
+ onClick: () => {
133
+ const i = u(), v = (p == null ? void 0 : p.visualId) || (e == null ? void 0 : e.id);
134
+ if (!v) {
135
+ C.error("No visual to save");
136
+ return;
137
+ }
138
+ t(!0), m.mutate(
139
+ {
140
+ visualId: v,
141
+ data: {
142
+ frameObject: i
143
+ }
144
+ },
145
+ {
146
+ onSuccess: () => {
147
+ t(!1), c(!0), C.success("Visual updated successfully"), a.invalidateQueries({
148
+ queryKey: ["resource-by-id", "visual", v],
149
+ exact: !0
150
+ });
151
+ },
152
+ onError: () => {
153
+ t(!1), C.error("Failed to update visual");
154
+ }
155
+ }
156
+ );
157
+ },
158
+ className: g("h-8", s),
159
+ size: "sm",
160
+ variant: o,
161
+ children: [
162
+ r && /* @__PURE__ */ f(I, { children: [
163
+ /* @__PURE__ */ h(E, { className: "mr-2 size-4 animate-spin font-bold" }),
164
+ " Saving"
165
+ ] }),
166
+ !r && /* @__PURE__ */ f(I, { children: [
167
+ /* @__PURE__ */ h(J, { className: "mr-2 size-4 font-bold" }),
168
+ "Save to Library"
169
+ ] })
170
+ ]
171
+ }
172
+ );
173
+ }
174
+ function fe({
175
+ className: s
176
+ }) {
177
+ const o = F(), [a, r] = P(!1), t = w(), c = n((i) => i.frame), l = T((i) => i.selectedSheetId), { updateFrame: u, setIsVisualEditing: e } = k(), { getUpdatedFrame: p } = V(), m = H();
178
+ return /* @__PURE__ */ h(
179
+ N,
180
+ {
181
+ onClick: async () => {
182
+ if (!l) {
183
+ C.error("No sheet selected");
184
+ return;
185
+ }
186
+ const i = (c == null ? void 0 : c.visualId) || (t == null ? void 0 : t.id);
187
+ if (!i) {
188
+ C.error("No visual to update");
189
+ return;
190
+ }
191
+ r(!0);
192
+ try {
193
+ const v = p();
194
+ await m.mutateAsync({
195
+ visualId: i,
196
+ data: {
197
+ frameObject: v
198
+ }
199
+ });
200
+ const D = {
201
+ ...v,
202
+ visualId: i
203
+ // Keep the link to library visual
204
+ };
205
+ u(l, D), o.invalidateQueries({ queryKey: ["visuals"] }), o.invalidateQueries({ queryKey: ["visual", i] }), C.success("Saved to library and applied locally"), setTimeout(() => {
206
+ e(!1);
207
+ }, 300);
208
+ } catch (v) {
209
+ console.error("Failed to save and apply:", v), C.error("Failed to save and apply changes");
210
+ } finally {
211
+ r(!1);
212
+ }
213
+ },
214
+ className: g("h-8", s),
215
+ size: "sm",
216
+ variant: "default",
217
+ disabled: a,
218
+ children: a ? /* @__PURE__ */ f(I, { children: [
219
+ /* @__PURE__ */ h(E, { className: "mr-2 size-4 animate-spin font-bold" }),
220
+ " Saving..."
221
+ ] }) : /* @__PURE__ */ f(I, { children: [
222
+ /* @__PURE__ */ h(J, { className: "mr-2 size-4 font-bold" }),
223
+ "Save & Apply"
224
+ ] })
225
+ }
226
+ );
227
+ }
228
+ function ve({ className: s }) {
229
+ const { getUpdatedFrame: o } = V();
230
+ n((e) => e.frame);
231
+ const a = T((e) => e.selectedSheetId), { updateFrame: r, setIsVisualEditing: t } = k(), [c, l] = P(!1);
232
+ return /* @__PURE__ */ f(
233
+ N,
234
+ {
235
+ onClick: () => {
236
+ if (!a) {
237
+ C.error("No sheet selected");
238
+ return;
239
+ }
240
+ l(!0);
241
+ const p = {
242
+ ...o(),
243
+ visualId: void 0
244
+ // Remove the link to library visual
245
+ };
246
+ r(a, p), setTimeout(() => {
247
+ l(!1), C.success("Changes applied. Visual is now local to this dashboard"), t(!1);
248
+ }, 300);
249
+ },
250
+ className: g("h-8", s),
251
+ size: "sm",
252
+ variant: "outline",
253
+ children: [
254
+ c && /* @__PURE__ */ f(I, { children: [
255
+ /* @__PURE__ */ h(E, { className: "mr-2 size-4 animate-spin font-bold" }),
256
+ " Applying"
257
+ ] }),
258
+ !c && /* @__PURE__ */ f(I, { children: [
259
+ /* @__PURE__ */ h(X, { className: "mr-2 size-4 font-bold" }),
260
+ "Apply Locally"
261
+ ] })
262
+ ]
263
+ }
264
+ );
265
+ }
266
+ function he({ className: s }) {
267
+ const { setTempQueryData: o, setSqlGen: a } = A(), r = F(), t = n((d) => d.tempQueryData), c = n((d) => d.onClose), l = n((d) => d.card), u = W(), e = S(() => u !== l.type ? { ...l, type: u } : l, [l, u]), { queryKey: p } = G(e);
268
+ function m() {
269
+ if (t) {
270
+ const { queryKey: d, queryData: i } = t;
271
+ d && i && r.setQueryData(d, i);
272
+ }
273
+ a({}), c == null || c();
274
+ }
275
+ return /* @__PURE__ */ f(
276
+ N,
277
+ {
278
+ onClick: m,
279
+ className: g("h-8", s),
280
+ size: "sm",
281
+ variant: "outline",
282
+ children: [
283
+ /* @__PURE__ */ h(R, { className: "mr-2 size-4" }),
284
+ "Close"
285
+ ]
286
+ }
287
+ );
288
+ }
289
+ function Ce() {
290
+ const { setTempQueryData: s } = A(), o = F();
291
+ n((b) => b.isDevMode);
292
+ const a = n((b) => b.tempQueryData), r = n((b) => b.card), t = W(), c = S(() => t !== r.type ? { ...r, type: t } : r, [r, t]), { queryKey: l } = G(c), {
293
+ setCardSql: u,
294
+ setSqlGen: e,
295
+ setCardPython: p,
296
+ setCardCustomCfg: m,
297
+ setCardPreferences: d,
298
+ updateDataSource: i,
299
+ clearQueryConfig: v,
300
+ setCardConfig: D,
301
+ setCardType: Y,
302
+ setFrame: Z,
303
+ setCard: _,
304
+ setActiveTabCardId: $
305
+ } = A();
306
+ function ee() {
307
+ var M, U, B, K;
308
+ const b = o.getQueryData(l);
309
+ a != null && a.queryData || s({
310
+ queryKey: l,
311
+ queryData: b
312
+ }), o.setQueryData(l, null), o.removeQueries({ queryKey: l, exact: !0 }), u(""), e({}), v(), D(void 0), p(""), m(""), d({});
313
+ const z = n.getState().frame, Q = n.getState().card, y = j(z, Q), x = ((M = y == null ? void 0 : y.customCardPreferences) == null ? void 0 : M.visualType) === "multiple" || !!((U = y == null ? void 0 : y.customCardPreferences) != null && U.dataInputCardIds) || (((B = y == null ? void 0 : y.customCardPreferences) == null ? void 0 : B.minInputs) || 0) > 1 || (((K = y == null ? void 0 : y.customCardPreferences) == null ? void 0 : K.maxInputs) || 0) > 1, q = ce(Q, x);
314
+ Z({
315
+ ...z,
316
+ cards: z.cards.map(
317
+ (L) => L.id === q.id ? q : L
318
+ )
319
+ }), $(q.id), _(q), x || Y("bar");
320
+ }
321
+ return /* @__PURE__ */ f(
322
+ N,
323
+ {
324
+ onClick: ee,
325
+ className: "h-8",
326
+ size: "sm",
327
+ variant: "secondary",
328
+ children: [
329
+ /* @__PURE__ */ h(R, { className: "mr-2 size-3.5" }),
330
+ "Clear"
331
+ ]
332
+ }
333
+ );
334
+ }
335
+ export {
336
+ me as C,
337
+ pe as E,
338
+ J as S,
339
+ ve as V,
340
+ ye as a,
341
+ fe as b,
342
+ he as c,
343
+ Ce as d,
344
+ W as u
345
+ };