commit 2d2d9264165b991ab5eacd0029b2312412ca39da Author: Philippe Pittoli Date: Mon Jun 26 17:14:05 2023 +0200 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40c533e --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.spago/ +app/index.js +node_modules/ +output/ +package-lock.json diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..e4868de --- /dev/null +++ b/app/index.html @@ -0,0 +1,11 @@ + + + + + + This is a simple pushstate example + + + + + diff --git a/makefile b/makefile new file mode 100644 index 0000000..bfbb519 --- /dev/null +++ b/makefile @@ -0,0 +1,32 @@ +all: build + +build: + spago build + +bundle: install-esbuild + PATH=$$PATH:node_modules/.bin spago bundle-app + mv index.js app/ + +repl: + spago repl + +spagobuild: + spago build + +install-esbuild: + @echo "install ebbuild" + [ -f node_modules/.bin/esbuild ] || npm install esbuild + +HTTPD_ACCESS_LOGS ?= /tmp/access.log +HTTPD_ADDR ?= 127.0.0.1 +HTTPD_PORT ?= 35000 +DIR ?= app +serve: + darkhttpd $(DIR) --addr $(HTTPD_ADDR) --port $(HTTPD_PORT) --log $(HTTPD_ACCESS_LOGS) + +# NPM can serve it, but it's slow for nothing. +#serve: +# npm run serve + +# You can add your specific instructions there. +-include makefile.user diff --git a/spago.dhall b/spago.dhall new file mode 100644 index 0000000..d58c533 --- /dev/null +++ b/spago.dhall @@ -0,0 +1,27 @@ +{ name = "halogen-project" +, dependencies = + [ "aff" + , "arrays" + , "bifunctors" + , "const" + , "control" + , "effect" + , "either" + , "foreign" + , "halogen" + , "halogen-store" + , "maybe" + , "prelude" + , "routing" + , "routing-duplex" + , "strings" + , "tailrec" + , "transformers" + , "web-dom" + , "web-events" + , "web-html" + , "web-uievents" + ] +, packages = ./packages.dhall +, sources = [ "src/**/*.purs", "test/**/*.purs" ] +} diff --git a/src/Main.purs b/src/Main.purs new file mode 100644 index 0000000..fd3a0ac --- /dev/null +++ b/src/Main.purs @@ -0,0 +1,669 @@ +{- + +This Gist has: + * PushState routing + * Interception of all clicks on hrefs or their children + * Login / sign out + - You "land" on the 'Secrets' page, but cannot see it until you "Login" + +You can preview the appearance of this Gist on TryPureScript, but note +that the PushState routing will not work within its