Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/panoply/qvp
💻 A tiny (1.2kb gzipped) media query utility for programmatic control of screen viewports.
https://github.com/panoply/qvp
match-media media-queries responsive screen viewport
Last synced: 2 months ago
JSON representation
💻 A tiny (1.2kb gzipped) media query utility for programmatic control of screen viewports.
- Host: GitHub
- URL: https://github.com/panoply/qvp
- Owner: panoply
- Created: 2022-11-02T08:17:54.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-23T21:50:46.000Z (over 1 year ago)
- Last Synced: 2024-10-11T09:46:44.613Z (3 months ago)
- Topics: match-media, media-queries, responsive, screen, viewport
- Language: TypeScript
- Homepage:
- Size: 121 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
Awesome Lists containing this project
README
[![Flems](https://img.shields.io/badge/playground-playground?labelColor=34454d&color=34454d&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyNSAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIzLjY2NCA5LjE2TDE4LjIxNiAzLjczNkMxOC4xMiAzLjYxNiAxNy45NTIgMy41NDQgMTcuODA4IDMuNTQ0SDE3LjEzNkMxNi4zMiAzLjU0NCAxNS41NzYgNC4wNzIgMTUuMzEyIDQuODY0TDE0LjI4IDcuOTZDMTQuMjA4IDguMiAxNC4zNzYgOC40NjQgMTQuNjQgOC40NjRIMTYuNDY0QzE2LjcyOCA4LjQ2NCAxNi44OTYgOC43MDQgMTYuODI0IDguOTQ0TDE2LjEwNCAxMS4xMjhDMTYuMDA4IDExLjM2OCAxNS43OTIgMTEuNTM2IDE1LjUyOCAxMS41MzZIMTMuNTM2QzEzLjI3MiAxMS41MzYgMTMuMDU2IDExLjcwNCAxMi45NiAxMS45N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VgqC0wqIqEU-KM0IJ4LeyFrYqyT6KxzGLe0O85kv1FR-DsawMAagauojri8F5SA6QHSZAgk1AAC6bGqMA6QthLlOaglEK1r6qnKFrTbG8sl2V9bZ0IbF1hAeDO0gaMBfrCBn1TaNKHrtLuBdL+C-8DiMzvQRbmrX1E7fK6RvtONPzvilqpy8RNiU6a1liRIv5M66qc714TtssZLb8OARbzxGhTaBY8tsz1LqzukTw87ozq6dFSg66G6m6za9QtKXTay-icr8Q6QvaqkKdUKuQBJdCxlvRoBCA65-z7hCj+bSKL8dhLsXy1BqjeAKiUg0gHMQKkjwl5VYBugZLeJ9LwhIzb8Y7GTGwY6NKGjV68QAC96wAEzWBPd+7hKRZGxV6xNHYb6yCEL+YcRGhf7CA56KdjyLdMKoB17sL7gfLdq6N4HZayIl7TKX4+leye6F49zlcKLs0Fa8QGjyGrbkgHa26dK5KSckLJyAdjaL8WBYBl56hKA-7y8AHxCgGWGDAQGsRRGySycxyFraGhGTB-bpgpsAR6HuHiYjN5GorEHzKlDZNc8Y7w0N73KN7E0Ob4Bwho1yB1UYk8AElUSqq34aqHCTTi6N7tr14GiDHwHs4Rh3wXpiALGQErGW5lHlBAQACvGJrs0AnLGohlg800gprkHidVbGhklklkmFSpqDHx6drPGXTvTEnz7zcUmtSkGIJBDkDfyroN6sHNiYLL6MBuzvKe6GnTFwl5bIKMBrDYDK7OYL72numSBMaEKOGvz56YyyIemKDJdt6cRKnhCopRCLBgywtQyc4849di82mvToSFdkz-LTgIJpnj128LQBndmft4A-symdGyIDHZn7GdqjimQzi2LLiA0d8BIDH6INzs5Rj5YFUDyVUeEd9dzeBI4YgwhTFbIiR7hGgyhg0MBVg+JoNQiaID9wXIX30UoxYIhJYTBpYGBZZhm8KaAUAcAkB3pgZNZvBdYhBvtCBiXDYggFAhAPBzx3AgA)
# qvp
A tiny (1.2kb gzipped) media query utility for programmatic control in different screen viewports within the browser.
### Install
The module is shipped for ESM consumption in the Browser.
```bash
pnpm add qvp
```[Flems Play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q6QvaqkKdUKuQBJdCxlvRoBCA65-z7hCj+bSKL8dhLsXy1BqjeAKiUg0gHMQKkjwl5VYBugZLeJ9LwhIzb8Y7GTGwY6NKGjV68QAC96wAEzWBPd+7hKRZGxV6xNHYb6yCEL+YcRGhf7CA56KdjyLdMKoB17sL7gfLdq6N4HZayIl7TKX4+leye6F49zlcKLs0Fa8QGjyGrbkgHa26dK5KSckLJyAdjaL8WBYBl56hKA-7y8AHxCgGWGDAQGsRRGySycxyFraGhGTB-bpgpsAR6HuHiYjN5GorEHzKlDZNc8Y7w0N73KN7E0Ob4Bwho1yB1UYk8AElUSqq34aqHCTTi6N7tr14GiDHwHs4Rh3wXpiALGQErGW5lHlBAQACvGJrs0AnLGohlg800gprkHidVbGhklklkmFSpqDHx6drPGXTvTEnz7zcUmtSkGIJBDkDfyroN6sHNiYLL6MBuzvKe6GnTFwl5bIKMBrDYDK7OYL72numSBMaEKOGvz56YyyIemKDJdt6cRKnhCopRCLBgywtQyc4849di82mvToSFdkz-LTgIJpnj128LQBndmft4A-symdGyIDHZn7GdqjimQzi2LLiA0d8BIDH6INzs5Rj5YFUDyVUeEd9dzeBI4YgwhTFbIiR7hGgyhg0MBVg+JoNQiaID9wXIX30UoxYIhJYTBpYGBZZhm8KaAUAcAkB3pgZNZvBdYhBvtCBiXDYggFAhAPBzx3AgA)
# Basic Usage
The module uses a single **default** export, so assign a default. There a 3 different different option schemas available.
```js
import qvp from 'qvp';// OPTION 1 ~ Events
qvp({
sm: '(max-width: 576px)',
md: '(min-width: 768px) and (max-width: 992px)'
});// OPTION 2 ~ Methods
qvp([
{
id: 'sm',
query: '(max-width: 576px)',
onenter: () => {
console.log('Screen size is below 576px');
},
onexit: () => {
console.log('Screen size is above 576px');
}
},
{
id: 'md',
query: '(min-width: 768px) and (max-width: 992px)',
onenter: () => {
console.log('Screen size above 768px but below 992px');
},
onresize: x => {
console.log('Screen size is: ' + x);
},
onexit: () => {
console.log('Left the viewport');
}
}
]);// OPTION 3 ~ Specific
qvp({
id: 'sm',
query: '(max-width: 576px)',
oninit: () => {
console.log('Screen size is below 576px');
},
onenter: () => {
console.log('Screen size is below 576px');
},
onexit: () => {
console.log('Screen size is above 576px');
}
});
```# Methods
The module provides several helpful methods for querying and retrieving context of the browsers screen.
```ts
import qvp from 'qvp';qvp.on(event, callback, scope?) // Method event listening
qvp.off(event, callback | number) // Remove event emitter
qvp.add(id, {}) // Extends the screen with new methods
qvp.get(id) // Returns the viewport and screen matching the id
qvp.active() // List of active screens or single screen
qvp.active(id) // Boolean indicating whether the screen is active
qvp.list() // List of viewport screens states
qvp.list(ids[]) // List of viewport screen states matching the ids
qvp.test(id | id[], separator?) // Test utility for validating screens
qvp.remove(id) // Remove a viewport matching the id from store
qvp.destroy() // Tear down and remove all instances```
# Events
Event listeners will fire methods as events. Media query matches will emit and invoke for all defined screens and can be sepcified using the `id:method` name. The `qvp.on()`
```ts
import qvp from 'qvp';// Define a set of queries and identifiers
qvp({
tablet: '(min-width: 768px) and (max-width: 991px)',
desktop: '(min-width: 992px)'
})// Events will also fire when using method schema
qvp({
id: 'mobile',
query: '(max-width: 777px)',
oninit: () => {
console.log('Screen size is below 777px');
}
})// ...
// Listen for event methods
qvp.on('desktop:oninit', () => {});
qvp.on('desktop:onenter', () => {});
qvp.on('desktop:onexit', () => {});
qvp.on('desktop:onresize', (screenX) => { console.log(screenX) });// Optionally bind context to the events
class Component {constructor () {
this.value = 'Hello World!'
this.event = qvp.on('mobile:onenter', this.method, this) // bind context to callback
}method () {
console.log(this.value) // logs "Hello World!"
}disconnect () {
qvp.off(this.event) // remove this event
}}
// Listen for resizes
qvp.on('tablet:onresize', (screenX: number) => {if(screenX > 800) {
console.log('Screen size is: ', screenX)
}})
qvp.on('mobile:onexit', function () {
console.log(this.context) // logs "foo"
console.log(this.binding) // logs "bar"}, {
context: 'foo',
binding: 'bar'
})
```# Store
The module maintains a store within a constant named `viewports` which you can access as a named import. The store is maintained within a `Map`and each `key` value uses the screen ids, that values hold the screen instances.
```ts
import qvp from 'qvp';qvp.viewports.forEach(viewport => {
// SCREEN INSTANCE
viewport.screen // The screen instance
viewport.screen.id // The screen id value
viewport.screen.query // The media query value
viewport.screen.active // A boolean value indicating whether the viewport is active
viewport.screen.oninit // A Set list of methods to invoke oninit
viewport.screen.onenter // A Set list of methods to invoke onenter
viewport.screen.onexit // A Set list of methods to invoke onexit
viewport.screen.onresize // A Set list of methods to invoke when resizing
viewport.screen.events // Event listeners store (also available on viewport.events)// EVENTS EMITTERS
viewport.events // Event listeners store (same as viewport.screen.events)
// METHOD TRIGGERS
viewport.oninit() // Calls all methods in screen.oninit Set (null if already invoked)
viewport.onenter() // Calls all methods in screen.onenter Set
viewport.onexit() // Calls all methods in screen.onexit Set
viewport.onresize() // Calls all methods in screen.onresize Set})
```