Skip to content

Commit

Permalink
Revert freeform dimension units
Browse files Browse the repository at this point in the history
  • Loading branch information
drwpow committed Oct 24, 2024
1 parent cfcda14 commit 67ab90a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions technical-reports/format/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ $translucent-shadow: hsla(300, 100%, 50%, 0.5);

## Dimension

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.
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"`).

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

For example:

Expand Down Expand Up @@ -85,8 +85,9 @@ For example:

### Validation

- `$value.unit` may be any string. It is up to tooling to translate units into the appropriate platform.
- `$value.unit` may NOT be an empty string (`""`).
- `$value.unit` may only be `"px"` or `"rem"`.
- **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.
- **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.
- `$value.unit` is still requird even if `$value.value` is `0`.

## Font family
Expand Down Expand Up @@ -160,12 +161,12 @@ Example:

## Duration

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.
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.

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

For example:

Expand Down

0 comments on commit 67ab90a

Please sign in to comment.