@syntrologie/adapt-nav 0.0.0-semantically-released → 1.0.0
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/NavWidget.d.ts.map +1 -1
- package/dist/NavWidget.js +33 -28
- package/dist/cdn.d.ts +13 -1
- package/dist/cdn.d.ts.map +1 -1
- package/dist/cdn.js +11 -7
- package/dist/editor.d.ts +12 -2
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +410 -134
- package/dist/runtime.d.ts +33 -7
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +78 -8
- package/dist/schema.d.ts +45 -10
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +24 -0
- package/dist/summarize.d.ts +14 -0
- package/dist/summarize.d.ts.map +1 -0
- package/dist/summarize.js +53 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -1
- package/package.json +14 -6
package/dist/NavWidget.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavWidget.d.ts","sourceRoot":"","sources":["../src/NavWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"NavWidget.d.ts","sourceRoot":"","sources":["../src/NavWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAiB,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA8G1F;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,cAAc,kDAkFxE;AAMD;;GAEG;AACH,eAAO,MAAM,kBAAkB;qBAEhB,WAAW,WACb,SAAS,GAAG;QAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CA8C3E,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/dist/NavWidget.js
CHANGED
|
@@ -9,6 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
* (nav:link) serve as configuration data for the parent widget.
|
|
10
10
|
*/
|
|
11
11
|
import React, { useEffect, useReducer, useMemo, useCallback } from 'react';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
12
13
|
// ============================================================================
|
|
13
14
|
// Styles
|
|
14
15
|
// ============================================================================
|
|
@@ -105,16 +106,14 @@ export function NavWidget({ config, runtime, instanceId }) {
|
|
|
105
106
|
return unsubscribe;
|
|
106
107
|
}, [runtime.context]);
|
|
107
108
|
// Filter visible links based on per-item showWhen
|
|
108
|
-
const visibleLinks = useMemo(() => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
117
|
-
}, [config.actions, runtime]);
|
|
109
|
+
const visibleLinks = useMemo(() => config.actions.filter((link) => {
|
|
110
|
+
// No showWhen = always visible
|
|
111
|
+
if (!link.showWhen)
|
|
112
|
+
return true;
|
|
113
|
+
// Evaluate the decision strategy
|
|
114
|
+
const result = runtime.evaluateSync(link.showWhen);
|
|
115
|
+
return result.value;
|
|
116
|
+
}), [config.actions, runtime]);
|
|
118
117
|
// Resolve theme (auto → detect system preference)
|
|
119
118
|
const resolvedTheme = useMemo(() => {
|
|
120
119
|
if (config.theme !== 'auto')
|
|
@@ -162,29 +161,35 @@ export function NavWidget({ config, runtime, instanceId }) {
|
|
|
162
161
|
*/
|
|
163
162
|
export const NavMountableWidget = {
|
|
164
163
|
mount(container, config) {
|
|
165
|
-
|
|
166
|
-
// In practice, the runtime handles React rendering
|
|
167
|
-
const { runtime, instanceId: _instanceId = 'nav-widget', ...navConfig } = config || {
|
|
164
|
+
const { runtime, instanceId = 'nav-widget', ...navConfig } = config || {
|
|
168
165
|
layout: 'horizontal',
|
|
169
166
|
theme: 'auto',
|
|
170
167
|
actions: [],
|
|
171
168
|
};
|
|
172
|
-
//
|
|
173
|
-
if (
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
${link.config.label}
|
|
182
|
-
</a>
|
|
183
|
-
`)
|
|
184
|
-
.join('')}
|
|
185
|
-
</nav>
|
|
186
|
-
`;
|
|
169
|
+
// React rendering when runtime + ReactDOM are available
|
|
170
|
+
if (runtime && typeof createRoot === 'function') {
|
|
171
|
+
const root = createRoot(container);
|
|
172
|
+
root.render(React.createElement(NavWidget, {
|
|
173
|
+
config: navConfig,
|
|
174
|
+
runtime: runtime,
|
|
175
|
+
instanceId,
|
|
176
|
+
}));
|
|
177
|
+
return () => { root.unmount(); };
|
|
187
178
|
}
|
|
179
|
+
// HTML fallback for non-React environments
|
|
180
|
+
const links = navConfig.actions || [];
|
|
181
|
+
container.innerHTML = `
|
|
182
|
+
<nav style="display: flex; gap: 8px; padding: 8px; font-family: system-ui;">
|
|
183
|
+
${links
|
|
184
|
+
.map((link) => `
|
|
185
|
+
<a href="${link.config.href}" style="padding: 8px 12px; text-decoration: none; color: #374151;">
|
|
186
|
+
${link.config.icon ? `<span>${link.config.icon}</span>` : ''}
|
|
187
|
+
${link.config.label}
|
|
188
|
+
</a>
|
|
189
|
+
`)
|
|
190
|
+
.join('')}
|
|
191
|
+
</nav>
|
|
192
|
+
`;
|
|
188
193
|
return () => {
|
|
189
194
|
container.innerHTML = '';
|
|
190
195
|
};
|
package/dist/cdn.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
5
|
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
6
|
*/
|
|
7
|
+
import NavEditor from './editor';
|
|
7
8
|
/**
|
|
8
9
|
* App manifest for registry registration.
|
|
9
10
|
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
@@ -14,7 +15,10 @@ export declare const manifest: {
|
|
|
14
15
|
name: string;
|
|
15
16
|
description: string;
|
|
16
17
|
runtime: {
|
|
17
|
-
actions:
|
|
18
|
+
actions: {
|
|
19
|
+
kind: "navigation:scrollTo" | "navigation:navigate";
|
|
20
|
+
executor: import("./types").ActionExecutor<import("./types").ScrollToAction> | import("./types").ActionExecutor<import("./types").NavigateAction>;
|
|
21
|
+
}[];
|
|
18
22
|
widgets: {
|
|
19
23
|
id: string;
|
|
20
24
|
component: {
|
|
@@ -30,6 +34,14 @@ export declare const manifest: {
|
|
|
30
34
|
};
|
|
31
35
|
}[];
|
|
32
36
|
};
|
|
37
|
+
editor: {
|
|
38
|
+
component: typeof NavEditor;
|
|
39
|
+
panel: {
|
|
40
|
+
title: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
33
45
|
metadata: {
|
|
34
46
|
isBuiltIn: boolean;
|
|
35
47
|
};
|
package/dist/cdn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;2BA8B8+J,CAAC;8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;CAdliK,CAAC;AAaF,eAAe,QAAQ,CAAC"}
|
package/dist/cdn.js
CHANGED
|
@@ -4,21 +4,25 @@
|
|
|
4
4
|
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
5
|
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import NavEditor, { editorPanel } from './editor';
|
|
8
|
+
import { executors, runtime } from './runtime';
|
|
8
9
|
/**
|
|
9
10
|
* App manifest for registry registration.
|
|
10
11
|
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
11
12
|
*/
|
|
12
13
|
export const manifest = {
|
|
13
|
-
id: 'nav',
|
|
14
|
+
id: 'adaptive-nav',
|
|
14
15
|
version: runtime.version,
|
|
15
16
|
name: runtime.name,
|
|
16
17
|
description: runtime.description,
|
|
17
18
|
runtime: {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
actions: executors.map(({ kind, executor }) => ({
|
|
20
|
+
kind,
|
|
21
|
+
executor,
|
|
22
|
+
})),
|
|
20
23
|
widgets: runtime.widgets,
|
|
21
24
|
},
|
|
25
|
+
editor: { component: NavEditor, panel: editorPanel },
|
|
22
26
|
metadata: {
|
|
23
27
|
isBuiltIn: false,
|
|
24
28
|
},
|
|
@@ -28,9 +32,9 @@ export const manifest = {
|
|
|
28
32
|
* This happens when loaded via script tag (UMD).
|
|
29
33
|
*/
|
|
30
34
|
if (typeof window !== 'undefined') {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
|
|
35
|
+
const registry = window.SynOS?.appRegistry;
|
|
36
|
+
if (registry && typeof registry.register === 'function') {
|
|
37
|
+
registry.register(manifest);
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
export default manifest;
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adaptive Nav - Editor Component
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Review & tweak editor for AI-generated navigation link decisions.
|
|
5
|
+
* Displays a scannable list of link cards with trigger, rationale,
|
|
6
|
+
* and inline editing. Includes detection badges and hover-to-highlight.
|
|
5
7
|
*/
|
|
6
|
-
import type
|
|
8
|
+
import { type EditorPanelProps } from './types';
|
|
7
9
|
export declare function NavEditor({ config, onChange, editor }: EditorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
/**
|
|
9
11
|
* Editor panel configuration for the app registry.
|
|
@@ -13,5 +15,13 @@ export declare const editorPanel: {
|
|
|
13
15
|
icon: string;
|
|
14
16
|
description: string;
|
|
15
17
|
};
|
|
18
|
+
export declare const editor: {
|
|
19
|
+
panel: {
|
|
20
|
+
title: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
component: typeof NavEditor;
|
|
25
|
+
};
|
|
16
26
|
export default NavEditor;
|
|
17
27
|
//# sourceMappingURL=editor.d.ts.map
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAmD,KAAK,gBAAgB,EAAqB,MAAM,SAAS,CAAC;AAmapH,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAiXvE;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;CAGlB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|