@typespec/html-program-viewer 0.72.0-dev.3 → 0.72.0-dev.4
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/{manifest-DH1LKq9n.js → manifest-Bn7Voc8C.js} +1 -1
- package/dist/react/index.js +42 -13
- package/dist/react/type-graph.d.ts +2 -0
- package/dist/react/type-graph.d.ts.map +1 -1
- package/dist/react/use-tree-navigation.d.ts +3 -1
- package/dist/react/use-tree-navigation.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -34305,7 +34305,7 @@ let manifest;
|
|
|
34305
34305
|
try {
|
|
34306
34306
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34307
34307
|
// @ts-ignore
|
|
34308
|
-
manifest = (await import('../manifest-
|
|
34308
|
+
manifest = (await import('../manifest-Bn7Voc8C.js')).default;
|
|
34309
34309
|
}
|
|
34310
34310
|
catch {
|
|
34311
34311
|
const name = "../dist/manifest.js";
|
|
@@ -45605,12 +45605,29 @@ function useTreeNavigator() {
|
|
|
45605
45605
|
}
|
|
45606
45606
|
return nav;
|
|
45607
45607
|
}
|
|
45608
|
-
const TypeGraphNavigatorProvider = ({
|
|
45609
|
-
|
|
45608
|
+
const TypeGraphNavigatorProvider = ({
|
|
45609
|
+
program,
|
|
45610
|
+
children,
|
|
45611
|
+
onNavigationChange,
|
|
45612
|
+
currentPath
|
|
45613
|
+
}) => {
|
|
45614
|
+
const treeNavigator = useTreeNavigatorInternal(program, onNavigationChange, currentPath);
|
|
45610
45615
|
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(TreeNavigatorContext.Provider, { value: treeNavigator, children });
|
|
45611
45616
|
};
|
|
45612
|
-
function useTreeNavigatorInternal(program) {
|
|
45613
|
-
const [selectedPath,
|
|
45617
|
+
function useTreeNavigatorInternal(program, onNavigationChange, currentPath) {
|
|
45618
|
+
const [selectedPath, setSelectedPath] = useState(currentPath || "");
|
|
45619
|
+
const selectPath = useCallback(
|
|
45620
|
+
(path) => {
|
|
45621
|
+
setSelectedPath(path);
|
|
45622
|
+
onNavigationChange?.(path);
|
|
45623
|
+
},
|
|
45624
|
+
[onNavigationChange]
|
|
45625
|
+
);
|
|
45626
|
+
useEffect(() => {
|
|
45627
|
+
if (currentPath !== void 0 && currentPath !== selectedPath) {
|
|
45628
|
+
setSelectedPath(currentPath);
|
|
45629
|
+
}
|
|
45630
|
+
}, [currentPath, selectedPath]);
|
|
45614
45631
|
const tree = useMemo(() => computeTree(program), [program]);
|
|
45615
45632
|
const { pathToNode, typeToPath } = useMemo(() => computeReferences(tree), [tree]);
|
|
45616
45633
|
const selectedNode = useMemo(() => pathToNode.get(selectedPath), [pathToNode, selectedPath]);
|
|
@@ -46454,14 +46471,26 @@ const TypeNodeView = ({ node }) => {
|
|
|
46454
46471
|
] });
|
|
46455
46472
|
};
|
|
46456
46473
|
|
|
46457
|
-
const TypeGraph = ({
|
|
46458
|
-
|
|
46459
|
-
|
|
46460
|
-
|
|
46461
|
-
|
|
46462
|
-
|
|
46463
|
-
|
|
46464
|
-
|
|
46474
|
+
const TypeGraph = ({
|
|
46475
|
+
program,
|
|
46476
|
+
onNavigationChange,
|
|
46477
|
+
currentPath
|
|
46478
|
+
}) => {
|
|
46479
|
+
return /* @__PURE__ */ jsxRuntimeExports$1.jsx(
|
|
46480
|
+
TypeGraphNavigatorProvider,
|
|
46481
|
+
{
|
|
46482
|
+
program,
|
|
46483
|
+
onNavigationChange,
|
|
46484
|
+
currentPath,
|
|
46485
|
+
children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(ProgramProvider, { value: program, children: /* @__PURE__ */ jsxRuntimeExports$1.jsxs(SplitPane, { initialSizes: ["200px", ""], split: "vertical", className: style$6["type-graph"], children: [
|
|
46486
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(Pane, { className: style$6["tree-navigation-pane"], children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(TreeNavigation, {}) }),
|
|
46487
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsxs(Pane, { className: style$6["view-pane"], children: [
|
|
46488
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { className: style$6["current-path"], children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(CurrentPath, {}) }),
|
|
46489
|
+
/* @__PURE__ */ jsxRuntimeExports$1.jsx(TypeGraphContent, {})
|
|
46490
|
+
] })
|
|
46491
|
+
] }) })
|
|
46492
|
+
}
|
|
46493
|
+
);
|
|
46465
46494
|
};
|
|
46466
46495
|
const TypeGraphContent = () => {
|
|
46467
46496
|
const nav = useTreeNavigator();
|
|
@@ -3,6 +3,8 @@ import { FunctionComponent } from 'react';
|
|
|
3
3
|
export declare function renderProgram(program: Program): string;
|
|
4
4
|
export interface TypeGraphProps {
|
|
5
5
|
readonly program: Program;
|
|
6
|
+
readonly onNavigationChange?: (path: string) => void;
|
|
7
|
+
readonly currentPath?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare const TypeGraph: FunctionComponent<TypeGraphProps>;
|
|
8
10
|
//# sourceMappingURL=type-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-graph.d.ts","sourceRoot":"","sources":["../../src/react/type-graph.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAO7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"type-graph.d.ts","sourceRoot":"","sources":["../../src/react/type-graph.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,UAO7C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CA0BvD,CAAC"}
|
|
@@ -25,6 +25,8 @@ export declare function useTreeNavigator(): TreeNavigator;
|
|
|
25
25
|
export interface TypeGraphNavigatorProvider {
|
|
26
26
|
program: Program;
|
|
27
27
|
children: ReactNode;
|
|
28
|
+
onNavigationChange?: (path: string) => void;
|
|
29
|
+
currentPath?: string;
|
|
28
30
|
}
|
|
29
|
-
export declare const TypeGraphNavigatorProvider: ({ program, children }: TypeGraphNavigatorProvider) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const TypeGraphNavigatorProvider: ({ program, children, onNavigationChange, currentPath, }: TypeGraphNavigatorProvider) => import("react/jsx-runtime").JSX.Element;
|
|
30
32
|
//# sourceMappingURL=use-tree-navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tree-navigation.d.ts","sourceRoot":"","sources":["../../src/react/use-tree-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,
|
|
1
|
+
{"version":3,"file":"use-tree-navigation.d.ts","sourceRoot":"","sources":["../../src/react/use-tree-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,iBAAiB;IAChC,QAAQ,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