repos / starfx

supercharged async flow control library.
git clone https://github.com/neurosnap/starfx.git

commit
a552790
parent
5ad5b08
author
Eric Bower
date
2024-06-21 04:03:22 +0000 UTC
fix: sidebar links
8 files changed,  +37, -95
M docs/Makefile
+1, -2
 1@@ -5,10 +5,9 @@ fmt:
 2 
 3 clean:
 4 	rm -rf ./public/*
 5-	echo "" > ./public/.gitkeep
 6 .PHONY: clean
 7 
 8-ssg: clean
 9+ssg:
10 	go run ./main.go
11 	cp ./static/* ./public
12 .PHONY: ssg
M docs/go.mod
+1, -1
1@@ -2,7 +2,7 @@ module github.com/neurosnap/starfx/docs
2 
3 go 1.22
4 
5-require github.com/picosh/pdocs v0.0.0-20240605155503-8b60d6355244
6+require github.com/picosh/pdocs v0.0.0-20240621040056-5cbf57557db3
7 
8 require (
9 	github.com/alecthomas/chroma v0.10.0 // indirect
M docs/go.sum
+4, -4
 1@@ -6,10 +6,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
 2 github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
 3 github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0=
 4 github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
 5-github.com/picosh/pdocs v0.0.0-20240218162954-0dec737a7805 h1:DlHwGHcZKm76+kK7EGG16ExG8S/GM+uz6VDVljmksxw=
 6-github.com/picosh/pdocs v0.0.0-20240218162954-0dec737a7805/go.mod h1:4Ei1K68K1qYyqSx5shNdw4++PN1Ws3QhD1u5eJYBmsA=
 7-github.com/picosh/pdocs v0.0.0-20240605155503-8b60d6355244 h1:5kqyTKIuLWGX9zZwOZoi+maEZEZLkq6QPLspUs8jUJE=
 8-github.com/picosh/pdocs v0.0.0-20240605155503-8b60d6355244/go.mod h1:KXO3Z0EVdA811AX6mlK4lwFDT+KgmegRVrEmZU5uLXU=
 9+github.com/picosh/pdocs v0.0.0-20240621040056-5cbf57557db3 h1:VuX6UzKt5bNir3itrMBiROmzZp8PEZJkbD7muwz5x2s=
10+github.com/picosh/pdocs v0.0.0-20240621040056-5cbf57557db3/go.mod h1:KXO3Z0EVdA811AX6mlK4lwFDT+KgmegRVrEmZU5uLXU=
11 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
12 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
14@@ -34,3 +32,5 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
15 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
16 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
17 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
18+pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
19+pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
M docs/main.go
+4, -71
  1@@ -1,6 +1,8 @@
  2 package main
  3 
  4 import (
  5+	"log/slog"
  6+
  7 	"github.com/picosh/pdocs"
  8 )
  9 
 10@@ -22,12 +24,6 @@ func main() {
 11 				Text: "Getting started",
 12 				Href: "/getting-started",
 13 				Page: pager("getting-started.md"),
 14-				Children: []*pdocs.Sitemap{
 15-					pdocs.AnchorTagSitemap("Motivation"),
 16-					pdocs.AnchorTagSitemap("When to use this library"),
 17-					pdocs.AnchorTagSitemap("Code Example"),
 18-					pdocs.AnchorTagSitemap("Install"),
 19-				},
 20 			},
 21 			{
 22 				Text: "Controllers",
 23@@ -41,26 +37,11 @@ func main() {
 24 						Text: "Thunks",
 25 						Href: "/thunks",
 26 						Page: pager("thunks.md"),
 27-						Children: []*pdocs.Sitemap{
 28-							pdocs.AnchorTagSitemap("Thunk Action"),
 29-							pdocs.AnchorTagSitemap("Thunk Payload"),
 30-							pdocs.AnchorTagSitemap("Custom ctx"),
 31-						},
 32 					},
 33 					{
 34 						Text: "Endpoints",
 35 						Href: "/endpoints",
 36 						Page: pager("endpoints.md"),
 37-						Children: []*pdocs.Sitemap{
 38-							pdocs.AnchorTagSitemap("Enforcing fetch response type"),
 39-							pdocs.AnchorTagSitemap("The same API endpoints but different logic"),
 40-							pdocs.AnchorTagSitemap("Using variables inside the API endpoint"),
 41-							pdocs.AnchorTagSitemap("ctx.request"),
 42-							pdocs.AnchorTagSitemap("Using ctx.req"),
 43-							pdocs.AnchorTagSitemap("ctx.response"),
 44-							pdocs.AnchorTagSitemap("ctx.json"),
 45-							pdocs.AnchorTagSitemap("Middleware automation"),
 46-						},
 47 					},
 48 				},
 49 			},
 50@@ -72,35 +53,17 @@ func main() {
 51 						Text: "Overview",
 52 						Href: "/models",
 53 						Page: pager("models.md"),
 54-						Children: []*pdocs.Sitemap{
 55-							pdocs.AnchorTagSitemap("How to update state"),
 56-							pdocs.AnchorTagSitemap("Updating state from view"),
 57-						},
 58 					},
 59 					{
 60 
 61 						Text: "Store",
 62 						Href: "/store",
 63 						Page: pager("store.md"),
 64-						Children: []*pdocs.Sitemap{
 65-							pdocs.AnchorTagSitemap("How to update state"),
 66-							pdocs.AnchorTagSitemap("Updating state from view"),
 67-						},
 68 					},
 69 					{
 70 						Text: "Schema",
 71 						Href: "/schema",
 72 						Page: pager("schema.md"),
 73-						Children: []*pdocs.Sitemap{
 74-							pdocs.AnchorTagSitemap("Schema Assumptions"),
 75-							pdocs.AnchorTagSitemap("any"),
 76-							pdocs.AnchorTagSitemap("str"),
 77-							pdocs.AnchorTagSitemap("num"),
 78-							pdocs.AnchorTagSitemap("obj"),
 79-							pdocs.AnchorTagSitemap("table"),
 80-							pdocs.AnchorTagSitemap("loader"),
 81-							pdocs.AnchorTagSitemap("Build your own slice"),
 82-						},
 83 					},
 84 				},
 85 			},
 86@@ -108,49 +71,26 @@ func main() {
 87 				Text: "React",
 88 				Href: "/react",
 89 				Page: pager("react.md"),
 90-				Children: []*pdocs.Sitemap{
 91-					pdocs.AnchorTagSitemap("useSelector"),
 92-					pdocs.AnchorTagSitemap("useLoader"),
 93-					pdocs.AnchorTagSitemap("useApi"),
 94-					pdocs.AnchorTagSitemap("useQuery"),
 95-					pdocs.AnchorTagSitemap("useCache"),
 96-					pdocs.AnchorTagSitemap("useLoaderSuccess"),
 97-				},
 98 			},
 99 			{
100 				Text: "Caching",
101 				Href: "/caching",
102 				Page: pager("caching.md"),
103-				Children: []*pdocs.Sitemap{
104-					pdocs.AnchorTagSitemap("Manual"),
105-					pdocs.AnchorTagSitemap("Automatic"),
106-				},
107 			},
108 			{
109 				Text: "Dependent Queries",
110 				Href: "/dependent-queries",
111 				Page: pager("dependent.md"),
112-				Children: []*pdocs.Sitemap{
113-					pdocs.AnchorTagSitemap("Dispatch the thunk as an action"),
114-					pdocs.AnchorTagSitemap("Call the middleware stack directly"),
115-				},
116 			},
117 			{
118 				Text: "Middleware",
119 				Href: "/middleware",
120 				Page: pager("mdw.md"),
121-				Children: []*pdocs.Sitemap{
122-					pdocs.AnchorTagSitemap("Context"),
123-				},
124 			},
125 			{
126 				Text: "Loaders",
127 				Href: "/loaders",
128 				Page: pager("loader.md"),
129-				Children: []*pdocs.Sitemap{
130-					pdocs.AnchorTagSitemap("Usage"),
131-					pdocs.AnchorTagSitemap("Shape"),
132-				},
133 			},
134 			{
135 				Text: "Structured Concurrency",
136@@ -161,10 +101,6 @@ func main() {
137 				Text: "Supervisors",
138 				Href: "/supervisors",
139 				Page: pager("supervisors.md"),
140-				Children: []*pdocs.Sitemap{
141-					pdocs.AnchorTagSitemap("poll"),
142-					pdocs.AnchorTagSitemap("timer"),
143-				},
144 			},
145 			{
146 				Text: "Testing",
147@@ -185,16 +121,13 @@ func main() {
148 				Text: "Resources",
149 				Href: "/resources",
150 				Page: pager("resources.md"),
151-				Children: []*pdocs.Sitemap{
152-					pdocs.AnchorTagSitemap("Quick Links"),
153-					pdocs.AnchorTagSitemap("Talk"),
154-					pdocs.AnchorTagSitemap("Other Notable Libraries"),
155-				},
156 			},
157 		},
158 	}
159 
160+	logger := slog.Default()
161 	config := &pdocs.DocConfig{
162+		Logger:   logger,
163 		Sitemap:  sitemap,
164 		Out:      "./public",
165 		Tmpl:     "./tmpl",
M docs/posts/getting-started.md
+1, -0
1@@ -1,6 +1,7 @@
2 ---
3 title: Getting Started
4 description: Use starfx with deno, node, or the browser
5+toc: 1
6 ---
7 
8 # motivation
D docs/public/.gitkeep
+0, -1
1@@ -1 +0,0 @@
2-
M docs/tmpl/sitemap-footer.partial.tmpl
+25, -15
 1@@ -3,25 +3,35 @@
 2 <ul class="list-none">
 3 {{range .Sitemap.Children -}}
 4   {{if .Href}}
 5-  <li><a href="{{.GenHref}}" class="link-alt text-md">{{.Text}}</a></li>
 6+  <li>
 7+    {{- if (and $.Prev (eq $.Prev.GenHref .GenHref)) -}}
 8+    <a href="{{.GenHref}}" class="link-alt-adj text-md">{{.Text}}</a>
 9+    {{- else if (and $.Next (eq $.Next.GenHref .GenHref)) -}}
10+    <a href="{{.GenHref}}" class="link-alt-adj text-md">{{.Text}}</a>
11+    {{- else if (eq $.Href .GenHref) -}}
12+    <a href="{{.GenHref}}" class="link-alt-hover text-md">{{.Text}}</a>
13+    {{- else -}}
14+    <a href="{{.GenHref}}" class="link-alt text-md">{{.Text}}</a>
15+    {{- end -}}
16+  </li>
17   {{else}}
18   <li class="text-md">{{.Text}}</li>
19   {{end}}
20+  <ul class="list-none sidebar-list">
21   {{range .Children -}}
22-    <ul class="list-none sidebar-list">
23-      <li>
24-        {{- if (and $.Prev (eq $.Prev.GenHref .GenHref)) -}}
25-        <a href="{{.GenHref}}" class="link-alt-adj">{{.Text}}</a>
26-        {{- else if (and $.Next (eq $.Next.GenHref .GenHref)) -}}
27-        <a href="{{.GenHref}}" class="link-alt-adj">{{.Text}}</a>
28-        {{- else if (eq $.Href .GenHref) -}}
29-        <a href="{{.GenHref}}" class="link-alt-hover">{{.Text}}</a>
30-        {{- else -}}
31-        <a href="{{.GenHref}}" class="link-alt">{{.Text}}</a>
32-        {{- end -}}
33-      </li>
34-    </ul>
35-  {{- end}}
36+  <li>
37+    {{- if (and $.Prev (eq $.Prev.GenHref .GenHref)) -}}
38+    <a href="{{.GenHref}}" class="link-alt-adj">{{.Text}}</a>
39+    {{- else if (and $.Next (eq $.Next.GenHref .GenHref)) -}}
40+    <a href="{{.GenHref}}" class="link-alt-adj">{{.Text}}</a>
41+    {{- else if (eq $.Href .GenHref) -}}
42+    <a href="{{.GenHref}}" class="link-alt-hover">{{.Text}}</a>
43+    {{- else -}}
44+    <a href="{{.GenHref}}" class="link-alt">{{.Text}}</a>
45+    {{- end -}}
46+  </li>
47+  {{end}}
48+  </ul>
49 {{- end}}
50 </ul>
51 </div>
M docs/tmpl/toc.partial.tmpl
+1, -1
1@@ -11,7 +11,7 @@
2         <ul class="list-disc" style="padding-left: 2rem;">
3         {{range .Children}}
4           <li>
5-            <a href="{{.ParentHref}}{{.GenHref}}">{{.Text}}</a>
6+            <a href="{{.GenHref}}">{{.Text}}</a>
7           </li>
8         {{end}}
9         </ul>