@fluxo-dev/shell 0.0.38 → 0.0.40

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(() => {
@@ -6476,7 +6476,7 @@ function NavBarItem({
6476
6476
  }
6477
6477
  if (link.featureIdentifier === 'webclient.routing.externallink') {
6478
6478
  return jsx(Link, {
6479
- className: style['link'],
6479
+ className: style["link"],
6480
6480
  style: {
6481
6481
  color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
6482
6482
  borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
@@ -6487,7 +6487,7 @@ function NavBarItem({
6487
6487
  }, link.label + '_' + i);
6488
6488
  } else {
6489
6489
  return jsx(Link, {
6490
- className: style['link'],
6490
+ className: style["link"],
6491
6491
  style: {
6492
6492
  color: colorScheme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7],
6493
6493
  borderLeft: `1px solid ${colorScheme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`
@@ -6510,7 +6510,7 @@ function NavBarItem({
6510
6510
  }
6511
6511
  });
6512
6512
  },
6513
- className: level === 0 ? style['control'] : style['controlSub'],
6513
+ className: level === 0 ? style["control"] : style["controlSub"],
6514
6514
  children: jsxs(Group, {
6515
6515
  justify: 'space-between',
6516
6516
  gap: 0,
@@ -6531,7 +6531,7 @@ function NavBarItem({
6531
6531
  children: label
6532
6532
  })]
6533
6533
  }), hasLinks && jsx(ChevronIcon, {
6534
- className: style['chevron'],
6534
+ className: style["chevron"],
6535
6535
  size: 14,
6536
6536
  stroke: 1.5,
6537
6537
  style: {
@@ -8394,61 +8394,102 @@ function ShellSpotlight() {
8394
8394
  });
8395
8395
  }
8396
8396
 
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, {
8397
+ // Context per evitare props drilling
8398
+ const ShellUIContext = /*#__PURE__*/createContext(null);
8399
+ const WithShellSessionProvider = ({
8400
+ children,
8401
+ withMultipleSessions
8402
+ }) => {
8403
+ if (withMultipleSessions) {
8404
+ return jsx(ShellSessionProvider, {
8405
+ children: children
8406
+ });
8407
+ }
8408
+ return jsx(Fragment, {
8409
+ children: children
8410
+ });
8411
+ };
8412
+ const WithRavifyProvider = ({
8413
+ children,
8414
+ hasAdminAccess,
8415
+ fluxoClientConfig
8416
+ }) => {
8417
+ if (hasAdminAccess) {
8418
+ return jsx(RavifyProvider, {
8404
8419
  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
8420
+ children: children
8421
+ });
8422
+ }
8423
+ return jsx(Fragment, {
8424
+ children: children
8425
+ });
8426
+ };
8427
+ function AppLayout({
8428
+ appVersion,
8429
+ brandName,
8430
+ withMultipleSessions,
8431
+ ui
8432
+ }) {
8433
+ const {
8434
+ navbarOpened,
8435
+ hasAdminAccess
8436
+ } = useAppSelector(state => state.layout);
8437
+ const fluxoClientConfig = useAppSelector(state => state.client.fluxoClientConfig);
8438
+ return jsx(ShellUIContext.Provider, {
8439
+ value: ui,
8440
+ children: jsxs(WithShellSessionProvider, {
8441
+ withMultipleSessions: withMultipleSessions,
8442
+ children: [jsx(WithRavifyProvider, {
8443
+ hasAdminAccess: hasAdminAccess,
8444
+ fluxoClientConfig: fluxoClientConfig,
8445
+ children: jsxs(AppShell, {
8446
+ padding: 0,
8447
+ styles: {
8448
+ main: {
8449
+ backgroundColor: '#fafbff'
8450
+ }
8436
8451
  },
8437
- children: jsx(Suspense, {
8438
- fallback: jsx(Loader, {}),
8439
- children: jsx(AppContent, {
8440
- shellUi: props.ui,
8441
- withMultipleSessions: props.withMultipleSessions
8452
+ navbar: {
8453
+ width: 248,
8454
+ breakpoint: 'sm',
8455
+ collapsed: {
8456
+ mobile: !navbarOpened,
8457
+ desktop: !navbarOpened
8458
+ }
8459
+ },
8460
+ header: {
8461
+ height: 48
8462
+ },
8463
+ footer: {
8464
+ height: 40
8465
+ },
8466
+ transitionDuration: 0,
8467
+ layout: "default",
8468
+ children: [jsx(AppBar, {
8469
+ shellUi: ui,
8470
+ brandName: brandName
8471
+ }), jsx(Navbar, {
8472
+ shellUi: ui
8473
+ }), jsx(AppShell.Main, {
8474
+ style: {
8475
+ paddingTop: ui.navigation === ShellUINavigation.Topbar ? 88 : undefined
8476
+ },
8477
+ children: jsx(Suspense, {
8478
+ fallback: jsx(Loader, {}),
8479
+ children: jsx(AppContent, {
8480
+ shellUi: ui,
8481
+ withMultipleSessions: withMultipleSessions
8482
+ })
8442
8483
  })
8443
- })
8444
- }), jsx(AppShell.Footer, {
8445
- children: jsx(FooterBar, {
8446
- brandName: props.brandName,
8447
- appVersion: props.appVersion
8448
- })
8449
- })]
8450
- })
8451
- }), jsx(ShellSpotlight, {})]
8484
+ }), jsx(AppShell.Footer, {
8485
+ children: jsx(FooterBar, {
8486
+ brandName: brandName,
8487
+ appVersion: appVersion
8488
+ })
8489
+ })]
8490
+ })
8491
+ }), jsx(ShellSpotlight, {})]
8492
+ })
8452
8493
  });
8453
8494
  }
8454
8495
 
@@ -23939,7 +23980,7 @@ function TreeInner(props, ref) {
23939
23980
  }
23940
23981
  var Tree = forwardRef(TreeInner);
23941
23982
 
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"};
23983
+ var styles$2 = {"root":"CustomNode-module_root__MTD8I","expandIconWrapper":"CustomNode-module_expandIconWrapper__XgO8w","isOpen":"CustomNode-module_isOpen__jPvPC","labelGridItem":"CustomNode-module_labelGridItem__k-wO-"};
23943
23984
 
23944
23985
  var $$6 = _export;
23945
23986
  var $includes = arrayIncludes.includes;
@@ -24923,6 +24964,7 @@ function MenuDesigner(props) {
24923
24964
  //setTreeData(result);
24924
24965
  }, [appMenu]);
24925
24966
  useEffect(() => {
24967
+ console.log(styles);
24926
24968
  loadAppMenuList();
24927
24969
  }, []);
24928
24970
  const loadAppMenuList = () => {
@@ -25092,9 +25134,6 @@ function MenuDesigner(props) {
25092
25134
  const isModuleAttachedToFrontend = (module, frontend) => {
25093
25135
  // workaround momentaneo. Bisogna capire come eventualmente
25094
25136
  // 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
25137
  return true;
25099
25138
  };
25100
25139
  const deleteWebMenu = webMenuId => {
@@ -36125,6 +36164,7 @@ var ShellUINavigation;
36125
36164
  (function (ShellUINavigation) {
36126
36165
  ShellUINavigation[ShellUINavigation["Sidebar"] = 1] = "Sidebar";
36127
36166
  ShellUINavigation[ShellUINavigation["Topbar"] = 2] = "Topbar";
36167
+ ShellUINavigation[ShellUINavigation["None"] = 3] = "None";
36128
36168
  })(ShellUINavigation || (ShellUINavigation = {}));
36129
36169
  function FluxoShell(props) {
36130
36170
  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.38",
3
+ "version": "0.0.40",
4
4
  "peerDependencies": {
5
- "@fluxo-dev/shell-hub": "0.0.38",
6
- "@fluxo-dev/shell-korebi": "0.0.38",
7
- "@fluxo-dev/shell-mfe": "0.0.38",
8
- "@fluxo-dev/shell-printing": "0.0.38",
9
- "@fluxo-dev/shell-reporting": "0.0.38",
10
- "@fluxo-dev/shell-workflow": "0.0.38",
11
- "@fluxo-dev/state": "0.0.38",
12
- "@fluxo-dev/ui-components": "0.0.38",
13
- "@fluxo-dev/shell-ravify": "0.0.38"
5
+ "@fluxo-dev/shell-hub": "0.0.40",
6
+ "@fluxo-dev/shell-korebi": "0.0.40",
7
+ "@fluxo-dev/shell-mfe": "0.0.40",
8
+ "@fluxo-dev/shell-printing": "0.0.40",
9
+ "@fluxo-dev/shell-reporting": "0.0.40",
10
+ "@fluxo-dev/shell-workflow": "0.0.40",
11
+ "@fluxo-dev/state": "0.0.40",
12
+ "@fluxo-dev/ui-components": "0.0.40",
13
+ "@fluxo-dev/shell-ravify": "0.0.40"
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;