Insets
Space inside each edge (the CSS box model), never negative, written in CSS's order: 8 16 8 16.
Media and visual; not ordered; since Jadpo 0.1.0.
Make one
Build one from its fields, Insets { top: ... right: ... bottom: ... }.
text.parse(raw, as: Insets) reads one from its text; text that isn't one at all fails malformed, such as 8 16, 8 or -1 0 0 0.
Fields
| Field | Type |
|---|---|
top |
Decimal |
right |
Decimal |
bottom |
Decimal |
left |
Decimal |
Text, JSON and storage
text.from writes its canonical text, the one form text.parse reads back. JSON sends an object of its parts.
| Text | JSON |
|---|---|
8 16 8 16 |
{"top":"8","right":"16","bottom":"8","left":"16"} |
0 0 0 0 |
{"top":"0","right":"0","bottom":"0","left":"0"} |
0.5 1 1.5 2 |
{"top":"0.5","right":"1","bottom":"1.5","left":"2"} |
It is stored in 4 columns, each named for the field, _ and its suffix. This is 0 0 0 0:
| Column | Type | Holds |
|---|---|---|
<field>_top |
numeric |
0 |
<field>_right |
numeric |
0 |
<field>_bottom |
numeric |
0 |
<field>_left |
numeric |
0 |
Shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
8 16 8 16 |
8 16 8 16 |
0 0 0 0 |
0 0 0 0 |
0.5 1 1.5 2 |
0.5 1 1.5 2 |
Operations
It has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It isn't ordered, so < and sorting don't take it. Every standard type meets one contract says how they work.
Markdown for agents: /docs/types/type-insets.md.Built from Jadpo main at e00e61f.