Skip to content
AJARProjectPublic

About

CSS Flexbox layout engine for 4D v21 forms (pure 4D, component)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

AJUI_flex

English · Français

CSS flexbox layout for 4D forms, written in plain 4D v21 code.

AJUI_flex is a 4D component (project mode) that implements the layout algorithm of the W3C CSS Flexible Box Layout Module Level 1 and applies it to the objects of a 4D form. You describe a container and its items the way you would in CSS (direction, wrap, justify, align, gap, grow, shrink…), and AJUI_flex moves and resizes the form objects. No plug-in, no web area.

Case of 
	: (FORM Event.code=On Load)
		Form.flex:=cs.flex.FlexLayout.new("box"; "item_"; {wrap: "wrap"; justifyContent: "space-between"; alignItems: "center"; gap: 8; padding: 10})
		Form.flex.item("item_3").grow:=1
		Form.flex.apply()
	: (FORM Event.code=On Resize)
		Form.flex.apply()
End case 

Features

  • Complete flexible-length resolution (§9.7): grow, shrink weighted by basis, min/max clamping with freezing, factor sums below 1.
  • direction, wrap (including wrap-reverse), justifyContent, alignItems, alignSelf, alignContent, gap / rowGap / columnGap, padding, margin, order.
  • auto margins on both axes (push a button to the right with margin: {left: "auto"}).
  • Percentages ("25%") for basis, width/height, min/max, margins, padding and gaps.
  • Nested flex containers: an item with children is itself a flex container, sized to its content, and the whole tree is laid out in one call.
  • Optional minWidth/minHeight: "auto" (content-based minimum size).
  • A pure computation engine (FlexEngine) with no form commands, usable for printing, SVG or anything that needs rectangles, and a form adapter (FlexLayout).

Status

0.1.0 (single-level flexbox) Validated in 4D v21: FlexEngine_runFixture 1105/1105, demo OK.
0.2.0 (auto margins, %, nesting) Validated against Google Chrome through mini4d, a small interpreter that runs the actual .4dm source (2342/2342 cases). Not yet run in 4D itself.

See Compatibility for details.

Documentation

Repository layout

Project/            4D project (the component itself: classes, methods, forms)
Resources/fixtures/ reference fixture used by FlexEngine_runFixture
docs/en, docs/fr    documentation
tests/              mini4d interpreter and test scripts (Python)
tools/              generators and checker of the FlexGuide form and its translations (Python)
tests/tools/        fixture generation and Chrome measurement (Node.js)

The repository root is the component root: clone it next to your host project and declare it in dependencies.json (see Getting started).

Source code comments and the demo forms are in French.

Author

Maurice Inzirillo, AJAR S.A.

License

MIT © 2026 Maurice Inzirillo / AJAR S.A.

About

CSS Flexbox layout engine for 4D v21 forms (pure 4D, component)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages