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
@@ -7,20 +7,28 @@ import { Lifecycles } from '#lib/lifecycles/$'
|
|
7
7
|
import { route, useLoaderData } from '#lib/react-router-effect/react-router-effect'
|
8
8
|
import { Schema } from '#lib/schema/$'
|
9
9
|
import { Version } from '#lib/version/$'
|
10
|
+
import { SegmentedControl, Text } from '@radix-ui/themes'
|
10
11
|
import { Flex } from '@radix-ui/themes'
|
12
|
+
import { Str } from '@wollybeard/kit'
|
11
13
|
import { neverCase } from '@wollybeard/kit/language'
|
12
14
|
import { HashMap, Option } from 'effect'
|
13
15
|
import { Effect, Match } from 'effect'
|
14
16
|
import React from 'react'
|
15
|
-
import { useParams } from 'react-router'
|
17
|
+
import { redirect, useParams } from 'react-router'
|
18
|
+
import { templateConfig } from 'virtual:polen/project/config'
|
19
|
+
import { IndexComponent } from 'virtual:polen/project/reference'
|
16
20
|
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
17
21
|
import { Field } from '../components/Field.js'
|
18
22
|
import { TypeKindIcon } from '../components/graphql/graphql.js'
|
19
23
|
import { MissingSchema } from '../components/MissingSchema.js'
|
20
24
|
import { NamedType } from '../components/NamedType.js'
|
21
25
|
import { ReferenceVersionPicker } from '../components/ReferenceVersionPicker.js'
|
26
|
+
import { ViewModeToggle } from '../components/ViewModeToggle.js'
|
22
27
|
import { GraphqlLifecycleProvider } from '../contexts/GraphqlLifecycleContext.js'
|
28
|
+
import { ReferenceConfigProvider } from '../contexts/ReferenceConfigContext.js'
|
29
|
+
import { ViewModeProvider } from '../contexts/ViewModeContext.js'
|
23
30
|
import { SidebarLayout } from '../layouts/index.js'
|
31
|
+
import { MdxProvider } from '../providers/mdx.js'
|
24
32
|
|
25
33
|
const routeSchema = S.Struct({
|
26
34
|
catalog: Catalog.Catalog,
|
@@ -28,6 +36,17 @@ const routeSchema = S.Struct({
|
|
28
36
|
})
|
29
37
|
|
30
38
|
const referenceLoader = ({ params }: any) => {
|
39
|
+
// Check if reference is enabled
|
40
|
+
if (!templateConfig.reference.enabled) {
|
41
|
+
throw new Response('Reference documentation is disabled', { status: 404 })
|
42
|
+
}
|
43
|
+
|
44
|
+
// Check if no type is selected (index route) and no custom index exists
|
45
|
+
if (!params.type && !params.version && !IndexComponent) {
|
46
|
+
// Redirect to Query type which is guaranteed to exist
|
47
|
+
throw redirect('/reference/Query')
|
48
|
+
}
|
49
|
+
|
31
50
|
// This should never be called when schemasCatalog is null
|
32
51
|
// because the route won't be added to the router
|
33
52
|
// But we return an Effect.fail for safety
|
@@ -97,7 +116,7 @@ const ReferenceView = () => {
|
|
97
116
|
for (const [title, types] of kindEntries) {
|
98
117
|
sidebarItems.push({
|
99
118
|
type: `ItemSection` as const,
|
100
|
-
title,
|
119
|
+
title: Str.Case.title(Str.Case.snake(title)),
|
101
120
|
pathExp: `reference-${title.toLowerCase()}`,
|
102
121
|
isLinkToo: false,
|
103
122
|
links: types.map(type => {
|
@@ -130,7 +149,16 @@ const ReferenceView = () => {
|
|
130
149
|
|
131
150
|
const content: React.ReactNode = (() => {
|
132
151
|
if (viewType === 'index') {
|
133
|
-
|
152
|
+
// Render custom index component if available
|
153
|
+
if (IndexComponent) {
|
154
|
+
return (
|
155
|
+
<MdxProvider schema={schema.definition}>
|
156
|
+
<IndexComponent />
|
157
|
+
</MdxProvider>
|
158
|
+
)
|
159
|
+
}
|
160
|
+
// Fallback message (shouldn't reach here due to redirect)
|
161
|
+
return <Text>Select a type from the sidebar to view its documentation.</Text>
|
134
162
|
} else if (viewType === 'type-missing' || viewType === 'field-missing') {
|
135
163
|
return <MissingSchema />
|
136
164
|
} else if (viewType === 'type') {
|
@@ -151,26 +179,42 @@ const ReferenceView = () => {
|
|
151
179
|
}
|
152
180
|
})()
|
153
181
|
|
182
|
+
const referenceConfig = {
|
183
|
+
descriptionsView: templateConfig.reference.descriptionsView,
|
184
|
+
nullabilityRendering: templateConfig.reference.nullabilityRendering,
|
185
|
+
}
|
186
|
+
|
154
187
|
return (
|
155
|
-
<
|
156
|
-
<
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
188
|
+
<ReferenceConfigProvider config={referenceConfig}>
|
189
|
+
<ViewModeProvider defaultMode={referenceConfig.descriptionsView.defaultMode}>
|
190
|
+
<GraphqlLifecycleProvider lifecycle={lifecycle} schema={schema}>
|
191
|
+
<SidebarLayout
|
192
|
+
sidebar={sidebarItems}
|
193
|
+
basePath={basePath}
|
194
|
+
topContent={(() => {
|
195
|
+
const version = Schema.getVersion(schema)
|
196
|
+
const versionPicker = catalog._tag === 'CatalogVersioned' && version
|
197
|
+
? (
|
198
|
+
<ReferenceVersionPicker
|
199
|
+
data={Catalog.Versioned.getVersions(catalog)}
|
200
|
+
current={version}
|
201
|
+
/>
|
202
|
+
)
|
203
|
+
: null
|
204
|
+
|
205
|
+
return (
|
206
|
+
<Flex gap='3' align='center'>
|
207
|
+
{versionPicker}
|
208
|
+
{referenceConfig.descriptionsView.showControl && <ViewModeToggle />}
|
209
|
+
</Flex>
|
210
|
+
)
|
211
|
+
})()}
|
212
|
+
>
|
213
|
+
{content}
|
214
|
+
</SidebarLayout>
|
215
|
+
</GraphqlLifecycleProvider>
|
216
|
+
</ViewModeProvider>
|
217
|
+
</ReferenceConfigProvider>
|
174
218
|
)
|
175
219
|
}
|
176
220
|
|
@@ -207,7 +251,7 @@ const typeAndFieldRoutes = [
|
|
207
251
|
* - Single ReferenceView component handles all variations
|
208
252
|
*/
|
209
253
|
|
210
|
-
export const reference = !schemasCatalog
|
254
|
+
export const reference = !schemasCatalog || !templateConfig.reference.enabled
|
211
255
|
? null
|
212
256
|
: route({
|
213
257
|
path: `reference`,
|
@@ -35,6 +35,11 @@ declare module 'virtual:polen/project/examples' {
|
|
35
35
|
export const IndexComponent: React.ComponentType | null
|
36
36
|
}
|
37
37
|
|
38
|
+
declare module 'virtual:polen/project/reference' {
|
39
|
+
export const referenceCatalog: import('#api/reference/catalog').Catalog
|
40
|
+
export const IndexComponent: React.ComponentType | null
|
41
|
+
}
|
42
|
+
|
38
43
|
declare module 'virtual:polen/project/config' {
|
39
44
|
export const templateConfig: import('#api/config-template/template').TemplateConfig
|
40
45
|
}
|
package/src/vite/plugins/core.ts
CHANGED
@@ -10,6 +10,7 @@ import { Examples } from './examples.js'
|
|
10
10
|
import { Hooks, viProjectHooks } from './hooks.js'
|
11
11
|
import { Navbar, viProjectNavbar } from './navbar.js'
|
12
12
|
import { Pages, viProjectRoutes } from './pages.js'
|
13
|
+
import { Reference, viProjectReference } from './reference.js'
|
13
14
|
import { Schemas, viProjectSchema } from './schemas.js'
|
14
15
|
|
15
16
|
export interface ProjectRoutesModule {
|
@@ -44,6 +45,10 @@ export const Core = (config: Api.Config.Config): Vite.PluginOption[] => {
|
|
44
45
|
schemaReader: schemasArea.reader,
|
45
46
|
dependentVirtualModules: [viProjectConfig, viProjectNavbar],
|
46
47
|
})
|
48
|
+
const referenceArea = Reference({
|
49
|
+
config,
|
50
|
+
dependentVirtualModules: [viProjectConfig, viProjectNavbar],
|
51
|
+
})
|
47
52
|
const configPlugin = ConfigPlugin({
|
48
53
|
config,
|
49
54
|
schemaReader: schemasArea.reader,
|
@@ -62,6 +67,7 @@ export const Core = (config: Api.Config.Config): Vite.PluginOption[] => {
|
|
62
67
|
...conditionalPlugins,
|
63
68
|
...examplesArea.plugins,
|
64
69
|
...schemasArea.plugins,
|
70
|
+
...referenceArea.plugins,
|
65
71
|
...pagesArea.plugins,
|
66
72
|
configPlugin,
|
67
73
|
navbarPlugin,
|
@@ -121,6 +121,8 @@ export const Examples = ({
|
|
121
121
|
|| file.endsWith('.gql')
|
122
122
|
|| file.endsWith('index.md')
|
123
123
|
|| file.endsWith('index.mdx')
|
124
|
+
|| (file.endsWith('.md') && !file.endsWith('index.md'))
|
125
|
+
|| (file.endsWith('.mdx') && !file.endsWith('index.mdx'))
|
124
126
|
)
|
125
127
|
},
|
126
128
|
},
|
@@ -179,6 +181,16 @@ export const Examples = ({
|
|
179
181
|
s`export const IndexComponent = null`
|
180
182
|
}
|
181
183
|
|
184
|
+
// Export description components for each example
|
185
|
+
for (const example of scanExamplesResult.catalog.examples) {
|
186
|
+
if (example.description?.path) {
|
187
|
+
s``
|
188
|
+
s`export { default as DescriptionComponent_${
|
189
|
+
example.name.replace(/-/g, '_')
|
190
|
+
} } from '${example.description.path}'`
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
182
194
|
// Encode the catalog to ensure HashMap and other Effect types are properly serialized
|
183
195
|
const encodedCatalog = Catalog.encodeSync(catalogWithIndex)
|
184
196
|
|
@@ -46,7 +46,10 @@ export const Navbar = ({
|
|
46
46
|
>,
|
47
47
|
)
|
48
48
|
|
49
|
-
if (
|
49
|
+
// Check if reference is enabled (explicitly or auto-detected via schema presence)
|
50
|
+
const referenceEnabled = config.reference.enabled ?? Boolean(loadedSchemaCatalog?.data)
|
51
|
+
|
52
|
+
if (referenceEnabled && loadedSchemaCatalog?.data) {
|
50
53
|
// IMPORTANT: Always ensure paths start with '/' for React Router compatibility.
|
51
54
|
// Without the leading slash, React Router treats paths as relative, which causes
|
52
55
|
// hydration mismatches between SSR (where base path is prepended) and client
|
@@ -0,0 +1,130 @@
|
|
1
|
+
import type { Api } from '#api/$'
|
2
|
+
import * as ReferenceModule from '#api/reference/$'
|
3
|
+
import * as Catalog from '#api/reference/catalog'
|
4
|
+
import { Diagnostic } from '#lib/diagnostic/$'
|
5
|
+
import { ViteReactive } from '#lib/vite-reactive/$'
|
6
|
+
import { type AssetReader, createAssetReader } from '#lib/vite-reactive/reactive-asset-plugin'
|
7
|
+
import { ViteVirtual } from '#lib/vite-virtual'
|
8
|
+
import { debugPolen } from '#singletons/debug'
|
9
|
+
import { FileSystem } from '@effect/platform'
|
10
|
+
import * as NodeFileSystem from '@effect/platform-node/NodeFileSystem'
|
11
|
+
import { Str } from '@wollybeard/kit'
|
12
|
+
import { Effect } from 'effect'
|
13
|
+
import type * as Vite from 'vite'
|
14
|
+
import { polenVirtual } from '../vi.js'
|
15
|
+
|
16
|
+
// Virtual modules provided by this plugin
|
17
|
+
export const viProjectReference = polenVirtual([`project`, `reference`])
|
18
|
+
|
19
|
+
export interface Options {
|
20
|
+
config: Api.Config.Config
|
21
|
+
dependentVirtualModules?: ViteVirtual.Identifier.Identifier[]
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Reference plugin for handling reference documentation
|
26
|
+
*/
|
27
|
+
export const Reference = ({
|
28
|
+
config,
|
29
|
+
dependentVirtualModules = [],
|
30
|
+
}: Options): {
|
31
|
+
plugins: Vite.Plugin[]
|
32
|
+
reader: AssetReader<ReferenceModule.ScanResult, Error, FileSystem.FileSystem>
|
33
|
+
} => {
|
34
|
+
const debug = debugPolen.sub(`vite-reference`)
|
35
|
+
|
36
|
+
const reader = createAssetReader<ReferenceModule.ScanResult, Error, FileSystem.FileSystem>(() => {
|
37
|
+
return ReferenceModule.scan({
|
38
|
+
dir: config.paths.project.rootDir,
|
39
|
+
})
|
40
|
+
})
|
41
|
+
|
42
|
+
const scanReference = async () => {
|
43
|
+
return await Effect.runPromise(
|
44
|
+
reader.read().pipe(Effect.provide(NodeFileSystem.layer)),
|
45
|
+
)
|
46
|
+
}
|
47
|
+
|
48
|
+
// Map diagnostic to its control configuration
|
49
|
+
const getControlForDiagnostic = (diagnostic: any) => {
|
50
|
+
return config.reference.diagnostics?.validation
|
51
|
+
}
|
52
|
+
|
53
|
+
// Report diagnostics
|
54
|
+
const reportDiagnostics = (
|
55
|
+
diagnostics: any[],
|
56
|
+
phase: 'dev' | 'build' = 'dev',
|
57
|
+
) => {
|
58
|
+
Diagnostic.filterAndReport(diagnostics, getControlForDiagnostic, phase)
|
59
|
+
}
|
60
|
+
|
61
|
+
// Check if a file is the reference index file
|
62
|
+
const isReferenceIndexFile = (file: string): boolean => {
|
63
|
+
return file.endsWith('/reference/index.md') || file.endsWith('/reference/index.mdx')
|
64
|
+
}
|
65
|
+
|
66
|
+
const plugins: Vite.Plugin[] = [
|
67
|
+
ViteReactive.ReactiveAssetPlugin<ReferenceModule.ScanResult, Error, FileSystem.FileSystem>({
|
68
|
+
name: 'polen:reference-reactive',
|
69
|
+
reader,
|
70
|
+
filePatterns: {
|
71
|
+
watch: ['reference'],
|
72
|
+
isRelevant: (file: string) => {
|
73
|
+
return isReferenceIndexFile(file)
|
74
|
+
},
|
75
|
+
},
|
76
|
+
dependentVirtualModules: [viProjectReference, ...dependentVirtualModules],
|
77
|
+
hooks: {
|
78
|
+
async shouldFullReload() {
|
79
|
+
// Trigger full reload for reference changes
|
80
|
+
return true
|
81
|
+
},
|
82
|
+
async onDiagnostics(data: any) {
|
83
|
+
// Report diagnostics with DiagnosticControl filtering
|
84
|
+
reportDiagnostics(data.diagnostics, 'dev')
|
85
|
+
},
|
86
|
+
},
|
87
|
+
}),
|
88
|
+
{
|
89
|
+
name: 'polen:reference-virtual',
|
90
|
+
...ViteVirtual.IdentifiedLoader.toHooks(
|
91
|
+
{
|
92
|
+
identifier: viProjectReference,
|
93
|
+
async loader() {
|
94
|
+
debug(`Loading viProjectReference virtual module`)
|
95
|
+
|
96
|
+
const scanReferenceResult = await scanReference()
|
97
|
+
|
98
|
+
reportDiagnostics(scanReferenceResult.diagnostics, 'dev')
|
99
|
+
|
100
|
+
// Generate the module code with both catalog and component exports
|
101
|
+
const s = Str.Builder()
|
102
|
+
s`import { Effect } from 'effect'`
|
103
|
+
s`import * as Catalog from '#api/reference/catalog'`
|
104
|
+
|
105
|
+
const indexFilePath = scanReferenceResult.catalog.index?.path
|
106
|
+
if (indexFilePath) {
|
107
|
+
s``
|
108
|
+
s`export { default as IndexComponent } from '${indexFilePath}'`
|
109
|
+
} else {
|
110
|
+
s``
|
111
|
+
s`export const IndexComponent = null`
|
112
|
+
}
|
113
|
+
|
114
|
+
// Encode the catalog to ensure proper serialization
|
115
|
+
const encodedCatalog = Catalog.encodeSync(scanReferenceResult.catalog)
|
116
|
+
|
117
|
+
s``
|
118
|
+
s`const catalogData = ${JSON.stringify(encodedCatalog)}`
|
119
|
+
s``
|
120
|
+
s`export const referenceCatalog = Catalog.decodeSync(catalogData)`
|
121
|
+
|
122
|
+
return s.render()
|
123
|
+
},
|
124
|
+
},
|
125
|
+
),
|
126
|
+
},
|
127
|
+
]
|
128
|
+
|
129
|
+
return { plugins, reader }
|
130
|
+
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/extensible-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/extensible-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAA"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import type { ComputedRef } from '@vue/reactivity';
|
2
|
-
type Join<$Data> = (chunks: $Data[]) => $Data;
|
3
|
-
type Create<$Data> = () => $Data;
|
4
|
-
interface DataTypeOperations<$Data> {
|
5
|
-
join: Join<$Data>;
|
6
|
-
create: Create<$Data>;
|
7
|
-
}
|
8
|
-
export declare const create: <$Data extends object = object>(dataTypeOperations: DataTypeOperations<$Data>) => ExtensibleData<$Data>;
|
9
|
-
export declare class ExtensibleData<$Data extends object = object> {
|
10
|
-
value: ComputedRef<$Data>;
|
11
|
-
private namespacedReactiveData;
|
12
|
-
private dataTypeOperations;
|
13
|
-
constructor(dataTypeOperations: DataTypeOperations<$Data>);
|
14
|
-
get(namespace: string): $Data;
|
15
|
-
}
|
16
|
-
export {};
|
17
|
-
//# sourceMappingURL=extensible-data.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extensible-data.d.ts","sourceRoot":"","sources":["../../../src/lib/extensible-data/extensible-data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAA;AAEnE,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,CAAA;AAC7C,KAAK,MAAM,CAAC,KAAK,IAAI,MAAM,KAAK,CAAA;AAEhC,UAAU,kBAAkB,CAAC,KAAK;IAChC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACjB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;CACtB;AAED,eAAO,MAAM,MAAM,GAAI,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,oBAAoB,kBAAkB,CAAC,KAAK,CAAC,0BAElG,CAAA;AAED,qBAAa,cAAc,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM;IAChD,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAI9B;IAEF,OAAO,CAAC,sBAAsB,CAAqC;IAEnE,OAAO,CAAC,kBAAkB,CAA2B;gBAEzC,kBAAkB,EAAE,kBAAkB,CAAC,KAAK,CAAC;IAIzD,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK;CAO9B"}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { computed, reactive } from '@vue/reactivity';
|
2
|
-
export const create = (dataTypeOperations) => {
|
3
|
-
return new ExtensibleData(dataTypeOperations);
|
4
|
-
};
|
5
|
-
export class ExtensibleData {
|
6
|
-
value = computed(() => {
|
7
|
-
const namespacedDataItems = Array.from(this.namespacedReactiveData.values());
|
8
|
-
const data = this.dataTypeOperations.join(namespacedDataItems);
|
9
|
-
return data;
|
10
|
-
});
|
11
|
-
namespacedReactiveData = reactive(new Map());
|
12
|
-
dataTypeOperations;
|
13
|
-
constructor(dataTypeOperations) {
|
14
|
-
this.dataTypeOperations = dataTypeOperations;
|
15
|
-
}
|
16
|
-
get(namespace) {
|
17
|
-
if (!this.namespacedReactiveData.has(namespace)) {
|
18
|
-
const data = this.dataTypeOperations.create();
|
19
|
-
this.namespacedReactiveData.set(namespace, data);
|
20
|
-
}
|
21
|
-
return this.namespacedReactiveData.get(namespace);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
//# sourceMappingURL=extensible-data.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"extensible-data.js","sourceRoot":"","sources":["../../../src/lib/extensible-data/extensible-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAWpD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAgC,kBAA6C,EAAE,EAAE;IACrG,OAAO,IAAI,cAAc,CAAQ,kBAAkB,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,OAAO,cAAc;IAClB,KAAK,GAAuB,QAAQ,CAAC,GAAG,EAAE;QAC/C,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC,CAAA;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAA8B,CAAC,CAAA;QACzE,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IAEM,sBAAsB,GAAG,QAAQ,CAAC,IAAI,GAAG,EAAiB,CAAC,CAAA;IAE3D,kBAAkB,CAA2B;IAErD,YAAY,kBAA6C;QACvD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;IAC9C,CAAC;IAED,GAAG,CAAC,SAAiB;QACnB,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAA;YAC7C,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,EAAE,IAA8B,CAAC,CAAA;QAC5E,CAAC;QACD,OAAO,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAW,CAAA;IAC7D,CAAC;CACF"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,sBAAsB,MAAM,gCAAgC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,sBAAsB,MAAM,gCAAgC,CAAA"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import type { VitePluginJson } from '#lib/vite-plugin-json';
|
2
|
-
import { type ComputedRef } from '@vue/reactivity';
|
3
|
-
import type { Plugin } from 'vite';
|
4
|
-
interface ReactiveDataOptions {
|
5
|
-
/**
|
6
|
-
* Virtual module ID (e.g., 'virtual:polen/navbar') that this data will be exported from.
|
7
|
-
* The appropriate extension will be appended automatically based on moduleType.
|
8
|
-
*/
|
9
|
-
moduleId: string;
|
10
|
-
/**
|
11
|
-
* The reactive data to expose.
|
12
|
-
* Can be either:
|
13
|
-
* - A Vue computed ref (recommended)
|
14
|
-
* - A function that returns reactive data
|
15
|
-
* - A reactive value directly
|
16
|
-
*/
|
17
|
-
data: ComputedRef<object | unknown[]> | (() => object | unknown[]) | object | unknown[];
|
18
|
-
/**
|
19
|
-
* JSON codec to use
|
20
|
-
* Default: JSON
|
21
|
-
* Only used when includeJsonPlugin is true
|
22
|
-
*/
|
23
|
-
codec?: VitePluginJson.Codec;
|
24
|
-
/**
|
25
|
-
* Custom plugin name. Can use to help identify this plugin in logs if using many instances of this plugin.
|
26
|
-
@default 'reactive-data'
|
27
|
-
*/
|
28
|
-
name?: string;
|
29
|
-
}
|
30
|
-
export declare const create: (options: ReactiveDataOptions) => Plugin;
|
31
|
-
export {};
|
32
|
-
//# sourceMappingURL=vite-plugin-reactive-data.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"vite-plugin-reactive-data.d.ts","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,iBAAiB,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AAEjD,UAAU,mBAAmB;IAC3B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC,GAAG,MAAM,GAAG,OAAO,EAAE,CAAA;IACvF;;;;OAIG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAA;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAID,eAAO,MAAM,MAAM,GAAI,SAAS,mBAAmB,KAAG,MAyFrD,CAAA"}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
import { debugPolen } from '#singletons/debug';
|
2
|
-
import { effect, isRef } from '@vue/reactivity';
|
3
|
-
const pluginDebug = debugPolen.sub(`vite-reactive-data`);
|
4
|
-
export const create = (options) => {
|
5
|
-
const codec = options.codec ?? JSON;
|
6
|
-
const moduleId = options.moduleId;
|
7
|
-
const name = options.name ?? `reactive-data`;
|
8
|
-
const debug = pluginDebug.sub(name);
|
9
|
-
debug(`constructor`, { moduleId });
|
10
|
-
let $server;
|
11
|
-
let $invalidationScheduled = false;
|
12
|
-
const tryInvalidate = () => {
|
13
|
-
$invalidationScheduled = false;
|
14
|
-
if (!$server)
|
15
|
-
throw new Error(`Server not available yet - this should be impossible`);
|
16
|
-
const moduleNode = $server.moduleGraph.getModuleById(moduleId);
|
17
|
-
if (moduleNode) {
|
18
|
-
debug(`invalidate`, { id: moduleNode.id });
|
19
|
-
$server.moduleGraph.invalidateModule(moduleNode);
|
20
|
-
}
|
21
|
-
else {
|
22
|
-
debug(`cannot invalidate`, {
|
23
|
-
reason: `notInModuleGraph`,
|
24
|
-
moduleId,
|
25
|
-
hint: `maybe it was not loaded yet`,
|
26
|
-
});
|
27
|
-
}
|
28
|
-
};
|
29
|
-
const scheduleInvalidate = () => {
|
30
|
-
if ($invalidationScheduled)
|
31
|
-
return; // already scheduled
|
32
|
-
$invalidationScheduled = true;
|
33
|
-
if (!$server)
|
34
|
-
return; // server will flush when ready
|
35
|
-
tryInvalidate();
|
36
|
-
};
|
37
|
-
// Helper to get the current data value
|
38
|
-
const getData = () => {
|
39
|
-
if (isRef(options.data)) {
|
40
|
-
return options.data.value;
|
41
|
-
}
|
42
|
-
else if (typeof options.data === `function`) {
|
43
|
-
return options.data();
|
44
|
-
}
|
45
|
-
else {
|
46
|
-
return options.data;
|
47
|
-
}
|
48
|
-
};
|
49
|
-
// Set up reactive effect immediately
|
50
|
-
effect(() => {
|
51
|
-
// Access data to track dependencies
|
52
|
-
const data = getData();
|
53
|
-
debug(`effect triggered`, { data });
|
54
|
-
scheduleInvalidate();
|
55
|
-
});
|
56
|
-
return {
|
57
|
-
name,
|
58
|
-
configureServer(_server) {
|
59
|
-
debug(`hook configureServer`);
|
60
|
-
$server = _server;
|
61
|
-
if ($invalidationScheduled) {
|
62
|
-
debug(`try invalidate scheduled before server was ready`);
|
63
|
-
tryInvalidate();
|
64
|
-
}
|
65
|
-
},
|
66
|
-
resolveId(id) {
|
67
|
-
if (id === moduleId) {
|
68
|
-
return moduleId;
|
69
|
-
}
|
70
|
-
},
|
71
|
-
// todo make use of Vite's builtin json plugin
|
72
|
-
// for example, call it here somehow
|
73
|
-
load(id) {
|
74
|
-
if (id !== moduleId)
|
75
|
-
return;
|
76
|
-
const data = getData();
|
77
|
-
debug(`hook load`, { data });
|
78
|
-
return {
|
79
|
-
code: codec.stringify(data),
|
80
|
-
map: null,
|
81
|
-
};
|
82
|
-
},
|
83
|
-
};
|
84
|
-
};
|
85
|
-
//# sourceMappingURL=vite-plugin-reactive-data.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"vite-plugin-reactive-data.js","sourceRoot":"","sources":["../../../src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts"],"names":[],"mappings":"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"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ArgumentList.d.ts","sourceRoot":"","sources":["../../../src/template/components/ArgumentList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,CAgBxE,CAAA"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
3
|
-
import { TypeAnnotation } from './TypeAnnotation.js';
|
4
|
-
export const ArgumentsList = ({ args }) => {
|
5
|
-
if (args.length === 0)
|
6
|
-
return null;
|
7
|
-
return (_jsxs(Flex, { direction: 'column', children: [_jsx(Heading, { size: '1', weight: 'bold', children: "Arguments" }), args.map(arg => (_jsxs(Box, { children: [_jsx(Text, { children: arg.name }), _jsx(Text, { children: ":" }), _jsx(TypeAnnotation, { type: arg.type }), arg.description && _jsx(Text, { as: 'p', size: '2', color: 'gray', children: arg.description })] }, arg.name)))] }));
|
8
|
-
};
|
9
|
-
//# sourceMappingURL=ArgumentList.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ArgumentList.js","sourceRoot":"","sources":["../../../src/template/components/ArgumentList.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,CAAC,MAAM,aAAa,GAAmD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IACxF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAElC,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,aACtB,KAAC,OAAO,IAAC,IAAI,EAAC,GAAG,EAAC,MAAM,EAAC,MAAM,0BAAoB,EAClD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACf,MAAC,GAAG,eACF,KAAC,IAAI,cAAE,GAAG,CAAC,IAAI,GAAQ,EACvB,KAAC,IAAI,oBAAS,EACd,KAAC,cAAc,IAAC,IAAI,EAAE,GAAG,CAAC,IAAI,GAAI,EACjC,GAAG,CAAC,WAAW,IAAI,KAAC,IAAI,IAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,KAAK,EAAC,MAAM,YAAE,GAAG,CAAC,WAAW,GAAQ,KAJvE,GAAG,CAAC,IAAI,CAKZ,CACP,CAAC,IACG,CACR,CAAA;AACH,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * as ExtensibleData from './extensible-data.js'
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { computed, reactive } from '@vue/reactivity'
|
2
|
-
import type { ComputedRef, UnwrapRefSimple } from '@vue/reactivity'
|
3
|
-
|
4
|
-
type Join<$Data> = (chunks: $Data[]) => $Data
|
5
|
-
type Create<$Data> = () => $Data
|
6
|
-
|
7
|
-
interface DataTypeOperations<$Data> {
|
8
|
-
join: Join<$Data>
|
9
|
-
create: Create<$Data>
|
10
|
-
}
|
11
|
-
|
12
|
-
export const create = <$Data extends object = object>(dataTypeOperations: DataTypeOperations<$Data>) => {
|
13
|
-
return new ExtensibleData<$Data>(dataTypeOperations)
|
14
|
-
}
|
15
|
-
|
16
|
-
export class ExtensibleData<$Data extends object = object> {
|
17
|
-
public value: ComputedRef<$Data> = computed(() => {
|
18
|
-
const namespacedDataItems = Array.from(this.namespacedReactiveData.values())
|
19
|
-
const data = this.dataTypeOperations.join(namespacedDataItems as $Data[])
|
20
|
-
return data
|
21
|
-
})
|
22
|
-
|
23
|
-
private namespacedReactiveData = reactive(new Map<string, $Data>())
|
24
|
-
|
25
|
-
private dataTypeOperations: DataTypeOperations<$Data>
|
26
|
-
|
27
|
-
constructor(dataTypeOperations: DataTypeOperations<$Data>) {
|
28
|
-
this.dataTypeOperations = dataTypeOperations
|
29
|
-
}
|
30
|
-
|
31
|
-
get(namespace: string): $Data {
|
32
|
-
if (!this.namespacedReactiveData.has(namespace)) {
|
33
|
-
const data = this.dataTypeOperations.create()
|
34
|
-
this.namespacedReactiveData.set(namespace, data as UnwrapRefSimple<$Data>)
|
35
|
-
}
|
36
|
-
return this.namespacedReactiveData.get(namespace)! as $Data
|
37
|
-
}
|
38
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * as VitePluginReactiveData from './vite-plugin-reactive-data.js'
|