@herdingbits/trailhead-cloudscape 0.0.4 → 0.0.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"shell-app.d.ts","sourceRoot":"","sources":["../src/shell-app.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,UAAU,aAAa;IACrB,KAAK,EAAE,SAAS,CAAC;CAClB;AAiBD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,2CA6MhD"}
1
+ {"version":3,"file":"shell-app.d.ts","sourceRoot":"","sources":["../src/shell-app.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,UAAU,aAAa;IACrB,KAAK,EAAE,SAAS,CAAC;CAClB;AAiBD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,2CAiNhD"}
package/dist/shell-app.js CHANGED
@@ -47,12 +47,17 @@ export function ShellApp({ shell }) {
47
47
  // Load navigation once (prevent React 18 double-mount in dev)
48
48
  if (!navigationLoadedRef.current) {
49
49
  navigationLoadedRef.current = true;
50
- fetch(`${shell.basePath}/navigation.json`)
51
- .then(res => res.json())
52
- .then(data => {
53
- setNavigation(data);
54
- })
55
- .catch(err => console.error('Failed to load navigation:', err));
50
+ // Get navigation from core (already loaded)
51
+ const nav = shell.getNavigation();
52
+ if (nav.length > 0) {
53
+ setNavigation(nav);
54
+ }
55
+ else {
56
+ // Wait for core to load navigation
57
+ setTimeout(() => {
58
+ setNavigation(shell.getNavigation());
59
+ }, 100);
60
+ }
56
61
  }
57
62
  return () => {
58
63
  window.removeEventListener('cloudscape-dialog', handleDialogEvent);
@@ -142,5 +147,5 @@ export function ShellApp({ shell }) {
142
147
  padding: '24px',
143
148
  borderRadius: '8px',
144
149
  textAlign: 'center',
145
- }, children: [_jsx(Spinner, { size: "large" }), _jsx("div", { style: { marginTop: '16px' }, children: busyMessage })] }) })), _jsx(Modal, { visible: dialogState.visible, onDismiss: handleDialogDismiss, header: dialogState.title, footer: _jsx(Box, { float: "right", children: _jsx(SpaceBetween, { direction: "horizontal", size: "xs", children: dialogState.buttons.map((btn, idx) => (_jsx(Button, { variant: btn.variant === 'primary' ? 'primary' : 'normal', onClick: () => handleDialogButton(btn.value), children: btn.label }, idx))) }) }), children: dialogState.message }), _jsx(ShellLayout, { navigation: navigation, currentPath: currentPath, basePath: shell.basePath, onNavigate: handleNavigate, children: _jsx("div", { ref: contentRef }) })] }));
150
+ }, children: [_jsx(Spinner, { size: "large" }), _jsx("div", { style: { marginTop: '16px' }, children: busyMessage })] }) })), _jsx(Modal, { visible: dialogState.visible, onDismiss: handleDialogDismiss, header: dialogState.title, footer: _jsx(Box, { float: "right", children: _jsx(SpaceBetween, { direction: "horizontal", size: "xs", children: dialogState.buttons.map((btn, idx) => (_jsx(Button, { variant: btn.variant === 'primary' ? 'primary' : 'normal', onClick: () => handleDialogButton(btn.value), children: btn.label }, idx))) }) }), children: dialogState.message }), _jsx(ShellLayout, { navigation: navigation, currentPath: currentPath, basePath: shell.basePath, onNavigate: handleNavigate, children: _jsx("div", { id: "shell-content", ref: contentRef }) })] }));
146
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herdingbits/trailhead-cloudscape",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "AWS CloudScape adapter for Trailhead. React-based shell with CloudScape components. Supports React 19.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "build": "npm run clean && tsc && cp src/shell.css dist/"
22
22
  },
23
23
  "peerDependencies": {
24
- "@herdingbits/trailhead-core": "^0.0.9",
24
+ "@herdingbits/trailhead-core": "^0.0.10",
25
25
  "@cloudscape-design/components": "^3.0.0",
26
26
  "@cloudscape-design/global-styles": "^1.0.0",
27
27
  "react": "^19.0.0",