Skip to content

Commit 5dac755

Browse files
committed
Revert freeform dimension units
1 parent f5af127 commit 5dac755

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

technical-reports/format/types.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ $translucent-shadow: hsla(300, 100%, 50%, 0.5);
5151

5252
## Dimension
5353

54-
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `$type` property MUST be set to the string `dimension`. The value MUST be an object with `value` and `unit` keys.
54+
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `$type` property MUST be set to the string `dimension`. The value MUST be an object containing a numeric `value` (integer or floating-point) and `unit` of measurement (`"px"` or `"rem"`).
5555

5656
| Key | Type | Required | Description |
5757
| :------ | :------: | :------: | :----------------------------------------------------------------- |
5858
| `value` | `number` | Y | An integer or floating-point value representing the numeric value. |
59-
| `unit` | `string` | Y | A string specifying the units of measurement |
59+
| `unit` | `string` | Y | Unit of distance. Supported values: `"px"`, `"rem"`. |
6060

6161
For example:
6262

@@ -85,8 +85,9 @@ For example:
8585

8686
### Validation
8787

88-
- `$value.unit` may be any string. It is up to tooling to translate units into the appropriate platform.
89-
- `$value.unit` may NOT be an empty string (`""`).
88+
- `$value.unit` may only be `"px"` or `"rem"`.
89+
- **px**: Represents an idealized pixel on the viewport. The equivalent in Android is `dp` and iOS is `pt`. Translation tools SHOULD therefore convert to these or other equivalent units as needed.
90+
- **rem**: Represents a multiple of the system's default font size (which MAY be configurable by the user). 1rem is 100% of the default font size. The equivalent of 1rem on Android is 16sp. Not all platforms have an equivalent to rem, so translation tools MAY need to do a lossy conversion to a fixed px size by assuming a default font size (usually 16px) for such platforms.
9091
- `$value.unit` is still requird even if `$value.value` is `0`.
9192

9293
## Font family
@@ -160,12 +161,12 @@ Example:
160161

161162
## Duration
162163

163-
Represents the length of time in milliseconds an animation or animation cycle takes to complete, such as 200 milliseconds. The `$type` property MUST be set to the string `duration`. The value MUST be an object containin a numeric `value` (either integer or floating-point) and optionally a `unit` to specify milliseconds (`"ms"`) or seconds (`"s"`). A millisecond is a unit of time equal to one thousandth of a second.
164+
Represents the length of time in milliseconds an animation or animation cycle takes to complete, such as 200 milliseconds. The `$type` property MUST be set to the string `duration`. The value MUST be an object containing a numeric `value` (either integer or floating-point) and a `unit` of milliseconds (`"ms"`) or seconds (`"s"`). A millisecond is a unit of time equal to one thousandth of a second.
164165

165-
| Key | Type | Required | Description |
166-
| :------ | :------: | :------: | :--------------------------------------------------------------------- |
167-
| `value` | `number` | Y | An integer or floating-point value representing the numeric value. |
168-
| `unit` | `string` | | The unit of time. Only `"ms"`, `"s`", or (undefined) are valid values. |
166+
| Key | Type | Required | Description |
167+
| :------ | :------: | :------: | :------------------------------------------------------------------- |
168+
| `value` | `number` | Y | An integer or floating-point value representing the numeric value. |
169+
| `unit` | `string` | Y | Unit of time. Supported values: `"ms"` (millisecond), `"s"`(second). |
169170

170171
For example:
171172

0 commit comments

Comments
 (0)