3-Clause BSD License<\/a>/" `find docs -name '*.html'`
- # Footer
- @$(SED) -i -e "/Generated using the DDOX documentation generator<\/p>/r views/footer.html" -e "/
Generated using the DDOX documentation generator<\/p>/d" `find docs -name '*.html'`
- # Dub Package Version
- @echo Latest tag: `git describe --tags --abbrev=0`
- @$(SED) -i "s/DUB_VERSION/$(PACKAGE_VERSION)/g" `find docs -name '*.html'`
- @echo Done
-
docs: docs/sitemap.xml
ifeq ($(OS),Windows_NT)
$(error Build documentation on *nix!)
+else
+ @dub build -b docs
endif
.PHONY: docs
diff --git a/docs/process.d b/docs/process.d
new file mode 100644
index 0000000..b407aae
--- /dev/null
+++ b/docs/process.d
@@ -0,0 +1,27 @@
+/// Process handlebars templates in API documentation.
+///
+/// Authors: Chance Snow
+/// Copyright: Copyright © 2024 Chance Snow. All rights reserved.
+/// License: MIT License
+module wgpu.docs.process;
+
+import handlebars.tpl;
+static import std.file;
+import std.process;
+import std.stdio;
+
+void main(string[] args) {
+ string template_ = std.file.readText("views/index.hbs");
+
+ struct Constants {
+ string DUB_VERSION;
+ auto SYMBOLS = new string[0];
+ auto MODULES = new string[0];
+ }
+
+ auto gitTagCmd = execute(["git", "describe", "--tags", "--abbrev=0"]);
+ assert(gitTagCmd.status == 0);
+ gitTagCmd.output.writeln;
+ auto result = render(template_, Constants(gitTagCmd.output));
+ result.writeln;
+}
diff --git a/docs/styles/docs.css b/docs/styles/docs.css
new file mode 100644
index 0000000..ea906aa
--- /dev/null
+++ b/docs/styles/docs.css
@@ -0,0 +1,338 @@
+body {
+ margin: 0;
+ padding: 0;
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue",
+ "Segoe UI", "Roboto Sans", "Open Sans", sans-serif;
+ font-size: 10pt;
+}
+
+.flex {
+ display: flex;
+}
+
+.row {
+ flex-direction: row;
+}
+
+.column {
+ flex-direction: column;
+}
+
+h1, h2, h3 {
+ font-weight: normal;
+}
+h1 {
+ margin-top: -5pt;
+}
+h2 {
+ margin-top: 2em;
+}
+h3 {
+ margin-top: 1.5em;
+}
+
+a {
+ color: #1133EE;
+ text-decoration: none;
+}
+a:hover {
+ color: #4488FF;
+ text-decoration: underline;
+}
+
+table {
+ border-collapse: collapse;
+}
+th, td {
+ padding: 0 10pt;
+ vertical-align: top;
+}
+th:first-child,
+td:first-child {
+ padding-left: 0;
+}
+th {
+ text-align: left;
+ font-weight: normal;
+ font-style: italic;
+}
+tr {
+ border-bottom: 1px dashed #ddd;
+ vertical-align: top;
+}
+col.caption {
+ min-width: 150pt;
+}
+
+p.faint {
+ color: #ccc;
+}
+
+span.tableEntryAnnotation {
+ color: #888;
+}
+
+main,
+main > aside:first-of-type > nav,
+#symbolSearch,
+#symbolSearchResults {
+ box-sizing: border-box;
+}
+
+main {
+ display: flex;
+ vertical-align: top;
+ font-size: 9.5pt;
+ flex-grow: 1;
+}
+
+main > aside:first-of-type > nav {
+ vertical-align: top;
+ font-size: 9.5pt;
+ padding: 2em 1.5em;
+ min-width: 16em;
+ background: linear-gradient(#ddd, #fff),
+ linear-gradient(90deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)),
+ linear-gradient(#eee, #fff);
+ background-size:
+ 1px 100%,
+ 100% 100%,
+ 100% 100%;
+ background-position:
+ 100% 0,
+ 0 0,
+ 0 0;
+ background-repeat: no-repeat, no-repeat;
+}
+
+main > aside:first-of-type nav h1 {
+ align-self: center;
+ margin: 0 0 0 0.25rem;
+ font-size: 19px;
+ line-height: 1;
+}
+
+main > aside:first-of-type nav h1 > span {
+ display: block;
+ padding-bottom: 0.25em;
+ white-space: nowrap;
+}
+main > aside:first-of-type nav h1 > span.faint {
+ font-weight: lighter;
+}
+
+#logo {
+ margin-right: 0.5rem;
+ max-width: 4rem;
+}
+
+main > article {
+ margin: 2em;
+}
+
+article.module > section.members > ul {
+ padding: 0;
+ list-style: none;
+}
+
+ul li > dd.decl {
+ margin: 8px 0 0 12px;
+}
+
+ul li > dd.decl > ul.members {
+ list-style-type: square;
+}
+
+article.module > section.members > ul > li {
+ padding: 0;
+}
+
+ul.enum.members > li.member > dt.decl > code {
+ display: none;
+}
+
+dt.decl {
+ font-family: monospace;
+}
+
+#symbolSearchPane form {
+ margin-bottom: 1.5em;
+}
+#symbolSearch {
+ width: 100%;
+}
+#symbolSearchResults {
+ position: absolute;
+ padding-right: 0.5em;
+ margin: 0;
+ margin-top: -1.5em;
+ background: white;
+ min-width: 20em;
+ border: 1px solid #ddd;
+ box-shadow: 0px 5px 20px 0 rgba(0, 0, 0, 0.5);
+}
+.symbolList {
+ list-style: none;
+ padding: 0;
+ overflow: hidden;
+}
+.symbolList li {
+ background-repeat: no-repeat;
+ background-position: 0 1pt;
+ padding-left: 18px;
+}
+
+.searchResults.symbolList li {
+ background-position: 0 5pt;
+}
+.searchResults h2 {
+ margin-bottom: 0;
+ margin-top: 1em;
+}
+
+.symbolList .deprecated a {
+ color: gray;
+}
+.symbolList .module {
+ background-image: url(../icons/module.png);
+}
+.symbolList .functiondeclaration {
+ background-image: url(../icons/function.png);
+}
+.symbolList .classdeclaration {
+ background-image: url(../icons/class.png);
+}
+.symbolList .interfacedeclaration {
+ background-image: url(../icons/interface.png);
+}
+.symbolList .structdeclaration {
+ background-image: url(../icons/struct.png);
+}
+.symbolList .variabledeclaration {
+ background-image: url(../icons/variable.png);
+}
+.symbolList .property {
+ background-image: url(../icons/property.png);
+}
+.symbolList .enumdeclaration {
+ background-image: url(../icons/enum.png);
+}
+.symbolList .enummemberdeclaration {
+ background-image: url(../icons/enummember.png);
+}
+.symbolList .aliasdeclaration {
+ background-image: url(../icons/alias.png);
+}
+.symbolList .templatedeclaration {
+ background-image: url(../icons/template.png);
+}
+
+ul.tree-view li {
+ list-style-type: none;
+ padding-left: 18px;
+ padding-right: 4px;
+}
+
+ul.tree-view .package {
+ padding-left: 18px;
+ background-image: url(../icons/package.png);
+ background-repeat: no-repeat;
+ background-position: left 2px;
+ cursor: default;
+}
+
+ul.tree-view .package:hover {
+ box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
+}
+
+ul.tree-view .module {
+ padding-left: 18px;
+ background-image: linear-gradient(
+ rgba(255, 255, 255, 0.5),
+ rgba(255, 255, 255, 0.5)
+ ),
+ url(../icons/module.png);
+ background-repeat: no-repeat, no-repeat;
+ background-position:
+ left 1px,
+ left 1px;
+ background-size: 18px 16px;
+}
+
+ul.tree-view .module.selected,
+ul.tree-view .package.selected {
+ font-weight: bold;
+}
+ul.tree-view .module.selected {
+ background-image: url(../icons/module.png);
+}
+
+ul.tree-view li.collapsed ul {
+ display: none;
+}
+
+ul.tree-view {
+ padding: 0;
+ margin: 0;
+}
+
+ul.tree-view ul {
+ margin: 0;
+ padding: 0;
+}
+
+a.protected {
+ font-style: italic;
+ background-image: url(../icons/protected.png);
+ background-repeat: no-repeat;
+ padding-left: 16px;
+}
+a.package {
+ font-style: italic;
+ background-image: url(../icons/package.png);
+ background-repeat: no-repeat;
+ padding-left: 16px;
+}
+
+a.private {
+ font-style: italic;
+ background-image: url(../icons/private.png);
+ background-repeat: no-repeat;
+ padding-left: 16px;
+}
+a.inherited:after {
+ content: url(../icons/inherited.png);
+ padding-left: 2pt;
+}
+
+nav.page-nav ul {
+ list-style: none;
+ padding-left: 0;
+}
+nav.page-nav li a {
+ color: black;
+}
+nav.page-nav li:before {
+ content: "▼";
+ padding-right: 3px;
+}
+
+.license-info {
+ margin-top: 2em;
+ color: #888;
+}
+.license-info p {
+ display: inline;
+}
+
+footer {
+ display: flex;
+ justify-content: space-between;
+ margin: 0 2em 2em;
+}
+
+@media (max-width: 500pt) {
+ body {
+ display: block;
+ }
+}
diff --git a/docs/styles/dub.css b/docs/styles/dub.css
new file mode 100644
index 0000000..82169ac
--- /dev/null
+++ b/docs/styles/dub.css
@@ -0,0 +1,42 @@
+.bs-hbtn {
+ display: inline-block;
+ color: white;
+ height: 34pt;
+ vertical-align: top;
+ text-align: center;
+ float: right;
+}
+.bs-hbtn.red.left {
+ background: #ab1919;
+ background-repeat: no-repeat, no-repeat, no-repeat;
+ background-size: 100% 34pt, 100% 18pt, 18.5pt 34pt;
+ background-position: 0 0, 18pt 34pt, 0 0;
+ background-clip: content-box, border-box, border-box;
+}
+.bs-hbtn.black.right {
+ background: black;
+ margin-right: 18pt;
+ background-repeat: no-repeat, no-repeat;
+ background-size: 100% 34pt, 100% 18pt, 18.5pt 34pt;
+ background-position: 0 0, -18pt 34pt, 100% 0;
+ background-clip: content-box, border-box, border-box;
+}
+.dub-logo {
+ background-image: url(../images/dub-logo.png);
+ width: 56px;
+ height: 100%;
+ background-position: 50% 50%;
+ background-repeat: no-repeat;
+}
+#downloadButton {
+ position: absolute;
+ top: 0;
+ right: 0;
+}
+#downloadButton large {
+ font-size: 14pt;
+ line-height: 16pt;
+}
+#downloadButton .content {
+ padding: 0 5pt;
+}
diff --git a/dub.json b/dub.json
index 2bc32e8..e2002fc 100644
--- a/dub.json
+++ b/dub.json
@@ -21,6 +21,22 @@
},
"systemDependencies": "vulkan >= 1.1.0 or DirectX >= 11 or metal >= 2 or OpenGL >= 3.3",
"preGenerateCommands": ["make wgpu"],
+ "buildTypes": {
+ "docs": {
+ "sourceFiles": [
+ "views/docs.ddoc"
+ ],
+ "buildOptions": ["syntaxOnly"],
+ "dependencies": {
+ "handlebars": "~>0.3.1"
+ },
+ "dflags": ["-Dddocs"],
+ "postBuildCommands-posix": [
+ "dub fetch handlebars",
+ "rdmd -I~/.dub/packages/handlebars/0.3.1/handlebars/source docs/process.d"
+ ]
+ }
+ },
"configurations": [
{
"name": "library",
diff --git a/views/docs.ddoc b/views/docs.ddoc
new file mode 100644
index 0000000..d91f405
--- /dev/null
+++ b/views/docs.ddoc
@@ -0,0 +1,236 @@
+API=WebGPU D Bindings API Reference
+API_TITLE=WebGPU API Reference
+
+FOOTER=
+
+DDOC=
+
+
+
+ $(TITLE) - $(API_TITLE)
+
+
+
+
+ $(HEADER)
+
+
+
+
get wgpu-d
{{ DUB_VERSION }}
+
+
+
+
+ $(ARTICLE_HEADER)
+ $(MODULE_LABEL) $(TITLE)
+
+ $(BODY)
+
+
+ $(FOOTER)
+
+
+
+ESCAPES =
+ /</
+ />/>/
+ /&/&/
+ /MIT License/