@ocelescope/core 0.1.0 → 0.1.1
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/dist/index.d.ts +17 -1
- package/dist/index.js +151 -19
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ declare const FileDropzone: React.FC<{
|
|
|
42
42
|
//#region src/components/EventHandler.d.ts
|
|
43
43
|
declare const sseHandler: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
44
44
|
//#endregion
|
|
45
|
+
//#region src/components/HelpModal/HelpModal.d.ts
|
|
46
|
+
declare const HelpModal: React.FC<{
|
|
47
|
+
visible: boolean;
|
|
48
|
+
onClose: () => void;
|
|
49
|
+
}>;
|
|
50
|
+
//#endregion
|
|
45
51
|
//#region src/lib/config.d.ts
|
|
46
52
|
type Author = {
|
|
47
53
|
name: string;
|
|
@@ -165,7 +171,17 @@ declare const formatAttributeValue: (type: ValueType, value: string | number) =>
|
|
|
165
171
|
//#endregion
|
|
166
172
|
//#region src/lib/env.d.ts
|
|
167
173
|
declare const env: {
|
|
174
|
+
appVersion: string;
|
|
168
175
|
projectPage: string;
|
|
176
|
+
docsUrl: string;
|
|
177
|
+
pluginDevGuideUrl: string;
|
|
178
|
+
pluginLibraryUrl: string;
|
|
179
|
+
reportBugUrl: string;
|
|
180
|
+
requestFeatureUrl: string;
|
|
181
|
+
submitPluginUrl: string;
|
|
182
|
+
troubleshootingUrl: string;
|
|
183
|
+
requestEnvironmentUrl: string;
|
|
184
|
+
contactEmail: string;
|
|
169
185
|
};
|
|
170
186
|
//#endregion
|
|
171
187
|
//#region src/lib/getModuleRoute.d.ts
|
|
@@ -184,4 +200,4 @@ declare const getModuleRoute: ({
|
|
|
184
200
|
pathname: string;
|
|
185
201
|
};
|
|
186
202
|
//#endregion
|
|
187
|
-
export { AttributesTable, BarList, FileDropzone, ModuleDefinition, ModuleRouteDefinition, OcelSelect, OcelescopeApp, OcelescopeConfig, OcelescopeDocument, RelationTable, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useInvalidate };
|
|
203
|
+
export { AttributesTable, BarList, FileDropzone, HelpModal, ModuleDefinition, ModuleRouteDefinition, OcelSelect, OcelescopeApp, OcelescopeConfig, OcelescopeDocument, RelationTable, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useInvalidate };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AppShell, Box, Burger, Button, ColorSchemeScript, Combobox, CopyButton, Divider, Group, Input, InputBase, LoadingOverlay, MantineProvider, Modal, MultiSelect, NavLink, Stack, Table, Text, ThemeIcon, Tooltip, UnstyledButton, createTheme, mantineHtmlProps, useCombobox, useMantineTheme } from "@mantine/core";
|
|
1
|
+
import { ActionIcon, Anchor, AppShell, Box, Burger, Button, ColorSchemeScript, Combobox, CopyButton, Divider, Group, Input, InputBase, LoadingOverlay, MantineProvider, Modal, MultiSelect, NavLink, Stack, Table, Text, ThemeIcon, Tooltip, UnstyledButton, createTheme, mantineHtmlProps, useCombobox, useMantineTheme } from "@mantine/core";
|
|
2
2
|
import { getDownloadFlatLogQueryKey, getDownloadOCELQueryKey, getDownloadResourceAsPnmlQueryKey, getDownloadResourceQueryKey, useActivities, useAggregatedAttributes, useAttributeNames, useE2o, useE2oCombinations, useEventAttributes, useGetDefaultOcel, useGetOcels, useImportDefaultOcel, useLogout, useO2o, useO2oCombinations, useObjectAttributes, useObjectTypes, useUpload } from "@ocelescope/api-base";
|
|
3
3
|
import { HydrationBoundary, QueryClient, QueryClientProvider, keepPreviousData, useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
import { ChevronDownIcon, ChevronRightIcon, ContainerIcon, DownloadIcon, FilterIcon, LogOutIcon, PackageIcon, UploadIcon, XIcon } from "lucide-react";
|
|
4
|
+
import { BookOpenIcon, BugIcon, ChevronDownIcon, ChevronRightIcon, ContainerIcon, DownloadIcon, FilterIcon, GlobeIcon, HelpCircleIcon, LightbulbIcon, LogOutIcon, MailIcon, PackageIcon, PackagePlusIcon, PuzzleIcon, TriangleAlertIcon, UploadIcon, XIcon } from "lucide-react";
|
|
5
5
|
import { DataTable } from "mantine-datatable";
|
|
6
6
|
import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import dayjs from "dayjs";
|
|
@@ -9,6 +9,7 @@ import isBetween from "dayjs/plugin/isBetween.js";
|
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { Dropzone } from "@mantine/dropzone";
|
|
11
11
|
import { Readable } from "node:stream";
|
|
12
|
+
import z from "zod";
|
|
12
13
|
import { Notifications, showNotification } from "@mantine/notifications";
|
|
13
14
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
14
15
|
import { useDisclosure } from "@mantine/hooks";
|
|
@@ -17,10 +18,9 @@ import { create } from "zustand";
|
|
|
17
18
|
import { persist } from "zustand/middleware";
|
|
18
19
|
import Link from "next/link.js";
|
|
19
20
|
import { useRouter } from "next/router.js";
|
|
20
|
-
import z from "zod";
|
|
21
21
|
import { Head, Html, Main, NextScript } from "next/document.js";
|
|
22
22
|
import { parse } from "content-disposition-attachment";
|
|
23
|
-
import
|
|
23
|
+
import FileSaver from "file-saver";
|
|
24
24
|
import qs from "qs";
|
|
25
25
|
//#region src/lib/dayjs.ts
|
|
26
26
|
dayjs.extend(isBetween);
|
|
@@ -456,6 +456,119 @@ const sseHandler = async (req, res) => {
|
|
|
456
456
|
res.status(500).end("SSE proxy error");
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
+
const env = z.object({
|
|
460
|
+
NEXT_PUBLIC_APP_VERSION: z.string().default("v0.0.0"),
|
|
461
|
+
NEXT_PUBLIC_PROJECT_PAGE: z.url().default("https://www.ocelescope.org/"),
|
|
462
|
+
NEXT_PUBLIC_DOCS_URL: z.url().default("https://www.ocelescope.org/getting-started/download/"),
|
|
463
|
+
NEXT_PUBLIC_PLUGIN_DEV_GUIDE_URL: z.url().default("https://www.ocelescope.org/plugin-development/"),
|
|
464
|
+
NEXT_PUBLIC_PLUGIN_LIBRARY_URL: z.url().default("https://www.ocelescope.org/community/plugin-library/"),
|
|
465
|
+
NEXT_PUBLIC_REPORT_BUG_URL: z.url().default("https://www.ocelescope.org/community/report-bug/"),
|
|
466
|
+
NEXT_PUBLIC_TROUBLESHOOTING_URL: z.url().default("https://www.ocelescope.org/community/troubleshooting/"),
|
|
467
|
+
NEXT_PUBLIC_REQUEST_FEATURE_URL: z.url().default("https://www.ocelescope.org/community/request-feature/"),
|
|
468
|
+
NEXT_PUBLIC_SUBMIT_PLUGIN_URL: z.url().default("https://www.ocelescope.org/community/submit-plugin/"),
|
|
469
|
+
NEXT_PUBLIC_REQUEST_ENVIRONMENT_URL: z.url().default("https://www.ocelescope.org/plugin-development/request-package/"),
|
|
470
|
+
NEXT_PUBLIC_CONTACT_EMAIL: z.string().default("ocelescope@pads.rwth-aachen.de")
|
|
471
|
+
}).transform((env) => ({
|
|
472
|
+
appVersion: env.NEXT_PUBLIC_APP_VERSION,
|
|
473
|
+
projectPage: env.NEXT_PUBLIC_PROJECT_PAGE,
|
|
474
|
+
docsUrl: env.NEXT_PUBLIC_DOCS_URL,
|
|
475
|
+
pluginDevGuideUrl: env.NEXT_PUBLIC_PLUGIN_DEV_GUIDE_URL,
|
|
476
|
+
pluginLibraryUrl: env.NEXT_PUBLIC_PLUGIN_LIBRARY_URL,
|
|
477
|
+
reportBugUrl: env.NEXT_PUBLIC_REPORT_BUG_URL,
|
|
478
|
+
requestFeatureUrl: env.NEXT_PUBLIC_REQUEST_FEATURE_URL,
|
|
479
|
+
submitPluginUrl: env.NEXT_PUBLIC_SUBMIT_PLUGIN_URL,
|
|
480
|
+
troubleshootingUrl: env.NEXT_PUBLIC_TROUBLESHOOTING_URL,
|
|
481
|
+
requestEnvironmentUrl: env.NEXT_PUBLIC_REQUEST_ENVIRONMENT_URL,
|
|
482
|
+
contactEmail: env.NEXT_PUBLIC_CONTACT_EMAIL
|
|
483
|
+
})).parse({
|
|
484
|
+
NEXT_PUBLIC_APP_VERSION: process.env.NEXT_PUBLIC_APP_VERSION,
|
|
485
|
+
NEXT_PUBLIC_PROJECT_PAGE: process.env.NEXT_PUBLIC_PROJECT_PAGE,
|
|
486
|
+
NEXT_PUBLIC_DOCS_URL: process.env.NEXT_PUBLIC_DOCS_URL,
|
|
487
|
+
NEXT_PUBLIC_PLUGIN_DEV_GUIDE_URL: process.env.NEXT_PUBLIC_PLUGIN_DEV_GUIDE_URL,
|
|
488
|
+
NEXT_PUBLIC_PLUGIN_LIBRARY_URL: process.env.NEXT_PUBLIC_PLUGIN_LIBRARY_URL,
|
|
489
|
+
NEXT_PUBLIC_REPORT_BUG_URL: process.env.NEXT_PUBLIC_REPORT_BUG_URL,
|
|
490
|
+
NEXT_PUBLIC_TROUBLESHOOTING_URL: process.env.NEXT_PUBLIC_TROUBLESHOOTING_URL,
|
|
491
|
+
NEXT_PUBLIC_REQUEST_FEATURE_URL: process.env.NEXT_PUBLIC_REQUEST_FEATURE_URL,
|
|
492
|
+
NEXT_PUBLIC_SUBMIT_PLUGIN_URL: process.env.NEXT_PUBLIC_SUBMIT_PLUGIN_URL,
|
|
493
|
+
NEXT_PUBLIC_REQUEST_ENVIRONMENT_URL: process.env.NEXT_PUBLIC_REQUEST_ENVIRONMENT_URL,
|
|
494
|
+
NEXT_PUBLIC_CONTACT_EMAIL: process.env.NEXT_PUBLIC_CONTACT_EMAIL
|
|
495
|
+
});
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/components/HelpModal/HelpModal.tsx
|
|
498
|
+
const HelpLink = ({ icon: Icon, label, href }) => /* @__PURE__ */ jsx(Anchor, {
|
|
499
|
+
href,
|
|
500
|
+
target: "_blank",
|
|
501
|
+
rel: "noopener noreferrer",
|
|
502
|
+
underline: "never",
|
|
503
|
+
c: "inherit",
|
|
504
|
+
children: /* @__PURE__ */ jsxs(Group, {
|
|
505
|
+
gap: "sm",
|
|
506
|
+
children: [/* @__PURE__ */ jsx(Icon, { size: 18 }), /* @__PURE__ */ jsx(Text, {
|
|
507
|
+
size: "sm",
|
|
508
|
+
children: label
|
|
509
|
+
})]
|
|
510
|
+
})
|
|
511
|
+
});
|
|
512
|
+
const HelpModal = ({ visible, onClose }) => {
|
|
513
|
+
return /* @__PURE__ */ jsx(Modal, {
|
|
514
|
+
title: /* @__PURE__ */ jsx(Text, {
|
|
515
|
+
size: "h3",
|
|
516
|
+
children: "Help"
|
|
517
|
+
}),
|
|
518
|
+
opened: visible,
|
|
519
|
+
onClose,
|
|
520
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
521
|
+
gap: "sm",
|
|
522
|
+
children: [
|
|
523
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
524
|
+
icon: GlobeIcon,
|
|
525
|
+
label: "Website",
|
|
526
|
+
href: env.projectPage
|
|
527
|
+
}),
|
|
528
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
529
|
+
icon: BookOpenIcon,
|
|
530
|
+
label: "Documentation",
|
|
531
|
+
href: env.docsUrl
|
|
532
|
+
}),
|
|
533
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
534
|
+
icon: PuzzleIcon,
|
|
535
|
+
label: "Plugin development guide",
|
|
536
|
+
href: env.pluginDevGuideUrl
|
|
537
|
+
}),
|
|
538
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
539
|
+
icon: TriangleAlertIcon,
|
|
540
|
+
label: "Known issues",
|
|
541
|
+
href: env.troubleshootingUrl
|
|
542
|
+
}),
|
|
543
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
544
|
+
icon: BugIcon,
|
|
545
|
+
label: "Report a bug",
|
|
546
|
+
href: env.reportBugUrl
|
|
547
|
+
}),
|
|
548
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
549
|
+
icon: LightbulbIcon,
|
|
550
|
+
label: "Request a feature",
|
|
551
|
+
href: env.requestFeatureUrl
|
|
552
|
+
}),
|
|
553
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
554
|
+
icon: UploadIcon,
|
|
555
|
+
label: "Submit a plugin",
|
|
556
|
+
href: env.submitPluginUrl
|
|
557
|
+
}),
|
|
558
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
559
|
+
icon: PackagePlusIcon,
|
|
560
|
+
label: "Request environment addition",
|
|
561
|
+
href: env.requestEnvironmentUrl
|
|
562
|
+
}),
|
|
563
|
+
/* @__PURE__ */ jsx(HelpLink, {
|
|
564
|
+
icon: MailIcon,
|
|
565
|
+
label: env.contactEmail,
|
|
566
|
+
href: `mailto:${env.contactEmail}`
|
|
567
|
+
})
|
|
568
|
+
]
|
|
569
|
+
})
|
|
570
|
+
});
|
|
571
|
+
};
|
|
459
572
|
//#endregion
|
|
460
573
|
//#region src/components/ModulePage.tsx
|
|
461
574
|
const createModulesPage = (config) => {
|
|
@@ -835,6 +948,7 @@ const AppShell$1 = ({ config, children }) => {
|
|
|
835
948
|
const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(true);
|
|
836
949
|
const [desktopOpened, { toggle: toggleDesktop }] = useDisclosure(true);
|
|
837
950
|
const [isUploadModalVisible, setIsUploadModalVisible] = useState(false);
|
|
951
|
+
const [isHelpModalVisible, setIsHelpModalVisible] = useState(false);
|
|
838
952
|
return /* @__PURE__ */ jsxs(AppShell, {
|
|
839
953
|
header: { height: 60 },
|
|
840
954
|
navbar: {
|
|
@@ -853,17 +967,25 @@ const AppShell$1 = ({ config, children }) => {
|
|
|
853
967
|
justify: "space-between",
|
|
854
968
|
children: [/* @__PURE__ */ jsxs(Group, {
|
|
855
969
|
align: "center",
|
|
856
|
-
children: [
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
970
|
+
children: [
|
|
971
|
+
/* @__PURE__ */ jsx(Burger, {
|
|
972
|
+
opened: mobileOpened,
|
|
973
|
+
onClick: toggleMobile,
|
|
974
|
+
hiddenFrom: "sm",
|
|
975
|
+
size: "sm"
|
|
976
|
+
}),
|
|
977
|
+
/* @__PURE__ */ jsx(Burger, {
|
|
978
|
+
opened: desktopOpened,
|
|
979
|
+
onClick: toggleDesktop,
|
|
980
|
+
visibleFrom: "sm",
|
|
981
|
+
size: "sm"
|
|
982
|
+
}),
|
|
983
|
+
/* @__PURE__ */ jsx(Text, {
|
|
984
|
+
size: "xs",
|
|
985
|
+
c: "dimmed",
|
|
986
|
+
children: env.appVersion
|
|
987
|
+
})
|
|
988
|
+
]
|
|
867
989
|
}), /* @__PURE__ */ jsxs(Group, { children: [
|
|
868
990
|
/* @__PURE__ */ jsx(CurrentOcelSelect, {}),
|
|
869
991
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -874,6 +996,16 @@ const AppShell$1 = ({ config, children }) => {
|
|
|
874
996
|
/* @__PURE__ */ jsx(UploadModal, {
|
|
875
997
|
visible: isUploadModalVisible,
|
|
876
998
|
onClose: () => setIsUploadModalVisible(false)
|
|
999
|
+
}),
|
|
1000
|
+
/* @__PURE__ */ jsx(ActionIcon, {
|
|
1001
|
+
variant: "subtle",
|
|
1002
|
+
"aria-label": "Help",
|
|
1003
|
+
onClick: () => setIsHelpModalVisible(true),
|
|
1004
|
+
children: /* @__PURE__ */ jsx(HelpCircleIcon, { size: 20 })
|
|
1005
|
+
}),
|
|
1006
|
+
/* @__PURE__ */ jsx(HelpModal, {
|
|
1007
|
+
visible: isHelpModalVisible,
|
|
1008
|
+
onClose: () => setIsHelpModalVisible(false)
|
|
877
1009
|
})
|
|
878
1010
|
] })]
|
|
879
1011
|
}) }),
|
|
@@ -884,7 +1016,7 @@ const AppShell$1 = ({ config, children }) => {
|
|
|
884
1016
|
children: /* @__PURE__ */ jsx(Box, {
|
|
885
1017
|
h: "100%",
|
|
886
1018
|
style: {
|
|
887
|
-
overflow: "
|
|
1019
|
+
overflow: "auto",
|
|
888
1020
|
position: "relative"
|
|
889
1021
|
},
|
|
890
1022
|
children
|
|
@@ -1306,7 +1438,8 @@ const useDownloadFile = () => {
|
|
|
1306
1438
|
if (!response.ok) throw new Error("Failed to download file");
|
|
1307
1439
|
const blob = await response.blob();
|
|
1308
1440
|
const contentDisposition = parse(response.headers.get("Content-Disposition") ?? "");
|
|
1309
|
-
|
|
1441
|
+
const fileName = contentDisposition.attachment ? contentDisposition.filename : "fileName";
|
|
1442
|
+
FileSaver.saveAs(blob, fileName);
|
|
1310
1443
|
} catch (err) {
|
|
1311
1444
|
console.error("Download error:", err);
|
|
1312
1445
|
}
|
|
@@ -1334,6 +1467,5 @@ const useDownloadResourceAsPnml = useDownloadFromServer(getDownloadResourceAsPnm
|
|
|
1334
1467
|
//#region src/lib/config.ts
|
|
1335
1468
|
const defineModule = (def) => def;
|
|
1336
1469
|
const defineModuleRoute = (def) => def;
|
|
1337
|
-
const env = z.object({ NEXT_PUBLIC_PROJECT_PAGE: z.url().default("https://www.ocelescope.org/") }).transform(({ NEXT_PUBLIC_PROJECT_PAGE }) => ({ projectPage: NEXT_PUBLIC_PROJECT_PAGE })).parse(process.env);
|
|
1338
1470
|
//#endregion
|
|
1339
|
-
export { AttributesTable, BarList, FileDropzone, OcelSelect, OcelescopeApp, OcelescopeDocument, RelationTable, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useInvalidate };
|
|
1471
|
+
export { AttributesTable, BarList, FileDropzone, HelpModal, OcelSelect, OcelescopeApp, OcelescopeDocument, RelationTable, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useInvalidate };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocelescope/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Core React component and style library for Ocelescope (Mantine + React Query).",
|
|
6
6
|
"author": "Görkem-Emre Öztürk <goerkem.oeztuerk@rwth-aachen.de>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"react-dom": "^19.2.0",
|
|
48
48
|
"zod": "^4.3.6",
|
|
49
49
|
"zustand": "^5.0.11",
|
|
50
|
+
"@ocelescope/api-base": "0.1.0",
|
|
50
51
|
"@ocelescope/api-client": "0.1.0",
|
|
51
|
-
"@ocelescope/resources": "0.1.0"
|
|
52
|
-
"@ocelescope/api-base": "0.1.0"
|
|
52
|
+
"@ocelescope/resources": "0.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@mantine/notifications": "^9.4.0",
|