polen 0.10.0-next.15 → 0.10.0-next.16
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/README.md +7 -6
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +9 -8
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/lib/graphql-change/change-groups.d.ts +52 -0
- package/build/lib/graphql-change/change-groups.d.ts.map +1 -0
- package/build/lib/graphql-change/change-groups.js +33 -0
- package/build/lib/graphql-change/change-groups.js.map +1 -0
- package/build/lib/graphql-change/change-types.d.ts +170 -0
- package/build/lib/graphql-change/change-types.d.ts.map +1 -0
- package/build/lib/graphql-change/change-types.js +11 -0
- package/build/lib/graphql-change/change-types.js.map +1 -0
- package/build/lib/graphql-change/criticality.d.ts +26 -0
- package/build/lib/graphql-change/criticality.d.ts.map +1 -0
- package/build/lib/graphql-change/criticality.js +30 -0
- package/build/lib/graphql-change/criticality.js.map +1 -0
- package/build/lib/graphql-change/graphql-change.d.ts +5 -6
- package/build/lib/graphql-change/graphql-change.d.ts.map +1 -1
- package/build/lib/graphql-change/graphql-change.js +4 -0
- package/build/lib/graphql-change/graphql-change.js.map +1 -1
- package/build/template/components/Changelog/ChangeBase.d.ts +9 -0
- package/build/template/components/Changelog/ChangeBase.d.ts.map +1 -0
- package/build/template/components/Changelog/ChangeBase.js +5 -0
- package/build/template/components/Changelog/ChangeBase.js.map +1 -0
- package/build/template/components/Changelog/CriticalitySection.d.ts +11 -0
- package/build/template/components/Changelog/CriticalitySection.d.ts.map +1 -0
- package/build/template/components/Changelog/CriticalitySection.js +11 -0
- package/build/template/components/Changelog/CriticalitySection.js.map +1 -0
- package/build/template/components/Changelog/changes/index.d.ts +2 -0
- package/build/template/components/Changelog/changes/index.d.ts.map +1 -0
- package/build/template/components/Changelog/changes/index.js +2 -0
- package/build/template/components/Changelog/changes/index.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveArgument.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveArgument.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveArgument.js +12 -0
- package/build/template/components/Changelog/groups/DirectiveArgument.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentDescription.js +7 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentOperation.js +12 -0
- package/build/template/components/Changelog/groups/DirectiveArgumentOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveDescription.js +7 -0
- package/build/template/components/Changelog/groups/DirectiveDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveLocationOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveLocationOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveLocationOperation.js +12 -0
- package/build/template/components/Changelog/groups/DirectiveLocationOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveOperation.js +12 -0
- package/build/template/components/Changelog/groups/DirectiveOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveUsage.d.ts +6 -0
- package/build/template/components/Changelog/groups/DirectiveUsage.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/DirectiveUsage.js +59 -0
- package/build/template/components/Changelog/groups/DirectiveUsage.js.map +1 -0
- package/build/template/components/Changelog/groups/EnumValueDeprecationReason.d.ts +6 -0
- package/build/template/components/Changelog/groups/EnumValueDeprecationReason.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/EnumValueDeprecationReason.js +14 -0
- package/build/template/components/Changelog/groups/EnumValueDeprecationReason.js.map +1 -0
- package/build/template/components/Changelog/groups/EnumValueDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/EnumValueDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/EnumValueDescription.js +7 -0
- package/build/template/components/Changelog/groups/EnumValueDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/EnumValueOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/EnumValueOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/EnumValueOperation.js +12 -0
- package/build/template/components/Changelog/groups/EnumValueOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldArgument.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldArgument.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldArgument.js +12 -0
- package/build/template/components/Changelog/groups/FieldArgument.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldArgumentDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldArgumentDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldArgumentDescription.js +7 -0
- package/build/template/components/Changelog/groups/FieldArgumentDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldArgumentOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldArgumentOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldArgumentOperation.js +12 -0
- package/build/template/components/Changelog/groups/FieldArgumentOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldDeprecation.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldDeprecation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldDeprecation.js +12 -0
- package/build/template/components/Changelog/groups/FieldDeprecation.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldDeprecationReason.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldDeprecationReason.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldDeprecationReason.js +14 -0
- package/build/template/components/Changelog/groups/FieldDeprecationReason.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldDescription.js +14 -0
- package/build/template/components/Changelog/groups/FieldDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/FieldOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/FieldOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/FieldOperation.js +14 -0
- package/build/template/components/Changelog/groups/FieldOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/InputFieldDefaultValue.d.ts +6 -0
- package/build/template/components/Changelog/groups/InputFieldDefaultValue.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/InputFieldDefaultValue.js +7 -0
- package/build/template/components/Changelog/groups/InputFieldDefaultValue.js.map +1 -0
- package/build/template/components/Changelog/groups/InputFieldDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/InputFieldDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/InputFieldDescription.js +14 -0
- package/build/template/components/Changelog/groups/InputFieldDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/InputFieldOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/InputFieldOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/InputFieldOperation.js +14 -0
- package/build/template/components/Changelog/groups/InputFieldOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/ObjectTypeInterfaceOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/ObjectTypeInterfaceOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/ObjectTypeInterfaceOperation.js +12 -0
- package/build/template/components/Changelog/groups/ObjectTypeInterfaceOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/SchemaRootType.d.ts +6 -0
- package/build/template/components/Changelog/groups/SchemaRootType.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/SchemaRootType.js +14 -0
- package/build/template/components/Changelog/groups/SchemaRootType.js.map +1 -0
- package/build/template/components/Changelog/groups/TypeDescription.d.ts +6 -0
- package/build/template/components/Changelog/groups/TypeDescription.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/TypeDescription.js +14 -0
- package/build/template/components/Changelog/groups/TypeDescription.js.map +1 -0
- package/build/template/components/Changelog/groups/TypeOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/TypeOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/TypeOperation.js +14 -0
- package/build/template/components/Changelog/groups/TypeOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/UnionMemberOperation.d.ts +6 -0
- package/build/template/components/Changelog/groups/UnionMemberOperation.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/UnionMemberOperation.js +12 -0
- package/build/template/components/Changelog/groups/UnionMemberOperation.js.map +1 -0
- package/build/template/components/Changelog/groups/index.d.ts +26 -0
- package/build/template/components/Changelog/groups/index.d.ts.map +1 -0
- package/build/template/components/Changelog/groups/index.js +26 -0
- package/build/template/components/Changelog/groups/index.js.map +1 -0
- package/build/template/components/Changelog.d.ts.map +1 -1
- package/build/template/components/Changelog.js +108 -27
- package/build/template/components/Changelog.js.map +1 -1
- package/build/template/components/ChangelogLayout.d.ts +9 -0
- package/build/template/components/ChangelogLayout.d.ts.map +1 -0
- package/build/template/components/ChangelogLayout.js +71 -0
- package/build/template/components/ChangelogLayout.js.map +1 -0
- package/build/template/components/layouts/SidebarLayout.d.ts +9 -0
- package/build/template/components/layouts/SidebarLayout.d.ts.map +1 -0
- package/build/template/components/layouts/SidebarLayout.js +25 -0
- package/build/template/components/layouts/SidebarLayout.js.map +1 -0
- package/build/template/components/layouts/index.d.ts +2 -0
- package/build/template/components/layouts/index.d.ts.map +1 -0
- package/build/template/components/layouts/index.js +2 -0
- package/build/template/components/layouts/index.js.map +1 -0
- package/build/template/routes/changelog.d.ts.map +1 -1
- package/build/template/routes/changelog.js +2 -1
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/reference.d.ts +2 -1
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +20 -1
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +5 -65
- package/build/template/routes/root.js.map +1 -1
- package/package.json +2 -1
- package/src/api/vite/plugins/core.ts +9 -8
- package/src/lib/graphql-change/change-groups.ts +250 -0
- package/src/lib/graphql-change/change-types.ts +203 -0
- package/src/lib/graphql-change/criticality.ts +45 -0
- package/src/lib/graphql-change/graphql-change.ts +7 -5
- package/src/template/components/Changelog/ChangeBase.tsx +15 -0
- package/src/template/components/Changelog/CriticalitySection.tsx +29 -0
- package/src/template/components/Changelog/changes/index.ts +1 -0
- package/src/template/components/Changelog/groups/DirectiveArgument.tsx +25 -0
- package/src/template/components/Changelog/groups/DirectiveArgumentDescription.tsx +15 -0
- package/src/template/components/Changelog/groups/DirectiveArgumentOperation.tsx +25 -0
- package/src/template/components/Changelog/groups/DirectiveDescription.tsx +12 -0
- package/src/template/components/Changelog/groups/DirectiveLocationOperation.tsx +25 -0
- package/src/template/components/Changelog/groups/DirectiveOperation.tsx +21 -0
- package/src/template/components/Changelog/groups/DirectiveUsage.tsx +137 -0
- package/src/template/components/Changelog/groups/EnumValueDeprecationReason.tsx +32 -0
- package/src/template/components/Changelog/groups/EnumValueDescription.tsx +12 -0
- package/src/template/components/Changelog/groups/EnumValueOperation.tsx +21 -0
- package/src/template/components/Changelog/groups/FieldArgument.tsx +26 -0
- package/src/template/components/Changelog/groups/FieldArgumentDescription.tsx +15 -0
- package/src/template/components/Changelog/groups/FieldArgumentOperation.tsx +26 -0
- package/src/template/components/Changelog/groups/FieldDeprecation.tsx +21 -0
- package/src/template/components/Changelog/groups/FieldDeprecationReason.tsx +33 -0
- package/src/template/components/Changelog/groups/FieldDescription.tsx +27 -0
- package/src/template/components/Changelog/groups/FieldOperation.tsx +28 -0
- package/src/template/components/Changelog/groups/InputFieldDefaultValue.tsx +16 -0
- package/src/template/components/Changelog/groups/InputFieldDescription.tsx +30 -0
- package/src/template/components/Changelog/groups/InputFieldOperation.tsx +29 -0
- package/src/template/components/Changelog/groups/ObjectTypeInterfaceOperation.tsx +25 -0
- package/src/template/components/Changelog/groups/SchemaRootType.tsx +31 -0
- package/src/template/components/Changelog/groups/TypeDescription.tsx +27 -0
- package/src/template/components/Changelog/groups/TypeOperation.tsx +27 -0
- package/src/template/components/Changelog/groups/UnionMemberOperation.tsx +21 -0
- package/src/template/components/Changelog/groups/index.ts +25 -0
- package/src/template/components/Changelog.tsx +96 -63
- package/src/template/components/ChangelogLayout.tsx +157 -0
- package/src/template/components/layouts/SidebarLayout.tsx +68 -0
- package/src/template/components/layouts/index.ts +1 -0
- package/src/template/routes/changelog.tsx +6 -1
- package/src/template/routes/reference.tsx +25 -2
- package/src/template/routes/root.tsx +5 -103
@@ -0,0 +1,157 @@
|
|
1
|
+
import {
|
2
|
+
CRITICALITY_CONFIG,
|
3
|
+
isCriticalityBreaking,
|
4
|
+
isCriticalityDangerous,
|
5
|
+
isCriticalitySafe,
|
6
|
+
} from '#lib/graphql-change/criticality'
|
7
|
+
import type { GraphqlChangeset } from '#lib/graphql-changeset/index'
|
8
|
+
import { Box, Flex, Text } from '@radix-ui/themes'
|
9
|
+
import type React from 'react'
|
10
|
+
import { useEffect, useState } from 'react'
|
11
|
+
import { renderDate } from './Changelog.js'
|
12
|
+
|
13
|
+
interface ChangelogLayoutProps {
|
14
|
+
children: React.ReactNode
|
15
|
+
versions: GraphqlChangeset.ChangeSet[]
|
16
|
+
}
|
17
|
+
|
18
|
+
interface VersionCounts {
|
19
|
+
breaking: number
|
20
|
+
dangerous: number
|
21
|
+
safe: number
|
22
|
+
}
|
23
|
+
|
24
|
+
const calculateCounts = (version: GraphqlChangeset.ChangeSet): VersionCounts => {
|
25
|
+
return {
|
26
|
+
breaking: version.changes.filter(isCriticalityBreaking).length,
|
27
|
+
dangerous: version.changes.filter(isCriticalityDangerous).length,
|
28
|
+
safe: version.changes.filter(isCriticalitySafe).length,
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
const SidebarEntry: React.FC<{
|
33
|
+
version: GraphqlChangeset.ChangeSet
|
34
|
+
counts: VersionCounts
|
35
|
+
isActive: boolean
|
36
|
+
}> = ({ version, counts, isActive }) => {
|
37
|
+
const dateId = version.date.toISOString()
|
38
|
+
|
39
|
+
return (
|
40
|
+
<Box mb='2'>
|
41
|
+
<a
|
42
|
+
href={`#${dateId}`}
|
43
|
+
style={{
|
44
|
+
textDecoration: 'none',
|
45
|
+
display: 'flex',
|
46
|
+
alignItems: 'center',
|
47
|
+
justifyContent: 'space-between',
|
48
|
+
padding: '0.5rem 0.75rem',
|
49
|
+
borderRadius: '4px',
|
50
|
+
backgroundColor: isActive ? 'var(--gray-a3)' : 'transparent',
|
51
|
+
color: 'inherit',
|
52
|
+
transition: 'background-color 0.2s',
|
53
|
+
}}
|
54
|
+
onClick={(e) => {
|
55
|
+
e.preventDefault()
|
56
|
+
document.getElementById(dateId)?.scrollIntoView({ behavior: 'smooth' })
|
57
|
+
}}
|
58
|
+
>
|
59
|
+
<Text size='2' weight={isActive ? 'medium' : 'regular'}>
|
60
|
+
{renderDate(version.date)}
|
61
|
+
</Text>
|
62
|
+
<Flex gap='2' align='center'>
|
63
|
+
{counts.breaking > 0 && (
|
64
|
+
<Text size='1' weight='medium' style={{ color: CRITICALITY_CONFIG.BREAKING.color }}>
|
65
|
+
{counts.breaking}
|
66
|
+
</Text>
|
67
|
+
)}
|
68
|
+
{counts.dangerous > 0 && (
|
69
|
+
<Text size='1' weight='medium' style={{ color: CRITICALITY_CONFIG.DANGEROUS.color }}>
|
70
|
+
{counts.dangerous}
|
71
|
+
</Text>
|
72
|
+
)}
|
73
|
+
{counts.safe > 0 && (
|
74
|
+
<Text size='1' weight='medium' style={{ color: CRITICALITY_CONFIG.NON_BREAKING.color }}>
|
75
|
+
{counts.safe}
|
76
|
+
</Text>
|
77
|
+
)}
|
78
|
+
</Flex>
|
79
|
+
</a>
|
80
|
+
</Box>
|
81
|
+
)
|
82
|
+
}
|
83
|
+
|
84
|
+
export const ChangelogLayout: React.FC<ChangelogLayoutProps> = ({ children, versions }) => {
|
85
|
+
const [activeVersion, setActiveVersion] = useState<string | null>(null)
|
86
|
+
|
87
|
+
// Calculate counts for all versions (SSR-safe)
|
88
|
+
const versionsWithCounts = versions.map(version => ({
|
89
|
+
version,
|
90
|
+
counts: calculateCounts(version),
|
91
|
+
}))
|
92
|
+
|
93
|
+
// Set up scroll spy after hydration
|
94
|
+
useEffect(() => {
|
95
|
+
const handleScroll = () => {
|
96
|
+
const scrollPosition = window.scrollY + 100 // Offset for header
|
97
|
+
|
98
|
+
// Find the current version based on scroll position
|
99
|
+
let currentVersion: string | null = null
|
100
|
+
|
101
|
+
for (const { version } of versionsWithCounts) {
|
102
|
+
const element = document.getElementById(version.date.toISOString())
|
103
|
+
if (element) {
|
104
|
+
const { top } = element.getBoundingClientRect()
|
105
|
+
if (top <= 100) {
|
106
|
+
currentVersion = version.date.toISOString()
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
setActiveVersion(currentVersion)
|
112
|
+
}
|
113
|
+
|
114
|
+
// Initial check
|
115
|
+
handleScroll()
|
116
|
+
|
117
|
+
// Add scroll listener
|
118
|
+
window.addEventListener('scroll', handleScroll, { passive: true })
|
119
|
+
|
120
|
+
return () => {
|
121
|
+
window.removeEventListener('scroll', handleScroll)
|
122
|
+
}
|
123
|
+
}, [versionsWithCounts])
|
124
|
+
|
125
|
+
return (
|
126
|
+
<Flex gap='6' style={{ position: 'relative' }}>
|
127
|
+
{/* Sidebar */}
|
128
|
+
<Box
|
129
|
+
style={{
|
130
|
+
position: 'sticky',
|
131
|
+
top: '2rem',
|
132
|
+
height: 'fit-content',
|
133
|
+
minWidth: '250px',
|
134
|
+
maxHeight: 'calc(100vh - 4rem)',
|
135
|
+
overflowY: 'auto',
|
136
|
+
}}
|
137
|
+
>
|
138
|
+
<Text size='2' weight='medium' mb='3' style={{ display: 'block' }}>
|
139
|
+
Releases
|
140
|
+
</Text>
|
141
|
+
{versionsWithCounts.map(({ version, counts }) => (
|
142
|
+
<SidebarEntry
|
143
|
+
key={version.date.toISOString()}
|
144
|
+
version={version}
|
145
|
+
counts={counts}
|
146
|
+
isActive={activeVersion === version.date.toISOString()}
|
147
|
+
/>
|
148
|
+
))}
|
149
|
+
</Box>
|
150
|
+
|
151
|
+
{/* Main content */}
|
152
|
+
<Box style={{ flex: 1, minWidth: 0 }}>
|
153
|
+
{children}
|
154
|
+
</Box>
|
155
|
+
</Flex>
|
156
|
+
)
|
157
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import type { Content } from '#api/content/$'
|
2
|
+
import { Box, Grid } from '@radix-ui/themes'
|
3
|
+
import type React from 'react'
|
4
|
+
import { useEffect, useState } from 'react'
|
5
|
+
import { useLocation } from 'react-router'
|
6
|
+
import { HamburgerMenu } from '../HamburgerMenu.js'
|
7
|
+
import { Sidebar } from '../sidebar/Sidebar.js'
|
8
|
+
|
9
|
+
interface SidebarLayoutProps {
|
10
|
+
children: React.ReactNode
|
11
|
+
sidebar: Content.Item[]
|
12
|
+
}
|
13
|
+
|
14
|
+
export const SidebarLayout: React.FC<SidebarLayoutProps> = ({ children, sidebar }) => {
|
15
|
+
const location = useLocation()
|
16
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
17
|
+
|
18
|
+
// Close mobile menu on route change
|
19
|
+
useEffect(() => {
|
20
|
+
setMobileMenuOpen(false)
|
21
|
+
}, [location.pathname])
|
22
|
+
|
23
|
+
const isShowSidebar = sidebar && sidebar.length > 0
|
24
|
+
|
25
|
+
return (
|
26
|
+
<Grid
|
27
|
+
areas={{
|
28
|
+
initial: `'content'`,
|
29
|
+
sm: `'content'`,
|
30
|
+
md: `'sidebar sidebar . content content content content content'`,
|
31
|
+
}}
|
32
|
+
rows='auto'
|
33
|
+
columns={{ initial: `1fr`, sm: `1fr`, md: `repeat(8, 1fr)` }}
|
34
|
+
gapX={{ initial: `0`, sm: `0`, md: `2` }}
|
35
|
+
>
|
36
|
+
{/* Mobile menu - only show when sidebar exists */}
|
37
|
+
{isShowSidebar && (
|
38
|
+
<Box display={{ initial: `block`, md: `none` }} mb='4'>
|
39
|
+
<HamburgerMenu
|
40
|
+
isOpen={mobileMenuOpen}
|
41
|
+
onToggle={() => {
|
42
|
+
setMobileMenuOpen(!mobileMenuOpen)
|
43
|
+
}}
|
44
|
+
onClose={() => {
|
45
|
+
setMobileMenuOpen(false)
|
46
|
+
}}
|
47
|
+
sidebarData={sidebar}
|
48
|
+
/>
|
49
|
+
</Box>
|
50
|
+
)}
|
51
|
+
|
52
|
+
{/* Desktop Sidebar */}
|
53
|
+
{isShowSidebar && (
|
54
|
+
<Box
|
55
|
+
display={{ initial: `none`, xs: `none`, sm: `none`, md: `block` }}
|
56
|
+
gridColumn='1 / 3'
|
57
|
+
gridRow='1 / auto'
|
58
|
+
>
|
59
|
+
<Sidebar data={sidebar} />
|
60
|
+
</Box>
|
61
|
+
)}
|
62
|
+
|
63
|
+
<Box gridArea='content / content / auto / 8' className='prose'>
|
64
|
+
{children}
|
65
|
+
</Box>
|
66
|
+
</Grid>
|
67
|
+
)
|
68
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './SidebarLayout.js'
|
@@ -2,6 +2,7 @@ import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
|
2
2
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
3
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
4
4
|
import { Changelog } from '../components/Changelog.js'
|
5
|
+
import { ChangelogLayout } from '../components/ChangelogLayout.js'
|
5
6
|
|
6
7
|
const loader = createLoader(() => {
|
7
8
|
return {
|
@@ -16,7 +17,11 @@ const Component = () => {
|
|
16
17
|
return <div>No data to show. There is no schema is.</div>
|
17
18
|
}
|
18
19
|
|
19
|
-
return
|
20
|
+
return (
|
21
|
+
<ChangelogLayout versions={data.schema.versions}>
|
22
|
+
<Changelog schema={data.schema} />
|
23
|
+
</ChangelogLayout>
|
24
|
+
)
|
20
25
|
}
|
21
26
|
|
22
27
|
export const changelog = createRoute({
|
@@ -1,8 +1,11 @@
|
|
1
|
+
import type { Content } from '#api/content/$'
|
2
|
+
import { GrafaidOld } from '#lib/grafaid-old/index'
|
1
3
|
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
4
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
5
|
import { Box } from '@radix-ui/themes'
|
4
6
|
import { Outlet } from 'react-router'
|
5
7
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
8
|
+
import { SidebarLayout } from '../components/layouts/index.js'
|
6
9
|
import { MissingSchema } from '../components/MissingSchema.js'
|
7
10
|
import { reference$type } from './reference.$type.js'
|
8
11
|
|
@@ -20,10 +23,30 @@ const Component = () => {
|
|
20
23
|
return <MissingSchema />
|
21
24
|
}
|
22
25
|
|
26
|
+
// Build reference sidebar from schema types
|
27
|
+
const kindMap = GrafaidOld.getKindMap(data.schema)
|
28
|
+
|
29
|
+
const sidebarItems: Content.Item[] = []
|
30
|
+
const kindEntries = Object.entries(kindMap.list).filter(([_, types]) => types.length > 0)
|
31
|
+
|
32
|
+
for (const [title, types] of kindEntries) {
|
33
|
+
sidebarItems.push({
|
34
|
+
type: `ItemSection` as const,
|
35
|
+
title,
|
36
|
+
pathExp: `reference-${title.toLowerCase()}`,
|
37
|
+
isLinkToo: false,
|
38
|
+
links: types.map(type => ({
|
39
|
+
type: `ItemLink` as const,
|
40
|
+
title: type.name,
|
41
|
+
pathExp: `reference/${type.name}`,
|
42
|
+
})),
|
43
|
+
})
|
44
|
+
}
|
45
|
+
|
23
46
|
return (
|
24
|
-
<
|
47
|
+
<SidebarLayout sidebar={sidebarItems}>
|
25
48
|
<Outlet />
|
26
|
-
</
|
49
|
+
</SidebarLayout>
|
27
50
|
)
|
28
51
|
}
|
29
52
|
|
@@ -1,25 +1,18 @@
|
|
1
|
-
import type { Content } from '#api/content/$'
|
2
1
|
import type { ReactRouter } from '#dep/react-router/index'
|
3
|
-
import { GrafaidOld } from '#lib/grafaid-old/index'
|
4
2
|
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
5
|
-
import { Box
|
3
|
+
import { Box } from '@radix-ui/themes'
|
6
4
|
import { Flex, Theme } from '@radix-ui/themes'
|
7
|
-
import { Arr } from '@wollybeard/kit'
|
8
|
-
import { useEffect, useState } from 'react'
|
9
5
|
import { Link as LinkReactRouter } from 'react-router'
|
10
|
-
import { Outlet, ScrollRestoration
|
6
|
+
import { Outlet, ScrollRestoration } from 'react-router'
|
11
7
|
import logoSrc from 'virtual:polen/project/assets/logo.svg'
|
12
8
|
import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
|
13
|
-
import projectPagesCatalog from 'virtual:polen/project/data/pages-catalog.jsonsuper'
|
14
9
|
import { routes } from 'virtual:polen/project/routes.jsx'
|
15
10
|
import { templateVariables } from 'virtual:polen/template/variables'
|
16
11
|
import { GraphQLSchemaProvider } from '../../lib/graphql-document/schema-context.js'
|
17
12
|
import { CodeBlockEnhancer } from '../components/CodeBlockEnhancer.js'
|
18
|
-
import { HamburgerMenu } from '../components/HamburgerMenu.js'
|
19
13
|
import { Link } from '../components/Link.js'
|
20
14
|
import { Logo } from '../components/Logo.js'
|
21
15
|
import { NotFound } from '../components/NotFound.js'
|
22
|
-
import { Sidebar } from '../components/sidebar/Sidebar.js'
|
23
16
|
import { ThemeToggle } from '../components/ThemeToggle.js'
|
24
17
|
import { ThemeProvider, useTheme } from '../contexts/ThemeContext.js'
|
25
18
|
import { changelog } from './changelog.js'
|
@@ -48,64 +41,10 @@ export const Component = () => {
|
|
48
41
|
}
|
49
42
|
|
50
43
|
const Layout = () => {
|
51
|
-
const location = useLocation()
|
52
44
|
const { appearance } = useTheme()
|
53
|
-
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
54
|
-
|
55
|
-
// Close mobile menu on route change
|
56
|
-
useEffect(() => {
|
57
|
-
setMobileMenuOpen(false)
|
58
|
-
}, [location.pathname])
|
59
|
-
|
60
|
-
// Determine if we should show sidebar based on current path
|
61
|
-
const getCurrentNavPathExp = (): string | null => {
|
62
|
-
// todo: general path manipulation lib because we are duplicating logic here found in FileRouter
|
63
|
-
// todo: kit: try a Str.split that returns [] | string[] so that our predicates can refine on it?
|
64
|
-
const segments = location.pathname.split(`/`).filter(Boolean)
|
65
|
-
if (Arr.isntEmpty(segments)) {
|
66
|
-
return `/${segments[0]}`
|
67
|
-
}
|
68
|
-
return null
|
69
|
-
}
|
70
|
-
|
71
|
-
const currentNavPathExp = getCurrentNavPathExp()
|
72
|
-
const isReferencePage = currentNavPathExp === `/reference`
|
73
|
-
|
74
|
-
const sidebar = (() => {
|
75
|
-
if (isReferencePage && PROJECT_DATA.schema) {
|
76
|
-
// Build reference sidebar from schema types
|
77
|
-
const schema = PROJECT_DATA.schema.versions[0].after
|
78
|
-
const kindMap = GrafaidOld.getKindMap(schema)
|
79
|
-
|
80
|
-
const sidebarItems: Content.Item[] = []
|
81
|
-
const kindEntries = Object.entries(kindMap.list).filter(([_, types]) => types.length > 0)
|
82
|
-
|
83
|
-
for (const [title, types] of kindEntries) {
|
84
|
-
sidebarItems.push({
|
85
|
-
type: `ItemSection` as const,
|
86
|
-
title,
|
87
|
-
pathExp: `reference-${title.toLowerCase()}`,
|
88
|
-
isLinkToo: false,
|
89
|
-
links: types.map(type => ({
|
90
|
-
type: `ItemLink` as const,
|
91
|
-
title: type.name,
|
92
|
-
pathExp: `reference/${type.name}`,
|
93
|
-
})),
|
94
|
-
})
|
95
|
-
}
|
96
|
-
|
97
|
-
return { items: sidebarItems }
|
98
|
-
} else {
|
99
|
-
// Use regular page sidebar
|
100
|
-
return currentNavPathExp ? projectPagesCatalog.sidebarIndex[currentNavPathExp] || null : null
|
101
|
-
}
|
102
|
-
})()
|
103
|
-
|
104
|
-
const isShowSidebar = sidebar && sidebar.items.length > 0
|
105
45
|
|
106
46
|
const header = (
|
107
47
|
<Flex
|
108
|
-
gridArea={`header`}
|
109
48
|
align='center'
|
110
49
|
gap={{ initial: `4`, md: `8` }}
|
111
50
|
pb='4'
|
@@ -114,20 +53,6 @@ const Layout = () => {
|
|
114
53
|
borderBottom: `1px solid var(--gray-3)`,
|
115
54
|
}}
|
116
55
|
>
|
117
|
-
{/* Mobile menu - only show when sidebar exists */}
|
118
|
-
{isShowSidebar && (
|
119
|
-
<HamburgerMenu
|
120
|
-
isOpen={mobileMenuOpen}
|
121
|
-
onToggle={() => {
|
122
|
-
setMobileMenuOpen(!mobileMenuOpen)
|
123
|
-
}}
|
124
|
-
onClose={() => {
|
125
|
-
setMobileMenuOpen(false)
|
126
|
-
}}
|
127
|
-
sidebarData={sidebar.items}
|
128
|
-
/>
|
129
|
-
)}
|
130
|
-
|
131
56
|
<LinkReactRouter
|
132
57
|
to='/'
|
133
58
|
style={{ color: `inherit`, textDecoration: `none` }}
|
@@ -149,40 +74,17 @@ const Layout = () => {
|
|
149
74
|
|
150
75
|
return (
|
151
76
|
<Theme asChild appearance={appearance}>
|
152
|
-
<
|
77
|
+
<Box
|
153
78
|
width={{ initial: `100%`, sm: `100%`, md: `var(--container-4)` }}
|
154
79
|
maxWidth='100vw'
|
155
|
-
areas={{
|
156
|
-
initial: `'header' 'content'`,
|
157
|
-
sm: `'header' 'content'`,
|
158
|
-
md:
|
159
|
-
`'header header header header header header header header' 'sidebar sidebar . content content content content content'`,
|
160
|
-
}}
|
161
|
-
rows='min-content auto'
|
162
|
-
columns={{ initial: `1fr`, sm: `1fr`, md: `repeat(8, 1fr)` }}
|
163
|
-
gapX={{ initial: `0`, sm: `0`, md: `2` }}
|
164
80
|
my={{ initial: `0`, sm: `0`, md: `8` }}
|
165
81
|
mx='auto'
|
166
82
|
px={{ initial: `4`, sm: `4`, md: `0` }}
|
167
83
|
py={{ initial: `4`, sm: `4`, md: `0` }}
|
168
84
|
>
|
169
85
|
{header}
|
170
|
-
|
171
|
-
|
172
|
-
{isShowSidebar && (
|
173
|
-
<Box
|
174
|
-
display={{ initial: `none`, xs: `none`, sm: `none`, md: `block` }}
|
175
|
-
gridColumn='1 / 3'
|
176
|
-
gridRow='2 / auto'
|
177
|
-
>
|
178
|
-
<Sidebar data={sidebar.items} />
|
179
|
-
</Box>
|
180
|
-
)}
|
181
|
-
|
182
|
-
<Box gridArea='content / content / auto / 8' className='prose'>
|
183
|
-
<Outlet />
|
184
|
-
</Box>
|
185
|
-
</Grid>
|
86
|
+
<Outlet />
|
87
|
+
</Box>
|
186
88
|
</Theme>
|
187
89
|
)
|
188
90
|
}
|