{"id":13509090,"url":"https://github.com/davidkpiano/RxCSS","last_synced_at":"2025-03-30T13:31:27.603Z","repository":{"id":65492120,"uuid":"55437346","full_name":"davidkpiano/RxCSS","owner":"davidkpiano","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-04T10:09:46.000Z","size":49,"stargazers_count":416,"open_issues_count":2,"forks_count":20,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T20:07:32.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/davidkpiano.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-04-04T19:04:31.000Z","updated_at":"2025-03-07T03:03:09.000Z","dependencies_parsed_at":"2023-01-25T19:25:12.278Z","dependency_job_id":null,"html_url":"https://github.com/davidkpiano/RxCSS","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkpiano%2FRxCSS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkpiano%2FRxCSS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkpiano%2FRxCSS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkpiano%2FRxCSS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidkpiano","download_url":"https://codeload.github.com/davidkpiano/RxCSS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246093165,"owners_count":20722400,"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","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":"2024-08-01T02:01:02.816Z","updated_at":"2025-03-30T13:31:27.557Z","avatar_url":"https://github.com/davidkpiano.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Frameworks/Libraries"],"sub_categories":["CSS"],"readme":"# RxCSS\n\nRxCSS is a _very_ small library for manipulating [CSS Custom Properties](https://www.w3.org/TR/css-variables/) (aka CSS Variables) with [RxJS Observables](http://reactivex.io/rxjs/).\n\n**More Info**\n\n- :book: Read the slides: http://slides.com/davidkhourshid/reactanim#/\n- :movie_camera: Watch the presentation: https://www.youtube.com/watch?v=lTCukb6Zn3g\n\n## Requirements\n\nMake sure [RxJS](https://github.com/ReactiveX/rxjs) is installed and globally available.\n\n## Installation\n\nYou can either use RxCSS in an existing project:\n\n```bash\nnpm install rxcss@latest --save\n```\n\nOr you can include it directly in a `\u003cscript\u003e` tag:\n```html\n\u003cscript src=\"https://unpkg.com/@reactivex/rxjs/dist/global/Rx.min.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/rxcss@latest/dist/rxcss.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n```js\nconst mouse$ = Rx.Observable\n  .fromEvent(document, 'mousemove')\n  .map(({ clientX, clientY }) =\u003e ({\n    x: clientX,\n    y: clientY\n  }));\n\n\nconst style$ = RxCSS({\n  mouse: mouse$,\n});\n\n// Optional\nstyle$.subscribe(...);\n```\n\n```css\n:root {\n  --mouse-x: 0;\n  --mouse-y: 0;\n}\n\n\n.ball {\n  transform:\n    translateX(calc(var(--mouse-x) * 1px))\n    translateY(calc(var(--mouse-y) * 1px));\n}\n```\n\n## API\n\n### `RxCSS(observableMap[, target])`\nSets each key/value pair, where each value is an observable, as a CSS variable on the target.\n\n- `observableMap` _(Object)_ - an object where each:\n  - `key` is the CSS variable name to be set on the `target`\n  - `value` is either an Observable stream of values, or a single value to set the CSS variable to.\n- `target` _(Element)_ - the DOM node to set the CSS variables to. Default: `document.documentElement`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidkpiano%2FRxCSS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidkpiano%2FRxCSS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidkpiano%2FRxCSS/lists"}