remoraid 1.1.0 → 2.0.0
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/LICENSE +1 -1
- package/README.md +12 -0
- package/dist/core/index.cjs +1206 -0
- package/dist/core/index.d.ts +264 -0
- package/dist/core/index.js +1237 -0
- package/dist/{styles.css → core/styles.css} +5 -0
- package/dist/jsonforms/index.cjs +721 -0
- package/dist/jsonforms/index.d.ts +28 -0
- package/dist/jsonforms/index.js +724 -0
- package/dist/{ssc.cjs → server/index.cjs} +11 -7
- package/dist/server/index.d.ts +11 -0
- package/dist/{ssc.js → server/index.js} +7 -3
- package/package.json +24 -14
- package/dist/index.cjs +0 -412
- package/dist/index.d.ts +0 -51
- package/dist/index.js +0 -395
- package/dist/ssc.d.ts +0 -10
@@ -0,0 +1,1206 @@
|
|
1
|
+
"use client";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
4
|
+
var __defProp = Object.defineProperty;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
13
|
+
__defProp(to, key, {
|
14
|
+
get: () => mod[key],
|
15
|
+
enumerable: true
|
16
|
+
});
|
17
|
+
return to;
|
18
|
+
};
|
19
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
20
|
+
var __toCommonJS = (from) => {
|
21
|
+
var entry = __moduleCache.get(from), desc;
|
22
|
+
if (entry)
|
23
|
+
return entry;
|
24
|
+
entry = __defProp({}, "__esModule", { value: true });
|
25
|
+
if (from && typeof from === "object" || typeof from === "function")
|
26
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
27
|
+
get: () => from[key],
|
28
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
29
|
+
}));
|
30
|
+
__moduleCache.set(from, entry);
|
31
|
+
return entry;
|
32
|
+
};
|
33
|
+
var __export = (target, all) => {
|
34
|
+
for (var name in all)
|
35
|
+
__defProp(target, name, {
|
36
|
+
get: all[name],
|
37
|
+
enumerable: true,
|
38
|
+
configurable: true,
|
39
|
+
set: (newValue) => all[name] = () => newValue
|
40
|
+
});
|
41
|
+
};
|
42
|
+
|
43
|
+
// src/core/index.ts
|
44
|
+
var exports_core = {};
|
45
|
+
__export(exports_core, {
|
46
|
+
userExperienceCookieName: () => userExperienceCookieName,
|
47
|
+
useWidgets: () => useWidgets,
|
48
|
+
useRemoraidUserExperience: () => useRemoraidUserExperience,
|
49
|
+
useRemoraidTheme: () => useRemoraidTheme,
|
50
|
+
defaultUserExperience: () => defaultUserExperience,
|
51
|
+
defaultNavbarSettings: () => defaultNavbarSettings,
|
52
|
+
createRemoraidTheme: () => createRemoraidTheme,
|
53
|
+
WidgetWrapper: () => WidgetWrapper,
|
54
|
+
WidgetSelectionHeader: () => WidgetSelectionHeader,
|
55
|
+
Widget: () => Widget,
|
56
|
+
ResponsiveButton: () => ResponsiveButton,
|
57
|
+
RemoraidProvider: () => RemoraidProvider,
|
58
|
+
Page: () => Page,
|
59
|
+
NotFoundPage: () => NotFoundPage,
|
60
|
+
EnvironmentShell: () => EnvironmentShell,
|
61
|
+
CloseButton: () => CloseButton,
|
62
|
+
BadgeMinimal: () => BadgeMinimal,
|
63
|
+
BadgeGroup: () => BadgeGroup,
|
64
|
+
AppShell: () => AppShell,
|
65
|
+
AlertMinimal: () => AlertMinimal
|
66
|
+
});
|
67
|
+
module.exports = __toCommonJS(exports_core);
|
68
|
+
|
69
|
+
// src/core/components/RemoraidProvider/UserExperienceProvider/index.tsx
|
70
|
+
var import_react3 = __toESM(require("react"));
|
71
|
+
var import_react_cookie = require("react-cookie");
|
72
|
+
|
73
|
+
// src/core/components/AppShell/NavbarMinimal/index.tsx
|
74
|
+
var import_core2 = require("@mantine/core");
|
75
|
+
var import_icons_react2 = require("@tabler/icons-react");
|
76
|
+
var import_link = __toESM(require("next/link"));
|
77
|
+
var import_navigation = require("next/navigation");
|
78
|
+
var import_react2 = require("react");
|
79
|
+
|
80
|
+
// src/core/lib/utils.ts
|
81
|
+
var co = (condition, value, fallback) => condition(value) ? value : fallback;
|
82
|
+
|
83
|
+
// src/core/components/RemoraidProvider/ThemeProvider/index.tsx
|
84
|
+
var import_core = require("@mantine/core");
|
85
|
+
var import_icons_react = require("@tabler/icons-react");
|
86
|
+
var import_react = __toESM(require("react"));
|
87
|
+
var jsx_dev_runtime = require("react/jsx-dev-runtime");
|
88
|
+
var isMantinePrimaryShade = (primaryShade) => {
|
89
|
+
if (isNaN(Number(primaryShade))) {
|
90
|
+
return true;
|
91
|
+
}
|
92
|
+
return false;
|
93
|
+
};
|
94
|
+
var createRemoraidTheme = (customTheme, mantineTheme, colorScheme) => {
|
95
|
+
const defaultMediumIconProps = { size: "1.125em" };
|
96
|
+
let transparentBackground;
|
97
|
+
let primaryColor;
|
98
|
+
let spacingPx;
|
99
|
+
if (mantineTheme && colorScheme) {
|
100
|
+
transparentBackground = colorScheme === "dark" ? import_core.rgba(mantineTheme.colors.dark[8], 0.8) : import_core.rgba(mantineTheme.white, 0.8);
|
101
|
+
primaryColor = mantineTheme.colors[mantineTheme.primaryColor][isMantinePrimaryShade(mantineTheme.primaryShade) ? mantineTheme.primaryShade[colorScheme === "auto" ? "light" : colorScheme] : mantineTheme.primaryShade];
|
102
|
+
spacingPx = {
|
103
|
+
xs: Number(co((v) => !Number.isNaN(v), Number(import_core.px(mantineTheme.spacing.xs)), 0)),
|
104
|
+
sm: Number(co((v) => !Number.isNaN(v), Number(import_core.px(mantineTheme.spacing.sm)), 0)),
|
105
|
+
md: Number(co((v) => !Number.isNaN(v), Number(import_core.px(mantineTheme.spacing.md)), 0)),
|
106
|
+
lg: Number(co((v) => !Number.isNaN(v), Number(import_core.px(mantineTheme.spacing.lg)), 0)),
|
107
|
+
xl: Number(co((v) => !Number.isNaN(v), Number(import_core.px(mantineTheme.spacing.xl)), 0))
|
108
|
+
};
|
109
|
+
}
|
110
|
+
return {
|
111
|
+
complete: true,
|
112
|
+
transitionDurations: {
|
113
|
+
short: 200,
|
114
|
+
medium: 350,
|
115
|
+
long: 500
|
116
|
+
},
|
117
|
+
breakpoints: {
|
118
|
+
buttonCollapse: "md",
|
119
|
+
badgeGroupCollapse: "md"
|
120
|
+
},
|
121
|
+
scrollAreaProps: {
|
122
|
+
scrollbarSize: 8,
|
123
|
+
scrollHideDelay: 20,
|
124
|
+
type: "hover"
|
125
|
+
},
|
126
|
+
containerSize: 1300,
|
127
|
+
alertProps: {
|
128
|
+
negative: {
|
129
|
+
icon: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(import_icons_react.IconAlertCircle, {
|
130
|
+
...defaultMediumIconProps
|
131
|
+
}, undefined, false, undefined, this),
|
132
|
+
variant: "light",
|
133
|
+
color: "red",
|
134
|
+
title: "Attention!"
|
135
|
+
},
|
136
|
+
neutral: {
|
137
|
+
icon: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(import_icons_react.IconInfoCircle, {
|
138
|
+
...defaultMediumIconProps
|
139
|
+
}, undefined, false, undefined, this),
|
140
|
+
variant: "light",
|
141
|
+
color: mantineTheme?.primaryColor,
|
142
|
+
title: "Information"
|
143
|
+
},
|
144
|
+
positive: {
|
145
|
+
icon: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(import_icons_react.IconCircleCheck, {
|
146
|
+
...defaultMediumIconProps
|
147
|
+
}, undefined, false, undefined, this),
|
148
|
+
variant: "light",
|
149
|
+
color: "green",
|
150
|
+
title: "Success"
|
151
|
+
}
|
152
|
+
},
|
153
|
+
iconProps: {
|
154
|
+
medium: defaultMediumIconProps,
|
155
|
+
tiny: { size: 14, stroke: 3 }
|
156
|
+
},
|
157
|
+
transparentBackground,
|
158
|
+
primaryColor,
|
159
|
+
spacingPx,
|
160
|
+
...customTheme
|
161
|
+
};
|
162
|
+
};
|
163
|
+
var isRemoraidTheme = (x) => {
|
164
|
+
if (!x) {
|
165
|
+
return false;
|
166
|
+
}
|
167
|
+
if (typeof x !== "object") {
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
if (!("complete" in x)) {
|
171
|
+
return false;
|
172
|
+
}
|
173
|
+
return true;
|
174
|
+
};
|
175
|
+
var themeContext = import_react.default.createContext(createRemoraidTheme());
|
176
|
+
var useRemoraidTheme = () => {
|
177
|
+
return import_react.useContext(themeContext);
|
178
|
+
};
|
179
|
+
function ThemeProvider({
|
180
|
+
children,
|
181
|
+
theme
|
182
|
+
}) {
|
183
|
+
const mantineTheme = import_core.useMantineTheme();
|
184
|
+
const { colorScheme } = import_core.useMantineColorScheme();
|
185
|
+
const remoraidTheme = import_react.useMemo(() => {
|
186
|
+
let value;
|
187
|
+
if (isRemoraidTheme(theme)) {
|
188
|
+
value = theme;
|
189
|
+
} else if (typeof theme === "function") {
|
190
|
+
value = theme(mantineTheme, colorScheme);
|
191
|
+
} else {
|
192
|
+
value = createRemoraidTheme(theme, mantineTheme, colorScheme);
|
193
|
+
}
|
194
|
+
return value;
|
195
|
+
}, [colorScheme]);
|
196
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(themeContext.Provider, {
|
197
|
+
value: remoraidTheme,
|
198
|
+
children
|
199
|
+
}, undefined, false, undefined, this);
|
200
|
+
}
|
201
|
+
|
202
|
+
// src/core/components/AppShell/NavbarMinimal/index.tsx
|
203
|
+
var jsx_dev_runtime2 = require("react/jsx-dev-runtime");
|
204
|
+
function NavbarLink({
|
205
|
+
icon: Icon2,
|
206
|
+
label,
|
207
|
+
active,
|
208
|
+
onClick,
|
209
|
+
href,
|
210
|
+
indicator,
|
211
|
+
settings
|
212
|
+
}) {
|
213
|
+
const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = import_react2.useState(false);
|
214
|
+
const iconProps = {
|
215
|
+
size: settings.iconSize,
|
216
|
+
stroke: 1.5
|
217
|
+
};
|
218
|
+
if (!href) {
|
219
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Tooltip, {
|
220
|
+
label,
|
221
|
+
position: "right",
|
222
|
+
transitionProps: { duration: 0 },
|
223
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.UnstyledButton, {
|
224
|
+
onClick,
|
225
|
+
className: "remoraid-navbar-minimal-link",
|
226
|
+
"data-active": active || undefined,
|
227
|
+
w: settings.linkSize,
|
228
|
+
h: settings.linkSize,
|
229
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Icon2, {
|
230
|
+
...iconProps
|
231
|
+
}, undefined, false, undefined, this)
|
232
|
+
}, undefined, false, undefined, this)
|
233
|
+
}, undefined, false, undefined, this);
|
234
|
+
}
|
235
|
+
const button = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.UnstyledButton, {
|
236
|
+
onClick,
|
237
|
+
className: "remoraid-navbar-minimal-link",
|
238
|
+
"data-active": active || undefined,
|
239
|
+
w: settings.linkSize,
|
240
|
+
h: settings.linkSize,
|
241
|
+
component: import_link.default,
|
242
|
+
href,
|
243
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Icon2, {
|
244
|
+
...iconProps
|
245
|
+
}, undefined, false, undefined, this)
|
246
|
+
}, undefined, false, undefined, this);
|
247
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Tooltip, {
|
248
|
+
label,
|
249
|
+
position: "right",
|
250
|
+
transitionProps: { duration: 0 },
|
251
|
+
children: indicator === undefined ? button : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Indicator, {
|
252
|
+
withBorder: true,
|
253
|
+
size: 13,
|
254
|
+
offset: 2,
|
255
|
+
onMouseEnter: () => setIsHoveringRoleIndicator(true),
|
256
|
+
onMouseLeave: () => setIsHoveringRoleIndicator(false),
|
257
|
+
...indicator(isHoveringRoleIndicator),
|
258
|
+
children: button
|
259
|
+
}, undefined, false, undefined, this)
|
260
|
+
}, undefined, false, undefined, this);
|
261
|
+
}
|
262
|
+
var defaultSettings = {
|
263
|
+
hiddenPages: [],
|
264
|
+
linkSize: import_core2.rem("50px"),
|
265
|
+
iconSize: "50%",
|
266
|
+
px: "sm",
|
267
|
+
py: "md"
|
268
|
+
};
|
269
|
+
function NavbarMinimal({
|
270
|
+
logo,
|
271
|
+
user,
|
272
|
+
links: linksProp,
|
273
|
+
settings: settingsProp,
|
274
|
+
linkIndicator,
|
275
|
+
logoIndicator,
|
276
|
+
onLogout
|
277
|
+
}) {
|
278
|
+
const { userExperience } = useRemoraidUserExperience();
|
279
|
+
const pathname = import_navigation.usePathname();
|
280
|
+
const theme = useRemoraidTheme();
|
281
|
+
const { setColorScheme, colorScheme } = import_core2.useMantineColorScheme();
|
282
|
+
const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = import_react2.useState(false);
|
283
|
+
const settings = settingsProp || userExperience.navbarSettings;
|
284
|
+
const links = linksProp.filter((link) => !settings.hiddenPages.includes(link.href)).map((link) => /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(NavbarLink, {
|
285
|
+
active: link.href === pathname,
|
286
|
+
indicator: linkIndicator,
|
287
|
+
settings,
|
288
|
+
...link
|
289
|
+
}, link.label, false, undefined, this));
|
290
|
+
const logoImage = logo({
|
291
|
+
style: {
|
292
|
+
cursor: "pointer",
|
293
|
+
width: settings.linkSize,
|
294
|
+
height: settings.linkSize
|
295
|
+
}
|
296
|
+
});
|
297
|
+
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Paper, {
|
298
|
+
h: "100%",
|
299
|
+
py: settings.py,
|
300
|
+
bg: theme.transparentBackground,
|
301
|
+
radius: 0,
|
302
|
+
shadow: "md",
|
303
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Flex, {
|
304
|
+
direction: "column",
|
305
|
+
h: "100%",
|
306
|
+
align: "center",
|
307
|
+
px: settings.px,
|
308
|
+
children: [
|
309
|
+
logoIndicator === undefined ? logoImage : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Indicator, {
|
310
|
+
withBorder: true,
|
311
|
+
offset: 2,
|
312
|
+
size: 13,
|
313
|
+
onMouseEnter: () => setIsHoveringRoleIndicator(true),
|
314
|
+
onMouseLeave: () => setIsHoveringRoleIndicator(false),
|
315
|
+
...logoIndicator(isHoveringRoleIndicator),
|
316
|
+
children: logoImage
|
317
|
+
}, undefined, false, undefined, this),
|
318
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Divider, {
|
319
|
+
my: "md",
|
320
|
+
variant: "dashed",
|
321
|
+
w: "100%"
|
322
|
+
}, undefined, false, undefined, this),
|
323
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Stack, {
|
324
|
+
justify: "flex-start",
|
325
|
+
gap: 0,
|
326
|
+
flex: 1,
|
327
|
+
children: links
|
328
|
+
}, undefined, false, undefined, this),
|
329
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(import_core2.Stack, {
|
330
|
+
justify: "center",
|
331
|
+
gap: 0,
|
332
|
+
children: [
|
333
|
+
user !== undefined && (user === null ? /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(NavbarLink, {
|
334
|
+
icon: import_icons_react2.IconLogin,
|
335
|
+
label: "Login",
|
336
|
+
href: "/login",
|
337
|
+
active: pathname === "/login",
|
338
|
+
settings
|
339
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(NavbarLink, {
|
340
|
+
icon: import_icons_react2.IconLogout,
|
341
|
+
label: "Logout",
|
342
|
+
onClick: () => {
|
343
|
+
if (onLogout) {
|
344
|
+
onLogout();
|
345
|
+
}
|
346
|
+
},
|
347
|
+
href: "/login",
|
348
|
+
settings
|
349
|
+
}, undefined, false, undefined, this)),
|
350
|
+
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(NavbarLink, {
|
351
|
+
icon: colorScheme === "dark" ? import_icons_react2.IconSun : import_icons_react2.IconMoon,
|
352
|
+
onClick: () => {
|
353
|
+
if (colorScheme === "dark") {
|
354
|
+
setColorScheme("light");
|
355
|
+
} else {
|
356
|
+
setColorScheme("dark");
|
357
|
+
}
|
358
|
+
},
|
359
|
+
label: "Toggle Color Scheme",
|
360
|
+
settings
|
361
|
+
}, undefined, false, undefined, this)
|
362
|
+
]
|
363
|
+
}, undefined, true, undefined, this)
|
364
|
+
]
|
365
|
+
}, undefined, true, undefined, this)
|
366
|
+
}, undefined, false, undefined, this);
|
367
|
+
}
|
368
|
+
|
369
|
+
// src/core/components/RemoraidProvider/UserExperienceProvider/index.tsx
|
370
|
+
var jsx_dev_runtime3 = require("react/jsx-dev-runtime");
|
371
|
+
var defaultNavbarSettings = {
|
372
|
+
minimal: defaultSettings
|
373
|
+
};
|
374
|
+
var defaultUserExperience = {
|
375
|
+
navbarVariant: "minimal",
|
376
|
+
navbarSettings: defaultNavbarSettings.minimal,
|
377
|
+
showWelcomeMessage: true
|
378
|
+
};
|
379
|
+
var userExperienceContext = import_react3.default.createContext({
|
380
|
+
userExperience: defaultUserExperience,
|
381
|
+
updateUserExperience: () => {},
|
382
|
+
processedCookie: false
|
383
|
+
});
|
384
|
+
var userExperienceCookieName = "remoraid-user-experience";
|
385
|
+
var useRemoraidUserExperience = () => {
|
386
|
+
return import_react3.useContext(userExperienceContext);
|
387
|
+
};
|
388
|
+
function UserExperienceProvider({
|
389
|
+
children,
|
390
|
+
initialValue
|
391
|
+
}) {
|
392
|
+
const [cookies, setCookie] = import_react_cookie.useCookies();
|
393
|
+
const [userExperience, setUserExperience] = import_react3.useState({
|
394
|
+
...defaultUserExperience,
|
395
|
+
...initialValue
|
396
|
+
});
|
397
|
+
const [processedCookie, setProcessedCookie] = import_react3.useState(false);
|
398
|
+
const isUserExperience = (x) => {
|
399
|
+
if (typeof x !== "object") {
|
400
|
+
return false;
|
401
|
+
}
|
402
|
+
if (!("showWelcomeMessage" in x)) {
|
403
|
+
return false;
|
404
|
+
}
|
405
|
+
if (!("navbarVariant" in x)) {
|
406
|
+
return false;
|
407
|
+
}
|
408
|
+
if (!("navbarSettings" in x)) {
|
409
|
+
return false;
|
410
|
+
}
|
411
|
+
if (typeof x.navbarSettings !== "object") {
|
412
|
+
return false;
|
413
|
+
}
|
414
|
+
if (!("hiddenPages" in x.navbarSettings)) {
|
415
|
+
return false;
|
416
|
+
}
|
417
|
+
if (!("linkSize" in x.navbarSettings)) {
|
418
|
+
return false;
|
419
|
+
}
|
420
|
+
if (!("px" in x.navbarSettings)) {
|
421
|
+
return false;
|
422
|
+
}
|
423
|
+
if (!("py" in x.navbarSettings)) {
|
424
|
+
return false;
|
425
|
+
}
|
426
|
+
return true;
|
427
|
+
};
|
428
|
+
const updateUserExperience = (p) => {
|
429
|
+
const updatedUserExperience = typeof p === "function" ? p(userExperience) : p;
|
430
|
+
setCookie(userExperienceCookieName, updatedUserExperience, { path: "/" });
|
431
|
+
setUserExperience(updatedUserExperience);
|
432
|
+
};
|
433
|
+
import_react3.useEffect(() => {
|
434
|
+
const userExperienceCookie = cookies[userExperienceCookieName];
|
435
|
+
if (userExperienceCookie && isUserExperience(userExperienceCookie)) {
|
436
|
+
setUserExperience(userExperienceCookie);
|
437
|
+
}
|
438
|
+
if (cookies && !processedCookie) {
|
439
|
+
setProcessedCookie(true);
|
440
|
+
}
|
441
|
+
}, [cookies]);
|
442
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(userExperienceContext.Provider, {
|
443
|
+
value: { userExperience, updateUserExperience, processedCookie },
|
444
|
+
children
|
445
|
+
}, undefined, false, undefined, this);
|
446
|
+
}
|
447
|
+
|
448
|
+
// src/core/components/RemoraidProvider/WidgetsProvider/index.tsx
|
449
|
+
var import_react4 = __toESM(require("react"));
|
450
|
+
var jsx_dev_runtime4 = require("react/jsx-dev-runtime");
|
451
|
+
var widgetsContext = import_react4.default.createContext({
|
452
|
+
widgets: {},
|
453
|
+
activeWidget: null,
|
454
|
+
updateActiveWidget: () => {},
|
455
|
+
registerWidget: () => {},
|
456
|
+
registerPage: () => {},
|
457
|
+
isWidgetRegistered: () => false,
|
458
|
+
isPageRegistered: () => false,
|
459
|
+
updateWidgetSelection: () => {},
|
460
|
+
updateWidgetSelectionBulk: () => {},
|
461
|
+
isWidgetSelected: () => false
|
462
|
+
});
|
463
|
+
var useWidgets = () => {
|
464
|
+
return import_react4.useContext(widgetsContext);
|
465
|
+
};
|
466
|
+
function WidgetsProvider({
|
467
|
+
children
|
468
|
+
}) {
|
469
|
+
const [activeWidget, setActiveWidget] = import_react4.useState(null);
|
470
|
+
const [widgets, setWidgets] = import_react4.useState({});
|
471
|
+
const updateActiveWidget = (widgetId) => {
|
472
|
+
setActiveWidget(widgetId);
|
473
|
+
};
|
474
|
+
const updateWidgetSelection = (pageId, widgetId, value) => {
|
475
|
+
if (!widgets[pageId]) {
|
476
|
+
console.error(`Cannot change selection of widget in page ${pageId}. Because this page does exist.`);
|
477
|
+
return;
|
478
|
+
}
|
479
|
+
if (!widgets[pageId][widgetId]) {
|
480
|
+
console.error(`Cannot change selection of widget ${widgetId}. Because this widget does not exist on page ${pageId}.`);
|
481
|
+
return;
|
482
|
+
}
|
483
|
+
setWidgets((prev) => ({
|
484
|
+
...prev,
|
485
|
+
[pageId]: {
|
486
|
+
...widgets[pageId],
|
487
|
+
[widgetId]: { ...widgets[pageId][widgetId], selected: value }
|
488
|
+
}
|
489
|
+
}));
|
490
|
+
};
|
491
|
+
const updateWidgetSelectionBulk = (pageId, selectedWidgetIds) => {
|
492
|
+
if (!widgets[pageId]) {
|
493
|
+
console.error(`Cannot change selection of widget in page ${pageId}. Because this page does exist.`);
|
494
|
+
return;
|
495
|
+
}
|
496
|
+
const updatedPage = widgets[pageId];
|
497
|
+
for (let widgetId of Object.keys(updatedPage)) {
|
498
|
+
updatedPage[widgetId] = {
|
499
|
+
...updatedPage[widgetId],
|
500
|
+
selected: selectedWidgetIds.includes(widgetId)
|
501
|
+
};
|
502
|
+
}
|
503
|
+
setWidgets((prev) => ({
|
504
|
+
...prev,
|
505
|
+
[pageId]: updatedPage
|
506
|
+
}));
|
507
|
+
};
|
508
|
+
const registerPage = (pageId, initialWidgets) => {
|
509
|
+
setWidgets((prev) => ({
|
510
|
+
...prev,
|
511
|
+
[pageId]: initialWidgets.reduce((t, w) => {
|
512
|
+
return {
|
513
|
+
...t,
|
514
|
+
[w.widgetId]: {
|
515
|
+
name: w.name,
|
516
|
+
selected: w.initialValue === undefined ? true : w.initialValue
|
517
|
+
}
|
518
|
+
};
|
519
|
+
}, {})
|
520
|
+
}));
|
521
|
+
};
|
522
|
+
const isPageRegistered = (pageId) => {
|
523
|
+
if (!widgets[pageId]) {
|
524
|
+
return false;
|
525
|
+
}
|
526
|
+
return true;
|
527
|
+
};
|
528
|
+
const registerWidget = (pageId, widget) => {
|
529
|
+
if (!isPageRegistered(pageId)) {
|
530
|
+
if (widget.allowUnregisteredPageUsage !== false) {
|
531
|
+
registerPage(pageId, [widget]);
|
532
|
+
return;
|
533
|
+
}
|
534
|
+
console.error(`Not allowed to register widget in unregistered page ${pageId}. Try registering the page first.`);
|
535
|
+
return;
|
536
|
+
}
|
537
|
+
setWidgets((prev) => ({
|
538
|
+
...prev,
|
539
|
+
[pageId]: {
|
540
|
+
...prev[pageId],
|
541
|
+
[widget.widgetId]: {
|
542
|
+
name: widget.name,
|
543
|
+
selected: widget.initialValue === undefined ? true : widget.initialValue
|
544
|
+
}
|
545
|
+
}
|
546
|
+
}));
|
547
|
+
};
|
548
|
+
const isWidgetRegistered = (pageId, widgetId) => {
|
549
|
+
if (!widgets[pageId]) {
|
550
|
+
return false;
|
551
|
+
}
|
552
|
+
if (!widgets[pageId][widgetId]) {
|
553
|
+
return false;
|
554
|
+
}
|
555
|
+
return true;
|
556
|
+
};
|
557
|
+
const isWidgetSelected = (pageId, widgetId) => {
|
558
|
+
if (!isWidgetRegistered(pageId, widgetId)) {
|
559
|
+
return false;
|
560
|
+
}
|
561
|
+
return widgets[pageId][widgetId].selected;
|
562
|
+
};
|
563
|
+
return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(widgetsContext.Provider, {
|
564
|
+
value: {
|
565
|
+
widgets,
|
566
|
+
activeWidget,
|
567
|
+
updateActiveWidget,
|
568
|
+
updateWidgetSelection,
|
569
|
+
updateWidgetSelectionBulk,
|
570
|
+
isWidgetSelected,
|
571
|
+
registerWidget,
|
572
|
+
registerPage,
|
573
|
+
isWidgetRegistered,
|
574
|
+
isPageRegistered
|
575
|
+
},
|
576
|
+
children
|
577
|
+
}, undefined, false, undefined, this);
|
578
|
+
}
|
579
|
+
|
580
|
+
// src/core/components/RemoraidProvider/index.tsx
|
581
|
+
var import_react_cookie2 = require("react-cookie");
|
582
|
+
var jsx_dev_runtime5 = require("react/jsx-dev-runtime");
|
583
|
+
function RemoraidProvider({
|
584
|
+
children,
|
585
|
+
theme,
|
586
|
+
initialUserExperience,
|
587
|
+
componentsProps
|
588
|
+
}) {
|
589
|
+
return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(import_react_cookie2.CookiesProvider, {
|
590
|
+
...componentsProps?.CookiesProvider,
|
591
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemeProvider, {
|
592
|
+
theme,
|
593
|
+
...componentsProps?.ThemeProvider,
|
594
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(UserExperienceProvider, {
|
595
|
+
initialValue: initialUserExperience,
|
596
|
+
...componentsProps?.UserExperienceProvider,
|
597
|
+
children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(WidgetsProvider, {
|
598
|
+
...componentsProps?.WidgetsProvider,
|
599
|
+
children
|
600
|
+
}, undefined, false, undefined, this)
|
601
|
+
}, undefined, false, undefined, this)
|
602
|
+
}, undefined, false, undefined, this)
|
603
|
+
}, undefined, false, undefined, this);
|
604
|
+
}
|
605
|
+
// src/core/components/AppShell/index.tsx
|
606
|
+
var import_core4 = require("@mantine/core");
|
607
|
+
var import_hooks = require("@mantine/hooks");
|
608
|
+
|
609
|
+
// src/core/components/AppShell/Footer/index.tsx
|
610
|
+
var import_core3 = require("@mantine/core");
|
611
|
+
var import_icons_react3 = require("@tabler/icons-react");
|
612
|
+
var jsx_dev_runtime6 = require("react/jsx-dev-runtime");
|
613
|
+
function Footer() {
|
614
|
+
const theme = import_core3.useMantineTheme();
|
615
|
+
const { colorScheme } = import_core3.useMantineColorScheme();
|
616
|
+
return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(import_core3.Group, {
|
617
|
+
justify: "center",
|
618
|
+
w: "100%",
|
619
|
+
py: "md",
|
620
|
+
children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(import_icons_react3.IconPennant, {
|
621
|
+
size: 50,
|
622
|
+
color: colorScheme === "dark" ? theme.colors.dark[8] : theme.colors.gray[3]
|
623
|
+
}, undefined, false, undefined, this)
|
624
|
+
}, undefined, false, undefined, this);
|
625
|
+
}
|
626
|
+
|
627
|
+
// src/core/components/AppShell/index.tsx
|
628
|
+
var jsx_dev_runtime7 = require("react/jsx-dev-runtime");
|
629
|
+
function AppShell({
|
630
|
+
children,
|
631
|
+
logo,
|
632
|
+
navbar,
|
633
|
+
user
|
634
|
+
}) {
|
635
|
+
const { userExperience } = useRemoraidUserExperience();
|
636
|
+
const mantineTheme = import_core4.useMantineTheme();
|
637
|
+
const theme = useRemoraidTheme();
|
638
|
+
const { colorScheme } = import_core4.useMantineColorScheme();
|
639
|
+
const [opened, { toggle }] = import_hooks.useDisclosure();
|
640
|
+
const navbarVariant = navbar && navbar.variant ? navbar.variant : userExperience.navbarVariant;
|
641
|
+
const navbarSettings = navbar && navbar.settings ? navbar.settings : userExperience.navbarSettings;
|
642
|
+
const navbarLinkSizePx = co((v) => !Number.isNaN(v), Number(import_core4.px(navbarSettings.linkSize)), 0);
|
643
|
+
const navbarPaddingPx = typeof navbarSettings.px === "number" ? navbarSettings.px : theme.spacingPx ? theme.spacingPx[navbarSettings.px] : 0;
|
644
|
+
return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.AppShell, {
|
645
|
+
header: { height: 0 },
|
646
|
+
navbar: {
|
647
|
+
width: import_core4.rem(`${navbarLinkSizePx + 2 * navbarPaddingPx}px`),
|
648
|
+
breakpoint: "sm",
|
649
|
+
collapsed: { mobile: !opened }
|
650
|
+
},
|
651
|
+
bg: colorScheme === "dark" ? mantineTheme.colors.dark[9] : mantineTheme.colors.gray[0],
|
652
|
+
children: [
|
653
|
+
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.AppShell.Header, {
|
654
|
+
withBorder: false,
|
655
|
+
children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.Group, {
|
656
|
+
p: "md",
|
657
|
+
bg: colorScheme === "dark" ? mantineTheme.colors.dark[8] : mantineTheme.colors.gray[3],
|
658
|
+
hiddenFrom: "sm",
|
659
|
+
children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.Burger, {
|
660
|
+
opened,
|
661
|
+
onClick: toggle,
|
662
|
+
h: 20,
|
663
|
+
size: 18
|
664
|
+
}, undefined, false, undefined, this)
|
665
|
+
}, undefined, false, undefined, this)
|
666
|
+
}, undefined, false, undefined, this),
|
667
|
+
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.AppShell.Navbar, {
|
668
|
+
withBorder: false,
|
669
|
+
children: navbarVariant === "minimal" && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(NavbarMinimal, {
|
670
|
+
logo,
|
671
|
+
user,
|
672
|
+
...navbar
|
673
|
+
}, undefined, false, undefined, this)
|
674
|
+
}, undefined, false, undefined, this),
|
675
|
+
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.AppShell.Main, {
|
676
|
+
children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
|
677
|
+
children: [
|
678
|
+
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(import_core4.Paper, {
|
679
|
+
radius: 0,
|
680
|
+
my: "md",
|
681
|
+
h: 20,
|
682
|
+
hiddenFrom: "sm"
|
683
|
+
}, undefined, false, undefined, this),
|
684
|
+
children,
|
685
|
+
/* @__PURE__ */ jsx_dev_runtime7.jsxDEV(Footer, {}, undefined, false, undefined, this)
|
686
|
+
]
|
687
|
+
}, undefined, true, undefined, this)
|
688
|
+
}, undefined, false, undefined, this)
|
689
|
+
]
|
690
|
+
}, undefined, true, undefined, this);
|
691
|
+
}
|
692
|
+
// src/core/components/WidgetSelectionHeader/index.tsx
|
693
|
+
var import_core6 = require("@mantine/core");
|
694
|
+
|
695
|
+
// src/core/components/Page/index.tsx
|
696
|
+
var import_core5 = require("@mantine/core");
|
697
|
+
var import_react5 = __toESM(require("react"));
|
698
|
+
var import_navigation2 = require("next/navigation");
|
699
|
+
var jsx_dev_runtime8 = require("react/jsx-dev-runtime");
|
700
|
+
var pageContext = import_react5.default.createContext(null);
|
701
|
+
var usePage = () => {
|
702
|
+
return import_react5.useContext(pageContext);
|
703
|
+
};
|
704
|
+
function Page({
|
705
|
+
children,
|
706
|
+
name,
|
707
|
+
config,
|
708
|
+
pt,
|
709
|
+
componentsProps
|
710
|
+
}) {
|
711
|
+
const pathname = import_navigation2.usePathname();
|
712
|
+
const { isPageRegistered, registerPage } = useWidgets();
|
713
|
+
const theme = useRemoraidTheme();
|
714
|
+
const pageId = config?.pageId ?? pathname;
|
715
|
+
import_react5.useEffect(() => {
|
716
|
+
if (!isPageRegistered(pageId)) {
|
717
|
+
if (config?.registerPageDirectly) {
|
718
|
+
registerPage(pageId, []);
|
719
|
+
}
|
720
|
+
}
|
721
|
+
}, []);
|
722
|
+
return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(pageContext.Provider, {
|
723
|
+
value: { name: name ?? pathname, pageId, ...config },
|
724
|
+
children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(import_core5.Container, {
|
725
|
+
size: theme.containerSize,
|
726
|
+
pt: pt ?? "md",
|
727
|
+
...componentsProps?.container,
|
728
|
+
children
|
729
|
+
}, undefined, false, undefined, this)
|
730
|
+
}, undefined, false, undefined, this);
|
731
|
+
}
|
732
|
+
|
733
|
+
// src/core/components/WidgetSelectionHeader/index.tsx
|
734
|
+
var import_icons_react4 = require("@tabler/icons-react");
|
735
|
+
var jsx_dev_runtime9 = require("react/jsx-dev-runtime");
|
736
|
+
function WidgetSelectionHeader({
|
737
|
+
title,
|
738
|
+
disabledWidgets,
|
739
|
+
mt
|
740
|
+
}) {
|
741
|
+
const theme = useRemoraidTheme();
|
742
|
+
const { widgets, isPageRegistered, updateWidgetSelectionBulk } = useWidgets();
|
743
|
+
const page = usePage();
|
744
|
+
if (!page) {
|
745
|
+
console.error("'WidgetSelectionHeader' must be rendered inside of a 'Page' component.");
|
746
|
+
return null;
|
747
|
+
}
|
748
|
+
return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.Flex, {
|
749
|
+
justify: "flex-start",
|
750
|
+
align: "center",
|
751
|
+
gap: "xs",
|
752
|
+
mt,
|
753
|
+
children: [
|
754
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.Text, {
|
755
|
+
size: "lg",
|
756
|
+
fw: 400,
|
757
|
+
children: title ?? page.name
|
758
|
+
}, undefined, false, undefined, this),
|
759
|
+
/* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.Divider, {
|
760
|
+
orientation: "vertical"
|
761
|
+
}, undefined, false, undefined, this),
|
762
|
+
isPageRegistered(page.pageId) && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.ScrollArea, {
|
763
|
+
flex: 1,
|
764
|
+
...theme.scrollAreaProps,
|
765
|
+
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.Chip.Group, {
|
766
|
+
multiple: true,
|
767
|
+
value: Object.keys(widgets[page.pageId]).filter((widgetId) => widgets[page.pageId][widgetId].selected),
|
768
|
+
onChange: (value) => {
|
769
|
+
updateWidgetSelectionBulk(page.pageId, value);
|
770
|
+
},
|
771
|
+
children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.Flex, {
|
772
|
+
justify: "flex-start",
|
773
|
+
align: "center",
|
774
|
+
gap: "xs",
|
775
|
+
h: "auto",
|
776
|
+
children: Object.keys(widgets[page.pageId]).map((widgetId) => /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_core6.Chip, {
|
777
|
+
value: widgetId,
|
778
|
+
size: "sm",
|
779
|
+
disabled: disabledWidgets && disabledWidgets.includes(widgetId),
|
780
|
+
icon: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(import_icons_react4.IconCheck, {
|
781
|
+
...theme.iconProps.tiny
|
782
|
+
}, undefined, false, undefined, this),
|
783
|
+
children: widgets[page.pageId][widgetId].name
|
784
|
+
}, widgetId, false, undefined, this))
|
785
|
+
}, undefined, false, undefined, this)
|
786
|
+
}, undefined, false, undefined, this)
|
787
|
+
}, undefined, false, undefined, this)
|
788
|
+
]
|
789
|
+
}, undefined, true, undefined, this);
|
790
|
+
}
|
791
|
+
// src/core/components/CloseButton/index.tsx
|
792
|
+
var import_core7 = require("@mantine/core");
|
793
|
+
var import_icons_react5 = require("@tabler/icons-react");
|
794
|
+
var jsx_dev_runtime10 = require("react/jsx-dev-runtime");
|
795
|
+
function CloseButton({ widgetId }) {
|
796
|
+
const theme = useRemoraidTheme();
|
797
|
+
const { activeWidget, updateWidgetSelection } = useWidgets();
|
798
|
+
const page = usePage();
|
799
|
+
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_core7.Transition, {
|
800
|
+
mounted: activeWidget === widgetId,
|
801
|
+
transition: "pop-top-right",
|
802
|
+
duration: theme.transitionDurations.short,
|
803
|
+
timingFunction: "ease",
|
804
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_core7.ActionIcon, {
|
805
|
+
pos: "absolute",
|
806
|
+
size: "xs",
|
807
|
+
className: "remoraid-close-button",
|
808
|
+
radius: "xl",
|
809
|
+
color: "red",
|
810
|
+
onClick: () => {
|
811
|
+
if (!page) {
|
812
|
+
return;
|
813
|
+
}
|
814
|
+
updateWidgetSelection(page.pageId, widgetId, false);
|
815
|
+
},
|
816
|
+
style: transitionStyle,
|
817
|
+
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_icons_react5.IconX, {
|
818
|
+
...theme.iconProps.tiny
|
819
|
+
}, undefined, false, undefined, this)
|
820
|
+
}, undefined, false, undefined, this)
|
821
|
+
}, undefined, false, undefined, this);
|
822
|
+
}
|
823
|
+
// src/core/components/BadgeGroup/index.tsx
|
824
|
+
var import_core9 = require("@mantine/core");
|
825
|
+
var import_react6 = __toESM(require("react"));
|
826
|
+
|
827
|
+
// src/core/components/BadgeMinimal/index.tsx
|
828
|
+
var import_core8 = require("@mantine/core");
|
829
|
+
var jsx_dev_runtime11 = require("react/jsx-dev-runtime");
|
830
|
+
var isBadgeMinimalProps = (e) => {
|
831
|
+
if (typeof e !== "object") {
|
832
|
+
return false;
|
833
|
+
}
|
834
|
+
if (!("label" in e)) {
|
835
|
+
return false;
|
836
|
+
}
|
837
|
+
return true;
|
838
|
+
};
|
839
|
+
function BadgeMinimal(props) {
|
840
|
+
const { label, tooltip, mounted, componentsProps } = props;
|
841
|
+
const theme = useRemoraidTheme();
|
842
|
+
return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core8.Transition, {
|
843
|
+
mounted: mounted !== false,
|
844
|
+
transition: "fade",
|
845
|
+
duration: theme.transitionDurations.short,
|
846
|
+
timingFunction: "ease",
|
847
|
+
...componentsProps?.transition,
|
848
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core8.Tooltip, {
|
849
|
+
disabled: !tooltip,
|
850
|
+
label: tooltip,
|
851
|
+
...componentsProps?.tooltip,
|
852
|
+
children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core8.Badge, {
|
853
|
+
variant: "default",
|
854
|
+
...componentsProps?.badge,
|
855
|
+
style: {
|
856
|
+
...transitionStyle,
|
857
|
+
cursor: "pointer",
|
858
|
+
...componentsProps?.badge?.style
|
859
|
+
},
|
860
|
+
children: label
|
861
|
+
}, undefined, false, undefined, this)
|
862
|
+
}, undefined, false, undefined, this)
|
863
|
+
}, undefined, false, undefined, this);
|
864
|
+
}
|
865
|
+
|
866
|
+
// src/core/components/BadgeGroup/index.tsx
|
867
|
+
var jsx_dev_runtime12 = require("react/jsx-dev-runtime");
|
868
|
+
var react = require("react");
|
869
|
+
function BadgeGroup({
|
870
|
+
badges,
|
871
|
+
gap,
|
872
|
+
breakpoint,
|
873
|
+
componentsProps
|
874
|
+
}) {
|
875
|
+
const theme = useRemoraidTheme();
|
876
|
+
const numVisibleBadges = badges.filter((e) => isBadgeMinimalProps(e) ? e.mounted !== false : true).length;
|
877
|
+
return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(jsx_dev_runtime12.Fragment, {
|
878
|
+
children: [
|
879
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core9.Group, {
|
880
|
+
gap: gap ?? "xs",
|
881
|
+
wrap: "nowrap",
|
882
|
+
visibleFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
|
883
|
+
children: badges.map((e, i) => {
|
884
|
+
if (isBadgeMinimalProps(e)) {
|
885
|
+
return /* @__PURE__ */ react.createElement(BadgeMinimal, {
|
886
|
+
...e,
|
887
|
+
key: i
|
888
|
+
});
|
889
|
+
}
|
890
|
+
return e;
|
891
|
+
})
|
892
|
+
}, undefined, false, undefined, this),
|
893
|
+
/* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core9.Tooltip, {
|
894
|
+
label: `${numVisibleBadges} badge${numVisibleBadges === 1 ? "" : "s"}`,
|
895
|
+
...componentsProps?.tooltip,
|
896
|
+
children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core9.Badge, {
|
897
|
+
hiddenFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
|
898
|
+
hidden: numVisibleBadges === 0,
|
899
|
+
variant: "light",
|
900
|
+
circle: true,
|
901
|
+
style: { cursor: "pointer" },
|
902
|
+
...componentsProps?.cumulativeBadge,
|
903
|
+
children: numVisibleBadges
|
904
|
+
}, undefined, false, undefined, this)
|
905
|
+
}, undefined, false, undefined, this)
|
906
|
+
]
|
907
|
+
}, undefined, true, undefined, this);
|
908
|
+
}
|
909
|
+
// src/core/components/AlertMinimal/index.tsx
|
910
|
+
var import_core10 = require("@mantine/core");
|
911
|
+
var jsx_dev_runtime13 = require("react/jsx-dev-runtime");
|
912
|
+
var isAlertMinimalProps = (e) => {
|
913
|
+
if (typeof e !== "object") {
|
914
|
+
return false;
|
915
|
+
}
|
916
|
+
if (!("category" in e)) {
|
917
|
+
return false;
|
918
|
+
}
|
919
|
+
return true;
|
920
|
+
};
|
921
|
+
function AlertMinimal({
|
922
|
+
children,
|
923
|
+
title,
|
924
|
+
category,
|
925
|
+
text,
|
926
|
+
onClose,
|
927
|
+
mounted,
|
928
|
+
mt,
|
929
|
+
mb,
|
930
|
+
componentsProps
|
931
|
+
}) {
|
932
|
+
const theme = useRemoraidTheme();
|
933
|
+
return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core10.Transition, {
|
934
|
+
mounted: mounted !== false,
|
935
|
+
transition: "fade",
|
936
|
+
duration: theme.transitionDurations.short,
|
937
|
+
timingFunction: "ease",
|
938
|
+
...componentsProps?.transition,
|
939
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core10.Alert, {
|
940
|
+
...theme.alertProps[category],
|
941
|
+
title: title ?? theme.alertProps[category].title,
|
942
|
+
withCloseButton: onClose !== undefined,
|
943
|
+
onClose,
|
944
|
+
mt,
|
945
|
+
mb,
|
946
|
+
...componentsProps?.alert,
|
947
|
+
style: {
|
948
|
+
...transitionStyle,
|
949
|
+
...componentsProps?.alert?.style ?? theme.alertProps[category].style
|
950
|
+
},
|
951
|
+
children: [
|
952
|
+
text,
|
953
|
+
children
|
954
|
+
]
|
955
|
+
}, undefined, true, undefined, this)
|
956
|
+
}, undefined, false, undefined, this);
|
957
|
+
}
|
958
|
+
// src/core/components/ResponsiveButton/index.tsx
|
959
|
+
var import_core11 = require("@mantine/core");
|
960
|
+
var import_icons_react6 = require("@tabler/icons-react");
|
961
|
+
var jsx_dev_runtime14 = require("react/jsx-dev-runtime");
|
962
|
+
var isResponsiveButtonProps = (e) => {
|
963
|
+
if (typeof e !== "object") {
|
964
|
+
return false;
|
965
|
+
}
|
966
|
+
if (!("label" in e)) {
|
967
|
+
return false;
|
968
|
+
}
|
969
|
+
return true;
|
970
|
+
};
|
971
|
+
function ResponsiveButton(props) {
|
972
|
+
const { onClick, label, loading, variant, componentsProps, breakpoint } = props;
|
973
|
+
const theme = useRemoraidTheme();
|
974
|
+
const icon = props.icon ? /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(props.icon, {
|
975
|
+
...theme.iconProps.medium
|
976
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_icons_react6.IconClick, {
|
977
|
+
...theme.iconProps.medium
|
978
|
+
}, undefined, false, undefined, this);
|
979
|
+
return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(jsx_dev_runtime14.Fragment, {
|
980
|
+
children: [
|
981
|
+
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core11.Tooltip, {
|
982
|
+
label,
|
983
|
+
...componentsProps?.tooltip,
|
984
|
+
children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core11.ActionIcon, {
|
985
|
+
variant: variant || "default",
|
986
|
+
onClick,
|
987
|
+
loading,
|
988
|
+
size: "input-sm",
|
989
|
+
"aria-label": "Refresh",
|
990
|
+
hiddenFrom: breakpoint || "md",
|
991
|
+
children: icon
|
992
|
+
}, undefined, false, undefined, this)
|
993
|
+
}, undefined, false, undefined, this),
|
994
|
+
/* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core11.Button, {
|
995
|
+
onClick,
|
996
|
+
loading,
|
997
|
+
variant: variant || "default",
|
998
|
+
leftSection: props.icon ? icon : undefined,
|
999
|
+
visibleFrom: breakpoint || "md",
|
1000
|
+
children: label
|
1001
|
+
}, undefined, false, undefined, this)
|
1002
|
+
]
|
1003
|
+
}, undefined, true, undefined, this);
|
1004
|
+
}
|
1005
|
+
// src/core/components/Widget/WidgetWrapper/index.tsx
|
1006
|
+
var import_core12 = require("@mantine/core");
|
1007
|
+
var import_react7 = require("react");
|
1008
|
+
var jsx_dev_runtime15 = require("react/jsx-dev-runtime");
|
1009
|
+
function WidgetWrapper({
|
1010
|
+
children,
|
1011
|
+
config,
|
1012
|
+
mt,
|
1013
|
+
withCloseButton,
|
1014
|
+
componentsProps
|
1015
|
+
}) {
|
1016
|
+
const {
|
1017
|
+
isWidgetSelected,
|
1018
|
+
isPageRegistered,
|
1019
|
+
isWidgetRegistered,
|
1020
|
+
registerWidget,
|
1021
|
+
updateActiveWidget
|
1022
|
+
} = useWidgets();
|
1023
|
+
const page = usePage();
|
1024
|
+
const theme = useRemoraidTheme();
|
1025
|
+
const pageRegistered = page ? isPageRegistered(page.pageId) : false;
|
1026
|
+
import_react7.useEffect(() => {
|
1027
|
+
if (!page) {
|
1028
|
+
return;
|
1029
|
+
}
|
1030
|
+
if (!isWidgetRegistered(page.pageId, config.widgetId)) {
|
1031
|
+
registerWidget(page.pageId, config);
|
1032
|
+
}
|
1033
|
+
}, [pageRegistered]);
|
1034
|
+
return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(import_core12.Transition, {
|
1035
|
+
mounted: page !== null && isWidgetSelected(page.pageId, config.widgetId),
|
1036
|
+
transition: "fade-left",
|
1037
|
+
duration: theme.transitionDurations.medium,
|
1038
|
+
timingFunction: "ease",
|
1039
|
+
children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(import_core12.Paper, {
|
1040
|
+
p: "md",
|
1041
|
+
shadow: "md",
|
1042
|
+
bg: theme.transparentBackground,
|
1043
|
+
mt: mt || 0,
|
1044
|
+
pos: "relative",
|
1045
|
+
h: "fit-content",
|
1046
|
+
...componentsProps?.container,
|
1047
|
+
style: { ...transitionStyle, ...componentsProps?.container?.style },
|
1048
|
+
onMouseEnter: () => {
|
1049
|
+
updateActiveWidget(config.widgetId);
|
1050
|
+
},
|
1051
|
+
onMouseLeave: () => {
|
1052
|
+
updateActiveWidget(null);
|
1053
|
+
},
|
1054
|
+
children: [
|
1055
|
+
withCloseButton !== false && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(CloseButton, {
|
1056
|
+
widgetId: config.widgetId
|
1057
|
+
}, undefined, false, undefined, this),
|
1058
|
+
children
|
1059
|
+
]
|
1060
|
+
}, undefined, true, undefined, this)
|
1061
|
+
}, undefined, false, undefined, this);
|
1062
|
+
}
|
1063
|
+
// src/core/components/Widget/index.tsx
|
1064
|
+
var import_core13 = require("@mantine/core");
|
1065
|
+
var jsx_dev_runtime16 = require("react/jsx-dev-runtime");
|
1066
|
+
var react2 = require("react");
|
1067
|
+
function Widget({
|
1068
|
+
children,
|
1069
|
+
id,
|
1070
|
+
config,
|
1071
|
+
title,
|
1072
|
+
badges,
|
1073
|
+
buttons,
|
1074
|
+
alerts,
|
1075
|
+
gaps,
|
1076
|
+
loading,
|
1077
|
+
mt,
|
1078
|
+
componentsProps
|
1079
|
+
}) {
|
1080
|
+
const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
|
1081
|
+
const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
|
1082
|
+
const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
|
1083
|
+
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(WidgetWrapper, {
|
1084
|
+
config: {
|
1085
|
+
widgetId: id,
|
1086
|
+
name: title,
|
1087
|
+
...config
|
1088
|
+
},
|
1089
|
+
mt,
|
1090
|
+
componentsProps: {
|
1091
|
+
container: componentsProps?.container,
|
1092
|
+
transition: componentsProps?.transition
|
1093
|
+
},
|
1094
|
+
...componentsProps?.wrapper,
|
1095
|
+
children: [
|
1096
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Group, {
|
1097
|
+
justify: "space-between",
|
1098
|
+
wrap: "nowrap",
|
1099
|
+
children: [
|
1100
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Group, {
|
1101
|
+
gap: badgesGap,
|
1102
|
+
wrap: "nowrap",
|
1103
|
+
children: [
|
1104
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Title, {
|
1105
|
+
order: 1,
|
1106
|
+
size: "h3",
|
1107
|
+
lineClamp: 1,
|
1108
|
+
children: title
|
1109
|
+
}, undefined, false, undefined, this),
|
1110
|
+
badges !== undefined && /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(BadgeGroup, {
|
1111
|
+
badges,
|
1112
|
+
gap: badgesGap,
|
1113
|
+
...componentsProps?.badgeGroup
|
1114
|
+
}, undefined, false, undefined, this)
|
1115
|
+
]
|
1116
|
+
}, undefined, true, undefined, this),
|
1117
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Group, {
|
1118
|
+
gap: buttonsGap,
|
1119
|
+
wrap: "nowrap",
|
1120
|
+
children: buttons !== undefined && buttons.map((e, i) => {
|
1121
|
+
if (isResponsiveButtonProps(e)) {
|
1122
|
+
return /* @__PURE__ */ react2.createElement(ResponsiveButton, {
|
1123
|
+
...e,
|
1124
|
+
key: i
|
1125
|
+
});
|
1126
|
+
}
|
1127
|
+
return e;
|
1128
|
+
})
|
1129
|
+
}, undefined, false, undefined, this)
|
1130
|
+
]
|
1131
|
+
}, undefined, true, undefined, this),
|
1132
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Divider, {
|
1133
|
+
my: "md"
|
1134
|
+
}, undefined, false, undefined, this),
|
1135
|
+
alerts !== undefined && alerts.map((a, i) => {
|
1136
|
+
if (isAlertMinimalProps(a)) {
|
1137
|
+
return /* @__PURE__ */ react2.createElement(AlertMinimal, {
|
1138
|
+
...a,
|
1139
|
+
mb: alertsGap,
|
1140
|
+
key: i
|
1141
|
+
});
|
1142
|
+
}
|
1143
|
+
return a;
|
1144
|
+
}),
|
1145
|
+
loading ? /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Center, {
|
1146
|
+
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core13.Loader, {
|
1147
|
+
...componentsProps?.loader
|
1148
|
+
}, undefined, false, undefined, this)
|
1149
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(jsx_dev_runtime16.Fragment, {
|
1150
|
+
children
|
1151
|
+
}, undefined, false, undefined, this)
|
1152
|
+
]
|
1153
|
+
}, undefined, true, undefined, this);
|
1154
|
+
}
|
1155
|
+
// src/core/components/Page/NotFoundPage/index.tsx
|
1156
|
+
var import_core14 = require("@mantine/core");
|
1157
|
+
var import_navigation3 = require("next/navigation");
|
1158
|
+
var jsx_dev_runtime17 = require("react/jsx-dev-runtime");
|
1159
|
+
function NotFoundPage({
|
1160
|
+
children,
|
1161
|
+
message,
|
1162
|
+
componentsProps
|
1163
|
+
}) {
|
1164
|
+
const pathname = import_navigation3.usePathname();
|
1165
|
+
const theme = useRemoraidTheme();
|
1166
|
+
return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(Page, {
|
1167
|
+
name: "Not Found",
|
1168
|
+
...componentsProps?.page,
|
1169
|
+
children: [
|
1170
|
+
/* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core14.Alert, {
|
1171
|
+
...theme.alertProps.negative,
|
1172
|
+
title: "404 - Page Not Found",
|
1173
|
+
children: message ?? `Could not find page ${pathname}.`
|
1174
|
+
}, undefined, false, undefined, this),
|
1175
|
+
children
|
1176
|
+
]
|
1177
|
+
}, undefined, true, undefined, this);
|
1178
|
+
}
|
1179
|
+
// src/core/components/EnvironmentShell/index.tsx
|
1180
|
+
var import_core15 = require("@mantine/core");
|
1181
|
+
var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
|
1182
|
+
function EnvironmentShell({
|
1183
|
+
children,
|
1184
|
+
vars,
|
1185
|
+
message,
|
1186
|
+
m,
|
1187
|
+
mt
|
1188
|
+
}) {
|
1189
|
+
const theme = useRemoraidTheme();
|
1190
|
+
const missingVars = vars.filter((v) => !process.env[v]);
|
1191
|
+
if (missingVars.length !== 0) {
|
1192
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core15.Alert, {
|
1193
|
+
...theme.alertProps.neutral,
|
1194
|
+
title: `Please Specify Environment Variable${missingVars.length > 1 ? "s" : ""}`,
|
1195
|
+
m,
|
1196
|
+
mt,
|
1197
|
+
children: message ?? `
|
1198
|
+
Components could not be rendered because the following environment
|
1199
|
+
variables are not specified: ${missingVars.join(", ")}.
|
1200
|
+
`
|
1201
|
+
}, undefined, false, undefined, this);
|
1202
|
+
}
|
1203
|
+
return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(jsx_dev_runtime18.Fragment, {
|
1204
|
+
children
|
1205
|
+
}, undefined, false, undefined, this);
|
1206
|
+
}
|