@ocelescope/core 0.10.1 → 0.11.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 (40) hide show
  1. package/README.md +2 -2
  2. package/dist/ActivityPicker-CtFSu1YR.js +31 -0
  3. package/dist/{AreaChart-DoD3LM50.js → AreaChart-BSwN1fMp.js} +6 -6
  4. package/dist/AttributePicker-Cq7luTEi.js +94 -0
  5. package/dist/{BarChart-Cixo5Okd.js → BarChart-CyMePf1z.js} +6 -6
  6. package/dist/E2ORelationPicker-C8EmrbFx.js +45 -0
  7. package/dist/EventAttributePicker-BgEdydek.js +26 -0
  8. package/dist/EventPicker-D5uNOTw1.js +38 -0
  9. package/dist/HistogramChart-CJwvvDUu.js +86 -0
  10. package/dist/{LineChart-CVz-dkJI.js → LineChart-Cbxnm338.js} +6 -6
  11. package/dist/O2ORelationPicker-CryAxxUo.js +43 -0
  12. package/dist/ObjectAttributePicker-D_I3LQsY.js +26 -0
  13. package/dist/ObjectPicker-D-ksQveT.js +38 -0
  14. package/dist/ObjectTypePicker-Bw8Fsktx.js +45 -0
  15. package/dist/{OcelChart-DvGTjJXo.js → OcelChart-DJNM5peW.js} +3 -4
  16. package/dist/OptionPicker-DQ-WYFQZ.js +344 -0
  17. package/dist/{PieChart-DBiASngC.js → PieChart-BmMoI0TY.js} +6 -6
  18. package/dist/{ScatterChart-jIQOjQes.js → ScatterChart-CASPRlZU.js} +6 -6
  19. package/dist/{SqlChart-bwDArK2l.js → SqlChart-cxKpWkyh.js} +34 -35
  20. package/dist/{SunburstChart-D6FhYBHI.js → SunburstChart-Ddx9EaL-.js} +5 -5
  21. package/dist/attributeOptions-COiWnKUS.js +36 -0
  22. package/dist/{cartesian-5TPNWjl_.js → cartesian-CtdS2iZb.js} +2 -3
  23. package/dist/index.d.ts +228 -209
  24. package/dist/index.js +83 -172
  25. package/dist/relationOptions-hEEsEQrx.js +32 -0
  26. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
  27. package/dist/{series-BBXVjHHY.js → series-Bx0HVnSy.js} +2 -3
  28. package/dist/style.css +630 -745
  29. package/dist/{Plot-CxHHyXot.js → useChart-BK4pjGal.js} +29 -5
  30. package/dist/{useCurrentOCEL-BeBa7K0g.js → useCurrentOCEL-BUH5XGje.js} +2 -4
  31. package/dist/useOcelId-BEC6_yRa.js +8 -0
  32. package/dist/{useOcelQuery-D1QM-Zgv.js → useOcelQuery-6vtgZNzz.js} +2 -3
  33. package/dist/useSearch-CdXjjv-a.js +18 -0
  34. package/package.json +25 -26
  35. package/dist/ActivityPicker-DbrGeiC_.js +0 -18
  36. package/dist/EventAttributePicker-Cf2vVKv5.js +0 -27
  37. package/dist/NamePicker-Be-qmr1x.js +0 -43
  38. package/dist/ObjectAttributePicker-CL43EsYt.js +0 -27
  39. package/dist/ObjectTypePicker-CKmszS0y.js +0 -18
  40. package/dist/useOcelId-BSU0-Srk.js +0 -6
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { colorForSeed, useViewerConfig } from "@r4pm/components";
2
3
  import { ThemedPlot } from "@r4pm/components/charts";
3
- //#region src/components/charts/types.ts
4
+ // src/components/charts/types.ts
4
5
  /** How a cell reads once it is a label. */
5
6
  const label = (value) => value == null ? "∅" : String(value);
6
7
  /** A cell as the chart plots it: a number where it is one, else its text. */
@@ -12,8 +13,7 @@ const plotted = (value) => {
12
13
  };
13
14
  /** The first, or only, column holding numbers. */
14
15
  const measureOf = (y) => (Array.isArray(y) ? y[0] : y) ?? "";
15
- //#endregion
16
- //#region src/components/charts/internal/Plot.tsx
16
+ // src/components/charts/internal/Plot.tsx
17
17
  /**
18
18
  * The plot every chart draws on: r4pm's themed Plotly, with the parts that
19
19
  * should look the same everywhere - margins, legend, no mode bar - already set.
@@ -71,5 +71,29 @@ const axis = (title, range) => ({
71
71
  } },
72
72
  ...range && { range: [...range] }
73
73
  });
74
- //#endregion
75
- export { plotted as a, measureOf as i, axis as n, label as r, Plot as t };
74
+ // src/components/charts/internal/useChart.ts
75
+ /**
76
+ * A chart's props with colour and selection resolved the way every r4pm
77
+ * viewer does: the chart's own prop, else the ambient `ViewerConfig`, else
78
+ * the hash. Both come back bound to the chart's scope, which is all the
79
+ * traces need.
80
+ */
81
+ const useChart = ({ rows, x, y, series, colorScope, colorOf, onSelect }) => {
82
+ const config = useViewerConfig({
83
+ colorOf,
84
+ onSelect
85
+ });
86
+ return {
87
+ rows,
88
+ x,
89
+ y,
90
+ series,
91
+ ...colorScope && { colorOf: (name) => config.colorOf?.(colorScope, name) ?? colorForSeed(name) },
92
+ ...config.onSelect && { onSelect: (name, point) => config.onSelect?.({
93
+ scope: colorScope ?? x,
94
+ key: name,
95
+ data: point
96
+ }) }
97
+ };
98
+ };
99
+ export { measureOf as a, label as i, Plot as n, plotted as o, axis as r, useChart as t };
@@ -3,14 +3,13 @@ import { useEffect } from "react";
3
3
  import { env } from "@ocelescope/api-client";
4
4
  import { create } from "zustand";
5
5
  import { persist } from "zustand/middleware";
6
- //#region src/store/currentOcelStore.ts
6
+ // src/store/currentOcelStore.ts
7
7
  const useCurrentOcelStore = create()(persist((set) => ({
8
8
  ocelId: null,
9
9
  setOcel: (id) => set({ ocelId: id }),
10
10
  clearOcel: () => set({ ocelId: null })
11
11
  }), { name: env.current_ocel_id }));
12
- //#endregion
13
- //#region src/hooks/useCurrentOCEL.ts
12
+ // src/hooks/useCurrentOCEL.ts
14
13
  const useCurrentOcel = () => {
15
14
  const { data: ocels = [], isSuccess } = useGetOcels();
16
15
  const { ocelId, setOcel, clearOcel } = useCurrentOcelStore();
@@ -30,5 +29,4 @@ const useCurrentOcel = () => {
30
29
  setCurrentOcel: setOcel
31
30
  };
32
31
  };
33
- //#endregion
34
32
  export { useCurrentOcel as t };
@@ -0,0 +1,8 @@
1
+ import { t as useCurrentOcel } from "./useCurrentOCEL-BUH5XGje.js";
2
+ // src/components/Pickers/internal/useOcelId.ts
3
+ /** The OCEL a picker reads: the one it was given, else the selected one. */
4
+ const useOcelId = (ocelId) => {
5
+ const current = useCurrentOcel();
6
+ return ocelId ?? current.id;
7
+ };
8
+ export { useOcelId as t };
@@ -1,7 +1,7 @@
1
- import { t as useCurrentOcel } from "./useCurrentOCEL-BeBa7K0g.js";
1
+ import { t as useCurrentOcel } from "./useCurrentOCEL-BUH5XGje.js";
2
2
  import { useRunSqlQuery } from "@ocelescope/api-base";
3
3
  import { useMemo } from "react";
4
- //#region src/hooks/useOcelQuery.ts
4
+ // src/hooks/useOcelQuery.ts
5
5
  /**
6
6
  * Run SQL against the current OCEL.
7
7
  *
@@ -30,5 +30,4 @@ const sqlError = (error) => {
30
30
  const detail = error?.response?.data?.detail;
31
31
  return detail ? new Error(detail) : error;
32
32
  };
33
- //#endregion
34
33
  export { useOcelQuery as t };
@@ -0,0 +1,18 @@
1
+ import { useEffect, useState } from "react";
2
+ // src/components/Pickers/internal/useSearch.ts
3
+ const DELAY_MS = 300;
4
+ /** What the reader has typed, slowed to one request per pause in typing. */
5
+ const useSearch = () => {
6
+ const [search, setSearch] = useState("");
7
+ const [debounced, setDebounced] = useState("");
8
+ useEffect(() => {
9
+ const timer = setTimeout(() => setDebounced(search), DELAY_MS);
10
+ return () => clearTimeout(timer);
11
+ }, [search]);
12
+ return {
13
+ search,
14
+ setSearch,
15
+ debounced: debounced || void 0
16
+ };
17
+ };
18
+ export { useSearch as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocelescope/core",
3
3
  "type": "module",
4
- "version": "0.10.1",
4
+ "version": "0.11.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,43 +28,42 @@
28
28
  "access": "public"
29
29
  },
30
30
  "peerDependencies": {
31
- "@mantine/core": "^9.5.1",
32
- "@mantine/dropzone": "^9.5.1",
33
- "@mantine/hooks": "^9.5.1",
34
- "@mantine/notifications": "^9.5.1",
31
+ "@mantine/core": "^9.7.4",
32
+ "@mantine/dropzone": "^9.7.4",
33
+ "@mantine/hooks": "^9.7.4",
34
+ "@mantine/notifications": "^9.7.4",
35
35
  "@marko19907/string-to-color": "^1.0.2",
36
- "@ocelescope/api-base": "^0.10.1",
37
- "@ocelescope/api-client": "^0.10.1",
38
- "@ocelescope/resources": "^0.10.1",
39
- "@tanstack/react-query": "^5.90.21",
40
- "@tanstack/react-query-devtools": "^5.91.3",
41
- "@r4pm/components": "^0.3.2",
36
+ "@ocelescope/api-base": "^0.11.0",
37
+ "@ocelescope/api-client": "^0.11.0",
38
+ "@ocelescope/resources": "^0.11.0",
39
+ "@tanstack/react-query": "^5.105.0",
40
+ "@tanstack/react-query-devtools": "^5.105.0",
41
+ "@r4pm/components": "^0.4.0",
42
42
  "clsx": "^2.1.1",
43
43
  "content-disposition-attachment": "^0.3.1",
44
44
  "dayjs": "^1.11.23",
45
45
  "file-saver": "^2.0.5",
46
- "lucide-react": "^1.0.0",
46
+ "lucide-react": "^1.63.0",
47
47
  "mantine-datatable": "^9.4.0",
48
- "next": "16.3.6",
49
- "qs": "^6.16.0",
50
- "react": "^19.3.0",
51
- "react-dom": "^19.3.0",
52
- "zod": "^4.6.5",
53
- "zustand": "^5.0.15"
48
+ "next": "16.4.3",
49
+ "qs": "^6.17.0",
50
+ "react": "^19.3.1",
51
+ "react-dom": "^19.3.1",
52
+ "zod": "^4.6.7",
53
+ "zustand": "^5.0.16"
54
54
  },
55
55
  "devDependencies": {
56
- "@mantine/charts": "^9.5.1",
57
- "@mantine/dates": "^9.5.1",
58
- "@mantine/notifications": "^9.5.1",
59
- "@tsdown/css": "^0.23.0",
56
+ "@mantine/dates": "^9.7.4",
57
+ "@mantine/notifications": "^9.7.4",
58
+ "@tsdown/css": "^0.23.3",
60
59
  "@types/file-saver": "^2.0.7",
61
- "@types/node": "^26.6.1",
60
+ "@types/node": "^26.6.5",
62
61
  "@types/qs": "^6.15.1",
63
62
  "@types/react": "^19.3.0",
64
63
  "@types/react-dom": "^19.3.0",
65
- "@xyflow/react": "^12.11.3",
66
- "qs": "^6.16.0",
67
- "tsdown": "^0.23.0",
64
+ "@xyflow/react": "^12.12.0",
65
+ "qs": "^6.17.0",
66
+ "tsdown": "^0.23.3",
68
67
  "typescript": "^6.0.3"
69
68
  },
70
69
  "scripts": {
@@ -1,18 +0,0 @@
1
- import { t as useOcelId } from "./useOcelId-BSU0-Srk.js";
2
- import { NamePicker } from "./NamePicker-Be-qmr1x.js";
3
- import { useEventCounts } from "@ocelescope/api-base";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/components/pickers/ActivityPicker.tsx
6
- /** The log's activities, by how often they occur. */
7
- const ActivityPicker = ({ ocelId, ocelVersion = "filtered", ...picker }) => {
8
- const id = useOcelId(ocelId);
9
- const { data, isPending } = useEventCounts(id, { ocel_version: ocelVersion }, { query: { enabled: id != null } });
10
- return /* @__PURE__ */ jsx(NamePicker, {
11
- items: data ?? {},
12
- scope: "activity",
13
- loading: isPending,
14
- ...picker
15
- });
16
- };
17
- //#endregion
18
- export { ActivityPicker };
@@ -1,27 +0,0 @@
1
- import { t as useOcelId } from "./useOcelId-BSU0-Srk.js";
2
- import { NamePicker } from "./NamePicker-Be-qmr1x.js";
3
- import { useEventAttributes } from "@ocelescope/api-base";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/components/pickers/EventAttributePicker.tsx
6
- /** The attributes events carry, counted by how many values each takes. */
7
- const EventAttributePicker = ({ activity, ocelId, ocelVersion = "filtered", ...picker }) => {
8
- const id = useOcelId(ocelId);
9
- const { data, isPending } = useEventAttributes(id, {
10
- ocel_version: ocelVersion,
11
- ...activity ? { names: [activity] } : {}
12
- }, { query: { enabled: id != null } });
13
- return /* @__PURE__ */ jsx(NamePicker, {
14
- items: (data ?? []).map((attribute) => ({
15
- key: attribute.name,
16
- count: attribute.distinct_values
17
- })),
18
- scope: "attribute",
19
- loading: isPending,
20
- bars: false,
21
- cutoff: false,
22
- sort: "name",
23
- ...picker
24
- });
25
- };
26
- //#endregion
27
- export { EventAttributePicker };
@@ -1,43 +0,0 @@
1
- import { Stack, Text } from "@mantine/core";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { FrequencyPicker } from "@r4pm/components";
4
- //#region src/components/pickers/types.ts
5
- /** The names as a set, which is how the pickers themselves hold them. */
6
- const chosen = (selection) => new Set(selection.multiple ? selection.value : selection.value == null ? [] : [selection.value]);
7
- /** Report a set back as the one name, or the list, the caller asked for. */
8
- const report = (selection, names) => {
9
- const list = [...names];
10
- if (selection.multiple) selection.onChange(list);
11
- else selection.onChange(list[0]);
12
- };
13
- //#endregion
14
- //#region src/components/pickers/NamePicker.tsx
15
- /**
16
- * Picking names out of a list, with what is known about how often each occurs.
17
- *
18
- * Presentational: it is handed the names and reports back what was picked.
19
- * `ActivityPicker` and the others wrap it around an endpoint.
20
- */
21
- const NamePicker = ({ items, label, searchable = true, bars = true, counts = true, cutoff = false, sort = "count", scope = "name", loading = false, emptyText, disabled = false, autoFocus, ...selection }) => /* @__PURE__ */ jsxs(Stack, {
22
- gap: 4,
23
- children: [label && /* @__PURE__ */ jsx(Text, {
24
- size: "xs",
25
- c: "dimmed",
26
- children: label
27
- }), /* @__PURE__ */ jsx(FrequencyPicker, {
28
- items,
29
- mode: selection.multiple ? "multi" : "single",
30
- value: chosen(selection),
31
- onChange: (next) => !disabled && report(selection, next),
32
- searchable,
33
- showBars: bars,
34
- showCounts: counts,
35
- showCutoff: cutoff,
36
- sort,
37
- scope,
38
- autoFocus,
39
- emptyText: emptyText ?? (loading ? "Reading the OCEL…" : "Nothing here")
40
- })]
41
- });
42
- //#endregion
43
- export { NamePicker };
@@ -1,27 +0,0 @@
1
- import { t as useOcelId } from "./useOcelId-BSU0-Srk.js";
2
- import { NamePicker } from "./NamePicker-Be-qmr1x.js";
3
- import { useObjectAttributes } from "@ocelescope/api-base";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/components/pickers/ObjectAttributePicker.tsx
6
- /** The attributes objects carry, counted by how many values each takes. */
7
- const ObjectAttributePicker = ({ objectType, ocelId, ocelVersion = "filtered", ...picker }) => {
8
- const id = useOcelId(ocelId);
9
- const { data, isPending } = useObjectAttributes(id, {
10
- ocel_version: ocelVersion,
11
- ...objectType ? { names: [objectType] } : {}
12
- }, { query: { enabled: id != null } });
13
- return /* @__PURE__ */ jsx(NamePicker, {
14
- items: (data ?? []).map((attribute) => ({
15
- key: attribute.name,
16
- count: attribute.distinct_values
17
- })),
18
- scope: "attribute",
19
- loading: isPending,
20
- bars: false,
21
- cutoff: false,
22
- sort: "name",
23
- ...picker
24
- });
25
- };
26
- //#endregion
27
- export { ObjectAttributePicker };
@@ -1,18 +0,0 @@
1
- import { t as useOcelId } from "./useOcelId-BSU0-Srk.js";
2
- import { NamePicker } from "./NamePicker-Be-qmr1x.js";
3
- import { useObjectCounts } from "@ocelescope/api-base";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/components/pickers/ObjectTypePicker.tsx
6
- /** The log's object types, by how often they occur. */
7
- const ObjectTypePicker = ({ ocelId, ocelVersion = "filtered", ...picker }) => {
8
- const id = useOcelId(ocelId);
9
- const { data, isPending } = useObjectCounts(id, { ocel_version: ocelVersion }, { query: { enabled: id != null } });
10
- return /* @__PURE__ */ jsx(NamePicker, {
11
- items: data ?? {},
12
- scope: "objectType",
13
- loading: isPending,
14
- ...picker
15
- });
16
- };
17
- //#endregion
18
- export { ObjectTypePicker };
@@ -1,6 +0,0 @@
1
- import { t as useCurrentOcel } from "./useCurrentOCEL-BeBa7K0g.js";
2
- //#region src/components/pickers/internal/useOcelId.ts
3
- /** The OCEL a picker reads: the one it was given, else the selected one. */
4
- const useOcelId = (ocelId) => ocelId ?? useCurrentOcel().id;
5
- //#endregion
6
- export { useOcelId as t };