diff --git a/scripts/extract-indices.mjs b/scripts/extract-indices.mjs index 628ba3e70..dc06dce09 100644 --- a/scripts/extract-indices.mjs +++ b/scripts/extract-indices.mjs @@ -155,6 +155,7 @@ const extractApiIndex = version => { }; extractApiIndex("latest"); +extractApiIndex("v9.0.0") extractApiIndex("v8.0.0"); diff --git a/src/common/App.res b/src/common/App.res index 206770c27..29b58d1d6 100644 --- a/src/common/App.res +++ b/src/common/App.res @@ -86,7 +86,7 @@ let make = (props: props): React.element => { | (2, Some("belt")) => content | (_, Some("js")) => content | (_, Some("belt")) => content - | (_, Some("dom")) => content + | (_, Some("dom")) => content | _ => React.null } | _ => content diff --git a/src/layouts/ApiOverviewLayout9_0_0.resi b/src/layouts/ApiOverviewLayout9_0_0.resi new file mode 100644 index 000000000..3cdd24d14 --- /dev/null +++ b/src/layouts/ApiOverviewLayout9_0_0.resi @@ -0,0 +1,4 @@ +module Docs: { + @react.component + let make: (~components: Mdx.Components.t=?, ~children: React.element) => React.element +} diff --git a/src/layouts/BeltDocsLayout9_0_0.res b/src/layouts/BeltDocsLayout9_0_0.res index c2d27565b..b3072550c 100644 --- a/src/layouts/BeltDocsLayout9_0_0.res +++ b/src/layouts/BeltDocsLayout9_0_0.res @@ -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<{ @@ -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"} }, ] diff --git a/src/layouts/DomDocsLayout9_0_0.res b/src/layouts/DomDocsLayout9_0_0.res new file mode 100644 index 000000000..789ca368f --- /dev/null +++ b/src/layouts/DomDocsLayout9_0_0.res @@ -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 = + + + warnBanner + children + + } +} + +module Prose = { + @react.component + let make = (~children) => children +} diff --git a/src/layouts/DomDocsLayout9_0_0.resi b/src/layouts/DomDocsLayout9_0_0.resi new file mode 100644 index 000000000..595dfe9fd --- /dev/null +++ b/src/layouts/DomDocsLayout9_0_0.resi @@ -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 +} diff --git a/src/layouts/JsDocsLayout9_0_0.res b/src/layouts/JsDocsLayout9_0_0.res index d92dd1862..00635e37c 100644 --- a/src/layouts/JsDocsLayout9_0_0.res +++ b/src/layouts/JsDocsLayout9_0_0.res @@ -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<{