polen 0.11.0-next.8 → 0.11.0-next.9
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/lib/react-router-aid/react-router-aid.d.ts +5 -3
- package/build/lib/react-router-aid/react-router-aid.d.ts.map +1 -1
- package/build/lib/react-router-aid/react-router-aid.js +7 -4
- package/build/lib/react-router-aid/react-router-aid.js.map +1 -1
- package/build/template/routes/changelog.js +2 -2
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/index.js +2 -2
- package/build/template/routes/index.js.map +1 -1
- package/build/template/routes/pages.js +2 -2
- package/build/template/routes/pages.js.map +1 -1
- package/build/template/routes/reference.d.ts +27 -4
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +76 -17
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.js +3 -3
- package/build/template/routes/root.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/react-router-aid/react-router-aid.ts +12 -6
- package/src/template/routes/changelog.tsx +2 -2
- package/src/template/routes/index.tsx +2 -2
- package/src/template/routes/pages.tsx +2 -2
- package/src/template/routes/reference.tsx +83 -17
- package/src/template/routes/root.tsx +3 -3
- package/build/template/routes/reference.$type.$field.d.ts +0 -5
- package/build/template/routes/reference.$type.$field.d.ts.map +0 -1
- package/build/template/routes/reference.$type.$field.js +0 -31
- package/build/template/routes/reference.$type.$field.js.map +0 -1
- package/build/template/routes/reference.$type.d.ts +0 -9
- package/build/template/routes/reference.$type.d.ts.map +0 -1
- package/build/template/routes/reference.$type.js +0 -25
- package/build/template/routes/reference.$type.js.map +0 -1
- package/build/template/routes/reference.version.$version.$type.$field.d.ts +0 -6
- package/build/template/routes/reference.version.$version.$type.$field.d.ts.map +0 -1
- package/build/template/routes/reference.version.$version.$type.$field.js +0 -32
- package/build/template/routes/reference.version.$version.$type.$field.js.map +0 -1
- package/build/template/routes/reference.version.$version.$type.d.ts +0 -11
- package/build/template/routes/reference.version.$version.$type.d.ts.map +0 -1
- package/build/template/routes/reference.version.$version.$type.js +0 -26
- package/build/template/routes/reference.version.$version.$type.js.map +0 -1
- package/src/template/routes/reference.$type.$field.tsx +0 -34
- package/src/template/routes/reference.$type.tsx +0 -29
- package/src/template/routes/reference.version.$version.$type.$field.tsx +0 -35
- package/src/template/routes/reference.version.$version.$type.tsx +0 -30
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { ReactRouter } from '#dep/react-router/index';
|
2
|
+
import type { React } from '#dep/react/index';
|
2
3
|
import type { Http } from '@wollybeard/kit';
|
3
4
|
export * from './get-paths-patterns.js';
|
4
5
|
export type RouteObject = RouteObjectIndex | RouteObjectNonIndex;
|
@@ -11,7 +12,8 @@ export interface RouteObjectNonIndex extends ReactRouter.NonIndexRouteObject {
|
|
11
12
|
export interface RouteHandle {
|
12
13
|
statusCode?: Http.Status.Code.All;
|
13
14
|
}
|
14
|
-
export declare const
|
15
|
-
export type RouteObjectIndexInput =
|
16
|
-
export
|
15
|
+
export declare const route: <routeObject extends RouteObject>(routeObject: routeObject) => routeObject;
|
16
|
+
export type RouteObjectIndexInput = RouteObjectIndexInputConfig | React.ComponentType;
|
17
|
+
export type RouteObjectIndexInputConfig = Omit<RouteObjectIndex, `index` | `children`>;
|
18
|
+
export declare const routeIndex: (input: RouteObjectIndexInput) => RouteObjectIndex;
|
17
19
|
//# sourceMappingURL=react-router-aid.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"react-router-aid.d.ts","sourceRoot":"","sources":["../../../src/lib/react-router-aid/react-router-aid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C,cAAc,yBAAyB,CAAA;AAEvC,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;AAEhE,MAAM,WAAW,gBAAiB,SAAQ,WAA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CAAA"}
|
@@ -1,15 +1,18 @@
|
|
1
1
|
export * from './get-paths-patterns.js';
|
2
|
-
export const
|
2
|
+
export const route = (routeObject) => {
|
3
3
|
return {
|
4
|
-
id: routeObject.path,
|
5
4
|
...routeObject,
|
6
5
|
};
|
7
6
|
};
|
8
|
-
export const
|
7
|
+
export const routeIndex = (input) => {
|
8
|
+
const routeConfig = isComponentType(input) ? { Component: input } : input;
|
9
9
|
return {
|
10
|
-
...
|
10
|
+
...routeConfig,
|
11
11
|
index: true,
|
12
12
|
children: undefined,
|
13
13
|
};
|
14
14
|
};
|
15
|
+
const isComponentType = (value) => {
|
16
|
+
return typeof value === 'function';
|
17
|
+
};
|
15
18
|
//# sourceMappingURL=react-router-aid.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"react-router-aid.js","sourceRoot":"","sources":["../../../src/lib/react-router-aid/react-router-aid.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"react-router-aid.js","sourceRoot":"","sources":["../../../src/lib/react-router-aid/react-router-aid.ts"],"names":[],"mappings":"AAIA,cAAc,yBAAyB,CAAA;AAiBvC,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,WAAwB,EACX,EAAE;IACf,OAAO;QACL,GAAG,WAAW;KACf,CAAA;AACH,CAAC,CAAA;AAKD,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAA4B,EACV,EAAE;IACpB,MAAM,WAAW,GAAgC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IACtG,OAAO;QACL,GAAG,WAAW;QACd,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,SAAS;KACpB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,KAAc,EAAgC,EAAE;IACvE,OAAO,OAAO,KAAK,KAAK,UAAU,CAAA;AACpC,CAAC,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { route } from '#lib/react-router-aid/react-router-aid';
|
3
3
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
4
|
import { Changelog } from '../components/Changelog.js';
|
5
5
|
import { ChangelogLayout } from '../layouts/index.js';
|
@@ -22,7 +22,7 @@ const Component = () => {
|
|
22
22
|
}
|
23
23
|
return (_jsx(ChangelogLayout, { versions: data.changesets, children: _jsx(Changelog, { changesets: data.changesets }) }));
|
24
24
|
};
|
25
|
-
export const changelog =
|
25
|
+
export const changelog = route({
|
26
26
|
path: `changelog`,
|
27
27
|
loader,
|
28
28
|
Component,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../../src/template/routes/changelog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../../src/template/routes/changelog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,IAAI,EAAE;IACrC,+BAA+B;IAC/B,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QACzB,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,CAAA;IAC3B,CAAC;IAED,sDAAsD;IACtD,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,gBAAgB,EAAE,CAAA;IAExD,OAAO;QACL,UAAU;KACX,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,IAAI,GAAG,aAAa,EAAiB,CAAA;IAE3C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,wEAAsD,CAAA;IAC/D,CAAC;IAED,OAAO,CACL,KAAC,eAAe,IAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,YACxC,KAAC,SAAS,IAAC,UAAU,EAAE,IAAI,CAAC,UAA2E,GAAI,GAC3F,CACnB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;IAC7B,IAAI,EAAE,WAAW;IACjB,MAAM;IACN,SAAS;CACV,CAAC,CAAA"}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { routeIndex } from '#lib/react-router-aid/react-router-aid';
|
3
3
|
import { Box } from '@radix-ui/themes';
|
4
4
|
const Component = () => {
|
5
5
|
return _jsx(Box, { children: "home todo" });
|
6
6
|
};
|
7
|
-
export const index =
|
7
|
+
export const index = routeIndex({
|
8
8
|
Component,
|
9
9
|
});
|
10
10
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/template/routes/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/template/routes/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAA;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEtC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,KAAC,GAAG,4BAAgB,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;IAC9B,SAAS;CACV,CAAC,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { route } from '#lib/react-router-aid/react-router-aid';
|
3
3
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
4
|
import { SidebarLayout } from '#template/layouts/index';
|
5
5
|
import { MDXProvider } from '@mdx-js/react';
|
@@ -67,7 +67,7 @@ const Component = () => {
|
|
67
67
|
CodeBlock: (props) => _jsx(CodeBlock, { ...props, schema: schema }),
|
68
68
|
}, children: _jsx(SidebarLayout, { sidebar: sidebar, children: _jsx(Outlet, {}) }) }));
|
69
69
|
};
|
70
|
-
export const pages =
|
70
|
+
export const pages = route({
|
71
71
|
// Pathless layout route - doesn't affect URL paths
|
72
72
|
loader,
|
73
73
|
Component,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../../src/template/routes/pages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"pages.js","sourceRoot":"","sources":["../../../src/template/routes/pages.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EACL,KAAK,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,OAAO,EACP,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,0BAA0B,MAAM,oDAAoD,CAAA;AAC3F,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ader: ({ params }: any) => Promise<{
|
3
|
+
schema: GrafaidOld.Schema.Schema;
|
4
|
+
currentVersion: any;
|
5
|
+
availableVersions: string[];
|
6
|
+
}>;
|
7
|
+
/**
|
8
|
+
* Reference documentation with proper nested structure - all routes in one file
|
9
|
+
*/
|
2
10
|
export declare const reference: {
|
11
|
+
id: string;
|
3
12
|
path: string;
|
4
13
|
loader: ({ params }: any) => Promise<{
|
5
14
|
schema: GrafaidOld.Schema.Schema;
|
@@ -7,13 +16,27 @@ export declare const reference: {
|
|
7
16
|
availableVersions: string[];
|
8
17
|
}>;
|
9
18
|
Component: () => import("react/jsx-runtime").JSX.Element;
|
10
|
-
children: {
|
19
|
+
children: (import("#lib/react-router-aid/react-router-aid").RouteObjectIndex | {
|
11
20
|
path: string;
|
12
|
-
Component: () =>
|
21
|
+
Component: () => import("react/jsx-runtime").JSX.Element;
|
22
|
+
errorElement: import("react/jsx-runtime").JSX.Element;
|
13
23
|
children: {
|
14
24
|
path: string;
|
15
|
-
Component: () =>
|
25
|
+
Component: () => import("react/jsx-runtime").JSX.Element;
|
26
|
+
errorElement: import("react/jsx-runtime").JSX.Element;
|
16
27
|
}[];
|
17
|
-
}
|
28
|
+
} | {
|
29
|
+
path: string;
|
30
|
+
children: (import("#lib/react-router-aid/react-router-aid").RouteObjectIndex | {
|
31
|
+
path: string;
|
32
|
+
Component: () => import("react/jsx-runtime").JSX.Element;
|
33
|
+
errorElement: import("react/jsx-runtime").JSX.Element;
|
34
|
+
children: {
|
35
|
+
path: string;
|
36
|
+
Component: () => import("react/jsx-runtime").JSX.Element;
|
37
|
+
errorElement: import("react/jsx-runtime").JSX.Element;
|
38
|
+
}[];
|
39
|
+
})[];
|
40
|
+
})[];
|
18
41
|
};
|
19
42
|
//# sourceMappingURL=reference.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAcnD,eAAO,MAAM,MAAM;;;;EAcjB,CAAA;AAgHF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYpB,CAAA"}
|
@@ -1,17 +1,18 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { GrafaidOld } from '#lib/grafaid-old/index';
|
3
|
-
import {
|
3
|
+
import { Grafaid } from '#lib/grafaid/index';
|
4
|
+
import { route, routeIndex } from '#lib/react-router-aid/react-router-aid';
|
4
5
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
5
6
|
import { Box } from '@radix-ui/themes';
|
6
|
-
import { Outlet } from 'react-router';
|
7
|
+
import { Outlet, useParams, useRouteLoaderData } from 'react-router';
|
8
|
+
import { Field } from '../components/Field.js';
|
7
9
|
import { MissingSchema } from '../components/MissingSchema.js';
|
10
|
+
import { NamedType } from '../components/NamedType.js';
|
8
11
|
import { VersionSelector } from '../components/VersionSelector.js';
|
9
12
|
import { SidebarLayout } from '../layouts/index.js';
|
10
13
|
import { VERSION_LATEST } from '../lib/schema-utils/constants.js';
|
11
14
|
import { schemaSource } from '../sources/schema-source.js';
|
12
|
-
|
13
|
-
import { referenceVersion$version$type } from './reference.version.$version.$type.js';
|
14
|
-
const loader = createLoader(async ({ params }) => {
|
15
|
+
export const loader = createLoader(async ({ params }) => {
|
15
16
|
// Handle both versioned and unversioned routes:
|
16
17
|
// - Versioned: /reference/version/:version/:type → params.version exists
|
17
18
|
// - Unversioned: /reference/:type → params.version is undefined, defaults to latest
|
@@ -24,7 +25,7 @@ const loader = createLoader(async ({ params }) => {
|
|
24
25
|
availableVersions,
|
25
26
|
};
|
26
27
|
});
|
27
|
-
const
|
28
|
+
const RouteReferenceComponent = () => {
|
28
29
|
const data = useLoaderData();
|
29
30
|
if (!data.schema) {
|
30
31
|
return _jsx(MissingSchema, {});
|
@@ -53,18 +54,76 @@ const Component = () => {
|
|
53
54
|
}
|
54
55
|
return (_jsxs(SidebarLayout, { sidebar: sidebarItems, children: [_jsx(Box, { mb: `4`, children: _jsx(VersionSelector, { availableVersions: data.availableVersions, currentVersion: data.currentVersion }) }), _jsx(Outlet, {})] }));
|
55
56
|
};
|
56
|
-
//
|
57
|
-
const
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
57
|
+
// Shared hooks for schema data validation and retrieval
|
58
|
+
const useReferenceSchema = () => {
|
59
|
+
const data = useRouteLoaderData('reference');
|
60
|
+
if (!data?.schema) {
|
61
|
+
throw new Error('Schema not found');
|
62
|
+
}
|
63
|
+
return data;
|
64
|
+
};
|
65
|
+
const useSchemaType = (typeName) => {
|
66
|
+
const { schema } = useReferenceSchema();
|
67
|
+
const type = schema.getType(typeName);
|
68
|
+
if (!type) {
|
69
|
+
throw new Error(`Could not find type ${typeName}`);
|
70
|
+
}
|
71
|
+
return type;
|
72
|
+
};
|
73
|
+
const useSchemaField = (typeName, fieldName) => {
|
74
|
+
const type = useSchemaType(typeName);
|
75
|
+
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
76
|
+
throw new Error(`Type ${typeName} does not have fields`);
|
77
|
+
}
|
78
|
+
const fields = type.getFields();
|
79
|
+
const field = fields[fieldName];
|
80
|
+
if (!field) {
|
81
|
+
throw new Error(`Could not find field ${fieldName} on type ${typeName}`);
|
82
|
+
}
|
83
|
+
return field;
|
84
|
+
};
|
85
|
+
const RouteComponentIndex = () => {
|
86
|
+
return _jsx("div", { children: "Select a type from the sidebar to view its documentation." });
|
87
|
+
};
|
88
|
+
const RouteComponentType = () => {
|
89
|
+
const params = useParams();
|
90
|
+
const type = useSchemaType(params.type);
|
91
|
+
return _jsx(NamedType, { data: type });
|
92
|
+
};
|
93
|
+
const RouteComponentTypeField = () => {
|
94
|
+
const params = useParams();
|
95
|
+
const field = useSchemaField(params.type, params.field);
|
96
|
+
return _jsx(Field, { data: field });
|
97
|
+
};
|
98
|
+
const typeAndFieldRoutes = [
|
99
|
+
routeIndex(RouteComponentIndex),
|
100
|
+
route({
|
101
|
+
path: `:type`,
|
102
|
+
Component: RouteComponentType,
|
103
|
+
errorElement: _jsx(MissingSchema, {}),
|
104
|
+
children: [
|
105
|
+
route({
|
106
|
+
path: `:field`,
|
107
|
+
Component: RouteComponentTypeField,
|
108
|
+
errorElement: _jsx(MissingSchema, {}),
|
109
|
+
}),
|
110
|
+
],
|
111
|
+
}),
|
112
|
+
];
|
113
|
+
/**
|
114
|
+
* Reference documentation with proper nested structure - all routes in one file
|
115
|
+
*/
|
116
|
+
export const reference = route({
|
117
|
+
id: 'reference',
|
65
118
|
path: `reference`,
|
66
119
|
loader,
|
67
|
-
Component,
|
68
|
-
children: [
|
120
|
+
Component: RouteReferenceComponent,
|
121
|
+
children: [
|
122
|
+
...typeAndFieldRoutes,
|
123
|
+
route({
|
124
|
+
path: `version/:version`,
|
125
|
+
children: typeAndFieldRoutes,
|
126
|
+
}),
|
127
|
+
],
|
69
128
|
});
|
70
129
|
//# sourceMappingURL=reference.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../../src/template/routes/reference.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,wCA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AC,IAAI,CAAC,CAAA;IACvC,OAAO,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACnC,MAAM,MAAM,GAAG,SAAS,EAAqC,CAAA;IAC7D,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IACvD,OAAO,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,GAAI,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,kBAAkB,GAAG;IACzB,UAAU,CAAC,mBAAmB,CAAC;IAC/B,KAAK,CAAC;QACJ,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,kBAAkB;QAC7B,YAAY,EAAE,KAAC,aAAa,KAAG;QAC/B,QAAQ,EAAE;YACR,KAAK,CAAC;gBACJ,IAAI,EAAE,QAAQ;gBACd,SAAS,EAAE,uBAAuB;gBAClC,YAAY,EAAE,KAAC,aAAa,KAAG;aAChC,CAAC;SACH;KACF,CAAC;CACH,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;IAC7B,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,WAAW;IACjB,MAAM;IACN,SAAS,EAAE,uBAAuB;IAClC,QAAQ,EAAE;QACR,GAAG,kBAAkB;QACrB,KAAK,CAAC;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;KACH;CACF,CAAC,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { route } from '#lib/react-router-aid/react-router-aid';
|
3
3
|
import { Box, Flex, Theme } from '@radix-ui/themes';
|
4
4
|
import { Link as LinkReactRouter } from 'react-router';
|
5
5
|
import { Outlet, ScrollRestoration } from 'react-router';
|
@@ -50,7 +50,7 @@ if (PROJECT_SCHEMA) {
|
|
50
50
|
//
|
51
51
|
//
|
52
52
|
//
|
53
|
-
const notFoundRoute =
|
53
|
+
const notFoundRoute = route({
|
54
54
|
id: `*_not_found`,
|
55
55
|
path: `*`,
|
56
56
|
Component: NotFound,
|
@@ -65,7 +65,7 @@ children.push(notFoundRoute);
|
|
65
65
|
// ━━━━━━━━━━━━━━ • Root Route
|
66
66
|
//
|
67
67
|
//
|
68
|
-
export const root =
|
68
|
+
export const root = route({
|
69
69
|
path: `/`,
|
70
70
|
Component,
|
71
71
|
children,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../../src/template/routes/root.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAA;AAC9D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,OAAO,MAAM,uCAAuC,CAAA;AAC3D,OAAO,YAAY,MAAM,sCAAsC,CAAA;AAC/D,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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AAE;AAEF,MAAM,aAAa,GAAG,KAAK,CAAC;IAC1B,EAAE,EAAE,aAAa;IACjB,IAAI,EAAE,GAAG;IACT,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE;QACN,UAAU,EAAE,GAAG;KAChB;CACF,CAAC,CAAA;AACF,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAE5B,EAAE;AACF,EAAE;AACF,EAAE;AACF,8BAA8B;AAC9B,EAAE;AACF,EAAE;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC;IACxB,IAAI,EAAE,GAAG;IACT,SAAS;IACT,QAAQ;CACT,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import type { ReactRouter } from '#dep/react-router/index'
|
2
|
+
import type { React } from '#dep/react/index'
|
2
3
|
import type { Http } from '@wollybeard/kit'
|
3
4
|
|
4
5
|
export * from './get-paths-patterns.js'
|
@@ -18,23 +19,28 @@ export interface RouteHandle {
|
|
18
19
|
statusCode?: Http.Status.Code.All
|
19
20
|
}
|
20
21
|
|
21
|
-
export const
|
22
|
+
export const route = <routeObject extends RouteObject>(
|
22
23
|
routeObject: routeObject,
|
23
24
|
): routeObject => {
|
24
25
|
return {
|
25
|
-
id: routeObject.path,
|
26
26
|
...routeObject,
|
27
27
|
}
|
28
28
|
}
|
29
29
|
|
30
|
-
export type RouteObjectIndexInput =
|
30
|
+
export type RouteObjectIndexInput = RouteObjectIndexInputConfig | React.ComponentType
|
31
|
+
export type RouteObjectIndexInputConfig = Omit<RouteObjectIndex, `index` | `children`>
|
31
32
|
|
32
|
-
export const
|
33
|
-
|
33
|
+
export const routeIndex = (
|
34
|
+
input: RouteObjectIndexInput,
|
34
35
|
): RouteObjectIndex => {
|
36
|
+
const routeConfig: RouteObjectIndexInputConfig = isComponentType(input) ? { Component: input } : input
|
35
37
|
return {
|
36
|
-
...
|
38
|
+
...routeConfig,
|
37
39
|
index: true,
|
38
40
|
children: undefined,
|
39
41
|
}
|
40
42
|
}
|
43
|
+
|
44
|
+
const isComponentType = (value: unknown): value is React.ComponentType => {
|
45
|
+
return typeof value === 'function'
|
46
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { GraphqlChangeset } from '#lib/graphql-changeset/index'
|
2
|
-
import {
|
2
|
+
import { route } from '#lib/react-router-aid/react-router-aid'
|
3
3
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
4
4
|
import { Changelog } from '../components/Changelog.js'
|
5
5
|
import { ChangelogLayout } from '../layouts/index.js'
|
@@ -33,7 +33,7 @@ const Component = () => {
|
|
33
33
|
)
|
34
34
|
}
|
35
35
|
|
36
|
-
export const changelog =
|
36
|
+
export const changelog = route({
|
37
37
|
path: `changelog`,
|
38
38
|
loader,
|
39
39
|
Component,
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { routeIndex } from '#lib/react-router-aid/react-router-aid'
|
2
2
|
import { Box } from '@radix-ui/themes'
|
3
3
|
|
4
4
|
const Component = () => {
|
5
5
|
return <Box>home todo</Box>
|
6
6
|
}
|
7
7
|
|
8
|
-
export const index =
|
8
|
+
export const index = routeIndex({
|
9
9
|
Component,
|
10
10
|
})
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { route } from '#lib/react-router-aid/react-router-aid'
|
2
2
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
3
|
import { SidebarLayout } from '#template/layouts/index'
|
4
4
|
import { MDXProvider } from '@mdx-js/react'
|
@@ -101,7 +101,7 @@ const Component = () => {
|
|
101
101
|
)
|
102
102
|
}
|
103
103
|
|
104
|
-
export const pages =
|
104
|
+
export const pages = route({
|
105
105
|
// Pathless layout route - doesn't affect URL paths
|
106
106
|
loader,
|
107
107
|
Component,
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import type { Content } from '#api/content/$'
|
2
2
|
import { GrafaidOld } from '#lib/grafaid-old/index'
|
3
|
-
import {
|
3
|
+
import { Grafaid } from '#lib/grafaid/index'
|
4
|
+
import { route, routeIndex } from '#lib/react-router-aid/react-router-aid'
|
4
5
|
import { createLoader, useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
5
6
|
import { Box } from '@radix-ui/themes'
|
6
|
-
import { Outlet } from 'react-router'
|
7
|
+
import { Outlet, useParams, useRouteLoaderData } from 'react-router'
|
8
|
+
import { Field } from '../components/Field.js'
|
7
9
|
import { MissingSchema } from '../components/MissingSchema.js'
|
10
|
+
import { NamedType } from '../components/NamedType.js'
|
8
11
|
import { VersionSelector } from '../components/VersionSelector.js'
|
9
12
|
import { SidebarLayout } from '../layouts/index.js'
|
10
13
|
import { VERSION_LATEST } from '../lib/schema-utils/constants.js'
|
11
14
|
import { schemaSource } from '../sources/schema-source.js'
|
12
|
-
import { reference$type } from './reference.$type.js'
|
13
|
-
import { referenceVersion$version$type } from './reference.version.$version.$type.js'
|
14
15
|
|
15
|
-
const loader = createLoader(async ({ params }) => {
|
16
|
+
export const loader = createLoader(async ({ params }) => {
|
16
17
|
// Handle both versioned and unversioned routes:
|
17
18
|
// - Versioned: /reference/version/:version/:type → params.version exists
|
18
19
|
// - Unversioned: /reference/:type → params.version is undefined, defaults to latest
|
@@ -28,7 +29,7 @@ const loader = createLoader(async ({ params }) => {
|
|
28
29
|
}
|
29
30
|
})
|
30
31
|
|
31
|
-
const
|
32
|
+
const RouteReferenceComponent = () => {
|
32
33
|
const data = useLoaderData<typeof loader>()
|
33
34
|
|
34
35
|
if (!data.schema) {
|
@@ -74,18 +75,83 @@ const Component = () => {
|
|
74
75
|
)
|
75
76
|
}
|
76
77
|
|
77
|
-
//
|
78
|
-
const
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
// Shared hooks for schema data validation and retrieval
|
79
|
+
const useReferenceSchema = () => {
|
80
|
+
const data = useRouteLoaderData('reference') as Awaited<ReturnType<typeof loader>>
|
81
|
+
if (!data?.schema) {
|
82
|
+
throw new Error('Schema not found')
|
83
|
+
}
|
84
|
+
return data
|
85
|
+
}
|
86
|
+
|
87
|
+
const useSchemaType = (typeName: string) => {
|
88
|
+
const { schema } = useReferenceSchema()
|
89
|
+
const type = schema.getType(typeName)
|
90
|
+
if (!type) {
|
91
|
+
throw new Error(`Could not find type ${typeName}`)
|
92
|
+
}
|
93
|
+
return type
|
94
|
+
}
|
95
|
+
|
96
|
+
const useSchemaField = (typeName: string, fieldName: string) => {
|
97
|
+
const type = useSchemaType(typeName)
|
98
|
+
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
99
|
+
throw new Error(`Type ${typeName} does not have fields`)
|
100
|
+
}
|
101
|
+
|
102
|
+
const fields = type.getFields()
|
103
|
+
const field = fields[fieldName]
|
104
|
+
if (!field) {
|
105
|
+
throw new Error(`Could not find field ${fieldName} on type ${typeName}`)
|
106
|
+
}
|
107
|
+
return field
|
108
|
+
}
|
109
|
+
|
110
|
+
const RouteComponentIndex = () => {
|
111
|
+
return <div>Select a type from the sidebar to view its documentation.</div>
|
112
|
+
}
|
113
|
+
|
114
|
+
const RouteComponentType = () => {
|
115
|
+
const params = useParams() as { type: string }
|
116
|
+
const type = useSchemaType(params.type)
|
117
|
+
return <NamedType data={type} />
|
118
|
+
}
|
119
|
+
|
120
|
+
const RouteComponentTypeField = () => {
|
121
|
+
const params = useParams() as { type: string; field: string }
|
122
|
+
const field = useSchemaField(params.type, params.field)
|
123
|
+
return <Field data={field} />
|
124
|
+
}
|
125
|
+
|
126
|
+
const typeAndFieldRoutes = [
|
127
|
+
routeIndex(RouteComponentIndex),
|
128
|
+
route({
|
129
|
+
path: `:type`,
|
130
|
+
Component: RouteComponentType,
|
131
|
+
errorElement: <MissingSchema />,
|
132
|
+
children: [
|
133
|
+
route({
|
134
|
+
path: `:field`,
|
135
|
+
Component: RouteComponentTypeField,
|
136
|
+
errorElement: <MissingSchema />,
|
137
|
+
}),
|
138
|
+
],
|
139
|
+
}),
|
140
|
+
]
|
84
141
|
|
85
|
-
|
86
|
-
|
142
|
+
/**
|
143
|
+
* Reference documentation with proper nested structure - all routes in one file
|
144
|
+
*/
|
145
|
+
export const reference = route({
|
146
|
+
id: 'reference',
|
87
147
|
path: `reference`,
|
88
148
|
loader,
|
89
|
-
Component,
|
90
|
-
children: [
|
149
|
+
Component: RouteReferenceComponent,
|
150
|
+
children: [
|
151
|
+
...typeAndFieldRoutes,
|
152
|
+
route({
|
153
|
+
path: `version/:version`,
|
154
|
+
children: typeAndFieldRoutes,
|
155
|
+
}),
|
156
|
+
],
|
91
157
|
})
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ReactRouter } from '#dep/react-router/index'
|
2
|
-
import {
|
2
|
+
import { route } from '#lib/react-router-aid/react-router-aid'
|
3
3
|
import { Box, Flex, Theme } from '@radix-ui/themes'
|
4
4
|
import { Link as LinkReactRouter } from 'react-router'
|
5
5
|
import { Outlet, ScrollRestoration } from 'react-router'
|
@@ -105,7 +105,7 @@ if (PROJECT_SCHEMA) {
|
|
105
105
|
//
|
106
106
|
//
|
107
107
|
|
108
|
-
const notFoundRoute =
|
108
|
+
const notFoundRoute = route({
|
109
109
|
id: `*_not_found`,
|
110
110
|
path: `*`,
|
111
111
|
Component: NotFound,
|
@@ -122,7 +122,7 @@ children.push(notFoundRoute)
|
|
122
122
|
//
|
123
123
|
//
|
124
124
|
|
125
|
-
export const root =
|
125
|
+
export const root = route({
|
126
126
|
path: `/`,
|
127
127
|
Component,
|
128
128
|
children,
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.$field.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.$field.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,oBAAoB;;;CAG/B,CAAA"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Grafaid } from '#lib/grafaid/index';
|
3
|
-
import { ReactRouterAid } from '#lib/react-router-aid/index';
|
4
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
5
|
-
import { useParams } from 'react-router';
|
6
|
-
import { Field } from '../components/Field.js';
|
7
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type)
|
16
|
-
return `Could not find type ${params.type}`;
|
17
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
18
|
-
return `Type ${params.type} does not have fields`;
|
19
|
-
}
|
20
|
-
const fields = type.getFields();
|
21
|
-
const field = fields[params.field];
|
22
|
-
if (!field) {
|
23
|
-
return `Could not find field ${params.field} on type ${params.type}`;
|
24
|
-
}
|
25
|
-
return _jsx(Field, { data: field });
|
26
|
-
};
|
27
|
-
export const reference$type$field = ReactRouterAid.createRoute({
|
28
|
-
path: `:field`,
|
29
|
-
Component,
|
30
|
-
});
|
31
|
-
//# sourceMappingURL=reference.$type.$field.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.$field.js","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.$field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAG9D,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAqC,CAAA;IAC7D,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,uBAAuB,MAAM,CAAC,IAAI,EAAE,CAAA;IACtD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,MAAM,CAAC,IAAI,uBAAuB,CAAA;IACnD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,wBAAwB,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,IAAI,EAAE,CAAA;IACtE,CAAC;IAED,OAAO,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,GAAI,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,WAAW,CAAC;IAC7D,IAAI,EAAE,QAAQ;IACd,SAAS;CACV,CAAC,CAAA"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
export declare const reference$type: {
|
2
|
-
path: string;
|
3
|
-
Component: () => string | import("react/jsx-runtime").JSX.Element;
|
4
|
-
children: {
|
5
|
-
path: string;
|
6
|
-
Component: () => string | import("react/jsx-runtime").JSX.Element;
|
7
|
-
}[];
|
8
|
-
};
|
9
|
-
//# sourceMappingURL=reference.$type.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,cAAc;;;;;;;CAIzB,CAAA"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
|
-
import { useParams } from 'react-router';
|
5
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
6
|
-
import { NamedType } from '../components/NamedType.js';
|
7
|
-
import { reference$type$field } from './reference.$type.$field.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type) {
|
16
|
-
return `Could not find type ${params.type}`;
|
17
|
-
}
|
18
|
-
return _jsx(NamedType, { data: type });
|
19
|
-
};
|
20
|
-
export const reference$type = createRoute({
|
21
|
-
path: `:type`,
|
22
|
-
Component,
|
23
|
-
children: [reference$type$field],
|
24
|
-
});
|
25
|
-
//# sourceMappingURL=reference.$type.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.$type.js","sourceRoot":"","sources":["../../../src/template/routes/reference.$type.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAGlE,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAsB,CAAA;IAE9C,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,uBAAuB,MAAM,CAAC,IAAI,EAAE,CAAA;IAC7C,CAAC;IAED,OAAO,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE,OAAO;IACb,SAAS;IACT,QAAQ,EAAE,CAAC,oBAAoB,CAAC;CACjC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.$field.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.$field.tsx"],"names":[],"mappings":"AA8BA,eAAO,MAAM,mCAAmC;;;;CAI9C,CAAA"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Grafaid } from '#lib/grafaid/index';
|
3
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
4
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
5
|
-
import { useParams } from 'react-router';
|
6
|
-
import { Field } from '../components/Field.js';
|
7
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type)
|
16
|
-
return `Could not find type ${params.type}`;
|
17
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
18
|
-
return `Type ${params.type} does not have fields`;
|
19
|
-
}
|
20
|
-
const fields = type.getFields();
|
21
|
-
const field = fields[params.field];
|
22
|
-
if (!field) {
|
23
|
-
return `Could not find field ${params.field} on type ${params.type}`;
|
24
|
-
}
|
25
|
-
return _jsx(Field, { data: field });
|
26
|
-
};
|
27
|
-
export const referenceVersion$version$type$field = createRoute({
|
28
|
-
id: `reference-version-type-field`,
|
29
|
-
path: `:field`,
|
30
|
-
Component,
|
31
|
-
});
|
32
|
-
//# sourceMappingURL=reference.version.$version.$type.$field.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.$field.js","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.$field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAG9D,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAsD,CAAA;IAC9E,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAO,uBAAuB,MAAM,CAAC,IAAI,EAAE,CAAA;IACtD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,QAAQ,MAAM,CAAC,IAAI,uBAAuB,CAAA;IACnD,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,wBAAwB,MAAM,CAAC,KAAK,YAAY,MAAM,CAAC,IAAI,EAAE,CAAA;IACtE,CAAC;IAED,OAAO,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,GAAI,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAG,WAAW,CAAC;IAC7D,EAAE,EAAE,8BAA8B;IAClC,IAAI,EAAE,QAAQ;IACd,SAAS;CACV,CAAC,CAAA"}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
export declare const referenceVersion$version$type: {
|
2
|
-
id: string;
|
3
|
-
path: string;
|
4
|
-
Component: () => import("react/jsx-runtime").JSX.Element;
|
5
|
-
children: {
|
6
|
-
id: string;
|
7
|
-
path: string;
|
8
|
-
Component: () => string | import("react/jsx-runtime").JSX.Element;
|
9
|
-
}[];
|
10
|
-
};
|
11
|
-
//# sourceMappingURL=reference.version.$version.$type.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.d.ts","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,6BAA6B;;;;;;;;;CAKxC,CAAA"}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid';
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader';
|
4
|
-
import { useParams } from 'react-router';
|
5
|
-
import { MissingSchema } from '../components/MissingSchema.js';
|
6
|
-
import { NamedType } from '../components/NamedType.js';
|
7
|
-
import { referenceVersion$version$type$field } from './reference.version.$version.$type.$field.js';
|
8
|
-
const Component = () => {
|
9
|
-
const params = useParams();
|
10
|
-
const data = useLoaderData(`reference`);
|
11
|
-
if (!data.schema) {
|
12
|
-
return _jsx(MissingSchema, {});
|
13
|
-
}
|
14
|
-
const type = data.schema.getType(params.type);
|
15
|
-
if (!type) {
|
16
|
-
return _jsxs("div", { children: ["Type not found: ", params.type] });
|
17
|
-
}
|
18
|
-
return _jsx(NamedType, { data: type });
|
19
|
-
};
|
20
|
-
export const referenceVersion$version$type = createRoute({
|
21
|
-
id: `reference-version-type`,
|
22
|
-
path: `:type`,
|
23
|
-
Component,
|
24
|
-
children: [referenceVersion$version$type$field],
|
25
|
-
});
|
26
|
-
//# sourceMappingURL=reference.version.$version.$type.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"reference.version.$version.$type.js","sourceRoot":"","sources":["../../../src/template/routes/reference.version.$version.$type.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAA;AAElG,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAuC,CAAA;IAE/D,MAAM,IAAI,GAAG,aAAa,CAA0B,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,KAAC,aAAa,KAAG,CAAA;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,8CAAsB,MAAM,CAAC,IAAI,IAAO,CAAA;IACjD,CAAC;IAED,OAAO,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,GAAI,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;IACvD,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,OAAO;IACb,SAAS;IACT,QAAQ,EAAE,CAAC,mCAAmC,CAAC;CAChD,CAAC,CAAA"}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { Grafaid } from '#lib/grafaid/index'
|
2
|
-
import { ReactRouterAid } from '#lib/react-router-aid/index'
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
4
|
-
import { useParams } from 'react-router'
|
5
|
-
import { Field } from '../components/Field.js'
|
6
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
7
|
-
import type { reference } from './reference.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string; field: string }
|
11
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
12
|
-
if (!data.schema) {
|
13
|
-
return <MissingSchema />
|
14
|
-
}
|
15
|
-
|
16
|
-
const type = data.schema.getType(params.type)
|
17
|
-
if (!type) return `Could not find type ${params.type}`
|
18
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
19
|
-
return `Type ${params.type} does not have fields`
|
20
|
-
}
|
21
|
-
|
22
|
-
const fields = type.getFields()
|
23
|
-
const field = fields[params.field]
|
24
|
-
if (!field) {
|
25
|
-
return `Could not find field ${params.field} on type ${params.type}`
|
26
|
-
}
|
27
|
-
|
28
|
-
return <Field data={field} />
|
29
|
-
}
|
30
|
-
|
31
|
-
export const reference$type$field = ReactRouterAid.createRoute({
|
32
|
-
path: `:field`,
|
33
|
-
Component,
|
34
|
-
})
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
|
-
import { useParams } from 'react-router'
|
4
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
5
|
-
import { NamedType } from '../components/NamedType.js'
|
6
|
-
import { reference$type$field } from './reference.$type.$field.js'
|
7
|
-
import type { reference } from './reference.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string }
|
11
|
-
|
12
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
13
|
-
if (!data.schema) {
|
14
|
-
return <MissingSchema />
|
15
|
-
}
|
16
|
-
|
17
|
-
const type = data.schema.getType(params.type)
|
18
|
-
if (!type) {
|
19
|
-
return `Could not find type ${params.type}`
|
20
|
-
}
|
21
|
-
|
22
|
-
return <NamedType data={type} />
|
23
|
-
}
|
24
|
-
|
25
|
-
export const reference$type = createRoute({
|
26
|
-
path: `:type`,
|
27
|
-
Component,
|
28
|
-
children: [reference$type$field],
|
29
|
-
})
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { Grafaid } from '#lib/grafaid/index'
|
2
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
3
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
4
|
-
import { useParams } from 'react-router'
|
5
|
-
import { Field } from '../components/Field.js'
|
6
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
7
|
-
import type { reference } from './reference.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string; field: string; version: string }
|
11
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
12
|
-
if (!data.schema) {
|
13
|
-
return <MissingSchema />
|
14
|
-
}
|
15
|
-
|
16
|
-
const type = data.schema.getType(params.type)
|
17
|
-
if (!type) return `Could not find type ${params.type}`
|
18
|
-
if (!Grafaid.Schema.TypesLike.isFielded(type)) {
|
19
|
-
return `Type ${params.type} does not have fields`
|
20
|
-
}
|
21
|
-
|
22
|
-
const fields = type.getFields()
|
23
|
-
const field = fields[params.field]
|
24
|
-
if (!field) {
|
25
|
-
return `Could not find field ${params.field} on type ${params.type}`
|
26
|
-
}
|
27
|
-
|
28
|
-
return <Field data={field} />
|
29
|
-
}
|
30
|
-
|
31
|
-
export const referenceVersion$version$type$field = createRoute({
|
32
|
-
id: `reference-version-type-field`,
|
33
|
-
path: `:field`,
|
34
|
-
Component,
|
35
|
-
})
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { createRoute } from '#lib/react-router-aid/react-router-aid'
|
2
|
-
import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
|
3
|
-
import { useParams } from 'react-router'
|
4
|
-
import { MissingSchema } from '../components/MissingSchema.js'
|
5
|
-
import { NamedType } from '../components/NamedType.js'
|
6
|
-
import type { reference } from './reference.js'
|
7
|
-
import { referenceVersion$version$type$field } from './reference.version.$version.$type.$field.js'
|
8
|
-
|
9
|
-
const Component = () => {
|
10
|
-
const params = useParams() as { type: string; version: string }
|
11
|
-
|
12
|
-
const data = useLoaderData<typeof reference.loader>(`reference`)
|
13
|
-
if (!data.schema) {
|
14
|
-
return <MissingSchema />
|
15
|
-
}
|
16
|
-
|
17
|
-
const type = data.schema.getType(params.type)
|
18
|
-
if (!type) {
|
19
|
-
return <div>Type not found: {params.type}</div>
|
20
|
-
}
|
21
|
-
|
22
|
-
return <NamedType data={type} />
|
23
|
-
}
|
24
|
-
|
25
|
-
export const referenceVersion$version$type = createRoute({
|
26
|
-
id: `reference-version-type`,
|
27
|
-
path: `:type`,
|
28
|
-
Component,
|
29
|
-
children: [referenceVersion$version$type$field],
|
30
|
-
})
|