polen 0.11.0-next.18 → 0.11.0-next.19
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/errors.d.ts +278 -0
- package/build/api/errors.d.ts.map +1 -0
- package/build/api/errors.js +153 -0
- package/build/api/errors.js.map +1 -0
- package/build/api/schema/input-source/$$.d.ts +1 -0
- package/build/api/schema/input-source/$$.d.ts.map +1 -1
- package/build/api/schema/input-source/$$.js +1 -0
- package/build/api/schema/input-source/$$.js.map +1 -1
- package/build/api/schema/input-source/errors.d.ts +36 -0
- package/build/api/schema/input-source/errors.d.ts.map +1 -0
- package/build/api/schema/input-source/errors.js +17 -0
- package/build/api/schema/input-source/errors.js.map +1 -0
- package/build/api/schema/input-source/input-source.d.ts +1 -7
- package/build/api/schema/input-source/input-source.d.ts.map +1 -1
- package/build/api/schema/input-source/input-source.js +0 -6
- package/build/api/schema/input-source/input-source.js.map +1 -1
- package/build/api/schema/input-sources/directory.d.ts.map +1 -1
- package/build/api/schema/input-sources/directory.js +17 -4
- package/build/api/schema/input-sources/directory.js.map +1 -1
- package/build/api/schema/input-sources/file.d.ts.map +1 -1
- package/build/api/schema/input-sources/file.js +15 -4
- package/build/api/schema/input-sources/file.js.map +1 -1
- package/build/api/schema/input-sources/introspection-file.d.ts.map +1 -1
- package/build/api/schema/input-sources/introspection-file.js +28 -6
- package/build/api/schema/input-sources/introspection-file.js.map +1 -1
- package/build/api/schema/input-sources/introspection.d.ts.map +1 -1
- package/build/api/schema/input-sources/introspection.js +35 -7
- package/build/api/schema/input-sources/introspection.js.map +1 -1
- package/build/api/schema/input-sources/memory.d.ts.map +1 -1
- package/build/api/schema/input-sources/memory.js +15 -3
- package/build/api/schema/input-sources/memory.js.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.js +20 -4
- package/build/api/schema/input-sources/versioned-directory.js.map +1 -1
- package/build/api/schema/load.d.ts +1 -1
- package/build/api/schema/load.d.ts.map +1 -1
- package/build/api/schema/load.js +1 -1
- package/build/api/schema/load.js.map +1 -1
- package/build/cli/commands/hero-image.d.ts +1 -2
- package/build/cli/commands/hero-image.d.ts.map +1 -1
- package/build/cli/index.d.ts +1 -1
- package/build/template/components/ReferenceVersionPicker.d.ts +9 -0
- package/build/template/components/ReferenceVersionPicker.d.ts.map +1 -0
- package/build/template/components/ReferenceVersionPicker.js +79 -0
- package/build/template/components/ReferenceVersionPicker.js.map +1 -0
- package/build/template/components/VersionPicker.d.ts +8 -3
- package/build/template/components/VersionPicker.d.ts.map +1 -1
- package/build/template/components/VersionPicker.js +12 -77
- package/build/template/components/VersionPicker.js.map +1 -1
- package/build/template/routes/changelog/ChangelogBody.d.ts +6 -0
- package/build/template/routes/changelog/ChangelogBody.d.ts.map +1 -0
- package/build/template/{components/Changelog/Changelog.js → routes/changelog/ChangelogBody.js} +8 -58
- package/build/template/routes/changelog/ChangelogBody.js.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebar.d.ts +7 -0
- package/build/template/routes/changelog/ChangelogSidebar.d.ts.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebar.js +46 -0
- package/build/template/routes/changelog/ChangelogSidebar.js.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.d.ts +11 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.d.ts.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.js +35 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.js.map +1 -0
- package/build/template/routes/changelog/_.d.ts +3264 -0
- package/build/template/routes/changelog/_.d.ts.map +1 -0
- package/build/template/routes/changelog/_.js +111 -0
- package/build/template/routes/changelog/_.js.map +1 -0
- package/build/template/routes/changelog/utils.d.ts +3 -0
- package/build/template/routes/changelog/utils.d.ts.map +1 -0
- package/build/template/routes/changelog/utils.js +11 -0
- package/build/template/routes/changelog/utils.js.map +1 -0
- package/build/template/routes/reference.js +2 -2
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.js +1 -1
- package/build/template/routes/root.js.map +1 -1
- package/build/template/theme/swiss-sharp.css +14 -14
- package/build/vite/plugins/schemas.d.ts +1 -2
- package/build/vite/plugins/schemas.d.ts.map +1 -1
- package/build/vite/plugins/schemas.js +0 -1
- package/build/vite/plugins/schemas.js.map +1 -1
- package/package.json +1 -1
- package/src/api/errors.ts +227 -0
- package/src/api/schema/input-source/$$.ts +1 -0
- package/src/api/schema/input-source/errors.ts +26 -0
- package/src/api/schema/input-source/input-source.ts +1 -22
- package/src/api/schema/input-sources/directory.ts +18 -13
- package/src/api/schema/input-sources/file.ts +17 -4
- package/src/api/schema/input-sources/introspection-file.ts +30 -15
- package/src/api/schema/input-sources/introspection.ts +38 -7
- package/src/api/schema/input-sources/memory.ts +19 -3
- package/src/api/schema/input-sources/versioned-directory.ts +20 -20
- package/src/api/schema/load.ts +3 -2
- package/src/template/components/ReferenceVersionPicker.tsx +107 -0
- package/src/template/components/VersionPicker.tsx +32 -98
- package/src/template/{components/Changelog/Changelog.tsx → routes/changelog/ChangelogBody.tsx} +7 -64
- package/src/template/routes/changelog/ChangelogSidebar.tsx +80 -0
- package/src/template/routes/changelog/ChangelogSidebarItem.tsx +68 -0
- package/src/template/routes/changelog/_.tsx +129 -0
- package/src/template/routes/changelog/utils.ts +13 -0
- package/src/template/routes/reference.tsx +2 -2
- package/src/template/routes/root.tsx +1 -1
- package/src/template/theme/swiss-sharp.css +14 -14
- package/src/vite/plugins/schemas.ts +0 -1
- package/build/sandbox.d.ts +0 -2
- package/build/sandbox.d.ts.map +0 -1
- package/build/sandbox.js +0 -17
- package/build/sandbox.js.map +0 -1
- package/build/template/components/Changelog/Changelog.d.ts +0 -8
- package/build/template/components/Changelog/Changelog.d.ts.map +0 -1
- package/build/template/components/Changelog/Changelog.js.map +0 -1
- package/build/template/components/Changelog/ChangelogVersionPicker.d.ts +0 -8
- package/build/template/components/Changelog/ChangelogVersionPicker.d.ts.map +0 -1
- package/build/template/components/Changelog/ChangelogVersionPicker.js +0 -16
- package/build/template/components/Changelog/ChangelogVersionPicker.js.map +0 -1
- package/build/template/components/SimpleVersionPicker.d.ts +0 -15
- package/build/template/components/SimpleVersionPicker.d.ts.map +0 -1
- package/build/template/components/SimpleVersionPicker.js +0 -15
- package/build/template/components/SimpleVersionPicker.js.map +0 -1
- package/build/template/routes/changelog.d.ts +0 -1635
- package/build/template/routes/changelog.d.ts.map +0 -1
- package/build/template/routes/changelog.js +0 -168
- package/build/template/routes/changelog.js.map +0 -1
- package/src/sandbox.ts +0 -15
- package/src/template/components/Changelog/ChangelogVersionPicker.tsx +0 -36
- package/src/template/components/SimpleVersionPicker.tsx +0 -48
- package/src/template/routes/changelog.tsx +0 -267
@@ -1,108 +1,42 @@
|
|
1
|
-
import { Api } from '#api/iso'
|
2
|
-
import type { React } from '#dep/react/index'
|
3
|
-
import { Catalog } from '#lib/catalog/$'
|
4
1
|
import { Version } from '#lib/version/$'
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
8
|
-
import { useReferencePath } from '../hooks/useReferencePath.js'
|
9
|
-
import { Stores } from '../stores/$.js'
|
10
|
-
import { tryWithToast } from '../utils/try-with-toast.js'
|
11
|
-
import { SimpleVersionPicker } from './SimpleVersionPicker.js'
|
2
|
+
import { Select } from '@radix-ui/themes'
|
3
|
+
import type * as React from 'react'
|
12
4
|
|
13
5
|
interface Props {
|
14
|
-
|
15
|
-
|
6
|
+
versions: readonly Version.Version[]
|
7
|
+
currentVersion: Version.Version
|
8
|
+
onVersionChange: (version: Version.Version) => void
|
16
9
|
}
|
17
10
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
// This component is only used for versioned catalogs
|
32
|
-
if (catalog._tag !== 'CatalogVersioned') {
|
33
|
-
throw new Error('VersionPicker used with non-versioned catalog')
|
34
|
-
}
|
35
|
-
|
36
|
-
// Find the schema for the target version
|
37
|
-
// Note: newVersion is a string that we need to parse
|
38
|
-
const targetSchemaOption = Option.map(
|
39
|
-
HashMap.findFirst(catalog.entries, (_, key) => Version.encodeSync(key) === newVersion),
|
40
|
-
([, value]) => value,
|
41
|
-
)
|
42
|
-
|
43
|
-
if (Option.isNone(targetSchemaOption)) {
|
44
|
-
throw new Error(`Version ${newVersion} not found`)
|
45
|
-
}
|
46
|
-
|
47
|
-
const targetSchema = Option.getOrThrow(targetSchemaOption)
|
48
|
-
|
49
|
-
// Find fallback path if needed
|
50
|
-
const fallbackPath = Api.Schema.Validation.findFallbackPath(targetSchema.definition, currentPath)
|
51
|
-
// Get redirect description if path changed
|
52
|
-
const redirectDescription = Api.Schema.Validation.getRedirectDescription(
|
53
|
-
targetSchema.definition,
|
54
|
-
currentPath,
|
55
|
-
fallbackPath,
|
56
|
-
newVersion,
|
57
|
-
)
|
58
|
-
// Create the new path - parse newVersion string to Version type
|
59
|
-
const newPath = Api.Schema.Routing.createReferencePath({
|
60
|
-
version: Version.fromString(newVersion),
|
61
|
-
type: fallbackPath.type || '',
|
62
|
-
field: fallbackPath.field || '',
|
63
|
-
})
|
64
|
-
// Show toast notification if schema location redirect will occur
|
65
|
-
if (redirectDescription) {
|
66
|
-
Stores.Toast.store.info(redirectDescription, {
|
67
|
-
duration: 160_000,
|
68
|
-
actions: [
|
69
|
-
{
|
70
|
-
label: 'Go back',
|
71
|
-
onClick() {
|
72
|
-
navigate(-1)
|
73
|
-
},
|
74
|
-
},
|
75
|
-
{
|
76
|
-
label: 'View changelog',
|
77
|
-
onClick() {
|
78
|
-
// Navigate to changelog page
|
79
|
-
navigate('/changelog')
|
80
|
-
},
|
81
|
-
},
|
82
|
-
],
|
83
|
-
})
|
84
|
-
}
|
85
|
-
|
86
|
-
navigate(newPath)
|
87
|
-
}, 'Failed to switch version')
|
88
|
-
|
89
|
-
// Fallback logic if error occurred
|
90
|
-
if (error) {
|
91
|
-
// Fallback to simple navigation if schema loading fails
|
92
|
-
const newPath = Api.Schema.Routing.createReferencePath({
|
93
|
-
version: Version.fromString(newVersion),
|
94
|
-
type: currentPath.type || '',
|
95
|
-
field: currentPath.field || '',
|
96
|
-
})
|
97
|
-
navigate(newPath)
|
98
|
-
}
|
11
|
+
/**
|
12
|
+
* A generic version picker component that can be used for any versioned content.
|
13
|
+
* This is a controlled component - parent manages the state.
|
14
|
+
*/
|
15
|
+
export const VersionPicker: React.FC<Props> = ({
|
16
|
+
versions,
|
17
|
+
currentVersion,
|
18
|
+
onVersionChange,
|
19
|
+
}) => {
|
20
|
+
// Don't show selector if only one version
|
21
|
+
if (versions.length <= 1) {
|
22
|
+
return null
|
99
23
|
}
|
100
24
|
|
101
25
|
return (
|
102
|
-
<
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
26
|
+
<Select.Root
|
27
|
+
value={Version.encodeSync(currentVersion)}
|
28
|
+
onValueChange={(versionEncoded) => onVersionChange(Version.fromString(versionEncoded))}
|
29
|
+
>
|
30
|
+
<Select.Trigger style={{ minWidth: '120px' }}>
|
31
|
+
Version {Version.encodeSync(currentVersion)}
|
32
|
+
</Select.Trigger>
|
33
|
+
<Select.Content position='popper' sideOffset={5}>
|
34
|
+
{versions.map(version => (
|
35
|
+
<Select.Item key={Version.encodeSync(version)} value={Version.encodeSync(version)}>
|
36
|
+
Version {Version.encodeSync(version)}
|
37
|
+
</Select.Item>
|
38
|
+
))}
|
39
|
+
</Select.Content>
|
40
|
+
</Select.Root>
|
107
41
|
)
|
108
42
|
}
|
package/src/template/{components/Changelog/Changelog.tsx → routes/changelog/ChangelogBody.tsx}
RENAMED
@@ -1,75 +1,18 @@
|
|
1
1
|
import { Catalog } from '#lib/catalog/$'
|
2
2
|
import { Change } from '#lib/change/$'
|
3
|
-
import { DateOnly } from '#lib/date-only/$'
|
4
3
|
import { Revision } from '#lib/revision/$'
|
5
4
|
import { Schema } from '#lib/schema/$'
|
6
|
-
import { Version } from '#lib/version/$'
|
7
|
-
import { HashMap, Option } from 'effect'
|
8
5
|
const CRITICALITY_LEVELS = ['BREAKING', 'DANGEROUS', 'NON_BREAKING'] as const
|
9
6
|
import type { CriticalityLevel } from '@graphql-inspector/core'
|
10
7
|
import { Box, Heading } from '@radix-ui/themes'
|
11
|
-
import React
|
8
|
+
import React from 'react'
|
12
9
|
import { useMemo } from 'react'
|
13
|
-
import {
|
14
|
-
import
|
15
|
-
import {
|
16
|
-
import
|
17
|
-
|
18
|
-
export const renderDate = (dateOnly: DateOnly.DateOnly) => {
|
19
|
-
const date = DateOnly.toDate(dateOnly)
|
20
|
-
const year = date.getUTCFullYear()
|
21
|
-
return `${year} ${
|
22
|
-
date.toLocaleString('default', {
|
23
|
-
month: 'long',
|
24
|
-
day: 'numeric',
|
25
|
-
timeZone: 'UTC',
|
26
|
-
})
|
27
|
-
}`
|
28
|
-
}
|
29
|
-
|
30
|
-
export const Changelog: React.FC<{ catalog: Catalog.Catalog }> = ({ catalog }) => {
|
31
|
-
const params = useParams()
|
32
|
-
const navigate = useNavigate()
|
33
|
-
const urlVersion = params['version']
|
34
|
-
|
35
|
-
// Redirect to latest version if versioned catalog and no version specified
|
36
|
-
useEffect(() => {
|
37
|
-
if (urlVersion) return
|
38
|
-
if (Catalog.Unversioned.is(catalog)) return
|
39
|
-
const latestSchema = Catalog.Versioned.getLatestOrThrow(catalog)
|
40
|
-
const latestVersion = Version.encodeSync(latestSchema.version)
|
41
|
-
navigate(`/changelog/version/${latestVersion}`, { replace: true })
|
42
|
-
}, [catalog, urlVersion, navigate])
|
43
|
-
|
44
|
-
// Get revisions and corresponding schema based on catalog type and URL params
|
45
|
-
const { revisions, schema } = useMemo(() => {
|
46
|
-
if (Catalog.Unversioned.is(catalog)) {
|
47
|
-
return {
|
48
|
-
revisions: catalog.schema.revisions,
|
49
|
-
schema: catalog.schema,
|
50
|
-
}
|
51
|
-
} else {
|
52
|
-
// For versioned catalogs, always show specific version (never all)
|
53
|
-
if (urlVersion) {
|
54
|
-
const entryOption = Option.map(
|
55
|
-
HashMap.findFirst(catalog.entries, (_, key) => Version.encodeSync(key) === urlVersion),
|
56
|
-
([, value]) => value,
|
57
|
-
)
|
58
|
-
return Option.match(entryOption, {
|
59
|
-
onNone: () => ({ revisions: [], schema: null }),
|
60
|
-
onSome: (entry) => ({ revisions: entry.revisions, schema: entry }),
|
61
|
-
})
|
62
|
-
}
|
63
|
-
// This shouldn't happen due to redirect above, but return empty as fallback
|
64
|
-
return { revisions: [], schema: null }
|
65
|
-
}
|
66
|
-
}, [catalog, urlVersion])
|
67
|
-
|
68
|
-
// Don't render anything while redirecting
|
69
|
-
if (Catalog.Versioned.is(catalog) && !urlVersion) {
|
70
|
-
return null
|
71
|
-
}
|
10
|
+
import { CriticalitySection } from '../../components/Changelog/CriticalitySection.js'
|
11
|
+
import * as Group from '../../components/Changelog/groups/index.js'
|
12
|
+
import { ComponentDispatch } from '../../components/ComponentDispatch.js'
|
13
|
+
import { renderDate } from './utils.js'
|
72
14
|
|
15
|
+
export const ChangelogBody: React.FC<{ schema: Schema.Schema }> = ({ schema }) => {
|
73
16
|
return (
|
74
17
|
<Box>
|
75
18
|
{/* Title bar - always shown */}
|
@@ -77,7 +20,7 @@ export const Changelog: React.FC<{ catalog: Catalog.Catalog }> = ({ catalog }) =
|
|
77
20
|
Changelog
|
78
21
|
</Heading>
|
79
22
|
|
80
|
-
{revisions.map(revision => <Changeset key={revision.date} revision={revision} schema={schema} />)}
|
23
|
+
{schema.revisions.map(revision => <Changeset key={revision.date} revision={revision} schema={schema} />)}
|
81
24
|
</Box>
|
82
25
|
)
|
83
26
|
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { Catalog } from '#lib/catalog/$'
|
2
|
+
import { Schema } from '#lib/schema/$'
|
3
|
+
import { Swiss } from '#lib/swiss/$'
|
4
|
+
import { Version } from '#lib/version'
|
5
|
+
import { Box, Text } from '@radix-ui/themes'
|
6
|
+
import { useEffect, useState } from 'react'
|
7
|
+
import { useNavigate, useParams } from 'react-router'
|
8
|
+
import { VersionPicker } from '../../components/VersionPicker.js'
|
9
|
+
import { ChangelogSidebarItem } from './ChangelogSidebarItem.js'
|
10
|
+
|
11
|
+
export const ChangelogSidebar: React.FC<{
|
12
|
+
catalog: Catalog.Catalog
|
13
|
+
schema: Schema.Schema
|
14
|
+
}> = ({ catalog, schema }) => {
|
15
|
+
{
|
16
|
+
const navigate = useNavigate()
|
17
|
+
|
18
|
+
// Get revisions for the current version (for sidebar)
|
19
|
+
const revisions = schema.revisions
|
20
|
+
|
21
|
+
const [activeRevision, setActiveRevision] = useState<string | null>(null)
|
22
|
+
// Track active revision based on URL hash
|
23
|
+
useEffect(() => {
|
24
|
+
const handleHashChange = () => {
|
25
|
+
const hash = window.location.hash.slice(1)
|
26
|
+
setActiveRevision(hash || null)
|
27
|
+
}
|
28
|
+
|
29
|
+
// Set initial active revision
|
30
|
+
handleHashChange()
|
31
|
+
|
32
|
+
// Listen for hash changes
|
33
|
+
window.addEventListener('hashchange', handleHashChange)
|
34
|
+
|
35
|
+
// Listen for pushState/replaceState (custom event we'll dispatch)
|
36
|
+
window.addEventListener('pushstate', handleHashChange)
|
37
|
+
|
38
|
+
return () => {
|
39
|
+
window.removeEventListener('hashchange', handleHashChange)
|
40
|
+
window.removeEventListener('pushstate', handleHashChange)
|
41
|
+
}
|
42
|
+
}, [])
|
43
|
+
|
44
|
+
return (
|
45
|
+
<Swiss.Item
|
46
|
+
cols={3}
|
47
|
+
style={{
|
48
|
+
position: 'sticky',
|
49
|
+
top: '2rem',
|
50
|
+
height: 'fit-content',
|
51
|
+
minWidth: '250px',
|
52
|
+
maxHeight: 'calc(100vh - 4rem)',
|
53
|
+
overflowY: 'auto',
|
54
|
+
}}
|
55
|
+
>
|
56
|
+
{Catalog.Versioned.is(catalog) && Schema.Versioned.is(schema) && (
|
57
|
+
<Box mb='3'>
|
58
|
+
<VersionPicker
|
59
|
+
versions={Catalog.Versioned.getVersions(catalog)}
|
60
|
+
currentVersion={schema.version}
|
61
|
+
onVersionChange={(newVersion) => {
|
62
|
+
navigate(`/changelog/version/${Version.encodeSync(newVersion)}`)
|
63
|
+
}}
|
64
|
+
/>
|
65
|
+
</Box>
|
66
|
+
)}
|
67
|
+
<Text size='2' weight='medium' mb='3' style={{ display: 'block' }}>
|
68
|
+
Revisions
|
69
|
+
</Text>
|
70
|
+
{revisions.map((revision) => (
|
71
|
+
<ChangelogSidebarItem
|
72
|
+
key={revision.date}
|
73
|
+
revision={revision}
|
74
|
+
isActive={activeRevision === revision.date}
|
75
|
+
/>
|
76
|
+
))}
|
77
|
+
</Swiss.Item>
|
78
|
+
)
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { Change } from '#lib/change'
|
2
|
+
import { Revision } from '#lib/revision'
|
3
|
+
import { Box, Flex, Text } from '@radix-ui/themes'
|
4
|
+
import { renderDate } from './utils.js'
|
5
|
+
|
6
|
+
export const ChangelogSidebarItem: React.FC<{
|
7
|
+
revision: Revision.Revision
|
8
|
+
isActive: boolean
|
9
|
+
}> = ({ revision, isActive }) => {
|
10
|
+
const counts = calculateCounts(revision)
|
11
|
+
|
12
|
+
return (
|
13
|
+
<Box mb='2'>
|
14
|
+
<a
|
15
|
+
href={`#${revision.date}`}
|
16
|
+
style={{
|
17
|
+
textDecoration: 'none',
|
18
|
+
display: 'flex',
|
19
|
+
alignItems: 'center',
|
20
|
+
justifyContent: 'space-between',
|
21
|
+
padding: '0.5rem 0.75rem',
|
22
|
+
borderRadius: '4px',
|
23
|
+
backgroundColor: isActive ? 'var(--gray-a3)' : 'transparent',
|
24
|
+
color: 'inherit',
|
25
|
+
transition: 'background-color 0.2s',
|
26
|
+
}}
|
27
|
+
onClick={(e) => {
|
28
|
+
e.preventDefault()
|
29
|
+
// Update URL hash
|
30
|
+
window.history.pushState(null, '', `#${revision.date}`)
|
31
|
+
// Dispatch custom event for pushState
|
32
|
+
window.dispatchEvent(new Event('pushstate'))
|
33
|
+
// Smooth scroll to element
|
34
|
+
document.getElementById(revision.date)?.scrollIntoView({ behavior: 'smooth' })
|
35
|
+
}}
|
36
|
+
>
|
37
|
+
<Text size='2' weight={isActive ? 'medium' : 'regular'}>
|
38
|
+
{renderDate(revision.date)}
|
39
|
+
</Text>
|
40
|
+
<Flex gap='2' align='center'>
|
41
|
+
{counts.breaking > 0 && (
|
42
|
+
<Text size='1' weight='medium' style={{ color: '#ef4444' }}>
|
43
|
+
{counts.breaking}
|
44
|
+
</Text>
|
45
|
+
)}
|
46
|
+
{counts.dangerous > 0 && (
|
47
|
+
<Text size='1' weight='medium' style={{ color: '#f59e0b' }}>
|
48
|
+
{counts.dangerous}
|
49
|
+
</Text>
|
50
|
+
)}
|
51
|
+
{counts.safe > 0 && (
|
52
|
+
<Text size='1' weight='medium' style={{ color: '#10b981' }}>
|
53
|
+
{counts.safe}
|
54
|
+
</Text>
|
55
|
+
)}
|
56
|
+
</Flex>
|
57
|
+
</a>
|
58
|
+
</Box>
|
59
|
+
)
|
60
|
+
}
|
61
|
+
|
62
|
+
export const calculateCounts = (revision: Revision.Revision) => {
|
63
|
+
return {
|
64
|
+
breaking: revision.changes.filter(Change.isBreaking).length,
|
65
|
+
dangerous: revision.changes.filter(Change.isDangerous).length,
|
66
|
+
safe: revision.changes.filter(Change.isSafe).length,
|
67
|
+
}
|
68
|
+
}
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import { Catalog } from '#lib/catalog'
|
2
|
+
import { S } from '#lib/kit-temp/$'
|
3
|
+
import { route } from '#lib/react-router-effect/route'
|
4
|
+
import { useLoaderData } from '#lib/react-router-effect/use-loader-data'
|
5
|
+
import { Schema } from '#lib/schema/$'
|
6
|
+
import { Swiss } from '#lib/swiss'
|
7
|
+
import { Version } from '#lib/version'
|
8
|
+
import { Http } from '@wollybeard/kit'
|
9
|
+
import { Effect, Option } from 'effect'
|
10
|
+
import { HashMap } from 'effect'
|
11
|
+
import { redirect } from 'react-router'
|
12
|
+
import { schemasCatalog } from 'virtual:polen/project/schemas'
|
13
|
+
import { ChangelogBody } from './ChangelogBody.js'
|
14
|
+
import { ChangelogSidebar } from './ChangelogSidebar.js'
|
15
|
+
|
16
|
+
//
|
17
|
+
//
|
18
|
+
//
|
19
|
+
//
|
20
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Schema
|
21
|
+
//
|
22
|
+
//
|
23
|
+
|
24
|
+
const LoaderSchema = S.Struct({
|
25
|
+
catalog: Catalog.Catalog,
|
26
|
+
schema: Schema.Schema,
|
27
|
+
})
|
28
|
+
|
29
|
+
//
|
30
|
+
//
|
31
|
+
//
|
32
|
+
//
|
33
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Loader
|
34
|
+
//
|
35
|
+
//
|
36
|
+
|
37
|
+
const loader = ({ params }: { params: { version?: string } }) => {
|
38
|
+
const catalog = schemasCatalog!
|
39
|
+
|
40
|
+
// If catalog is versioned and no version is provided in URL, redirect to latest version
|
41
|
+
if (Catalog.Versioned.is(catalog) && !params.version) {
|
42
|
+
const latestVersion = Catalog.getLatestVersion(catalog)
|
43
|
+
const urlVersion = Version.encodeSync(Option.getOrThrow(latestVersion))
|
44
|
+
throw redirect(`/changelog/version/${urlVersion}`)
|
45
|
+
}
|
46
|
+
|
47
|
+
const schemaMaybe = ((): Option.Option<Schema.Schema> => {
|
48
|
+
if (Catalog.Versioned.is(catalog)) {
|
49
|
+
const version = Version.decodeSync(params.version!)
|
50
|
+
const schema = HashMap.get(catalog.entries, version)
|
51
|
+
return schema
|
52
|
+
}
|
53
|
+
return Option.some(catalog.schema)
|
54
|
+
})()
|
55
|
+
|
56
|
+
if (Option.isNone(schemaMaybe)) {
|
57
|
+
throw Http.Response.notFound
|
58
|
+
}
|
59
|
+
|
60
|
+
return Effect.succeed({ catalog, schema: schemaMaybe.value })
|
61
|
+
}
|
62
|
+
|
63
|
+
//
|
64
|
+
//
|
65
|
+
//
|
66
|
+
//
|
67
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Component
|
68
|
+
//
|
69
|
+
//
|
70
|
+
|
71
|
+
const Component = () => {
|
72
|
+
const { catalog, schema } = useLoaderData(LoaderSchema)
|
73
|
+
|
74
|
+
return (
|
75
|
+
<Swiss.Body subgrid>
|
76
|
+
<ChangelogSidebar schema={schema} catalog={catalog} />
|
77
|
+
<Swiss.Item start={5} cols={8}>
|
78
|
+
<ChangelogBody schema={schema} />
|
79
|
+
</Swiss.Item>
|
80
|
+
</Swiss.Body>
|
81
|
+
)
|
82
|
+
}
|
83
|
+
|
84
|
+
//
|
85
|
+
//
|
86
|
+
//
|
87
|
+
//
|
88
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Routes
|
89
|
+
//
|
90
|
+
//
|
91
|
+
|
92
|
+
export const changelog = !schemasCatalog
|
93
|
+
? null
|
94
|
+
: Catalog.Versioned.is(schemasCatalog)
|
95
|
+
? route({
|
96
|
+
path: `changelog`,
|
97
|
+
loader,
|
98
|
+
Component,
|
99
|
+
children: [
|
100
|
+
route({
|
101
|
+
path: `version/:version`,
|
102
|
+
schema: LoaderSchema,
|
103
|
+
loader,
|
104
|
+
Component,
|
105
|
+
// children: [
|
106
|
+
// route({
|
107
|
+
// path: `revision/:revision`,
|
108
|
+
// schema: LoaderSchema,
|
109
|
+
// loader,
|
110
|
+
// Component,
|
111
|
+
// }),
|
112
|
+
// ],
|
113
|
+
}),
|
114
|
+
],
|
115
|
+
})
|
116
|
+
: route({
|
117
|
+
path: `changelog`,
|
118
|
+
loader,
|
119
|
+
schema: LoaderSchema,
|
120
|
+
Component,
|
121
|
+
// children: [
|
122
|
+
// route({
|
123
|
+
// path: `revision/:revision`,
|
124
|
+
// schema: LoaderSchema,
|
125
|
+
// loader,
|
126
|
+
// Component,
|
127
|
+
// }),
|
128
|
+
// ],
|
129
|
+
})
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { DateOnly } from '#lib/date-only/$'
|
2
|
+
|
3
|
+
export const renderDate = (dateOnly: DateOnly.DateOnly) => {
|
4
|
+
const date = DateOnly.toDate(dateOnly)
|
5
|
+
const year = date.getUTCFullYear()
|
6
|
+
return `${year} ${
|
7
|
+
date.toLocaleString('default', {
|
8
|
+
month: 'long',
|
9
|
+
day: 'numeric',
|
10
|
+
timeZone: 'UTC',
|
11
|
+
})
|
12
|
+
}`
|
13
|
+
}
|
@@ -18,7 +18,7 @@ import { Field } from '../components/Field.js'
|
|
18
18
|
import { TypeKindIcon } from '../components/graphql/graphql.js'
|
19
19
|
import { MissingSchema } from '../components/MissingSchema.js'
|
20
20
|
import { NamedType } from '../components/NamedType.js'
|
21
|
-
import {
|
21
|
+
import { ReferenceVersionPicker } from '../components/ReferenceVersionPicker.js'
|
22
22
|
import { GraphqlLifecycleProvider } from '../contexts/GraphqlLifecycleContext.js'
|
23
23
|
import { SidebarLayout } from '../layouts/index.js'
|
24
24
|
|
@@ -160,7 +160,7 @@ const ReferenceView = () => {
|
|
160
160
|
const version = Schema.getVersion(schema)
|
161
161
|
return catalog._tag === 'CatalogVersioned' && version
|
162
162
|
? (
|
163
|
-
<
|
163
|
+
<ReferenceVersionPicker
|
164
164
|
data={Catalog.Versioned.getVersions(catalog)}
|
165
165
|
current={version}
|
166
166
|
/>
|
@@ -20,7 +20,7 @@ import { ThemeProvider, useTheme } from '../contexts/ThemeContext.js'
|
|
20
20
|
import { swissSharpTheme } from '../theme/swiss-sharp.js'
|
21
21
|
import '../theme/swiss-sharp.css'
|
22
22
|
import '../../lib/swiss/styles.css'
|
23
|
-
import { changelog } from './changelog.js'
|
23
|
+
import { changelog } from './changelog/_.js'
|
24
24
|
import { examplesRoute } from './examples/_.js'
|
25
25
|
import { index } from './index.js'
|
26
26
|
import { pages } from './pages.js'
|
@@ -40,18 +40,18 @@ body {
|
|
40
40
|
"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
|
41
41
|
|
42
42
|
/* Font adjustments for impact */
|
43
|
-
|
43
|
+
/*--heading-font-size-adjust: 1.05;
|
44
44
|
--heading-letter-spacing: -0.04em;
|
45
|
-
--heading-line-height: 0.9
|
45
|
+
--heading-line-height: 0.9;*/
|
46
46
|
|
47
47
|
/* Weight system - extreme contrast */
|
48
|
-
|
48
|
+
/*--font-weight-light: 200;
|
49
49
|
--font-weight-regular: 400;
|
50
50
|
--font-weight-medium: 500;
|
51
|
-
--font-weight-bold: 900
|
51
|
+
--font-weight-bold: 900;*/
|
52
52
|
|
53
53
|
/* Letter spacing - tighter for sharpness */
|
54
|
-
|
54
|
+
/*--letter-spacing-1: 0.04em;
|
55
55
|
--letter-spacing-2: 0.02em;
|
56
56
|
--letter-spacing-3: 0em;
|
57
57
|
--letter-spacing-4: -0.01em;
|
@@ -59,16 +59,16 @@ body {
|
|
59
59
|
--letter-spacing-6: -0.025em;
|
60
60
|
--letter-spacing-7: -0.03em;
|
61
61
|
--letter-spacing-8: -0.035em;
|
62
|
-
--letter-spacing-9: -0.04em
|
62
|
+
--letter-spacing-9: -0.04em;*/
|
63
63
|
|
64
64
|
/* ============================================================================
|
65
65
|
* Accent Color - Sharp Blue
|
66
66
|
* ============================================================================ */
|
67
67
|
|
68
68
|
/* Override accent with a sharp blue - works in both light and dark */
|
69
|
-
|
69
|
+
/*--accent-9: #0055ff;
|
70
70
|
--accent-10: #0044dd;
|
71
|
-
--accent-11: #0033bb
|
71
|
+
--accent-11: #0033bb;*/
|
72
72
|
|
73
73
|
/* ============================================================================
|
74
74
|
* Spacing - Using Radix defaults to avoid breaking components
|
@@ -80,32 +80,32 @@ body {
|
|
80
80
|
* Radius - All Sharp (Zero Radius)
|
81
81
|
* ============================================================================ */
|
82
82
|
|
83
|
-
|
83
|
+
/*--radius-1: 0px;
|
84
84
|
--radius-2: 0px;
|
85
85
|
--radius-3: 0px;
|
86
86
|
--radius-4: 0px;
|
87
87
|
--radius-5: 0px;
|
88
88
|
--radius-6: 0px;
|
89
89
|
--radius-full: 0px;
|
90
|
-
--radius-thumb: 0px
|
90
|
+
--radius-thumb: 0px;*/
|
91
91
|
|
92
92
|
/* ============================================================================
|
93
93
|
* Shadows - Minimal & Sharp
|
94
94
|
* ============================================================================ */
|
95
95
|
|
96
96
|
/* Minimal shadows - using semi-transparent blacks for theme compatibility */
|
97
|
-
|
97
|
+
/*--shadow-1: 0 1px 0 0 rgba(0, 0, 0, 0.05);
|
98
98
|
--shadow-2: 0 2px 0 0 rgba(0, 0, 0, 0.1);
|
99
99
|
--shadow-3: 0 4px 0 0 rgba(0, 0, 0, 0.15);
|
100
100
|
--shadow-4: 0 8px 0 0 rgba(0, 0, 0, 0.2);
|
101
101
|
--shadow-5: 0 12px 0 0 rgba(0, 0, 0, 0.25);
|
102
|
-
--shadow-6: 0 16px 0 0 rgba(0, 0, 0, 0.3)
|
102
|
+
--shadow-6: 0 16px 0 0 rgba(0, 0, 0, 0.3);*/
|
103
103
|
|
104
104
|
/* ============================================================================
|
105
105
|
* Cursors - Minimal
|
106
106
|
* ============================================================================ */
|
107
107
|
|
108
|
-
|
108
|
+
/*--cursor-button: pointer;
|
109
109
|
--cursor-checkbox: pointer;
|
110
110
|
--cursor-disabled: not-allowed;
|
111
111
|
--cursor-link: pointer;
|
@@ -113,5 +113,5 @@ body {
|
|
113
113
|
--cursor-radio: pointer;
|
114
114
|
--cursor-slider-thumb: grab;
|
115
115
|
--cursor-slider-thumb-active: grabbing;
|
116
|
-
--cursor-switch: pointer
|
116
|
+
--cursor-switch: pointer;*/
|
117
117
|
}
|
@@ -6,7 +6,6 @@ import { createAssetReader } from '#lib/vite-reactive/reactive-asset-plugin'
|
|
6
6
|
import { ViteVirtual } from '#lib/vite-virtual/$'
|
7
7
|
import { debugPolen } from '#singletons/debug'
|
8
8
|
import { polenVirtual } from '#vite/vi'
|
9
|
-
import { FileSystem } from '@effect/platform'
|
10
9
|
import * as NodeFileSystem from '@effect/platform-node/NodeFileSystem'
|
11
10
|
import { Effect } from 'effect'
|
12
11
|
import * as NodePath from 'node:path'
|
package/build/sandbox.d.ts
DELETED
package/build/sandbox.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":""}
|
package/build/sandbox.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
export {};
|
2
|
-
//
|
3
|
-
//
|
4
|
-
//
|
5
|
-
//
|
6
|
-
//
|
7
|
-
// Temporary Work File
|
8
|
-
//
|
9
|
-
// ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
|
10
|
-
//
|
11
|
-
// – Use freely
|
12
|
-
// – Try to remember to not commit changes
|
13
|
-
// – Included by development TypeScript configuration
|
14
|
-
// – Excluded by build TypeScript configuration
|
15
|
-
//
|
16
|
-
//
|
17
|
-
//# sourceMappingURL=sandbox.js.map
|
package/build/sandbox.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,sBAAsB;AACtB,EAAE;AACF,oFAAoF;AACpF,EAAE;AACF,eAAe;AACf,0CAA0C;AAC1C,qDAAqD;AACrD,+CAA+C;AAC/C,EAAE;AACF,EAAE"}
|