-module(shore@layout). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([cell/3, grid/4, center/3, split/2]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -file("src/shore/layout.gleam", 10). ?DOC( " A Cell is an item within a Grid. Use Cells to define how many rows and\n" " columns the content should cover.\n" ). -spec cell( shore@internal:node_(HQQ), {integer(), integer()}, {integer(), integer()} ) -> shore@internal:cell(HQQ). cell(Content, Row, Col) -> {cell, Content, Row, Col}. -file("src/shore/layout.gleam", 29). ?DOC( " A grid-based layout defining rows and columns which contain cells and the gaps between them.\n" "\n" " This should be remeniscent of CSS Grid. You define a list of rows and\n" " columns by size, then use Cells to fill the rows/columns to create descrete\n" " areas of ui elements.\n" "\n" " Consider using some of the default provided layouts, such as\n" " `layout_center` and `layout_split` or view the examples/layouts for more\n" " complex custom layouts.\n" "\n" " Note: Layouts can be nested as long as it is the only child of a cell.\n" ). -spec grid( integer(), list(shore@style:size()), list(shore@style:size()), list(shore@internal:cell(HQV)) ) -> shore@internal:node_(HQV). grid(Gap, Rows, Cols, Cells) -> {layouts, {grid, Gap, Rows, Cols, Cells}}. -file("src/shore/layout.gleam", 39). ?DOC(" A layout which centers vertically and horizontally\n"). -spec center(shore@internal:node_(HQZ), shore@style:size(), shore@style:size()) -> shore@internal:node_(HQZ). center(Content, Width, Height) -> _pipe = {grid, 0, [fill, Height, fill], [fill, Width, fill], [{cell, Content, {1, 1}, {1, 1}}]}, {layouts, _pipe}. -file("src/shore/layout.gleam", 54). ?DOC(" A layout which has a 50/50 split\n"). -spec split(shore@internal:node_(HRC), shore@internal:node_(HRC)) -> shore@internal:node_(HRC). split(Left, Right) -> _pipe = {grid, 0, [{pct, 100}], [{pct, 50}, fill], [{cell, Left, {0, 0}, {0, 0}}, {cell, Right, {0, 0}, {1, 1}}]}, {layouts, _pipe}.