polen 0.11.0-next.25 → 0.11.0-next.27

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 (230) hide show
  1. package/build/api/config/input.d.ts +183 -0
  2. package/build/api/config/input.d.ts.map +1 -1
  3. package/build/api/config/input.js +2 -0
  4. package/build/api/config/input.js.map +1 -1
  5. package/build/api/config/normalized.d.ts +297 -0
  6. package/build/api/config/normalized.d.ts.map +1 -1
  7. package/build/api/config/normalized.js +47 -0
  8. package/build/api/config/normalized.js.map +1 -1
  9. package/build/api/config-template/template.d.ts +81 -0
  10. package/build/api/config-template/template.d.ts.map +1 -1
  11. package/build/api/config-template/template.js +18 -1
  12. package/build/api/config-template/template.js.map +1 -1
  13. package/build/api/examples/scanner.d.ts.map +1 -1
  14. package/build/api/examples/scanner.js +11 -0
  15. package/build/api/examples/scanner.js.map +1 -1
  16. package/build/api/examples/schemas/catalog.d.ts +36 -0
  17. package/build/api/examples/schemas/catalog.d.ts.map +1 -1
  18. package/build/api/examples/schemas/example/example.d.ts +37 -0
  19. package/build/api/examples/schemas/example/example.d.ts.map +1 -1
  20. package/build/api/examples/schemas/example/example.js +5 -0
  21. package/build/api/examples/schemas/example/example.js.map +1 -1
  22. package/build/api/reference/$.d.ts +4 -0
  23. package/build/api/reference/$.d.ts.map +1 -0
  24. package/build/api/reference/$.js +4 -0
  25. package/build/api/reference/$.js.map +1 -0
  26. package/build/api/reference/catalog.d.ts +69 -0
  27. package/build/api/reference/catalog.d.ts.map +1 -0
  28. package/build/api/reference/catalog.js +44 -0
  29. package/build/api/reference/catalog.js.map +1 -0
  30. package/build/api/reference/config.d.ts +616 -0
  31. package/build/api/reference/config.d.ts.map +1 -0
  32. package/build/api/reference/config.js +162 -0
  33. package/build/api/reference/config.js.map +1 -0
  34. package/build/api/reference/scanner.d.ts +26 -0
  35. package/build/api/reference/scanner.d.ts.map +1 -0
  36. package/build/api/reference/scanner.js +27 -0
  37. package/build/api/reference/scanner.js.map +1 -0
  38. package/build/lib/grafaid/schema/format-default-value.d.ts +11 -0
  39. package/build/lib/grafaid/schema/format-default-value.d.ts.map +1 -0
  40. package/build/lib/grafaid/schema/format-default-value.js +20 -0
  41. package/build/lib/grafaid/schema/format-default-value.js.map +1 -0
  42. package/build/lib/grafaid/schema/schema.d.ts +1 -0
  43. package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
  44. package/build/lib/grafaid/schema/schema.js +1 -0
  45. package/build/lib/grafaid/schema/schema.js.map +1 -1
  46. package/build/template/components/ArgumentAnnotation.d.ts +2 -1
  47. package/build/template/components/ArgumentAnnotation.d.ts.map +1 -1
  48. package/build/template/components/ArgumentAnnotation.js +14 -4
  49. package/build/template/components/ArgumentAnnotation.js.map +1 -1
  50. package/build/template/components/ArgumentListAnnotation.d.ts +1 -0
  51. package/build/template/components/ArgumentListAnnotation.d.ts.map +1 -1
  52. package/build/template/components/ArgumentListAnnotation.js +21 -8
  53. package/build/template/components/ArgumentListAnnotation.js.map +1 -1
  54. package/build/template/components/Changelog/groups/FieldArgument.d.ts.map +1 -1
  55. package/build/template/components/Changelog/groups/FieldArgument.js +0 -1
  56. package/build/template/components/Changelog/groups/FieldArgument.js.map +1 -1
  57. package/build/template/components/CodeBlock.d.ts.map +1 -1
  58. package/build/template/components/CodeBlock.js +1 -1
  59. package/build/template/components/CodeBlock.js.map +1 -1
  60. package/build/template/components/Description.js +1 -1
  61. package/build/template/components/Description.js.map +1 -1
  62. package/build/template/components/ExampleLink.d.ts.map +1 -1
  63. package/build/template/components/ExampleLink.js +2 -1
  64. package/build/template/components/ExampleLink.js.map +1 -1
  65. package/build/template/components/Field.d.ts +2 -0
  66. package/build/template/components/Field.d.ts.map +1 -1
  67. package/build/template/components/Field.js +42 -4
  68. package/build/template/components/Field.js.map +1 -1
  69. package/build/template/components/FieldList.d.ts +2 -1
  70. package/build/template/components/FieldList.d.ts.map +1 -1
  71. package/build/template/components/FieldList.js +14 -3
  72. package/build/template/components/FieldList.js.map +1 -1
  73. package/build/template/components/FieldListSection.d.ts.map +1 -1
  74. package/build/template/components/FieldListSection.js +6 -1
  75. package/build/template/components/FieldListSection.js.map +1 -1
  76. package/build/template/components/GraphQLDocument.d.ts.map +1 -1
  77. package/build/template/components/GraphQLDocument.js +2 -1
  78. package/build/template/components/GraphQLDocument.js.map +1 -1
  79. package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts +2 -0
  80. package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts.map +1 -1
  81. package/build/template/components/GraphQLInteractive/GraphQLInteractive.js +4 -3
  82. package/build/template/components/GraphQLInteractive/GraphQLInteractive.js.map +1 -1
  83. package/build/template/components/GraphQLInteractive/lib/parser.d.ts +2 -2
  84. package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
  85. package/build/template/components/GraphQLInteractive/lib/parser.js +17 -12
  86. package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
  87. package/build/template/components/IAPIndicator.d.ts +12 -0
  88. package/build/template/components/IAPIndicator.d.ts.map +1 -0
  89. package/build/template/components/IAPIndicator.js +21 -0
  90. package/build/template/components/IAPIndicator.js.map +1 -0
  91. package/build/template/components/Link.d.ts +1 -2
  92. package/build/template/components/Link.d.ts.map +1 -1
  93. package/build/template/components/Link.js +5 -2
  94. package/build/template/components/Link.js.map +1 -1
  95. package/build/template/components/NamedType.d.ts.map +1 -1
  96. package/build/template/components/NamedType.js +9 -5
  97. package/build/template/components/NamedType.js.map +1 -1
  98. package/build/template/components/ReferenceLink.d.ts +3 -2
  99. package/build/template/components/ReferenceLink.d.ts.map +1 -1
  100. package/build/template/components/ReferenceLink.js +5 -3
  101. package/build/template/components/ReferenceLink.js.map +1 -1
  102. package/build/template/components/TypeAnnotation.d.ts +2 -0
  103. package/build/template/components/TypeAnnotation.d.ts.map +1 -1
  104. package/build/template/components/TypeAnnotation.js +4 -4
  105. package/build/template/components/TypeAnnotation.js.map +1 -1
  106. package/build/template/components/ViewModeToggle.d.ts +3 -0
  107. package/build/template/components/ViewModeToggle.d.ts.map +1 -0
  108. package/build/template/components/ViewModeToggle.js +9 -0
  109. package/build/template/components/ViewModeToggle.js.map +1 -0
  110. package/build/template/components/graphql/type-link.d.ts +2 -0
  111. package/build/template/components/graphql/type-link.d.ts.map +1 -1
  112. package/build/template/components/graphql/type-link.js +17 -4
  113. package/build/template/components/graphql/type-link.js.map +1 -1
  114. package/build/template/components/home/PlaygroundPreview.d.ts.map +1 -1
  115. package/build/template/components/home/PlaygroundPreview.js +3 -2
  116. package/build/template/components/home/PlaygroundPreview.js.map +1 -1
  117. package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
  118. package/build/template/components/sidebar/SidebarItem.js +18 -5
  119. package/build/template/components/sidebar/SidebarItem.js.map +1 -1
  120. package/build/template/contexts/ReferenceConfigContext.d.ts +16 -0
  121. package/build/template/contexts/ReferenceConfigContext.d.ts.map +1 -0
  122. package/build/template/contexts/ReferenceConfigContext.js +14 -0
  123. package/build/template/contexts/ReferenceConfigContext.js.map +1 -0
  124. package/build/template/contexts/ViewModeContext.d.ts +14 -0
  125. package/build/template/contexts/ViewModeContext.d.ts.map +1 -0
  126. package/build/template/contexts/ViewModeContext.js +40 -0
  127. package/build/template/contexts/ViewModeContext.js.map +1 -0
  128. package/build/template/hooks/use-examples.d.ts +3 -0
  129. package/build/template/hooks/use-examples.d.ts.map +1 -1
  130. package/build/template/hooks/useAlignedColumns.d.ts +10 -0
  131. package/build/template/hooks/useAlignedColumns.d.ts.map +1 -0
  132. package/build/template/hooks/useAlignedColumns.js +17 -0
  133. package/build/template/hooks/useAlignedColumns.js.map +1 -0
  134. package/build/template/routes/examples/_.d.ts +9 -0
  135. package/build/template/routes/examples/_.d.ts.map +1 -1
  136. package/build/template/routes/examples/_index.d.ts +6 -0
  137. package/build/template/routes/examples/_index.d.ts.map +1 -1
  138. package/build/template/routes/examples/name.d.ts +9 -0
  139. package/build/template/routes/examples/name.d.ts.map +1 -1
  140. package/build/template/routes/examples/name.js +6 -2
  141. package/build/template/routes/examples/name.js.map +1 -1
  142. package/build/template/routes/reference.d.ts.map +1 -1
  143. package/build/template/routes/reference.js +37 -10
  144. package/build/template/routes/reference.js.map +1 -1
  145. package/build/vite/plugins/core.d.ts.map +1 -1
  146. package/build/vite/plugins/core.js +6 -0
  147. package/build/vite/plugins/core.js.map +1 -1
  148. package/build/vite/plugins/examples.d.ts.map +1 -1
  149. package/build/vite/plugins/examples.js +10 -1
  150. package/build/vite/plugins/examples.js.map +1 -1
  151. package/build/vite/plugins/index.d.ts +1 -0
  152. package/build/vite/plugins/index.d.ts.map +1 -1
  153. package/build/vite/plugins/index.js +1 -0
  154. package/build/vite/plugins/index.js.map +1 -1
  155. package/build/vite/plugins/navbar.d.ts.map +1 -1
  156. package/build/vite/plugins/navbar.js +3 -1
  157. package/build/vite/plugins/navbar.js.map +1 -1
  158. package/build/vite/plugins/reference.d.ts +19 -0
  159. package/build/vite/plugins/reference.d.ts.map +1 -0
  160. package/build/vite/plugins/reference.js +96 -0
  161. package/build/vite/plugins/reference.js.map +1 -0
  162. package/package.json +1 -7
  163. package/src/api/config/input.ts +2 -0
  164. package/src/api/config/normalized.ts +54 -0
  165. package/src/api/config-template/template.ts +18 -1
  166. package/src/api/examples/scanner.ts +14 -0
  167. package/src/api/examples/schemas/example/example.ts +6 -0
  168. package/src/api/reference/$.ts +3 -0
  169. package/src/api/reference/catalog.ts +55 -0
  170. package/src/api/reference/config.ts +193 -0
  171. package/src/api/reference/scanner.ts +53 -0
  172. package/src/lib/grafaid/schema/format-default-value.ts +22 -0
  173. package/src/lib/grafaid/schema/schema.ts +2 -0
  174. package/src/template/components/ArgumentAnnotation.tsx +58 -9
  175. package/src/template/components/ArgumentListAnnotation.tsx +50 -17
  176. package/src/template/components/Changelog/groups/FieldArgument.tsx +0 -1
  177. package/src/template/components/CodeBlock.tsx +1 -0
  178. package/src/template/components/Description.tsx +1 -1
  179. package/src/template/components/ExampleLink.tsx +2 -1
  180. package/src/template/components/Field.tsx +148 -20
  181. package/src/template/components/FieldList.tsx +28 -13
  182. package/src/template/components/FieldListSection.tsx +12 -2
  183. package/src/template/components/GraphQLDocument.tsx +2 -0
  184. package/src/template/components/GraphQLInteractive/GraphQLInteractive.tsx +6 -1
  185. package/src/template/components/GraphQLInteractive/lib/parser.ts +16 -3
  186. package/src/template/components/IAPIndicator.tsx +73 -0
  187. package/src/template/components/Link.tsx +9 -3
  188. package/src/template/components/NamedType.tsx +54 -28
  189. package/src/template/components/ReferenceLink.tsx +17 -10
  190. package/src/template/components/TypeAnnotation.tsx +17 -5
  191. package/src/template/components/ViewModeToggle.tsx +27 -0
  192. package/src/template/components/graphql/type-link.tsx +52 -9
  193. package/src/template/components/home/PlaygroundPreview.tsx +3 -0
  194. package/src/template/components/sidebar/SidebarItem.tsx +21 -5
  195. package/src/template/contexts/ReferenceConfigContext.tsx +37 -0
  196. package/src/template/contexts/ViewModeContext.tsx +64 -0
  197. package/src/template/hooks/useAlignedColumns.ts +19 -0
  198. package/src/template/routes/examples/name.tsx +13 -1
  199. package/src/template/routes/reference.tsx +67 -23
  200. package/src/types/virtual-modules.d.ts +5 -0
  201. package/src/vite/plugins/core.ts +6 -0
  202. package/src/vite/plugins/examples.ts +12 -0
  203. package/src/vite/plugins/index.ts +1 -0
  204. package/src/vite/plugins/navbar.ts +4 -1
  205. package/src/vite/plugins/reference.ts +130 -0
  206. package/build/lib/extensible-data/$.d.ts +0 -2
  207. package/build/lib/extensible-data/$.d.ts.map +0 -1
  208. package/build/lib/extensible-data/$.js +0 -2
  209. package/build/lib/extensible-data/$.js.map +0 -1
  210. package/build/lib/extensible-data/extensible-data.d.ts +0 -17
  211. package/build/lib/extensible-data/extensible-data.d.ts.map +0 -1
  212. package/build/lib/extensible-data/extensible-data.js +0 -24
  213. package/build/lib/extensible-data/extensible-data.js.map +0 -1
  214. package/build/lib/vite-plugin-reactive-data/$.d.ts +0 -2
  215. package/build/lib/vite-plugin-reactive-data/$.d.ts.map +0 -1
  216. package/build/lib/vite-plugin-reactive-data/$.js +0 -2
  217. package/build/lib/vite-plugin-reactive-data/$.js.map +0 -1
  218. package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts +0 -32
  219. package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts.map +0 -1
  220. package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js +0 -85
  221. package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js.map +0 -1
  222. package/build/template/components/ArgumentList.d.ts +0 -6
  223. package/build/template/components/ArgumentList.d.ts.map +0 -1
  224. package/build/template/components/ArgumentList.js +0 -9
  225. package/build/template/components/ArgumentList.js.map +0 -1
  226. package/src/lib/extensible-data/$.ts +0 -1
  227. package/src/lib/extensible-data/extensible-data.ts +0 -38
  228. package/src/lib/vite-plugin-reactive-data/$.ts +0 -1
  229. package/src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts +0 -124
  230. package/src/template/components/ArgumentList.tsx +0 -22
@@ -1,124 +0,0 @@
1
- import type { VitePluginJson } from '#lib/vite-plugin-json'
2
- import { debugPolen } from '#singletons/debug'
3
- import { type ComputedRef, effect, isRef } from '@vue/reactivity'
4
- import type { Plugin, ViteDevServer } from 'vite'
5
-
6
- interface ReactiveDataOptions {
7
- /**
8
- * Virtual module ID (e.g., 'virtual:polen/navbar') that this data will be exported from.
9
- * The appropriate extension will be appended automatically based on moduleType.
10
- */
11
- moduleId: string
12
- /**
13
- * The reactive data to expose.
14
- * Can be either:
15
- * - A Vue computed ref (recommended)
16
- * - A function that returns reactive data
17
- * - A reactive value directly
18
- */
19
- data: ComputedRef<object | unknown[]> | (() => object | unknown[]) | object | unknown[]
20
- /**
21
- * JSON codec to use
22
- * Default: JSON
23
- * Only used when includeJsonPlugin is true
24
- */
25
- codec?: VitePluginJson.Codec
26
- /**
27
- * Custom plugin name. Can use to help identify this plugin in logs if using many instances of this plugin.
28
- @default 'reactive-data'
29
- */
30
- name?: string
31
- }
32
-
33
- const pluginDebug = debugPolen.sub(`vite-reactive-data`)
34
-
35
- export const create = (options: ReactiveDataOptions): Plugin => {
36
- const codec = options.codec ?? JSON
37
- const moduleId = options.moduleId
38
- const name = options.name ?? `reactive-data`
39
-
40
- const debug = pluginDebug.sub(name)
41
- debug(`constructor`, { moduleId })
42
-
43
- let $server: ViteDevServer
44
- let $invalidationScheduled = false
45
-
46
- const tryInvalidate = () => {
47
- $invalidationScheduled = false
48
- if (!$server) throw new Error(`Server not available yet - this should be impossible`)
49
- const moduleNode = $server.moduleGraph.getModuleById(moduleId)
50
- if (moduleNode) {
51
- debug(`invalidate`, { id: moduleNode.id })
52
- $server.moduleGraph.invalidateModule(moduleNode)
53
- } else {
54
- debug(`cannot invalidate`, {
55
- reason: `notInModuleGraph`,
56
- moduleId,
57
- hint: `maybe it was not loaded yet`,
58
- })
59
- }
60
- }
61
-
62
- const scheduleInvalidate = () => {
63
- if ($invalidationScheduled) return // already scheduled
64
-
65
- $invalidationScheduled = true
66
-
67
- if (!$server) return // server will flush when ready
68
-
69
- tryInvalidate()
70
- }
71
-
72
- // Helper to get the current data value
73
- const getData = () => {
74
- if (isRef(options.data)) {
75
- return options.data.value
76
- } else if (typeof options.data === `function`) {
77
- return options.data()
78
- } else {
79
- return options.data
80
- }
81
- }
82
-
83
- // Set up reactive effect immediately
84
- effect(() => {
85
- // Access data to track dependencies
86
- const data = getData()
87
- debug(`effect triggered`, { data })
88
-
89
- scheduleInvalidate()
90
- })
91
-
92
- return {
93
- name,
94
-
95
- configureServer(_server) {
96
- debug(`hook configureServer`)
97
- $server = _server
98
- if ($invalidationScheduled) {
99
- debug(`try invalidate scheduled before server was ready`)
100
- tryInvalidate()
101
- }
102
- },
103
-
104
- resolveId(id) {
105
- if (id === moduleId) {
106
- return moduleId
107
- }
108
- },
109
-
110
- // todo make use of Vite's builtin json plugin
111
- // for example, call it here somehow
112
- load(id) {
113
- if (id !== moduleId) return
114
-
115
- const data = getData()
116
- debug(`hook load`, { data })
117
-
118
- return {
119
- code: codec.stringify(data),
120
- map: null,
121
- }
122
- },
123
- }
124
- }
@@ -1,22 +0,0 @@
1
- import type { React } from '#dep/react/index'
2
- import { Box, Flex, Heading, Text } from '@radix-ui/themes'
3
- import type { GraphQLArgument } from 'graphql'
4
- import { TypeAnnotation } from './TypeAnnotation.js'
5
-
6
- export const ArgumentsList: React.FC<{ args: readonly GraphQLArgument[] }> = ({ args }) => {
7
- if (args.length === 0) return null
8
-
9
- return (
10
- <Flex direction='column'>
11
- <Heading size='1' weight='bold'>Arguments</Heading>
12
- {args.map(arg => (
13
- <Box key={arg.name}>
14
- <Text>{arg.name}</Text>
15
- <Text>:</Text>
16
- <TypeAnnotation type={arg.type} />
17
- {arg.description && <Text as='p' size='2' color='gray'>{arg.description}</Text>}
18
- </Box>
19
- ))}
20
- </Flex>
21
- )
22
- }