@ocelescope/core 0.0.1 → 0.1.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 +661 -0
- package/README.md +82 -14
- package/dist/index.d.ts +126 -14
- package/dist/index.js +1065 -465
- package/dist/style.css +9861 -0
- package/package.json +23 -17
- package/dist/index.css +0 -2
- package/dist/styles/styles.d.ts +0 -3
- package/dist/styles/styles.js +0 -4
package/README.md
CHANGED
|
@@ -1,29 +1,97 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ocelescope/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Core React component and style library for [Ocelescope](https://github.com/promi4s/ocelescope).
|
|
4
|
+
It provides the application shell, the module system and the shared UI building
|
|
5
|
+
blocks that every Ocelescope frontend module is built on.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
It is built on [Mantine](https://mantine.dev/) for UI and
|
|
8
|
+
[TanStack Query](https://tanstack.com/query) for data fetching, and is designed
|
|
9
|
+
to run inside a [Next.js](https://nextjs.org/) (Pages Router) app.
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
## Installation
|
|
8
12
|
|
|
9
13
|
```bash
|
|
10
|
-
|
|
14
|
+
pnpm add @ocelescope/core
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
`@ocelescope/core` relies on a number of peer dependencies (notably `react`,
|
|
18
|
+
`react-dom`, `next`, `@mantine/*`, `@tanstack/react-query`, `dayjs` and
|
|
19
|
+
`zustand`). When building a full app you normally install them alongside the
|
|
20
|
+
Ocelescope packages — see the [app template](https://github.com/promi4s/ocelescope)
|
|
21
|
+
for a complete setup.
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Setting up the app (Next.js Pages Router)
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
// pages/_app.tsx
|
|
29
|
+
import "@ocelescope/core/styles.css";
|
|
30
|
+
import { OcelescopeApp } from "@ocelescope/core";
|
|
31
|
+
import config from "../ocelescope.config";
|
|
32
|
+
|
|
33
|
+
export default OcelescopeApp(config);
|
|
17
34
|
```
|
|
18
35
|
|
|
19
|
-
|
|
36
|
+
```tsx
|
|
37
|
+
// pages/_document.tsx
|
|
38
|
+
import { OcelescopeDocument } from "@ocelescope/core";
|
|
20
39
|
|
|
21
|
-
|
|
22
|
-
npm run test
|
|
40
|
+
export default OcelescopeDocument;
|
|
23
41
|
```
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
```tsx
|
|
44
|
+
// pages/[[...slug]].tsx — renders the registered modules
|
|
45
|
+
import { createModulesPage } from "@ocelescope/core";
|
|
46
|
+
import config from "../ocelescope.config";
|
|
26
47
|
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
const page = createModulesPage(config);
|
|
49
|
+
|
|
50
|
+
export const getStaticPaths = page.getStaticPaths;
|
|
51
|
+
export const getStaticProps = page.getStaticProps;
|
|
52
|
+
export default page.ModulePage;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
// ocelescope.config.ts — register modules
|
|
57
|
+
import type { OcelescopeConfig } from "@ocelescope/core";
|
|
58
|
+
import ocelot from "@ocelescope/ocelot";
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
modules: [ocelot],
|
|
62
|
+
} satisfies OcelescopeConfig;
|
|
29
63
|
```
|
|
64
|
+
|
|
65
|
+
### Defining a module
|
|
66
|
+
|
|
67
|
+
A module bundles metadata and one or more routes:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { defineModule, defineModuleRoute } from "@ocelescope/core";
|
|
71
|
+
import { TableIcon } from "lucide-react";
|
|
72
|
+
import EventsView from "./routes/events";
|
|
73
|
+
|
|
74
|
+
const eventsRoute = defineModuleRoute({
|
|
75
|
+
name: "events",
|
|
76
|
+
label: "Events",
|
|
77
|
+
requiresOcel: true,
|
|
78
|
+
component: EventsView,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export default defineModule({
|
|
82
|
+
name: "example",
|
|
83
|
+
label: "Example",
|
|
84
|
+
description: "An example Ocelescope module",
|
|
85
|
+
authors: [{ name: "Your Name" }],
|
|
86
|
+
icon: TableIcon,
|
|
87
|
+
routes: [eventsRoute],
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## About
|
|
92
|
+
|
|
93
|
+
Part of [Ocelescope](https://github.com/promi4s/ocelescope), a framework for
|
|
94
|
+
working with Object-Centric Event Logs (OCEL) developed at the Chair of Process
|
|
95
|
+
and Data Science (PADS), RWTH Aachen University.
|
|
96
|
+
|
|
97
|
+
📖 Documentation: <https://www.ocelescope.org>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { MantineStyleProps } from "@mantine/core";
|
|
2
|
+
import { AggregatedAttribute, RelationCountSummary, TypedAttribute, ValueType } from "@ocelescope/api-base";
|
|
3
|
+
import { DataTableColumn } from "mantine-datatable";
|
|
4
|
+
import { ComponentProps, SVGProps } from "react";
|
|
5
|
+
import { Dropzone, FileWithPath } from "@mantine/dropzone";
|
|
6
|
+
import { GetStaticPaths, GetStaticProps, NextApiRequest, NextApiResponse } from "next";
|
|
5
7
|
|
|
8
|
+
//#region src/components/AttributeTable.d.ts
|
|
9
|
+
type OcelVersion$1 = "original" | "filtered";
|
|
10
|
+
declare const AttributesTable: React.FC<{
|
|
11
|
+
ocelId: string;
|
|
12
|
+
entityType?: "events" | "objects";
|
|
13
|
+
extraColumns?: DataTableColumn<AggregatedAttribute>[];
|
|
14
|
+
subTableExtraColumns?: DataTableColumn<TypedAttribute>[];
|
|
15
|
+
hideRange?: boolean;
|
|
16
|
+
hideValues?: boolean;
|
|
17
|
+
ocelVersion?: OcelVersion$1;
|
|
18
|
+
alwaysExpandable?: boolean;
|
|
19
|
+
visibleAttributes?: string[];
|
|
20
|
+
}>;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/components/BarList/BarList.d.ts
|
|
23
|
+
declare const BarList: React.FC<{
|
|
24
|
+
data: Record<string, number>;
|
|
25
|
+
labelHeader: string;
|
|
26
|
+
valueHeader?: string;
|
|
27
|
+
maxVisibleItems?: number;
|
|
28
|
+
}>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/Dropzone/Dropzone.d.ts
|
|
31
|
+
declare const FileDropzone: React.FC<{
|
|
32
|
+
onUpload: (files: FileWithPath[]) => void;
|
|
33
|
+
accept?: ComponentProps<typeof Dropzone>["accept"];
|
|
34
|
+
content: {
|
|
35
|
+
accept?: React.ReactNode;
|
|
36
|
+
reject?: React.ReactNode;
|
|
37
|
+
idle?: React.ReactNode;
|
|
38
|
+
description?: React.ReactNode;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/EventHandler.d.ts
|
|
43
|
+
declare const sseHandler: (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
|
|
44
|
+
//#endregion
|
|
6
45
|
//#region src/lib/config.d.ts
|
|
7
46
|
type Author = {
|
|
8
47
|
name: string;
|
|
@@ -23,24 +62,25 @@ type ModuleRouteDefinition = {
|
|
|
23
62
|
component: React.ComponentType;
|
|
24
63
|
};
|
|
25
64
|
type OcelescopeConfig = {
|
|
26
|
-
homePage?: React.FC;
|
|
27
65
|
modules?: readonly ModuleDefinition[];
|
|
66
|
+
navbarGroups?: {
|
|
67
|
+
title?: string;
|
|
68
|
+
modulesNames: string[];
|
|
69
|
+
}[];
|
|
28
70
|
};
|
|
29
71
|
declare const defineModule: (def: ModuleDefinition) => ModuleDefinition;
|
|
30
72
|
declare const defineModuleRoute: (def: ModuleRouteDefinition) => ModuleRouteDefinition;
|
|
31
73
|
//#endregion
|
|
32
74
|
//#region src/components/ModulePage.d.ts
|
|
33
75
|
type ModulePageProps = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
routeName: string;
|
|
37
|
-
};
|
|
76
|
+
moduleName: string;
|
|
77
|
+
routeName: string;
|
|
38
78
|
};
|
|
39
79
|
declare const createModulesPage: (config: OcelescopeConfig) => {
|
|
40
80
|
getStaticPaths: GetStaticPaths;
|
|
41
81
|
getStaticProps: GetStaticProps<ModulePageProps>;
|
|
42
|
-
ModulePage:
|
|
43
|
-
getInitialProps?(context:
|
|
82
|
+
ModulePage: import("react").FunctionComponent<ModulePageProps> & {
|
|
83
|
+
getInitialProps?(context: import("next").NextPageContext): ModulePageProps | Promise<ModulePageProps>;
|
|
44
84
|
};
|
|
45
85
|
};
|
|
46
86
|
//#endregion
|
|
@@ -50,12 +90,84 @@ declare const OcelescopeApp: (config: OcelescopeConfig) => React.FC<any>;
|
|
|
50
90
|
//#region src/components/OcelescopeDocument.d.ts
|
|
51
91
|
declare const OcelescopeDocument: React.FC;
|
|
52
92
|
//#endregion
|
|
93
|
+
//#region src/components/OcelSelect/OcelSelect.d.ts
|
|
94
|
+
type OcelSelectProps = {
|
|
95
|
+
extension?: string;
|
|
96
|
+
value?: string | null;
|
|
97
|
+
onChange?: (value: string | null) => void;
|
|
98
|
+
label?: React.ReactNode;
|
|
99
|
+
description?: React.ReactNode;
|
|
100
|
+
error?: React.ReactNode;
|
|
101
|
+
placeholder?: string;
|
|
102
|
+
required?: boolean;
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
w?: MantineStyleProps["w"];
|
|
105
|
+
};
|
|
106
|
+
declare const OcelSelect: React.FC<OcelSelectProps>;
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/components/RelationTable.d.ts
|
|
109
|
+
type RelationType = "o2o" | "e2o";
|
|
110
|
+
type Direction = "source" | "target";
|
|
111
|
+
type OcelVersion = "original" | "filtered";
|
|
112
|
+
declare const RelationTable: React.FC<{
|
|
113
|
+
ocelId: string;
|
|
114
|
+
relationType?: RelationType;
|
|
115
|
+
direction?: Direction;
|
|
116
|
+
extraColumns?: DataTableColumn<RelationCountSummary>[];
|
|
117
|
+
subTableExtraColumns?: DataTableColumn<RelationCountSummary>[];
|
|
118
|
+
hideRange?: boolean;
|
|
119
|
+
hideTotal?: boolean;
|
|
120
|
+
ocelVersion?: OcelVersion;
|
|
121
|
+
visibleRelations?: {
|
|
122
|
+
source: string;
|
|
123
|
+
target: string;
|
|
124
|
+
}[];
|
|
125
|
+
}>;
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/components/UploadModal/UploadModal.d.ts
|
|
128
|
+
declare const UploadModal: React.FC<{
|
|
129
|
+
visible: boolean;
|
|
130
|
+
onClose: () => void;
|
|
131
|
+
}>;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/components/UploadSection/UploadSection.d.ts
|
|
134
|
+
declare const UploadSection: React.FC<{
|
|
135
|
+
onSuccess?: () => void;
|
|
136
|
+
}>;
|
|
137
|
+
//#endregion
|
|
53
138
|
//#region src/hooks/useCurrentOCEL.d.ts
|
|
54
139
|
declare const useCurrentOcel: () => {
|
|
55
140
|
id: string | null;
|
|
56
141
|
setCurrentOcel: (id: string) => void;
|
|
57
142
|
};
|
|
58
143
|
//#endregion
|
|
144
|
+
//#region src/hooks/useDownload.d.ts
|
|
145
|
+
declare const useDownloadFile: () => (path: string) => Promise<void>;
|
|
146
|
+
declare const useDownloadOCEL: () => {
|
|
147
|
+
download: (ocelId: string | null, params?: import("@ocelescope/api-base").DownloadOCELParams | undefined) => void;
|
|
148
|
+
};
|
|
149
|
+
declare const useDownloadFlatOCEL: () => {
|
|
150
|
+
download: (ocelId: string | null, params?: import("@ocelescope/api-base").DownloadFlatLogParams | undefined) => void;
|
|
151
|
+
};
|
|
152
|
+
declare const useDownloadResource: () => {
|
|
153
|
+
download: (resourceId: string) => void;
|
|
154
|
+
};
|
|
155
|
+
declare const useDownloadResourceAsPnml: () => {
|
|
156
|
+
download: (resourceId: string) => void;
|
|
157
|
+
};
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/hooks/useInvalidate.d.ts
|
|
160
|
+
type InvalidationRouteName = "ocels" | "resources" | "tasks" | "plugins";
|
|
161
|
+
declare const useInvalidate: () => (routeNames: InvalidationRouteName[]) => Promise<void>;
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/lib/attributes.d.ts
|
|
164
|
+
declare const formatAttributeValue: (type: ValueType, value: string | number) => string | number;
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/lib/env.d.ts
|
|
167
|
+
declare const env: {
|
|
168
|
+
projectPage: string;
|
|
169
|
+
};
|
|
170
|
+
//#endregion
|
|
59
171
|
//#region src/lib/getModuleRoute.d.ts
|
|
60
172
|
declare const getModuleRoute: ({
|
|
61
173
|
moduleName,
|
|
@@ -63,13 +175,13 @@ declare const getModuleRoute: ({
|
|
|
63
175
|
query
|
|
64
176
|
}: {
|
|
65
177
|
moduleName: string;
|
|
66
|
-
routeName
|
|
178
|
+
routeName?: string;
|
|
67
179
|
query?: Record<string, string>;
|
|
68
180
|
}) => {
|
|
69
181
|
query?: {
|
|
70
182
|
[x: string]: string;
|
|
71
|
-
};
|
|
183
|
+
} | undefined;
|
|
72
184
|
pathname: string;
|
|
73
185
|
};
|
|
74
186
|
//#endregion
|
|
75
|
-
export { ModuleDefinition, ModuleRouteDefinition, OcelescopeApp, OcelescopeConfig, OcelescopeDocument, createModulesPage, defineModule, defineModuleRoute, getModuleRoute, useCurrentOcel };
|
|
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 };
|