# @medi-q/core

> Type-safe media queries.

Latest version **0.3.1** (published 2021-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @medi-q/core
pnpm add @medi-q/core
yarn add @medi-q/core
bun add @medi-q/core
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2021-11-28 |
| First published | 2021-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 107.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Karibash |
| Maintainers | karibash |
| Keywords | typescript, media-query, responsive, breakpoint |

## Links

- npm: https://www.npmjs.com/package/@medi-q/core
- Repository: https://github.com/Karibash/medi-q
- Homepage: https://github.com/Karibash/medi-q/tree/main/packages/core
- Issues: https://github.com/Karibash/medi-q/issues
- npm.io page: https://npm.io/package/@medi-q/core

## Dependencies (2)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.15.4
- [@karibash/pixel-units](https://npm.io/package/@karibash/pixel-units.md) ^2.3.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.3.1 (latest) — 2021-11-28
- 0.3.0 — 2021-10-31
- 0.0.3 — 2021-10-02
- 0.0.2 — 2021-09-25
- 0.0.1 — 2021-09-24

## README

# @medi-q/core

The @medi-q/core package is a framework agnostic for simply generating media queries.

## 🚀 Installation

```
$ npm install @medi-q/core
```

## 👏 Getting Started

By using the createMediQ function, you can create a helper function to generate media queries.
You can also generate media queries with multiple conditions by connecting the queries with and or.

```tsx
import { createMediQ } from '@medi-q/core';

const mediQ = createMediQ({
  tiny: '400px',
  small: '600px',
  medium: '800px',
  large: '1000px',
});

const maxSmall = mediQ('max-small');
const minMedium = mediQ('min-medium');
const minSmallAndMaxMedium = mediQ('min-small-and-max-medium');

const onResize = (): void => {
  if (matchMedia(maxSmall).matches) {
    console.log('isLessThanSmall');
  } else if (matchMedia(minMedium).matches) {
    console.log('isGreaterThanMedium');
  } else if (matchMedia(minSmallAndMaxMedium).matches) {
    console.log('isBetweenSmallAndMedium');
  }
};
onResize();
window.onresize = onResize;
```

---
_Source: https://npm.io/package/@medi-q/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
