polen 0.10.0-next.11 → 0.10.0-next.13
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/build/api/builder/builder.js +1 -1
- package/build/api/builder/builder.js.map +1 -1
- package/build/api/config/load.js +1 -1
- package/build/api/config/load.js.map +1 -1
- package/build/api/vite/plugins/build.js +1 -1
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +0 -2
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/pages.js +1 -1
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/exports/components.d.ts +4 -1
- package/build/exports/components.d.ts.map +1 -1
- package/build/exports/components.js +4 -1
- package/build/exports/components.js.map +1 -1
- package/build/lib/demos/config-schema.d.ts +6 -6
- package/build/lib/github-actions/runner.js +2 -2
- package/build/lib/github-actions/runner.js.map +1 -1
- package/build/lib/graphql-document/$$.d.ts +5 -0
- package/build/lib/graphql-document/$$.d.ts.map +1 -0
- package/build/lib/graphql-document/$$.js +5 -0
- package/build/lib/graphql-document/$$.js.map +1 -0
- package/build/lib/graphql-document/$.d.ts +2 -0
- package/build/lib/graphql-document/$.d.ts.map +1 -0
- package/build/lib/graphql-document/$.js +2 -0
- package/build/lib/graphql-document/$.js.map +1 -0
- package/build/lib/graphql-document/analysis.d.ts +44 -0
- package/build/lib/graphql-document/analysis.d.ts.map +1 -0
- package/build/lib/graphql-document/analysis.js +361 -0
- package/build/lib/graphql-document/analysis.js.map +1 -0
- package/build/lib/graphql-document/components/CopyButton.d.ts +19 -0
- package/build/lib/graphql-document/components/CopyButton.d.ts.map +1 -0
- package/build/lib/graphql-document/components/CopyButton.js +43 -0
- package/build/lib/graphql-document/components/CopyButton.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +38 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.js +130 -0
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +7 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +45 -0
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +33 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +1 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +48 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +1 -0
- package/build/lib/graphql-document/components/IdentifierLink.d.ts +39 -0
- package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +1 -0
- package/build/lib/graphql-document/components/IdentifierLink.js +75 -0
- package/build/lib/graphql-document/components/IdentifierLink.js.map +1 -0
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts +5 -0
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +1 -0
- package/build/lib/graphql-document/components/graphql-document-styles.js +167 -0
- package/build/lib/graphql-document/components/graphql-document-styles.js.map +1 -0
- package/build/lib/graphql-document/components/index.d.ts +6 -0
- package/build/lib/graphql-document/components/index.d.ts.map +1 -0
- package/build/lib/graphql-document/components/index.js +6 -0
- package/build/lib/graphql-document/components/index.js.map +1 -0
- package/build/lib/graphql-document/example.d.ts +25 -0
- package/build/lib/graphql-document/example.d.ts.map +1 -0
- package/build/lib/graphql-document/example.js +140 -0
- package/build/lib/graphql-document/example.js.map +1 -0
- package/build/lib/graphql-document/graphql-document.d.ts +35 -0
- package/build/lib/graphql-document/graphql-document.d.ts.map +1 -0
- package/build/lib/graphql-document/graphql-document.js +36 -0
- package/build/lib/graphql-document/graphql-document.js.map +1 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +43 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +1 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.js +132 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +1 -0
- package/build/lib/graphql-document/positioning-simple.d.ts +68 -0
- package/build/lib/graphql-document/positioning-simple.d.ts.map +1 -0
- package/build/lib/graphql-document/positioning-simple.js +197 -0
- package/build/lib/graphql-document/positioning-simple.js.map +1 -0
- package/build/lib/graphql-document/schema-context.d.ts +8 -0
- package/build/lib/graphql-document/schema-context.d.ts.map +1 -0
- package/build/lib/graphql-document/schema-context.js +11 -0
- package/build/lib/graphql-document/schema-context.js.map +1 -0
- package/build/lib/graphql-document/schema-integration-example.d.ts +27 -0
- package/build/lib/graphql-document/schema-integration-example.d.ts.map +1 -0
- package/build/lib/graphql-document/schema-integration-example.js +297 -0
- package/build/lib/graphql-document/schema-integration-example.js.map +1 -0
- package/build/lib/graphql-document/schema-integration.d.ts +135 -0
- package/build/lib/graphql-document/schema-integration.d.ts.map +1 -0
- package/build/lib/graphql-document/schema-integration.js +328 -0
- package/build/lib/graphql-document/schema-integration.js.map +1 -0
- package/build/lib/graphql-document/types.d.ts +117 -0
- package/build/lib/graphql-document/types.d.ts.map +1 -0
- package/build/lib/graphql-document/types.js +2 -0
- package/build/lib/graphql-document/types.js.map +1 -0
- package/build/template/components/ArgumentAnnotation.js +10 -0
- package/build/template/components/ArgumentAnnotation.js.map +1 -0
- package/build/template/components/ArgumentList.js +9 -0
- package/build/template/components/ArgumentList.js.map +1 -0
- package/build/template/components/ArgumentListAnnotation.js +15 -0
- package/build/template/components/ArgumentListAnnotation.js.map +1 -0
- package/build/template/components/Changelog.js +44 -0
- package/build/template/components/Changelog.js.map +1 -0
- package/build/template/components/{CodeBlock.jsx → CodeBlock.js} +4 -5
- package/build/template/components/{CodeBlock.jsx.map → CodeBlock.js.map} +1 -1
- package/build/template/components/{CodeBlockEnhancer.jsx → CodeBlockEnhancer.js} +4 -4
- package/build/template/components/CodeBlockEnhancer.js.map +1 -0
- package/build/template/components/DeprecationReason.js +9 -0
- package/build/template/components/DeprecationReason.js.map +1 -0
- package/build/template/components/Description.js +9 -0
- package/build/template/components/Description.js.map +1 -0
- package/build/template/components/Field.js +14 -0
- package/build/template/components/Field.js.map +1 -0
- package/build/template/components/{FieldList.jsx → FieldList.js} +4 -5
- package/build/template/components/FieldList.js.map +1 -0
- package/build/template/components/{FieldListSection.jsx → FieldListSection.js} +4 -6
- package/build/template/components/FieldListSection.js.map +1 -0
- package/build/template/components/HamburgerMenu.js +30 -0
- package/build/template/components/HamburgerMenu.js.map +1 -0
- package/build/template/components/Link.d.ts +1 -1
- package/build/template/components/{Link.jsx → Link.js} +4 -5
- package/build/template/components/Link.js.map +1 -0
- package/build/template/components/Logo.js +20 -0
- package/build/template/components/Logo.js.map +1 -0
- package/build/template/components/MDXComponents.d.ts +11 -0
- package/build/template/components/MDXComponents.d.ts.map +1 -0
- package/build/template/components/MDXComponents.js +70 -0
- package/build/template/components/MDXComponents.js.map +1 -0
- package/build/template/components/{Markdown.jsx → Markdown.js} +3 -2
- package/build/template/components/Markdown.js.map +1 -0
- package/build/template/components/MissingSchema.d.ts +1 -1
- package/build/template/components/MissingSchema.d.ts.map +1 -1
- package/build/template/components/MissingSchema.js +5 -0
- package/build/template/components/MissingSchema.js.map +1 -0
- package/build/template/components/NamedType.js +12 -0
- package/build/template/components/NamedType.js.map +1 -0
- package/build/template/components/NotFound.js +7 -0
- package/build/template/components/NotFound.js.map +1 -0
- package/build/template/components/{RadixLink.jsx → RadixLink.js} +1 -1
- package/build/template/components/RadixLink.js.map +1 -0
- package/build/template/components/TestComponent.d.ts +5 -0
- package/build/template/components/TestComponent.d.ts.map +1 -0
- package/build/template/components/TestComponent.js +7 -0
- package/build/template/components/TestComponent.js.map +1 -0
- package/build/template/components/Texts/{MinorHeading.jsx → MinorHeading.js} +4 -3
- package/build/template/components/Texts/MinorHeading.js.map +1 -0
- package/build/template/components/Texts/texts.js +1 -1
- package/build/template/components/Texts/texts.js.map +1 -1
- package/build/template/components/ThemeToggle.js +9 -0
- package/build/template/components/ThemeToggle.js.map +1 -0
- package/build/template/components/{TypeAnnotation.jsx → TypeAnnotation.js} +8 -18
- package/build/template/components/TypeAnnotation.js.map +1 -0
- package/build/template/components/TypeFieldsLinkList.js +9 -0
- package/build/template/components/TypeFieldsLinkList.js.map +1 -0
- package/build/template/components/TypeIndex.js +17 -0
- package/build/template/components/TypeIndex.js.map +1 -0
- package/build/template/components/content/$$.d.ts +1 -0
- package/build/template/components/content/$$.d.ts.map +1 -1
- package/build/template/components/content/$$.js +1 -0
- package/build/template/components/content/$$.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts +8 -0
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +1 -0
- package/build/template/components/content/GraphQLDocumentWithSchema.js +16 -0
- package/build/template/components/content/GraphQLDocumentWithSchema.js.map +1 -0
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts +7 -0
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +1 -0
- package/build/template/components/content/GraphQLDocumentWrapper.js +62 -0
- package/build/template/components/content/GraphQLDocumentWrapper.js.map +1 -0
- package/build/template/components/graphql/graphql.d.ts +2 -2
- package/build/template/components/graphql/graphql.js +3 -0
- package/build/template/components/graphql/graphql.js.map +1 -0
- package/build/template/components/graphql/index.d.ts +1 -1
- package/build/template/components/graphql/index.js +1 -1
- package/build/template/components/graphql/index.js.map +1 -1
- package/build/template/components/graphql/{type-kind-icon.jsx → type-kind-icon.js} +3 -2
- package/build/template/components/graphql/type-kind-icon.js.map +1 -0
- package/build/template/components/graphql/type-link.js +11 -0
- package/build/template/components/graphql/type-link.js.map +1 -0
- package/build/template/components/sidebar/Sidebar.d.ts +1 -1
- package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
- package/build/template/components/sidebar/Sidebar.js +11 -0
- package/build/template/components/sidebar/Sidebar.js.map +1 -0
- package/build/template/components/sidebar/{SidebarItem.jsx → SidebarItem.js} +15 -32
- package/build/template/components/sidebar/SidebarItem.js.map +1 -0
- package/build/template/components/sidebar/ToggleButton.d.ts +1 -1
- package/build/template/components/sidebar/ToggleButton.d.ts.map +1 -1
- package/build/template/components/sidebar/ToggleButton.js +5 -0
- package/build/template/components/sidebar/ToggleButton.js.map +1 -0
- package/build/template/contexts/{ThemeContext.jsx → ThemeContext.js} +3 -4
- package/build/template/contexts/{ThemeContext.jsx.map → ThemeContext.js.map} +1 -1
- package/build/template/entry.client.d.ts +1 -0
- package/build/template/entry.client.d.ts.map +1 -1
- package/build/template/{entry.client.jsx → entry.client.js} +5 -6
- package/build/template/entry.client.js.map +1 -0
- package/build/template/routes/changelog.d.ts +1 -1
- package/build/template/routes/{changelog.jsx → changelog.js} +5 -4
- package/build/template/routes/changelog.js.map +1 -0
- package/build/template/routes/{index.jsx → index.js} +3 -2
- package/build/template/routes/index.js.map +1 -0
- package/build/template/routes/reference.$type.$field.d.ts +1 -1
- package/build/template/routes/{reference.$type.$field.jsx → reference.$type.$field.js} +6 -5
- package/build/template/routes/reference.$type.$field.js.map +1 -0
- package/build/template/routes/reference.$type.d.ts +1 -1
- package/build/template/routes/{reference.$type.jsx → reference.$type.js} +6 -5
- package/build/template/routes/reference.$type.js.map +1 -0
- package/build/template/routes/reference.d.ts +2 -2
- package/build/template/routes/{reference.jsx → reference.js} +6 -7
- package/build/template/routes/reference.js.map +1 -0
- package/build/template/routes/root.d.ts +2 -2
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/{root.jsx → root.js} +46 -88
- package/build/template/routes/root.js.map +1 -0
- package/build/template/routes.js +5 -0
- package/build/template/routes.js.map +1 -0
- package/build/template/server/app.js +1 -1
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/{render-page.jsx → render-page.js} +3 -4
- package/build/template/server/render-page.js.map +1 -0
- package/build/template/server/ssg/generate.js +1 -1
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/server/ssg/get-route-paths.js +1 -1
- package/build/template/server/ssg/get-route-paths.js.map +1 -1
- package/build/template/server/view.js +1 -1
- package/build/template/server/view.js.map +1 -1
- package/package.json +57 -8
- package/src/api/vite/plugins/core.ts +0 -3
- package/src/api/vite/plugins/pages.ts +1 -1
- package/src/exports/components.ts +4 -1
- package/src/lib/graphql-document/$$.ts +4 -0
- package/src/lib/graphql-document/$.test.ts +132 -0
- package/src/lib/graphql-document/$.ts +1 -0
- package/src/lib/graphql-document/README.md +102 -0
- package/src/lib/graphql-document/analysis.ts +415 -0
- package/src/lib/graphql-document/components/CopyButton.tsx +76 -0
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +250 -0
- package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +188 -0
- package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +70 -0
- package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +197 -0
- package/src/lib/graphql-document/components/IdentifierLink.tsx +160 -0
- package/src/lib/graphql-document/components/graphql-document-styles.ts +167 -0
- package/src/lib/graphql-document/components/index.ts +5 -0
- package/src/lib/graphql-document/demo.md +155 -0
- package/src/lib/graphql-document/example.ts +163 -0
- package/src/lib/graphql-document/graphql-document.ts +37 -0
- package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +76 -0
- package/src/lib/graphql-document/hooks/use-tooltip-state.ts +191 -0
- package/src/lib/graphql-document/positioning-simple.test.ts +252 -0
- package/src/lib/graphql-document/positioning-simple.ts +271 -0
- package/src/lib/graphql-document/schema-context.tsx +20 -0
- package/src/lib/graphql-document/schema-integration-example.ts +341 -0
- package/src/lib/graphql-document/schema-integration.test.ts +365 -0
- package/src/lib/graphql-document/schema-integration.ts +497 -0
- package/src/lib/graphql-document/types.ts +129 -0
- package/src/template/components/ArgumentAnnotation.tsx +1 -1
- package/src/template/components/ArgumentList.tsx +1 -1
- package/src/template/components/ArgumentListAnnotation.tsx +2 -2
- package/src/template/components/CodeBlockEnhancer.tsx +21 -21
- package/src/template/components/DeprecationReason.tsx +1 -1
- package/src/template/components/Description.tsx +1 -1
- package/src/template/components/Field.tsx +4 -4
- package/src/template/components/FieldList.tsx +1 -1
- package/src/template/components/FieldListSection.tsx +1 -1
- package/src/template/components/Link.tsx +2 -2
- package/src/template/components/MDXComponents.tsx +101 -0
- package/src/template/components/NamedType.tsx +2 -2
- package/src/template/components/TestComponent.tsx +6 -0
- package/src/template/components/TypeAnnotation.tsx +1 -1
- package/src/template/components/TypeFieldsLinkList.tsx +1 -1
- package/src/template/components/TypeIndex.tsx +1 -1
- package/src/template/components/content/$$.ts +1 -0
- package/src/template/components/content/GraphQLDocumentWithSchema.tsx +18 -0
- package/src/template/components/content/GraphQLDocumentWrapper.tsx +82 -0
- package/src/template/components/graphql/graphql.tsx +2 -2
- package/src/template/components/graphql/index.ts +1 -1
- package/src/template/components/graphql/type-link.tsx +2 -2
- package/src/template/entry.client.tsx +2 -2
- package/src/template/routes/changelog.tsx +1 -1
- package/src/template/routes/reference.$type.$field.tsx +3 -3
- package/src/template/routes/reference.$type.tsx +3 -3
- package/src/template/routes/reference.tsx +3 -3
- package/src/template/routes/root.tsx +36 -25
- package/src/template/routes.tsx +1 -1
- package/src/template/server/app.ts +1 -1
- package/src/template/server/ssg/generate.ts +1 -1
- package/src/template/server/ssg/get-route-paths.ts +1 -1
- package/src/template/server/view.ts +1 -1
- package/src/template/styles/code-block.css +32 -0
- package/build/template/components/ArgumentAnnotation.jsx +0 -16
- package/build/template/components/ArgumentAnnotation.jsx.map +0 -1
- package/build/template/components/ArgumentList.jsx +0 -16
- package/build/template/components/ArgumentList.jsx.map +0 -1
- package/build/template/components/ArgumentListAnnotation.jsx +0 -23
- package/build/template/components/ArgumentListAnnotation.jsx.map +0 -1
- package/build/template/components/Changelog.jsx +0 -68
- package/build/template/components/Changelog.jsx.map +0 -1
- package/build/template/components/CodeBlockEnhancer.jsx.map +0 -1
- package/build/template/components/DeprecationReason.jsx +0 -10
- package/build/template/components/DeprecationReason.jsx.map +0 -1
- package/build/template/components/Description.jsx +0 -10
- package/build/template/components/Description.jsx.map +0 -1
- package/build/template/components/Field.jsx +0 -22
- package/build/template/components/Field.jsx.map +0 -1
- package/build/template/components/FieldList.jsx.map +0 -1
- package/build/template/components/FieldListSection.jsx.map +0 -1
- package/build/template/components/HamburgerMenu.jsx +0 -53
- package/build/template/components/HamburgerMenu.jsx.map +0 -1
- package/build/template/components/Link.jsx.map +0 -1
- package/build/template/components/Logo.jsx +0 -29
- package/build/template/components/Logo.jsx.map +0 -1
- package/build/template/components/Markdown.jsx.map +0 -1
- package/build/template/components/MissingSchema.jsx +0 -4
- package/build/template/components/MissingSchema.jsx.map +0 -1
- package/build/template/components/NamedType.jsx +0 -17
- package/build/template/components/NamedType.jsx.map +0 -1
- package/build/template/components/NotFound.jsx +0 -26
- package/build/template/components/NotFound.jsx.map +0 -1
- package/build/template/components/RadixLink.jsx.map +0 -1
- package/build/template/components/Texts/MinorHeading.jsx.map +0 -1
- package/build/template/components/ThemeToggle.jsx +0 -10
- package/build/template/components/ThemeToggle.jsx.map +0 -1
- package/build/template/components/TypeAnnotation.jsx.map +0 -1
- package/build/template/components/TypeFieldsLinkList.jsx +0 -17
- package/build/template/components/TypeFieldsLinkList.jsx.map +0 -1
- package/build/template/components/TypeIndex.jsx +0 -27
- package/build/template/components/TypeIndex.jsx.map +0 -1
- package/build/template/components/graphql/graphql.jsx +0 -3
- package/build/template/components/graphql/graphql.jsx.map +0 -1
- package/build/template/components/graphql/type-kind-icon.jsx.map +0 -1
- package/build/template/components/graphql/type-link.jsx +0 -16
- package/build/template/components/graphql/type-link.jsx.map +0 -1
- package/build/template/components/sidebar/Sidebar.jsx +0 -15
- package/build/template/components/sidebar/Sidebar.jsx.map +0 -1
- package/build/template/components/sidebar/SidebarItem.jsx.map +0 -1
- package/build/template/components/sidebar/ToggleButton.jsx +0 -6
- package/build/template/components/sidebar/ToggleButton.jsx.map +0 -1
- package/build/template/entry.client.jsx.map +0 -1
- package/build/template/routes/changelog.jsx.map +0 -1
- package/build/template/routes/index.jsx.map +0 -1
- package/build/template/routes/reference.$type.$field.jsx.map +0 -1
- package/build/template/routes/reference.$type.jsx.map +0 -1
- package/build/template/routes/reference.jsx.map +0 -1
- package/build/template/routes/root.jsx.map +0 -1
- package/build/template/routes.jsx +0 -5
- package/build/template/routes.jsx.map +0 -1
- package/build/template/server/render-page.jsx.map +0 -1
@@ -10,13 +10,13 @@ export const CodeBlockEnhancer = () => {
|
|
10
10
|
// Add styles for code block enhancements
|
11
11
|
const styleId = 'code-block-enhancer-styles'
|
12
12
|
let styleElement = document.getElementById(styleId) as HTMLStyleElement
|
13
|
-
|
13
|
+
|
14
14
|
if (!styleElement) {
|
15
15
|
styleElement = document.createElement('style')
|
16
16
|
styleElement.id = styleId
|
17
17
|
document.head.appendChild(styleElement)
|
18
18
|
}
|
19
|
-
|
19
|
+
|
20
20
|
styleElement.textContent = `
|
21
21
|
/* Enhanced code block styles */
|
22
22
|
pre.shiki {
|
@@ -89,7 +89,7 @@ export const CodeBlockEnhancer = () => {
|
|
89
89
|
color: white !important;
|
90
90
|
}
|
91
91
|
`
|
92
|
-
|
92
|
+
|
93
93
|
return () => {
|
94
94
|
if (styleElement && styleElement.parentNode) {
|
95
95
|
styleElement.parentNode.removeChild(styleElement)
|
@@ -100,22 +100,22 @@ export const CodeBlockEnhancer = () => {
|
|
100
100
|
useEffect(() => {
|
101
101
|
const enhanceCodeBlocks = () => {
|
102
102
|
const codeBlocks = document.querySelectorAll('pre.shiki:not([data-enhanced])')
|
103
|
-
|
103
|
+
|
104
104
|
codeBlocks.forEach((block) => {
|
105
105
|
const preElement = block as HTMLPreElement
|
106
106
|
preElement.setAttribute('data-enhanced', 'true')
|
107
|
-
|
107
|
+
|
108
108
|
// Get language from class name
|
109
109
|
const classes = preElement.className.split(' ')
|
110
110
|
const language = classes.find(c => c !== 'shiki' && c !== 'shiki-light' && c !== 'shiki-dark') || 'text'
|
111
|
-
|
111
|
+
|
112
112
|
// Check for title in first line
|
113
113
|
const codeElement = preElement.querySelector('code')
|
114
114
|
if (!codeElement) return
|
115
|
-
|
115
|
+
|
116
116
|
const firstLine = codeElement.textContent?.split('\n')[0] || ''
|
117
117
|
let title = ''
|
118
|
-
|
118
|
+
|
119
119
|
const titleMatch = firstLine.match(/^\/\/\s*title:\s*(.+)$/i)
|
120
120
|
if (titleMatch && titleMatch[1]) {
|
121
121
|
title = titleMatch[1]
|
@@ -124,27 +124,27 @@ export const CodeBlockEnhancer = () => {
|
|
124
124
|
if (firstLineElement) {
|
125
125
|
firstLineElement.style.display = 'none'
|
126
126
|
}
|
127
|
-
|
127
|
+
|
128
128
|
// Set data attributes for CSS
|
129
129
|
preElement.setAttribute('data-title', title)
|
130
130
|
preElement.setAttribute('data-language', language)
|
131
131
|
preElement.style.marginTop = '3rem'
|
132
132
|
}
|
133
|
-
|
133
|
+
|
134
134
|
// Create copy button
|
135
135
|
const copyButton = document.createElement('button')
|
136
136
|
copyButton.className = 'code-block-copy'
|
137
137
|
copyButton.textContent = 'Copy'
|
138
138
|
copyButton.setAttribute('data-copied', 'false')
|
139
|
-
|
139
|
+
|
140
140
|
copyButton.onclick = async (e) => {
|
141
141
|
e.preventDefault()
|
142
142
|
e.stopPropagation()
|
143
|
-
|
143
|
+
|
144
144
|
// Get clean code without the title line
|
145
145
|
const code = codeElement.textContent || ''
|
146
146
|
const cleanCode = title ? code.split('\n').slice(1).join('\n') : code
|
147
|
-
|
147
|
+
|
148
148
|
try {
|
149
149
|
await navigator.clipboard.writeText(cleanCode)
|
150
150
|
copyButton.textContent = 'Copied!'
|
@@ -157,15 +157,15 @@ export const CodeBlockEnhancer = () => {
|
|
157
157
|
console.error('Failed to copy:', err)
|
158
158
|
}
|
159
159
|
}
|
160
|
-
|
160
|
+
|
161
161
|
// Append copy button directly to pre element
|
162
162
|
preElement.appendChild(copyButton)
|
163
163
|
})
|
164
164
|
}
|
165
|
-
|
165
|
+
|
166
166
|
// Small delay to ensure DOM is ready
|
167
167
|
const timeoutId = setTimeout(enhanceCodeBlocks, 100)
|
168
|
-
|
168
|
+
|
169
169
|
return () => {
|
170
170
|
clearTimeout(timeoutId)
|
171
171
|
// Clean up enhanced code blocks
|
@@ -181,12 +181,12 @@ export const CodeBlockEnhancer = () => {
|
|
181
181
|
const firstLine = block.querySelector('span.line') as HTMLElement
|
182
182
|
if (firstLine && firstLine.style.display === 'none') {
|
183
183
|
firstLine.style.display = ''
|
184
|
-
}
|
185
|
-
|
186
|
-
(block as HTMLElement).style.marginTop = ''
|
184
|
+
} // Reset margin
|
185
|
+
|
186
|
+
;(block as HTMLElement).style.marginTop = ''
|
187
187
|
})
|
188
188
|
}
|
189
189
|
}, [location.pathname]) // Re-run when route changes
|
190
|
-
|
190
|
+
|
191
191
|
return null
|
192
|
-
}
|
192
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { GrafaidOld } from '#lib/grafaid-old/index'
|
2
2
|
import { Text } from '@radix-ui/themes'
|
3
3
|
import type { FC } from 'react'
|
4
|
-
import { Markdown } from './Markdown.
|
4
|
+
import { Markdown } from './Markdown.tsx'
|
5
5
|
|
6
6
|
export const DeprecationReason: FC<{ data: GrafaidOld.GraphQLField }> = ({ data }) => {
|
7
7
|
if (!data.deprecationReason) return null
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Text } from '@radix-ui/themes'
|
2
2
|
import type { FC } from 'react'
|
3
|
-
import { Markdown } from './Markdown.
|
3
|
+
import { Markdown } from './Markdown.tsx'
|
4
4
|
// import type { Grafaid } from '#lib/grafaid'
|
5
5
|
import type { GrafaidOld } from '#lib/grafaid-old/index'
|
6
6
|
import type { GraphQLNamedType } from 'graphql'
|
@@ -2,10 +2,10 @@ import { GrafaidOld } from '#lib/grafaid-old/index'
|
|
2
2
|
import type { BoxProps } from '@radix-ui/themes'
|
3
3
|
import { Box, Text } from '@radix-ui/themes'
|
4
4
|
import type { FC } from 'react'
|
5
|
-
import { ArgumentListAnnotation } from './ArgumentListAnnotation.
|
6
|
-
import { DeprecationReason } from './DeprecationReason.
|
7
|
-
import { Description } from './Description.
|
8
|
-
import { TypeAnnotation } from './TypeAnnotation.
|
5
|
+
import { ArgumentListAnnotation } from './ArgumentListAnnotation.tsx'
|
6
|
+
import { DeprecationReason } from './DeprecationReason.tsx'
|
7
|
+
import { Description } from './Description.tsx'
|
8
|
+
import { TypeAnnotation } from './TypeAnnotation.tsx'
|
9
9
|
|
10
10
|
export type Props = BoxProps & {
|
11
11
|
data: GrafaidOld.GraphQLField
|
@@ -2,7 +2,7 @@ import { Grafaid } from '#lib/grafaid/index'
|
|
2
2
|
import { Box, Heading } from '@radix-ui/themes'
|
3
3
|
import type { GraphQLNamedType } from 'graphql'
|
4
4
|
import type { FC } from 'react'
|
5
|
-
import { FieldList } from './FieldList.
|
5
|
+
import { FieldList } from './FieldList.tsx'
|
6
6
|
|
7
7
|
export interface Props {
|
8
8
|
data: GraphQLNamedType
|
@@ -3,8 +3,8 @@ import type { LinkProps as LinkPropsReactRouter } from 'react-router'
|
|
3
3
|
import { Link as LinkReactRouter, useLocation } from 'react-router'
|
4
4
|
// todo: #lib/kit-temp does not work as import
|
5
5
|
import { ObjPartition } from '../../lib/kit-temp.ts'
|
6
|
-
import type { LinkPropsRadix } from './RadixLink.
|
7
|
-
import { LinkRadix } from './RadixLink.
|
6
|
+
import type { LinkPropsRadix } from './RadixLink.tsx'
|
7
|
+
import { LinkRadix } from './RadixLink.tsx'
|
8
8
|
|
9
9
|
const reactRouterPropKeys = [
|
10
10
|
'discover',
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
interface PreProps {
|
4
|
+
children: React.ReactNode
|
5
|
+
className?: string
|
6
|
+
'data-enhanced'?: string
|
7
|
+
}
|
8
|
+
|
9
|
+
interface CodeProps {
|
10
|
+
children: string
|
11
|
+
className?: string
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Custom pre component that intercepts GraphQL code blocks
|
16
|
+
*/
|
17
|
+
const Pre: React.FC<PreProps> = ({ children, className, ...props }) => {
|
18
|
+
// Check if this is a Shiki-enhanced code block
|
19
|
+
const isShiki = props['data-enhanced'] === 'true'
|
20
|
+
|
21
|
+
// Extract the code element
|
22
|
+
const codeElement = React.Children.toArray(children).find(
|
23
|
+
child => React.isValidElement(child) && child.type === 'code',
|
24
|
+
) as React.ReactElement<CodeProps> | undefined
|
25
|
+
|
26
|
+
if (!codeElement) {
|
27
|
+
return <pre className={className} {...props}>{children}</pre>
|
28
|
+
}
|
29
|
+
|
30
|
+
// Check if it's a GraphQL code block
|
31
|
+
const codeClassName = codeElement.props.className || ''
|
32
|
+
const isGraphQL = codeClassName.includes('language-graphql') || codeClassName.includes('language-gql')
|
33
|
+
|
34
|
+
if (isGraphQL && isShiki) {
|
35
|
+
// Extract the plain text content from the code element
|
36
|
+
const plainText = extractPlainText(codeElement.props.children)
|
37
|
+
|
38
|
+
// For now, just render the Shiki-highlighted code normally
|
39
|
+
// The GraphQLDocument component will be enhanced client-side
|
40
|
+
return (
|
41
|
+
<div data-testid='graphql-document' data-graphql-code={plainText}>
|
42
|
+
<pre className={className} {...props}>{children}</pre>
|
43
|
+
</div>
|
44
|
+
)
|
45
|
+
}
|
46
|
+
|
47
|
+
// For non-GraphQL code blocks, render normally
|
48
|
+
return <pre className={className} {...props}>{children}</pre>
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Extract plain text from React children (recursive)
|
53
|
+
*/
|
54
|
+
function extractPlainText(children: React.ReactNode): string {
|
55
|
+
if (typeof children === 'string') {
|
56
|
+
return children
|
57
|
+
}
|
58
|
+
|
59
|
+
if (Array.isArray(children)) {
|
60
|
+
return children.map(extractPlainText).join('')
|
61
|
+
}
|
62
|
+
|
63
|
+
if (React.isValidElement(children)) {
|
64
|
+
const props = (children as React.ReactElement<any>).props
|
65
|
+
if (props?.children) {
|
66
|
+
return extractPlainText(props.children)
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
return ''
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Simple server-side rendering of React element to HTML string
|
75
|
+
*/
|
76
|
+
function renderToStaticMarkup(element: React.ReactNode): string {
|
77
|
+
// For server-side, we just need to preserve the structure
|
78
|
+
if (typeof element === 'string') return element
|
79
|
+
|
80
|
+
if (React.isValidElement(element)) {
|
81
|
+
const { type, props } = element as React.ReactElement<any>
|
82
|
+
const tagName = typeof type === 'string' ? type : 'div'
|
83
|
+
const attrs = Object.entries(props || {})
|
84
|
+
.filter(([key]) => key !== 'children' && !key.startsWith('__'))
|
85
|
+
.map(([key, value]) => `${key}="${value}"`)
|
86
|
+
.join(' ')
|
87
|
+
|
88
|
+
const children = props?.children ? renderToStaticMarkup(props.children) : ''
|
89
|
+
return `<${tagName}${attrs ? ' ' + attrs : ''}>${children}</${tagName}>`
|
90
|
+
}
|
91
|
+
|
92
|
+
if (Array.isArray(element)) {
|
93
|
+
return element.map(renderToStaticMarkup).join('')
|
94
|
+
}
|
95
|
+
|
96
|
+
return ''
|
97
|
+
}
|
98
|
+
|
99
|
+
export const mdxComponents = {
|
100
|
+
pre: Pre,
|
101
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Box, Heading, Text } from '@radix-ui/themes'
|
2
2
|
import { type GraphQLNamedType } from 'graphql'
|
3
3
|
import type { FC } from 'react'
|
4
|
-
import { FieldListSection } from './FieldListSection.
|
5
|
-
import { Markdown } from './Markdown.
|
4
|
+
import { FieldListSection } from './FieldListSection.tsx'
|
5
|
+
import { Markdown } from './Markdown.tsx'
|
6
6
|
|
7
7
|
export interface Props {
|
8
8
|
data: GraphQLNamedType
|
@@ -2,7 +2,7 @@ import { Text } from '@radix-ui/themes'
|
|
2
2
|
import type { GraphQLType } from 'graphql'
|
3
3
|
import { isInputObjectType, isListType, isNamedType, isNonNullType, isScalarType } from 'graphql'
|
4
4
|
import type { FC } from 'react'
|
5
|
-
import { Link } from './Link.
|
5
|
+
import { Link } from './Link.tsx'
|
6
6
|
|
7
7
|
export interface Props {
|
8
8
|
type: GraphQLType // Can be either GraphQLInputType or GraphQLOutputType
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Box, Flex, Heading } from '@radix-ui/themes'
|
2
2
|
import type { GraphQLInterfaceType, GraphQLObjectType } from 'graphql'
|
3
3
|
import type { FC } from 'react'
|
4
|
-
import { Link } from './Link.
|
4
|
+
import { Link } from './Link.tsx'
|
5
5
|
|
6
6
|
export interface Props {
|
7
7
|
type: GraphQLObjectType | GraphQLInterfaceType
|
@@ -3,7 +3,7 @@ import { Box, Flex, Heading } from '@radix-ui/themes'
|
|
3
3
|
import { Obj } from '@wollybeard/kit'
|
4
4
|
import type { GraphQLNamedType, GraphQLSchema } from 'graphql'
|
5
5
|
import type { FC } from 'react'
|
6
|
-
import { Link } from './Link.
|
6
|
+
import { Link } from './Link.tsx'
|
7
7
|
|
8
8
|
export interface Props {
|
9
9
|
schema: GraphQLSchema
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { GraphQLSchema } from 'graphql'
|
2
|
+
import React from 'react'
|
3
|
+
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
4
|
+
import { GraphQLDocument } from '../../../lib/graphql-document/components/GraphQLDocument.tsx'
|
5
|
+
import type { GraphQLDocumentProps } from '../../../lib/graphql-document/components/GraphQLDocument.tsx'
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Wrapper component that provides schema from virtual module directly to GraphQLDocument
|
9
|
+
* This bypasses the context issue with MDX components
|
10
|
+
*/
|
11
|
+
export const GraphQLDocumentWithSchema: React.FC<Omit<GraphQLDocumentProps, 'schema'>> = (props) => {
|
12
|
+
const schema = PROJECT_DATA.schema?.versions[0]?.after
|
13
|
+
console.log('Template wrapper - schema:', schema ? 'EXISTS' : 'UNDEFINED')
|
14
|
+
console.log('Template wrapper - props:', props)
|
15
|
+
console.log('Template wrapper - PROJECT_DATA.schema:', PROJECT_DATA.schema)
|
16
|
+
|
17
|
+
return <GraphQLDocument {...props} schema={schema} />
|
18
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { useNavigate } from 'react-router'
|
3
|
+
import { GraphQLDocument } from '../../../lib/graphql-document/components/GraphQLDocument.tsx'
|
4
|
+
import type { GraphQLDocumentProps } from '../../../lib/graphql-document/components/GraphQLDocument.tsx'
|
5
|
+
import { highlightCode } from '../../../lib/shiki/shiki.ts'
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Client-side wrapper that hydrates GraphQL documents with schema
|
9
|
+
*/
|
10
|
+
export const GraphQLDocumentWithSchema: React.FC<Omit<GraphQLDocumentProps, 'schema'>> = (props) => {
|
11
|
+
try {
|
12
|
+
const [schema, setSchema] = React.useState<any>(null)
|
13
|
+
const [isClient, setIsClient] = React.useState(false)
|
14
|
+
const [highlightedHtml, setHighlightedHtml] = React.useState<string | null>(null)
|
15
|
+
|
16
|
+
React.useEffect(() => {
|
17
|
+
setIsClient(true)
|
18
|
+
|
19
|
+
// Highlight the code
|
20
|
+
if (typeof props.children === 'string') {
|
21
|
+
highlightCode({
|
22
|
+
code: props.children,
|
23
|
+
lang: 'graphql',
|
24
|
+
theme: 'light', // You can make this dynamic based on theme
|
25
|
+
}).then(html => {
|
26
|
+
setHighlightedHtml(html)
|
27
|
+
}).catch(err => {
|
28
|
+
console.error('Failed to highlight code:', err)
|
29
|
+
})
|
30
|
+
}
|
31
|
+
|
32
|
+
// Access virtual module only on client side
|
33
|
+
if (typeof window !== 'undefined') {
|
34
|
+
import('virtual:polen/project/data.jsonsuper').then(PROJECT_DATA => {
|
35
|
+
const s = PROJECT_DATA.default?.schema?.versions?.[0]?.after
|
36
|
+
if (s) {
|
37
|
+
setSchema(s)
|
38
|
+
}
|
39
|
+
}).catch(err => {
|
40
|
+
console.error('Failed to load schema:', err)
|
41
|
+
})
|
42
|
+
}
|
43
|
+
}, [props.children])
|
44
|
+
|
45
|
+
// During SSR, render a simple code block
|
46
|
+
if (!isClient) {
|
47
|
+
return (
|
48
|
+
<div data-testid='graphql-document' className='graphql-document graphql-document-static'>
|
49
|
+
<pre className='shiki shiki-themes github-light tokyo-night'>
|
50
|
+
<code className="language-graphql">{props.children}</code>
|
51
|
+
</pre>
|
52
|
+
</div>
|
53
|
+
)
|
54
|
+
}
|
55
|
+
|
56
|
+
// During client render, use the full component
|
57
|
+
// Pass a custom navigate function that doesn't require router
|
58
|
+
const handleNavigate = (url: string) => {
|
59
|
+
if (typeof window !== 'undefined') {
|
60
|
+
window.location.href = url
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
return (
|
65
|
+
<div data-testid='graphql-document'>
|
66
|
+
<GraphQLDocument
|
67
|
+
{...props}
|
68
|
+
schema={schema}
|
69
|
+
highlightedHtml={highlightedHtml || undefined}
|
70
|
+
options={{
|
71
|
+
...props.options,
|
72
|
+
onNavigate: handleNavigate,
|
73
|
+
debug: false, // Disable debug mode for shipping
|
74
|
+
}}
|
75
|
+
/>
|
76
|
+
</div>
|
77
|
+
)
|
78
|
+
} catch (err) {
|
79
|
+
console.error('GraphQLDocumentWithSchema error:', err)
|
80
|
+
return <div>Error rendering GraphQL document</div>
|
81
|
+
}
|
82
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from './type-kind-icon.
|
2
|
-
export * from './type-link.
|
1
|
+
export * from './type-kind-icon.tsx'
|
2
|
+
export * from './type-link.tsx'
|
@@ -1 +1 @@
|
|
1
|
-
export * as Graphql from './graphql.
|
1
|
+
export * as Graphql from './graphql.tsx'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Grafaid } from '#lib/grafaid/index'
|
2
2
|
import { Code, Flex } from '@radix-ui/themes'
|
3
|
-
import { Link } from '../Link.
|
4
|
-
import { TypeKindIcon } from './graphql.
|
3
|
+
import { Link } from '../Link.tsx'
|
4
|
+
import { TypeKindIcon } from './graphql.tsx'
|
5
5
|
import { typeKindTokensIndex } from './type-kind-tokens.ts'
|
6
6
|
|
7
7
|
export const TypeLink: React.FC<{ type: Grafaid.Schema.TypesLike.Named }> = ({ type }) => {
|
@@ -2,12 +2,12 @@
|
|
2
2
|
// But then, we won't get it from the client manifest. But we could get it from the server manifest. Should we do that?
|
3
3
|
// But then, that wouldn't work for SPA. Does that matter? Just put a conditional here e.g. if (import.meta.env.PROD) ...?
|
4
4
|
import '@radix-ui/themes/styles.css'
|
5
|
-
|
5
|
+
import './styles/code-block.css'
|
6
6
|
import { ReactDomClient } from '#dep/react-dom-client/index'
|
7
7
|
import { StrictMode } from 'react'
|
8
8
|
import { createBrowserRouter, RouterProvider } from 'react-router'
|
9
9
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
10
|
-
import { routes } from './routes.
|
10
|
+
import { routes } from './routes.tsx'
|
11
11
|
|
12
12
|
// SPA
|
13
13
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
2
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
3
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
4
|
-
import { Changelog } from '../components/Changelog.
|
4
|
+
import { Changelog } from '../components/Changelog.tsx'
|
5
5
|
|
6
6
|
const loader = createLoader(() => {
|
7
7
|
return {
|
@@ -2,9 +2,9 @@ import { Grafaid } from '#lib/grafaid/index'
|
|
2
2
|
import { ReactRouterAid } from '#lib/react-router-aid/index'
|
3
3
|
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
4
4
|
import { useParams } from 'react-router'
|
5
|
-
import { Field } from '../components/Field.
|
6
|
-
import { MissingSchema } from '../components/MissingSchema.
|
7
|
-
import type { reference } from './reference.
|
5
|
+
import { Field } from '../components/Field.tsx'
|
6
|
+
import { MissingSchema } from '../components/MissingSchema.tsx'
|
7
|
+
import type { reference } from './reference.tsx'
|
8
8
|
|
9
9
|
const Component = () => {
|
10
10
|
const params = useParams() as { type: string; field: string }
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
2
|
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
3
|
import { useParams } from 'react-router'
|
4
|
-
import { MissingSchema } from '../components/MissingSchema.
|
5
|
-
import { NamedType } from '../components/NamedType.
|
6
|
-
import type { reference } from './reference.
|
4
|
+
import { MissingSchema } from '../components/MissingSchema.tsx'
|
5
|
+
import { NamedType } from '../components/NamedType.tsx'
|
6
|
+
import type { reference } from './reference.tsx'
|
7
7
|
|
8
8
|
const Component = () => {
|
9
9
|
const params = useParams() as { type: string }
|
@@ -3,8 +3,8 @@ import { createLoader, useLoaderData } from '#lib/react-router-loader/react-rout
|
|
3
3
|
import { Box } from '@radix-ui/themes'
|
4
4
|
import { Outlet } from 'react-router'
|
5
5
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
6
|
-
import { MissingSchema } from '../components/MissingSchema.
|
7
|
-
import { reference$type } from './reference.$type.
|
6
|
+
import { MissingSchema } from '../components/MissingSchema.tsx'
|
7
|
+
import { reference$type } from './reference.$type.tsx'
|
8
8
|
|
9
9
|
const loader = createLoader(() => {
|
10
10
|
const latestSchemaVersion = PROJECT_DATA.schema?.versions[0].after ?? null
|
@@ -21,7 +21,7 @@ const Component = () => {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
return (
|
24
|
-
<Box className=
|
24
|
+
<Box className='prose'>
|
25
25
|
<Outlet />
|
26
26
|
</Box>
|
27
27
|
)
|