@typespec/html-program-viewer 0.58.0-dev.1 → 0.58.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.
Files changed (97) hide show
  1. package/dist/emitter/index.js +5779 -0
  2. package/dist/emitter/style.css +92 -0
  3. package/dist/{src/emitter.d.ts → emitter.d.ts} +6 -5
  4. package/dist/emitter.d.ts.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/manifest-DR4jWHsG.js +6 -0
  8. package/dist/react/common.d.ts +18 -0
  9. package/dist/react/common.d.ts.map +1 -0
  10. package/dist/react/current-path/current-path.d.ts +2 -0
  11. package/dist/react/current-path/current-path.d.ts.map +1 -0
  12. package/dist/react/index.d.ts +2 -0
  13. package/dist/react/index.d.ts.map +1 -0
  14. package/dist/react/index.js +42232 -0
  15. package/dist/react/inspect-type/inspect-type.d.ts +12 -0
  16. package/dist/react/inspect-type/inspect-type.d.ts.map +1 -0
  17. package/dist/react/inspect-type/type-data-table.d.ts +10 -0
  18. package/dist/react/inspect-type/type-data-table.d.ts.map +1 -0
  19. package/dist/react/js-inspector/index.d.ts +6 -0
  20. package/dist/react/js-inspector/index.d.ts.map +1 -0
  21. package/dist/react/js-inspector/js-value/js-value.d.ts +12 -0
  22. package/dist/react/js-inspector/js-value/js-value.d.ts.map +1 -0
  23. package/dist/react/js-inspector/js-value/js-value.test.d.ts +2 -0
  24. package/dist/react/js-inspector/js-value/js-value.test.d.ts.map +1 -0
  25. package/dist/react/js-inspector/object-inspector.d.ts +18 -0
  26. package/dist/react/js-inspector/object-inspector.d.ts.map +1 -0
  27. package/dist/react/js-inspector/object-label.d.ts +12 -0
  28. package/dist/react/js-inspector/object-label.d.ts.map +1 -0
  29. package/dist/react/js-inspector/object-name.d.ts +17 -0
  30. package/dist/react/js-inspector/object-name.d.ts.map +1 -0
  31. package/dist/react/js-inspector/object-preview.d.ts +7 -0
  32. package/dist/react/js-inspector/object-preview.d.ts.map +1 -0
  33. package/dist/react/js-inspector/object-root-label.d.ts +4 -0
  34. package/dist/react/js-inspector/object-root-label.d.ts.map +1 -0
  35. package/dist/react/js-inspector/utils/object-prototype.d.ts +3 -0
  36. package/dist/react/js-inspector/utils/object-prototype.d.ts.map +1 -0
  37. package/dist/react/js-inspector/utils/property-utils.d.ts +2 -0
  38. package/dist/react/js-inspector/utils/property-utils.d.ts.map +1 -0
  39. package/dist/react/list-type-view/list-type-view.d.ts +8 -0
  40. package/dist/react/list-type-view/list-type-view.d.ts.map +1 -0
  41. package/dist/react/program-context.d.ts +5 -0
  42. package/dist/react/program-context.d.ts.map +1 -0
  43. package/dist/react/tree-navigation.d.ts +9 -0
  44. package/dist/react/tree-navigation.d.ts.map +1 -0
  45. package/dist/react/type-config.d.ts +20 -0
  46. package/dist/react/type-config.d.ts.map +1 -0
  47. package/dist/react/type-graph.d.ts +9 -0
  48. package/dist/react/type-graph.d.ts.map +1 -0
  49. package/dist/react/type-view/type-view.d.ts +8 -0
  50. package/dist/react/type-view/type-view.d.ts.map +1 -0
  51. package/dist/react/use-tree-navigation.d.ts +31 -0
  52. package/dist/react/use-tree-navigation.d.ts.map +1 -0
  53. package/dist/style.css +244 -0
  54. package/dist/testing/index.d.ts +4 -0
  55. package/dist/testing/index.d.ts.map +1 -0
  56. package/dist/utils.d.ts +10 -0
  57. package/dist/utils.d.ts.map +1 -0
  58. package/package.json +29 -20
  59. package/dist/src/color-provider.d.ts +0 -8
  60. package/dist/src/color-provider.d.ts.map +0 -1
  61. package/dist/src/color-provider.js +0 -13
  62. package/dist/src/color-provider.js.map +0 -1
  63. package/dist/src/common.d.ts +0 -8
  64. package/dist/src/common.d.ts.map +0 -1
  65. package/dist/src/common.js +0 -12
  66. package/dist/src/common.js.map +0 -1
  67. package/dist/src/constants.d.ts +0 -15
  68. package/dist/src/constants.d.ts.map +0 -1
  69. package/dist/src/constants.js +0 -23
  70. package/dist/src/constants.js.map +0 -1
  71. package/dist/src/emitter.d.ts.map +0 -1
  72. package/dist/src/emitter.js +0 -29
  73. package/dist/src/emitter.js.map +0 -1
  74. package/dist/src/index.d.ts +0 -5
  75. package/dist/src/index.d.ts.map +0 -1
  76. package/dist/src/index.js +0 -4
  77. package/dist/src/index.js.map +0 -1
  78. package/dist/src/inspect.d.ts +0 -2
  79. package/dist/src/inspect.d.ts.map +0 -1
  80. package/dist/src/inspect.js +0 -46
  81. package/dist/src/inspect.js.map +0 -1
  82. package/dist/src/testing/index.d.ts +0 -3
  83. package/dist/src/testing/index.d.ts.map +0 -1
  84. package/dist/src/testing/index.js +0 -6
  85. package/dist/src/testing/index.js.map +0 -1
  86. package/dist/src/type-ui-base.d.ts +0 -19
  87. package/dist/src/type-ui-base.d.ts.map +0 -1
  88. package/dist/src/type-ui-base.js +0 -21
  89. package/dist/src/type-ui-base.js.map +0 -1
  90. package/dist/src/ui.d.ts +0 -13
  91. package/dist/src/ui.d.ts.map +0 -1
  92. package/dist/src/ui.js +0 -285
  93. package/dist/src/ui.js.map +0 -1
  94. package/dist/src/utils.d.ts +0 -6
  95. package/dist/src/utils.d.ts.map +0 -1
  96. package/dist/src/utils.js +0 -27
  97. package/dist/src/utils.js.map +0 -1
@@ -0,0 +1,12 @@
1
+ import { Entity, Type } from '@typespec/compiler';
2
+ import { FunctionComponent } from 'react';
3
+
4
+ interface InspectTypeProps {
5
+ readonly entity: Entity;
6
+ }
7
+ export declare const InspectType: FunctionComponent<InspectTypeProps>;
8
+ export declare const TypeReference: FunctionComponent<{
9
+ type: Type;
10
+ }>;
11
+ export {};
12
+ //# sourceMappingURL=inspect-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect-type.d.ts","sourceRoot":"","sources":["../../../src/react/inspect-type/inspect-type.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAe,KAAK,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAU/F,UAAU,gBAAgB;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAM3D,CAAC;AAuEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAmD3D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Type } from '@typespec/compiler';
2
+ import { FC } from 'react';
3
+
4
+ export declare const TypeDataTable: FC<{
5
+ type: Type;
6
+ }>;
7
+ export interface ObjectInspectorProps {
8
+ readonly data: any;
9
+ }
10
+ //# sourceMappingURL=type-data-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-data-table.d.ts","sourceRoot":"","sources":["../../../src/react/inspect-type/type-data-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CA4B5C,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;CACpB"}
@@ -0,0 +1,6 @@
1
+ export { JsValue as JSValue } from './js-value/js-value.js';
2
+ export { DefaultNodeRenderer, ObjectInspector } from './object-inspector.js';
3
+ export { ObjectLabel } from './object-label.js';
4
+ export { ObjectPreview } from './object-preview.js';
5
+ export { ObjectRootLabel } from './object-root-label.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/js-inspector/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+
3
+ export interface JsValueProps {
4
+ readonly value: any;
5
+ }
6
+ /**
7
+ * A short description of the object values.
8
+ * Can be used to render tree node in ObjectInspector
9
+ * or render objects in TableInspector.
10
+ */
11
+ export declare const JsValue: FC<JsValueProps>;
12
+ //# sourceMappingURL=js-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-value.d.ts","sourceRoot":"","sources":["../../../../src/react/js-inspector/js-value/js-value.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;CACrB;AACD;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CA6CpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=js-value.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-value.test.d.ts","sourceRoot":"","sources":["../../../../src/react/js-inspector/js-value/js-value.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { FC } from 'react';
2
+
3
+ export declare const DefaultNodeRenderer: ({ path, name, data, isNonenumerable }: NodeRendererProps) => import("react/jsx-runtime").JSX.Element;
4
+ export interface ObjectInspectorProps {
5
+ readonly data: any;
6
+ readonly showNonenumerable?: boolean;
7
+ readonly sortObjectKeys?: boolean;
8
+ readonly nodeRenderer?: (props: NodeRendererProps) => any;
9
+ }
10
+ export declare const ObjectInspector: FC<ObjectInspectorProps>;
11
+ export declare const DEFAULT_ROOT_PATH = "$";
12
+ export interface NodeRendererProps {
13
+ readonly name: string | undefined;
14
+ readonly path: string;
15
+ readonly data: any;
16
+ readonly isNonenumerable?: boolean;
17
+ }
18
+ //# sourceMappingURL=object-inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-inspector.d.ts","sourceRoot":"","sources":["../../../src/react/js-inspector/object-inspector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAqFhC,eAAO,MAAM,mBAAmB,0CAA2C,iBAAiB,4CAOzF,CAAC;AAEJ,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,GAAG,CAAC;CAC3D;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAyBpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAMrC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC"}
@@ -0,0 +1,12 @@
1
+ import { FC, ReactNode } from 'react';
2
+
3
+ export interface ObjectLabelProps {
4
+ readonly name: any;
5
+ readonly isNonenumerable?: boolean;
6
+ readonly children: ReactNode;
7
+ }
8
+ /**
9
+ * if isNonenumerable is specified, render the name dimmed
10
+ */
11
+ export declare const ObjectLabel: FC<ObjectLabelProps>;
12
+ //# sourceMappingURL=object-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-label.d.ts","sourceRoot":"","sources":["../../../src/react/js-inspector/object-label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AACD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAY5C,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { FC } from 'react';
2
+
3
+ export interface ObjectNameProps {
4
+ readonly name: any;
5
+ readonly dimmed?: boolean;
6
+ }
7
+ /**
8
+ * A view for object property names.
9
+ *
10
+ * If the property name is enumerable (in Object.keys(object)),
11
+ * the property name will be rendered normally.
12
+ *
13
+ * If the property name is not enumerable (`Object.prototype.propertyIsEnumerable()`),
14
+ * the property name will be dimmed to show the difference.
15
+ */
16
+ export declare const ObjectName: FC<ObjectNameProps>;
17
+ //# sourceMappingURL=object-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-name.d.ts","sourceRoot":"","sources":["../../../src/react/js-inspector/object-name.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AACD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAI1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+
3
+ /**
4
+ * A preview of the object
5
+ */
6
+ export declare const ObjectPreview: FC<any>;
7
+ //# sourceMappingURL=object-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-preview.d.ts","sourceRoot":"","sources":["../../../src/react/js-inspector/object-preview.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAqBvD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,GAAG,CAsEjC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+
3
+ export declare const ObjectRootLabel: FC<any>;
4
+ //# sourceMappingURL=object-root-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-root-label.d.ts","sourceRoot":"","sources":["../../../src/react/js-inspector/object-root-label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,GAAG,CAYnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const hasOwnProperty: (v: PropertyKey) => boolean;
2
+ export declare const propertyIsEnumerable: (v: PropertyKey) => boolean;
3
+ //# sourceMappingURL=object-prototype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-prototype.d.ts","sourceRoot":"","sources":["../../../../src/react/js-inspector/utils/object-prototype.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,6BAAkC,CAAC;AAC9D,eAAO,MAAM,oBAAoB,6BAAwC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getPropertyValue(object: any, propertyName: string): any;
2
+ //# sourceMappingURL=property-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-utils.d.ts","sourceRoot":"","sources":["../../../../src/react/js-inspector/utils/property-utils.tsx"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,OAWjE"}
@@ -0,0 +1,8 @@
1
+ import { TreeNavigator, TypeGraphListNode } from '../use-tree-navigation.js';
2
+
3
+ export interface ListTypeViewProps {
4
+ readonly nav: TreeNavigator;
5
+ readonly node: TypeGraphListNode;
6
+ }
7
+ export declare const ListTypeView: ({ nav, node }: ListTypeViewProps) => import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=list-type-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-type-view.d.ts","sourceRoot":"","sources":["../../../src/react/list-type-view/list-type-view.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAiB,MAAM,2BAA2B,CAAC;AAGjG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AACD,eAAO,MAAM,YAAY,kBAAmB,iBAAiB,4CAmB5D,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Program } from '@typespec/compiler';
2
+
3
+ export declare const ProgramProvider: import('react').Provider<Program | undefined>;
4
+ export declare function useProgram(): Program;
5
+ //# sourceMappingURL=program-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program-context.d.ts","sourceRoot":"","sources":["../../src/react/program-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAKlD,eAAO,MAAM,eAAe,+CAA0B,CAAC;AAEvD,wBAAgB,UAAU,YAMzB"}
@@ -0,0 +1,9 @@
1
+ import { TypeGraphNode } from './use-tree-navigation.js';
2
+
3
+ export interface TreeNavigationProps {
4
+ }
5
+ export declare const TreeNavigation: (_: TreeNavigationProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const NodeIcon: ({ node }: {
7
+ node: TypeGraphNode;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=tree-navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-navigation.d.ts","sourceRoot":"","sources":["../../src/react/tree-navigation.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhF,MAAM,WAAW,mBAAmB;CAAG;AAEvC,eAAO,MAAM,cAAc,MAAO,mBAAmB,4CAYpD,CAAC;AAEF,eAAO,MAAM,QAAQ,aAAc;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,4CAOzD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Type } from '@typespec/compiler';
2
+
3
+ export type EntityPropertyConfig = "parent" | "nested" | "ref" | "value" | "skip";
4
+ export declare const TypeConfig: TypeGraphConfig;
5
+ type PropsToDefine<T extends Type> = Exclude<keyof T, HiddenPropsType | keyof typeof CommonPropsConfig>;
6
+ type TypeConfig<T extends Type> = Record<PropsToDefine<T>, EntityPropertyConfig> | null;
7
+ type TypeGraphConfig = {
8
+ [K in Type["kind"]]: TypeConfig<Extract<Type, {
9
+ kind: K;
10
+ }>>;
11
+ };
12
+ export declare const CommonPropsConfig: {
13
+ namespace: string;
14
+ };
15
+ declare const HiddenProps: readonly ["entityKind", "kind", "name", "node", "symbol", "templateNode", "templateArguments", "templateMapper", "instantiationParameters", "decorators", "projectionBase", "projectionsByName", "projectionSource", "projector", "projections", "isFinished"];
16
+ type HiddenPropsType = (typeof HiddenProps)[number];
17
+ export declare const HiddenPropsSet: Set<"symbol" | "kind" | "entityKind" | "name" | "node" | "templateNode" | "templateArguments" | "templateMapper" | "instantiationParameters" | "decorators" | "projectionBase" | "projectionsByName" | "projectionSource" | "projector" | "projections" | "isFinished">;
18
+ export declare function getPropertyRendering<T extends Type, K extends keyof T>(type: T, key: K): EntityPropertyConfig;
19
+ export {};
20
+ //# sourceMappingURL=type-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-config.d.ts","sourceRoot":"","sources":["../../src/react/type-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAElF,eAAO,MAAM,UAAU,EAAE,eAsGxB,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,SAAS,IAAI,IAAI,OAAO,CAC1C,MAAM,CAAC,EACP,eAAe,GAAG,MAAM,OAAO,iBAAiB,CACjD,CAAC;AACF,KAAK,UAAU,CAAC,CAAC,SAAS,IAAI,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,GAAG,IAAI,CAAC;AACxF,KAAK,eAAe,GAAG;KACpB,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAE7B,CAAC;AAEF,QAAA,MAAM,WAAW,gQAiBP,CAAC;AACX,KAAK,eAAe,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpD,eAAO,MAAM,cAAc,yQAAuB,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,MAAM,CAAC,EACpE,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,CAAC,GACL,oBAAoB,CAItB"}
@@ -0,0 +1,9 @@
1
+ import { Program } from '@typespec/compiler';
2
+ import { FunctionComponent } from 'react';
3
+
4
+ export declare function renderProgram(program: Program): string;
5
+ export interface TypeGraphProps {
6
+ readonly program: Program;
7
+ }
8
+ export declare const TypeGraph: FunctionComponent<TypeGraphProps>;
9
+ //# sourceMappingURL=type-graph.d.ts.map
@@ -0,0 +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;CAC3B;AAED,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAkBvD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TreeNavigator, TypeGraphTypeNode } from '../use-tree-navigation.js';
2
+
3
+ export interface TypeNodeViewProps {
4
+ readonly nav: TreeNavigator;
5
+ readonly node: TypeGraphTypeNode;
6
+ }
7
+ export declare const TypeNodeView: ({ node }: TypeNodeViewProps) => import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=type-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-view.d.ts","sourceRoot":"","sources":["../../../src/react/type-view/type-view.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGlF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,eAAO,MAAM,YAAY,aAAc,iBAAiB,4CA+BvD,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { Program, Type } from '@typespec/compiler';
2
+ import { ReactNode } from 'react';
3
+
4
+ export interface TypeGraphNodeBase {
5
+ readonly id: string;
6
+ readonly name: string;
7
+ readonly children: TypeGraphNode[];
8
+ }
9
+ export interface TypeGraphTypeNode extends TypeGraphNodeBase {
10
+ readonly kind: "type";
11
+ readonly type: Type;
12
+ }
13
+ export interface TypeGraphListNode extends TypeGraphNodeBase {
14
+ readonly kind: "list";
15
+ }
16
+ export type TypeGraphNode = TypeGraphTypeNode | TypeGraphListNode;
17
+ export interface TreeNavigator {
18
+ readonly selectedNode?: TypeGraphNode;
19
+ readonly selectedPath: string;
20
+ readonly selectPath: (path: string) => void;
21
+ readonly navToType: (type: Type) => void;
22
+ readonly tree: TypeGraphListNode;
23
+ }
24
+ export declare function useTreeNavigatorOptional(): TreeNavigator | undefined;
25
+ export declare function useTreeNavigator(): TreeNavigator;
26
+ export interface TypeGraphNavigatorProvider {
27
+ program: Program;
28
+ children: ReactNode;
29
+ }
30
+ export declare const TypeGraphNavigatorProvider: ({ program, children }: TypeGraphNavigatorProvider) => import("react/jsx-runtime").JSX.Element;
31
+ //# sourceMappingURL=use-tree-navigation.d.ts.map
@@ -0,0 +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,EAA6D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAQD,wBAAgB,wBAAwB,IAAI,aAAa,GAAG,SAAS,CAEpE;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAMhD;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,eAAO,MAAM,0BAA0B,0BAA2B,0BAA0B,4CAK3F,CAAC"}
package/dist/style.css ADDED
@@ -0,0 +1,244 @@
1
+ ._type-kind-icon_1l8cz_1 {
2
+ color: var(--colorPaletteBerryForeground2);
3
+ font-weight: bold;
4
+ padding: 1px 1px;
5
+ border-radius: 2px;
6
+ line-height: 16px;
7
+ }
8
+ ._current-path_x1yb7_1 {
9
+ overflow-y: auto;
10
+ border: 1px solid var(--colorNeutralStroke1);
11
+ }
12
+
13
+ ._current-path_x1yb7_1._focus_x1yb7_6 {
14
+ border-bottom: 1px solid var(--colorBrandForeground1);
15
+ }
16
+ ._breadcrumb-search_x1yb7_9 {
17
+ width: 100%;
18
+ border-radius: 0 !important;
19
+ border: none !important;
20
+ }
21
+
22
+ ._breadcrumb-search_x1yb7_9::after {
23
+ border: none !important;
24
+ }
25
+
26
+ ._option_x1yb7_19 {
27
+ padding: 2px 4px !important;
28
+ }
29
+
30
+ ._option_x1yb7_19 ._doc_x1yb7_23 {
31
+ color: var(--colorNeutralForeground4);
32
+ text-overflow: ellipsis;
33
+ text-wrap: nowrap;
34
+ min-width: 0;
35
+ flex: 0 1 auto;
36
+ overflow: hidden;
37
+ }
38
+
39
+ ._flex-gap_x1yb7_32 {
40
+ flex: 1;
41
+ }
42
+
43
+ ._search-placeholder_x1yb7_36 {
44
+ color: var(--colorNeutralForeground4);
45
+ font-size: 12px;
46
+ margin: 5px;
47
+ text-wrap: nowrap;
48
+ }
49
+ ._item_1lyf1_1 {
50
+ border-top: 1px solid var(--colorNeutralStroke1);
51
+ padding: 5px 0 !important;
52
+ }
53
+
54
+ ._item_1lyf1_1:hover {
55
+ background-color: var(--colorNeutralBackground1Hover);
56
+ }
57
+ ._type-graph_yi03c_1 * {
58
+ box-sizing: border-box;
59
+ }
60
+
61
+ ._tree-navigation-pane_yi03c_5 {
62
+ height: 100%;
63
+ overflow-y: auto;
64
+ }
65
+
66
+ ._view-pane_yi03c_10 {
67
+ padding: 10px;
68
+ overflow-y: auto;
69
+ }
70
+
71
+ ._current-path_yi03c_15 {
72
+ margin-bottom: 10px;
73
+ }
74
+ ._mono_ouyit_1 {
75
+ font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
76
+ }
77
+
78
+ ._literal_ouyit_5 {
79
+ color: var(--colorPaletteLightGreenForeground2);
80
+ }
81
+
82
+ ._type-kind_ouyit_9 {
83
+ color: var(--colorPaletteBerryForeground2);
84
+ }
85
+ ._type-kind-tag_ouyit_12 {
86
+ color: white;
87
+ background-color: var(--colorPaletteBerryForeground2);
88
+ border-radius: 2px;
89
+ }
90
+ ._type-kind-tag-small_ouyit_17 {
91
+ height: 16px;
92
+ line-height: 16px;
93
+ font-size: 10px;
94
+ padding: 0 3px;
95
+ }
96
+
97
+ ._type-kind-tag-auto_ouyit_24 {
98
+ padding: 1px 5px;
99
+ }
100
+ ._string_yr0s7_1 {
101
+ color: var(--colorPaletteLightGreenForeground2);
102
+ }
103
+
104
+ ._boolean_yr0s7_5 {
105
+ color: var(--colorPaletteDarkOrangeForeground1);
106
+ }
107
+
108
+ ._number_yr0s7_9 {
109
+ color: var(--colorPaletteDarkOrangeForeground1);
110
+ }
111
+
112
+ ._intrinsic_yr0s7_13 {
113
+ color: var(--colorPaletteDarkOrangeForeground1);
114
+ }
115
+ ._inspect-type_pmg7n_1 {
116
+ font-size: 12px;
117
+ }
118
+ ._inspect-type_pmg7n_1 ul {
119
+ padding: 0 0 0 16px;
120
+ margin: 0;
121
+ }
122
+
123
+ ._inspect-type_pmg7n_1 > ul {
124
+ padding: 0;
125
+ }
126
+
127
+ ._inspect-type_pmg7n_1 li {
128
+ margin: 0;
129
+ list-style: none;
130
+ position: relative;
131
+ }
132
+
133
+ ._type-ui_pmg7n_19 {
134
+ display: inline;
135
+ }
136
+ ._type-ui-header_pmg7n_22 {
137
+ cursor: pointer;
138
+ display: inline;
139
+ }
140
+
141
+ ._type-ui-header_pmg7n_22:hover {
142
+ text-decoration: underline;
143
+ }
144
+
145
+ ._type-name_pmg7n_31 {
146
+ color: var(--colorNeutralForeground2);
147
+ }
148
+
149
+ ._property_pmg7n_35 {
150
+ color: var(--colorPaletteMarigoldForeground2);
151
+ }
152
+
153
+ ._named-type-ref_pmg7n_39 {
154
+ color: var(--colorBrandForeground1);
155
+ text-decoration: none;
156
+ cursor: pointer;
157
+ }
158
+
159
+ ._named-type-ref_pmg7n_39:hover {
160
+ text-decoration: underline;
161
+ }
162
+
163
+ ._js-value_pmg7n_49 {
164
+ color: var(--colorPaletteDarkOrangeForeground1);
165
+ }
166
+ ._object-description_1mqr2_1 {
167
+ font-style: italic;
168
+ }
169
+
170
+ ._preview_1mqr2_5 {
171
+ font-style: italic;
172
+ }
173
+
174
+ ._object-name_1mqr2_9 {
175
+ color: var(--colorPaletteMarigoldForeground2);
176
+ }
177
+
178
+ ._dimmed_1mqr2_13 {
179
+ opacity: 0.6;
180
+ }
181
+ ._table_1qvgd_1 {
182
+ table-layout: auto;
183
+ border-collapse: collapse;
184
+ }
185
+
186
+ ._table_1qvgd_1 th {
187
+ font-weight: bold;
188
+ }
189
+
190
+ ._table_1qvgd_1 thead tr,
191
+ ._table_1qvgd_1 tbody tr:not(:last-child) {
192
+ border-bottom: 1px solid var(--colorNeutralStroke1);
193
+ }
194
+
195
+ ._key_1qvgd_15 {
196
+ vertical-align: top;
197
+ color: var(--colorNeutralForeground2);
198
+ }
199
+
200
+ ._data_1qvgd_20 {
201
+ }
202
+
203
+ ._tsp-type-ref_1qvgd_23 {
204
+ display: inline-flex;
205
+ align-items: center;
206
+ gap: 3px;
207
+ }
208
+
209
+ ._tsp-type-logo_1qvgd_29 {
210
+ display: inline-block;
211
+ font-size: 7px;
212
+ width: 12px;
213
+ height: 12px;
214
+ line-height: 12px;
215
+ background-color: var(--colorPaletteBerryForeground2);
216
+ color: white;
217
+ }
218
+ ._type-view_d4sc6_1 {
219
+ display: flex;
220
+ flex-direction: column;
221
+ gap: 20px;
222
+ }
223
+
224
+ ._main_d4sc6_7 {
225
+ padding: var(--fui-Card--size) 0 !important;
226
+ }
227
+
228
+ ._header-section_d4sc6_11 {
229
+ padding: 0 var(--fui-Card--size);
230
+ }
231
+
232
+ ._inspect-section_d4sc6_15 {
233
+ padding: 0 var(--fui-Card--size);
234
+ }
235
+
236
+ ._header_d4sc6_11 {
237
+ display: flex;
238
+ align-items: center;
239
+ gap: 10px;
240
+ }
241
+
242
+ ._doc_d4sc6_25 {
243
+ color: var(--colorNeutralForeground3);
244
+ }
@@ -0,0 +1,4 @@
1
+ import { TypeSpecTestLibrary } from '@typespec/compiler/testing';
2
+
3
+ export declare const ProgramViewerTestLibrary: TypeSpecTestLibrary;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,wBAAwB,EAAE,mBAIrC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Type, Union } from '@typespec/compiler';
2
+
3
+ export type NamedType = Type & {
4
+ name: string;
5
+ };
6
+ export declare function isNamedUnion(union: Union): union is Union & {
7
+ name: string;
8
+ };
9
+ export declare function isMapLike(value: any): value is Map<string, any>;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAE5E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAE/D"}