@fluxo-dev/shell 0.0.37 → 0.0.39

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.
package/index.esm.css CHANGED
@@ -184,7 +184,7 @@
184
184
  text-transform: uppercase;
185
185
  }
186
186
 
187
- .custom-node-module_root__OB7SZ {
187
+ .CustomNode-module_root__MTD8I {
188
188
  align-items: center;
189
189
  display: grid;
190
190
  grid-template-columns: auto auto 1fr auto;
@@ -194,11 +194,11 @@
194
194
  /*border-bottom: solid 1px #eee;*/
195
195
  }
196
196
 
197
- .custom-node-module_root__OB7SZ:hover {
197
+ .CustomNode-module_root__MTD8I:hover {
198
198
  background: #e9ecef54;
199
199
  }
200
200
 
201
- .custom-node-module_expandIconWrapper__fKf-r {
201
+ .CustomNode-module_expandIconWrapper__XgO8w {
202
202
  align-items: center;
203
203
  font-size: 0;
204
204
  cursor: pointer;
@@ -211,11 +211,11 @@
211
211
  margin-left: 8px;
212
212
  }
213
213
 
214
- .custom-node-module_expandIconWrapper__fKf-r.custom-node-module_isOpen__vePGR {
214
+ .CustomNode-module_expandIconWrapper__XgO8w.CustomNode-module_isOpen__jPvPC {
215
215
  transform: rotate(90deg);
216
216
  }
217
217
 
218
- .custom-node-module_labelGridItem__7eEnD {
218
+ .CustomNode-module_labelGridItem__k-wO- {
219
219
  padding-inline-start: 8px;
220
220
  }
221
221
 
package/index.esm.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useState, Suspense, forwardRef, createElement as createElement$2, useEffect, useCallback, useMemo, createContext, useRef, useLayoutEffect, useReducer, useContext, useImperativeHandle, Fragment as Fragment$1, cloneElement, memo, isValidElement, lazy } from 'react';
3
+ import React__default, { useState, Suspense, useCallback, forwardRef, createElement as createElement$2, useEffect, useMemo, createContext, useRef, useLayoutEffect, useReducer, useContext, useImperativeHandle, Fragment as Fragment$1, cloneElement, memo, isValidElement, lazy } from 'react';
4
4
  import { useSelector, Provider } from 'react-redux';
5
5
  import { useLocation, Navigate, Outlet, useNavigate, Link, useOutlet, Route, useSearchParams, createBrowserRouter, RouterProvider } from 'react-router-dom';
6
- import { DataCard, useFlxNavigate, NoData, ConfirmModal, CronGenerator, ShellPage, ErrorPage as ErrorPage$1, WaitData, FlxRoutes } from '@fluxo-dev/ui-components';
6
+ import { useFlxNavigate, DataCard, NoData, ConfirmModal, CronGenerator, ShellPage, ErrorPage as ErrorPage$1, WaitData, FlxRoutes } from '@fluxo-dev/ui-components';
7
7
  import { ModuleLoader } from '@fluxo-dev/shell-mfe';
8
8
  import { Text, TextInput, ActionIcon, useMantineTheme, AppShell, Stack, Group, Burger, Badge, Drawer, NavLink, Popover, Avatar, Center, Divider, Button, Tabs, Anchor, Tooltip, Space, useMantineColorScheme, UnstyledButton, Box, ThemeIcon, Collapse, ScrollArea, rem, Loader, Grid, PasswordInput, ColorSwatch, FileButton, NumberInput, Alert, ColorInput, Checkbox, Modal, Switch, Select, Chip, LoadingOverlay, Image as Image$1, Menu as Menu$1, Table, MultiSelect, Portal, useDirection, Paper, px as px$1, parseThemeColor, rgba as rgba$1, FocusTrap, Breadcrumbs, TagsInput, Card, MantineProvider } from '@mantine/core';
9
+ import { MinimalStateViewer, RavifyProvider, JobsViewer } from '@fluxo-dev/shell-ravify';
10
+ import { useAppSelector, store as store$4 } from '@fluxo-dev/state';
11
+ import { useHotkeys, useOs, useIdle, useWindowEvent, useResizeObserver, useMediaQuery, useTimeout } from '@mantine/hooks';
9
12
  import { openSpotlight, Spotlight } from '@mantine/spotlight';
10
- import { useOs, useHotkeys, useIdle, useWindowEvent, useResizeObserver, useMediaQuery, useTimeout } from '@mantine/hooks';
11
13
  import { AppType, AppState, FluxoStateDispatcher, FluxoClientSys, UserService, AppMenuContextType, ApiKeyService, DomainRoleService, EmailServerProviderType, RavifyInstanceProtocol, RavifyInstanceVersion } from '@fluxo-dev/api-client-base';
12
14
  import { showNotification, Notifications } from '@mantine/notifications';
13
- import { useAppSelector, store as store$4 } from '@fluxo-dev/state';
14
- import { MinimalStateViewer, RavifyProvider, JobsViewer } from '@fluxo-dev/shell-ravify';
15
15
  import { unstable_batchedUpdates, flushSync as flushSync$1, createPortal } from 'react-dom';
16
16
  import { useForm } from '@mantine/form';
17
17
  import { RestApiDocumentation } from '@fluxo-dev/shell-korebi';
@@ -3358,6 +3358,231 @@ function BlankLayout() {
3358
3358
  return jsx(Outlet, {});
3359
3359
  }
3360
3360
 
3361
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
3362
+ // require the crypto API and do not support built-in fallback to lower quality random number
3363
+ // generators (like Math.random()).
3364
+ let getRandomValues;
3365
+ const rnds8 = new Uint8Array(16);
3366
+ function rng() {
3367
+ // lazy load so that environments that need to polyfill have a chance to do so
3368
+ if (!getRandomValues) {
3369
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
3370
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
3371
+
3372
+ if (!getRandomValues) {
3373
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
3374
+ }
3375
+ }
3376
+
3377
+ return getRandomValues(rnds8);
3378
+ }
3379
+
3380
+ /**
3381
+ * Convert array of 16 byte values to UUID string format of the form:
3382
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
3383
+ */
3384
+
3385
+ const byteToHex = [];
3386
+
3387
+ for (let i = 0; i < 256; ++i) {
3388
+ byteToHex.push((i + 0x100).toString(16).slice(1));
3389
+ }
3390
+
3391
+ function unsafeStringify(arr, offset = 0) {
3392
+ // Note: Be careful editing this code! It's been tuned for performance
3393
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
3394
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
3395
+ }
3396
+
3397
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
3398
+ var native = {
3399
+ randomUUID
3400
+ };
3401
+
3402
+ function v4(options, buf, offset) {
3403
+ if (native.randomUUID && !buf && !options) {
3404
+ return native.randomUUID();
3405
+ }
3406
+
3407
+ options = options || {};
3408
+ const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
3409
+
3410
+ rnds[6] = rnds[6] & 0x0f | 0x40;
3411
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
3412
+
3413
+ return unsafeStringify(rnds);
3414
+ }
3415
+
3416
+ class ShellSessionCollection {
3417
+ constructor(sessions = [], currentSessionId) {
3418
+ this._sessions = sessions;
3419
+ this._currentSessionId = currentSessionId;
3420
+ }
3421
+ get currentSession() {
3422
+ return this._currentSessionId ? this.getSession(this._currentSessionId) : null;
3423
+ }
3424
+ addSession(title, element, url) {
3425
+ const session = new ShellSession(title, element, url);
3426
+ this._sessions.push(session);
3427
+ return session;
3428
+ }
3429
+ removeSession(id) {
3430
+ this._sessions = this._sessions.filter(s => s.id !== id);
3431
+ }
3432
+ getSession(id) {
3433
+ return this._sessions.find(s => s.id === id);
3434
+ }
3435
+ get sessions() {
3436
+ return this._sessions;
3437
+ }
3438
+ getCurrentSessionId() {
3439
+ return this._currentSessionId;
3440
+ }
3441
+ getCurrentSession() {
3442
+ return this.getSession(this._currentSessionId);
3443
+ }
3444
+ setCurrentSession(id) {
3445
+ this._currentSessionId = id;
3446
+ }
3447
+ updateSession(id, title, element, url) {
3448
+ const session = this.getSession(id);
3449
+ if (session) {
3450
+ session.updateSession(title, element, url);
3451
+ }
3452
+ }
3453
+ getPreviuosSessionId() {
3454
+ const index = this._sessions.findIndex(s => s.id === this._currentSessionId);
3455
+ if (index > 0) {
3456
+ return this._sessions[index - 1].id;
3457
+ }
3458
+ return this._sessions[this._sessions.length - 1].id;
3459
+ }
3460
+ getNextSessionId() {
3461
+ const index = this._sessions.findIndex(s => s.id === this._currentSessionId);
3462
+ if (index < this._sessions.length - 1) {
3463
+ return this._sessions[index + 1].id;
3464
+ }
3465
+ return this._sessions[0].id;
3466
+ }
3467
+ }
3468
+ class ShellSession {
3469
+ constructor(title, element, url) {
3470
+ this._id = v4();
3471
+ this._title = title;
3472
+ this._element = element;
3473
+ this._url = url;
3474
+ }
3475
+ get id() {
3476
+ return this._id;
3477
+ }
3478
+ get title() {
3479
+ return this._title;
3480
+ }
3481
+ get element() {
3482
+ return this._element;
3483
+ }
3484
+ get url() {
3485
+ return this._url;
3486
+ }
3487
+ updateSession(title, element, url) {
3488
+ this._title = title;
3489
+ this._element = element;
3490
+ this._url = url;
3491
+ }
3492
+ }
3493
+
3494
+ const defaultState = {
3495
+ addSession: () => '',
3496
+ removeSession: () => {},
3497
+ getSession: () => {},
3498
+ sessions: () => [],
3499
+ updateSession: () => {},
3500
+ getCurrentSessionId: () => null,
3501
+ getCurrentSession: () => null,
3502
+ setCurrentSession: () => {},
3503
+ isCurrentSessionDisableable: () => false
3504
+ };
3505
+ const ShellSessionContext = /*#__PURE__*/React__default.createContext(defaultState);
3506
+ function ShellSessionProvider(props) {
3507
+ useHotkeys([['shift+s', () => {
3508
+ addSession(`Dashboard`, null, '/');
3509
+ }]]);
3510
+ useHotkeys([['shift+x', () => {
3511
+ removeSession(getCurrentSessionId());
3512
+ }]], [], true);
3513
+ useHotkeys([['shift+ArrowLeft', () => {
3514
+ setCurrentSession(sessionCollection.getPreviuosSessionId());
3515
+ }]], [], true);
3516
+ useHotkeys([['shift+ArrowRight', () => {
3517
+ setCurrentSession(sessionCollection.getNextSessionId());
3518
+ }]], [], true);
3519
+ const [sessionCollection, setSessionCollection] = React__default.useState(new ShellSessionCollection([], null));
3520
+ const navigate = useFlxNavigate();
3521
+ const addSession = useCallback((title, element, url) => {
3522
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
3523
+ const s = cloned.addSession(title, element, url);
3524
+ cloned.setCurrentSession(s.id);
3525
+ setSessionCollection(cloned);
3526
+ navigate(s.url, {
3527
+ state: {
3528
+ title: title
3529
+ }
3530
+ });
3531
+ return s.id;
3532
+ }, [sessionCollection]);
3533
+ const removeSession = useCallback(id => {
3534
+ if (!isCurrentSessionDisableable()) return;
3535
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
3536
+ cloned.removeSession(id);
3537
+ cloned.setCurrentSession(cloned.sessions[cloned.sessions.length - 1].id);
3538
+ setSessionCollection(cloned);
3539
+ }, [sessionCollection]);
3540
+ const getSession = useCallback(id => {
3541
+ return sessionCollection.getSession(id);
3542
+ }, [sessionCollection]);
3543
+ const sessions = useCallback(() => {
3544
+ return sessionCollection.sessions;
3545
+ }, [sessionCollection]);
3546
+ const updateSession = useCallback((id, title, element, url) => {
3547
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
3548
+ cloned.updateSession(id, title, element, url);
3549
+ setSessionCollection(cloned);
3550
+ }, [sessionCollection]);
3551
+ const setCurrentSession = useCallback(id => {
3552
+ const cloned = new ShellSessionCollection(sessionCollection.sessions, id);
3553
+ cloned.setCurrentSession(id);
3554
+ setSessionCollection(cloned);
3555
+ navigate(cloned.getCurrentSession().url, {
3556
+ state: {
3557
+ title: cloned.getCurrentSession().title
3558
+ }
3559
+ });
3560
+ }, [sessionCollection]);
3561
+ const getCurrentSessionId = useCallback(() => {
3562
+ return sessionCollection.getCurrentSessionId();
3563
+ }, [sessionCollection]);
3564
+ const getCurrentSession = useCallback(() => {
3565
+ return sessionCollection.getCurrentSession();
3566
+ }, [sessionCollection]);
3567
+ const isCurrentSessionDisableable = useCallback(() => {
3568
+ return sessionCollection.sessions.length > 1;
3569
+ }, [sessionCollection]);
3570
+ return jsx(ShellSessionContext.Provider, {
3571
+ value: {
3572
+ sessions: sessions,
3573
+ addSession: addSession,
3574
+ removeSession: removeSession,
3575
+ getSession: getSession,
3576
+ updateSession: updateSession,
3577
+ getCurrentSessionId: getCurrentSessionId,
3578
+ getCurrentSession: getCurrentSession,
3579
+ setCurrentSession: setCurrentSession,
3580
+ isCurrentSessionDisableable: isCurrentSessionDisableable
3581
+ },
3582
+ children: props.children
3583
+ });
3584
+ }
3585
+
3361
3586
  var propTypes = {exports: {}};
3362
3587
 
3363
3588
  var reactIs = {exports: {}};
@@ -5821,9 +6046,9 @@ function AppBar(props) {
5821
6046
  const location = useLocation();
5822
6047
  const [developmentMode, setDevelopmentMode] = React__default.useState(undefined);
5823
6048
  const [lastLocation, setLastLocation] = React__default.useState(undefined);
5824
- useHotkeys([['mod + o', () => {
6049
+ useHotkeys(props.shellUi.navigation === ShellUINavigation.Sidebar ? [['mod + o', () => {
5825
6050
  if (navbarOpened) FluxoStateDispatcher.dispatchCloseNavbar();else FluxoStateDispatcher.dispatchOpenNavbar();
5826
- }]]);
6051
+ }]] : []);
5827
6052
  useEffect(() => {
5828
6053
  if (!jitAppsLoaded) return;
5829
6054
  const splittedLocation = location.pathname.split('/');
@@ -6030,231 +6255,6 @@ function AppBar(props) {
6030
6255
  });
6031
6256
  }
6032
6257
 
6033
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
6034
- // require the crypto API and do not support built-in fallback to lower quality random number
6035
- // generators (like Math.random()).
6036
- let getRandomValues;
6037
- const rnds8 = new Uint8Array(16);
6038
- function rng() {
6039
- // lazy load so that environments that need to polyfill have a chance to do so
6040
- if (!getRandomValues) {
6041
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
6042
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
6043
-
6044
- if (!getRandomValues) {
6045
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
6046
- }
6047
- }
6048
-
6049
- return getRandomValues(rnds8);
6050
- }
6051
-
6052
- /**
6053
- * Convert array of 16 byte values to UUID string format of the form:
6054
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
6055
- */
6056
-
6057
- const byteToHex = [];
6058
-
6059
- for (let i = 0; i < 256; ++i) {
6060
- byteToHex.push((i + 0x100).toString(16).slice(1));
6061
- }
6062
-
6063
- function unsafeStringify(arr, offset = 0) {
6064
- // Note: Be careful editing this code! It's been tuned for performance
6065
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
6066
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
6067
- }
6068
-
6069
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
6070
- var native = {
6071
- randomUUID
6072
- };
6073
-
6074
- function v4(options, buf, offset) {
6075
- if (native.randomUUID && !buf && !options) {
6076
- return native.randomUUID();
6077
- }
6078
-
6079
- options = options || {};
6080
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
6081
-
6082
- rnds[6] = rnds[6] & 0x0f | 0x40;
6083
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
6084
-
6085
- return unsafeStringify(rnds);
6086
- }
6087
-
6088
- class ShellSessionCollection {
6089
- constructor(sessions = [], currentSessionId) {
6090
- this._sessions = sessions;
6091
- this._currentSessionId = currentSessionId;
6092
- }
6093
- get currentSession() {
6094
- return this._currentSessionId ? this.getSession(this._currentSessionId) : null;
6095
- }
6096
- addSession(title, element, url) {
6097
- const session = new ShellSession(title, element, url);
6098
- this._sessions.push(session);
6099
- return session;
6100
- }
6101
- removeSession(id) {
6102
- this._sessions = this._sessions.filter(s => s.id !== id);
6103
- }
6104
- getSession(id) {
6105
- return this._sessions.find(s => s.id === id);
6106
- }
6107
- get sessions() {
6108
- return this._sessions;
6109
- }
6110
- getCurrentSessionId() {
6111
- return this._currentSessionId;
6112
- }
6113
- getCurrentSession() {
6114
- return this.getSession(this._currentSessionId);
6115
- }
6116
- setCurrentSession(id) {
6117
- this._currentSessionId = id;
6118
- }
6119
- updateSession(id, title, element, url) {
6120
- const session = this.getSession(id);
6121
- if (session) {
6122
- session.updateSession(title, element, url);
6123
- }
6124
- }
6125
- getPreviuosSessionId() {
6126
- const index = this._sessions.findIndex(s => s.id === this._currentSessionId);
6127
- if (index > 0) {
6128
- return this._sessions[index - 1].id;
6129
- }
6130
- return this._sessions[this._sessions.length - 1].id;
6131
- }
6132
- getNextSessionId() {
6133
- const index = this._sessions.findIndex(s => s.id === this._currentSessionId);
6134
- if (index < this._sessions.length - 1) {
6135
- return this._sessions[index + 1].id;
6136
- }
6137
- return this._sessions[0].id;
6138
- }
6139
- }
6140
- class ShellSession {
6141
- constructor(title, element, url) {
6142
- this._id = v4();
6143
- this._title = title;
6144
- this._element = element;
6145
- this._url = url;
6146
- }
6147
- get id() {
6148
- return this._id;
6149
- }
6150
- get title() {
6151
- return this._title;
6152
- }
6153
- get element() {
6154
- return this._element;
6155
- }
6156
- get url() {
6157
- return this._url;
6158
- }
6159
- updateSession(title, element, url) {
6160
- this._title = title;
6161
- this._element = element;
6162
- this._url = url;
6163
- }
6164
- }
6165
-
6166
- const defaultState = {
6167
- addSession: () => '',
6168
- removeSession: () => {},
6169
- getSession: () => {},
6170
- sessions: () => [],
6171
- updateSession: () => {},
6172
- getCurrentSessionId: () => null,
6173
- getCurrentSession: () => null,
6174
- setCurrentSession: () => {},
6175
- isCurrentSessionDisableable: () => false
6176
- };
6177
- const ShellSessionContext = /*#__PURE__*/React__default.createContext(defaultState);
6178
- function ShellSessionProvider(props) {
6179
- useHotkeys([['shift+s', () => {
6180
- addSession(`Dashboard`, null, '/');
6181
- }]]);
6182
- useHotkeys([['shift+x', () => {
6183
- removeSession(getCurrentSessionId());
6184
- }]], [], true);
6185
- useHotkeys([['shift+ArrowLeft', () => {
6186
- setCurrentSession(sessionCollection.getPreviuosSessionId());
6187
- }]], [], true);
6188
- useHotkeys([['shift+ArrowRight', () => {
6189
- setCurrentSession(sessionCollection.getNextSessionId());
6190
- }]], [], true);
6191
- const [sessionCollection, setSessionCollection] = React__default.useState(new ShellSessionCollection([], null));
6192
- const navigate = useFlxNavigate();
6193
- const addSession = useCallback((title, element, url) => {
6194
- const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
6195
- const s = cloned.addSession(title, element, url);
6196
- cloned.setCurrentSession(s.id);
6197
- setSessionCollection(cloned);
6198
- navigate(s.url, {
6199
- state: {
6200
- title: title
6201
- }
6202
- });
6203
- return s.id;
6204
- }, [sessionCollection]);
6205
- const removeSession = useCallback(id => {
6206
- if (!isCurrentSessionDisableable()) return;
6207
- const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
6208
- cloned.removeSession(id);
6209
- cloned.setCurrentSession(cloned.sessions[cloned.sessions.length - 1].id);
6210
- setSessionCollection(cloned);
6211
- }, [sessionCollection]);
6212
- const getSession = useCallback(id => {
6213
- return sessionCollection.getSession(id);
6214
- }, [sessionCollection]);
6215
- const sessions = useCallback(() => {
6216
- return sessionCollection.sessions;
6217
- }, [sessionCollection]);
6218
- const updateSession = useCallback((id, title, element, url) => {
6219
- const cloned = new ShellSessionCollection(sessionCollection.sessions, sessionCollection.getCurrentSessionId());
6220
- cloned.updateSession(id, title, element, url);
6221
- setSessionCollection(cloned);
6222
- }, [sessionCollection]);
6223
- const setCurrentSession = useCallback(id => {
6224
- const cloned = new ShellSessionCollection(sessionCollection.sessions, id);
6225
- cloned.setCurrentSession(id);
6226
- setSessionCollection(cloned);
6227
- navigate(cloned.getCurrentSession().url, {
6228
- state: {
6229
- title: cloned.getCurrentSession().title
6230
- }
6231
- });
6232
- }, [sessionCollection]);
6233
- const getCurrentSessionId = useCallback(() => {
6234
- return sessionCollection.getCurrentSessionId();
6235
- }, [sessionCollection]);
6236
- const getCurrentSession = useCallback(() => {
6237
- return sessionCollection.getCurrentSession();
6238
- }, [sessionCollection]);
6239
- const isCurrentSessionDisableable = useCallback(() => {
6240
- return sessionCollection.sessions.length > 1;
6241
- }, [sessionCollection]);
6242
- return jsx(ShellSessionContext.Provider, {
6243
- value: {
6244
- sessions: sessions,
6245
- addSession: addSession,
6246
- removeSession: removeSession,
6247
- getSession: getSession,
6248
- updateSession: updateSession,
6249
- getCurrentSessionId: getCurrentSessionId,
6250
- getCurrentSession: getCurrentSession,
6251
- setCurrentSession: setCurrentSession,
6252
- isCurrentSessionDisableable: isCurrentSessionDisableable
6253
- },
6254
- children: props.children
6255
- });
6256
- }
6257
-
6258
6258
  function AppContent(props) {
6259
6259
  const sessionContext = React__default.useContext(ShellSessionContext);
6260
6260
  useEffect(() => {
@@ -6439,8 +6439,6 @@ function FooterBar(props) {
6439
6439
  });
6440
6440
  }
6441
6441
 
6442
- var style = {"control":"navbar-item-module_control__0EMhh","controlSub":"navbar-item-module_controlSub__U-eSe","link":"navbar-item-module_link__sVkBe","chevron":"navbar-item-module_chevron__-1UpS"};
6443
-
6444
6442
  function NavBarItem({
6445
6443
  icon: Icon,
6446
6444
  label,
@@ -6476,7 +6474,7 @@ function NavBarItem({
6476
6474
  }
6477
6475
  if (link.featureIdentifier === 'webclient.routing.externallink') {
6478
6476
  return jsx(Link, {
6479
- className: style['link'],
6477
+ className: undefined,
6480
6478
  style: {
6481
6479
  color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
6482
6480
  borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
@@ -6487,7 +6485,7 @@ function NavBarItem({
6487
6485
  }, link.label + '_' + i);
6488
6486
  } else {
6489
6487
  return jsx(Link, {
6490
- className: style['link'],
6488
+ className: undefined,
6491
6489
  style: {
6492
6490
  color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
6493
6491
  borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
@@ -6510,7 +6508,7 @@ function NavBarItem({
6510
6508
  }
6511
6509
  });
6512
6510
  },
6513
- className: level === 0 ? style['control'] : style['controlSub'],
6511
+ className: level === 0 ? undefined : undefined,
6514
6512
  children: jsxs(Group, {
6515
6513
  justify: 'space-between',
6516
6514
  gap: 0,
@@ -6531,7 +6529,7 @@ function NavBarItem({
6531
6529
  children: label
6532
6530
  })]
6533
6531
  }), hasLinks && jsx(ChevronIcon, {
6534
- className: style['chevron'],
6532
+ className: undefined,
6535
6533
  size: 14,
6536
6534
  stroke: 1.5,
6537
6535
  style: {
@@ -8394,61 +8392,102 @@ function ShellSpotlight() {
8394
8392
  });
8395
8393
  }
8396
8394
 
8397
- function AppLayout(props) {
8398
- const {
8399
- navbarOpened
8400
- } = useSelector(state => state.layout);
8401
- const fluxoClientConfig = useSelector(state => state.client.fluxoClientConfig);
8402
- return jsxs(ShellSessionProvider, {
8403
- children: [jsx(RavifyProvider, {
8395
+ // Context per evitare props drilling
8396
+ const ShellUIContext = /*#__PURE__*/createContext(null);
8397
+ const WithShellSessionProvider = ({
8398
+ children,
8399
+ withMultipleSessions
8400
+ }) => {
8401
+ if (withMultipleSessions) {
8402
+ return jsx(ShellSessionProvider, {
8403
+ children: children
8404
+ });
8405
+ }
8406
+ return jsx(Fragment, {
8407
+ children: children
8408
+ });
8409
+ };
8410
+ const WithRavifyProvider = ({
8411
+ children,
8412
+ hasAdminAccess,
8413
+ fluxoClientConfig
8414
+ }) => {
8415
+ if (hasAdminAccess) {
8416
+ return jsx(RavifyProvider, {
8404
8417
  fluxoClientConfig: fluxoClientConfig,
8405
- children: jsxs(AppShell, {
8406
- padding: 0,
8407
- styles: {
8408
- main: {
8409
- backgroundColor: '#fafbff'
8410
- }
8411
- },
8412
- navbar: {
8413
- width: 248,
8414
- breakpoint: 'sm',
8415
- collapsed: {
8416
- mobile: !navbarOpened,
8417
- desktop: !navbarOpened
8418
- }
8419
- },
8420
- header: {
8421
- height: 48
8422
- },
8423
- footer: {
8424
- height: 40
8425
- },
8426
- transitionDuration: 0,
8427
- layout: 'default',
8428
- children: [jsx(AppBar, {
8429
- shellUi: props.ui,
8430
- brandName: props.brandName
8431
- }), jsx(Navbar, {
8432
- shellUi: props.ui
8433
- }), jsx(AppShell.Main, {
8434
- style: {
8435
- paddingTop: props.ui.navigation === ShellUINavigation.Topbar ? 88 : undefined
8418
+ children: children
8419
+ });
8420
+ }
8421
+ return jsx(Fragment, {
8422
+ children: children
8423
+ });
8424
+ };
8425
+ function AppLayout({
8426
+ appVersion,
8427
+ brandName,
8428
+ withMultipleSessions,
8429
+ ui
8430
+ }) {
8431
+ const {
8432
+ navbarOpened,
8433
+ hasAdminAccess
8434
+ } = useAppSelector(state => state.layout);
8435
+ const fluxoClientConfig = useAppSelector(state => state.client.fluxoClientConfig);
8436
+ return jsx(ShellUIContext.Provider, {
8437
+ value: ui,
8438
+ children: jsxs(WithShellSessionProvider, {
8439
+ withMultipleSessions: withMultipleSessions,
8440
+ children: [jsx(WithRavifyProvider, {
8441
+ hasAdminAccess: hasAdminAccess,
8442
+ fluxoClientConfig: fluxoClientConfig,
8443
+ children: jsxs(AppShell, {
8444
+ padding: 0,
8445
+ styles: {
8446
+ main: {
8447
+ backgroundColor: '#fafbff'
8448
+ }
8449
+ },
8450
+ navbar: {
8451
+ width: 248,
8452
+ breakpoint: 'sm',
8453
+ collapsed: {
8454
+ mobile: !navbarOpened,
8455
+ desktop: !navbarOpened
8456
+ }
8436
8457
  },
8437
- children: jsx(Suspense, {
8438
- fallback: jsx(Loader, {}),
8439
- children: jsx(AppContent, {
8440
- shellUi: props.ui,
8441
- withMultipleSessions: props.withMultipleSessions
8458
+ header: {
8459
+ height: 48
8460
+ },
8461
+ footer: {
8462
+ height: 40
8463
+ },
8464
+ transitionDuration: 0,
8465
+ layout: "default",
8466
+ children: [jsx(AppBar, {
8467
+ shellUi: ui,
8468
+ brandName: brandName
8469
+ }), jsx(Navbar, {
8470
+ shellUi: ui
8471
+ }), jsx(AppShell.Main, {
8472
+ style: {
8473
+ paddingTop: ui.navigation === ShellUINavigation.Topbar ? 88 : undefined
8474
+ },
8475
+ children: jsx(Suspense, {
8476
+ fallback: jsx(Loader, {}),
8477
+ children: jsx(AppContent, {
8478
+ shellUi: ui,
8479
+ withMultipleSessions: withMultipleSessions
8480
+ })
8442
8481
  })
8443
- })
8444
- }), jsx(AppShell.Footer, {
8445
- children: jsx(FooterBar, {
8446
- brandName: props.brandName,
8447
- appVersion: props.appVersion
8448
- })
8449
- })]
8450
- })
8451
- }), jsx(ShellSpotlight, {})]
8482
+ }), jsx(AppShell.Footer, {
8483
+ children: jsx(FooterBar, {
8484
+ brandName: brandName,
8485
+ appVersion: appVersion
8486
+ })
8487
+ })]
8488
+ })
8489
+ }), jsx(ShellSpotlight, {})]
8490
+ })
8452
8491
  });
8453
8492
  }
8454
8493
 
@@ -23939,8 +23978,6 @@ function TreeInner(props, ref) {
23939
23978
  }
23940
23979
  var Tree = forwardRef(TreeInner);
23941
23980
 
23942
- var styles$2 = {"root":"custom-node-module_root__OB7SZ","expandIconWrapper":"custom-node-module_expandIconWrapper__fKf-r","isOpen":"custom-node-module_isOpen__vePGR","labelGridItem":"custom-node-module_labelGridItem__7eEnD"};
23943
-
23944
23981
  var $$6 = _export;
23945
23982
  var $includes = arrayIncludes.includes;
23946
23983
  var fails$6 = fails$q;
@@ -24313,7 +24350,7 @@ const CustomNode = props => {
24313
24350
  };
24314
24351
  return jsxs("div", {
24315
24352
  id: props.node.id.toString(),
24316
- className: `tree-node ${styles$2["root"]}`,
24353
+ className: `tree-node ${undefined}`,
24317
24354
  style: {
24318
24355
  marginLeft: indent,
24319
24356
  marginBottom: 16,
@@ -24321,14 +24358,14 @@ const CustomNode = props => {
24321
24358
  border: '1px solid #e9ecef'
24322
24359
  },
24323
24360
  children: [jsx("div", {
24324
- className: styles$2["expandIconWrapper"],
24361
+ className: undefined,
24325
24362
  children: jsx(ThemeIcon, {
24326
24363
  variant: "light",
24327
24364
  size: 30,
24328
24365
  children: IconFactory.getIcon(props.node.data.icon)
24329
24366
  })
24330
24367
  }), jsx("div", {
24331
- className: styles$2["labelGridItem"],
24368
+ className: undefined,
24332
24369
  onClick: handleToggle,
24333
24370
  children: jsx(Text, {
24334
24371
  variant: "text",
@@ -24340,7 +24377,7 @@ const CustomNode = props => {
24340
24377
  style: {
24341
24378
  width: isLeaf() ? 24 : 8
24342
24379
  },
24343
- className: `${styles$2["expandIconWrapper"]} ${props.isOpen ? styles$2["isOpen"] : ""}`,
24380
+ className: `${undefined} ${props.isOpen ? undefined : ""}`,
24344
24381
  children: isLeaf() && jsx("div", {
24345
24382
  onClick: handleToggle,
24346
24383
  children: jsx(IconChevronRight, {
@@ -24444,19 +24481,22 @@ const CustomNode = props => {
24444
24481
  });
24445
24482
  };
24446
24483
 
24447
- var styles$1 = {"root":"placeholder-module_root__3fAsg"};
24448
-
24449
24484
  const Placeholder = props => {
24450
24485
  const left = props.depth * 24;
24451
24486
  return jsx("div", {
24452
- className: styles$1["root"],
24487
+ className: undefined,
24453
24488
  style: {
24454
24489
  left
24455
24490
  }
24456
24491
  });
24457
24492
  };
24458
24493
 
24459
- var styles = {"app":"menu-designer-module_app__LilwQ","treeRoot":"menu-designer-module_treeRoot__QFCU1","draggingSource":"menu-designer-module_draggingSource__Kmtr5","placeholderContainer":"menu-designer-module_placeholderContainer__Y4M-R","dropTarget":"menu-designer-module_dropTarget__9otBw"};
24494
+ var menuDesigner_module = {"app":"menu-designer-module_app__LilwQ","treeRoot":"menu-designer-module_treeRoot__QFCU1","draggingSource":"menu-designer-module_draggingSource__Kmtr5","placeholderContainer":"menu-designer-module_placeholderContainer__Y4M-R","dropTarget":"menu-designer-module_dropTarget__9otBw"};
24495
+
24496
+ var styles = /*#__PURE__*/Object.freeze({
24497
+ __proto__: null,
24498
+ default: menuDesigner_module
24499
+ });
24460
24500
 
24461
24501
  var fails$5 = fails$q;
24462
24502
  var global$4 = global$p;
@@ -24923,6 +24963,7 @@ function MenuDesigner(props) {
24923
24963
  //setTreeData(result);
24924
24964
  }, [appMenu]);
24925
24965
  useEffect(() => {
24966
+ console.log(styles);
24926
24967
  loadAppMenuList();
24927
24968
  }, []);
24928
24969
  const loadAppMenuList = () => {
@@ -25092,9 +25133,6 @@ function MenuDesigner(props) {
25092
25133
  const isModuleAttachedToFrontend = (module, frontend) => {
25093
25134
  // workaround momentaneo. Bisogna capire come eventualmente
25094
25135
  // abbinare le app dinamiche ai frontend. Per ora, tutte quelle che non sono fluxo, vengono abbinate
25095
- if (module.key !== 'fluxo') return true;
25096
- const shellFrontend = props.frontends.find(a => a.id === (currentWebMenu === null || currentWebMenu === void 0 ? void 0 : currentWebMenu.frontend));
25097
- if ((shellFrontend === null || shellFrontend === void 0 ? void 0 : shellFrontend.modules.filter(a => a.scope === module.key).length) === 0) return false;
25098
25136
  return true;
25099
25137
  };
25100
25138
  const deleteWebMenu = webMenuId => {
@@ -25278,9 +25316,9 @@ function MenuDesigner(props) {
25278
25316
  return ((_a = dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.data) === null || _a === void 0 ? void 0 : _a.isGroup) || dropTarget === undefined;
25279
25317
  },
25280
25318
  classes: {
25281
- root: styles["treeRoot"],
25282
- draggingSource: styles["draggingSource"],
25283
- placeholder: styles["placeholderContainer"]
25319
+ root: undefined,
25320
+ draggingSource: undefined,
25321
+ placeholder: undefined
25284
25322
  },
25285
25323
  placeholderRender: (node, {
25286
25324
  depth
@@ -36125,6 +36163,7 @@ var ShellUINavigation;
36125
36163
  (function (ShellUINavigation) {
36126
36164
  ShellUINavigation[ShellUINavigation["Sidebar"] = 1] = "Sidebar";
36127
36165
  ShellUINavigation[ShellUINavigation["Topbar"] = 2] = "Topbar";
36166
+ ShellUINavigation[ShellUINavigation["None"] = 3] = "None";
36128
36167
  })(ShellUINavigation || (ShellUINavigation = {}));
36129
36168
  function FluxoShell(props) {
36130
36169
  const [initialOperationsFinished, setInitialOperationsFinished] = useState(false);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@fluxo-dev/shell",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "peerDependencies": {
5
- "@fluxo-dev/shell-hub": "0.0.37",
6
- "@fluxo-dev/shell-korebi": "0.0.37",
7
- "@fluxo-dev/shell-mfe": "0.0.37",
8
- "@fluxo-dev/shell-printing": "0.0.37",
9
- "@fluxo-dev/shell-reporting": "0.0.37",
10
- "@fluxo-dev/shell-workflow": "0.0.37",
11
- "@fluxo-dev/state": "0.0.37",
12
- "@fluxo-dev/ui-components": "0.0.37",
13
- "@fluxo-dev/shell-ravify": "0.0.37"
5
+ "@fluxo-dev/shell-hub": "0.0.39",
6
+ "@fluxo-dev/shell-korebi": "0.0.39",
7
+ "@fluxo-dev/shell-mfe": "0.0.39",
8
+ "@fluxo-dev/shell-printing": "0.0.39",
9
+ "@fluxo-dev/shell-reporting": "0.0.39",
10
+ "@fluxo-dev/shell-workflow": "0.0.39",
11
+ "@fluxo-dev/state": "0.0.39",
12
+ "@fluxo-dev/ui-components": "0.0.39",
13
+ "@fluxo-dev/shell-ravify": "0.0.39"
14
14
  },
15
15
  "module": "./index.esm.js",
16
16
  "type": "module",
package/src/lib/app.d.ts CHANGED
@@ -12,7 +12,8 @@ export type ShellFrontend = {
12
12
  };
13
13
  export declare enum ShellUINavigation {
14
14
  Sidebar = 1,
15
- Topbar = 2
15
+ Topbar = 2,
16
+ None = 3
16
17
  }
17
18
  export interface ShellUI {
18
19
  navigation: ShellUINavigation;
@@ -1,10 +1,11 @@
1
1
  import { ShellUI } from "../../app";
2
2
  import './horizontal-menu.css';
3
- export interface AppLayoutProps {
3
+ interface AppLayoutProps {
4
4
  appVersion: string;
5
5
  brandName: string;
6
6
  withMultipleSessions: boolean;
7
7
  ui: ShellUI;
8
8
  }
9
- declare function AppLayout(props: AppLayoutProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare const useShellUI: () => ShellUI;
10
+ declare function AppLayout({ appVersion, brandName, withMultipleSessions, ui }: AppLayoutProps): import("react/jsx-runtime").JSX.Element;
10
11
  export default AppLayout;