@xyd-js/storybook 0.0.1-xyd.4 → 0.0.1-xyd.5

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 (78) hide show
  1. package/.storybook/main.ts +173 -4
  2. package/.storybook/preview.ts +2 -1
  3. package/CHANGELOG.md +11 -0
  4. package/package.json +9 -5
  5. package/src/components/DemoWireframe.tsx +237 -0
  6. package/src/components/logo.tsx +37 -0
  7. package/src/content/atlas-index/package-index.mdx +192 -0
  8. package/src/content/atlas-index/wip1.mdx +131 -0
  9. package/src/content/atlas-index.mdx +53 -0
  10. package/src/docs/atlas/Atlas.stories.tsx +4 -9
  11. package/src/docs/atlas/AtlasIndex.stories.tsx +130 -0
  12. package/src/docs/components/writer/Table.stories.tsx +32 -0
  13. package/src/docs/themes/themes.stories.tsx +27 -24
  14. package/storybook-static/assets/{Atlas.stories-C5gRCegi.js → Atlas.stories-D9DS7hl-.js} +122 -125
  15. package/storybook-static/assets/AtlasIndex.stories-D_Oxkfvi.js +41 -0
  16. package/storybook-static/assets/{Badge.stories-XOQv4P0k.js → Badge.stories-D8HrQDwV.js} +1 -1
  17. package/storybook-static/assets/{Breadcrumbs.stories-DBonCt0B.js → Breadcrumbs.stories-tNKyphmn.js} +1 -1
  18. package/storybook-static/assets/{Button.stories-BXyfQD_l.js → Button.stories-C9qt61OR.js} +1 -1
  19. package/storybook-static/assets/{CTABanner-Dxjlb-Oo-D4ZzKv-X.js → CTABanner-XQNnnpUx-DwYWZ4fP.js} +1 -1
  20. package/storybook-static/assets/{CTABanner.stories-CboCyNul.js → CTABanner.stories-BiQXR4rl.js} +1 -1
  21. package/storybook-static/assets/{Callout.stories-1M6sBDsc.js → Callout.stories-CGC_uVON.js} +1 -1
  22. package/storybook-static/assets/CodeSample-DxPp80ID-C5AHaCBx-D2i_bX1Z.js +9 -0
  23. package/storybook-static/assets/CodeSample.stories-DTrUVe_s.js +22 -0
  24. package/storybook-static/assets/{Color-YHDXOIA2-DKdobiDN.js → Color-YHDXOIA2-jdiJ8nLV.js} +1 -1
  25. package/storybook-static/assets/{DocsRenderer-CFRXHY34-Bal2bsPI.js → DocsRenderer-CFRXHY34-Dx8J2UZ2.js} +4 -4
  26. package/storybook-static/assets/{GuideCard.stories-D_PCT7Jx.js → GuideCard.stories-DNNHeSGK.js} +1 -1
  27. package/storybook-static/assets/{Heading.stories-IvodKnYL.js → Heading.stories-PDwVi1FA.js} +1 -1
  28. package/storybook-static/assets/{Nav.stories-DpHSEq4D.js → Nav.stories-DDu5T02Y.js} +1 -1
  29. package/storybook-static/assets/{NavLinks.stories--GLnE3VD.js → NavLinks.stories-DNOvI3bZ.js} +1 -1
  30. package/storybook-static/assets/{Pre.stories-D5iLAJJ5.js → Pre.stories-BHVX2jFF.js} +1 -1
  31. package/storybook-static/assets/{Sidebar.stories-Ck4U5ocr.js → Sidebar.stories-CtYcwtfR.js} +1 -1
  32. package/storybook-static/assets/{Steps.stories-DJGuK21z.js → Steps.stories-lNmlIaIJ.js} +1 -1
  33. package/storybook-static/assets/{SubNav.stories-C6zqzDri.js → SubNav.stories-DH8b0a7D.js} +1 -1
  34. package/storybook-static/assets/Table.stories-B6GQYi2j.js +72 -0
  35. package/storybook-static/assets/{UnderlineNav-yn8_whBd-Bbi7p2g-.js → UnderlineNav-C2aEVraN-9GpY15Jh.js} +41 -36
  36. package/storybook-static/assets/{_rollupPluginBabelHelpers-Dh5BmVB--DyHbsKhl.js → _rollupPluginBabelHelpers-DsEzE6Ab-CerVq3GU.js} +1 -1
  37. package/storybook-static/assets/{chevron-right-B9VhLASW.js → chevron-right-MQoc73cD.js} +1 -1
  38. package/storybook-static/assets/{chunk-K6AXKMTT-BnQROexa.js → chunk-K6AXKMTT-CzEIZnfC.js} +1 -1
  39. package/storybook-static/assets/content-B1kn5ITj.js +22 -0
  40. package/storybook-static/assets/{browser.esm-CjKZlQaR.js → copy-DNsBvoDT.js} +12 -12
  41. package/storybook-static/assets/entry-preview-PtW0VFtQ.js +2 -0
  42. package/storybook-static/assets/{entry-preview-docs-B1zb5AAd.js → entry-preview-docs-D4yhrvjB.js} +1 -1
  43. package/storybook-static/assets/{iframe-VEPF5FFi.js → iframe-20rzKf4k.js} +2 -2
  44. package/storybook-static/assets/index-BPIV5q2-.js +18 -0
  45. package/storybook-static/assets/index-BdGwgT04.js +9 -0
  46. package/storybook-static/assets/{index-BxVt_j7t.js → index-C3_PYvTT.js} +1 -1
  47. package/storybook-static/assets/{index-D1ZprCIH.js → index-C7VnYWJ0.js} +2 -2
  48. package/storybook-static/assets/{index-C2_NlWRN.js → index-CGqnQ2T-.js} +1 -1
  49. package/storybook-static/assets/{index-0nua7n0t.js → index-DXayMMq-.js} +1 -1
  50. package/storybook-static/assets/{layouts-DvpaRV78.js → layouts-BwYpnzso.js} +1 -1
  51. package/storybook-static/assets/preview-CoMWgYGQ.css +1 -0
  52. package/storybook-static/assets/{preview-BK56XEt8.js → preview-jqfvLFBB.js} +2 -2
  53. package/storybook-static/assets/react-18-DQs0uuxx.js +25 -0
  54. package/storybook-static/assets/test-utils-Di69x3Vj.js +9 -0
  55. package/storybook-static/assets/themes-designsystem.stories-DJ0jz3mR.js +11 -0
  56. package/storybook-static/assets/themes.stories-BEC7n9_k.js +41 -0
  57. package/storybook-static/assets/{writer-BNuXwA0f.js → writer-kuuIP814.js} +3 -3
  58. package/storybook-static/iframe.html +1 -1
  59. package/storybook-static/index.html +1 -1
  60. package/storybook-static/index.json +1 -1
  61. package/storybook-static/project.json +1 -1
  62. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +1 -1
  63. package/storybook-static/sb-manager/globals-runtime.js +1 -1
  64. package/tsconfig.json +16 -11
  65. package/storybook-static/assets/CodeSample.stories-ygE0LGuD.js +0 -22
  66. package/storybook-static/assets/Table.stories-zUHxRyRv.js +0 -43
  67. package/storybook-static/assets/content-BSQS1YU1.js +0 -8
  68. package/storybook-static/assets/entry-preview-BTiD55pK.js +0 -2
  69. package/storybook-static/assets/index-B7gF9TUu.js +0 -9
  70. package/storybook-static/assets/index-UoN3NoLW.js +0 -17
  71. package/storybook-static/assets/preview-EtXI0_34.css +0 -1
  72. package/storybook-static/assets/react-18-BsB9_d4u.js +0 -25
  73. package/storybook-static/assets/test-utils-CHVDXiZU.js +0 -9
  74. package/storybook-static/assets/themes-designsystem.stories-D43FSrQO.js +0 -11
  75. package/storybook-static/assets/themes.stories-CNT0emaP.js +0 -41
  76. package/tsconfig.app.json +0 -24
  77. package/tsconfig.node.json +0 -13
  78. /package/storybook-static/assets/{preview-BOIWi3FM.js → preview-DQn0GC_k.js} +0 -0
@@ -0,0 +1,192 @@
1
+ # Package Index
2
+
3
+ These are all the API packages. See all [API symbols](#).
4
+
5
+ <TableV2>
6
+ <TableV2.Head>
7
+ <TableV2.Tr>
8
+ <TableV2.Th>Package</TableV2.Th>
9
+ <TableV2.Th numeric>Description</TableV2.Th>
10
+ </TableV2.Tr>
11
+ </TableV2.Head>
12
+ <TableV2.Tr>
13
+ <TableV2.Td>
14
+ <TableV2.ModelCell>
15
+ [`@xyd-js/atlas`](#)
16
+ </TableV2.ModelCell>
17
+ </TableV2.Td>
18
+ <TableV2.Td numeric muted>
19
+ <TableV2.Cell>
20
+ API Reference template
21
+ </TableV2.Cell>
22
+ </TableV2.Td>
23
+ </TableV2.Tr>
24
+ <TableV2.Tr>
25
+ <TableV2.Td>
26
+ <TableV2.ModelCell>
27
+ [`@xyd-js/cli`](#)
28
+ </TableV2.ModelCell>
29
+ </TableV2.Td>
30
+ <TableV2.Td numeric muted>
31
+ <TableV2.Cell>
32
+ Command line interface tools
33
+ </TableV2.Cell>
34
+ </TableV2.Td>
35
+ </TableV2.Tr>
36
+ <TableV2.Tr>
37
+ <TableV2.Td>
38
+ <TableV2.ModelCell>
39
+ [`@xyd-js/components`](#)
40
+ </TableV2.ModelCell>
41
+ </TableV2.Td>
42
+ <TableV2.Td numeric muted>
43
+ <TableV2.Cell>
44
+ Shared React components library
45
+ </TableV2.Cell>
46
+ </TableV2.Td>
47
+ </TableV2.Tr>
48
+ <TableV2.Tr>
49
+ <TableV2.Td>
50
+ <TableV2.ModelCell>
51
+ [`@xyd-js/content`](#)
52
+ </TableV2.ModelCell>
53
+ </TableV2.Td>
54
+ <TableV2.Td numeric muted>
55
+ <TableV2.Cell>
56
+ Content management and MDX utilities
57
+ </TableV2.Cell>
58
+ </TableV2.Td>
59
+ </TableV2.Tr>
60
+ <TableV2.Tr>
61
+ <TableV2.Td>
62
+ <TableV2.ModelCell>
63
+ [`@xyd-js/core`](#)
64
+ </TableV2.ModelCell>
65
+ </TableV2.Td>
66
+ <TableV2.Td numeric muted>
67
+ <TableV2.Cell>
68
+ Core utilities and shared functionality
69
+ </TableV2.Cell>
70
+ </TableV2.Td>
71
+ </TableV2.Tr>
72
+ <TableV2.Tr>
73
+ <TableV2.Td>
74
+ <TableV2.ModelCell>
75
+ [`@xyd-js/documan`](#)
76
+ </TableV2.ModelCell>
77
+ </TableV2.Td>
78
+ <TableV2.Td numeric muted>
79
+ <TableV2.Cell>
80
+ Documentation sever runner
81
+ </TableV2.Cell>
82
+ </TableV2.Td>
83
+ </TableV2.Tr>
84
+ <TableV2.Tr>
85
+ <TableV2.Td>
86
+ <TableV2.ModelCell>
87
+ [`@xyd-js/framework`](#)
88
+ </TableV2.ModelCell>
89
+ </TableV2.Td>
90
+ <TableV2.Td numeric muted>
91
+ <TableV2.Cell>
92
+ Bridge between core logic and ui
93
+ </TableV2.Cell>
94
+ </TableV2.Td>
95
+ </TableV2.Tr>
96
+ <TableV2.Tr>
97
+ <TableV2.Td>
98
+ <TableV2.ModelCell>
99
+ [`@xyd-js/gql`](#)
100
+ </TableV2.ModelCell>
101
+ </TableV2.Td>
102
+ <TableV2.Td numeric muted>
103
+ <TableV2.Cell>
104
+ GraphQL utilities and tools
105
+ </TableV2.Cell>
106
+ </TableV2.Td>
107
+ </TableV2.Tr>
108
+ <TableV2.Tr>
109
+ <TableV2.Td>
110
+ <TableV2.ModelCell>
111
+ [`@xyd-js/openapi`](#)
112
+ </TableV2.ModelCell>
113
+ </TableV2.Td>
114
+ <TableV2.Td numeric muted>
115
+ <TableV2.Cell>
116
+ OpenAPI specification tools
117
+ </TableV2.Cell>
118
+ </TableV2.Td>
119
+ </TableV2.Tr>
120
+ <TableV2.Tr>
121
+ <TableV2.Td>
122
+ <TableV2.ModelCell>
123
+ [`@xyd-js/plugin-zero`](#)
124
+ </TableV2.ModelCell>
125
+ </TableV2.Td>
126
+ <TableV2.Td numeric muted>
127
+ <TableV2.Cell>
128
+ Core documentation plugin
129
+ </TableV2.Cell>
130
+ </TableV2.Td>
131
+ </TableV2.Tr>
132
+ <TableV2.Tr>
133
+ <TableV2.Td>
134
+ <TableV2.ModelCell>
135
+ [`@xyd-js/storybook`](#)
136
+ </TableV2.ModelCell>
137
+ </TableV2.Td>
138
+ <TableV2.Td numeric muted>
139
+ <TableV2.Cell>
140
+ Component documentation and testing
141
+ </TableV2.Cell>
142
+ </TableV2.Td>
143
+ </TableV2.Tr>
144
+ <TableV2.Tr>
145
+ <TableV2.Td>
146
+ <TableV2.ModelCell>
147
+ [`@xyd-js/theme-poetry`](#)
148
+ </TableV2.ModelCell>
149
+ </TableV2.Td>
150
+ <TableV2.Td numeric muted>
151
+ <TableV2.Cell>
152
+ On of the default themes
153
+ </TableV2.Cell>
154
+ </TableV2.Td>
155
+ </TableV2.Tr>
156
+ <TableV2.Tr>
157
+ <TableV2.Td>
158
+ <TableV2.ModelCell>
159
+ [`@xyd-js/ui`](#)
160
+ </TableV2.ModelCell>
161
+ </TableV2.Td>
162
+ <TableV2.Td numeric muted>
163
+ <TableV2.Cell>
164
+ Core documentations ui elements
165
+ </TableV2.Cell>
166
+ </TableV2.Td>
167
+ </TableV2.Tr>
168
+ <TableV2.Tr>
169
+ <TableV2.Td>
170
+ <TableV2.ModelCell>
171
+ [`@xyd-js/uniform`](#)
172
+ </TableV2.ModelCell>
173
+ </TableV2.Td>
174
+ <TableV2.Td numeric muted>
175
+ <TableV2.Cell>
176
+ Unified formatting for API references
177
+ </TableV2.Cell>
178
+ </TableV2.Td>
179
+ </TableV2.Tr>
180
+ <TableV2.Tr>
181
+ <TableV2.Td>
182
+ <TableV2.ModelCell>
183
+ [`@xyd-js/xtokens`](#)
184
+ </TableV2.ModelCell>
185
+ </TableV2.Td>
186
+ <TableV2.Td numeric muted>
187
+ <TableV2.Cell>
188
+ Design tokens and theming system
189
+ </TableV2.Cell>
190
+ </TableV2.Td>
191
+ </TableV2.Tr>
192
+ </TableV2>
@@ -0,0 +1,131 @@
1
+ # Function `gqlSchemaToReferences`
2
+
3
+ :::code-group
4
+ ```ts
5
+ function gqlSchemaToReferences(
6
+ schemaLocation: string
7
+ ): Promise<Reference[]>
8
+ ```
9
+ :::
10
+
11
+ Converts a GraphQL schema file to a list of uniform references.
12
+
13
+ :::Details{kind="tertiary" title="<>Source code in <code>src/hello.ts</code></>" icon="<IconQuote/>"}
14
+ ```ts {from="index.ts"}
15
+ export async function gqlSchemaToReferences(
16
+ schemaLocation: string
17
+ ): Promise<Reference[]> {
18
+ const loadersList = {
19
+ ["GraphQLFileLoader"]: "@graphql-tools/graphql-file-loader",
20
+ }
21
+ const loaders = await getDocumentLoaders(loadersList);
22
+
23
+ // @ts-ignore TODO: but ts works in @graphql-markdown/core
24
+ const schema = await loadSchema(schemaLocation as string, loaders);
25
+
26
+ const references: Reference[] = []
27
+
28
+ const queries = schema.getRootType(OperationTypeNode.QUERY)
29
+ const queryFields = queries?.getFields?.()
30
+
31
+ if (queryFields) {
32
+ references.push(...gqlOperationsToUniformRef(
33
+ ReferenceType.GRAPHQL_QUERY,
34
+ queryFields
35
+ ))
36
+ }
37
+
38
+ const mutations = schema.getRootType(OperationTypeNode.MUTATION)
39
+ const mutationFields = mutations?.getFields?.()
40
+
41
+ if (mutationFields) {
42
+ references.push(...gqlOperationsToUniformRef(
43
+ ReferenceType.GRAPHQL_MUTATION,
44
+ mutationFields
45
+ ))
46
+ }
47
+
48
+ const typeMap = schema.getTypeMap();
49
+
50
+ for (const gqlType of Object.values(typeMap)) {
51
+ const builtInType = isSpecifiedScalarType(gqlType) ||
52
+ isIntrospectionType(gqlType) ||
53
+ gqlType.name === "Mutation"
54
+
55
+ if (builtInType) {
56
+ continue;
57
+ }
58
+
59
+ switch (gqlType.constructor.name) {
60
+ case 'GraphQLObjectType': {
61
+ const type = gqlType as GraphQLObjectType;
62
+
63
+ references.push(gqlObjectToUniformRef(type))
64
+
65
+ break
66
+ }
67
+
68
+ case 'GraphQLInputObjectType': {
69
+ const type = gqlType as GraphQLInputObjectType;
70
+
71
+ references.push(gqlInputToUniformRef(type))
72
+ break
73
+ }
74
+
75
+ case 'GraphQLEnumType': {
76
+ const type = gqlType as GraphQLEnumType;
77
+
78
+ references.push(gqlEnumToUniformRef(type))
79
+
80
+ break
81
+ }
82
+
83
+ case 'GraphQLScalarType': {
84
+ const type = gqlType as GraphQLScalarType
85
+
86
+ references.push(gqlScalarToUniformRef(type))
87
+
88
+ break
89
+ }
90
+
91
+ default: {
92
+ console.debug(`Unsupported type: ${gqlType.constructor.name}`)
93
+ }
94
+ }
95
+ }
96
+
97
+ return references
98
+ }
99
+ ```
100
+ :::
101
+
102
+ :::TableV2
103
+ ```ts
104
+ [
105
+ ["See also", ""],
106
+ ["[`@xyd-js/atlas`](#)", ""]
107
+ ]
108
+ ```
109
+ :::
110
+
111
+ ## Parameters
112
+ :::TableV2
113
+ ```ts
114
+ [
115
+ ["Name", "Type", "Description"],
116
+ ["`schemaLocation`", "`string`", "The location of the GraphQL schema file."]
117
+ ]
118
+ ```
119
+ :::
120
+
121
+ ## Returns
122
+ :::TableV2
123
+ ```ts
124
+ [
125
+ ["Type", "Description"],
126
+ ["`Promise<Resolve[]>`", "The list of uniform references."]
127
+ ]
128
+ ```
129
+ :::
130
+
131
+
@@ -0,0 +1,53 @@
1
+ # Agents
2
+
3
+ ## ToolsToFinalOutputFunction `module-attribute`
4
+
5
+ :::code-group
6
+ ```py
7
+ ToolsToFinalOutputFunction: TypeAlias = Callable[
8
+ [RunContextWrapper[TContext], list[FunctionToolResult]],
9
+ MaybeAwaitable[ToolsToFinalOutputResult],
10
+ ]
11
+ ```
12
+ :::
13
+
14
+ A function that takes a run context and a list of tool results, and returns a `ToolToFinalOutputResult`.
15
+
16
+ ## ToolsToFinalOutputResult `dataclass`
17
+
18
+ :::code-group
19
+ ```py
20
+ ToolsToFinalOutputResult: TypeAlias = Union[
21
+ FinalOutput,
22
+ Tuple[FinalOutput, list[FunctionToolResult]],
23
+ ]
24
+ ```
25
+ :::
26
+
27
+ ### is_final_output `instance-attribute`
28
+
29
+
30
+ <Details
31
+ kind="tertiary"
32
+ title={<>
33
+ Source code in
34
+ <code>src/agents/agent.py</code>
35
+ </>
36
+ }
37
+ icon={<IconQuote/>}
38
+ >
39
+ ```py
40
+ @dataclass
41
+ class ToolsToFinalOutputResult:
42
+ is_final_output: bool
43
+ """Whether this is the final output. If False, the LLM will run again and receive the tool call
44
+ output.
45
+ """
46
+
47
+ final_output: Any | None = None
48
+ """The final output. Can be None if `is_final_output` is False, otherwise must match the
49
+ `output_type` of the agent.
50
+ """
51
+ ```
52
+ </Details>
53
+
@@ -5,20 +5,14 @@ import {Reference} from '@xyd-js/uniform';
5
5
  import {Atlas} from "@xyd-js/atlas";
6
6
 
7
7
  import {uniformToReferences} from "./uniform-to-references";
8
- import {MDXReference} from "../../utils/mdx.ts";
9
-
10
- const HelloWorld = () => {
11
- return <h1>Hello, World!</h1>;
12
- };
8
+ import {MDXReference} from "../../utils/mdx";
13
9
 
14
10
  export default {
15
11
  title: 'Atlas/Atlas',
16
- component: HelloWorld,
12
+ component: Atlas,
17
13
  } as Meta;
18
14
 
19
- // const Template = (args) => <Atlas/>;
20
-
21
- const Template = (args) => {
15
+ const Template = (args: any) => {
22
16
  const [references, setReferences] = useState<MDXReference<Reference[]> | []>([])
23
17
 
24
18
  async function load() {
@@ -45,3 +39,4 @@ const Template = (args) => {
45
39
 
46
40
  export const Default = Template.bind({});
47
41
  Default.args = {};
42
+
@@ -0,0 +1,130 @@
1
+ import React, {useState, useEffect} from 'react';
2
+ import type {Meta} from '@storybook/react';
3
+
4
+ import {Reference} from '@xyd-js/uniform';
5
+ import {
6
+ CodeSample,
7
+ } from '@xyd-js/components/coder';
8
+ import {
9
+ TableV2
10
+ } from "@xyd-js/components/writer";
11
+ import {LayoutPrimary} from "@xyd-js/components/layouts";
12
+ import getContentComponents from "@xyd-js/components/content"
13
+ import {AtlasIndex} from "@xyd-js/atlas/atlas-index"
14
+
15
+ import PackageIndexWip1Content from "../../content/atlas-index/wip1.mdx"
16
+
17
+ import {
18
+ DemoNavbar,
19
+ DemoSubNav,
20
+ DemoSidebar,
21
+ DemoContent,
22
+ DemoTOC
23
+ } from "../../components/DemoWireframe";
24
+
25
+ export default {
26
+ title: 'Atlas/AtlasIndex',
27
+ component: AtlasIndex,
28
+ } as Meta;
29
+
30
+ const contentComponents = getContentComponents()
31
+
32
+ const Content = {
33
+ Text: contentComponents.p,
34
+ Details: contentComponents.Details,
35
+ IconQuote: contentComponents.IconQuote,
36
+ Code: contentComponents.code,
37
+ Heading1: contentComponents.h1,
38
+ Heading2: contentComponents.h2,
39
+ Container: contentComponents.Content,
40
+ CodeSample: contentComponents.CodeSample
41
+ }
42
+
43
+ export const Default = () => {
44
+ return <LayoutPrimary
45
+ header={<DemoNavbar/>}
46
+ subheader={<DemoSubNav/>}
47
+ aside={<DemoSidebar/>}
48
+ content={<>
49
+ {/*<FakeContent/>*/}
50
+ <AtlasIndex data={exampleUniform}/>
51
+ </>}
52
+ contentNav={<DemoTOC/>}
53
+ layoutSize="large"
54
+ />
55
+ }
56
+
57
+ function FakeContent() {
58
+ return <DemoContent breadcrumbs={false}>
59
+ {<PackageIndexWip1Content components={{
60
+ ...contentComponents,
61
+ pre: Pre,
62
+ TableV2
63
+ }}/>}
64
+ </DemoContent>
65
+ }
66
+
67
+ function Pre({children, ...rest}: { children: React.ReactNode }) {
68
+ const codeElement = children as any
69
+ if (!children) {
70
+ return null
71
+ }
72
+
73
+ const {className, children: codeChildren} = codeElement.props;
74
+ const language = className?.replace('language-', '') || '';
75
+ const codeContent = codeChildren || '';
76
+
77
+ return <CodeSample
78
+ name={language}
79
+ description={""}
80
+ codeblocks={[
81
+ {
82
+ value: codeContent,
83
+ lang: language,
84
+ meta: language,
85
+ }
86
+ ]}
87
+ size="full"
88
+ kind="secondary"
89
+ />
90
+ }
91
+
92
+ const exampleUniform = {
93
+ "title": "Function gqlSchemaToReferences",
94
+ "canonical": "fn-gqlSchemaToReferences",
95
+ "description": "Converts a GraphQL schema file to references.\n",
96
+ "context": {
97
+ "fileName": "index.ts",
98
+ "fileFullPath": "src/index.ts",
99
+ "line": 48,
100
+ "col": 16,
101
+ "signatureText": "export function gqlSchemaToReferences(schemaLocation: string): Promise<[\n]>;",
102
+ "sourcecode": "export function gqlSchemaToReferences(\n schemaLocation: string\n): Promise<[]> {\n if (schemaLocation.endsWith(\".graphql\")) {\n return Promise.resolve([])\n }\n\n return Promise.resolve([])\n}",
103
+ "package": "@xyd-sources-examples/package-a"
104
+ },
105
+ "examples": {
106
+ "groups": []
107
+ },
108
+ "definitions": [
109
+ {
110
+ "title": "Returns",
111
+ "properties": [
112
+ {
113
+ "name": "",
114
+ "type": "<Promise>",
115
+ "description": "references\n"
116
+ }
117
+ ]
118
+ },
119
+ {
120
+ "title": "Parameters",
121
+ "properties": [
122
+ {
123
+ "name": "schemaLocation",
124
+ "type": "string",
125
+ "description": "The location of the schema file.\n"
126
+ }
127
+ ]
128
+ }
129
+ ]
130
+ } as Reference
@@ -3,6 +3,7 @@ import type {Meta} from '@storybook/react';
3
3
 
4
4
  import {
5
5
  Table,
6
+ TableV2
6
7
  } from '@xyd-js/components/writer';
7
8
 
8
9
  export default {
@@ -52,3 +53,34 @@ export const Default = () => {
52
53
  </Table>
53
54
  </div>
54
55
  }
56
+
57
+ export const V2 = () => {
58
+ return <TableV2>
59
+ <TableV2.Head>
60
+ <TableV2.Tr>
61
+ <TableV2.Th>Model</TableV2.Th>
62
+ <TableV2.Th numeric>Training</TableV2.Th>
63
+ <TableV2.Th numeric>Input</TableV2.Th>
64
+ <TableV2.Th numeric>Cached input</TableV2.Th>
65
+ <TableV2.Th numeric>Output</TableV2.Th>
66
+ </TableV2.Tr>
67
+ </TableV2.Head>
68
+ <TableV2.Tr>
69
+ <TableV2.Td>
70
+ <TableV2.ModelCell>gpt-4o-2024-08-06</TableV2.ModelCell>
71
+ </TableV2.Td>
72
+ <TableV2.Td numeric>
73
+ <TableV2.Cell>$25.00</TableV2.Cell>
74
+ </TableV2.Td>
75
+ <TableV2.Td numeric>
76
+ <TableV2.Cell>$3.75</TableV2.Cell>
77
+ </TableV2.Td>
78
+ <TableV2.Td numeric muted>
79
+ <TableV2.Cell>$1.875</TableV2.Cell>
80
+ </TableV2.Td>
81
+ <TableV2.Td numeric>
82
+ <TableV2.Cell>$15.00</TableV2.Cell>
83
+ </TableV2.Td>
84
+ </TableV2.Tr>
85
+ </TableV2>
86
+ }
@@ -3,7 +3,6 @@ import type {Meta} from '@storybook/react';
3
3
  import {MemoryRouter} from "react-router";
4
4
 
5
5
  import {
6
- Layout,
7
6
  LayoutPrimary
8
7
  } from '@xyd-js/components/layouts';
9
8
 
@@ -19,7 +18,7 @@ import {
19
18
  UISidebar
20
19
  } from "@xyd-js/ui"
21
20
 
22
- import {LiveSessionPlatformLogo} from "./logo.tsx";
21
+ import {LiveSessionPlatformLogo} from "./logo";
23
22
  import Content from "../../content/hello-world.mdx";
24
23
 
25
24
  export default {
@@ -33,17 +32,18 @@ export default {
33
32
 
34
33
  export const Default = () => {
35
34
  return <LayoutPrimary
36
- header={<DemoNavbar/>}
37
- subheader
38
- aside={<DemoSidebar/>}
39
- content={<DemoContent/>}
40
- contentNav={<DemoTOC/>}
35
+ header={<$DemoNavbar/>}
36
+ subheader={<$DemoSubNav/>}
37
+ aside={<$DemoSidebar/>}
38
+ content={<$DemoContent/>}
39
+ contentNav={<$DemoTOC/>}
41
40
  />
42
41
  }
43
42
 
44
- function DemoNavbar() {
43
+ function $DemoNavbar() {
45
44
  return <>
46
45
  <Nav
46
+ onChange={() => {}}
47
47
  value="api-reference"
48
48
  logo={<LiveSessionPlatformLogo/>}
49
49
  kind="middle"
@@ -58,21 +58,24 @@ function DemoNavbar() {
58
58
  GraphQL
59
59
  </Nav.Item>
60
60
  </Nav>
61
- <SubNav title="Apps" value="build">
62
- <SubNav.Item value="build" href="/build">
63
- Build
64
- </SubNav.Item>
65
- <SubNav.Item value="design" href="/design">
66
- Design
67
- </SubNav.Item>
68
- <SubNav.Item value="launch" href="/launch">
69
- Launch
70
- </SubNav.Item>
71
- </SubNav>
72
61
  </>
73
62
  }
74
63
 
75
- function DemoSidebar() {
64
+ function $DemoSubNav() {
65
+ return <SubNav onChange={() => {}} title="Apps" value="build">
66
+ <SubNav.Item value="build" href="/build">
67
+ Build
68
+ </SubNav.Item>
69
+ <SubNav.Item value="design" href="/design">
70
+ Design
71
+ </SubNav.Item>
72
+ <SubNav.Item value="launch" href="/launch">
73
+ Launch
74
+ </SubNav.Item>
75
+ </SubNav>
76
+ }
77
+
78
+ function $DemoSidebar() {
76
79
  const [isOpen, setIsOpen] = useState(false)
77
80
 
78
81
  function onClick() {
@@ -84,7 +87,7 @@ function DemoSidebar() {
84
87
  </UISidebar.Item>
85
88
  )
86
89
 
87
- return <UISidebar footerItems={<DemoSidebarFooter/>}>
90
+ return <UISidebar footerItems={<$DemoSidebarFooter/>}>
88
91
  <UISidebar.ItemHeader>
89
92
  GET STARTED
90
93
  </UISidebar.ItemHeader>
@@ -131,7 +134,7 @@ function DemoSidebar() {
131
134
  </UISidebar>
132
135
  }
133
136
 
134
- function DemoSidebarFooter() {
137
+ function $DemoSidebarFooter() {
135
138
  return <>
136
139
  <UISidebar.FooterItem
137
140
  href="#"
@@ -209,7 +212,7 @@ function DemoSidebarFooter() {
209
212
  }
210
213
 
211
214
 
212
- function DemoContent() {
215
+ function $DemoContent() {
213
216
  return <>
214
217
  <Breadcrumbs
215
218
  items={[
@@ -245,7 +248,7 @@ function DemoContent() {
245
248
  </>
246
249
  }
247
250
 
248
- function DemoTOC() {
251
+ function $DemoTOC() {
249
252
  return <Toc defaultValue="quickstart">
250
253
  <Toc.Item value="quickstart">
251
254
  Quickstart