Include basic grid support as a JavaScript library
Perhaps it would be a nice addition to provide a very basic grid support as a JavaScript library that could be included in Phoenix and enabled if desired. This would provide a good starting point for people with little (or none) programming experience.
Basic feature set:
Grid prototype
- set grid size ({w:units,h:units}) absolute
- adjust grid size ({w: delta, h: delta})
- get width
- get height
Layout prototype
TBC... allow automatic layouts. Tmuxinator has some neat ideas here IIRC
Window static methods
- snap all visible windows to grid
Window prototype new methods
- snap current window to grid
- move current window around grid (ie. Window::gridMove({x: delta, Y delta}) )
- size current window using grid (ie. Window::gridResize({w: delta, h: delta}) )
To be continued ...
Additionally, I think it should support basic alignment methods such as: top left, top right, bottom right, bottom left and centre. I’m considering creating a new repository for this (with tests and style checks) and linking it through a submodule. This could be a focus for a 2.x release.
This would be awesome :+1: This way users don't need to reinvent the same thing over and over.
There’s now a build environment integrated in this project that allows adding features in JavaScript (f1ae8682795f79d7d12cec4b21f45673031fac5e).
Linking my humble implementation of a grid system, if someone finds it useful: https://github.com/ngryman/phoenix/blob/master/lib/grid.js.
@kasper if you are interested I could work on bringing this to Phoenix's core library.
Ping.
@ngryman Nice, sorry for not responding earlier! Feel free to work on adapting your grid implementation to the core library. 😄
@kasper @ngryman Cool, hopefully it gets in soon 👍
@kasper Alright, I'll try to find some spare time to open a PR. Meanwhile @arzg you can almost copy/paste my implementation.