polen 0.10.0-next.15 → 0.10.0-next.17
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/lib/graphql-document/components/GraphQLDocument.d.ts +0 -2
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +5 -5
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +1 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +1 -3
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +1 -1
- package/build/lib/graphql-document/positioning-simple.d.ts +1 -1
- package/build/lib/graphql-document/positioning-simple.js +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/entry.client.d.ts +0 -1
- package/build/template/entry.client.d.ts.map +1 -1
- package/build/template/entry.client.js +0 -1
- package/build/template/entry.client.js.map +1 -1
- 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 +7 -68
- package/build/template/routes/root.js.map +1 -1
- package/package.json +3 -3
- 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/lib/graphql-document/components/GraphQLDocument.tsx +7 -12
- package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +1 -6
- package/src/lib/graphql-document/demo.md +1 -1
- package/src/lib/graphql-document/positioning-simple.test.ts +5 -5
- package/src/lib/graphql-document/positioning-simple.ts +1 -1
- 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/entry.client.tsx +0 -1
- package/src/template/routes/changelog.tsx +6 -1
- package/src/template/routes/reference.tsx +25 -2
- package/src/template/routes/root.tsx +5 -105
- package/build/template/components/CodeBlockEnhancer.d.ts +0 -2
- package/build/template/components/CodeBlockEnhancer.d.ts.map +0 -1
- package/build/template/components/CodeBlockEnhancer.js +0 -175
- package/build/template/components/CodeBlockEnhancer.js.map +0 -1
- package/build/template/styles/code-block.css +0 -218
- package/src/template/components/CodeBlockEnhancer.tsx +0 -192
- package/src/template/styles/code-block.css +0 -218
@@ -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,17 @@
|
|
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
|
-
import { CodeBlockEnhancer } from '../components/CodeBlockEnhancer.js'
|
18
|
-
import { HamburgerMenu } from '../components/HamburgerMenu.js'
|
19
12
|
import { Link } from '../components/Link.js'
|
20
13
|
import { Logo } from '../components/Logo.js'
|
21
14
|
import { NotFound } from '../components/NotFound.js'
|
22
|
-
import { Sidebar } from '../components/sidebar/Sidebar.js'
|
23
15
|
import { ThemeToggle } from '../components/ThemeToggle.js'
|
24
16
|
import { ThemeProvider, useTheme } from '../contexts/ThemeContext.js'
|
25
17
|
import { changelog } from './changelog.js'
|
@@ -39,7 +31,6 @@ export const Component = () => {
|
|
39
31
|
<ThemeProvider>
|
40
32
|
<GraphQLSchemaProvider schema={schema}>
|
41
33
|
<Layout />
|
42
|
-
<CodeBlockEnhancer />
|
43
34
|
</GraphQLSchemaProvider>
|
44
35
|
</ThemeProvider>
|
45
36
|
<ScrollRestoration />
|
@@ -48,64 +39,10 @@ export const Component = () => {
|
|
48
39
|
}
|
49
40
|
|
50
41
|
const Layout = () => {
|
51
|
-
const location = useLocation()
|
52
42
|
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
43
|
|
106
44
|
const header = (
|
107
45
|
<Flex
|
108
|
-
gridArea={`header`}
|
109
46
|
align='center'
|
110
47
|
gap={{ initial: `4`, md: `8` }}
|
111
48
|
pb='4'
|
@@ -114,20 +51,6 @@ const Layout = () => {
|
|
114
51
|
borderBottom: `1px solid var(--gray-3)`,
|
115
52
|
}}
|
116
53
|
>
|
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
54
|
<LinkReactRouter
|
132
55
|
to='/'
|
133
56
|
style={{ color: `inherit`, textDecoration: `none` }}
|
@@ -149,40 +72,17 @@ const Layout = () => {
|
|
149
72
|
|
150
73
|
return (
|
151
74
|
<Theme asChild appearance={appearance}>
|
152
|
-
<
|
75
|
+
<Box
|
153
76
|
width={{ initial: `100%`, sm: `100%`, md: `var(--container-4)` }}
|
154
77
|
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
78
|
my={{ initial: `0`, sm: `0`, md: `8` }}
|
165
79
|
mx='auto'
|
166
80
|
px={{ initial: `4`, sm: `4`, md: `0` }}
|
167
81
|
py={{ initial: `4`, sm: `4`, md: `0` }}
|
168
82
|
>
|
169
83
|
{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>
|
84
|
+
<Outlet />
|
85
|
+
</Box>
|
186
86
|
</Theme>
|
187
87
|
)
|
188
88
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CodeBlockEnhancer.d.ts","sourceRoot":"","sources":["../../../src/template/components/CodeBlockEnhancer.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,YA2L7B,CAAA"}
|
@@ -1,175 +0,0 @@
|
|
1
|
-
import { useEffect } from 'react';
|
2
|
-
import { useLocation } from 'react-router';
|
3
|
-
import { useTheme } from '../contexts/ThemeContext.js';
|
4
|
-
export const CodeBlockEnhancer = () => {
|
5
|
-
const { appearance } = useTheme();
|
6
|
-
const location = useLocation();
|
7
|
-
useEffect(() => {
|
8
|
-
// Add styles for code block enhancements
|
9
|
-
const styleId = `code-block-enhancer-styles`;
|
10
|
-
let styleElement = document.getElementById(styleId);
|
11
|
-
if (!styleElement) {
|
12
|
-
styleElement = document.createElement(`style`);
|
13
|
-
styleElement.id = styleId;
|
14
|
-
document.head.appendChild(styleElement);
|
15
|
-
}
|
16
|
-
styleElement.textContent = `
|
17
|
-
/* Enhanced code block styles */
|
18
|
-
pre.shiki {
|
19
|
-
position: relative;
|
20
|
-
}
|
21
|
-
|
22
|
-
pre.shiki[data-title] {
|
23
|
-
margin-top: 0;
|
24
|
-
border-radius: 0 0 8px 8px !important;
|
25
|
-
}
|
26
|
-
|
27
|
-
pre.shiki[data-title]::before {
|
28
|
-
content: attr(data-title);
|
29
|
-
display: block;
|
30
|
-
position: absolute;
|
31
|
-
top: -2.5rem;
|
32
|
-
left: -1px;
|
33
|
-
right: -1px;
|
34
|
-
background-color: ${appearance === `dark` ? `#2a2b3d` : `#f3f4f6`};
|
35
|
-
border: 1px solid var(--gray-4);
|
36
|
-
border-bottom: 1px solid ${appearance === `dark` ? `#3a3b4d` : `#e5e7eb`};
|
37
|
-
border-radius: 8px 8px 0 0;
|
38
|
-
padding: 0.5rem 1rem;
|
39
|
-
font-size: 0.875rem;
|
40
|
-
font-weight: 500;
|
41
|
-
color: var(--gray-11);
|
42
|
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
43
|
-
}
|
44
|
-
|
45
|
-
pre.shiki[data-title][data-language]::after {
|
46
|
-
content: attr(data-language);
|
47
|
-
position: absolute;
|
48
|
-
top: -2rem;
|
49
|
-
right: 1rem;
|
50
|
-
font-size: 0.75rem;
|
51
|
-
color: var(--gray-9);
|
52
|
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
53
|
-
}
|
54
|
-
|
55
|
-
.code-block-copy {
|
56
|
-
position: absolute;
|
57
|
-
top: 0.5rem;
|
58
|
-
right: 0.5rem;
|
59
|
-
padding: 0.25rem 0.5rem;
|
60
|
-
font-size: 0.75rem;
|
61
|
-
cursor: pointer;
|
62
|
-
border: none;
|
63
|
-
border-radius: 4px;
|
64
|
-
transition: all 0.2s;
|
65
|
-
background-color: ${appearance === `dark` ? `rgba(0, 0, 0, 0.5)` : `rgba(255, 255, 255, 0.8)`};
|
66
|
-
backdrop-filter: blur(4px);
|
67
|
-
color: ${appearance === `dark` ? `#fff` : `#000`};
|
68
|
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
69
|
-
}
|
70
|
-
|
71
|
-
pre.shiki[data-title] .code-block-copy {
|
72
|
-
top: -2rem;
|
73
|
-
right: 6rem;
|
74
|
-
background-color: transparent;
|
75
|
-
color: var(--gray-11);
|
76
|
-
}
|
77
|
-
|
78
|
-
.code-block-copy:hover {
|
79
|
-
background-color: var(--accent-9) !important;
|
80
|
-
color: white !important;
|
81
|
-
}
|
82
|
-
|
83
|
-
.code-block-copy[data-copied="true"] {
|
84
|
-
background-color: var(--green-9) !important;
|
85
|
-
color: white !important;
|
86
|
-
}
|
87
|
-
`;
|
88
|
-
return () => {
|
89
|
-
if (styleElement && styleElement.parentNode) {
|
90
|
-
styleElement.parentNode.removeChild(styleElement);
|
91
|
-
}
|
92
|
-
};
|
93
|
-
}, [appearance]);
|
94
|
-
useEffect(() => {
|
95
|
-
const enhanceCodeBlocks = () => {
|
96
|
-
const codeBlocks = document.querySelectorAll(`pre.shiki:not([data-enhanced])`);
|
97
|
-
codeBlocks.forEach((block) => {
|
98
|
-
const preElement = block;
|
99
|
-
preElement.setAttribute(`data-enhanced`, `true`);
|
100
|
-
// Get language from class name
|
101
|
-
const classes = preElement.className.split(` `);
|
102
|
-
const language = classes.find(c => c !== `shiki` && c !== `shiki-light` && c !== `shiki-dark`) || `text`;
|
103
|
-
// Check for title in first line
|
104
|
-
const codeElement = preElement.querySelector(`code`);
|
105
|
-
if (!codeElement)
|
106
|
-
return;
|
107
|
-
const firstLine = codeElement.textContent?.split(`\n`)[0] || ``;
|
108
|
-
let title = ``;
|
109
|
-
const titleMatch = /^\/\/\s*title:\s*(.+)$/i.exec(firstLine);
|
110
|
-
if (titleMatch?.[1]) {
|
111
|
-
title = titleMatch[1];
|
112
|
-
// Remove title line from display
|
113
|
-
const firstLineElement = codeElement.querySelector(`span.line`);
|
114
|
-
if (firstLineElement) {
|
115
|
-
firstLineElement.style.display = `none`;
|
116
|
-
}
|
117
|
-
// Set data attributes for CSS
|
118
|
-
preElement.setAttribute(`data-title`, title);
|
119
|
-
preElement.setAttribute(`data-language`, language);
|
120
|
-
preElement.style.marginTop = `3rem`;
|
121
|
-
}
|
122
|
-
// Create copy button
|
123
|
-
const copyButton = document.createElement(`button`);
|
124
|
-
copyButton.className = `code-block-copy`;
|
125
|
-
copyButton.textContent = `Copy`;
|
126
|
-
copyButton.setAttribute(`data-copied`, `false`);
|
127
|
-
copyButton.onclick = async (e) => {
|
128
|
-
e.preventDefault();
|
129
|
-
e.stopPropagation();
|
130
|
-
// Get clean code without the title line
|
131
|
-
const code = codeElement.textContent || ``;
|
132
|
-
const cleanCode = title ? code.split(`\n`).slice(1).join(`\n`) : code;
|
133
|
-
try {
|
134
|
-
await navigator.clipboard.writeText(cleanCode);
|
135
|
-
copyButton.textContent = `Copied!`;
|
136
|
-
copyButton.setAttribute(`data-copied`, `true`);
|
137
|
-
setTimeout(() => {
|
138
|
-
copyButton.textContent = `Copy`;
|
139
|
-
copyButton.setAttribute(`data-copied`, `false`);
|
140
|
-
}, 2000);
|
141
|
-
}
|
142
|
-
catch (err) {
|
143
|
-
console.error(`Failed to copy:`, err);
|
144
|
-
}
|
145
|
-
};
|
146
|
-
// Append copy button directly to pre element
|
147
|
-
preElement.appendChild(copyButton);
|
148
|
-
});
|
149
|
-
};
|
150
|
-
// Small delay to ensure DOM is ready
|
151
|
-
const timeoutId = setTimeout(enhanceCodeBlocks, 100);
|
152
|
-
return () => {
|
153
|
-
clearTimeout(timeoutId);
|
154
|
-
// Clean up enhanced code blocks
|
155
|
-
document.querySelectorAll(`pre.shiki[data-enhanced]`).forEach(block => {
|
156
|
-
block.removeAttribute(`data-enhanced`);
|
157
|
-
block.removeAttribute(`data-title`);
|
158
|
-
block.removeAttribute(`data-language`);
|
159
|
-
const copyButton = block.querySelector(`.code-block-copy`);
|
160
|
-
if (copyButton) {
|
161
|
-
copyButton.remove();
|
162
|
-
}
|
163
|
-
// Restore hidden title lines
|
164
|
-
const firstLine = block.querySelector(`span.line`);
|
165
|
-
if (firstLine && firstLine.style.display === `none`) {
|
166
|
-
firstLine.style.display = ``;
|
167
|
-
} // Reset margin
|
168
|
-
;
|
169
|
-
block.style.marginTop = ``;
|
170
|
-
});
|
171
|
-
};
|
172
|
-
}, [location.pathname]); // Re-run when route changes
|
173
|
-
return null;
|
174
|
-
};
|
175
|
-
//# sourceMappingURL=CodeBlockEnhancer.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CodeBlockEnhancer.js","sourceRoot":"","sources":["../../../src/template/components/CodeBlockEnhancer.tsx"],"names":[],"mappings":"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A4B;IAEpD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
|
@@ -1,218 +0,0 @@
|
|
1
|
-
/* Code Block Styles */
|
2
|
-
|
3
|
-
/* Base code block container */
|
4
|
-
.code-block {
|
5
|
-
position: relative;
|
6
|
-
margin: 1rem 0;
|
7
|
-
border-radius: 8px;
|
8
|
-
overflow: hidden;
|
9
|
-
font-size: 14px;
|
10
|
-
line-height: 1.6;
|
11
|
-
}
|
12
|
-
|
13
|
-
.code-block pre {
|
14
|
-
margin: 0;
|
15
|
-
padding: 1rem;
|
16
|
-
overflow-x: auto;
|
17
|
-
background: inherit;
|
18
|
-
}
|
19
|
-
|
20
|
-
.code-block code {
|
21
|
-
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
|
22
|
-
font-variant-ligatures: contextual;
|
23
|
-
}
|
24
|
-
|
25
|
-
/* Shiki theme switching with CSS variables */
|
26
|
-
/* Default to light theme */
|
27
|
-
:root {
|
28
|
-
color-scheme: light;
|
29
|
-
}
|
30
|
-
|
31
|
-
/* When dark mode is active */
|
32
|
-
.dark {
|
33
|
-
color-scheme: dark;
|
34
|
-
}
|
35
|
-
|
36
|
-
/* Shiki token colors for light theme (github-light) */
|
37
|
-
:root {
|
38
|
-
--shiki-color-text: #24292e;
|
39
|
-
--shiki-color-background: #f6f8fa;
|
40
|
-
--shiki-token-constant: #005cc5;
|
41
|
-
--shiki-token-string: #032f62;
|
42
|
-
--shiki-token-comment: #6a737d;
|
43
|
-
--shiki-token-keyword: #d73a49;
|
44
|
-
--shiki-token-parameter: #e36209;
|
45
|
-
--shiki-token-function: #6f42c1;
|
46
|
-
--shiki-token-string-expression: #032f62;
|
47
|
-
--shiki-token-punctuation: #24292e;
|
48
|
-
--shiki-token-link: #032f62;
|
49
|
-
}
|
50
|
-
|
51
|
-
/* Shiki token colors for dark theme (tokyo-night) */
|
52
|
-
.dark {
|
53
|
-
--shiki-color-text: #c0caf5;
|
54
|
-
--shiki-color-background: #1a1b26;
|
55
|
-
--shiki-token-constant: #ff9e64;
|
56
|
-
--shiki-token-string: #9ece6a;
|
57
|
-
--shiki-token-comment: #565f89;
|
58
|
-
--shiki-token-keyword: #bb9af7;
|
59
|
-
--shiki-token-parameter: #e0af68;
|
60
|
-
--shiki-token-function: #7aa2f7;
|
61
|
-
--shiki-token-string-expression: #9ece6a;
|
62
|
-
--shiki-token-punctuation: #c0caf5;
|
63
|
-
--shiki-token-link: #9ece6a;
|
64
|
-
}
|
65
|
-
|
66
|
-
/* Shiki code blocks */
|
67
|
-
pre.shiki {
|
68
|
-
margin: 1rem 0;
|
69
|
-
padding: 1rem;
|
70
|
-
border-radius: 8px;
|
71
|
-
overflow-x: auto;
|
72
|
-
font-size: 14px;
|
73
|
-
line-height: 1.6;
|
74
|
-
background-color: var(--shiki-color-background);
|
75
|
-
color: var(--shiki-color-text);
|
76
|
-
}
|
77
|
-
|
78
|
-
pre.shiki code {
|
79
|
-
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
|
80
|
-
font-variant-ligatures: contextual;
|
81
|
-
}
|
82
|
-
|
83
|
-
/* Line numbers */
|
84
|
-
.code-block[data-line-numbers="true"] pre {
|
85
|
-
padding-left: 3.5rem;
|
86
|
-
position: relative;
|
87
|
-
}
|
88
|
-
|
89
|
-
.code-block[data-line-numbers="true"] .line {
|
90
|
-
position: relative;
|
91
|
-
}
|
92
|
-
|
93
|
-
.code-block[data-line-numbers="true"] .line::before {
|
94
|
-
content: attr(data-line);
|
95
|
-
position: absolute;
|
96
|
-
left: -3rem;
|
97
|
-
width: 2.5rem;
|
98
|
-
text-align: right;
|
99
|
-
color: var(--gray-a6);
|
100
|
-
user-select: none;
|
101
|
-
}
|
102
|
-
|
103
|
-
/* Line highlighting */
|
104
|
-
.code-block .line[data-highlighted="true"] {
|
105
|
-
background-color: var(--amber-a3);
|
106
|
-
display: block;
|
107
|
-
margin: 0 -1rem;
|
108
|
-
padding: 0 1rem;
|
109
|
-
}
|
110
|
-
|
111
|
-
/* Diff lines */
|
112
|
-
.code-block .line[data-diff="+"] {
|
113
|
-
background-color: var(--green-a3);
|
114
|
-
display: block;
|
115
|
-
margin: 0 -1rem;
|
116
|
-
padding: 0 1rem;
|
117
|
-
}
|
118
|
-
|
119
|
-
.code-block .line[data-diff="-"] {
|
120
|
-
background-color: var(--red-a3);
|
121
|
-
display: block;
|
122
|
-
margin: 0 -1rem;
|
123
|
-
padding: 0 1rem;
|
124
|
-
}
|
125
|
-
|
126
|
-
.code-block .line[data-diff="+"]::before {
|
127
|
-
content: "+ ";
|
128
|
-
color: var(--green-11);
|
129
|
-
font-weight: bold;
|
130
|
-
}
|
131
|
-
|
132
|
-
.code-block .line[data-diff="-"]::before {
|
133
|
-
content: "- ";
|
134
|
-
color: var(--red-11);
|
135
|
-
font-weight: bold;
|
136
|
-
}
|
137
|
-
|
138
|
-
/* Focus lines */
|
139
|
-
.code-block .line:not([data-focus="true"]) {
|
140
|
-
opacity: 0.5;
|
141
|
-
filter: grayscale(100%);
|
142
|
-
transition: opacity 0.2s, filter 0.2s;
|
143
|
-
}
|
144
|
-
|
145
|
-
.code-block:hover .line:not([data-focus="true"]) {
|
146
|
-
opacity: 0.8;
|
147
|
-
filter: grayscale(0%);
|
148
|
-
}
|
149
|
-
|
150
|
-
/* Copy button */
|
151
|
-
.code-block-copy {
|
152
|
-
position: absolute;
|
153
|
-
top: 0.5rem;
|
154
|
-
right: 0.5rem;
|
155
|
-
padding: 0.25rem 0.5rem;
|
156
|
-
border-radius: 4px;
|
157
|
-
background: var(--gray-a3);
|
158
|
-
color: var(--gray-12);
|
159
|
-
border: 1px solid var(--gray-a5);
|
160
|
-
cursor: pointer;
|
161
|
-
font-size: 12px;
|
162
|
-
transition: all 0.2s;
|
163
|
-
}
|
164
|
-
|
165
|
-
.code-block-copy:hover {
|
166
|
-
background: var(--gray-a4);
|
167
|
-
border-color: var(--gray-a6);
|
168
|
-
}
|
169
|
-
|
170
|
-
.code-block-copy.copied {
|
171
|
-
background: var(--green-a3);
|
172
|
-
border-color: var(--green-a5);
|
173
|
-
color: var(--green-11);
|
174
|
-
}
|
175
|
-
|
176
|
-
/* Language badge */
|
177
|
-
.code-block-lang {
|
178
|
-
position: absolute;
|
179
|
-
top: 0;
|
180
|
-
right: 0;
|
181
|
-
padding: 0.25rem 0.75rem;
|
182
|
-
background: var(--gray-a3);
|
183
|
-
color: var(--gray-11);
|
184
|
-
font-size: 12px;
|
185
|
-
font-weight: 500;
|
186
|
-
border-bottom-left-radius: 4px;
|
187
|
-
user-select: none;
|
188
|
-
}
|
189
|
-
|
190
|
-
/* Scrollbar styling */
|
191
|
-
.code-block pre::-webkit-scrollbar {
|
192
|
-
height: 8px;
|
193
|
-
width: 8px;
|
194
|
-
}
|
195
|
-
|
196
|
-
.code-block pre::-webkit-scrollbar-track {
|
197
|
-
background: var(--gray-a3);
|
198
|
-
border-radius: 4px;
|
199
|
-
}
|
200
|
-
|
201
|
-
.code-block pre::-webkit-scrollbar-thumb {
|
202
|
-
background: var(--gray-a6);
|
203
|
-
border-radius: 4px;
|
204
|
-
}
|
205
|
-
|
206
|
-
.code-block pre::-webkit-scrollbar-thumb:hover {
|
207
|
-
background: var(--gray-a7);
|
208
|
-
}
|
209
|
-
|
210
|
-
/* Inline code */
|
211
|
-
code:not(.code-block code) {
|
212
|
-
padding: 0.2em 0.4em;
|
213
|
-
margin: 0;
|
214
|
-
font-size: 0.85em;
|
215
|
-
background-color: var(--gray-a3);
|
216
|
-
border-radius: 4px;
|
217
|
-
font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
|
218
|
-
}
|