I like building Arduino Projects. I like to use the ESP8266 for those projects. I don't like hardcoding my WIFI details in code. Thankfully, it is possible to run an ESP8266 in "AP" mode and create what is called a Capitivate Portal.
These components allow me to quickly throw together a lightweight UI that con be delivered to a browser on a device connected to a captivate portal.
I had some design goals for this library:
When connected to a captivate portal, the client won't have access to the internet, so everything has to be served from the Arduino. While many ESP8266 boards have 1MB of flash, using it up on a configruation app that may only be used once is pretty crazy.
I looked into React, but it was WAY too big. React 16 is around 40kB gzipped just on it's own. I managed to find Preact, with claims to be 3kB. To push my luck, I also added CSS modules.
After a rewrite, I ran a build, and it came in around double the size at 11kB. I was happy with that trade off in exchange code that is maintainble and testable.
The config app needed to be user friendly. Too many embedded configuration web apps are horrible. If you have ever configured a ADSL modem, you'll know what I'm talking about.
4. Self contained
I didn't want to mess about with multiple HTTP endpoints (the less the Arduino does the better), so the config app needs to be a single page-app. This means moving as much logic to the browser as possible.
This includes input validation, and even building the config object binary.
The widgets are exposed via a NPM package.
yarn add configduino