polen 0.10.0-next.11 → 0.10.0-next.12

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 (324) hide show
  1. package/build/api/builder/builder.js +1 -1
  2. package/build/api/builder/builder.js.map +1 -1
  3. package/build/api/config/load.js +1 -1
  4. package/build/api/config/load.js.map +1 -1
  5. package/build/api/vite/plugins/build.js +1 -1
  6. package/build/api/vite/plugins/build.js.map +1 -1
  7. package/build/api/vite/plugins/core.d.ts.map +1 -1
  8. package/build/api/vite/plugins/core.js +0 -2
  9. package/build/api/vite/plugins/core.js.map +1 -1
  10. package/build/api/vite/plugins/pages.js +1 -1
  11. package/build/api/vite/plugins/pages.js.map +1 -1
  12. package/build/exports/components.d.ts +4 -1
  13. package/build/exports/components.d.ts.map +1 -1
  14. package/build/exports/components.js +4 -1
  15. package/build/exports/components.js.map +1 -1
  16. package/build/lib/demos/config-schema.d.ts +6 -6
  17. package/build/lib/github-actions/runner.js +2 -2
  18. package/build/lib/github-actions/runner.js.map +1 -1
  19. package/build/lib/graphql-document/$$.d.ts +5 -0
  20. package/build/lib/graphql-document/$$.d.ts.map +1 -0
  21. package/build/lib/graphql-document/$$.js +5 -0
  22. package/build/lib/graphql-document/$$.js.map +1 -0
  23. package/build/lib/graphql-document/$.d.ts +2 -0
  24. package/build/lib/graphql-document/$.d.ts.map +1 -0
  25. package/build/lib/graphql-document/$.js +2 -0
  26. package/build/lib/graphql-document/$.js.map +1 -0
  27. package/build/lib/graphql-document/analysis.d.ts +44 -0
  28. package/build/lib/graphql-document/analysis.d.ts.map +1 -0
  29. package/build/lib/graphql-document/analysis.js +361 -0
  30. package/build/lib/graphql-document/analysis.js.map +1 -0
  31. package/build/lib/graphql-document/components/GraphQLDocument.d.ts +42 -0
  32. package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -0
  33. package/build/lib/graphql-document/components/GraphQLDocument.js +173 -0
  34. package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -0
  35. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +7 -0
  36. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +1 -0
  37. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +45 -0
  38. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +1 -0
  39. package/build/lib/graphql-document/components/HoverTooltip.d.ts +35 -0
  40. package/build/lib/graphql-document/components/HoverTooltip.d.ts.map +1 -0
  41. package/build/lib/graphql-document/components/HoverTooltip.js +132 -0
  42. package/build/lib/graphql-document/components/HoverTooltip.js.map +1 -0
  43. package/build/lib/graphql-document/components/IdentifierLink.d.ts +37 -0
  44. package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +1 -0
  45. package/build/lib/graphql-document/components/IdentifierLink.js +141 -0
  46. package/build/lib/graphql-document/components/IdentifierLink.js.map +1 -0
  47. package/build/lib/graphql-document/components/index.d.ts +5 -0
  48. package/build/lib/graphql-document/components/index.d.ts.map +1 -0
  49. package/build/lib/graphql-document/components/index.js +5 -0
  50. package/build/lib/graphql-document/components/index.js.map +1 -0
  51. package/build/lib/graphql-document/example.d.ts +25 -0
  52. package/build/lib/graphql-document/example.d.ts.map +1 -0
  53. package/build/lib/graphql-document/example.js +140 -0
  54. package/build/lib/graphql-document/example.js.map +1 -0
  55. package/build/lib/graphql-document/graphql-document.d.ts +35 -0
  56. package/build/lib/graphql-document/graphql-document.d.ts.map +1 -0
  57. package/build/lib/graphql-document/graphql-document.js +36 -0
  58. package/build/lib/graphql-document/graphql-document.js.map +1 -0
  59. package/build/lib/graphql-document/positioning-simple.d.ts +68 -0
  60. package/build/lib/graphql-document/positioning-simple.d.ts.map +1 -0
  61. package/build/lib/graphql-document/positioning-simple.js +197 -0
  62. package/build/lib/graphql-document/positioning-simple.js.map +1 -0
  63. package/build/lib/graphql-document/schema-context.d.ts +8 -0
  64. package/build/lib/graphql-document/schema-context.d.ts.map +1 -0
  65. package/build/lib/graphql-document/schema-context.js +11 -0
  66. package/build/lib/graphql-document/schema-context.js.map +1 -0
  67. package/build/lib/graphql-document/schema-integration-example.d.ts +27 -0
  68. package/build/lib/graphql-document/schema-integration-example.d.ts.map +1 -0
  69. package/build/lib/graphql-document/schema-integration-example.js +297 -0
  70. package/build/lib/graphql-document/schema-integration-example.js.map +1 -0
  71. package/build/lib/graphql-document/schema-integration.d.ts +135 -0
  72. package/build/lib/graphql-document/schema-integration.d.ts.map +1 -0
  73. package/build/lib/graphql-document/schema-integration.js +328 -0
  74. package/build/lib/graphql-document/schema-integration.js.map +1 -0
  75. package/build/lib/graphql-document/types.d.ts +117 -0
  76. package/build/lib/graphql-document/types.d.ts.map +1 -0
  77. package/build/lib/graphql-document/types.js +2 -0
  78. package/build/lib/graphql-document/types.js.map +1 -0
  79. package/build/template/components/ArgumentAnnotation.js +10 -0
  80. package/build/template/components/ArgumentAnnotation.js.map +1 -0
  81. package/build/template/components/ArgumentList.js +9 -0
  82. package/build/template/components/ArgumentList.js.map +1 -0
  83. package/build/template/components/ArgumentListAnnotation.js +15 -0
  84. package/build/template/components/ArgumentListAnnotation.js.map +1 -0
  85. package/build/template/components/Changelog.js +44 -0
  86. package/build/template/components/Changelog.js.map +1 -0
  87. package/build/template/components/{CodeBlock.jsx → CodeBlock.js} +4 -5
  88. package/build/template/components/{CodeBlock.jsx.map → CodeBlock.js.map} +1 -1
  89. package/build/template/components/{CodeBlockEnhancer.jsx → CodeBlockEnhancer.js} +4 -4
  90. package/build/template/components/CodeBlockEnhancer.js.map +1 -0
  91. package/build/template/components/DeprecationReason.js +9 -0
  92. package/build/template/components/DeprecationReason.js.map +1 -0
  93. package/build/template/components/Description.js +9 -0
  94. package/build/template/components/Description.js.map +1 -0
  95. package/build/template/components/Field.js +14 -0
  96. package/build/template/components/Field.js.map +1 -0
  97. package/build/template/components/{FieldList.jsx → FieldList.js} +4 -5
  98. package/build/template/components/FieldList.js.map +1 -0
  99. package/build/template/components/{FieldListSection.jsx → FieldListSection.js} +4 -6
  100. package/build/template/components/FieldListSection.js.map +1 -0
  101. package/build/template/components/HamburgerMenu.js +30 -0
  102. package/build/template/components/HamburgerMenu.js.map +1 -0
  103. package/build/template/components/Link.d.ts +1 -1
  104. package/build/template/components/{Link.jsx → Link.js} +4 -5
  105. package/build/template/components/Link.js.map +1 -0
  106. package/build/template/components/Logo.js +20 -0
  107. package/build/template/components/Logo.js.map +1 -0
  108. package/build/template/components/MDXComponents.d.ts +11 -0
  109. package/build/template/components/MDXComponents.d.ts.map +1 -0
  110. package/build/template/components/MDXComponents.js +70 -0
  111. package/build/template/components/MDXComponents.js.map +1 -0
  112. package/build/template/components/{Markdown.jsx → Markdown.js} +3 -2
  113. package/build/template/components/Markdown.js.map +1 -0
  114. package/build/template/components/MissingSchema.d.ts +1 -1
  115. package/build/template/components/MissingSchema.d.ts.map +1 -1
  116. package/build/template/components/MissingSchema.js +5 -0
  117. package/build/template/components/MissingSchema.js.map +1 -0
  118. package/build/template/components/NamedType.js +12 -0
  119. package/build/template/components/NamedType.js.map +1 -0
  120. package/build/template/components/NotFound.js +7 -0
  121. package/build/template/components/NotFound.js.map +1 -0
  122. package/build/template/components/{RadixLink.jsx → RadixLink.js} +1 -1
  123. package/build/template/components/RadixLink.js.map +1 -0
  124. package/build/template/components/TestComponent.d.ts +5 -0
  125. package/build/template/components/TestComponent.d.ts.map +1 -0
  126. package/build/template/components/TestComponent.js +7 -0
  127. package/build/template/components/TestComponent.js.map +1 -0
  128. package/build/template/components/Texts/{MinorHeading.jsx → MinorHeading.js} +4 -3
  129. package/build/template/components/Texts/MinorHeading.js.map +1 -0
  130. package/build/template/components/Texts/texts.js +1 -1
  131. package/build/template/components/Texts/texts.js.map +1 -1
  132. package/build/template/components/ThemeToggle.js +9 -0
  133. package/build/template/components/ThemeToggle.js.map +1 -0
  134. package/build/template/components/{TypeAnnotation.jsx → TypeAnnotation.js} +8 -18
  135. package/build/template/components/TypeAnnotation.js.map +1 -0
  136. package/build/template/components/TypeFieldsLinkList.js +9 -0
  137. package/build/template/components/TypeFieldsLinkList.js.map +1 -0
  138. package/build/template/components/TypeIndex.js +17 -0
  139. package/build/template/components/TypeIndex.js.map +1 -0
  140. package/build/template/components/content/$$.d.ts +1 -0
  141. package/build/template/components/content/$$.d.ts.map +1 -1
  142. package/build/template/components/content/$$.js +1 -0
  143. package/build/template/components/content/$$.js.map +1 -1
  144. package/build/template/components/content/GraphQLDocumentWithSchema.d.ts +8 -0
  145. package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +1 -0
  146. package/build/template/components/content/GraphQLDocumentWithSchema.js +16 -0
  147. package/build/template/components/content/GraphQLDocumentWithSchema.js.map +1 -0
  148. package/build/template/components/content/GraphQLDocumentWrapper.d.ts +7 -0
  149. package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +1 -0
  150. package/build/template/components/content/GraphQLDocumentWrapper.js +62 -0
  151. package/build/template/components/content/GraphQLDocumentWrapper.js.map +1 -0
  152. package/build/template/components/graphql/graphql.d.ts +2 -2
  153. package/build/template/components/graphql/graphql.js +3 -0
  154. package/build/template/components/graphql/graphql.js.map +1 -0
  155. package/build/template/components/graphql/index.d.ts +1 -1
  156. package/build/template/components/graphql/index.js +1 -1
  157. package/build/template/components/graphql/index.js.map +1 -1
  158. package/build/template/components/graphql/{type-kind-icon.jsx → type-kind-icon.js} +3 -2
  159. package/build/template/components/graphql/type-kind-icon.js.map +1 -0
  160. package/build/template/components/graphql/type-link.js +11 -0
  161. package/build/template/components/graphql/type-link.js.map +1 -0
  162. package/build/template/components/sidebar/Sidebar.d.ts +1 -1
  163. package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
  164. package/build/template/components/sidebar/Sidebar.js +11 -0
  165. package/build/template/components/sidebar/Sidebar.js.map +1 -0
  166. package/build/template/components/sidebar/{SidebarItem.jsx → SidebarItem.js} +15 -32
  167. package/build/template/components/sidebar/SidebarItem.js.map +1 -0
  168. package/build/template/components/sidebar/ToggleButton.d.ts +1 -1
  169. package/build/template/components/sidebar/ToggleButton.d.ts.map +1 -1
  170. package/build/template/components/sidebar/ToggleButton.js +5 -0
  171. package/build/template/components/sidebar/ToggleButton.js.map +1 -0
  172. package/build/template/contexts/{ThemeContext.jsx → ThemeContext.js} +3 -4
  173. package/build/template/contexts/{ThemeContext.jsx.map → ThemeContext.js.map} +1 -1
  174. package/build/template/entry.client.d.ts +1 -0
  175. package/build/template/entry.client.d.ts.map +1 -1
  176. package/build/template/{entry.client.jsx → entry.client.js} +5 -6
  177. package/build/template/entry.client.js.map +1 -0
  178. package/build/template/routes/changelog.d.ts +1 -1
  179. package/build/template/routes/{changelog.jsx → changelog.js} +5 -4
  180. package/build/template/routes/changelog.js.map +1 -0
  181. package/build/template/routes/{index.jsx → index.js} +3 -2
  182. package/build/template/routes/index.js.map +1 -0
  183. package/build/template/routes/reference.$type.$field.d.ts +1 -1
  184. package/build/template/routes/{reference.$type.$field.jsx → reference.$type.$field.js} +6 -5
  185. package/build/template/routes/reference.$type.$field.js.map +1 -0
  186. package/build/template/routes/reference.$type.d.ts +1 -1
  187. package/build/template/routes/{reference.$type.jsx → reference.$type.js} +6 -5
  188. package/build/template/routes/reference.$type.js.map +1 -0
  189. package/build/template/routes/reference.d.ts +2 -2
  190. package/build/template/routes/{reference.jsx → reference.js} +6 -7
  191. package/build/template/routes/reference.js.map +1 -0
  192. package/build/template/routes/root.d.ts +2 -2
  193. package/build/template/routes/root.d.ts.map +1 -1
  194. package/build/template/routes/{root.jsx → root.js} +46 -88
  195. package/build/template/routes/root.js.map +1 -0
  196. package/build/template/routes.js +5 -0
  197. package/build/template/routes.js.map +1 -0
  198. package/build/template/server/app.js +1 -1
  199. package/build/template/server/app.js.map +1 -1
  200. package/build/template/server/{render-page.jsx → render-page.js} +3 -4
  201. package/build/template/server/render-page.js.map +1 -0
  202. package/build/template/server/ssg/generate.js +1 -1
  203. package/build/template/server/ssg/generate.js.map +1 -1
  204. package/build/template/server/ssg/get-route-paths.js +1 -1
  205. package/build/template/server/ssg/get-route-paths.js.map +1 -1
  206. package/build/template/server/view.js +1 -1
  207. package/build/template/server/view.js.map +1 -1
  208. package/package.json +56 -8
  209. package/src/api/vite/plugins/core.ts +0 -3
  210. package/src/api/vite/plugins/pages.ts +1 -1
  211. package/src/exports/components.ts +4 -1
  212. package/src/lib/graphql-document/$$.ts +4 -0
  213. package/src/lib/graphql-document/$.test.ts +132 -0
  214. package/src/lib/graphql-document/$.ts +1 -0
  215. package/src/lib/graphql-document/README.md +102 -0
  216. package/src/lib/graphql-document/analysis.ts +415 -0
  217. package/src/lib/graphql-document/components/GraphQLDocument.tsx +284 -0
  218. package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +188 -0
  219. package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +70 -0
  220. package/src/lib/graphql-document/components/HoverTooltip.tsx +282 -0
  221. package/src/lib/graphql-document/components/IdentifierLink.tsx +221 -0
  222. package/src/lib/graphql-document/components/index.ts +4 -0
  223. package/src/lib/graphql-document/demo.md +155 -0
  224. package/src/lib/graphql-document/example.ts +163 -0
  225. package/src/lib/graphql-document/graphql-document.ts +37 -0
  226. package/src/lib/graphql-document/positioning-simple.test.ts +252 -0
  227. package/src/lib/graphql-document/positioning-simple.ts +271 -0
  228. package/src/lib/graphql-document/schema-context.tsx +20 -0
  229. package/src/lib/graphql-document/schema-integration-example.ts +341 -0
  230. package/src/lib/graphql-document/schema-integration.test.ts +365 -0
  231. package/src/lib/graphql-document/schema-integration.ts +497 -0
  232. package/src/lib/graphql-document/types.ts +129 -0
  233. package/src/template/components/ArgumentAnnotation.tsx +1 -1
  234. package/src/template/components/ArgumentList.tsx +1 -1
  235. package/src/template/components/ArgumentListAnnotation.tsx +2 -2
  236. package/src/template/components/CodeBlockEnhancer.tsx +21 -21
  237. package/src/template/components/DeprecationReason.tsx +1 -1
  238. package/src/template/components/Description.tsx +1 -1
  239. package/src/template/components/Field.tsx +4 -4
  240. package/src/template/components/FieldList.tsx +1 -1
  241. package/src/template/components/FieldListSection.tsx +1 -1
  242. package/src/template/components/Link.tsx +2 -2
  243. package/src/template/components/MDXComponents.tsx +101 -0
  244. package/src/template/components/NamedType.tsx +2 -2
  245. package/src/template/components/TestComponent.tsx +6 -0
  246. package/src/template/components/TypeAnnotation.tsx +1 -1
  247. package/src/template/components/TypeFieldsLinkList.tsx +1 -1
  248. package/src/template/components/TypeIndex.tsx +1 -1
  249. package/src/template/components/content/$$.ts +1 -0
  250. package/src/template/components/content/GraphQLDocumentWithSchema.tsx +18 -0
  251. package/src/template/components/content/GraphQLDocumentWrapper.tsx +82 -0
  252. package/src/template/components/graphql/graphql.tsx +2 -2
  253. package/src/template/components/graphql/index.ts +1 -1
  254. package/src/template/components/graphql/type-link.tsx +2 -2
  255. package/src/template/entry.client.tsx +2 -2
  256. package/src/template/routes/changelog.tsx +1 -1
  257. package/src/template/routes/reference.$type.$field.tsx +3 -3
  258. package/src/template/routes/reference.$type.tsx +3 -3
  259. package/src/template/routes/reference.tsx +3 -3
  260. package/src/template/routes/root.tsx +36 -25
  261. package/src/template/routes.tsx +1 -1
  262. package/src/template/server/app.ts +1 -1
  263. package/src/template/server/ssg/generate.ts +1 -1
  264. package/src/template/server/ssg/get-route-paths.ts +1 -1
  265. package/src/template/server/view.ts +1 -1
  266. package/src/template/styles/code-block.css +32 -0
  267. package/build/template/components/ArgumentAnnotation.jsx +0 -16
  268. package/build/template/components/ArgumentAnnotation.jsx.map +0 -1
  269. package/build/template/components/ArgumentList.jsx +0 -16
  270. package/build/template/components/ArgumentList.jsx.map +0 -1
  271. package/build/template/components/ArgumentListAnnotation.jsx +0 -23
  272. package/build/template/components/ArgumentListAnnotation.jsx.map +0 -1
  273. package/build/template/components/Changelog.jsx +0 -68
  274. package/build/template/components/Changelog.jsx.map +0 -1
  275. package/build/template/components/CodeBlockEnhancer.jsx.map +0 -1
  276. package/build/template/components/DeprecationReason.jsx +0 -10
  277. package/build/template/components/DeprecationReason.jsx.map +0 -1
  278. package/build/template/components/Description.jsx +0 -10
  279. package/build/template/components/Description.jsx.map +0 -1
  280. package/build/template/components/Field.jsx +0 -22
  281. package/build/template/components/Field.jsx.map +0 -1
  282. package/build/template/components/FieldList.jsx.map +0 -1
  283. package/build/template/components/FieldListSection.jsx.map +0 -1
  284. package/build/template/components/HamburgerMenu.jsx +0 -53
  285. package/build/template/components/HamburgerMenu.jsx.map +0 -1
  286. package/build/template/components/Link.jsx.map +0 -1
  287. package/build/template/components/Logo.jsx +0 -29
  288. package/build/template/components/Logo.jsx.map +0 -1
  289. package/build/template/components/Markdown.jsx.map +0 -1
  290. package/build/template/components/MissingSchema.jsx +0 -4
  291. package/build/template/components/MissingSchema.jsx.map +0 -1
  292. package/build/template/components/NamedType.jsx +0 -17
  293. package/build/template/components/NamedType.jsx.map +0 -1
  294. package/build/template/components/NotFound.jsx +0 -26
  295. package/build/template/components/NotFound.jsx.map +0 -1
  296. package/build/template/components/RadixLink.jsx.map +0 -1
  297. package/build/template/components/Texts/MinorHeading.jsx.map +0 -1
  298. package/build/template/components/ThemeToggle.jsx +0 -10
  299. package/build/template/components/ThemeToggle.jsx.map +0 -1
  300. package/build/template/components/TypeAnnotation.jsx.map +0 -1
  301. package/build/template/components/TypeFieldsLinkList.jsx +0 -17
  302. package/build/template/components/TypeFieldsLinkList.jsx.map +0 -1
  303. package/build/template/components/TypeIndex.jsx +0 -27
  304. package/build/template/components/TypeIndex.jsx.map +0 -1
  305. package/build/template/components/graphql/graphql.jsx +0 -3
  306. package/build/template/components/graphql/graphql.jsx.map +0 -1
  307. package/build/template/components/graphql/type-kind-icon.jsx.map +0 -1
  308. package/build/template/components/graphql/type-link.jsx +0 -16
  309. package/build/template/components/graphql/type-link.jsx.map +0 -1
  310. package/build/template/components/sidebar/Sidebar.jsx +0 -15
  311. package/build/template/components/sidebar/Sidebar.jsx.map +0 -1
  312. package/build/template/components/sidebar/SidebarItem.jsx.map +0 -1
  313. package/build/template/components/sidebar/ToggleButton.jsx +0 -6
  314. package/build/template/components/sidebar/ToggleButton.jsx.map +0 -1
  315. package/build/template/entry.client.jsx.map +0 -1
  316. package/build/template/routes/changelog.jsx.map +0 -1
  317. package/build/template/routes/index.jsx.map +0 -1
  318. package/build/template/routes/reference.$type.$field.jsx.map +0 -1
  319. package/build/template/routes/reference.$type.jsx.map +0 -1
  320. package/build/template/routes/reference.jsx.map +0 -1
  321. package/build/template/routes/root.jsx.map +0 -1
  322. package/build/template/routes.jsx +0 -5
  323. package/build/template/routes.jsx.map +0 -1
  324. package/build/template/server/render-page.jsx.map +0 -1
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { useGraphQLSchema } from "../schema-context.js";
4
+ import { GraphQLDocument } from "./GraphQLDocument.js";
5
+ // Cache for highlighter
6
+ let highlighterCache = null;
7
+ /**
8
+ * GraphQL Document component that uses the schema context and handles syntax highlighting
9
+ */
10
+ export const GraphQLDocumentWithSchema = (props) => {
11
+ const schema = useGraphQLSchema();
12
+ const [mounted, setMounted] = useState(false);
13
+ const [highlightedHtml, setHighlightedHtml] = useState(null);
14
+ useEffect(() => {
15
+ setMounted(true);
16
+ const loadHighlighter = async () => {
17
+ try {
18
+ // Load highlighter if not cached
19
+ if (!highlighterCache) {
20
+ const { highlightCode } = await import('#lib/shiki/index');
21
+ highlighterCache = highlightCode;
22
+ }
23
+ // Generate highlighted HTML
24
+ const highlighted = await highlighterCache({
25
+ code: props['children'],
26
+ lang: 'graphql',
27
+ theme: 'light',
28
+ });
29
+ setHighlightedHtml(highlighted);
30
+ }
31
+ catch (error) {
32
+ console.error('Failed to load GraphQL document highlighter:', error);
33
+ }
34
+ };
35
+ loadHighlighter();
36
+ }, [props['children']]);
37
+ // Always render the same structure to avoid hydration issues
38
+ const isInteractive = mounted && schema && highlightedHtml;
39
+ if (!isInteractive) {
40
+ // Static fallback that looks like Shiki output
41
+ return (_jsx("div", { className: 'graphql-document graphql-document-static', "data-testid": 'graphql-document', children: _jsx("pre", { className: 'shiki shiki-themes github-light tokyo-night', style: { backgroundColor: 'var(--shiki-light-bg)', color: 'var(--shiki-light)' }, children: _jsx("code", { className: "language-graphql", children: props['children'] }) }) }));
42
+ }
43
+ return (_jsx(GraphQLDocument, { ...props, schema: schema, highlightedHtml: highlightedHtml }));
44
+ };
45
+ //# sourceMappingURL=GraphQLDocumentWithSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GraphQLDocumentWithSchema.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAuB,CAAA;AACxD,OAAO,EAAE,eAAe,EAA6B,MAAM,sBAAuB,CAAA;AAElF,wBAAwB;AACxB,IAAI,gBAAgB,GAAQ,IAAI,CAAA;AAEhC;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAuE,CAC3G,KAAK,EACL,EAAE;IACF,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAA;IACjC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAA;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE;YACjC,IAAI,CAAC;gBACH,iCAAiC;gBACjC,IAAI,CAAC,gBAAgB,EAAE,CAAC;oBACtB,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA;oBAC1D,gBAAgB,GAAG,aAAa,CAAA;gBAClC,CAAC;gBAED,4BAA4B;gBAC5B,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC;oBACzC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC;oBACvB,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,OAAO;iBACf,CAAC,CAAA;gBAEF,kBAAkB,CAAC,WAAW,CAAC,CAAA;YACjC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAA;YACtE,CAAC;QACH,CAAC,CAAA;QAED,eAAe,EAAE,CAAA;IACnB,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IAEvB,6DAA6D;IAC7D,MAAM,aAAa,GAAG,OAAO,IAAI,MAAM,IAAI,eAAe,CAAA;IAE1D,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,+CAA+C;QAC/C,OAAO,CACL,cAAK,SAAS,EAAC,0CAA0C,iBAAa,kBAAkB,YACtF,cACE,SAAS,EAAC,6CAA6C,EACvD,KAAK,EAAE,EAAE,eAAe,EAAE,uBAAuB,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAEhF,eAAM,SAAS,EAAC,kBAAkB,YAAE,KAAK,CAAC,UAAU,CAAC,GAAQ,GACzD,GACF,CACP,CAAA;IACH,CAAC;IAED,OAAO,CACL,KAAC,eAAe,OACV,KAAK,EACT,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,GAChC,CACH,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,35 @@
1
+ import type { React } from '#dep/react/index';
2
+ import type { DOMPosition } from '../positioning-simple.ts';
3
+ import type { Documentation } from '../schema-integration.ts';
4
+ import type { Identifier } from '../types.ts';
5
+ /**
6
+ * Props for the HoverTooltip component
7
+ */
8
+ export interface HoverTooltipProps {
9
+ /** The identifier being hovered */
10
+ identifier: Identifier;
11
+ /** Documentation from schema */
12
+ documentation: Documentation;
13
+ /** Position of the identifier */
14
+ position: DOMPosition;
15
+ /** Whether this identifier has an error */
16
+ hasError?: boolean;
17
+ /** Reference URL for "View docs" link */
18
+ referenceUrl: string;
19
+ /** Callback to close the tooltip */
20
+ onClose?: () => void;
21
+ /** Callback to navigate to docs */
22
+ onNavigate?: () => void;
23
+ }
24
+ /**
25
+ * Tooltip shown on hover over GraphQL identifiers
26
+ *
27
+ * Displays type information, descriptions, deprecation warnings,
28
+ * and links to full documentation.
29
+ */
30
+ export declare const HoverTooltip: React.FC<HoverTooltipProps>;
31
+ /**
32
+ * Default styles for hover tooltips
33
+ */
34
+ export declare const hoverTooltipStyles = "\n.graphql-hover-tooltip {\n /* Tooltip animation */\n animation: graphql-tooltip-fade-in 0.2s ease-out;\n}\n\n@keyframes graphql-tooltip-fade-in {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Ensure tooltips appear above other content */\n.graphql-hover-tooltip .rt-Card {\n box-shadow: 0 10px 38px -10px rgba(22, 23, 24, 0.35), \n 0 10px 20px -15px rgba(22, 23, 24, 0.2);\n}\n";
35
+ //# sourceMappingURL=HoverTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HoverTooltip.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/HoverTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,UAAU,EAAE,UAAU,CAAA;IACtB,gCAAgC;IAChC,aAAa,EAAE,aAAa,CAAA;IAC5B,iCAAiC;IACjC,QAAQ,EAAE,WAAW,CAAA;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA6NpD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,yeAsB9B,CAAA"}
@@ -0,0 +1,132 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Badge, Box, Card, Flex, Text } from '@radix-ui/themes';
3
+ import { useEffect, useRef, useState } from 'react';
4
+ /**
5
+ * Tooltip shown on hover over GraphQL identifiers
6
+ *
7
+ * Displays type information, descriptions, deprecation warnings,
8
+ * and links to full documentation.
9
+ */
10
+ export const HoverTooltip = ({ identifier, documentation, position, hasError = false, referenceUrl, onClose, onNavigate, }) => {
11
+ const tooltipRef = useRef(null);
12
+ const [tooltipPosition, setTooltipPosition] = useState({ top: 0, left: 0 });
13
+ // Calculate tooltip position to avoid viewport edges
14
+ useEffect(() => {
15
+ if (!tooltipRef.current)
16
+ return;
17
+ const tooltip = tooltipRef.current;
18
+ const rect = tooltip.getBoundingClientRect();
19
+ const viewportWidth = window.innerWidth;
20
+ const viewportHeight = window.innerHeight;
21
+ // Default position: above the identifier
22
+ let top = position.top - rect.height - 8;
23
+ let left = position.left;
24
+ // Adjust if tooltip would go off screen
25
+ if (top < 0) {
26
+ // Show below if not enough space above
27
+ top = position.top + position.height + 8;
28
+ }
29
+ if (left + rect.width > viewportWidth) {
30
+ // Align right edge with identifier if too wide
31
+ left = position.left + position.width - rect.width;
32
+ }
33
+ if (left < 0) {
34
+ // Keep on screen
35
+ left = 8;
36
+ }
37
+ setTooltipPosition({ top, left });
38
+ }, [position]);
39
+ // Determine badge color based on identifier kind
40
+ const getBadgeColor = () => {
41
+ switch (identifier.kind) {
42
+ case 'Type':
43
+ return 'blue';
44
+ case 'Field':
45
+ return 'green';
46
+ case 'Argument':
47
+ return 'orange';
48
+ case 'Variable':
49
+ return 'purple';
50
+ case 'Directive':
51
+ return 'amber';
52
+ case 'Fragment':
53
+ return 'cyan';
54
+ default:
55
+ return 'gray';
56
+ }
57
+ };
58
+ return (_jsx("div", { ref: tooltipRef, className: 'graphql-hover-tooltip', style: {
59
+ position: 'absolute',
60
+ top: tooltipPosition.top,
61
+ left: tooltipPosition.left,
62
+ zIndex: 100,
63
+ maxWidth: '400px',
64
+ pointerEvents: 'auto', // Make tooltip interactive
65
+ }, children: _jsx(Card, { size: '2', variant: 'surface', children: _jsxs(Flex, { direction: 'column', gap: '2', children: [_jsxs(Flex, { justify: 'between', align: 'center', children: [_jsxs(Flex, { align: 'center', gap: '2', children: [_jsx(Text, { size: '2', weight: 'bold', children: identifier.name }), _jsx(Badge, { color: getBadgeColor(), size: '1', children: identifier.kind })] }), onClose && (_jsx("button", { onClick: onClose, style: {
66
+ background: 'none',
67
+ border: 'none',
68
+ cursor: 'pointer',
69
+ padding: '4px',
70
+ color: 'var(--gray-11)',
71
+ fontSize: '18px',
72
+ lineHeight: '1',
73
+ fontWeight: 'bold',
74
+ borderRadius: '4px',
75
+ transition: 'background-color 0.2s',
76
+ }, onMouseEnter: (e) => {
77
+ e.currentTarget.style.backgroundColor = 'var(--gray-a3)';
78
+ }, onMouseLeave: (e) => {
79
+ e.currentTarget.style.backgroundColor = 'transparent';
80
+ }, "aria-label": 'Close tooltip', children: "\u00D7" }))] }), _jsx(Box, { children: _jsxs(Text, { size: '1', color: 'gray', children: ["Type: ", _jsx(Text, { as: 'span', size: '1', style: { fontFamily: 'monospace' }, children: documentation.typeInfo })] }) }), documentation.description && (_jsx(Box, { children: _jsx(Text, { size: '1', children: documentation.description }) })), documentation.defaultValue && (_jsx(Box, { children: _jsxs(Text, { size: '1', color: 'gray', children: ["Default:", ' ', _jsx(Text, { as: 'span', size: '1', style: { fontFamily: 'monospace' }, children: documentation.defaultValue })] }) })), documentation.deprecated && (_jsxs(Box, { style: {
81
+ padding: '8px',
82
+ backgroundColor: 'var(--amber-2)',
83
+ borderRadius: '4px',
84
+ border: '1px solid var(--amber-6)',
85
+ }, children: [_jsxs(Text, { size: '1', color: 'amber', children: ["\u26A0\uFE0F Deprecated: ", documentation.deprecated.reason] }), documentation.deprecated.replacement && (_jsxs(Text, { size: '1', color: 'amber', children: ["Use ", documentation.deprecated.replacement, " instead."] }))] })), hasError && (_jsx(Box, { style: {
86
+ padding: '8px',
87
+ backgroundColor: 'var(--red-2)',
88
+ borderRadius: '4px',
89
+ border: '1px solid var(--red-6)',
90
+ }, children: _jsxs(Text, { size: '1', color: 'red', children: ["\u274C ", identifier.kind, " not found in schema"] }) })), _jsx(Box, { children: _jsxs(Text, { size: '1', color: 'gray', children: ["Path: ", identifier.schemaPath.join(' → ')] }) }), onNavigate && (_jsx(Box, { children: _jsx(Text, { size: '1', children: _jsx("a", { href: referenceUrl, onClick: (e) => {
91
+ e.preventDefault();
92
+ onNavigate();
93
+ onClose?.();
94
+ }, style: {
95
+ color: 'var(--accent-9)',
96
+ textDecoration: 'none',
97
+ borderBottom: '1px solid transparent',
98
+ transition: 'border-color 0.2s',
99
+ cursor: 'pointer',
100
+ }, onMouseEnter: (e) => {
101
+ e.currentTarget.style.borderBottomColor = 'var(--accent-9)';
102
+ }, onMouseLeave: (e) => {
103
+ e.currentTarget.style.borderBottomColor = 'transparent';
104
+ }, children: "View full documentation \u2192" }) }) }))] }) }) }));
105
+ };
106
+ /**
107
+ * Default styles for hover tooltips
108
+ */
109
+ export const hoverTooltipStyles = `
110
+ .graphql-hover-tooltip {
111
+ /* Tooltip animation */
112
+ animation: graphql-tooltip-fade-in 0.2s ease-out;
113
+ }
114
+
115
+ @keyframes graphql-tooltip-fade-in {
116
+ from {
117
+ opacity: 0;
118
+ transform: translateY(4px);
119
+ }
120
+ to {
121
+ opacity: 1;
122
+ transform: translateY(0);
123
+ }
124
+ }
125
+
126
+ /* Ensure tooltips appear above other content */
127
+ .graphql-hover-tooltip .rt-Card {
128
+ box-shadow: 0 10px 38px -10px rgba(22, 23, 24, 0.35),
129
+ 0 10px 20px -15px rgba(22, 23, 24, 0.2);
130
+ }
131
+ `;
132
+ //# sourceMappingURL=HoverTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HoverTooltip.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/HoverTooltip.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAyBnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EACxD,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,GACX,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC/C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;IAE3E,qDAAqD;IACrD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,OAAM;QAE/B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;QAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAA;QACvC,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAA;QAEzC,yCAAyC;QACzC,IAAI,GAAG,GAAG,QAAQ,CAAC,GAAG,GAAG,IAAI,C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AG,EAAC,KAAK,EAAC,KAAK,wBACrB,UAAU,CAAC,IAAI,4BACb,GACH,CACP,EAGD,KAAC,GAAG,cACF,MAAC,IAAI,IAAC,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,MAAM,uBAClB,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IACnC,GACH,EAGL,UAAU,IAAI,CACb,KAAC,GAAG,cACF,KAAC,IAAI,IAAC,IAAI,EAAC,GAAG,YACZ,YACE,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oCACb,CAAC,CAAC,cAAc,EAAE,CAAA;oCAClB,UAAU,EAAE,CAAA;oCACZ,OAAO,EAAE,EAAE,CAAA;gCACb,CAAC,EACD,KAAK,EAAE;oCACL,KAAK,EAAE,iBAAiB;oCACxB,cAAc,EAAE,MAAM;oCACtB,YAAY,EAAE,uBAAuB;oCACrC,UAAU,EAAE,mBAAmB;oCAC/B,MAAM,EAAE,SAAS;iCAClB,EACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;oCAClB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;gCAC7D,CAAC,EACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;oCAClB,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,GAAG,aAAa,CAAA;gCACzD,CAAC,+CAGC,GACC,GACH,CACP,IACI,GACF,GACH,CACP,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBjC,CAAA"}
@@ -0,0 +1,37 @@
1
+ import type { React } from '#dep/react/index';
2
+ import type { DOMPosition } from '../positioning-simple.ts';
3
+ import type { SchemaResolution } from '../schema-integration.ts';
4
+ import type { Identifier } from '../types.ts';
5
+ /**
6
+ * Props for the IdentifierLink component
7
+ */
8
+ export interface IdentifierLinkProps {
9
+ /** The GraphQL identifier */
10
+ identifier: Identifier;
11
+ /** Schema resolution information */
12
+ resolution: SchemaResolution;
13
+ /** DOM position for overlay placement */
14
+ position: DOMPosition;
15
+ /** Navigation handler */
16
+ onNavigate: (url: string) => void;
17
+ /** Whether to show debug visuals */
18
+ debug?: boolean;
19
+ /** Whether this tooltip is open */
20
+ isOpen?: boolean;
21
+ /** Toggle tooltip open state */
22
+ onToggle?: (open: boolean) => void;
23
+ }
24
+ /**
25
+ * Interactive overlay for a GraphQL identifier
26
+ *
27
+ * Renders an invisible clickable area over the identifier text
28
+ * with hover tooltips and navigation to schema reference pages.
29
+ */
30
+ export declare const IdentifierLink: React.FC<IdentifierLinkProps>;
31
+ /**
32
+ * Default styles for identifier overlays
33
+ *
34
+ * These can be included in the document or overridden by custom styles.
35
+ */
36
+ export declare const identifierLinkStyles = "\n.graphql-identifier-overlay {\n /* Base styles for all overlays */\n transition: background-color 0.2s ease;\n}\n\n.graphql-identifier-overlay.graphql-clickable:hover {\n /* Subtle highlight on hover for clickable identifiers */\n background-color: rgba(59, 130, 246, 0.05);\n}\n\n.graphql-identifier-overlay.graphql-error {\n /* Error indicator */\n border-bottom: 2px wavy red;\n}\n\n.graphql-identifier-overlay.graphql-deprecated {\n /* Deprecated indicator */\n text-decoration: line-through;\n opacity: 0.7;\n}\n\n.graphql-identifier-overlay.graphql-debug {\n /* Debug mode makes overlays visible */\n background-color: rgba(59, 130, 246, 0.1) !important;\n border: 1px solid rgba(59, 130, 246, 0.3) !important;\n}\n\n/* Kind-specific styles */\n.graphql-identifier-overlay.graphql-type {\n /* Type identifiers */\n}\n\n.graphql-identifier-overlay.graphql-field {\n /* Field identifiers */\n}\n\n.graphql-identifier-overlay.graphql-argument {\n /* Argument identifiers */\n font-style: italic;\n}\n\n.graphql-identifier-overlay.graphql-variable {\n /* Variable identifiers */\n color: var(--purple-11);\n}\n\n.graphql-identifier-overlay.graphql-directive {\n /* Directive identifiers */\n color: var(--amber-11);\n}\n";
37
+ //# sourceMappingURL=IdentifierLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdentifierLink.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/IdentifierLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG7C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,oCAAoC;IACpC,UAAU,EAAE,gBAAgB,CAAA;IAC5B,yCAAyC;IACzC,QAAQ,EAAE,WAAW,CAAA;IACrB,yBAAyB;IACzB,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAiIxD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,iuCAmDhC,CAAA"}
@@ -0,0 +1,141 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { HoverTooltip } from "./HoverTooltip.js";
4
+ /**
5
+ * Interactive overlay for a GraphQL identifier
6
+ *
7
+ * Renders an invisible clickable area over the identifier text
8
+ * with hover tooltips and navigation to schema reference pages.
9
+ */
10
+ export const IdentifierLink = ({ identifier, resolution, position, onNavigate, debug = false, isOpen = false, onToggle, }) => {
11
+ const [isHovered, setIsHovered] = useState(false);
12
+ // Use external state if provided, otherwise manage locally
13
+ const showTooltip = isOpen;
14
+ const setShowTooltip = (show) => {
15
+ onToggle?.(show);
16
+ };
17
+ // Determine visual state
18
+ const isClickable = resolution.exists;
19
+ const hasError = !resolution.exists && (identifier.kind === 'Type' || identifier.kind === 'Field');
20
+ const isDeprecated = !!resolution.deprecated;
21
+ // Build class names
22
+ const classNames = [
23
+ 'graphql-identifier-overlay',
24
+ `graphql-${identifier.kind.toLowerCase()}`,
25
+ isClickable && 'graphql-clickable',
26
+ hasError && 'graphql-error',
27
+ isDeprecated && 'graphql-deprecated',
28
+ isHovered && 'graphql-hovered',
29
+ showTooltip && 'graphql-tooltip-open',
30
+ debug && 'graphql-debug',
31
+ ].filter(Boolean).join(' ');
32
+ const handleClick = (e) => {
33
+ e.preventDefault();
34
+ e.stopPropagation();
35
+ // Toggle tooltip on click
36
+ setShowTooltip(!showTooltip);
37
+ };
38
+ const handleNavigate = (e) => {
39
+ e.preventDefault();
40
+ e.stopPropagation();
41
+ if (isClickable) {
42
+ onNavigate(resolution.referenceUrl);
43
+ }
44
+ };
45
+ return (_jsxs(_Fragment, { children: [isClickable
46
+ ? (_jsx("a", { href: resolution.referenceUrl, className: classNames + ' graphql-identifier-link', style: {
47
+ position: 'absolute',
48
+ top: position.top,
49
+ left: position.left,
50
+ width: position.width,
51
+ height: position.height,
52
+ cursor: 'pointer',
53
+ zIndex: 10,
54
+ pointerEvents: 'auto',
55
+ display: 'block',
56
+ textDecoration: 'none',
57
+ // Debug mode visual
58
+ ...(debug && {
59
+ backgroundColor: hasError ? 'rgba(239, 68, 68, 0.1)' : 'rgba(59, 130, 246, 0.1)',
60
+ border: `1px solid ${hasError ? 'rgba(239, 68, 68, 0.3)' : 'rgba(59, 130, 246, 0.3)'}`,
61
+ }),
62
+ }, onClick: handleClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-label": `${identifier.kind} ${identifier.name} - Click to view documentation`, "data-graphql-identifier": identifier.name, "data-graphql-kind": identifier.kind }))
63
+ : (_jsx("div", { className: classNames, style: {
64
+ position: 'absolute',
65
+ top: position.top,
66
+ left: position.left,
67
+ width: position.width,
68
+ height: position.height,
69
+ cursor: 'pointer', // Make it clickable even for errors
70
+ zIndex: 10,
71
+ pointerEvents: 'auto',
72
+ // Debug mode visual
73
+ ...(debug && {
74
+ backgroundColor: 'rgba(239, 68, 68, 0.1)',
75
+ border: `1px solid rgba(239, 68, 68, 0.3)`,
76
+ }),
77
+ }, onClick: handleClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), role: 'button', "aria-label": `${identifier.kind} ${identifier.name} - Click to view information`, "data-graphql-identifier": identifier.name, "data-graphql-kind": identifier.kind })), showTooltip && (_jsx(HoverTooltip, { identifier: identifier, documentation: resolution.documentation || {
78
+ description: hasError
79
+ ? `${identifier.kind} "${identifier.name}" not found in schema. This ${identifier.kind.toLowerCase()} does not exist in the current GraphQL schema.`
80
+ : `${identifier.kind}: ${identifier.name}`,
81
+ typeInfo: identifier.kind,
82
+ }, position: position, hasError: hasError, referenceUrl: resolution.referenceUrl, onClose: () => setShowTooltip(false), onNavigate: isClickable ? () => onNavigate(resolution.referenceUrl) : undefined }))] }));
83
+ };
84
+ /**
85
+ * Default styles for identifier overlays
86
+ *
87
+ * These can be included in the document or overridden by custom styles.
88
+ */
89
+ export const identifierLinkStyles = `
90
+ .graphql-identifier-overlay {
91
+ /* Base styles for all overlays */
92
+ transition: background-color 0.2s ease;
93
+ }
94
+
95
+ .graphql-identifier-overlay.graphql-clickable:hover {
96
+ /* Subtle highlight on hover for clickable identifiers */
97
+ background-color: rgba(59, 130, 246, 0.05);
98
+ }
99
+
100
+ .graphql-identifier-overlay.graphql-error {
101
+ /* Error indicator */
102
+ border-bottom: 2px wavy red;
103
+ }
104
+
105
+ .graphql-identifier-overlay.graphql-deprecated {
106
+ /* Deprecated indicator */
107
+ text-decoration: line-through;
108
+ opacity: 0.7;
109
+ }
110
+
111
+ .graphql-identifier-overlay.graphql-debug {
112
+ /* Debug mode makes overlays visible */
113
+ background-color: rgba(59, 130, 246, 0.1) !important;
114
+ border: 1px solid rgba(59, 130, 246, 0.3) !important;
115
+ }
116
+
117
+ /* Kind-specific styles */
118
+ .graphql-identifier-overlay.graphql-type {
119
+ /* Type identifiers */
120
+ }
121
+
122
+ .graphql-identifier-overlay.graphql-field {
123
+ /* Field identifiers */
124
+ }
125
+
126
+ .graphql-identifier-overlay.graphql-argument {
127
+ /* Argument identifiers */
128
+ font-style: italic;
129
+ }
130
+
131
+ .graphql-identifier-overlay.graphql-variable {
132
+ /* Variable identifiers */
133
+ color: var(--purple-11);
134
+ }
135
+
136
+ .graphql-identifier-overlay.graphql-directive {
137
+ /* Directive identifiers */
138
+ color: var(--amber-11);
139
+ }
140
+ `;
141
+ //# sourceMappingURL=IdentifierLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdentifierLink.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/IdentifierLink.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAA;AAsBjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC5D,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,KAAK,GAAG,KAAK,EACb,MAAM,GAAG,KAAK,EACd,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEjD,2DAA2D;IAC3D,MAAM,WAAW,GAAG,MAAM,CAAA;IAC1B,MAAM,cAAc,GAAG,CAAC,IAAa,EAAE,EAAE;QACvC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CA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,EACpB,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EACtC,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EACvC,IAAI,EAAC,QAAQ,gBACD,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,8BAA8B,6BACtD,UAAU,CAAC,IAAI,uBACrB,UAAU,CAAC,IAAI,GAClC,CACH,EAGF,WAAW,IAAI,CACd,KAAC,YAAY,IACX,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI;oBACzC,WAAW,EAAE,QAAQ;wBACnB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,+BAA+B,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,gDAAgD;wBACpJ,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;oBAC5C,QAAQ,EAAE,UAAU,CAAC,IAAI;iBAC1B,EACD,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,UAAU,CAAC,YAAY,EACrC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EACpC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,GAC/E,CACH,IACA,CACJ,CAAA;AACH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDnC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './GraphQLDocument.tsx';
2
+ export * from './GraphQLDocumentWithSchema.tsx';
3
+ export * from './HoverTooltip.tsx';
4
+ export * from './IdentifierLink.tsx';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from "./GraphQLDocument.js";
2
+ export * from "./GraphQLDocumentWithSchema.js";
3
+ export * from "./HoverTooltip.js";
4
+ export * from "./IdentifierLink.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAuB,CAAA;AACrC,cAAc,gCAAiC,CAAA;AAC/C,cAAc,mBAAoB,CAAA;AAClC,cAAc,qBAAsB,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Example usage of the GraphQL Document Analysis library
3
+ *
4
+ * This demonstrates how to use the foundational layer for extracting
5
+ * identifiers and context from GraphQL documents - the building block
6
+ * for the interactive GraphQL Document Component.
7
+ */
8
+ import { GraphQLDocument } from './$.ts';
9
+ /**
10
+ * Demonstrate basic analysis
11
+ */
12
+ export declare const analyzeExample: () => GraphQLDocument.AnalysisResult;
13
+ /**
14
+ * Demonstrate identifier lookup by position
15
+ */
16
+ export declare const demonstratePositionLookup: () => void;
17
+ /**
18
+ * Demonstrate how this enables hyperlink generation
19
+ */
20
+ export declare const demonstrateHyperlinkGeneration: () => void;
21
+ /**
22
+ * Show the foundation for hover tooltips
23
+ */
24
+ export declare const demonstrateTooltipFoundation: () => void;
25
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/example.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AA2BxC;;GAEG;AACH,eAAO,MAAM,cAAc,sCAsB1B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,YA2BrC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,YAsB1C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,YAiBxC,CAAA"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Example usage of the GraphQL Document Analysis library
3
+ *
4
+ * This demonstrates how to use the foundational layer for extracting
5
+ * identifiers and context from GraphQL documents - the building block
6
+ * for the interactive GraphQL Document Component.
7
+ */
8
+ import { GraphQLDocument } from "./$.js";
9
+ // Example GraphQL query with various constructs
10
+ const exampleQuery = `
11
+ query GetPokemonWithAbilities($id: ID!, $limit: Int = 10) {
12
+ pokemon(id: $id) {
13
+ name
14
+ abilities(first: $limit) {
15
+ name
16
+ isHidden
17
+ pokemon {
18
+ name
19
+ }
20
+ }
21
+ ... on ElectricPokemon {
22
+ voltage
23
+ }
24
+ }
25
+ }
26
+
27
+ fragment PokemonBasics on Pokemon {
28
+ name
29
+ type
30
+ level
31
+ }
32
+ `;
33
+ /**
34
+ * Demonstrate basic analysis
35
+ */
36
+ export const analyzeExample = () => {
37
+ console.log('šŸ” Analyzing GraphQL Document...\n');
38
+ const result = GraphQLDocument.analyze(exampleQuery);
39
+ console.log(`āœ… Valid: ${result.isValid}`);
40
+ console.log(`šŸ“Š Total identifiers: ${result.identifiers.all.length}`);
41
+ console.log(`🚨 Errors: ${result.errors.length}\n`);
42
+ // Show identifiers by kind
43
+ for (const [kind, identifiers] of result.identifiers.byKind) {
44
+ console.log(`${getKindEmoji(kind)} ${kind} (${identifiers.length}):`);
45
+ for (const identifier of identifiers) {
46
+ const pos = `${identifier.position.line}:${identifier.position.column}`;
47
+ const path = identifier.schemaPath.join(' → ');
48
+ const parent = identifier.parentType ? ` (in ${identifier.parentType})` : '';
49
+ console.log(` • ${identifier.name}${parent} → ${path} @ ${pos}`);
50
+ }
51
+ console.log();
52
+ }
53
+ return result;
54
+ };
55
+ /**
56
+ * Demonstrate identifier lookup by position
57
+ */
58
+ export const demonstratePositionLookup = () => {
59
+ console.log('šŸ“ Position-based Identifier Lookup...\n');
60
+ const identifiers = GraphQLDocument.extractIdentifiers(exampleQuery);
61
+ // Find identifier at a specific position (e.g., cursor position in an editor)
62
+ const targetPosition = 180; // Approximate position of "abilities" field
63
+ // Find the closest identifier to this position
64
+ let closestIdentifier = null;
65
+ let closestDistance = Infinity;
66
+ for (const identifier of identifiers.all) {
67
+ const distance = Math.abs(identifier.position.start - targetPosition);
68
+ if (distance < closestDistance) {
69
+ closestDistance = distance;
70
+ closestIdentifier = identifier;
71
+ }
72
+ }
73
+ if (closestIdentifier) {
74
+ console.log(`šŸŽÆ Identifier near position ${targetPosition}:`);
75
+ console.log(` Name: ${closestIdentifier.name}`);
76
+ console.log(` Kind: ${closestIdentifier.kind}`);
77
+ console.log(` Schema Path: ${closestIdentifier.schemaPath.join(' → ')}`);
78
+ console.log(` Context: ${JSON.stringify(closestIdentifier.context, null, 2)}`);
79
+ }
80
+ };
81
+ /**
82
+ * Demonstrate how this enables hyperlink generation
83
+ */
84
+ export const demonstrateHyperlinkGeneration = () => {
85
+ console.log('šŸ”— Hyperlink Generation Preview...\n');
86
+ const identifiers = GraphQLDocument.extractIdentifiers(exampleQuery);
87
+ // Show how each identifier could become a hyperlink
88
+ const typeIdentifiers = identifiers.byKind.get('Type') || [];
89
+ const fieldIdentifiers = identifiers.byKind.get('Field') || [];
90
+ console.log('šŸ“ Type References → Schema Links:');
91
+ for (const identifier of typeIdentifiers) {
92
+ const referenceUrl = `/reference/${identifier.name}`;
93
+ console.log(` ${identifier.name} → ${referenceUrl}`);
94
+ }
95
+ console.log('\nšŸ“ Field References → Schema Links:');
96
+ for (const identifier of fieldIdentifiers.slice(0, 5)) { // Show first 5
97
+ const referenceUrl = identifier.parentType
98
+ ? `/reference/${identifier.parentType}#${identifier.name}`
99
+ : `/reference/${identifier.name}`;
100
+ console.log(` ${identifier.name} → ${referenceUrl}`);
101
+ }
102
+ };
103
+ /**
104
+ * Show the foundation for hover tooltips
105
+ */
106
+ export const demonstrateTooltipFoundation = () => {
107
+ console.log('šŸ’¬ Tooltip Foundation...\n');
108
+ const identifiers = GraphQLDocument.extractIdentifiers(exampleQuery);
109
+ // Show context information that would be displayed in tooltips
110
+ const fieldIdentifiers = identifiers.byKind.get('Field') || [];
111
+ for (const identifier of fieldIdentifiers.slice(0, 3)) { // Show first 3
112
+ console.log(`šŸ·ļø ${identifier.name}:`);
113
+ console.log(` Position: Line ${identifier.position.line}, Column ${identifier.position.column}`);
114
+ console.log(` Schema Path: ${identifier.schemaPath.join(' → ')}`);
115
+ console.log(` Parent Type: ${identifier.parentType || 'Root'}`);
116
+ console.log(` Operation: ${identifier.context.operationType || 'None'}`);
117
+ console.log(` Selection Path: ${identifier.context.selectionPath.join(' → ')}`);
118
+ console.log();
119
+ }
120
+ };
121
+ // Helper function
122
+ function getKindEmoji(kind) {
123
+ const emojis = {
124
+ 'Type': 'šŸ·ļø',
125
+ 'Field': 'šŸ“‹',
126
+ 'Argument': 'āš™ļø',
127
+ 'Variable': 'šŸ’°',
128
+ 'Directive': 'šŸŽÆ',
129
+ 'Fragment': '🧩',
130
+ };
131
+ return emojis[kind] || 'ā“';
132
+ }
133
+ // Run example if executed directly
134
+ if (import.meta.url === `file://${process.argv[1]}`) {
135
+ analyzeExample();
136
+ demonstratePositionLookup();
137
+ demonstrateHyperlinkGeneration();
138
+ demonstrateTooltipFoundation();
139
+ }
140
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","sourceRoot":"","sources":["../../../src/lib/graphql-document/example.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAExC,gDAAgD;AAChD,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBpB,CAAA;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