Skip to content

Commit

Permalink
add v9
Browse files Browse the repository at this point in the history
  • Loading branch information
aspeddro committed Oct 8, 2023
1 parent de2d2d8 commit f821a1a
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 38 deletions.
1 change: 1 addition & 0 deletions scripts/extract-indices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const extractApiIndex = version => {
};

extractApiIndex("latest");
extractApiIndex("v9.0.0")
extractApiIndex("v8.0.0");


Expand Down
2 changes: 1 addition & 1 deletion src/common/App.res
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ let make = (props: props): React.element => {
| (2, Some("belt")) => <BeltDocsLayout9_0_0.Prose> content </BeltDocsLayout9_0_0.Prose>
| (_, Some("js")) => <JsDocsLayout9_0_0.Docs> content </JsDocsLayout9_0_0.Docs>
| (_, Some("belt")) => <BeltDocsLayout9_0_0.Docs> content </BeltDocsLayout9_0_0.Docs>
| (_, Some("dom")) => <DomDocsLayout8_0_0.Docs> content </DomDocsLayout8_0_0.Docs>
| (_, Some("dom")) => <DomDocsLayout9_0_0.Docs> content </DomDocsLayout9_0_0.Docs>
| _ => React.null
}
| _ => content
Expand Down
4 changes: 4 additions & 0 deletions src/layouts/ApiOverviewLayout9_0_0.resi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Docs: {
@react.component
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element
}
72 changes: 36 additions & 36 deletions src/layouts/BeltDocsLayout9_0_0.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Structure defined by `scripts/extract-indices.js`
@module("index_data/latest_belt_api_index.json")
@module("index_data/v900_belt_api_index.json")
external indexData: Js.Dict.t<{
"moduleName": string,
"headers": array<{
Expand All @@ -14,77 +14,77 @@ module NavItem = SidebarLayout.Sidebar.NavItem
let overviewNavs = [
{
open NavItem
{name: "Introduction", href: "/docs/manual/latest/api/belt"}
{name: "Introduction", href: "/docs/manual/v9.0.0/api/belt"}
},
]

let setNavs = [
{
open NavItem
{name: "HashSet", href: "/docs/manual/latest/api/belt/hash-set"}
{name: "HashSet", href: "/docs/manual/v9.0.0/api/belt/hash-set"}
},
{name: "HashSetInt", href: "/docs/manual/latest/api/belt/hash-set-int"},
{name: "HashSetString", href: "/docs/manual/latest/api/belt/hash-set-string"},
{name: "Set", href: "/docs/manual/latest/api/belt/set"},
{name: "SetDict", href: "/docs/manual/latest/api/belt/set-dict"},
{name: "SetInt", href: "/docs/manual/latest/api/belt/set-int"},
{name: "SetString", href: "/docs/manual/latest/api/belt/set-string"},
{name: "HashSetInt", href: "/docs/manual/v9.0.0/api/belt/hash-set-int"},
{name: "HashSetString", href: "/docs/manual/v9.0.0/api/belt/hash-set-string"},
{name: "Set", href: "/docs/manual/v9.0.0/api/belt/set"},
{name: "SetDict", href: "/docs/manual/v9.0.0/api/belt/set-dict"},
{name: "SetInt", href: "/docs/manual/v9.0.0/api/belt/set-int"},
{name: "SetString", href: "/docs/manual/v9.0.0/api/belt/set-string"},
]

let mapNavs = [
{
open NavItem
{name: "HashMap", href: "/docs/manual/latest/api/belt/hash-map"}
{name: "HashMap", href: "/docs/manual/v9.0.0/api/belt/hash-map"}
},
{name: "HashMapInt", href: "/docs/manual/latest/api/belt/hash-map-int"},
{name: "HashMapString", href: "/docs/manual/latest/api/belt/hash-map-string"},
{name: "Map", href: "/docs/manual/latest/api/belt/map"},
{name: "MapDict", href: "/docs/manual/latest/api/belt/map-dict"},
{name: "MapInt", href: "/docs/manual/latest/api/belt/map-int"},
{name: "MapString", href: "/docs/manual/latest/api/belt/map-string"},
{name: "HashMapInt", href: "/docs/manual/v9.0.0/api/belt/hash-map-int"},
{name: "HashMapString", href: "/docs/manual/v9.0.0/api/belt/hash-map-string"},
{name: "Map", href: "/docs/manual/v9.0.0/api/belt/map"},
{name: "MapDict", href: "/docs/manual/v9.0.0/api/belt/map-dict"},
{name: "MapInt", href: "/docs/manual/v9.0.0/api/belt/map-int"},
{name: "MapString", href: "/docs/manual/v9.0.0/api/belt/map-string"},
]

let mutableCollectionsNavs = [
{
open NavItem
{name: "MutableMap", href: "/docs/manual/latest/api/belt/mutable-map"}
{name: "MutableMap", href: "/docs/manual/v9.0.0/api/belt/mutable-map"}
},
{name: "MutableMapInt", href: "/docs/manual/latest/api/belt/mutable-map-int"},
{name: "MutableMapString", href: "/docs/manual/latest/api/belt/mutable-map-string"},
{name: "MutableQueue", href: "/docs/manual/latest/api/belt/mutable-queue"},
{name: "MutableSet", href: "/docs/manual/latest/api/belt/mutable-set"},
{name: "MutableSetInt", href: "/docs/manual/latest/api/belt/mutable-set-int"},
{name: "MutableSetString", href: "/docs/manual/latest/api/belt/mutable-set-string"},
{name: "MutableStack", href: "/docs/manual/latest/api/belt/mutable-stack"},
{name: "MutableMapInt", href: "/docs/manual/v9.0.0/api/belt/mutable-map-int"},
{name: "MutableMapString", href: "/docs/manual/v9.0.0/api/belt/mutable-map-string"},
{name: "MutableQueue", href: "/docs/manual/v9.0.0/api/belt/mutable-queue"},
{name: "MutableSet", href: "/docs/manual/v9.0.0/api/belt/mutable-set"},
{name: "MutableSetInt", href: "/docs/manual/v9.0.0/api/belt/mutable-set-int"},
{name: "MutableSetString", href: "/docs/manual/v9.0.0/api/belt/mutable-set-string"},
{name: "MutableStack", href: "/docs/manual/v9.0.0/api/belt/mutable-stack"},
]

let basicNavs = [
{
open NavItem
{name: "Array", href: "/docs/manual/latest/api/belt/array"}
{name: "Array", href: "/docs/manual/v9.0.0/api/belt/array"}
},
{name: "List", href: "/docs/manual/latest/api/belt/list"},
{name: "Float", href: "/docs/manual/latest/api/belt/float"},
{name: "Int", href: "/docs/manual/latest/api/belt/int"},
{name: "Range", href: "/docs/manual/latest/api/belt/range"},
{name: "Id", href: "/docs/manual/latest/api/belt/id"},
{name: "Option", href: "/docs/manual/latest/api/belt/option"},
{name: "Result", href: "/docs/manual/latest/api/belt/result"},
{name: "List", href: "/docs/manual/v9.0.0/api/belt/list"},
{name: "Float", href: "/docs/manual/v9.0.0/api/belt/float"},
{name: "Int", href: "/docs/manual/v9.0.0/api/belt/int"},
{name: "Range", href: "/docs/manual/v9.0.0/api/belt/range"},
{name: "Id", href: "/docs/manual/v9.0.0/api/belt/id"},
{name: "Option", href: "/docs/manual/v9.0.0/api/belt/option"},
{name: "Result", href: "/docs/manual/v9.0.0/api/belt/result"},
]

let sortNavs = [
{
open NavItem
{name: "SortArray", href: "/docs/manual/latest/api/belt/sort-array"}
{name: "SortArray", href: "/docs/manual/v9.0.0/api/belt/sort-array"}
},
{name: "SortArrayInt", href: "/docs/manual/latest/api/belt/sort-array-int"},
{name: "SortArrayString", href: "/docs/manual/latest/api/belt/sort-array-string"},
{name: "SortArrayInt", href: "/docs/manual/v9.0.0/api/belt/sort-array-int"},
{name: "SortArrayString", href: "/docs/manual/v9.0.0/api/belt/sort-array-string"},
]

let utilityNavs = [
{
open NavItem
{name: "Debug", href: "/docs/manual/latest/api/belt/debug"}
{name: "Debug", href: "/docs/manual/v9.0.0/api/belt/debug"}
},
]

Expand Down
99 changes: 99 additions & 0 deletions src/layouts/DomDocsLayout9_0_0.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Structure defined by `scripts/extract-indices.js`
@module("index_data/v900_dom_api_index.json")
external indexData: Js.Dict.t<{
"moduleName": string,
"headers": array<{
"name": string,
"href": string,
}>,
}> = "default"

module Category = SidebarLayout.Sidebar.Category
module NavItem = SidebarLayout.Sidebar.NavItem

let overviewNavs = [
{
open NavItem
{name: "Dom", href: "/docs/manual/v9.0.0/api/dom"}
},
]

let moduleNavs = [
{
open NavItem
{name: "Storage", href: "/docs/manual/v9.0.0/api/dom/storage"}
},
{
open NavItem
{name: "Storage2", href: "/docs/manual/v9.0.0/api/dom/storage2"}
},
]

let categories = [
{
open Category
{name: "Overview", items: overviewNavs}
},
{name: "Submodules", items: moduleNavs},
]

module Docs = {
@react.component
let make = (~components=ApiMarkdown.default, ~children) => {
let router = Next.Router.useRouter()
let route = router.route

// Gather data for the CollapsibleSection
let headers = {
open Belt.Option
Js.Dict.get(indexData, route)
->map(data =>
data["headers"]->Belt.Array.map(header => (header["name"], "#" ++ header["href"]))
)
->getWithDefault([])
}

let moduleName = {
open Belt.Option
Js.Dict.get(indexData, route)->map(data => data["moduleName"])->getWithDefault("?")
}

let url = route->Url.parse

let version = switch url.version {
| Version(version) => version
| NoVersion => "latest"
| Latest => "latest"
}

let prefix = {
open Url
{name: "API", href: "/docs/manual/" ++ (version ++ "/api")}
}

let breadcrumbs = ApiLayout.makeBreadcrumbs(~prefix, route)

let activeToc = {
open SidebarLayout.Toc
{
title: moduleName,
entries: Belt.Array.map(headers, ((name, href)) => {header: name, href}),
}
}

let title = "Dom Module"
let version = "v9.0.0"

let warnBanner = <ApiLayout.OldDocsWarning route version />

<ApiLayout components title version activeToc categories breadcrumbs>
warnBanner
children
</ApiLayout>
}
}

module Prose = {
@react.component
let make = (~children) => <Docs components=ApiMarkdown.default> children </Docs>
}
8 changes: 8 additions & 0 deletions src/layouts/DomDocsLayout9_0_0.resi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Docs: {
@react.component
let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element
}
module Prose: {
@react.component
let make: (~children: React.element) => React.element
}
2 changes: 1 addition & 1 deletion src/layouts/JsDocsLayout9_0_0.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Structure defined by `scripts/extract-indices.js`
@module("index_data/v800_js_api_index.json")
@module("index_data/v900_js_api_index.json")
external indexData: Js.Dict.t<{
"moduleName": string,
"headers": array<{
Expand Down

0 comments on commit f821a1a

Please sign in to comment.