{"id":26684333,"url":"https://github.com/react-container-query/container-query-toolkit","last_synced_at":"2025-10-08T18:58:47.202Z","repository":{"id":57206411,"uuid":"70902640","full_name":"react-container-query/container-query-toolkit","owner":"react-container-query","description":":wrench: Basic utilities to work with container query.","archived":false,"fork":false,"pushed_at":"2018-02-05T00:01:14.000Z","size":51,"stargazers_count":1,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-18T08:47:57.795Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/react-container-query.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-14T11:08:01.000Z","updated_at":"2020-01-01T09:53:06.000Z","dependencies_parsed_at":"2022-09-11T05:20:26.953Z","dependency_job_id":null,"html_url":"https://github.com/react-container-query/container-query-toolkit","commit_stats":null,"previous_names":["d6u/container-query-toolkit"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/react-container-query/container-query-toolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-container-query%2Fcontainer-query-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-container-query%2Fcontainer-query-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-container-query%2Fcontainer-query-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-container-query%2Fcontainer-query-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/react-container-query","download_url":"https://codeload.github.com/react-container-query/container-query-toolkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-container-query%2Fcontainer-query-toolkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000299,"owners_count":26082780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-26T09:20:07.011Z","updated_at":"2025-10-08T18:58:47.173Z","avatar_url":"https://github.com/react-container-query.png","language":"JavaScript","readme":"# container-query-toolkit\n\n:wrench: Basic utilities to work with container query.\n\n## Install\n\n```\nnpm i -S container-query-toolkit\n```\n\n## Usage\n\n```js\nconst kit = require('container-query-toolkit');\n// or\nimport * as kit from 'container-query-toolkit';\n// or\nimport {matchQueries} from 'container-query-toolkit';\n// or\nimport matchQueries from 'container-query-toolkit/lib/matchQueries';\n\nconst query = {\n  a: {minWidth: 400, maxWidth: 500, minHeight: 400, maxHeight: 500},\n  b: {minWidth: 500, maxWidth: 600, minHeight: 400, maxHeight: 500},\n  c: {minWidth: 400, maxWidth: 500, minHeight: 500, maxHeight: 600},\n  d: {minWidth: 500, maxWidth: 600, minHeight: 500, maxHeight: 600},\n};\n\nconst result1 = matchQueries(query)({width: 300, height: 300});\nexpect(result1).toEqual({a: false, b: false, c: false, d: false});\n\nconst result2 = matchQueries(query)({width: 450, height: 450});\nexpect(result2).toEqual({a: true, b: false, c: false, d: false});\n\nconst result3 = matchQueries(query)({width: 450, height: 550});\nexpect(result3).toEqual({a: false, b: false, c: true, d: false});\n\nconst result4 = matchQueries(query)({width: 550, height: 450});\nexpect(result4).toEqual({a: false, b: true, c: false, d: false});\n\nconst result5 = matchQueries(query)({width: 550, height: 550});\nexpect(result5).toEqual({a: false, b: false, c: false, d: true});\n\nconst result6 = matchQueries(query)({width: 700, height: 700});\nexpect(result6).toEqual({a: false, b: false, c: false, d: false});\n\n// {min|max}Height would be ignored if height is not provided.\nconst result7 = matchQueries(query)({width: 450});\nexpect(result7).toEqual({a: true, b: false, c: true, d: false});\n\n// {min|max}Width would be ignored if width is not provided.\nconst result8 = matchQueries(query)({height: 450});\nexpect(result8).toEqual({a: true, b: true, c: false, d: false});\n```\n\n## API\n\n### `matchQueries(rules)(contentSize)`\n\n- `rules: {[key: string]: {minWidth?: number, maxWidth?: number, minHeight?: number, maxHeight?: number}}`\n\n- `contentSize: {height?: number, width?: number}`\n\n\tIf `contentSize` is missing `height` or `width`, `{min|max}Height` or `{min|max}Width` rules will be ignored respectively.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-container-query%2Fcontainer-query-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freact-container-query%2Fcontainer-query-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-container-query%2Fcontainer-query-toolkit/lists"}