@cccsaurora/clue-ui 1.4.0 → 1.4.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/components/ClassificationChip.js +17 -15
- package/components/actions/formats/index.js +1 -1
- package/components/fetchers/FetcherResultView.js +1 -1
- package/hooks/ClueUIPluginContext.d.ts +4 -0
- package/hooks/ClueUIPluginContext.js +20 -19
- package/package.json +1 -1
- package/plugins/store.d.ts +1 -1
- package/plugins/store.js +1 -1
- package/{store-DClHBq7r.js → store-D4aFUWxi.js} +5 -5
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { Tooltip as p, Chip as x } from "@mui/material";
|
|
3
3
|
import D from "../hooks/useClueConfig.js";
|
|
4
4
|
import { getParts as C, normalizedClassification as _ } from "../utils/classificationParser.js";
|
|
5
|
-
import
|
|
6
|
-
const g = ["default", "primary", "secondary", "error", "info", "success", "warning"], A =
|
|
7
|
-
({ classification:
|
|
8
|
-
var
|
|
9
|
-
const { config:
|
|
10
|
-
var c, a,
|
|
11
|
-
|
|
5
|
+
import y, { useMemo as s, memo as v } from "react";
|
|
6
|
+
const g = ["default", "primary", "secondary", "error", "info", "success", "warning"], A = y.memo(
|
|
7
|
+
({ classification: n, ...t }) => {
|
|
8
|
+
var f, i;
|
|
9
|
+
const { config: r } = D(), e = s(() => r.c12nDef ? C(n, r.c12nDef, "short", !0) : null, [n, r.c12nDef]), d = s(() => !r.c12nDef || !e ? n : _(e, r.c12nDef, "short", !0), [n, r.c12nDef, e]), o = s(() => {
|
|
10
|
+
var c, a, u;
|
|
11
|
+
if (!e)
|
|
12
|
+
return { color: "default" };
|
|
13
|
+
const l = (u = (a = r.c12nDef) == null ? void 0 : a.levels_styles_map[(c = r.c12nDef) == null ? void 0 : c.levels_map[e.lvlIdx]]) == null ? void 0 : u.color;
|
|
12
14
|
return g.includes(l) ? { color: l } : l ? { sx: { color: l } } : { color: "default" };
|
|
13
|
-
}, [(
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
+
}, [(f = r.c12nDef) == null ? void 0 : f.levels_map, (i = r.c12nDef) == null ? void 0 : i.levels_styles_map, e]);
|
|
16
|
+
return /* @__PURE__ */ m(p, { title: n, children: /* @__PURE__ */ m(
|
|
15
17
|
x,
|
|
16
18
|
{
|
|
17
|
-
variant:
|
|
19
|
+
variant: t.variant || "outlined",
|
|
18
20
|
label: d,
|
|
19
21
|
...o,
|
|
20
|
-
...
|
|
22
|
+
...t,
|
|
21
23
|
sx: [
|
|
22
24
|
...Array.isArray(o.sx) ? o.sx : [o.sx],
|
|
23
|
-
...Array.isArray(
|
|
25
|
+
...Array.isArray(t.sx) ? t.sx : [t.sx]
|
|
24
26
|
]
|
|
25
27
|
}
|
|
26
28
|
) });
|
|
27
29
|
}
|
|
28
|
-
),
|
|
30
|
+
), b = v(A);
|
|
29
31
|
export {
|
|
30
|
-
|
|
32
|
+
b as default
|
|
31
33
|
};
|
|
@@ -3,7 +3,7 @@ import { Stack as i } from "@mui/material";
|
|
|
3
3
|
import { J as m } from "../../../index-Cj4d5cGz.js";
|
|
4
4
|
import f from "../../display/markdown/index.js";
|
|
5
5
|
import t from "../../ErrorBoundary.js";
|
|
6
|
-
import { u as p, c as s } from "../../../store-
|
|
6
|
+
import { u as p, c as s } from "../../../store-D4aFUWxi.js";
|
|
7
7
|
import { useTranslation as g } from "react-i18next";
|
|
8
8
|
const k = ({
|
|
9
9
|
pluginName: u,
|
|
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { Stack as c } from "@mui/material";
|
|
3
3
|
import { J as m } from "../../index-Cj4d5cGz.js";
|
|
4
4
|
import f from "../display/markdown/index.js";
|
|
5
|
-
import { u as p, c as g } from "../../store-
|
|
5
|
+
import { u as p, c as g } from "../../store-D4aFUWxi.js";
|
|
6
6
|
import { useTranslation as h } from "react-i18next";
|
|
7
7
|
import u from "../ErrorBoundary.js";
|
|
8
8
|
const y = ({
|
|
@@ -17,6 +17,10 @@ export type ClueUIPluginProviderProps = {
|
|
|
17
17
|
* If true, do not load any plugins from the ClueUIPluginsRegistry, only load plugins passed in via props
|
|
18
18
|
*/
|
|
19
19
|
excludeBuiltInPlugins?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* If true, don't print the author information of loaded plugins
|
|
22
|
+
*/
|
|
23
|
+
silent?: boolean;
|
|
20
24
|
};
|
|
21
25
|
export type ClueUIPluginContextType = {
|
|
22
26
|
clueUIPluginStore: ClueUIPluginStore;
|
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { c as i, P as
|
|
4
|
-
import { createContext as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import m from "../plugins/registry.js";
|
|
3
|
+
import { c as i, P as p } from "../store-D4aFUWxi.js";
|
|
4
|
+
import { createContext as C, useState as P, useEffect as v } from "react";
|
|
5
|
+
const w = C(null), h = ({
|
|
6
6
|
plugins: a,
|
|
7
7
|
excludePlugins: o,
|
|
8
8
|
excludeBuiltInPlugins: e,
|
|
9
|
-
|
|
9
|
+
silent: l,
|
|
10
|
+
children: c
|
|
10
11
|
}) => {
|
|
11
|
-
const [
|
|
12
|
-
return
|
|
13
|
-
const t = new AbortController(),
|
|
12
|
+
const [d, u] = P(() => i.pluginStore);
|
|
13
|
+
return v(() => {
|
|
14
|
+
const t = new AbortController(), s = async (r) => {
|
|
14
15
|
try {
|
|
15
16
|
const n = await r.loadPlugin();
|
|
16
17
|
if (t.signal.aborted) return;
|
|
17
|
-
const
|
|
18
|
-
i.install(
|
|
18
|
+
const b = new n.default();
|
|
19
|
+
i.install(b, l);
|
|
19
20
|
} catch (n) {
|
|
20
21
|
if (t.signal.aborted) return;
|
|
21
22
|
console.error(`[ClueUIPluginProvider] Failed to load plugin: ${r.name ?? r.id}`, n);
|
|
22
23
|
}
|
|
23
|
-
},
|
|
24
|
+
}, g = async () => {
|
|
24
25
|
if (a && Array.isArray(a))
|
|
25
26
|
for (const r of a) {
|
|
26
27
|
if (t.signal.aborted) return;
|
|
27
|
-
o != null && o.includes(r.id) || await
|
|
28
|
+
o != null && o.includes(r.id) || await s(r);
|
|
28
29
|
}
|
|
29
30
|
if (!e) {
|
|
30
|
-
const r = new
|
|
31
|
+
const r = new m().getPlugins();
|
|
31
32
|
for (const n of r) {
|
|
32
33
|
if (t.signal.aborted) return;
|
|
33
|
-
o != null && o.includes(n.id) || await
|
|
34
|
+
o != null && o.includes(n.id) || await s(n);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
return i.reset(),
|
|
38
|
+
return i.reset(), u(i.pluginStore), g().catch((r) => {
|
|
38
39
|
t.signal.aborted || console.error("[ClueUIPluginProvider] Failed to load plugins", r);
|
|
39
40
|
}), () => t.abort();
|
|
40
|
-
}, [e, o, a]), /* @__PURE__ */
|
|
41
|
+
}, [e, o, a, l]), /* @__PURE__ */ f(w.Provider, { value: { clueUIPluginStore: i }, children: /* @__PURE__ */ f(p, { pluginStore: d, children: c }) });
|
|
41
42
|
};
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
w as ClueUIPluginContext,
|
|
45
|
+
h as ClueUIPluginProvider
|
|
45
46
|
};
|
package/package.json
CHANGED
package/plugins/store.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class ClueUIPluginStore {
|
|
|
15
15
|
actionPlugins: string[];
|
|
16
16
|
fetcherPlugins: string[];
|
|
17
17
|
reset(): void;
|
|
18
|
-
install(plugin: ClueUIPlugin): void;
|
|
18
|
+
install(plugin: ClueUIPlugin, silent?: boolean): void;
|
|
19
19
|
/**
|
|
20
20
|
* Get plugins based on the given criteria.
|
|
21
21
|
*
|
package/plugins/store.js
CHANGED
|
@@ -1113,11 +1113,11 @@ class Ct {
|
|
|
1113
1113
|
reset() {
|
|
1114
1114
|
this._pluginStore = Br(), this.plugins = [], this.pluginsByFormat = {}, this.pluginsByActionId = {}, this.pluginsByFetcherId = {}, this.actionPlugins = [], this.fetcherPlugins = [];
|
|
1115
1115
|
}
|
|
1116
|
-
install(s) {
|
|
1117
|
-
this.plugins.includes(s.name) || (console.log(`Installing plugin ${s.getPluginName()} by ${s.author}`), this.pluginStore.install(s), this.plugins.push(s.name), s.format && (this.pluginsByFormat[s.format] = [...this.pluginsByFormat[s.format] ?? [], s.name]), s.actionIds && s.actionResult && s.actionIds.forEach((
|
|
1118
|
-
this.pluginsByActionId[
|
|
1119
|
-
}), s.fetcherIds && s.fetcherResult && s.fetcherIds.forEach((
|
|
1120
|
-
this.pluginsByFetcherId[
|
|
1116
|
+
install(s, t = !1) {
|
|
1117
|
+
this.plugins.includes(s.name) || (t || console.log(`Installing plugin ${s.getPluginName()} by ${s.author}`), this.pluginStore.install(s), this.plugins.push(s.name), s.format && (this.pluginsByFormat[s.format] = [...this.pluginsByFormat[s.format] ?? [], s.name]), s.actionIds && s.actionResult && s.actionIds.forEach((r) => {
|
|
1118
|
+
this.pluginsByActionId[r] = [...this.pluginsByActionId[r] ?? [], s.name];
|
|
1119
|
+
}), s.fetcherIds && s.fetcherResult && s.fetcherIds.forEach((r) => {
|
|
1120
|
+
this.pluginsByFetcherId[r] = [...this.pluginsByFetcherId[r] ?? [], s.name];
|
|
1121
1121
|
}), s.actionResult && this.actionPlugins.push(s.name), s.fetcherResult && this.fetcherPlugins.push(s.name));
|
|
1122
1122
|
}
|
|
1123
1123
|
/**
|