Skip to content

Commit

Permalink
Document ESM and TypeScript behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Jan 18, 2024
1 parent e53bd36 commit dbc6ee2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ Style.registerStyle({
Style.getStyles(); //=> ".f65pi0b{background-color:red;padding:10px}"
```

### Useful libraries
## TypeScript and ESM

This package is a [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and ships with TypeScript definitions. It cannot be `require`'d or used with CommonJS module resolution in TypeScript.

## Useful libraries

- [`polished`](https://polished.js.org)
- [`classnames`](https://github.com/JedWatson/classnames)
Expand All @@ -264,13 +268,13 @@ Style.getStyles(); //=> ".f65pi0b{background-color:red;padding:10px}"
- [`image-url`](https://github.com/ajoslin/image-url)
- [**Add yours!**](https://github.com/blakeembrey/free-style/issues/new)

### Implementation details
## Implementation details

#### Debugging
### Debugging

Display names will automatically be removed when `process.env.NODE_ENV === "production"`.

#### Changes
### Changes

The only argument to `create()` is a map of change function handlers. All functions are required:

Expand All @@ -280,7 +284,7 @@ The only argument to `create()` is a map of change function handlers. All functi

All styles implement `Container`, so you can call `getStyles()` or `clone()`.

#### Merging
### Merging

`Sheet`, `Style`, and `Rule` have the ability to be merged.

Expand All @@ -291,7 +295,7 @@ sheet.merge(otherSheet); // Merge the current styles of `otherSheet` into `sheet
sheet.unmerge(otherSheet); // Remove the current styles of `otherSheet` from `sheet`.
```

#### Pre-process styles
### Pre-process styles

If you plan to re-use styles across `Sheet`s, it will be more efficient to use `compile` once and `register` many times instead of `registerStyle`.

Expand Down

0 comments on commit dbc6ee2

Please sign in to comment.