@herdingbits/trailhead-core 0.0.8 → 0.0.10
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/dist/shell.d.ts +9 -0
- package/dist/shell.d.ts.map +1 -1
- package/dist/shell.js +14 -1
- package/package.json +1 -1
package/dist/shell.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trailhead Core Shell - Design system agnostic orchestration
|
|
3
|
+
*/
|
|
4
|
+
import type { NavItem } from "./types/shell-api.js";
|
|
1
5
|
import type { DesignSystemAdapter } from "./adapters/types.js";
|
|
2
6
|
export interface ShellConfig {
|
|
3
7
|
adapter: DesignSystemAdapter;
|
|
@@ -12,6 +16,11 @@ export declare class Trailhead {
|
|
|
12
16
|
private readonly shellResourceUrl;
|
|
13
17
|
readonly adapter: DesignSystemAdapter;
|
|
14
18
|
constructor(config: ShellConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Get navigation items loaded from navigation.json
|
|
21
|
+
* @returns Array of navigation items
|
|
22
|
+
*/
|
|
23
|
+
getNavigation(): NavItem[];
|
|
15
24
|
/**
|
|
16
25
|
* Initialize shell
|
|
17
26
|
*/
|
package/dist/shell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../src/shell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../src/shell.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,oBAAoB,CAAqC;IACjE,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,SAAgB,OAAO,EAAE,mBAAmB,CAAC;gBAEjC,MAAM,EAAE,WAAW;IAO/B;;;OAGG;IACI,aAAa,IAAI,OAAO,EAAE;IAIjC;;OAEG;YACW,IAAI;IAwBlB;;OAEG;YACW,WAAW;IAUzB;;OAEG;IACH,OAAO,CAAC,SAAS;IAmFjB;;OAEG;YACW,cAAc;IAU5B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA6BxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAMpB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;OAEG;IACH,OAAO,CAAC,WAAW;IAsBnB;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;YACW,UAAU;CAsCzB"}
|
package/dist/shell.js
CHANGED
|
@@ -9,6 +9,13 @@ export class Trailhead {
|
|
|
9
9
|
this.adapter = config.adapter;
|
|
10
10
|
this.init(config.apiUrl);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Get navigation items loaded from navigation.json
|
|
14
|
+
* @returns Array of navigation items
|
|
15
|
+
*/
|
|
16
|
+
getNavigation() {
|
|
17
|
+
return this.navigation;
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
20
|
* Initialize shell
|
|
14
21
|
*/
|
|
@@ -177,7 +184,13 @@ export class Trailhead {
|
|
|
177
184
|
}
|
|
178
185
|
const navItem = this.navigation.find((item) => path.startsWith(item.path));
|
|
179
186
|
if (navItem) {
|
|
180
|
-
|
|
187
|
+
// Skip loading if app is already mounted (dev mode)
|
|
188
|
+
const shellContent = document.getElementById("shell-content");
|
|
189
|
+
const rootElement = shellContent?.querySelector("#root");
|
|
190
|
+
const isAlreadyMounted = rootElement && rootElement.children.length > 0;
|
|
191
|
+
if (!isAlreadyMounted) {
|
|
192
|
+
this.loadPlugin(navItem.app, navItem.path);
|
|
193
|
+
}
|
|
181
194
|
this.updateActiveNav(navItem.path);
|
|
182
195
|
}
|
|
183
196
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herdingbits/trailhead-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Simple application shell that orchestrates multiple SPAs. No webpack magic, just the browser's native module system.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|