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