polen 0.10.0 → 0.11.0-next.1
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/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/config/configurator.d.ts +20 -3
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +27 -3
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/schema/data-sources/memory/memory.d.ts +2 -2
- package/build/api/schema/data-sources/memory/memory.d.ts.map +1 -1
- package/build/api/schema/data-sources/memory/memory.js +1 -3
- package/build/api/schema/data-sources/memory/memory.js.map +1 -1
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts +7 -3
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js +15 -11
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts +16 -7
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.js +26 -7
- package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
- package/build/api/schema/data-sources/schema-file/schema-file.d.ts +7 -2
- package/build/api/schema/data-sources/schema-file/schema-file.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-file/schema-file.js +13 -5
- package/build/api/schema/data-sources/schema-file/schema-file.js.map +1 -1
- package/build/api/schema/metadata.d.ts +8 -0
- package/build/api/schema/metadata.d.ts.map +1 -0
- package/build/api/schema/metadata.js +19 -0
- package/build/api/schema/metadata.js.map +1 -0
- package/build/api/schema/read.d.ts +3 -3
- package/build/api/schema/read.d.ts.map +1 -1
- package/build/api/schema/read.js.map +1 -1
- package/build/api/schema/schema.d.ts +33 -2
- package/build/api/schema/schema.d.ts.map +1 -1
- package/build/api/schema/schema.js +42 -0
- package/build/api/schema/schema.js.map +1 -1
- package/build/api/schema-source/index.d.ts +2 -0
- package/build/api/schema-source/index.d.ts.map +1 -0
- package/build/api/schema-source/index.js +2 -0
- package/build/api/schema-source/index.js.map +1 -0
- package/build/api/schema-source/schema-source.d.ts +33 -0
- package/build/api/schema-source/schema-source.d.ts.map +1 -0
- package/build/api/schema-source/schema-source.js +137 -0
- package/build/api/schema-source/schema-source.js.map +1 -0
- package/build/api/vite/plugins/core.d.ts +1 -0
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +21 -18
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/schema-assets.d.ts +22 -0
- package/build/api/vite/plugins/schema-assets.d.ts.map +1 -0
- package/build/api/vite/plugins/schema-assets.js +269 -0
- package/build/api/vite/plugins/schema-assets.js.map +1 -0
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +11 -0
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/lib/graphql-change/change-groups.d.ts +2 -0
- package/build/lib/graphql-change/change-groups.d.ts.map +1 -1
- package/build/lib/graphql-change/change-groups.js +54 -0
- package/build/lib/graphql-change/change-groups.js.map +1 -1
- package/build/lib/kit-temp.d.ts +9 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +12 -0
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/path-map/path-map.d.ts.map +1 -1
- package/build/lib/path-map/path-map.js +3 -1
- package/build/lib/path-map/path-map.js.map +1 -1
- package/build/project-data.d.ts +3 -11
- package/build/project-data.d.ts.map +1 -1
- package/build/template/components/Changelog.d.ts +3 -3
- package/build/template/components/Changelog.d.ts.map +1 -1
- package/build/template/components/Changelog.js +8 -84
- package/build/template/components/Changelog.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts +2 -0
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +1 -4
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/ComponentDispatch.d.ts +34 -0
- package/build/template/components/ComponentDispatch.d.ts.map +1 -0
- package/build/template/components/ComponentDispatch.js +33 -0
- package/build/template/components/ComponentDispatch.js.map +1 -0
- package/build/template/components/ReferenceLink.d.ts +19 -0
- package/build/template/components/ReferenceLink.d.ts.map +1 -0
- package/build/template/components/ReferenceLink.js +19 -0
- package/build/template/components/ReferenceLink.js.map +1 -0
- package/build/template/components/TypeAnnotation.d.ts.map +1 -1
- package/build/template/components/TypeAnnotation.js +3 -3
- package/build/template/components/TypeAnnotation.js.map +1 -1
- package/build/template/components/TypeFieldsLinkList.d.ts.map +1 -1
- package/build/template/components/TypeFieldsLinkList.js +4 -4
- package/build/template/components/TypeFieldsLinkList.js.map +1 -1
- package/build/template/components/TypeIndex.js +2 -2
- package/build/template/components/TypeIndex.js.map +1 -1
- package/build/template/components/VersionSelector.d.ts +7 -0
- package/build/template/components/VersionSelector.d.ts.map +1 -0
- package/build/template/components/VersionSelector.js +30 -0
- package/build/template/components/VersionSelector.js.map +1 -0
- package/build/template/components/graphql/type-link.d.ts.map +1 -1
- package/build/template/components/graphql/type-link.js +2 -2
- package/build/template/components/graphql/type-link.js.map +1 -1
- package/build/template/hooks/useVersionPath.d.ts +6 -0
- package/build/template/hooks/useVersionPath.d.ts.map +1 -0
- package/build/template/hooks/useVersionPath.js +10 -0
- package/build/template/hooks/useVersionPath.js.map +1 -0
- package/build/template/layouts/ChangelogLayout.d.ts.map +1 -0
- package/build/template/{components → layouts}/ChangelogLayout.js +1 -1
- package/build/template/layouts/ChangelogLayout.js.map +1 -0
- package/build/template/layouts/index.d.ts +1 -0
- package/build/template/layouts/index.d.ts.map +1 -1
- package/build/template/layouts/index.js +1 -0
- package/build/template/layouts/index.js.map +1 -1
- package/build/template/lib/fetch-text.d.ts +8 -0
- package/build/template/lib/fetch-text.d.ts.map +1 -0
- package/build/template/lib/fetch-text.js +14 -0
- package/build/template/lib/fetch-text.js.map +1 -0
- package/build/template/lib/polen-url.d.ts +14 -0
- package/build/template/lib/polen-url.d.ts.map +1 -1
- package/build/template/lib/polen-url.js +16 -0
- package/build/template/lib/polen-url.js.map +1 -1
- package/build/template/lib/schema-utils/constants.d.ts +5 -0
- package/build/template/lib/schema-utils/constants.d.ts.map +1 -0
- package/build/template/lib/schema-utils/constants.js +5 -0
- package/build/template/lib/schema-utils/constants.js.map +1 -0
- package/build/template/lib/schema-utils/schema-utils.d.ts +15 -0
- package/build/template/lib/schema-utils/schema-utils.d.ts.map +1 -0
- package/build/template/lib/schema-utils/schema-utils.js +37 -0
- package/build/template/lib/schema-utils/schema-utils.js.map +1 -0
- package/build/template/routes/changelog.d.ts +4 -3
- package/build/template/routes/changelog.d.ts.map +1 -1
- package/build/template/routes/changelog.js +13 -7
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/pages.d.ts +10 -0
- package/build/template/routes/pages.d.ts.map +1 -0
- package/build/template/routes/pages.js +76 -0
- package/build/template/routes/pages.js.map +1 -0
- package/build/template/routes/reference.$type.$field.js +1 -1
- package/build/template/routes/reference.$type.$field.js.map +1 -1
- package/build/template/routes/reference.$type.d.ts +4 -0
- package/build/template/routes/reference.$type.d.ts.map +1 -1
- package/build/template/routes/reference.$type.js +2 -0
- package/build/template/routes/reference.$type.js.map +1 -1
- package/build/template/routes/reference.d.ts +9 -3
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +30 -8
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/reference.version.$version.$type.$field.d.ts +6 -0
- package/build/template/routes/reference.version.$version.$type.$field.d.ts.map +1 -0
- package/build/template/routes/reference.version.$version.$type.$field.js +32 -0
- package/build/template/routes/reference.version.$version.$type.$field.js.map +1 -0
- package/build/template/routes/reference.version.$version.$type.d.ts +11 -0
- package/build/template/routes/reference.version.$version.$type.d.ts.map +1 -0
- package/build/template/routes/reference.version.$version.$type.js +26 -0
- package/build/template/routes/reference.version.$version.$type.js.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +8 -72
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/app.d.ts +22 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +19 -9
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/main.js +9 -1
- package/build/template/server/main.js.map +1 -1
- package/build/template/server/ssg/generate.js +2 -2
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
- package/build/template/server/ssg/get-route-paths.js +51 -27
- package/build/template/server/ssg/get-route-paths.js.map +1 -1
- package/build/template/sources/schema-source.d.ts +15 -0
- package/build/template/sources/schema-source.d.ts.map +1 -0
- package/build/template/sources/schema-source.js +63 -0
- package/build/template/sources/schema-source.js.map +1 -0
- package/package.json +1 -1
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +51 -6
- package/src/api/schema/data-sources/memory/memory.ts +3 -5
- package/src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts +29 -13
- package/src/api/schema/data-sources/schema-directory/schema-directory.ts +56 -16
- package/src/api/schema/data-sources/schema-file/schema-file.ts +16 -7
- package/src/api/schema/metadata.ts +23 -0
- package/src/api/schema/read.ts +3 -3
- package/src/api/schema/schema.ts +62 -2
- package/src/api/schema-source/index.ts +1 -0
- package/src/api/schema-source/schema-source.ts +189 -0
- package/src/api/vite/plugins/core.ts +23 -18
- package/src/api/vite/plugins/schema-assets.ts +317 -0
- package/src/api/vite/plugins/serve.ts +15 -8
- package/src/lib/graphql-change/change-groups.ts +57 -0
- package/src/lib/kit-temp.ts +13 -0
- package/src/lib/path-map/$.test.ts +22 -19
- package/src/lib/path-map/path-map.ts +3 -1
- package/src/project-data.ts +3 -11
- package/src/template/components/Changelog.tsx +16 -67
- package/src/template/components/CodeBlock.tsx +3 -5
- package/src/template/components/ComponentDispatch.tsx +42 -0
- package/src/template/components/ReferenceLink.tsx +34 -0
- package/src/template/components/TypeAnnotation.tsx +5 -7
- package/src/template/components/TypeFieldsLinkList.tsx +20 -23
- package/src/template/components/TypeIndex.tsx +10 -12
- package/src/template/components/VersionSelector.tsx +50 -0
- package/src/template/components/graphql/type-link.tsx +4 -3
- package/src/template/hooks/useVersionPath.ts +10 -0
- package/src/template/{components → layouts}/ChangelogLayout.tsx +1 -1
- package/src/template/layouts/index.ts +1 -0
- package/src/template/lib/fetch-text.ts +13 -0
- package/src/template/lib/polen-url.ts +20 -0
- package/src/template/lib/schema-utils/constants.ts +4 -0
- package/src/template/lib/schema-utils/schema-utils.ts +42 -0
- package/src/template/routes/changelog.tsx +17 -8
- package/src/template/routes/pages.tsx +109 -0
- package/src/template/routes/reference.$type.$field.tsx +1 -1
- package/src/template/routes/reference.$type.tsx +2 -0
- package/src/template/routes/reference.tsx +38 -6
- package/src/template/routes/reference.version.$version.$type.$field.tsx +35 -0
- package/src/template/routes/reference.version.$version.$type.tsx +30 -0
- package/src/template/routes/root.tsx +8 -109
- package/src/template/server/app.ts +47 -14
- package/src/template/server/main.ts +9 -1
- package/src/template/server/ssg/generate.ts +2 -2
- package/src/template/server/ssg/get-route-paths.ts +53 -27
- package/src/template/sources/schema-source.ts +68 -0
- package/build/lib/graphql-document/$$.d.ts +0 -5
- package/build/lib/graphql-document/$$.d.ts.map +0 -1
- package/build/lib/graphql-document/$$.js +0 -5
- package/build/lib/graphql-document/$$.js.map +0 -1
- package/build/lib/graphql-document/$.d.ts +0 -2
- package/build/lib/graphql-document/$.d.ts.map +0 -1
- package/build/lib/graphql-document/$.js +0 -2
- package/build/lib/graphql-document/$.js.map +0 -1
- package/build/lib/graphql-document/analysis.d.ts +0 -44
- package/build/lib/graphql-document/analysis.d.ts.map +0 -1
- package/build/lib/graphql-document/analysis.js +0 -361
- package/build/lib/graphql-document/analysis.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -38
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +0 -151
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +0 -7
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +0 -27
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +0 -33
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +0 -50
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +0 -1
- package/build/lib/graphql-document/components/IdentifierLink.d.ts +0 -39
- package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +0 -1
- package/build/lib/graphql-document/components/IdentifierLink.js +0 -75
- package/build/lib/graphql-document/components/IdentifierLink.js.map +0 -1
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts +0 -5
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +0 -1
- package/build/lib/graphql-document/components/graphql-document-styles.js +0 -144
- package/build/lib/graphql-document/components/graphql-document-styles.js.map +0 -1
- package/build/lib/graphql-document/components/index.d.ts +0 -5
- package/build/lib/graphql-document/components/index.d.ts.map +0 -1
- package/build/lib/graphql-document/components/index.js +0 -5
- package/build/lib/graphql-document/components/index.js.map +0 -1
- package/build/lib/graphql-document/example.d.ts +0 -25
- package/build/lib/graphql-document/example.d.ts.map +0 -1
- package/build/lib/graphql-document/example.js +0 -140
- package/build/lib/graphql-document/example.js.map +0 -1
- package/build/lib/graphql-document/graphql-document.d.ts +0 -35
- package/build/lib/graphql-document/graphql-document.d.ts.map +0 -1
- package/build/lib/graphql-document/graphql-document.js +0 -36
- package/build/lib/graphql-document/graphql-document.js.map +0 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +0 -43
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +0 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.js +0 -132
- package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +0 -1
- package/build/lib/graphql-document/positioning-simple.d.ts +0 -63
- package/build/lib/graphql-document/positioning-simple.d.ts.map +0 -1
- package/build/lib/graphql-document/positioning-simple.js +0 -185
- package/build/lib/graphql-document/positioning-simple.js.map +0 -1
- package/build/lib/graphql-document/schema-context.d.ts +0 -8
- package/build/lib/graphql-document/schema-context.d.ts.map +0 -1
- package/build/lib/graphql-document/schema-context.js +0 -11
- package/build/lib/graphql-document/schema-context.js.map +0 -1
- package/build/lib/graphql-document/schema-integration.d.ts +0 -135
- package/build/lib/graphql-document/schema-integration.d.ts.map +0 -1
- package/build/lib/graphql-document/schema-integration.js +0 -328
- package/build/lib/graphql-document/schema-integration.js.map +0 -1
- package/build/lib/graphql-document/types.d.ts +0 -117
- package/build/lib/graphql-document/types.d.ts.map +0 -1
- package/build/lib/graphql-document/types.js +0 -2
- package/build/lib/graphql-document/types.js.map +0 -1
- package/build/template/components/ChangelogLayout.d.ts.map +0 -1
- package/build/template/components/ChangelogLayout.js.map +0 -1
- package/build/template/components/CodeHikePre.d.ts +0 -16
- package/build/template/components/CodeHikePre.d.ts.map +0 -1
- package/build/template/components/CodeHikePre.js +0 -37
- package/build/template/components/CodeHikePre.js.map +0 -1
- package/src/lib/graphql-document/$$.ts +0 -4
- package/src/lib/graphql-document/$.test.ts +0 -132
- package/src/lib/graphql-document/$.ts +0 -1
- package/src/lib/graphql-document/README.md +0 -102
- package/src/lib/graphql-document/analysis.ts +0 -415
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +0 -265
- package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +0 -188
- package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +0 -46
- package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +0 -199
- package/src/lib/graphql-document/components/IdentifierLink.tsx +0 -160
- package/src/lib/graphql-document/components/graphql-document-styles.ts +0 -144
- package/src/lib/graphql-document/components/index.ts +0 -4
- package/src/lib/graphql-document/demo.md +0 -155
- package/src/lib/graphql-document/example.ts +0 -163
- package/src/lib/graphql-document/graphql-document.ts +0 -37
- package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +0 -76
- package/src/lib/graphql-document/hooks/use-tooltip-state.ts +0 -191
- package/src/lib/graphql-document/positioning-simple.test.ts +0 -248
- package/src/lib/graphql-document/positioning-simple.ts +0 -260
- package/src/lib/graphql-document/schema-context.tsx +0 -20
- package/src/lib/graphql-document/schema-integration.test.ts +0 -365
- package/src/lib/graphql-document/schema-integration.ts +0 -488
- package/src/lib/graphql-document/types.ts +0 -129
- package/src/template/components/CodeHikePre.tsx +0 -51
- /package/build/template/{components → layouts}/ChangelogLayout.d.ts +0 -0
@@ -1,265 +0,0 @@
|
|
1
|
-
import type { React } from '#dep/react/index'
|
2
|
-
import { React as ReactHooks } from '#dep/react/index'
|
3
|
-
import type { GraphQLSchema } from 'graphql'
|
4
|
-
import { useNavigate } from 'react-router'
|
5
|
-
import { analyze } from '../analysis.js'
|
6
|
-
import { useTooltipState } from '../hooks/use-tooltip-state.js'
|
7
|
-
import { createSimplePositionCalculator } from '../positioning-simple.js'
|
8
|
-
import { createPolenSchemaResolver } from '../schema-integration.js'
|
9
|
-
import type { Identifier } from '../types.js'
|
10
|
-
import { graphqlDocumentStyles } from './graphql-document-styles.js'
|
11
|
-
import { IdentifierLink } from './IdentifierLink.js'
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Options for the GraphQL document component
|
15
|
-
*/
|
16
|
-
export interface GraphQLDocumentOptions {
|
17
|
-
/** Whether to show debug overlays */
|
18
|
-
debug?: boolean
|
19
|
-
/** Whether to disable interactive features */
|
20
|
-
plain?: boolean
|
21
|
-
/** Custom navigation handler */
|
22
|
-
onNavigate?: (url: string) => void
|
23
|
-
/** Whether to validate against schema */
|
24
|
-
validate?: boolean
|
25
|
-
/** Custom class name for the container */
|
26
|
-
className?: string
|
27
|
-
/** Custom render function for the code block */
|
28
|
-
renderCode?: () => React.ReactNode
|
29
|
-
}
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Props for the GraphQL document component
|
33
|
-
*/
|
34
|
-
export interface GraphQLDocumentProps {
|
35
|
-
/** The GraphQL document source code */
|
36
|
-
children: string
|
37
|
-
/** GraphQL schema for validation and linking */
|
38
|
-
schema?: GraphQLSchema
|
39
|
-
/** Component options */
|
40
|
-
options?: GraphQLDocumentOptions
|
41
|
-
}
|
42
|
-
|
43
|
-
/**
|
44
|
-
* Interactive GraphQL document component
|
45
|
-
*
|
46
|
-
* Transforms static GraphQL code blocks into interactive documentation
|
47
|
-
* with hyperlinks, tooltips, and schema validation.
|
48
|
-
*/
|
49
|
-
export const GraphQLDocument: React.FC<GraphQLDocumentProps> = ({
|
50
|
-
children,
|
51
|
-
schema,
|
52
|
-
options = {},
|
53
|
-
}) => {
|
54
|
-
const {
|
55
|
-
debug = false,
|
56
|
-
plain = false,
|
57
|
-
onNavigate,
|
58
|
-
validate = true,
|
59
|
-
className = ``,
|
60
|
-
renderCode,
|
61
|
-
} = options
|
62
|
-
|
63
|
-
const navigate = useNavigate()
|
64
|
-
const handleNavigate = onNavigate || ((url: string) => navigate(url))
|
65
|
-
|
66
|
-
// Container ref for positioning calculations
|
67
|
-
const containerRef = ReactHooks.useRef<HTMLDivElement>(null)
|
68
|
-
const [isReady, setIsReady] = ReactHooks.useState(false)
|
69
|
-
|
70
|
-
// Use tooltip state management
|
71
|
-
const tooltipState = useTooltipState({
|
72
|
-
showDelay: 300,
|
73
|
-
hideDelay: 200, // Increased for smoother experience
|
74
|
-
allowMultiplePins: true,
|
75
|
-
})
|
76
|
-
|
77
|
-
// Handle escape key to unpin all
|
78
|
-
ReactHooks.useEffect(() => {
|
79
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
80
|
-
if (event.key === `Escape`) {
|
81
|
-
tooltipState.unpinAll()
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
document.addEventListener(`keydown`, handleKeyDown)
|
86
|
-
return () => {
|
87
|
-
document.removeEventListener(`keydown`, handleKeyDown)
|
88
|
-
}
|
89
|
-
}, [tooltipState])
|
90
|
-
|
91
|
-
// Layer 1: Parse and analyze
|
92
|
-
const analysisResult = ReactHooks.useMemo(() => {
|
93
|
-
if (plain) return null
|
94
|
-
const result = analyze(children, { schema })
|
95
|
-
// Debug logging handled by debug prop
|
96
|
-
return result
|
97
|
-
}, [children, plain, schema, debug])
|
98
|
-
|
99
|
-
// Layer 2: Schema resolution
|
100
|
-
const resolver = ReactHooks.useMemo(() => {
|
101
|
-
if (!schema || plain) return null
|
102
|
-
return createPolenSchemaResolver(schema)
|
103
|
-
}, [schema, plain])
|
104
|
-
|
105
|
-
const resolutions = ReactHooks.useMemo(() => {
|
106
|
-
if (!analysisResult || !resolver) {
|
107
|
-
return new Map()
|
108
|
-
}
|
109
|
-
|
110
|
-
const results = new Map()
|
111
|
-
for (const [position, identifier] of analysisResult.identifiers.byPosition) {
|
112
|
-
const resolution = resolver.resolveIdentifier(identifier)
|
113
|
-
if (resolution) {
|
114
|
-
results.set(position, resolution)
|
115
|
-
}
|
116
|
-
}
|
117
|
-
return results
|
118
|
-
}, [analysisResult, resolver])
|
119
|
-
|
120
|
-
// Layer 3: Position calculation
|
121
|
-
const positionCalculator = ReactHooks.useMemo(() => {
|
122
|
-
if (plain) return null
|
123
|
-
return createSimplePositionCalculator()
|
124
|
-
}, [plain])
|
125
|
-
|
126
|
-
const [positions, setPositions] = ReactHooks.useState<Map<string, { position: any; identifier: Identifier }>>(
|
127
|
-
new Map(),
|
128
|
-
)
|
129
|
-
|
130
|
-
// Prepare code block and calculate positions after render
|
131
|
-
ReactHooks.useEffect(() => {
|
132
|
-
if (!containerRef.current || !analysisResult || !positionCalculator || plain) {
|
133
|
-
// Skip position calculation - debug handled by debug prop
|
134
|
-
return
|
135
|
-
}
|
136
|
-
|
137
|
-
// Get the code element within the container
|
138
|
-
const codeElement = containerRef.current.querySelector(`pre.code-block code`)
|
139
|
-
|| containerRef.current.querySelector(`pre code`)
|
140
|
-
|| containerRef.current.querySelector(`code`)
|
141
|
-
if (!codeElement) {
|
142
|
-
// No code element found - skip
|
143
|
-
return
|
144
|
-
}
|
145
|
-
|
146
|
-
// Prepare the code block (wrap identifiers)
|
147
|
-
const identifiers = Array.from(analysisResult.identifiers.byPosition.values())
|
148
|
-
// Prepare code block with identifiers
|
149
|
-
positionCalculator.prepareCodeBlock(codeElement, identifiers)
|
150
|
-
|
151
|
-
// Get positions after DOM update
|
152
|
-
requestAnimationFrame(() => {
|
153
|
-
// Pass containerRef.current as the reference element for positioning
|
154
|
-
if (containerRef.current) {
|
155
|
-
const newPositions = positionCalculator.getIdentifierPositions(codeElement, containerRef.current)
|
156
|
-
// Position calculation complete
|
157
|
-
setPositions(newPositions)
|
158
|
-
setIsReady(true)
|
159
|
-
}
|
160
|
-
})
|
161
|
-
}, [analysisResult, positionCalculator, plain])
|
162
|
-
|
163
|
-
// Handle resize events with debouncing
|
164
|
-
ReactHooks.useEffect(() => {
|
165
|
-
if (!containerRef.current || !positionCalculator || plain) return
|
166
|
-
|
167
|
-
let resizeTimer: NodeJS.Timeout
|
168
|
-
const handleResize = () => {
|
169
|
-
clearTimeout(resizeTimer)
|
170
|
-
resizeTimer = setTimeout(() => {
|
171
|
-
const codeElement = containerRef.current?.querySelector(`pre.code-block code`)
|
172
|
-
|| containerRef.current?.querySelector(`pre code`)
|
173
|
-
|| containerRef.current?.querySelector(`code`)
|
174
|
-
if (codeElement && containerRef.current) {
|
175
|
-
const newPositions = positionCalculator.getIdentifierPositions(codeElement, containerRef.current)
|
176
|
-
setPositions(newPositions)
|
177
|
-
}
|
178
|
-
}, 100) // Debounce resize events
|
179
|
-
}
|
180
|
-
|
181
|
-
window.addEventListener(`resize`, handleResize)
|
182
|
-
return () => {
|
183
|
-
clearTimeout(resizeTimer)
|
184
|
-
window.removeEventListener(`resize`, handleResize)
|
185
|
-
}
|
186
|
-
}, [positionCalculator, plain])
|
187
|
-
|
188
|
-
// Validation errors
|
189
|
-
const validationErrors = ReactHooks.useMemo(() => {
|
190
|
-
if (!validate || !analysisResult || !schema) return []
|
191
|
-
return analysisResult.errors
|
192
|
-
}, [validate, analysisResult, schema])
|
193
|
-
|
194
|
-
return (
|
195
|
-
<>
|
196
|
-
<style dangerouslySetInnerHTML={{ __html: graphqlDocumentStyles }} />
|
197
|
-
<div
|
198
|
-
ref={containerRef}
|
199
|
-
className={`graphql-document ${className} ${debug ? `graphql-debug-mode` : ``} ${
|
200
|
-
!isReady && !plain ? `graphql-loading` : ``
|
201
|
-
}`}
|
202
|
-
data-testid='graphql-document'
|
203
|
-
>
|
204
|
-
{/* Base code block */}
|
205
|
-
{renderCode
|
206
|
-
? (
|
207
|
-
renderCode()
|
208
|
-
)
|
209
|
-
: (
|
210
|
-
<pre className='code-block'>
|
211
|
-
<code>{children}</code>
|
212
|
-
</pre>
|
213
|
-
)}
|
214
|
-
|
215
|
-
{/* Interactive overlay layer */}
|
216
|
-
{!plain && isReady && (
|
217
|
-
<div className='graphql-interaction-layer' style={{ pointerEvents: `none` }}>
|
218
|
-
{Array.from(positions.entries()).map(([id, { position, identifier }]) => {
|
219
|
-
const startPos = identifier.position.start
|
220
|
-
const resolution = resolutions.get(startPos)
|
221
|
-
|
222
|
-
if (!resolution) return null
|
223
|
-
|
224
|
-
return (
|
225
|
-
<IdentifierLink
|
226
|
-
key={id}
|
227
|
-
identifier={identifier}
|
228
|
-
resolution={resolution}
|
229
|
-
position={position}
|
230
|
-
onNavigate={handleNavigate}
|
231
|
-
debug={debug}
|
232
|
-
isOpen={tooltipState.isOpen(id)}
|
233
|
-
isPinned={tooltipState.isPinned(id)}
|
234
|
-
onHoverStart={() => {
|
235
|
-
tooltipState.onHoverStart(id)
|
236
|
-
}}
|
237
|
-
onHoverEnd={() => {
|
238
|
-
tooltipState.onHoverEnd(id)
|
239
|
-
}}
|
240
|
-
onTogglePin={() => {
|
241
|
-
tooltipState.onTogglePin(id)
|
242
|
-
}}
|
243
|
-
onTooltipHover={() => {
|
244
|
-
tooltipState.onTooltipHover(id)
|
245
|
-
}}
|
246
|
-
/>
|
247
|
-
)
|
248
|
-
})}
|
249
|
-
</div>
|
250
|
-
)}
|
251
|
-
|
252
|
-
{/* Validation errors overlay */}
|
253
|
-
{validationErrors.length > 0 && (
|
254
|
-
<div className='graphql-validation-errors'>
|
255
|
-
{validationErrors.map((error: any, index: number) => (
|
256
|
-
<div key={index} className='graphql-error'>
|
257
|
-
{error.message}
|
258
|
-
</div>
|
259
|
-
))}
|
260
|
-
</div>
|
261
|
-
)}
|
262
|
-
</div>
|
263
|
-
</>
|
264
|
-
)
|
265
|
-
}
|
@@ -1,188 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Unit tests for GraphQL Document component logic
|
3
|
-
*
|
4
|
-
* Tests the core functionality without rendering React components
|
5
|
-
*/
|
6
|
-
|
7
|
-
import { buildSchema } from 'graphql'
|
8
|
-
import { describe, expect, it } from 'vitest'
|
9
|
-
import { analyze } from '../analysis.js'
|
10
|
-
import { createSimplePositionCalculator } from '../positioning-simple.js'
|
11
|
-
import { analyzeWithSchema, createPolenSchemaResolver } from '../schema-integration.js'
|
12
|
-
|
13
|
-
describe('GraphQLDocument logic', () => {
|
14
|
-
const testSchema = buildSchema(`
|
15
|
-
type Query {
|
16
|
-
user(id: ID!): User
|
17
|
-
users: [User!]!
|
18
|
-
}
|
19
|
-
|
20
|
-
type User {
|
21
|
-
id: ID!
|
22
|
-
name: String!
|
23
|
-
email: String!
|
24
|
-
posts: [Post!]!
|
25
|
-
}
|
26
|
-
|
27
|
-
type Post {
|
28
|
-
id: ID!
|
29
|
-
title: String!
|
30
|
-
content: String!
|
31
|
-
author: User!
|
32
|
-
}
|
33
|
-
`)
|
34
|
-
|
35
|
-
const testQuery = `
|
36
|
-
query GetUser($id: ID!) {
|
37
|
-
user(id: $id) {
|
38
|
-
id
|
39
|
-
name
|
40
|
-
email
|
41
|
-
posts {
|
42
|
-
title
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}`
|
46
|
-
|
47
|
-
describe('analysis integration', () => {
|
48
|
-
it('should analyze GraphQL document and extract identifiers', () => {
|
49
|
-
const result = analyze(testQuery)
|
50
|
-
|
51
|
-
expect(result.identifiers.byKind.get('Field')).toBeDefined()
|
52
|
-
expect(result.identifiers.byKind.get('Variable')).toBeDefined()
|
53
|
-
expect(result.identifiers.byKind.get('Type')).toBeDefined()
|
54
|
-
|
55
|
-
// Check specific identifiers
|
56
|
-
const fields = result.identifiers.byKind.get('Field') || []
|
57
|
-
const fieldNames = fields.map(f => f.name)
|
58
|
-
expect(fieldNames).toContain('user')
|
59
|
-
expect(fieldNames).toContain('id')
|
60
|
-
expect(fieldNames).toContain('name')
|
61
|
-
expect(fieldNames).toContain('email')
|
62
|
-
expect(fieldNames).toContain('posts')
|
63
|
-
expect(fieldNames).toContain('title')
|
64
|
-
})
|
65
|
-
|
66
|
-
it('should handle empty document', () => {
|
67
|
-
const result = analyze('')
|
68
|
-
expect(result.identifiers.byPosition.size).toBe(0)
|
69
|
-
// Empty string is technically parseable as an empty document
|
70
|
-
expect(result.ast).toBeDefined()
|
71
|
-
})
|
72
|
-
})
|
73
|
-
|
74
|
-
describe('schema resolution integration', () => {
|
75
|
-
it('should resolve identifiers against schema', () => {
|
76
|
-
// Use analyzeWithSchema for proper schema-aware analysis
|
77
|
-
const { analysis, resolutions } = analyzeWithSchema(testQuery, testSchema)
|
78
|
-
|
79
|
-
// Check that analysis found identifiers
|
80
|
-
expect(analysis.identifiers.all.length).toBeGreaterThan(0)
|
81
|
-
|
82
|
-
// Check that we have resolutions
|
83
|
-
expect(resolutions.size).toBeGreaterThan(0)
|
84
|
-
|
85
|
-
// Check that analysis is valid
|
86
|
-
expect(analysis.isValid).toBe(true)
|
87
|
-
|
88
|
-
// Basic check that resolutions were created
|
89
|
-
const hasValidResolutions = Array.from(resolutions.values()).some(
|
90
|
-
res => res.exists && res.referenceUrl.includes('/reference/'),
|
91
|
-
)
|
92
|
-
expect(hasValidResolutions).toBe(true)
|
93
|
-
})
|
94
|
-
|
95
|
-
it('should detect non-existent fields', () => {
|
96
|
-
const invalidQuery = 'query { nonExistentField }'
|
97
|
-
const result = analyze(invalidQuery)
|
98
|
-
const resolver = createPolenSchemaResolver(testSchema)
|
99
|
-
|
100
|
-
const field = Array.from(result.identifiers.byPosition.values())[0]
|
101
|
-
const resolution = resolver.resolveIdentifier(field!)
|
102
|
-
|
103
|
-
expect(resolution).toBeDefined()
|
104
|
-
expect(resolution!.exists).toBe(false)
|
105
|
-
})
|
106
|
-
})
|
107
|
-
|
108
|
-
describe('position calculation', () => {
|
109
|
-
it('should create position calculator', () => {
|
110
|
-
const calculator = createSimplePositionCalculator()
|
111
|
-
expect(calculator).toBeDefined()
|
112
|
-
expect(calculator.prepareCodeBlock).toBeDefined()
|
113
|
-
expect(calculator.getIdentifierPositions).toBeDefined()
|
114
|
-
})
|
115
|
-
})
|
116
|
-
|
117
|
-
describe('options handling', () => {
|
118
|
-
it('should skip analysis when plain option is true', () => {
|
119
|
-
const options = { plain: true }
|
120
|
-
// When plain is true, no analysis should be performed
|
121
|
-
expect(options.plain).toBe(true)
|
122
|
-
})
|
123
|
-
|
124
|
-
it('should enable debug mode', () => {
|
125
|
-
const options = { debug: true }
|
126
|
-
expect(options.debug).toBe(true)
|
127
|
-
})
|
128
|
-
|
129
|
-
it('should handle custom navigation', () => {
|
130
|
-
const onNavigate = (url: string) => {
|
131
|
-
expect(url).toContain('/reference/')
|
132
|
-
}
|
133
|
-
const options = { onNavigate }
|
134
|
-
expect(options.onNavigate).toBeDefined()
|
135
|
-
})
|
136
|
-
|
137
|
-
it('should handle validation option', () => {
|
138
|
-
const options = { validate: true }
|
139
|
-
expect(options.validate).toBe(true)
|
140
|
-
})
|
141
|
-
|
142
|
-
it('should handle custom className', () => {
|
143
|
-
const options = { className: 'custom-graphql-block' }
|
144
|
-
expect(options.className).toBe('custom-graphql-block')
|
145
|
-
})
|
146
|
-
})
|
147
|
-
|
148
|
-
describe('validation', () => {
|
149
|
-
it('should validate valid queries', () => {
|
150
|
-
const { analysis, resolutions } = analyzeWithSchema(testQuery, testSchema)
|
151
|
-
|
152
|
-
// Check that validation passed
|
153
|
-
expect(analysis.isValid).toBe(true)
|
154
|
-
|
155
|
-
// Check that we have resolutions
|
156
|
-
expect(resolutions.size).toBeGreaterThan(0)
|
157
|
-
|
158
|
-
// Check that the user field resolved correctly
|
159
|
-
const userResolution = Array.from(resolutions.values()).find(
|
160
|
-
res => res.referenceUrl.includes('query') && res.referenceUrl.includes('user'),
|
161
|
-
)
|
162
|
-
|
163
|
-
if (userResolution) {
|
164
|
-
expect(userResolution.exists).toBe(true)
|
165
|
-
}
|
166
|
-
})
|
167
|
-
|
168
|
-
it('should detect validation errors', () => {
|
169
|
-
const invalidQuery = `
|
170
|
-
query {
|
171
|
-
user {
|
172
|
-
nonExistentField
|
173
|
-
}
|
174
|
-
}
|
175
|
-
`
|
176
|
-
|
177
|
-
const result = analyze(invalidQuery)
|
178
|
-
const resolver = createPolenSchemaResolver(testSchema)
|
179
|
-
|
180
|
-
const resolutions = Array.from(result.identifiers.byPosition.values())
|
181
|
-
.map(id => ({ id, resolution: resolver.resolveIdentifier(id) }))
|
182
|
-
|
183
|
-
const invalidField = resolutions.find(r => r.id.name === 'nonExistentField')
|
184
|
-
expect(invalidField).toBeDefined()
|
185
|
-
expect(invalidField!.resolution!.exists).toBe(false)
|
186
|
-
})
|
187
|
-
})
|
188
|
-
})
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import type { React } from '#dep/react/index'
|
2
|
-
import { useEffect, useState } from 'react'
|
3
|
-
import { useGraphQLSchema } from '../schema-context.js'
|
4
|
-
import { GraphQLDocument, type GraphQLDocumentProps } from './GraphQLDocument.js'
|
5
|
-
|
6
|
-
/**
|
7
|
-
* GraphQL Document component that uses the schema context
|
8
|
-
*/
|
9
|
-
export const GraphQLDocumentWithSchema: React.FC<Omit<GraphQLDocumentProps, `schema`>> = (
|
10
|
-
props,
|
11
|
-
) => {
|
12
|
-
const schema = useGraphQLSchema()
|
13
|
-
const [mounted, setMounted] = useState(false)
|
14
|
-
|
15
|
-
useEffect(() => {
|
16
|
-
setMounted(true)
|
17
|
-
}, [])
|
18
|
-
|
19
|
-
// Always render the same structure to avoid hydration issues
|
20
|
-
const isInteractive = mounted && schema
|
21
|
-
|
22
|
-
if (!isInteractive) {
|
23
|
-
// Static fallback
|
24
|
-
return (
|
25
|
-
<div className='graphql-document graphql-document-static' data-testid='graphql-document'>
|
26
|
-
<pre
|
27
|
-
style={{
|
28
|
-
backgroundColor: `var(--gray-a2)`,
|
29
|
-
color: `var(--gray-12)`,
|
30
|
-
padding: `var(--space-3)`,
|
31
|
-
borderRadius: `var(--radius-3)`,
|
32
|
-
}}
|
33
|
-
>
|
34
|
-
<code className="language-graphql">{props.children}</code>
|
35
|
-
</pre>
|
36
|
-
</div>
|
37
|
-
)
|
38
|
-
}
|
39
|
-
|
40
|
-
return (
|
41
|
-
<GraphQLDocument
|
42
|
-
{...props}
|
43
|
-
schema={schema}
|
44
|
-
/>
|
45
|
-
)
|
46
|
-
}
|
@@ -1,199 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* GraphQL Identifier Popover using Radix Themes
|
3
|
-
*
|
4
|
-
* Displays rich information about GraphQL identifiers on hover/click
|
5
|
-
*/
|
6
|
-
|
7
|
-
import type { React } from '#dep/react/index'
|
8
|
-
import { Cross2Icon } from '@radix-ui/react-icons'
|
9
|
-
import { Badge, Box, Flex, IconButton, Link, Popover, Text } from '@radix-ui/themes'
|
10
|
-
import type { Documentation } from '../schema-integration.js'
|
11
|
-
import type { Identifier } from '../types.js'
|
12
|
-
|
13
|
-
export interface GraphQLIdentifierPopoverProps {
|
14
|
-
/** The identifier being shown */
|
15
|
-
identifier: Identifier
|
16
|
-
/** Documentation from schema */
|
17
|
-
documentation: Documentation
|
18
|
-
/** Whether this identifier has an error */
|
19
|
-
hasError?: boolean
|
20
|
-
/** Reference URL for "View docs" link */
|
21
|
-
referenceUrl: string
|
22
|
-
/** Whether popover is open */
|
23
|
-
open: boolean
|
24
|
-
/** Whether popover is pinned */
|
25
|
-
isPinned: boolean
|
26
|
-
/** Callback when open state changes */
|
27
|
-
onOpenChange: (open: boolean) => void
|
28
|
-
/** Callback to navigate to docs */
|
29
|
-
onNavigate?: (url: string) => void
|
30
|
-
/** The trigger element */
|
31
|
-
children: React.ReactNode
|
32
|
-
}
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Popover content for GraphQL identifiers
|
36
|
-
*/
|
37
|
-
export const GraphQLIdentifierPopover: React.FC<GraphQLIdentifierPopoverProps> = ({
|
38
|
-
identifier,
|
39
|
-
documentation,
|
40
|
-
hasError = false,
|
41
|
-
referenceUrl,
|
42
|
-
open,
|
43
|
-
isPinned,
|
44
|
-
onOpenChange,
|
45
|
-
onNavigate,
|
46
|
-
children,
|
47
|
-
}) => {
|
48
|
-
// Determine badge color based on identifier kind
|
49
|
-
const getBadgeColor = () => {
|
50
|
-
switch (identifier.kind) {
|
51
|
-
case `Type`:
|
52
|
-
return `blue`
|
53
|
-
case `Field`:
|
54
|
-
return `green`
|
55
|
-
case `Argument`:
|
56
|
-
return `orange`
|
57
|
-
case `Variable`:
|
58
|
-
return `purple`
|
59
|
-
case `Directive`:
|
60
|
-
return `amber`
|
61
|
-
case `Fragment`:
|
62
|
-
return `cyan`
|
63
|
-
default:
|
64
|
-
return `gray`
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
return (
|
69
|
-
<Popover.Root open={open} onOpenChange={onOpenChange}>
|
70
|
-
<Popover.Trigger>
|
71
|
-
{children}
|
72
|
-
</Popover.Trigger>
|
73
|
-
|
74
|
-
<Popover.Content
|
75
|
-
className='graphql-identifier-popover'
|
76
|
-
style={{ maxWidth: 400 }}
|
77
|
-
onInteractOutside={(e) => {
|
78
|
-
// Prevent closing when clicking inside popover if pinned
|
79
|
-
if (isPinned) {
|
80
|
-
e.preventDefault()
|
81
|
-
}
|
82
|
-
}}
|
83
|
-
>
|
84
|
-
<Flex direction='column' gap='2'>
|
85
|
-
{/* Header with name, kind, and close button */}
|
86
|
-
<Flex justify='between' align='center'>
|
87
|
-
<Flex align='center' gap='2'>
|
88
|
-
<Text size='2' weight='bold'>
|
89
|
-
{identifier.name}
|
90
|
-
</Text>
|
91
|
-
<Badge color={getBadgeColor()} size='1'>
|
92
|
-
{identifier.kind}
|
93
|
-
</Badge>
|
94
|
-
</Flex>
|
95
|
-
{isPinned && (
|
96
|
-
<IconButton
|
97
|
-
size='1'
|
98
|
-
variant='ghost'
|
99
|
-
onClick={() => {
|
100
|
-
onOpenChange(false)
|
101
|
-
}}
|
102
|
-
aria-label='Close popover'
|
103
|
-
>
|
104
|
-
<Cross2Icon />
|
105
|
-
</IconButton>
|
106
|
-
)}
|
107
|
-
</Flex>
|
108
|
-
|
109
|
-
{/* Type signature */}
|
110
|
-
<Box>
|
111
|
-
<Text size='1' color='gray'>
|
112
|
-
Type: <Text as='span' size='1' style={{ fontFamily: `monospace` }}>{documentation.typeInfo}</Text>
|
113
|
-
</Text>
|
114
|
-
</Box>
|
115
|
-
|
116
|
-
{/* Description */}
|
117
|
-
{documentation.description && (
|
118
|
-
<Box>
|
119
|
-
<Text size='1'>
|
120
|
-
{documentation.description}
|
121
|
-
</Text>
|
122
|
-
</Box>
|
123
|
-
)}
|
124
|
-
|
125
|
-
{/* Default value for arguments */}
|
126
|
-
{documentation.defaultValue && (
|
127
|
-
<Box>
|
128
|
-
<Text size='1' color='gray'>
|
129
|
-
Default:{` `}
|
130
|
-
<Text as='span' size='1' style={{ fontFamily: `monospace` }}>{documentation.defaultValue}</Text>
|
131
|
-
</Text>
|
132
|
-
</Box>
|
133
|
-
)}
|
134
|
-
|
135
|
-
{/* Deprecation warning */}
|
136
|
-
{documentation.deprecated && (
|
137
|
-
<Box
|
138
|
-
style={{
|
139
|
-
padding: `8px`,
|
140
|
-
backgroundColor: `var(--amber-2)`,
|
141
|
-
borderRadius: `4px`,
|
142
|
-
border: `1px solid var(--amber-6)`,
|
143
|
-
}}
|
144
|
-
>
|
145
|
-
<Text size='1' color='amber'>
|
146
|
-
⚠️ Deprecated: {documentation.deprecated.reason}
|
147
|
-
</Text>
|
148
|
-
{documentation.deprecated.replacement && (
|
149
|
-
<Text size='1' color='amber'>
|
150
|
-
Use {documentation.deprecated.replacement} instead.
|
151
|
-
</Text>
|
152
|
-
)}
|
153
|
-
</Box>
|
154
|
-
)}
|
155
|
-
|
156
|
-
{/* Error message */}
|
157
|
-
{hasError && (
|
158
|
-
<Box
|
159
|
-
style={{
|
160
|
-
padding: `8px`,
|
161
|
-
backgroundColor: `var(--red-2)`,
|
162
|
-
borderRadius: `4px`,
|
163
|
-
border: `1px solid var(--red-6)`,
|
164
|
-
}}
|
165
|
-
>
|
166
|
-
<Text size='1' color='red'>
|
167
|
-
❌ {identifier.kind} not found in schema
|
168
|
-
</Text>
|
169
|
-
</Box>
|
170
|
-
)}
|
171
|
-
|
172
|
-
{/* Schema path */}
|
173
|
-
<Box>
|
174
|
-
<Text size='1' color='gray'>
|
175
|
-
Path: {identifier.schemaPath.join(` → `)}
|
176
|
-
</Text>
|
177
|
-
</Box>
|
178
|
-
|
179
|
-
{/* View docs link */}
|
180
|
-
{onNavigate && !hasError && (
|
181
|
-
<Box>
|
182
|
-
<Link
|
183
|
-
size='1'
|
184
|
-
href={referenceUrl}
|
185
|
-
onClick={(e: React.MouseEvent) => {
|
186
|
-
e.preventDefault()
|
187
|
-
onNavigate(referenceUrl)
|
188
|
-
onOpenChange(false)
|
189
|
-
}}
|
190
|
-
>
|
191
|
-
View full documentation →
|
192
|
-
</Link>
|
193
|
-
</Box>
|
194
|
-
)}
|
195
|
-
</Flex>
|
196
|
-
</Popover.Content>
|
197
|
-
</Popover.Root>
|
198
|
-
)
|
199
|
-
}
|