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.
Files changed (314) hide show
  1. package/build/api/api.d.ts +1 -0
  2. package/build/api/api.d.ts.map +1 -1
  3. package/build/api/api.js +1 -0
  4. package/build/api/api.js.map +1 -1
  5. package/build/api/config/configurator.d.ts +20 -3
  6. package/build/api/config/configurator.d.ts.map +1 -1
  7. package/build/api/config/configurator.js +27 -3
  8. package/build/api/config/configurator.js.map +1 -1
  9. package/build/api/schema/data-sources/memory/memory.d.ts +2 -2
  10. package/build/api/schema/data-sources/memory/memory.d.ts.map +1 -1
  11. package/build/api/schema/data-sources/memory/memory.js +1 -3
  12. package/build/api/schema/data-sources/memory/memory.js.map +1 -1
  13. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts +7 -3
  14. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts.map +1 -1
  15. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js +15 -11
  16. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js.map +1 -1
  17. package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts +16 -7
  18. package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
  19. package/build/api/schema/data-sources/schema-directory/schema-directory.js +26 -7
  20. package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
  21. package/build/api/schema/data-sources/schema-file/schema-file.d.ts +7 -2
  22. package/build/api/schema/data-sources/schema-file/schema-file.d.ts.map +1 -1
  23. package/build/api/schema/data-sources/schema-file/schema-file.js +13 -5
  24. package/build/api/schema/data-sources/schema-file/schema-file.js.map +1 -1
  25. package/build/api/schema/metadata.d.ts +8 -0
  26. package/build/api/schema/metadata.d.ts.map +1 -0
  27. package/build/api/schema/metadata.js +19 -0
  28. package/build/api/schema/metadata.js.map +1 -0
  29. package/build/api/schema/read.d.ts +3 -3
  30. package/build/api/schema/read.d.ts.map +1 -1
  31. package/build/api/schema/read.js.map +1 -1
  32. package/build/api/schema/schema.d.ts +33 -2
  33. package/build/api/schema/schema.d.ts.map +1 -1
  34. package/build/api/schema/schema.js +42 -0
  35. package/build/api/schema/schema.js.map +1 -1
  36. package/build/api/schema-source/index.d.ts +2 -0
  37. package/build/api/schema-source/index.d.ts.map +1 -0
  38. package/build/api/schema-source/index.js +2 -0
  39. package/build/api/schema-source/index.js.map +1 -0
  40. package/build/api/schema-source/schema-source.d.ts +33 -0
  41. package/build/api/schema-source/schema-source.d.ts.map +1 -0
  42. package/build/api/schema-source/schema-source.js +137 -0
  43. package/build/api/schema-source/schema-source.js.map +1 -0
  44. package/build/api/vite/plugins/core.d.ts +1 -0
  45. package/build/api/vite/plugins/core.d.ts.map +1 -1
  46. package/build/api/vite/plugins/core.js +21 -18
  47. package/build/api/vite/plugins/core.js.map +1 -1
  48. package/build/api/vite/plugins/schema-assets.d.ts +22 -0
  49. package/build/api/vite/plugins/schema-assets.d.ts.map +1 -0
  50. package/build/api/vite/plugins/schema-assets.js +269 -0
  51. package/build/api/vite/plugins/schema-assets.js.map +1 -0
  52. package/build/api/vite/plugins/serve.d.ts.map +1 -1
  53. package/build/api/vite/plugins/serve.js +11 -0
  54. package/build/api/vite/plugins/serve.js.map +1 -1
  55. package/build/lib/graphql-change/change-groups.d.ts +2 -0
  56. package/build/lib/graphql-change/change-groups.d.ts.map +1 -1
  57. package/build/lib/graphql-change/change-groups.js +54 -0
  58. package/build/lib/graphql-change/change-groups.js.map +1 -1
  59. package/build/lib/kit-temp.d.ts +9 -0
  60. package/build/lib/kit-temp.d.ts.map +1 -1
  61. package/build/lib/kit-temp.js +12 -0
  62. package/build/lib/kit-temp.js.map +1 -1
  63. package/build/lib/path-map/path-map.d.ts.map +1 -1
  64. package/build/lib/path-map/path-map.js +3 -1
  65. package/build/lib/path-map/path-map.js.map +1 -1
  66. package/build/project-data.d.ts +3 -11
  67. package/build/project-data.d.ts.map +1 -1
  68. package/build/template/components/Changelog.d.ts +3 -3
  69. package/build/template/components/Changelog.d.ts.map +1 -1
  70. package/build/template/components/Changelog.js +8 -84
  71. package/build/template/components/Changelog.js.map +1 -1
  72. package/build/template/components/CodeBlock.d.ts +2 -0
  73. package/build/template/components/CodeBlock.d.ts.map +1 -1
  74. package/build/template/components/CodeBlock.js +1 -4
  75. package/build/template/components/CodeBlock.js.map +1 -1
  76. package/build/template/components/ComponentDispatch.d.ts +34 -0
  77. package/build/template/components/ComponentDispatch.d.ts.map +1 -0
  78. package/build/template/components/ComponentDispatch.js +33 -0
  79. package/build/template/components/ComponentDispatch.js.map +1 -0
  80. package/build/template/components/ReferenceLink.d.ts +19 -0
  81. package/build/template/components/ReferenceLink.d.ts.map +1 -0
  82. package/build/template/components/ReferenceLink.js +19 -0
  83. package/build/template/components/ReferenceLink.js.map +1 -0
  84. package/build/template/components/TypeAnnotation.d.ts.map +1 -1
  85. package/build/template/components/TypeAnnotation.js +3 -3
  86. package/build/template/components/TypeAnnotation.js.map +1 -1
  87. package/build/template/components/TypeFieldsLinkList.d.ts.map +1 -1
  88. package/build/template/components/TypeFieldsLinkList.js +4 -4
  89. package/build/template/components/TypeFieldsLinkList.js.map +1 -1
  90. package/build/template/components/TypeIndex.js +2 -2
  91. package/build/template/components/TypeIndex.js.map +1 -1
  92. package/build/template/components/VersionSelector.d.ts +7 -0
  93. package/build/template/components/VersionSelector.d.ts.map +1 -0
  94. package/build/template/components/VersionSelector.js +30 -0
  95. package/build/template/components/VersionSelector.js.map +1 -0
  96. package/build/template/components/graphql/type-link.d.ts.map +1 -1
  97. package/build/template/components/graphql/type-link.js +2 -2
  98. package/build/template/components/graphql/type-link.js.map +1 -1
  99. package/build/template/hooks/useVersionPath.d.ts +6 -0
  100. package/build/template/hooks/useVersionPath.d.ts.map +1 -0
  101. package/build/template/hooks/useVersionPath.js +10 -0
  102. package/build/template/hooks/useVersionPath.js.map +1 -0
  103. package/build/template/layouts/ChangelogLayout.d.ts.map +1 -0
  104. package/build/template/{components → layouts}/ChangelogLayout.js +1 -1
  105. package/build/template/layouts/ChangelogLayout.js.map +1 -0
  106. package/build/template/layouts/index.d.ts +1 -0
  107. package/build/template/layouts/index.d.ts.map +1 -1
  108. package/build/template/layouts/index.js +1 -0
  109. package/build/template/layouts/index.js.map +1 -1
  110. package/build/template/lib/fetch-text.d.ts +8 -0
  111. package/build/template/lib/fetch-text.d.ts.map +1 -0
  112. package/build/template/lib/fetch-text.js +14 -0
  113. package/build/template/lib/fetch-text.js.map +1 -0
  114. package/build/template/lib/polen-url.d.ts +14 -0
  115. package/build/template/lib/polen-url.d.ts.map +1 -1
  116. package/build/template/lib/polen-url.js +16 -0
  117. package/build/template/lib/polen-url.js.map +1 -1
  118. package/build/template/lib/schema-utils/constants.d.ts +5 -0
  119. package/build/template/lib/schema-utils/constants.d.ts.map +1 -0
  120. package/build/template/lib/schema-utils/constants.js +5 -0
  121. package/build/template/lib/schema-utils/constants.js.map +1 -0
  122. package/build/template/lib/schema-utils/schema-utils.d.ts +15 -0
  123. package/build/template/lib/schema-utils/schema-utils.d.ts.map +1 -0
  124. package/build/template/lib/schema-utils/schema-utils.js +37 -0
  125. package/build/template/lib/schema-utils/schema-utils.js.map +1 -0
  126. package/build/template/routes/changelog.d.ts +4 -3
  127. package/build/template/routes/changelog.d.ts.map +1 -1
  128. package/build/template/routes/changelog.js +13 -7
  129. package/build/template/routes/changelog.js.map +1 -1
  130. package/build/template/routes/pages.d.ts +10 -0
  131. package/build/template/routes/pages.d.ts.map +1 -0
  132. package/build/template/routes/pages.js +76 -0
  133. package/build/template/routes/pages.js.map +1 -0
  134. package/build/template/routes/reference.$type.$field.js +1 -1
  135. package/build/template/routes/reference.$type.$field.js.map +1 -1
  136. package/build/template/routes/reference.$type.d.ts +4 -0
  137. package/build/template/routes/reference.$type.d.ts.map +1 -1
  138. package/build/template/routes/reference.$type.js +2 -0
  139. package/build/template/routes/reference.$type.js.map +1 -1
  140. package/build/template/routes/reference.d.ts +9 -3
  141. package/build/template/routes/reference.d.ts.map +1 -1
  142. package/build/template/routes/reference.js +30 -8
  143. package/build/template/routes/reference.js.map +1 -1
  144. package/build/template/routes/reference.version.$version.$type.$field.d.ts +6 -0
  145. package/build/template/routes/reference.version.$version.$type.$field.d.ts.map +1 -0
  146. package/build/template/routes/reference.version.$version.$type.$field.js +32 -0
  147. package/build/template/routes/reference.version.$version.$type.$field.js.map +1 -0
  148. package/build/template/routes/reference.version.$version.$type.d.ts +11 -0
  149. package/build/template/routes/reference.version.$version.$type.d.ts.map +1 -0
  150. package/build/template/routes/reference.version.$version.$type.js +26 -0
  151. package/build/template/routes/reference.version.$version.$type.js.map +1 -0
  152. package/build/template/routes/root.d.ts.map +1 -1
  153. package/build/template/routes/root.js +8 -72
  154. package/build/template/routes/root.js.map +1 -1
  155. package/build/template/server/app.d.ts +22 -1
  156. package/build/template/server/app.d.ts.map +1 -1
  157. package/build/template/server/app.js +19 -9
  158. package/build/template/server/app.js.map +1 -1
  159. package/build/template/server/main.js +9 -1
  160. package/build/template/server/main.js.map +1 -1
  161. package/build/template/server/ssg/generate.js +2 -2
  162. package/build/template/server/ssg/generate.js.map +1 -1
  163. package/build/template/server/ssg/get-route-paths.d.ts +1 -1
  164. package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
  165. package/build/template/server/ssg/get-route-paths.js +51 -27
  166. package/build/template/server/ssg/get-route-paths.js.map +1 -1
  167. package/build/template/sources/schema-source.d.ts +15 -0
  168. package/build/template/sources/schema-source.d.ts.map +1 -0
  169. package/build/template/sources/schema-source.js +63 -0
  170. package/build/template/sources/schema-source.js.map +1 -0
  171. package/package.json +1 -1
  172. package/src/api/api.ts +1 -0
  173. package/src/api/config/configurator.ts +51 -6
  174. package/src/api/schema/data-sources/memory/memory.ts +3 -5
  175. package/src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts +29 -13
  176. package/src/api/schema/data-sources/schema-directory/schema-directory.ts +56 -16
  177. package/src/api/schema/data-sources/schema-file/schema-file.ts +16 -7
  178. package/src/api/schema/metadata.ts +23 -0
  179. package/src/api/schema/read.ts +3 -3
  180. package/src/api/schema/schema.ts +62 -2
  181. package/src/api/schema-source/index.ts +1 -0
  182. package/src/api/schema-source/schema-source.ts +189 -0
  183. package/src/api/vite/plugins/core.ts +23 -18
  184. package/src/api/vite/plugins/schema-assets.ts +317 -0
  185. package/src/api/vite/plugins/serve.ts +15 -8
  186. package/src/lib/graphql-change/change-groups.ts +57 -0
  187. package/src/lib/kit-temp.ts +13 -0
  188. package/src/lib/path-map/$.test.ts +22 -19
  189. package/src/lib/path-map/path-map.ts +3 -1
  190. package/src/project-data.ts +3 -11
  191. package/src/template/components/Changelog.tsx +16 -67
  192. package/src/template/components/CodeBlock.tsx +3 -5
  193. package/src/template/components/ComponentDispatch.tsx +42 -0
  194. package/src/template/components/ReferenceLink.tsx +34 -0
  195. package/src/template/components/TypeAnnotation.tsx +5 -7
  196. package/src/template/components/TypeFieldsLinkList.tsx +20 -23
  197. package/src/template/components/TypeIndex.tsx +10 -12
  198. package/src/template/components/VersionSelector.tsx +50 -0
  199. package/src/template/components/graphql/type-link.tsx +4 -3
  200. package/src/template/hooks/useVersionPath.ts +10 -0
  201. package/src/template/{components → layouts}/ChangelogLayout.tsx +1 -1
  202. package/src/template/layouts/index.ts +1 -0
  203. package/src/template/lib/fetch-text.ts +13 -0
  204. package/src/template/lib/polen-url.ts +20 -0
  205. package/src/template/lib/schema-utils/constants.ts +4 -0
  206. package/src/template/lib/schema-utils/schema-utils.ts +42 -0
  207. package/src/template/routes/changelog.tsx +17 -8
  208. package/src/template/routes/pages.tsx +109 -0
  209. package/src/template/routes/reference.$type.$field.tsx +1 -1
  210. package/src/template/routes/reference.$type.tsx +2 -0
  211. package/src/template/routes/reference.tsx +38 -6
  212. package/src/template/routes/reference.version.$version.$type.$field.tsx +35 -0
  213. package/src/template/routes/reference.version.$version.$type.tsx +30 -0
  214. package/src/template/routes/root.tsx +8 -109
  215. package/src/template/server/app.ts +47 -14
  216. package/src/template/server/main.ts +9 -1
  217. package/src/template/server/ssg/generate.ts +2 -2
  218. package/src/template/server/ssg/get-route-paths.ts +53 -27
  219. package/src/template/sources/schema-source.ts +68 -0
  220. package/build/lib/graphql-document/$$.d.ts +0 -5
  221. package/build/lib/graphql-document/$$.d.ts.map +0 -1
  222. package/build/lib/graphql-document/$$.js +0 -5
  223. package/build/lib/graphql-document/$$.js.map +0 -1
  224. package/build/lib/graphql-document/$.d.ts +0 -2
  225. package/build/lib/graphql-document/$.d.ts.map +0 -1
  226. package/build/lib/graphql-document/$.js +0 -2
  227. package/build/lib/graphql-document/$.js.map +0 -1
  228. package/build/lib/graphql-document/analysis.d.ts +0 -44
  229. package/build/lib/graphql-document/analysis.d.ts.map +0 -1
  230. package/build/lib/graphql-document/analysis.js +0 -361
  231. package/build/lib/graphql-document/analysis.js.map +0 -1
  232. package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -38
  233. package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +0 -1
  234. package/build/lib/graphql-document/components/GraphQLDocument.js +0 -151
  235. package/build/lib/graphql-document/components/GraphQLDocument.js.map +0 -1
  236. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +0 -7
  237. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +0 -1
  238. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +0 -27
  239. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +0 -1
  240. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +0 -33
  241. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +0 -1
  242. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +0 -50
  243. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +0 -1
  244. package/build/lib/graphql-document/components/IdentifierLink.d.ts +0 -39
  245. package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +0 -1
  246. package/build/lib/graphql-document/components/IdentifierLink.js +0 -75
  247. package/build/lib/graphql-document/components/IdentifierLink.js.map +0 -1
  248. package/build/lib/graphql-document/components/graphql-document-styles.d.ts +0 -5
  249. package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +0 -1
  250. package/build/lib/graphql-document/components/graphql-document-styles.js +0 -144
  251. package/build/lib/graphql-document/components/graphql-document-styles.js.map +0 -1
  252. package/build/lib/graphql-document/components/index.d.ts +0 -5
  253. package/build/lib/graphql-document/components/index.d.ts.map +0 -1
  254. package/build/lib/graphql-document/components/index.js +0 -5
  255. package/build/lib/graphql-document/components/index.js.map +0 -1
  256. package/build/lib/graphql-document/example.d.ts +0 -25
  257. package/build/lib/graphql-document/example.d.ts.map +0 -1
  258. package/build/lib/graphql-document/example.js +0 -140
  259. package/build/lib/graphql-document/example.js.map +0 -1
  260. package/build/lib/graphql-document/graphql-document.d.ts +0 -35
  261. package/build/lib/graphql-document/graphql-document.d.ts.map +0 -1
  262. package/build/lib/graphql-document/graphql-document.js +0 -36
  263. package/build/lib/graphql-document/graphql-document.js.map +0 -1
  264. package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +0 -43
  265. package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +0 -1
  266. package/build/lib/graphql-document/hooks/use-tooltip-state.js +0 -132
  267. package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +0 -1
  268. package/build/lib/graphql-document/positioning-simple.d.ts +0 -63
  269. package/build/lib/graphql-document/positioning-simple.d.ts.map +0 -1
  270. package/build/lib/graphql-document/positioning-simple.js +0 -185
  271. package/build/lib/graphql-document/positioning-simple.js.map +0 -1
  272. package/build/lib/graphql-document/schema-context.d.ts +0 -8
  273. package/build/lib/graphql-document/schema-context.d.ts.map +0 -1
  274. package/build/lib/graphql-document/schema-context.js +0 -11
  275. package/build/lib/graphql-document/schema-context.js.map +0 -1
  276. package/build/lib/graphql-document/schema-integration.d.ts +0 -135
  277. package/build/lib/graphql-document/schema-integration.d.ts.map +0 -1
  278. package/build/lib/graphql-document/schema-integration.js +0 -328
  279. package/build/lib/graphql-document/schema-integration.js.map +0 -1
  280. package/build/lib/graphql-document/types.d.ts +0 -117
  281. package/build/lib/graphql-document/types.d.ts.map +0 -1
  282. package/build/lib/graphql-document/types.js +0 -2
  283. package/build/lib/graphql-document/types.js.map +0 -1
  284. package/build/template/components/ChangelogLayout.d.ts.map +0 -1
  285. package/build/template/components/ChangelogLayout.js.map +0 -1
  286. package/build/template/components/CodeHikePre.d.ts +0 -16
  287. package/build/template/components/CodeHikePre.d.ts.map +0 -1
  288. package/build/template/components/CodeHikePre.js +0 -37
  289. package/build/template/components/CodeHikePre.js.map +0 -1
  290. package/src/lib/graphql-document/$$.ts +0 -4
  291. package/src/lib/graphql-document/$.test.ts +0 -132
  292. package/src/lib/graphql-document/$.ts +0 -1
  293. package/src/lib/graphql-document/README.md +0 -102
  294. package/src/lib/graphql-document/analysis.ts +0 -415
  295. package/src/lib/graphql-document/components/GraphQLDocument.tsx +0 -265
  296. package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +0 -188
  297. package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +0 -46
  298. package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +0 -199
  299. package/src/lib/graphql-document/components/IdentifierLink.tsx +0 -160
  300. package/src/lib/graphql-document/components/graphql-document-styles.ts +0 -144
  301. package/src/lib/graphql-document/components/index.ts +0 -4
  302. package/src/lib/graphql-document/demo.md +0 -155
  303. package/src/lib/graphql-document/example.ts +0 -163
  304. package/src/lib/graphql-document/graphql-document.ts +0 -37
  305. package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +0 -76
  306. package/src/lib/graphql-document/hooks/use-tooltip-state.ts +0 -191
  307. package/src/lib/graphql-document/positioning-simple.test.ts +0 -248
  308. package/src/lib/graphql-document/positioning-simple.ts +0 -260
  309. package/src/lib/graphql-document/schema-context.tsx +0 -20
  310. package/src/lib/graphql-document/schema-integration.test.ts +0 -365
  311. package/src/lib/graphql-document/schema-integration.ts +0 -488
  312. package/src/lib/graphql-document/types.ts +0 -129
  313. package/src/template/components/CodeHikePre.tsx +0 -51
  314. /package/build/template/{components → layouts}/ChangelogLayout.d.ts +0 -0
@@ -1,3 +1,4 @@
1
+ import { neverCase } from '@wollybeard/kit/language'
1
2
  import type {
2
3
  Change,
3
4
  DirectiveAddedChange,
@@ -248,3 +249,59 @@ export type DirectiveUsage =
248
249
  | DirectiveUsageInputFieldDefinitionRemovedChange
249
250
 
250
251
  export const isDirectiveUsage = (change: Change): change is DirectiveUsage => change.type.startsWith(`DIRECTIVE_USAGE_`)
252
+
253
+ export type Type =
254
+ | 'TypeOperation'
255
+ | 'TypeDescription'
256
+ | 'FieldOperation'
257
+ | 'FieldDescription'
258
+ | 'FieldDeprecation'
259
+ | 'FieldDeprecationReason'
260
+ | 'FieldArgumentOperation'
261
+ | 'FieldArgument'
262
+ | 'FieldArgumentDescription'
263
+ | 'EnumValueOperation'
264
+ | 'EnumValueDescription'
265
+ | 'EnumValueDeprecationReason'
266
+ | 'InputFieldOperation'
267
+ | 'InputFieldDescription'
268
+ | 'InputFieldDefaultValue'
269
+ | 'UnionMemberOperation'
270
+ | 'ObjectTypeInterfaceOperation'
271
+ | 'DirectiveOperation'
272
+ | 'DirectiveDescription'
273
+ | 'DirectiveLocationOperation'
274
+ | 'DirectiveArgumentOperation'
275
+ | 'DirectiveArgument'
276
+ | 'DirectiveArgumentDescription'
277
+ | 'SchemaRootType'
278
+ | 'DirectiveUsage'
279
+
280
+ export const getType = (change: Change): Type => {
281
+ if (isTypeOperation(change)) return 'TypeOperation'
282
+ if (isTypeDescription(change)) return 'TypeDescription'
283
+ if (isFieldOperation(change)) return 'FieldOperation'
284
+ if (isFieldDescription(change)) return 'FieldDescription'
285
+ if (isFieldDeprecation(change)) return 'FieldDeprecation'
286
+ if (isFieldDeprecationReason(change)) return 'FieldDeprecationReason'
287
+ if (isFieldArgumentOperation(change)) return 'FieldArgumentOperation'
288
+ if (isFieldArgument(change)) return 'FieldArgument'
289
+ if (isFieldArgumentDescription(change)) return 'FieldArgumentDescription'
290
+ if (isEnumValueOperation(change)) return 'EnumValueOperation'
291
+ if (isEnumValueDescription(change)) return 'EnumValueDescription'
292
+ if (isEnumValueDeprecationReason(change)) return 'EnumValueDeprecationReason'
293
+ if (isInputFieldOperation(change)) return 'InputFieldOperation'
294
+ if (isInputFieldDescription(change)) return 'InputFieldDescription'
295
+ if (isInputFieldDefaultValue(change)) return 'InputFieldDefaultValue'
296
+ if (isUnionMemberOperation(change)) return 'UnionMemberOperation'
297
+ if (isObjectTypeInterfaceOperation(change)) return 'ObjectTypeInterfaceOperation'
298
+ if (isDirectiveOperation(change)) return 'DirectiveOperation'
299
+ if (isDirectiveDescription(change)) return 'DirectiveDescription'
300
+ if (isDirectiveLocationOperation(change)) return 'DirectiveLocationOperation'
301
+ if (isDirectiveArgumentOperation(change)) return 'DirectiveArgumentOperation'
302
+ if (isDirectiveArgument(change)) return 'DirectiveArgument'
303
+ if (isDirectiveArgumentDescription(change)) return 'DirectiveArgumentDescription'
304
+ if (isSchemaRootType(change)) return 'SchemaRootType'
305
+ if (isDirectiveUsage(change)) return 'DirectiveUsage'
306
+ neverCase(change)
307
+ }
@@ -181,6 +181,19 @@ export const ensureEnd = (string: string, ending: string) => {
181
181
  return string + ending
182
182
  }
183
183
 
184
+ /**
185
+ * Create a generic cache with clear interface
186
+ */
187
+ export const createCache = <T>() => {
188
+ const cache = new Map<string, T>()
189
+ return {
190
+ has: (key: string) => cache.has(key),
191
+ get: (key: string) => cache.get(key),
192
+ set: (key: string, value: T) => cache.set(key, value),
193
+ clear: () => cache.clear(),
194
+ }
195
+ }
196
+
184
197
  export const ResponseInternalServerError = () =>
185
198
  new Response(null, {
186
199
  status: Http.Status.InternalServerError.code,
@@ -197,6 +197,22 @@ describe('PathMap', () => {
197
197
  })
198
198
 
199
199
  describe('property tests', () => {
200
+ // Helper to normalize base paths the same way PathMap.create does
201
+ const normalizeBasePath = (base: string): string => {
202
+ const trimmedBase = base.trim()
203
+ const collapsedBase = trimmedBase.replace(/\/+/g, '/')
204
+ const cleanedBase = collapsedBase === '/.' ? '/' : collapsedBase
205
+ return cleanedBase === '/' ? '/' : cleanedBase.replace(/\/$/, '')
206
+ }
207
+
208
+ // Helper to build absolute paths with proper handling of root base
209
+ const buildAbsolutePath = (normalizedBase: string, segments: string[]): string => {
210
+ if (segments.length === 0) return normalizedBase
211
+ return normalizedBase === '/'
212
+ ? `/${segments.join('/')}`
213
+ : `${normalizedBase}/${segments.join('/')}`
214
+ }
215
+
200
216
  // Arbitrary for valid path segments
201
217
  const pathSegment = fc.stringMatching(/^[a-zA-Z0-9_-]+$/)
202
218
 
@@ -243,10 +259,7 @@ describe('PathMap', () => {
243
259
  fc.assert(
244
260
  fc.property(pathInput, fc.string({ minLength: 1 }).filter(s => s.startsWith('/')), (input, base) => {
245
261
  const paths = PathMap.create(input, base)
246
-
247
- // Base is normalized (trimmed, multiple slashes collapsed, trailing removed)
248
- const collapsedBase = base.trim().replace(/\/+/g, '/')
249
- const normalizedBase = collapsedBase === '/' ? '/' : collapsedBase.replace(/\/$/, '')
262
+ const normalizedBase = normalizeBasePath(base)
250
263
 
251
264
  function checkAbsolute(obj: any) {
252
265
  for (const [key, value] of Object.entries(obj)) {
@@ -278,14 +291,11 @@ describe('PathMap', () => {
278
291
  expect(JSON.stringify(p1.rooted)).toBe(JSON.stringify(p2.rooted))
279
292
 
280
293
  // Only absolute paths and base should change
281
- const collapsedBase2 = base2.trim().replace(/\/+/g, '/')
282
- const normalizedBase2 = collapsedBase2 === '/' ? '/' : collapsedBase2.replace(/\/$/, '')
283
- expect(p2.base).toBe(normalizedBase2)
284
-
294
+ // Use the normalized base from the PathMap itself
285
295
  function checkBase(obj: any) {
286
296
  for (const [key, value] of Object.entries(obj)) {
287
297
  if (typeof value === 'string') {
288
- expect(value.startsWith(normalizedBase2)).toBe(true)
298
+ expect(value.startsWith(p2.base)).toBe(true)
289
299
  } else if (typeof value === 'object') {
290
300
  checkBase(value)
291
301
  }
@@ -309,20 +319,13 @@ describe('PathMap', () => {
309
319
  if (currentPath.length === 0) {
310
320
  expect(rel.$).toBe('.')
311
321
  expect(rooted.$).toBe('.')
312
- // Base is normalized in create() (trimmed, collapsed, trailing removed)
313
- const collapsedBase = base.trim().replace(/\/+/g, '/')
314
- const normalizedBase = collapsedBase === '/' ? '/' : collapsedBase.replace(/\/$/, '')
322
+ const normalizedBase = normalizeBasePath(base)
315
323
  expect(abs.$).toBe(normalizedBase)
316
324
  } else {
317
325
  expect(rel.$).toBe(currentPath[currentPath.length - 1])
318
326
  expect(rooted.$).toBe(currentPath.join('/'))
319
- // Handle base that might be '/' or have trailing slash
320
- // Note: create() normalizes the base (trim + collapse + remove trailing)
321
- const collapsedBase = base.trim().replace(/\/+/g, '/')
322
- const normalizedBase = collapsedBase === '/' ? '/' : collapsedBase.replace(/\/$/, '')
323
- const expectedAbs = normalizedBase === '/'
324
- ? `/${currentPath.join('/')}`
325
- : `${normalizedBase}/${currentPath.join('/')}`
327
+ const normalizedBase = normalizeBasePath(base)
328
+ const expectedAbs = buildAbsolutePath(normalizedBase, currentPath)
326
329
  expect(abs.$).toBe(expectedAbs)
327
330
  }
328
331
  }
@@ -113,7 +113,9 @@ export function create<T extends PathInput>(paths: T, base?: string): RelativePa
113
113
  const trimmedBase = base.trim()
114
114
  // Collapse multiple slashes to single, then remove trailing (unless it's just "/")
115
115
  const collapsedBase = trimmedBase.replace(/\/+/g, `/`)
116
- const normalizedBase = collapsedBase === `/` ? `/` : collapsedBase.replace(/\/$/, ``)
116
+ // Handle edge case where base is "/." - this should become "/"
117
+ const cleanedBase = collapsedBase === `/.` ? `/` : collapsedBase
118
+ const normalizedBase = cleanedBase === `/` ? `/` : cleanedBase.replace(/\/$/, ``)
117
119
 
118
120
  const rooted = processRootedPaths(paths, [])
119
121
  const absolute = processAbsolutePaths(paths, normalizedBase, [])
@@ -1,18 +1,10 @@
1
1
  import type { Config } from '#api/config/index'
2
2
  import type { NavbarItem } from '#api/content/navbar'
3
- import type { Schema } from './api/schema/index.js'
4
3
 
5
4
  export interface ProjectData {
6
- schema: null | Schema.Schema
7
5
  basePath: string
8
- paths: Config.Config[`paths`][`project`]
6
+ paths: Config.Config['paths']
9
7
  navbar: NavbarItem[]
10
- server: {
11
- port: number
12
- static: {
13
- directory: string
14
- route: string
15
- }
16
- }
17
- warnings: Config.Config[`warnings`]
8
+ server: Config.Config['server']
9
+ warnings: Config.Config['warnings']
18
10
  }
@@ -1,15 +1,14 @@
1
- import type { GrafaidOld } from '#lib/grafaid-old/index'
1
+ import type { Api } from '#api/index'
2
2
  import { CRITICALITY_LEVELS } from '#lib/graphql-change/criticality'
3
3
  import { GraphqlChange } from '#lib/graphql-change/index'
4
4
  import type { GraphqlChangeset } from '#lib/graphql-changeset/index'
5
5
  import type { CriticalityLevel } from '@graphql-inspector/core'
6
6
  import { Box } from '@radix-ui/themes'
7
- import { neverCase } from '@wollybeard/kit/language'
8
- import type React from 'react'
7
+ import React from 'react'
9
8
  import { useMemo } from 'react'
10
- import type { Schema as ChangelogData } from '../../api/schema/index.js'
11
9
  import { CriticalitySection } from './Changelog/CriticalitySection.js'
12
10
  import * as Group from './Changelog/groups/index.js'
11
+ import { ComponentDispatch } from './ComponentDispatch.js'
13
12
 
14
13
  export const renderDate = (date: Date) => {
15
14
  return date.toLocaleString(`default`, {
@@ -20,10 +19,10 @@ export const renderDate = (date: Date) => {
20
19
  })
21
20
  }
22
21
 
23
- export const Changelog: React.FC<{ schema: ChangelogData.Schema }> = ({ schema }) => {
22
+ export const Changelog: React.FC<{ changesets: Api.Schema.NonEmptyChangeSets }> = ({ changesets }) => {
24
23
  return (
25
24
  <Box>
26
- {schema.versions.map(changeset => <Changeset key={changeset.date.toISOString()} changeset={changeset} />)}
25
+ {changesets.map(changeset => <Changeset key={changeset.date.toISOString()} changeset={changeset} />)}
27
26
  </Box>
28
27
  )
29
28
  }
@@ -62,69 +61,19 @@ const Changeset: React.FC<{ changeset: GraphqlChangeset.ChangeSet }> = ({ change
62
61
  </h1>
63
62
  {groupedChanges.map(group => (
64
63
  <CriticalitySection key={group.level} level={group.level} changes={group.changes}>
65
- {group.changes.map(change => (
66
- <Change key={`${change.type}-${change.path || change.message}`} change={change} schema={changeset.after} />
67
- ))}
64
+ {group.changes.map(change => {
65
+ const type = GraphqlChange.Group.getType(change)
66
+ return (
67
+ <ComponentDispatch
68
+ key={`${change.type}-${change.path || change.message}`}
69
+ components={Group}
70
+ name={type}
71
+ props={{ change }}
72
+ />
73
+ )
74
+ })}
68
75
  </CriticalitySection>
69
76
  ))}
70
77
  </Box>
71
78
  )
72
79
  }
73
-
74
- const Change: React.FC<{ change: GraphqlChange.Change; schema: GrafaidOld.Schema.Schema }> = (
75
- { change, schema },
76
- ) => {
77
- if (GraphqlChange.Group.isTypeOperation(change)) {
78
- return <Group.TypeOperation change={change} />
79
- } else if (GraphqlChange.Group.isTypeDescription(change)) {
80
- return <Group.TypeDescription change={change} />
81
- } else if (GraphqlChange.Group.isFieldOperation(change)) {
82
- return <Group.FieldOperation change={change} />
83
- } else if (GraphqlChange.Group.isFieldDescription(change)) {
84
- return <Group.FieldDescription change={change} />
85
- } else if (GraphqlChange.Group.isFieldDeprecation(change)) {
86
- return <Group.FieldDeprecation change={change} />
87
- } else if (GraphqlChange.Group.isFieldDeprecationReason(change)) {
88
- return <Group.FieldDeprecationReason change={change} />
89
- } else if (GraphqlChange.Group.isFieldArgumentOperation(change)) {
90
- return <Group.FieldArgumentOperation change={change} />
91
- } else if (GraphqlChange.Group.isFieldArgument(change)) {
92
- return <Group.FieldArgument change={change} />
93
- } else if (GraphqlChange.Group.isFieldArgumentDescription(change)) {
94
- return <Group.FieldArgumentDescription change={change} />
95
- } else if (GraphqlChange.Group.isEnumValueOperation(change)) {
96
- return <Group.EnumValueOperation change={change} />
97
- } else if (GraphqlChange.Group.isEnumValueDescription(change)) {
98
- return <Group.EnumValueDescription change={change} />
99
- } else if (GraphqlChange.Group.isEnumValueDeprecationReason(change)) {
100
- return <Group.EnumValueDeprecationReason change={change} />
101
- } else if (GraphqlChange.Group.isInputFieldOperation(change)) {
102
- return <Group.InputFieldOperation change={change} />
103
- } else if (GraphqlChange.Group.isInputFieldDescription(change)) {
104
- return <Group.InputFieldDescription change={change} />
105
- } else if (GraphqlChange.Group.isInputFieldDefaultValue(change)) {
106
- return <Group.InputFieldDefaultValue change={change} />
107
- } else if (GraphqlChange.Group.isUnionMemberOperation(change)) {
108
- return <Group.UnionMemberOperation change={change} />
109
- } else if (GraphqlChange.Group.isObjectTypeInterfaceOperation(change)) {
110
- return <Group.ObjectTypeInterfaceOperation change={change} />
111
- } else if (GraphqlChange.Group.isDirectiveOperation(change)) {
112
- return <Group.DirectiveOperation change={change} />
113
- } else if (GraphqlChange.Group.isDirectiveDescription(change)) {
114
- return <Group.DirectiveDescription change={change} />
115
- } else if (GraphqlChange.Group.isDirectiveLocationOperation(change)) {
116
- return <Group.DirectiveLocationOperation change={change} />
117
- } else if (GraphqlChange.Group.isDirectiveArgumentOperation(change)) {
118
- return <Group.DirectiveArgumentOperation change={change} />
119
- } else if (GraphqlChange.Group.isDirectiveArgument(change)) {
120
- return <Group.DirectiveArgument change={change} />
121
- } else if (GraphqlChange.Group.isDirectiveArgumentDescription(change)) {
122
- return <Group.DirectiveArgumentDescription change={change} />
123
- } else if (GraphqlChange.Group.isSchemaRootType(change)) {
124
- return <Group.SchemaRootType change={change} />
125
- } else if (GraphqlChange.Group.isDirectiveUsage(change)) {
126
- return <Group.DirectiveUsage change={change} />
127
- } else {
128
- neverCase(change)
129
- }
130
- }
@@ -1,23 +1,21 @@
1
1
  import { type HighlightedCode, Pre } from 'codehike/code'
2
+ import type { GraphQLSchema } from 'graphql'
2
3
  import React from 'react'
3
4
  import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
4
5
  import { GraphQLInteractive } from './GraphQLInteractive/index.js'
5
6
 
6
7
  interface CodeBlockProps {
7
8
  codeblock: HighlightedCode
9
+ schema?: GraphQLSchema
8
10
  }
9
11
 
10
12
  /**
11
13
  * Code block component for Code Hike
12
14
  * Handles pre-highlighted code blocks and interactive GraphQL blocks
13
15
  */
14
- export const CodeBlock: React.FC<CodeBlockProps> = ({ codeblock }) => {
16
+ export const CodeBlock: React.FC<CodeBlockProps> = ({ codeblock, schema }) => {
15
17
  // Check if this is an interactive GraphQL block
16
18
  if (codeblock.lang === 'graphql' && codeblock.meta?.includes('interactive')) {
17
- const schema = typeof window !== 'undefined'
18
- ? (window as any).__POLEN_GRAPHQL_SCHEMA__
19
- : null
20
-
21
19
  return (
22
20
  <GraphQLInteractive
23
21
  codeblock={codeblock}
@@ -0,0 +1,42 @@
1
+ import React from 'react'
2
+
3
+ /**
4
+ * A generic component dispatcher that dynamically renders components from a namespace.
5
+ *
6
+ * Useful for cases where you need to select and render a component at runtime based on
7
+ * a string key, while maintaining some level of type safety through generics.
8
+ *
9
+ * @template TComponents - The object/namespace containing the components
10
+ * @template TName - The key type for component selection (constrained to keyof TComponents)
11
+ *
12
+ * @param components - The namespace/object containing the components to choose from
13
+ * @param name - The key to select which component to render
14
+ * @param props - The props to pass to the selected component
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import * as MyComponents from './MyComponents'
19
+ *
20
+ * const componentName = getComponentName(data)
21
+ * return (
22
+ * <ComponentDispatch
23
+ * components={MyComponents}
24
+ * name={componentName}
25
+ * props={{ data }}
26
+ * />
27
+ * )
28
+ * ```
29
+ */
30
+ export const ComponentDispatch = <
31
+ TComponents extends Record<string, React.ComponentType<any>>,
32
+ TName extends keyof TComponents,
33
+ >(
34
+ { components, name, props }: {
35
+ components: TComponents
36
+ name: TName
37
+ props: object
38
+ },
39
+ ) => {
40
+ const Component = components[name]
41
+ return React.createElement(Component as any, props)
42
+ }
@@ -0,0 +1,34 @@
1
+ import type { ReactNode } from 'react'
2
+ import { useVersionPath } from '../hooks/useVersionPath.js'
3
+ import { Link } from './Link.js'
4
+
5
+ interface Props {
6
+ /** The GraphQL type name */
7
+ type: string
8
+ /** Optional field name for field-specific links */
9
+ field?: string
10
+ /** Link content */
11
+ children: ReactNode
12
+ }
13
+
14
+ /**
15
+ * Link component for GraphQL schema references that preserves version context
16
+ *
17
+ * @example
18
+ * <ReferenceLink type="User">User</ReferenceLink>
19
+ * <ReferenceLink type="User" field="name">User.name</ReferenceLink>
20
+ */
21
+ export const ReferenceLink = ({ type, field, children }: Props) => {
22
+ const versionPath = useVersionPath()
23
+
24
+ let path = `/reference/${versionPath}${type}`
25
+ if (field) {
26
+ path += `/${field}`
27
+ }
28
+
29
+ return (
30
+ <Link to={path}>
31
+ {children}
32
+ </Link>
33
+ )
34
+ }
@@ -2,7 +2,7 @@ import { Text } from '@radix-ui/themes'
2
2
  import type { GraphQLType } from 'graphql'
3
3
  import { isInputObjectType, isListType, isNamedType, isNonNullType, isScalarType } from 'graphql'
4
4
  import type { FC } from 'react'
5
- import { Link } from './Link.js'
5
+ import { ReferenceLink } from './ReferenceLink.js'
6
6
 
7
7
  export interface Props {
8
8
  type: GraphQLType // Can be either GraphQLInputType or GraphQLOutputType
@@ -40,20 +40,18 @@ export const TypeAnnotation: FC<Props> = ({ type }) => {
40
40
  // Handle input object types
41
41
  if (isInputObjectType(namedType)) {
42
42
  return (
43
- <Link
44
- to={`/reference/${namedType.name}`}
45
- >
43
+ <ReferenceLink type={namedType.name}>
46
44
  <Text color='green'>{namedType.name}</Text>
47
- </Link>
45
+ </ReferenceLink>
48
46
  )
49
47
  }
50
48
 
51
49
  // If it's an expandable type (object or interface), make it a link
52
50
  // if (Grafaid.isExpandableType(namedType)) {
53
51
  return (
54
- <Link to={`/reference/${namedType.name}`}>
52
+ <ReferenceLink type={namedType.name}>
55
53
  <Text color={isScalarType(namedType) ? `purple` : `blue`}>{namedType.name}</Text>
56
- </Link>
54
+ </ReferenceLink>
57
55
  )
58
56
 
59
57
  // For scalar and other non-expandable types, just render the name
@@ -1,7 +1,7 @@
1
1
  import { Box, Flex, Heading } from '@radix-ui/themes'
2
2
  import type { GraphQLInterfaceType, GraphQLObjectType } from 'graphql'
3
3
  import type { FC } from 'react'
4
- import { Link } from './Link.js'
4
+ import { ReferenceLink } from './ReferenceLink.js'
5
5
 
6
6
  export interface Props {
7
7
  type: GraphQLObjectType | GraphQLInterfaceType
@@ -9,27 +9,24 @@ export interface Props {
9
9
 
10
10
  export const TypeFieldsLinkList: FC<Props> = ({ type }) => {
11
11
  return (
12
- (
13
- <Box>
14
- <Heading>{type.name}</Heading>
15
- <Flex direction='column'>
16
- {Object.values(type.getFields()).map(field => {
17
- return (
18
- (
19
- <Box key={field.name}>
20
- <Link
21
- to={`/reference/${type.name}/${field.name}`}
22
- // TODO: can we use styled from Radix?
23
- // activeProps={{ style: { fontWeight: `bold` } }}
24
- >
25
- {field.name}
26
- </Link>
27
- </Box>
28
- )
29
- )
30
- })}
31
- </Flex>
32
- </Box>
33
- )
12
+ <Box>
13
+ <Heading>{type.name}</Heading>
14
+ <Flex direction='column'>
15
+ {Object.values(type.getFields()).map(field => {
16
+ return (
17
+ <Box key={field.name}>
18
+ <ReferenceLink
19
+ type={type.name}
20
+ field={field.name}
21
+ // TODO: can we use styled from Radix?
22
+ // activeProps={{ style: { fontWeight: `bold` } }}
23
+ >
24
+ {field.name}
25
+ </ReferenceLink>
26
+ </Box>
27
+ )
28
+ })}
29
+ </Flex>
30
+ </Box>
34
31
  )
35
32
  }
@@ -3,7 +3,7 @@ import { Box, Flex, Heading } from '@radix-ui/themes'
3
3
  import { Obj } from '@wollybeard/kit'
4
4
  import type { GraphQLNamedType, GraphQLSchema } from 'graphql'
5
5
  import type { FC } from 'react'
6
- import { Link } from './Link.js'
6
+ import { ReferenceLink } from './ReferenceLink.js'
7
7
 
8
8
  export interface Props {
9
9
  schema: GraphQLSchema
@@ -31,16 +31,14 @@ const TypeSection: FC<{ title: string; types: GraphQLNamedType[] }> = ({ title,
31
31
 
32
32
  const TypeList: FC<{ types: GraphQLNamedType[] }> = ({ types }) => {
33
33
  return (
34
- (
35
- <Box>
36
- {types.map(type => (
37
- <Box key={type.name}>
38
- <Link to={`/reference/${type.name}`}>
39
- {type.name}
40
- </Link>
41
- </Box>
42
- ))}
43
- </Box>
44
- )
34
+ <Box>
35
+ {types.map(type => (
36
+ <Box key={type.name}>
37
+ <ReferenceLink type={type.name}>
38
+ {type.name}
39
+ </ReferenceLink>
40
+ </Box>
41
+ ))}
42
+ </Box>
45
43
  )
46
44
  }
@@ -0,0 +1,50 @@
1
+ import { Select } from '@radix-ui/themes'
2
+ import { useNavigate, useParams } from 'react-router'
3
+ import { VERSION_LATEST } from '../lib/schema-utils/constants.js'
4
+
5
+ interface VersionSelectorProps {
6
+ availableVersions: string[]
7
+ currentVersion: string
8
+ }
9
+
10
+ export const VersionSelector = ({ availableVersions, currentVersion }: VersionSelectorProps) => {
11
+ const navigate = useNavigate()
12
+ const params = useParams()
13
+
14
+ // Don't show selector if only one version
15
+ if (availableVersions.length <= 1) {
16
+ return null
17
+ }
18
+
19
+ const handleVersionChange = (newVersion: string) => {
20
+ // Build new path preserving the current type/field if any
21
+ const currentType = params[`type`]
22
+ const currentField = params[`field`]
23
+
24
+ let newPath = `/reference`
25
+ if (newVersion !== VERSION_LATEST) {
26
+ newPath += `/version/${newVersion}`
27
+ }
28
+ if (currentType) {
29
+ newPath += `/${currentType}`
30
+ if (currentField) {
31
+ newPath += `/${currentField}`
32
+ }
33
+ }
34
+
35
+ navigate(newPath)
36
+ }
37
+
38
+ return (
39
+ <Select.Root value={currentVersion} onValueChange={handleVersionChange}>
40
+ <Select.Trigger />
41
+ <Select.Content>
42
+ {availableVersions.map(version => (
43
+ <Select.Item key={version} value={version}>
44
+ {version === VERSION_LATEST ? `Latest` : version}
45
+ </Select.Item>
46
+ ))}
47
+ </Select.Content>
48
+ </Select.Root>
49
+ )
50
+ }
@@ -1,18 +1,19 @@
1
1
  import { Grafaid } from '#lib/grafaid/index'
2
2
  import { Code, Flex } from '@radix-ui/themes'
3
- import { Link } from '../Link.js'
3
+ import { ReferenceLink } from '../ReferenceLink.js'
4
4
  import { TypeKindIcon } from './graphql.js'
5
5
  import { typeKindTokensIndex } from './type-kind-tokens.js'
6
6
 
7
7
  export const TypeLink: React.FC<{ type: Grafaid.Schema.TypesLike.Named }> = ({ type }) => {
8
8
  const kind = Grafaid.Schema.typeKindFromClass(type)
9
+
9
10
  return (
10
- <Link to={`/reference/${type.name}`}>
11
+ <ReferenceLink type={type.name}>
11
12
  <Flex align='center' gap='1' display='inline-flex'>
12
13
  <TypeKindIcon kind={kind} />
13
14
  {` `}
14
15
  <Code color={typeKindTokensIndex[kind].color} variant='ghost'>{type.name}</Code>
15
16
  </Flex>
16
- </Link>
17
+ </ReferenceLink>
17
18
  )
18
19
  }
@@ -0,0 +1,10 @@
1
+ import { useParams } from 'react-router'
2
+
3
+ /**
4
+ * Custom hook to generate version path for versioned routes
5
+ * Returns the appropriate path prefix for the current version
6
+ */
7
+ export const useVersionPath = (): string => {
8
+ const params = useParams()
9
+ return params[`version`] ? `version/${params[`version`]}/` : ``
10
+ }
@@ -8,7 +8,7 @@ import type { GraphqlChangeset } from '#lib/graphql-changeset/index'
8
8
  import { Box, Flex, Text } from '@radix-ui/themes'
9
9
  import type React from 'react'
10
10
  import { useEffect, useState } from 'react'
11
- import { renderDate } from './Changelog.js'
11
+ import { renderDate } from '../components/Changelog.js'
12
12
 
13
13
  interface ChangelogLayoutProps {
14
14
  children: React.ReactNode
@@ -1 +1,2 @@
1
+ export * from './ChangelogLayout.js'
1
2
  export * from './SidebarLayout.js'
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Fetch text content from a URL
3
+ * @param url - The URL to fetch from
4
+ * @returns Promise that resolves to the text content
5
+ * @throws Error if the request fails
6
+ */
7
+ export const fetchText = async (url: string): Promise<string> => {
8
+ const response = await fetch(url)
9
+ if (!response.ok) {
10
+ throw new Error(`Failed to fetch: ${url} (${response.status} ${response.statusText})`)
11
+ }
12
+ return response.text()
13
+ }