Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout builder #364

Closed
wants to merge 38 commits into from
Closed

Layout builder #364

wants to merge 38 commits into from

Conversation

rodja
Copy link
Member

@rodja rodja commented Feb 11, 2023

One idea from #117 was to create a subset of layout commands which are easier to understand and discover than the classic css/quasar/tailwind techniques. The "Layout Builder" is one such attempt.

Features

This branch currently sketches out the following features (meaning it's not a full implementation but rather a proof of concept):

  • auto completion + documentation for simple to understand layout and styling aspects
  • using the builder pattern in combination with string literals for auto completion
  • logical grouping of layout aspects (e.g. align.center and align.children are fundamentally different in css but presented together)
  • the Layout of an existing element can be modify by accessing its layout property
  • Layouts can also be created independently because they are self contained classes
  • element.props and element.classes take precedence over element.layout definitions to allow customizations
  • Layouts can be used as contexts to create generic groups, rows, columns: with ui.layout('horizontal')
  • specialized Layouts provide additional styling (e.g. ButtonLayout to configure shape etc.)
  • a Layout can be applied to (multiple) other Layouts via add
  • a Layout can be duplicated by calling .copy()
  • invalid layout aspects can raise error reports (e.g. margin.top.auto() is not possible with css)
  • binding to Layout values like opacity

A demo of this features is implemented in the layout_demo.py.

ToDos / Ideas

  • Layout.row() and Layout.column() should use a GroupLayout which provides arrangement of children (e.g. gap, align.children, ...)
  • Some mechanism to allow Grid and Masonry Layouts

Questions

  • How does the name "Layout" affect header/footer/drawer and tabs? Should we rename the latter? Or incorporate it?
  • How to provide smart colors which change automatically for dark mode?
  • Can we return the specialized Layout type in base class methods? (e.g. ui.button().layout.align.center() should return ButtonLayout)
  • Should we use tailwind classes for color to support dark: selector or use Quasar colors to support Theming with ui.colors?

@rodja rodja added the enhancement New feature or request label Feb 11, 2023
@rodja rodja self-assigned this Feb 11, 2023
@HilkopterBob
Copy link

a layout builder would be awesome♥

@falkoschindler
Copy link
Contributor

@rodja What do you think: With 1.3.0 being (almost) released now, it's getting harder and harder to merge this PR. And it's stale for months now. Should we close it and come back once we have new ideas on how to proceed?

@rodja rodja closed this Jul 12, 2023
@rodja
Copy link
Member Author

rodja commented Jul 12, 2023

Yes, the code is not lost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants