Commit Graph

52 Commits

Author SHA1 Message Date
8ebab702ac fix(element/scrollable): reduce the number of minSize calls and correctly resize scrollable Container
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m26s
2025-11-05 18:33:16 +01:00
e53bb7880b mod: cleanup TODO and outdated comments 2025-11-05 18:32:49 +01:00
a83e86f8d9 feat(element/scrollable): background configuration
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m30s
2025-11-02 21:00:17 +01:00
d4cc520826 fix(element/scrollable): display and user interaction
Fix initial render to show scrollbar immediately if required. Show and
hide scrollbar correctly when content size or terminal size changes. Add
keybindings for scrolling similar to pager keybindings.
2025-11-02 16:05:53 +01:00
7cd1fb139f mod(element/scrollable): ensure minSize returns correct dimensions
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 56s
Enforce that `minSize` returns a `Point` with corresponding minimal
dimensions with respect to the provided available size. This means that
an `Element` implementation that provides a `minSize` function may even
return a too small dimension, which would automatically be resized to be
at least as big as the provided size.
2025-11-01 14:37:14 +01:00
f70ea05244 mod(element/scrollable): introduce minSize function for Element
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 3m24s
The minimal required size can the queried from the containing `Element`
of the `Container` that is provided to the `Scrollable` to dynamically
adjust its size.

Currently abritrary nesting is not supported / tested.
2025-11-01 13:55:16 +01:00
feae9fa1a4 feat(model): implement Elm architecture
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m2s
Now the `App` contains a state which is a user-defined `struct` which
is passed to the `handle` and `contents` callbacks for `Container`'s and
`Element`'s. Built-in `Element`'s shall not access the `App.Model` and
should therefore never cause any side-effects.

User-defined events shall be used to act as *messages* to cause
potential side-effects for the model. This is the reason why only
the `handle` callback has a non-const pointer to the `App.Model`. The
`contents` callback can only access the `App.Model` read-only to use for
generating the *view* (in context of the elm architecture).
2025-10-26 15:58:07 +01:00
cba07b119c chor: upgrade to latest zig; remove zg dependency
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 55s
2025-09-29 23:09:42 +02:00
f256a79da0 chor: bumb zig version to 0.16.0-dev
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m41s
2025-08-27 12:17:20 +02:00
0de50e7016 feat(element/selection): Element implementation for selecting an enum variant
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m35s
2025-07-17 21:00:00 +02:00
088e1a9246 add(element/radio-button): RadioButton Element implementation
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 2m6s
This can be used to visualize the values of `bool`'s, which is relevant
when creating form's based on `struct`'s automatically.
2025-07-13 21:02:28 +02:00
9f33c902ee mod(container): cleanup and highlight points for improvement
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m42s
2025-07-06 00:42:00 +02:00
9f29ac6a77 feat(element/progress): Progress bar implementation as an Element
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 2m42s
2025-07-05 18:29:49 +02:00
f775a6ab2d formatting
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 13s
2025-06-30 22:53:05 +02:00
a39cee7ccb feat(element/button): add builtin Element implementation for buttons 2025-06-30 22:52:27 +02:00
7875db0aea feat(element/input): make accept event agnostic to u8 and u21 slices
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 50s
There are now comptime checks in place an the corresponding triggered
event will be automatically converted to the correct type to support
simple ascii strings (`[]u8`) or utf-8 strings (`[]u21`).
2025-06-30 22:03:59 +02:00
7595e3b5bb feat(element/input): text input element implementation
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 14s
Moved implementation from example/input as a standalone `Element`
implementation, which is directly used by the example instead.

The provided argument is the `App.Event`'s event that should be
triggered on acceptance for the contents of the Input `Element`.
Currently only `[]u21` strings are supported, but in the future also
`[]u8` strings shall be supported and automatically converted when
pushed as an `App.Event` into the app's queue.
2025-06-29 11:19:09 +02:00
5ba5b2b372 feat(element/alignment): alignment Element implementation
You can now align a `Container` using the Alignment `Element` similar to
how you make a `Container` scrollable. For usage details please see the
example and the corresponding tests.
2025-05-28 14:42:02 +02:00
3cb0d11e71 add: necessary assert statement; rem: unnecessary render resize in testing 2025-05-28 14:40:25 +02:00
c6d8eec287 feat(debug): render debug support 2025-05-26 15:43:47 +02:00
80a36a9947 refactor: zigify imports and usages 2025-05-26 14:23:18 +02:00
4cde0640c8 fix(element/scrollable): adjust anchor for scrollable element during resize 2025-05-22 23:39:05 +02:00
ba25e6056c feat(element/scrollable): scrollbar rendering
Configuration to enable scrollbar rendering for scrollable `Element`s.
Currently only the fg `Color` of the scrollbar can be configured while
the background uses the same fg `Color` but adds the emphasis `.dim` to
make it obvious what the is the actual scrollbar. In the future it might
be necessary to provide the user with more options to configure the
representation of the scrollbar.

Tests have been added to test the scrollbar rendering and placement
accordingly.
2025-05-21 18:20:52 +02:00
aa4adf20f9 refactor: zigify imports and correct minor mistakes 2025-05-20 18:23:44 +02:00
962a384ecf add(Scrollable): init function with corresponding usages
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 42s
2025-03-29 21:21:23 +01:00
7e20dd73d9 mod: add missing inline function attribute
Correct example to use the actual `zterm.Error` type accordingly.
2025-03-27 21:41:18 +01:00
54af974c2b mod(container): make reposition public and split from resize
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m3s
2025-03-13 19:48:31 +01:00
dddc09b4ce mod(container/element): remove origin: Point argument from Element.content function
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m12s
Renamed `Container.contents` to `Container.content` to be in line with
the corresponding `Element` function name. This has also been done for
the properties structs used by the `Container`.
2025-03-11 07:52:35 +01:00
5c1d61eefd rem(element): unnecessary debug loging
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m20s
2025-03-10 21:44:18 +01:00
315cd8d23e fix(layout): remove upper bound of while loop
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 29s
The upper loop was incorrect and therefore removed to create correct
layouts. I should be able to calculate the bound correctly, but for
now).
2025-03-05 23:14:54 +01:00
e3551fa624 add(sizing): grow configuration
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m14s
Currently the 'grid' and 'mixed' examples are not working yet.
2025-03-05 22:53:28 +01:00
466e00c16c fix(element/scrollable): support deriving Container size of scrollable
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 13s
2025-03-04 21:54:07 +01:00
fc72cf4abb ref(container): split size and position calculations
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 34s
2025-03-04 19:53:28 +01:00
ec22e68e8c ref(event): remove .resize and replace with recursize method calls
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 40s
This also means that currently the dynamic resizing through the app's
detached thread is not working, as it cannot send size updates. The
examples have been overhauled to still implement intermediate mode
applications accordingly.
2025-03-04 14:52:19 +01:00
591b990087 ref(event): split Size into two Points (one for the size and one for the anchor / origin)
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 39s
2025-03-04 00:04:56 +01:00
91ac6241f4 doc: correct TODO, NOTE and FIX comment statements
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 48s
2025-03-03 21:49:11 +01:00
4145ff497b fix(elements/scrollable): nested container rendering
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 2m45s
2025-03-02 22:27:26 +01:00
af443c6bbf test(elements/scrollable): remove redundance from test code
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 28s
2025-03-01 16:24:10 +01:00
8a7ce78aaf feat(container): introduce fixed_size property for fixed sizing of Containers
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 42s
Moved min_size property from `Container` to the `Scrollable` element,
where it is only used anyway.
2025-03-01 11:56:14 +01:00
3b6848f845 fix(container): rendering scrollable elements with separators
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 23s
Added corresponding test cases to test the corresponding rendering of
scrollable elements.
2025-02-27 17:02:16 +01:00
53b69f034c mod(size): rename merge function to add; new max function
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m6s
2025-02-27 14:17:19 +01:00
ca14bc6106 fix(container): positioning; move separator options to layout struct
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 22s
Added corresponding test cases for padding, borders and corresponding
seperators.
2025-02-26 18:21:55 +01:00
4234c9ad0c rem(element): template Element moved into wiki documentation
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 45s
2025-02-25 16:55:11 +01:00
16724f6a52 add(example/elements): distinct different scrollable containers
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 46s
2025-02-21 15:58:42 +01:00
cc831a5cdf fix(element/scrollable): render horizontal directed contents correctly
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 46s
2025-02-19 22:23:32 +01:00
86b3e7d4ed feat(scrollable): make Container scrollable through Element Scrollable
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m35s
2025-02-19 20:32:26 +01:00
f55d71a7cb mod(mouse): fix input.Mouse.in method
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 46s
Pass through mouse events where they actually match the corresponding
`Container`. Adopt mouse event accordingly in `Scrollable` `Element`
trait when passing through the mouse event to the scrollable
`Container`.
2025-02-18 19:09:03 +01:00
a9f48bfb6a ref(key): make Key struct packed and rename constants
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 2m5s
2025-02-17 21:06:15 +01:00
7891af6c6f add(element/scrollable): implement content provider
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m49s
However this is only working for the same size as the parent container
(i.e. same `Size`). The `.resize` event for the `Container` of the
scrollable element needs to be the necessary and/or required size for
the contents (regardless of the screen viewport).
2025-02-17 19:58:25 +01:00
d951906b2b rem: Scroll from Propierties of Container
Updated the corresponding documentation and ideas for how to realize
scrollable contents.
2025-02-15 18:50:36 +01:00