A HTML like GUI could work but I think its one magnitude of complexity too high for me. On the other hand people are used to HTML. I don't have much input on its design.
I also am working on a GUI library, I don't have a spec but I have a workflowy insanity map (beware he who enters here!)
The idea behind it is best described by step by step process.
First the usual require,load, draw with some interesting features we will talk about later. What is important is load must have the path to the GUI graphics.
Once you do that when you fire the game by using Ctrl+Shift+U you enter the editor mode. The editor has two phases the resource phase, and the design phase.
In the Resource phase it will import graphics from your folders do some sorting and throws it on screen, The graphics elements can be moved about to arrange them in place.
Then you select a basic element(image,button,bar,panel,etc) from the left side tool panel and drag select all the graphics part of that element, configure how that element works and add more graphics for different states(default,hover,pressed,etc)
Once you do this you will have a list of basic elements on the right side panel.
You then go to the design phase here you use the basic elements to make more complex elements like spinners(Text area,arrows,maybe a scroll bar?), combobox ,inventory and generally make your interface. The elements will be arranged in a hierarchical list.
You can use controllers to manage your interface like horizontal lines to align your elements too or arrays,grids,corners. They are also part of the hierarchy so you can make it as global or local to the element as you like.
Th basic elements can be stretched and handles scaling to the resolution you want without filtering. Everything is relative to its parent element or controller.
After you make the interface you want and exit the edit mode it will generate a new script with all the classes you made, including setting the default resources for the basic classes from the first phase.
In the main game code you simply initialize the generated class you want with screen = GenClass:new(). It will add it to a global hierarchy table.
It will automatically initialize children instances by the name it had in edit mode element hierarchy list.
To program the interface you can either modify the classes from the generated script or use the instances to override the functions.
You can even script the interface programmatically without the visual editor.
For handling mouse/keyboard focus, draws or updates you either use the default library function for the whole global hierarchy or use individual elements that are their own branch.
For example in library.draw(branch) the branch can either be a table full of elements, a element that has its own children, or a bunch of arguments with either tables or elements. Or you can modify the global hierarchy to handle that.
All elements can be disabled in which case they don't get evaluated and their children.
That is pretty much it
, if you find some interesting things I hope it helps your project, if anyone is interested I will make another thread since I don't want to derail this thread, otherwise I will make slow(crawling) steady(ha!) progress(since I am lazy and incompetent with code).