@herdingbits/trailhead-core 0.0.4 → 0.0.7
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/README.md +1 -1
- package/dist/shell.d.ts +2 -0
- package/dist/shell.d.ts.map +1 -1
- package/dist/shell.js +5 -5
- package/package.json +2 -2
- package/dist/lib/i18n.d.ts +0 -7
- package/dist/lib/i18n.d.ts.map +0 -1
- package/dist/lib/i18n.js +0 -6
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ const shell = new Trailhead({
|
|
|
46
46
|
|
|
47
47
|
## Documentation
|
|
48
48
|
|
|
49
|
-
See the [main Trailhead documentation](https://github.com/
|
|
49
|
+
See the [main Trailhead documentation](https://github.com/quicken/trailhead) for more information.
|
|
50
50
|
|
|
51
51
|
## License
|
|
52
52
|
|
package/dist/shell.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ export interface ShellConfig {
|
|
|
3
3
|
adapter: DesignSystemAdapter;
|
|
4
4
|
basePath?: string;
|
|
5
5
|
apiUrl?: string;
|
|
6
|
+
shellResourceUrl?: string;
|
|
6
7
|
}
|
|
7
8
|
export declare class Trailhead {
|
|
8
9
|
private navigation;
|
|
9
10
|
private routeChangeCallbacks;
|
|
10
11
|
readonly basePath: string;
|
|
12
|
+
private readonly shellResourceUrl;
|
|
11
13
|
readonly adapter: DesignSystemAdapter;
|
|
12
14
|
constructor(config: ShellConfig);
|
|
13
15
|
/**
|
package/dist/shell.d.ts.map
CHANGED
|
@@ -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;
|
|
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;IAC1C,SAAgB,OAAO,EAAE,mBAAmB,CAAC;gBAEjC,MAAM,EAAE,WAAW;IAO/B;;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;IAenB;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;YACW,UAAU;CAsCzB"}
|
package/dist/shell.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as http from "./lib/http.js";
|
|
2
2
|
import * as requestManager from "./lib/requestManager.js";
|
|
3
|
-
import { t } from "./lib/i18n.js";
|
|
4
3
|
export class Trailhead {
|
|
5
4
|
constructor(config) {
|
|
6
5
|
this.navigation = [];
|
|
7
6
|
this.routeChangeCallbacks = [];
|
|
8
7
|
this.basePath = config.basePath || "";
|
|
8
|
+
this.shellResourceUrl = config.shellResourceUrl || this.basePath;
|
|
9
9
|
this.adapter = config.adapter;
|
|
10
10
|
this.init(config.apiUrl);
|
|
11
11
|
}
|
|
@@ -117,7 +117,7 @@ export class Trailhead {
|
|
|
117
117
|
*/
|
|
118
118
|
async loadNavigation() {
|
|
119
119
|
try {
|
|
120
|
-
const response = await fetch(`${this.
|
|
120
|
+
const response = await fetch(`${this.shellResourceUrl}/navigation.json`);
|
|
121
121
|
this.navigation = await response.json();
|
|
122
122
|
}
|
|
123
123
|
catch (error) {
|
|
@@ -204,7 +204,7 @@ export class Trailhead {
|
|
|
204
204
|
const root = document.getElementById("shell-content");
|
|
205
205
|
if (!root)
|
|
206
206
|
return;
|
|
207
|
-
root.innerHTML = `<div class="shell-loading"
|
|
207
|
+
root.innerHTML = `<div class="shell-loading">Loading...</div>`;
|
|
208
208
|
try {
|
|
209
209
|
const pluginUrl = `${this.basePath}${appPath}/app.js`;
|
|
210
210
|
const pluginCss = `${this.basePath}${appPath}/${appName}.css`;
|
|
@@ -224,13 +224,13 @@ export class Trailhead {
|
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
script.onerror = () => {
|
|
227
|
-
root.innerHTML = `<div class="shell-error"
|
|
227
|
+
root.innerHTML = `<div class="shell-error">Failed to load application: ${appName}</div>`;
|
|
228
228
|
};
|
|
229
229
|
document.body.appendChild(script);
|
|
230
230
|
}
|
|
231
231
|
catch (error) {
|
|
232
232
|
console.error("Failed to load plugin:", error);
|
|
233
|
-
root.innerHTML = `<div class="shell-error"
|
|
233
|
+
root.innerHTML = `<div class="shell-error">Failed to load application</div>`;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herdingbits/trailhead-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/quicken/trailhead.git",
|
|
44
44
|
"directory": "packages/core"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/dist/lib/i18n.d.ts
DELETED
package/dist/lib/i18n.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/lib/i18n.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,CAAC,GAAI,KAAK,MAAM,KAAG,MAAa,CAAC"}
|