@herdingbits/trailhead-core 0.0.9 → 0.0.11

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 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;
@@ -11,7 +15,23 @@ export declare class Trailhead {
11
15
  readonly basePath: string;
12
16
  private readonly shellResourceUrl;
13
17
  readonly adapter: DesignSystemAdapter;
18
+ private readyPromise;
19
+ private readyResolve;
14
20
  constructor(config: ShellConfig);
21
+ /**
22
+ * Get navigation items loaded from navigation.json
23
+ * @returns Array of navigation items
24
+ */
25
+ getNavigation(): NavItem[];
26
+ /**
27
+ * Wait for shell to be ready (adapter has rendered)
28
+ * @returns Promise that resolves when shell is ready
29
+ */
30
+ waitForReady(): Promise<void>;
31
+ /**
32
+ * Notify that shell is ready (called by adapter after rendering)
33
+ */
34
+ notifyReady(): void;
15
35
  /**
16
36
  * Initialize shell
17
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../src/shell.ts"],"names":[],"mappings":"AAIA,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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AEG;YACW,IAAI;IA0BlB;;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
@@ -7,8 +7,31 @@ export class Trailhead {
7
7
  this.basePath = config.basePath || "";
8
8
  this.shellResourceUrl = config.shellResourceUrl || this.basePath;
9
9
  this.adapter = config.adapter;
10
+ this.readyPromise = new Promise((resolve) => {
11
+ this.readyResolve = resolve;
12
+ });
10
13
  this.init(config.apiUrl);
11
14
  }
15
+ /**
16
+ * Get navigation items loaded from navigation.json
17
+ * @returns Array of navigation items
18
+ */
19
+ getNavigation() {
20
+ return this.navigation;
21
+ }
22
+ /**
23
+ * Wait for shell to be ready (adapter has rendered)
24
+ * @returns Promise that resolves when shell is ready
25
+ */
26
+ waitForReady() {
27
+ return this.readyPromise;
28
+ }
29
+ /**
30
+ * Notify that shell is ready (called by adapter after rendering)
31
+ */
32
+ notifyReady() {
33
+ this.readyResolve();
34
+ }
12
35
  /**
13
36
  * Initialize shell
14
37
  */
@@ -26,8 +49,10 @@ export class Trailhead {
26
49
  this.setupRouting();
27
50
  // Render navigation
28
51
  this.renderNavigation();
29
- // Load initial route
30
- this.handleRoute();
52
+ // Wait for adapter to be ready, then load initial route
53
+ this.waitForReady().then(() => {
54
+ this.handleRoute();
55
+ });
31
56
  }
32
57
  /**
33
58
  * Initialize design system adapter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herdingbits/trailhead-core",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
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",