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.
- package/build/api/config/input.d.ts +183 -0
- package/build/api/config/input.d.ts.map +1 -1
- package/build/api/config/input.js +2 -0
- package/build/api/config/input.js.map +1 -1
- package/build/api/config/normalized.d.ts +297 -0
- package/build/api/config/normalized.d.ts.map +1 -1
- package/build/api/config/normalized.js +47 -0
- package/build/api/config/normalized.js.map +1 -1
- package/build/api/config-template/template.d.ts +81 -0
- package/build/api/config-template/template.d.ts.map +1 -1
- package/build/api/config-template/template.js +18 -1
- package/build/api/config-template/template.js.map +1 -1
- package/build/api/examples/scanner.d.ts.map +1 -1
- package/build/api/examples/scanner.js +11 -0
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/schemas/catalog.d.ts +36 -0
- package/build/api/examples/schemas/catalog.d.ts.map +1 -1
- package/build/api/examples/schemas/example/example.d.ts +37 -0
- package/build/api/examples/schemas/example/example.d.ts.map +1 -1
- package/build/api/examples/schemas/example/example.js +5 -0
- package/build/api/examples/schemas/example/example.js.map +1 -1
- package/build/api/reference/$.d.ts +4 -0
- package/build/api/reference/$.d.ts.map +1 -0
- package/build/api/reference/$.js +4 -0
- package/build/api/reference/$.js.map +1 -0
- package/build/api/reference/catalog.d.ts +69 -0
- package/build/api/reference/catalog.d.ts.map +1 -0
- package/build/api/reference/catalog.js +44 -0
- package/build/api/reference/catalog.js.map +1 -0
- package/build/api/reference/config.d.ts +616 -0
- package/build/api/reference/config.d.ts.map +1 -0
- package/build/api/reference/config.js +162 -0
- package/build/api/reference/config.js.map +1 -0
- package/build/api/reference/scanner.d.ts +26 -0
- package/build/api/reference/scanner.d.ts.map +1 -0
- package/build/api/reference/scanner.js +27 -0
- package/build/api/reference/scanner.js.map +1 -0
- package/build/lib/grafaid/schema/format-default-value.d.ts +11 -0
- package/build/lib/grafaid/schema/format-default-value.d.ts.map +1 -0
- package/build/lib/grafaid/schema/format-default-value.js +20 -0
- package/build/lib/grafaid/schema/format-default-value.js.map +1 -0
- package/build/lib/grafaid/schema/schema.d.ts +1 -0
- package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
- package/build/lib/grafaid/schema/schema.js +1 -0
- package/build/lib/grafaid/schema/schema.js.map +1 -1
- package/build/template/components/ArgumentAnnotation.d.ts +2 -1
- package/build/template/components/ArgumentAnnotation.d.ts.map +1 -1
- package/build/template/components/ArgumentAnnotation.js +14 -4
- package/build/template/components/ArgumentAnnotation.js.map +1 -1
- package/build/template/components/ArgumentListAnnotation.d.ts +1 -0
- package/build/template/components/ArgumentListAnnotation.d.ts.map +1 -1
- package/build/template/components/ArgumentListAnnotation.js +21 -8
- package/build/template/components/ArgumentListAnnotation.js.map +1 -1
- package/build/template/components/Changelog/groups/FieldArgument.d.ts.map +1 -1
- package/build/template/components/Changelog/groups/FieldArgument.js +0 -1
- package/build/template/components/Changelog/groups/FieldArgument.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +1 -1
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/Description.js +1 -1
- package/build/template/components/Description.js.map +1 -1
- package/build/template/components/ExampleLink.d.ts.map +1 -1
- package/build/template/components/ExampleLink.js +2 -1
- package/build/template/components/ExampleLink.js.map +1 -1
- package/build/template/components/Field.d.ts +2 -0
- package/build/template/components/Field.d.ts.map +1 -1
- package/build/template/components/Field.js +42 -4
- package/build/template/components/Field.js.map +1 -1
- package/build/template/components/FieldList.d.ts +2 -1
- package/build/template/components/FieldList.d.ts.map +1 -1
- package/build/template/components/FieldList.js +14 -3
- package/build/template/components/FieldList.js.map +1 -1
- package/build/template/components/FieldListSection.d.ts.map +1 -1
- package/build/template/components/FieldListSection.js +6 -1
- package/build/template/components/FieldListSection.js.map +1 -1
- package/build/template/components/GraphQLDocument.d.ts.map +1 -1
- package/build/template/components/GraphQLDocument.js +2 -1
- package/build/template/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts +2 -0
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.js +4 -3
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.js.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts +2 -2
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.js +17 -12
- package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
- package/build/template/components/IAPIndicator.d.ts +12 -0
- package/build/template/components/IAPIndicator.d.ts.map +1 -0
- package/build/template/components/IAPIndicator.js +21 -0
- package/build/template/components/IAPIndicator.js.map +1 -0
- package/build/template/components/Link.d.ts +1 -2
- package/build/template/components/Link.d.ts.map +1 -1
- package/build/template/components/Link.js +5 -2
- package/build/template/components/Link.js.map +1 -1
- package/build/template/components/NamedType.d.ts.map +1 -1
- package/build/template/components/NamedType.js +9 -5
- package/build/template/components/NamedType.js.map +1 -1
- package/build/template/components/ReferenceLink.d.ts +3 -2
- package/build/template/components/ReferenceLink.d.ts.map +1 -1
- package/build/template/components/ReferenceLink.js +5 -3
- package/build/template/components/ReferenceLink.js.map +1 -1
- package/build/template/components/TypeAnnotation.d.ts +2 -0
- package/build/template/components/TypeAnnotation.d.ts.map +1 -1
- package/build/template/components/TypeAnnotation.js +4 -4
- package/build/template/components/TypeAnnotation.js.map +1 -1
- package/build/template/components/ViewModeToggle.d.ts +3 -0
- package/build/template/components/ViewModeToggle.d.ts.map +1 -0
- package/build/template/components/ViewModeToggle.js +9 -0
- package/build/template/components/ViewModeToggle.js.map +1 -0
- package/build/template/components/graphql/type-link.d.ts +2 -0
- package/build/template/components/graphql/type-link.d.ts.map +1 -1
- package/build/template/components/graphql/type-link.js +17 -4
- package/build/template/components/graphql/type-link.js.map +1 -1
- package/build/template/components/home/PlaygroundPreview.d.ts.map +1 -1
- package/build/template/components/home/PlaygroundPreview.js +3 -2
- package/build/template/components/home/PlaygroundPreview.js.map +1 -1
- package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.js +18 -5
- package/build/template/components/sidebar/SidebarItem.js.map +1 -1
- package/build/template/contexts/ReferenceConfigContext.d.ts +16 -0
- package/build/template/contexts/ReferenceConfigContext.d.ts.map +1 -0
- package/build/template/contexts/ReferenceConfigContext.js +14 -0
- package/build/template/contexts/ReferenceConfigContext.js.map +1 -0
- package/build/template/contexts/ViewModeContext.d.ts +14 -0
- package/build/template/contexts/ViewModeContext.d.ts.map +1 -0
- package/build/template/contexts/ViewModeContext.js +40 -0
- package/build/template/contexts/ViewModeContext.js.map +1 -0
- package/build/template/hooks/use-examples.d.ts +3 -0
- package/build/template/hooks/use-examples.d.ts.map +1 -1
- package/build/template/hooks/useAlignedColumns.d.ts +10 -0
- package/build/template/hooks/useAlignedColumns.d.ts.map +1 -0
- package/build/template/hooks/useAlignedColumns.js +17 -0
- package/build/template/hooks/useAlignedColumns.js.map +1 -0
- package/build/template/routes/examples/_.d.ts +9 -0
- package/build/template/routes/examples/_.d.ts.map +1 -1
- package/build/template/routes/examples/_index.d.ts +6 -0
- package/build/template/routes/examples/_index.d.ts.map +1 -1
- package/build/template/routes/examples/name.d.ts +9 -0
- package/build/template/routes/examples/name.d.ts.map +1 -1
- package/build/template/routes/examples/name.js +6 -2
- package/build/template/routes/examples/name.js.map +1 -1
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +37 -10
- package/build/template/routes/reference.js.map +1 -1
- package/build/vite/plugins/core.d.ts.map +1 -1
- package/build/vite/plugins/core.js +6 -0
- package/build/vite/plugins/core.js.map +1 -1
- package/build/vite/plugins/examples.d.ts.map +1 -1
- package/build/vite/plugins/examples.js +10 -1
- package/build/vite/plugins/examples.js.map +1 -1
- package/build/vite/plugins/index.d.ts +1 -0
- package/build/vite/plugins/index.d.ts.map +1 -1
- package/build/vite/plugins/index.js +1 -0
- package/build/vite/plugins/index.js.map +1 -1
- package/build/vite/plugins/navbar.d.ts.map +1 -1
- package/build/vite/plugins/navbar.js +3 -1
- package/build/vite/plugins/navbar.js.map +1 -1
- package/build/vite/plugins/reference.d.ts +19 -0
- package/build/vite/plugins/reference.d.ts.map +1 -0
- package/build/vite/plugins/reference.js +96 -0
- package/build/vite/plugins/reference.js.map +1 -0
- package/package.json +1 -7
- package/src/api/config/input.ts +2 -0
- package/src/api/config/normalized.ts +54 -0
- package/src/api/config-template/template.ts +18 -1
- package/src/api/examples/scanner.ts +14 -0
- package/src/api/examples/schemas/example/example.ts +6 -0
- package/src/api/reference/$.ts +3 -0
- package/src/api/reference/catalog.ts +55 -0
- package/src/api/reference/config.ts +193 -0
- package/src/api/reference/scanner.ts +53 -0
- package/src/lib/grafaid/schema/format-default-value.ts +22 -0
- package/src/lib/grafaid/schema/schema.ts +2 -0
- package/src/template/components/ArgumentAnnotation.tsx +58 -9
- package/src/template/components/ArgumentListAnnotation.tsx +50 -17
- package/src/template/components/Changelog/groups/FieldArgument.tsx +0 -1
- package/src/template/components/CodeBlock.tsx +1 -0
- package/src/template/components/Description.tsx +1 -1
- package/src/template/components/ExampleLink.tsx +2 -1
- package/src/template/components/Field.tsx +148 -20
- package/src/template/components/FieldList.tsx +28 -13
- package/src/template/components/FieldListSection.tsx +12 -2
- package/src/template/components/GraphQLDocument.tsx +2 -0
- package/src/template/components/GraphQLInteractive/GraphQLInteractive.tsx +6 -1
- package/src/template/components/GraphQLInteractive/lib/parser.ts +16 -3
- package/src/template/components/IAPIndicator.tsx +73 -0
- package/src/template/components/Link.tsx +9 -3
- package/src/template/components/NamedType.tsx +54 -28
- package/src/template/components/ReferenceLink.tsx +17 -10
- package/src/template/components/TypeAnnotation.tsx +17 -5
- package/src/template/components/ViewModeToggle.tsx +27 -0
- package/src/template/components/graphql/type-link.tsx +52 -9
- package/src/template/components/home/PlaygroundPreview.tsx +3 -0
- package/src/template/components/sidebar/SidebarItem.tsx +21 -5
- package/src/template/contexts/ReferenceConfigContext.tsx +37 -0
- package/src/template/contexts/ViewModeContext.tsx +64 -0
- package/src/template/hooks/useAlignedColumns.ts +19 -0
- package/src/template/routes/examples/name.tsx +13 -1
- package/src/template/routes/reference.tsx +67 -23
- package/src/types/virtual-modules.d.ts +5 -0
- package/src/vite/plugins/core.ts +6 -0
- package/src/vite/plugins/examples.ts +12 -0
- package/src/vite/plugins/index.ts +1 -0
- package/src/vite/plugins/navbar.ts +4 -1
- package/src/vite/plugins/reference.ts +130 -0
- package/build/lib/extensible-data/$.d.ts +0 -2
- package/build/lib/extensible-data/$.d.ts.map +0 -1
- package/build/lib/extensible-data/$.js +0 -2
- package/build/lib/extensible-data/$.js.map +0 -1
- package/build/lib/extensible-data/extensible-data.d.ts +0 -17
- package/build/lib/extensible-data/extensible-data.d.ts.map +0 -1
- package/build/lib/extensible-data/extensible-data.js +0 -24
- package/build/lib/extensible-data/extensible-data.js.map +0 -1
- package/build/lib/vite-plugin-reactive-data/$.d.ts +0 -2
- package/build/lib/vite-plugin-reactive-data/$.d.ts.map +0 -1
- package/build/lib/vite-plugin-reactive-data/$.js +0 -2
- package/build/lib/vite-plugin-reactive-data/$.js.map +0 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts +0 -32
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts.map +0 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js +0 -85
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js.map +0 -1
- package/build/template/components/ArgumentList.d.ts +0 -6
- package/build/template/components/ArgumentList.d.ts.map +0 -1
- package/build/template/components/ArgumentList.js +0 -9
- package/build/template/components/ArgumentList.js.map +0 -1
- package/src/lib/extensible-data/$.ts +0 -1
- package/src/lib/extensible-data/extensible-data.ts +0 -38
- package/src/lib/vite-plugin-reactive-data/$.ts +0 -1
- package/src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts +0 -124
- 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
|
-
}
|