Skip to content

Commit 183becd

Browse files
Snapshot v10 api docs
1 parent 362684e commit 183becd

12 files changed

+539
-2
lines changed

pages/docs/v10.0.0.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import make from "src/DocsOverview.mjs";
2+
3+
export default make;

scripts/extract-indices.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ const extractApiIndex = version => {
155155
};
156156

157157
extractApiIndex("latest");
158-
extractApiIndex("v9.0.0")
158+
extractApiIndex("v10.0.0");
159+
extractApiIndex("v9.0.0");
159160
extractApiIndex("v8.0.0");
160161

161162

src/common/App.res

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ let make = (props: props): React.element => {
8989
| (_, Some("dom")) => <DomDocsLayout9_0_0.Docs> content </DomDocsLayout9_0_0.Docs>
9090
| _ => React.null
9191
}
92+
| Version("v10.0.0") =>
93+
switch (Belt.Array.length(pagepath), Belt.Array.get(pagepath, 1)) {
94+
| (1, _) => <ApiOverviewLayout10_0_0.Docs> content </ApiOverviewLayout10_0_0.Docs>
95+
| (2, Some("js")) => <JsDocsLayout10_0_0.Prose> content </JsDocsLayout10_0_0.Prose>
96+
| (2, Some("belt")) => <BeltDocsLayout10_0_0.Prose> content </BeltDocsLayout10_0_0.Prose>
97+
| (_, Some("js")) => <JsDocsLayout10_0_0.Docs> content </JsDocsLayout10_0_0.Docs>
98+
| (_, Some("belt")) => <BeltDocsLayout10_0_0.Docs> content </BeltDocsLayout10_0_0.Docs>
99+
| (_, Some("dom")) => <DomDocsLayout10_0_0.Docs> content </DomDocsLayout10_0_0.Docs>
100+
| _ => React.null
101+
}
92102
| _ => content
93103
}
94104
| _ =>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module Sidebar = SidebarLayout.Sidebar
2+
3+
let categories: array<Sidebar.Category.t> = [
4+
{
5+
name: "Introduction",
6+
items: [{name: "Overview", href: "/docs/manual/v10.0.0/api"}],
7+
},
8+
{
9+
name: "Modules",
10+
items: [
11+
{name: "Js Module", href: "/docs/manual/v10.0.0/api/js"},
12+
{name: "Belt Stdlib", href: "/docs/manual/v10.0.0/api/belt"},
13+
{name: "Dom Module", href: "/docs/manual/v10.0.0/api/dom"},
14+
],
15+
},
16+
]
17+
18+
/* Used for API docs (structured data) */
19+
module Docs = {
20+
@react.component
21+
let make = (~components=ApiMarkdown.default, ~children) => {
22+
let title = "API"
23+
let version = "v10.0.0"
24+
25+
<ApiLayout title categories version components> children </ApiLayout>
26+
}
27+
}
28+
29+
/*
30+
This layout is used for structured prose text with proper H2 headings.
31+
We cannot really use the same layout as with the Docs module, since they
32+
have different semantic styling and do things such as hiding the text
33+
of H2 nodes.
34+
*/
35+
/* module Prose = { */
36+
/* @react.component */
37+
/* let make = (~children) => <Docs components=Markdown.default> children </Docs> */
38+
/* } */
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Docs: {
2+
@react.component
3+
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element
4+
}

src/layouts/BeltDocsLayout10_0_0.res

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
// Structure defined by `scripts/extract-indices.js`
2+
@module("index_data/v1000_belt_api_index.json")
3+
external indexData: Js.Dict.t<{
4+
"moduleName": string,
5+
"headers": array<{
6+
"name": string,
7+
"href": string,
8+
}>,
9+
}> = "default"
10+
11+
module Category = SidebarLayout.Sidebar.Category
12+
module NavItem = SidebarLayout.Sidebar.NavItem
13+
14+
let overviewNavs = [
15+
{
16+
open NavItem
17+
{name: "Introduction", href: "/docs/manual/v10.0.0/api/belt"}
18+
},
19+
]
20+
21+
let setNavs = [
22+
{
23+
open NavItem
24+
{name: "HashSet", href: "/docs/manual/v10.0.0/api/belt/hash-set"}
25+
},
26+
{name: "HashSetInt", href: "/docs/manual/v10.0.0/api/belt/hash-set-int"},
27+
{name: "HashSetString", href: "/docs/manual/v10.0.0/api/belt/hash-set-string"},
28+
{name: "Set", href: "/docs/manual/v10.0.0/api/belt/set"},
29+
{name: "SetDict", href: "/docs/manual/v10.0.0/api/belt/set-dict"},
30+
{name: "SetInt", href: "/docs/manual/v10.0.0/api/belt/set-int"},
31+
{name: "SetString", href: "/docs/manual/v10.0.0/api/belt/set-string"},
32+
]
33+
34+
let mapNavs = [
35+
{
36+
open NavItem
37+
{name: "HashMap", href: "/docs/manual/v10.0.0/api/belt/hash-map"}
38+
},
39+
{name: "HashMapInt", href: "/docs/manual/v10.0.0/api/belt/hash-map-int"},
40+
{name: "HashMapString", href: "/docs/manual/v10.0.0/api/belt/hash-map-string"},
41+
{name: "Map", href: "/docs/manual/v10.0.0/api/belt/map"},
42+
{name: "MapDict", href: "/docs/manual/v10.0.0/api/belt/map-dict"},
43+
{name: "MapInt", href: "/docs/manual/v10.0.0/api/belt/map-int"},
44+
{name: "MapString", href: "/docs/manual/v10.0.0/api/belt/map-string"},
45+
]
46+
47+
let mutableCollectionsNavs = [
48+
{
49+
open NavItem
50+
{name: "MutableMap", href: "/docs/manual/v10.0.0/api/belt/mutable-map"}
51+
},
52+
{name: "MutableMapInt", href: "/docs/manual/v10.0.0/api/belt/mutable-map-int"},
53+
{name: "MutableMapString", href: "/docs/manual/v10.0.0/api/belt/mutable-map-string"},
54+
{name: "MutableQueue", href: "/docs/manual/v10.0.0/api/belt/mutable-queue"},
55+
{name: "MutableSet", href: "/docs/manual/v10.0.0/api/belt/mutable-set"},
56+
{name: "MutableSetInt", href: "/docs/manual/v10.0.0/api/belt/mutable-set-int"},
57+
{name: "MutableSetString", href: "/docs/manual/v10.0.0/api/belt/mutable-set-string"},
58+
{name: "MutableStack", href: "/docs/manual/v10.0.0/api/belt/mutable-stack"},
59+
]
60+
61+
let basicNavs = [
62+
{
63+
open NavItem
64+
{name: "Array", href: "/docs/manual/v10.0.0/api/belt/array"}
65+
},
66+
{name: "List", href: "/docs/manual/v10.0.0/api/belt/list"},
67+
{name: "Float", href: "/docs/manual/v10.0.0/api/belt/float"},
68+
{name: "Int", href: "/docs/manual/v10.0.0/api/belt/int"},
69+
{name: "Range", href: "/docs/manual/v10.0.0/api/belt/range"},
70+
{name: "Id", href: "/docs/manual/v10.0.0/api/belt/id"},
71+
{name: "Option", href: "/docs/manual/v10.0.0/api/belt/option"},
72+
{name: "Result", href: "/docs/manual/v10.0.0/api/belt/result"},
73+
]
74+
75+
let sortNavs = [
76+
{
77+
open NavItem
78+
{name: "SortArray", href: "/docs/manual/v10.0.0/api/belt/sort-array"}
79+
},
80+
{name: "SortArrayInt", href: "/docs/manual/v10.0.0/api/belt/sort-array-int"},
81+
{name: "SortArrayString", href: "/docs/manual/v10.0.0/api/belt/sort-array-string"},
82+
]
83+
84+
let utilityNavs = [
85+
{
86+
open NavItem
87+
{name: "Debug", href: "/docs/manual/v10.0.0/api/belt/debug"}
88+
},
89+
]
90+
91+
let categories = [
92+
{
93+
open Category
94+
{name: "Overview", items: overviewNavs}
95+
},
96+
{name: "Basics", items: basicNavs},
97+
{name: "Set", items: setNavs},
98+
{name: "Map", items: mapNavs},
99+
{name: "Mutable Collections", items: mutableCollectionsNavs},
100+
{name: "Sort Collections", items: sortNavs},
101+
{name: "Utilities", items: utilityNavs},
102+
]
103+
104+
module Docs = {
105+
@react.component
106+
let make = (~components=ApiMarkdown.default, ~children) => {
107+
let router = Next.Router.useRouter()
108+
let route = router.route
109+
110+
// Gather data for the CollapsibleSection
111+
let headers = {
112+
open Belt.Option
113+
Js.Dict.get(indexData, route)
114+
->map(data =>
115+
data["headers"]->Belt.Array.map(header => (header["name"], "#" ++ header["href"]))
116+
)
117+
->getWithDefault([])
118+
}
119+
120+
let moduleName = {
121+
open Belt.Option
122+
Js.Dict.get(indexData, route)->map(data => data["moduleName"])->getWithDefault("?")
123+
}
124+
125+
let url = route->Url.parse
126+
127+
let version = switch url.version {
128+
| Version(version) => version
129+
| NoVersion => "latest"
130+
| Latest => "latest"
131+
}
132+
133+
let prefix = {
134+
open Url
135+
{name: "API", href: "/docs/manual/" ++ (version ++ "/api")}
136+
}
137+
138+
let breadcrumbs = ApiLayout.makeBreadcrumbs(~prefix, route)
139+
140+
let activeToc = {
141+
open SidebarLayout.Toc
142+
{
143+
title: moduleName,
144+
entries: Belt.Array.map(headers, ((name, href)) => {header: name, href}),
145+
}
146+
}
147+
148+
let title = "Belt Stdlib"
149+
let version = "v10.0.0"
150+
151+
<ApiLayout components title version activeToc categories breadcrumbs> children </ApiLayout>
152+
}
153+
}
154+
155+
module Prose = {
156+
@react.component
157+
let make = (~children) => <Docs components=ApiMarkdown.default> children </Docs>
158+
}

src/layouts/BeltDocsLayout10_0_0.resi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Docs: {
2+
@react.component
3+
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element
4+
}
5+
6+
module Prose: {
7+
@react.component
8+
let make: (~children: React.element) => React.element
9+
}

src/layouts/DomDocsLayout10_0_0.res

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Structure defined by `scripts/extract-indices.js`
2+
@module("index_data/v1000_dom_api_index.json")
3+
external indexData: Js.Dict.t<{
4+
"moduleName": string,
5+
"headers": array<{
6+
"name": string,
7+
"href": string,
8+
}>,
9+
}> = "default"
10+
11+
module Category = SidebarLayout.Sidebar.Category
12+
module NavItem = SidebarLayout.Sidebar.NavItem
13+
14+
let overviewNavs = [
15+
{
16+
open NavItem
17+
{name: "Dom", href: "/docs/manual/v9.0.0/api/dom"}
18+
},
19+
]
20+
21+
let moduleNavs = [
22+
{
23+
open NavItem
24+
{name: "Storage", href: "/docs/manual/v9.0.0/api/dom/storage"}
25+
},
26+
{
27+
open NavItem
28+
{name: "Storage2", href: "/docs/manual/v9.0.0/api/dom/storage2"}
29+
},
30+
]
31+
32+
let categories = [
33+
{
34+
open Category
35+
{name: "Overview", items: overviewNavs}
36+
},
37+
{name: "Submodules", items: moduleNavs},
38+
]
39+
40+
module Docs = {
41+
@react.component
42+
let make = (~components=ApiMarkdown.default, ~children) => {
43+
let router = Next.Router.useRouter()
44+
let route = router.route
45+
46+
// Gather data for the CollapsibleSection
47+
let headers = {
48+
open Belt.Option
49+
Js.Dict.get(indexData, route)
50+
->map(data =>
51+
data["headers"]->Belt.Array.map(header => (header["name"], "#" ++ header["href"]))
52+
)
53+
->getWithDefault([])
54+
}
55+
56+
let moduleName = {
57+
open Belt.Option
58+
Js.Dict.get(indexData, route)->map(data => data["moduleName"])->getWithDefault("?")
59+
}
60+
61+
let url = route->Url.parse
62+
63+
let version = switch url.version {
64+
| Version(version) => version
65+
| NoVersion => "latest"
66+
| Latest => "latest"
67+
}
68+
69+
let prefix = {
70+
open Url
71+
{name: "API", href: "/docs/manual/" ++ (version ++ "/api")}
72+
}
73+
74+
let breadcrumbs = ApiLayout.makeBreadcrumbs(~prefix, route)
75+
76+
let activeToc = {
77+
open SidebarLayout.Toc
78+
{
79+
title: moduleName,
80+
entries: Belt.Array.map(headers, ((name, href)) => {header: name, href}),
81+
}
82+
}
83+
84+
let title = "Dom Module"
85+
let version = "v9.0.0"
86+
87+
<ApiLayout components title version activeToc categories breadcrumbs> children </ApiLayout>
88+
}
89+
}
90+
91+
module Prose = {
92+
@react.component
93+
let make = (~children) => <Docs components=ApiMarkdown.default> children </Docs>
94+
}

src/layouts/DomDocsLayout10_0_0.resi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Docs: {
2+
@react.component
3+
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element
4+
}
5+
6+
module Prose: {
7+
@react.component
8+
let make: (~children: React.element) => React.element
9+
}

0 commit comments

Comments
 (0)