@ocelescope/core 0.1.2 → 0.5.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +15 -9
  2. package/dist/index.js +161 -13
  3. package/package.json +19 -21
package/dist/index.d.ts CHANGED
@@ -4,7 +4,6 @@ import { DataTableColumn } from "mantine-datatable";
4
4
  import { ComponentProps, SVGProps } from "react";
5
5
  import { Dropzone, FileWithPath } from "@mantine/dropzone";
6
6
  import { GetStaticPaths, GetStaticProps, NextApiRequest, NextApiResponse } from "next";
7
-
8
7
  //#region src/components/AttributeTable.d.ts
9
8
  type OcelVersion$1 = "original" | "filtered";
10
9
  declare const AttributesTable: React.FC<{
@@ -39,6 +38,14 @@ declare const FileDropzone: React.FC<{
39
38
  };
40
39
  }>;
41
40
  //#endregion
41
+ //#region src/components/Dropzone/FullScreenUpload.d.ts
42
+ declare const FullScreenUpload: React.FC<{
43
+ onSuccess?: () => void;
44
+ accept?: ComponentProps<typeof Dropzone.FullScreen>["accept"];
45
+ label?: React.ReactNode;
46
+ active?: boolean;
47
+ }>;
48
+ //#endregion
42
49
  //#region src/components/EventHandler.d.ts
43
50
  declare const sseHandler: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
44
51
  //#endregion
@@ -150,11 +157,14 @@ declare const useCurrentOcel: () => {
150
157
  //#region src/hooks/useDownload.d.ts
151
158
  declare const useDownloadFile: () => (path: string) => Promise<void>;
152
159
  declare const useDownloadOCEL: () => {
153
- download: (ocelId: string | null, params?: import("@ocelescope/api-base").DownloadOCELParams | undefined) => void;
160
+ download: (ocelId: string, params?: import("@ocelescope/api-base").DownloadOCELParams | undefined) => void;
154
161
  };
155
162
  declare const useDownloadFlatOCEL: () => {
156
163
  download: (ocelId: string | null, params?: import("@ocelescope/api-base").DownloadFlatLogParams | undefined) => void;
157
164
  };
165
+ declare const useDownloadVariantFlatLog: () => {
166
+ download: (ocelId: string | null, params?: import("@ocelescope/api-base").DownloadVariantFlatLogParams | undefined) => void;
167
+ };
158
168
  declare const useDownloadResource: () => {
159
169
  download: (resourceId: string) => void;
160
170
  };
@@ -163,7 +173,7 @@ declare const useDownloadResourceAsPnml: () => {
163
173
  };
164
174
  //#endregion
165
175
  //#region src/hooks/useInvalidate.d.ts
166
- type InvalidationRouteName = "ocels" | "resources" | "tasks" | "plugins";
176
+ type InvalidationRouteName = "ocels" | "resources" | "tasks" | "plugins" | "discoveryMethods";
167
177
  declare const useInvalidate: () => (routeNames: InvalidationRouteName[]) => Promise<void>;
168
178
  //#endregion
169
179
  //#region src/lib/attributes.d.ts
@@ -185,11 +195,7 @@ declare const env: {
185
195
  };
186
196
  //#endregion
187
197
  //#region src/lib/getModuleRoute.d.ts
188
- declare const getModuleRoute: ({
189
- moduleName,
190
- routeName,
191
- query
192
- }: {
198
+ declare const getModuleRoute: ({ moduleName, routeName, query }: {
193
199
  moduleName: string;
194
200
  routeName?: string;
195
201
  query?: Record<string, string>;
@@ -200,4 +206,4 @@ declare const getModuleRoute: ({
200
206
  pathname: string;
201
207
  };
202
208
  //#endregion
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 };
209
+ export { AttributesTable, BarList, FileDropzone, FullScreenUpload, HelpModal, ModuleDefinition, ModuleRouteDefinition, OcelSelect, OcelescopeApp, OcelescopeConfig, OcelescopeDocument, RelationTable, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useDownloadVariantFlatLog, useInvalidate };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
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
- import { getDownloadFlatLogQueryKey, getDownloadOCELQueryKey, getDownloadResourceAsPnmlQueryKey, getDownloadResourceQueryKey, useActivities, useAggregatedAttributes, useAttributeNames, useE2o, useE2oCombinations, useEventAttributes, useGetDefaultOcel, useGetOcels, useImportDefaultOcel, useLogout, useO2o, useO2oCombinations, useObjectAttributes, useObjectTypes, useUpload } from "@ocelescope/api-base";
2
+ import { getDownloadFlatLogQueryKey, getDownloadOCELQueryKey, getDownloadResourceAsPnmlQueryKey, getDownloadResourceQueryKey, getDownloadVariantFlatLogQueryKey, 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
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";
@@ -422,6 +422,92 @@ const FileDropzone = ({ onUpload, accept, content }) => {
422
422
  });
423
423
  };
424
424
  //#endregion
425
+ //#region src/hooks/useInvalidate.ts
426
+ const ROUTE_PATH = {
427
+ ocels: "ocels",
428
+ resources: "resources",
429
+ tasks: "tasks",
430
+ plugins: "plugins",
431
+ discoveryMethods: "discovery/methods"
432
+ };
433
+ const useInvalidate = () => {
434
+ const queryClient = useQueryClient();
435
+ return async (routeNames) => await queryClient.invalidateQueries({ predicate: (query) => typeof query.queryKey[0] === "string" && routeNames.some((route) => query.queryKey[0].includes(`/${ROUTE_PATH[route]}`)) });
436
+ };
437
+ //#endregion
438
+ //#region src/components/Dropzone/FullScreenUpload.tsx
439
+ const defaultLabel = `Drag'n'drop your ${[
440
+ "OCELs",
441
+ "Plugins",
442
+ "Resources"
443
+ ].join(", ")} here to upload.`;
444
+ const FullScreenUpload = ({ onSuccess, accept, label = defaultLabel, active = true }) => {
445
+ const invalidate = useInvalidate();
446
+ const { mutate: upload, isPending } = useUpload({ mutation: { onSuccess: async () => {
447
+ await invalidate(["tasks"]);
448
+ onSuccess?.();
449
+ } } });
450
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(LoadingOverlay, {
451
+ visible: isPending,
452
+ overlayProps: { blur: 2 }
453
+ }), /* @__PURE__ */ jsx(Dropzone.FullScreen, {
454
+ active,
455
+ accept,
456
+ withinPortal: false,
457
+ styles: {
458
+ fullScreen: {
459
+ position: "absolute",
460
+ padding: 0,
461
+ backgroundColor: "var(--mantine-color-body)"
462
+ },
463
+ root: { backgroundColor: "transparent" },
464
+ inner: {
465
+ height: "100%",
466
+ display: "flex",
467
+ alignItems: "center",
468
+ justifyContent: "center"
469
+ }
470
+ },
471
+ onDrop: (files) => {
472
+ upload({ data: { files } });
473
+ },
474
+ children: /* @__PURE__ */ jsxs(Group, {
475
+ justify: "center",
476
+ gap: "xl",
477
+ mih: 220,
478
+ style: { pointerEvents: "none" },
479
+ children: [
480
+ /* @__PURE__ */ jsx(Dropzone.Accept, { children: /* @__PURE__ */ jsx(DownloadIcon, {
481
+ size: 52,
482
+ color: "var(--mantine-color-blue-6)"
483
+ }) }),
484
+ /* @__PURE__ */ jsx(Dropzone.Reject, { children: /* @__PURE__ */ jsx(XIcon, {
485
+ size: 52,
486
+ color: "var(--mantine-color-red-6)"
487
+ }) }),
488
+ /* @__PURE__ */ jsx(Dropzone.Idle, { children: /* @__PURE__ */ jsx(UploadIcon, {
489
+ size: 52,
490
+ color: "var(--mantine-color-dimmed)"
491
+ }) }),
492
+ /* @__PURE__ */ jsxs("div", {
493
+ style: { textAlign: "center" },
494
+ children: [/* @__PURE__ */ jsx(Text, {
495
+ size: "xl",
496
+ inline: true,
497
+ children: label
498
+ }), /* @__PURE__ */ jsx(Text, {
499
+ size: "sm",
500
+ c: "dimmed",
501
+ inline: true,
502
+ mt: 7,
503
+ children: "Release to start the upload."
504
+ })]
505
+ })
506
+ ]
507
+ })
508
+ })] });
509
+ };
510
+ //#endregion
425
511
  //#region src/components/EventHandler.ts
426
512
  const apiBase = process.env.EXTERNAL_API_BASE_URL ?? "http://localhost:8000";
427
513
  const sseHandler = async (req, res) => {
@@ -466,7 +552,7 @@ const env = z.object({
466
552
  NEXT_PUBLIC_TROUBLESHOOTING_URL: z.url().default("https://www.ocelescope.org/community/troubleshooting/"),
467
553
  NEXT_PUBLIC_REQUEST_FEATURE_URL: z.url().default("https://www.ocelescope.org/community/request-feature/"),
468
554
  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/"),
555
+ NEXT_PUBLIC_REQUEST_ENVIRONMENT_URL: z.url().default("https://www.ocelescope.org/community/request-package/"),
470
556
  NEXT_PUBLIC_CONTACT_EMAIL: z.string().default("ocelescope@pads.rwth-aachen.de")
471
557
  }).transform((env) => ({
472
558
  appVersion: env.NEXT_PUBLIC_APP_VERSION,
@@ -685,12 +771,6 @@ const CurrentOcelSelect = () => {
685
771
  });
686
772
  };
687
773
  //#endregion
688
- //#region src/hooks/useInvalidate.ts
689
- const useInvalidate = () => {
690
- const queryClient = useQueryClient();
691
- return async (routeNames) => await queryClient.invalidateQueries({ predicate: (query) => typeof query.queryKey[0] === "string" && routeNames.some((route) => query.queryKey[0].includes(`/${route}`)) });
692
- };
693
- //#endregion
694
774
  //#region src/components/UploadSection/UploadSection.tsx
695
775
  const DefaultOcels = ({ onSuccess, setIsPending }) => {
696
776
  const { data: ocels = [] } = useGetDefaultOcel({});
@@ -863,7 +943,7 @@ const LogoutButton = () => {
863
943
  w: "100%",
864
944
  children: [/* @__PURE__ */ jsx(Text, {
865
945
  style: { lineHeight: 1 },
866
- children: "Logout"
946
+ children: "Reset Session"
867
947
  }), /* @__PURE__ */ jsx(LogOutIcon, { className: AppShell_module_default.buttonIcon })]
868
948
  })
869
949
  })] });
@@ -943,6 +1023,62 @@ const NavBar = ({ config }) => {
943
1023
  });
944
1024
  };
945
1025
  //#endregion
1026
+ //#region src/components/AppShell/components/OcelescopeLogo.tsx
1027
+ const OcelescopeLogo = ({ size = 32 }) => /* @__PURE__ */ jsxs("svg", {
1028
+ width: size,
1029
+ height: size * 32 / 40,
1030
+ viewBox: "0 0 40 32",
1031
+ fill: "none",
1032
+ xmlns: "http://www.w3.org/2000/svg",
1033
+ children: [
1034
+ /* @__PURE__ */ jsx("circle", {
1035
+ cx: "8",
1036
+ cy: "16",
1037
+ r: "5.6",
1038
+ stroke: "#17a3b8",
1039
+ strokeWidth: "2.2"
1040
+ }),
1041
+ /* @__PURE__ */ jsx("circle", {
1042
+ cx: "8",
1043
+ cy: "16",
1044
+ r: "2.1",
1045
+ fill: "#17a3b8"
1046
+ }),
1047
+ /* @__PURE__ */ jsx("line", {
1048
+ x1: "13.6",
1049
+ y1: "16",
1050
+ x2: "16.6",
1051
+ y2: "16",
1052
+ stroke: "#17a3b8",
1053
+ strokeWidth: "2.2"
1054
+ }),
1055
+ /* @__PURE__ */ jsx("rect", {
1056
+ x: "16.9",
1057
+ y: "9.5",
1058
+ width: "5.4",
1059
+ height: "13",
1060
+ rx: "1.4",
1061
+ stroke: "#17a3b8",
1062
+ strokeWidth: "2.2"
1063
+ }),
1064
+ /* @__PURE__ */ jsx("line", {
1065
+ x1: "22.7",
1066
+ y1: "16",
1067
+ x2: "26",
1068
+ y2: "16",
1069
+ stroke: "#17a3b8",
1070
+ strokeWidth: "2.2"
1071
+ }),
1072
+ /* @__PURE__ */ jsx("circle", {
1073
+ cx: "31.6",
1074
+ cy: "16",
1075
+ r: "5.6",
1076
+ stroke: "#17a3b8",
1077
+ strokeWidth: "2.2"
1078
+ })
1079
+ ]
1080
+ });
1081
+ //#endregion
946
1082
  //#region src/components/AppShell/AppShell.tsx
947
1083
  const AppShell$1 = ({ config, children }) => {
948
1084
  const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(true);
@@ -980,6 +1116,7 @@ const AppShell$1 = ({ config, children }) => {
980
1116
  visibleFrom: "sm",
981
1117
  size: "sm"
982
1118
  }),
1119
+ /* @__PURE__ */ jsx(OcelescopeLogo, { size: 32 }),
983
1120
  /* @__PURE__ */ jsx(Text, {
984
1121
  size: "xs",
985
1122
  c: "dimmed",
@@ -1063,7 +1200,8 @@ const InvalidationRequest = z.object({
1063
1200
  "ocels",
1064
1201
  "resources",
1065
1202
  "tasks",
1066
- "plugins"
1203
+ "plugins",
1204
+ "discoveryMethods"
1067
1205
  ]))
1068
1206
  });
1069
1207
  const ErrorNotification = z.object({
@@ -1079,6 +1217,11 @@ const ServerEventMessage = z.discriminatedUnion("type", [
1079
1217
  ]);
1080
1218
  //#endregion
1081
1219
  //#region src/components/SSEWrapper.tsx
1220
+ const NotificationColorMap = {
1221
+ warning: "yellow",
1222
+ info: "blue",
1223
+ error: "red"
1224
+ };
1082
1225
  const SSEWrapper = () => {
1083
1226
  const { sessionId } = useSessionStore();
1084
1227
  const invalidate = useInvalidate();
@@ -1097,7 +1240,7 @@ const SSEWrapper = () => {
1097
1240
  showNotification({
1098
1241
  title: message.title,
1099
1242
  message: message.message,
1100
- color: "green"
1243
+ color: NotificationColorMap[message.notification_type]
1101
1244
  });
1102
1245
  break;
1103
1246
  case "error":
@@ -1171,7 +1314,11 @@ const OcelescopeDocument = () => {
1171
1314
  return /* @__PURE__ */ jsxs(Html, {
1172
1315
  lang: "en",
1173
1316
  ...mantineHtmlProps,
1174
- children: [/* @__PURE__ */ jsx(Head, { children: /* @__PURE__ */ jsx(ColorSchemeScript, { defaultColorScheme: "auto" }) }), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsx(Main, {}), /* @__PURE__ */ jsx(NextScript, {})] })]
1317
+ children: [/* @__PURE__ */ jsxs(Head, { children: [/* @__PURE__ */ jsx(ColorSchemeScript, { defaultColorScheme: "auto" }), /* @__PURE__ */ jsx("link", {
1318
+ rel: "icon",
1319
+ type: "image/svg+xml",
1320
+ href: "/favicon.svg"
1321
+ })] }), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsx(Main, {}), /* @__PURE__ */ jsx(NextScript, {})] })]
1175
1322
  });
1176
1323
  };
1177
1324
  //#endregion
@@ -1461,6 +1608,7 @@ const useDownloadFromServer = (getQueryKey) => () => {
1461
1608
  };
1462
1609
  const useDownloadOCEL = useDownloadFromServer(getDownloadOCELQueryKey);
1463
1610
  const useDownloadFlatOCEL = useDownloadFromServer(getDownloadFlatLogQueryKey);
1611
+ const useDownloadVariantFlatLog = useDownloadFromServer(getDownloadVariantFlatLogQueryKey);
1464
1612
  const useDownloadResource = useDownloadFromServer(getDownloadResourceQueryKey);
1465
1613
  const useDownloadResourceAsPnml = useDownloadFromServer(getDownloadResourceAsPnmlQueryKey);
1466
1614
  //#endregion
@@ -1468,4 +1616,4 @@ const useDownloadResourceAsPnml = useDownloadFromServer(getDownloadResourceAsPnm
1468
1616
  const defineModule = (def) => def;
1469
1617
  const defineModuleRoute = (def) => def;
1470
1618
  //#endregion
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 };
1619
+ export { AttributesTable, BarList, FileDropzone, FullScreenUpload, HelpModal, OcelSelect, OcelescopeApp, OcelescopeDocument, RelationTable, UploadModal, UploadSection, createModulesPage, defineModule, defineModuleRoute, env, formatAttributeValue, getModuleRoute, sseHandler, useCurrentOcel, useDownloadFile, useDownloadFlatOCEL, useDownloadOCEL, useDownloadResource, useDownloadResourceAsPnml, useDownloadVariantFlatLog, useInvalidate };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocelescope/core",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.5.0",
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",
@@ -28,10 +28,10 @@
28
28
  "access": "public"
29
29
  },
30
30
  "peerDependencies": {
31
- "@mantine/core": "^9.4.0",
32
- "@mantine/dropzone": "^9.4.0",
33
- "@mantine/hooks": "^9.4.0",
34
- "@mantine/notifications": "^9.4.0",
31
+ "@mantine/core": "^9.4.2",
32
+ "@mantine/dropzone": "^9.4.2",
33
+ "@mantine/hooks": "^9.4.2",
34
+ "@mantine/notifications": "^9.4.2",
35
35
  "@marko19907/string-to-color": "^1.0.2",
36
36
  "@tanstack/react-query": "^5.90.21",
37
37
  "@tanstack/react-query-devtools": "^5.91.3",
@@ -40,29 +40,27 @@
40
40
  "dayjs": "^1.11.19",
41
41
  "file-saver": "^2.0.5",
42
42
  "lucide-react": "^1.0.0",
43
- "mantine-datatable": "^9.3.1",
44
- "next": "^16.1.6",
45
- "qs": "^6.15.1",
46
- "react": "^19.2.0",
47
- "react-dom": "^19.2.0",
43
+ "mantine-datatable": "^9.4.0",
44
+ "next": "^16.2.10",
45
+ "qs": "^6.15.3",
46
+ "react": "^19.2.7",
47
+ "react-dom": "^19.2.7",
48
48
  "zod": "^4.3.6",
49
49
  "zustand": "^5.0.11",
50
- "@ocelescope/api-base": "^0.1.0",
51
- "@ocelescope/resources": "^0.1.2",
52
- "@ocelescope/api-client": "^0.1.0"
50
+ "@ocelescope/resources": "^0.5.0",
51
+ "@ocelescope/api-client": "^0.5.0",
52
+ "@ocelescope/api-base": "^0.5.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@mantine/notifications": "^9.4.0",
56
- "@tsdown/css": "^0.22.0",
57
- "@types/css-modules": "^1.0.5",
55
+ "@mantine/notifications": "^9.4.2",
56
+ "@tsdown/css": "^0.22.12",
58
57
  "@types/file-saver": "^2.0.7",
59
- "@types/node": "^25.0.3",
58
+ "@types/node": "^26.1.1",
60
59
  "@types/qs": "^6.15.1",
61
- "@types/react": "^19.2.7",
60
+ "@types/react": "^19.2.17",
62
61
  "@types/react-dom": "^19.2.3",
63
- "bumpp": "^11.0.0",
64
- "qs": "^6.15.1",
65
- "tsdown": "^0.22.0",
62
+ "qs": "^6.15.3",
63
+ "tsdown": "^0.22.12",
66
64
  "typescript": "^5.9.3"
67
65
  },
68
66
  "scripts": {