@jskit-ai/shell-web 0.1.80 → 0.1.81
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/package.descriptor.mjs +2 -2
- package/package.json +2 -2
- package/src/client/lib/menuIcons.js +19 -8
- package/test/menuIcons.test.js +37 -0
package/package.descriptor.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Object.freeze({
|
|
2
2
|
packageVersion: 1,
|
|
3
3
|
packageId: "@jskit-ai/shell-web",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.81",
|
|
5
5
|
kind: "runtime",
|
|
6
6
|
description: "Web shell layout runtime with outlet-based placement contributions.",
|
|
7
7
|
dependsOn: [],
|
|
@@ -291,7 +291,7 @@ export default Object.freeze({
|
|
|
291
291
|
dependencies: {
|
|
292
292
|
runtime: {
|
|
293
293
|
"@mdi/js": "^7.4.47",
|
|
294
|
-
"@jskit-ai/kernel": "0.1.
|
|
294
|
+
"@jskit-ai/kernel": "0.1.82"
|
|
295
295
|
},
|
|
296
296
|
dev: {}
|
|
297
297
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/shell-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@mdi/js": "^7.4.47",
|
|
29
|
-
"@jskit-ai/kernel": "0.1.
|
|
29
|
+
"@jskit-ai/kernel": "0.1.82"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"pinia": "^3.0.4",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as mdiIcons from "@mdi/js";
|
|
2
1
|
import {
|
|
3
2
|
mdiAccountCircleOutline,
|
|
4
3
|
mdiAccountCogOutline,
|
|
@@ -27,6 +26,24 @@ const SURFACE_SWITCH_ICON_BY_ID = Object.freeze({
|
|
|
27
26
|
console: mdiConsoleNetworkOutline
|
|
28
27
|
});
|
|
29
28
|
|
|
29
|
+
const SUPPORTED_EXPLICIT_MDI_ICON_BY_NAME = Object.freeze({
|
|
30
|
+
"mdi-account-circle-outline": mdiAccountCircleOutline,
|
|
31
|
+
"mdi-account-cog-outline": mdiAccountCogOutline,
|
|
32
|
+
"mdi-account-group-outline": mdiAccountGroupOutline,
|
|
33
|
+
"mdi-arrow-right-circle-outline": mdiArrowRightCircleOutline,
|
|
34
|
+
"mdi-clipboard-list-outline": mdiClipboardListOutline,
|
|
35
|
+
"mdi-cog-outline": mdiCogOutline,
|
|
36
|
+
"mdi-console-network-outline": mdiConsoleNetworkOutline,
|
|
37
|
+
"mdi-folder-outline": mdiFolderOutline,
|
|
38
|
+
"mdi-home-variant-outline": mdiHomeVariantOutline,
|
|
39
|
+
"mdi-login": mdiLogin,
|
|
40
|
+
"mdi-logout": mdiLogout,
|
|
41
|
+
"mdi-robot-outline": mdiRobotOutline,
|
|
42
|
+
"mdi-shield-crown-outline": mdiShieldCrownOutline,
|
|
43
|
+
"mdi-view-dashboard-outline": mdiViewDashboardOutline,
|
|
44
|
+
"mdi-view-list-outline": mdiViewListOutline
|
|
45
|
+
});
|
|
46
|
+
|
|
30
47
|
function resolveExplicitIconValue(explicitIcon = "") {
|
|
31
48
|
const normalizedExplicitIcon = normalizeText(explicitIcon);
|
|
32
49
|
if (!normalizedExplicitIcon) {
|
|
@@ -37,13 +54,7 @@ function resolveExplicitIconValue(explicitIcon = "") {
|
|
|
37
54
|
return normalizedExplicitIcon;
|
|
38
55
|
}
|
|
39
56
|
|
|
40
|
-
const
|
|
41
|
-
.slice("mdi-".length)
|
|
42
|
-
.split("-")
|
|
43
|
-
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
44
|
-
.join("");
|
|
45
|
-
const exportName = `mdi${iconKey}`;
|
|
46
|
-
const resolvedIcon = mdiIcons[exportName];
|
|
57
|
+
const resolvedIcon = SUPPORTED_EXPLICIT_MDI_ICON_BY_NAME[normalizedExplicitIcon];
|
|
47
58
|
return typeof resolvedIcon === "string" && resolvedIcon ? resolvedIcon : normalizedExplicitIcon;
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import test from "node:test";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import {
|
|
7
|
+
mdiCogOutline,
|
|
8
|
+
mdiConsoleNetworkOutline,
|
|
9
|
+
mdiViewListOutline
|
|
10
|
+
} from "@mdi/js";
|
|
11
|
+
import {
|
|
12
|
+
resolveMenuLinkIcon,
|
|
13
|
+
resolveSurfaceSwitchIcon
|
|
14
|
+
} from "../src/client/lib/menuIcons.js";
|
|
15
|
+
|
|
16
|
+
const TEST_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const PACKAGE_DIR = path.resolve(TEST_DIRECTORY, "..");
|
|
18
|
+
|
|
19
|
+
test("shell-web resolves supported explicit mdi metadata icons from a finite map", () => {
|
|
20
|
+
assert.equal(resolveMenuLinkIcon({ icon: "mdi-view-list-outline" }), mdiViewListOutline);
|
|
21
|
+
assert.equal(resolveMenuLinkIcon({ icon: "mdi-cog-outline" }), mdiCogOutline);
|
|
22
|
+
assert.equal(
|
|
23
|
+
resolveSurfaceSwitchIcon("home", "mdi-console-network-outline"),
|
|
24
|
+
mdiConsoleNetworkOutline
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("shell-web leaves unknown explicit mdi metadata icons unchanged", () => {
|
|
29
|
+
assert.equal(resolveMenuLinkIcon({ icon: "mdi-not-a-real-supported-icon" }), "mdi-not-a-real-supported-icon");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("shell-web menu icon resolution does not import the full mdi namespace", async () => {
|
|
33
|
+
const source = await readFile(path.join(PACKAGE_DIR, "src", "client", "lib", "menuIcons.js"), "utf8");
|
|
34
|
+
|
|
35
|
+
assert.doesNotMatch(source, /import\s+\*\s+as\s+mdiIcons\s+from\s+["']@mdi\/js["']/);
|
|
36
|
+
assert.doesNotMatch(source, /mdiIcons\[/);
|
|
37
|
+
});
|