{"id":20263215,"url":"https://github.com/wesm87/styled-transform-proxy","last_synced_at":"2026-04-24T20:07:25.690Z","repository":{"id":30710728,"uuid":"125777290","full_name":"wesm87/styled-transform-proxy","owner":"wesm87","description":"A wrapper function for extending styled-components via a custom transform function","archived":false,"fork":false,"pushed_at":"2023-01-06T01:57:31.000Z","size":311,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-24T01:54:53.493Z","etag":null,"topics":["styled-components"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/wesm87.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":"2018-03-18T23:29:31.000Z","updated_at":"2020-06-24T00:20:52.000Z","dependencies_parsed_at":"2023-01-14T17:45:15.674Z","dependency_job_id":null,"html_url":"https://github.com/wesm87/styled-transform-proxy","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/wesm87/styled-transform-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesm87%2Fstyled-transform-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesm87%2Fstyled-transform-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesm87%2Fstyled-transform-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesm87%2Fstyled-transform-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wesm87","download_url":"https://codeload.github.com/wesm87/styled-transform-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesm87%2Fstyled-transform-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32238797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["styled-components"],"created_at":"2024-11-14T11:34:03.855Z","updated_at":"2026-04-24T20:07:25.676Z","avatar_url":"https://github.com/wesm87.png","language":"TypeScript","readme":"# styled-transform-proxy\n\nA wrapper function for extending styled-components via a custom transform function. The\nwrapper function is curried and takes two arguments - the transform function and the\noriginal `styled` function from `styled-components`. The transform receives the original\nstrings \u0026 interpolations and is expected to return an array containing the strings and\ninterpolations with any transformations applied.\n\n## Install\n\n```sh\n# Yarn\nyarn add styled-transform-proxy\n\n# npm\nnpm install --save styled-transform-proxy\n```\n\n## Type Definitions\n\n```\ntransform :: (Array\u003cString\u003e strings, ...* interpolations) -\u003e [strings, ...interpolations]\n\nstyledTransformProxy :: transform -\u003e styled -\u003e styled\n```\n\n## Examples\n\n### Transform strings\n\n```js\n// src/styled.js\nimport styled from 'styled-components';\nimport styledTransformProxy from 'styled-transform-proxy';\nimport { map, replace } from 'ramda';\n\nconst transformStrings = map(replace(/\\.foo\\s/g, '.bar '));\n\nconst transform = (strings, ...interpolations) =\u003e [\n  transformStrings([...strings]),\n  ...interpolations\n];\n\nexport default styledTransformProxy(transform, styled);\n\n// src/components/MyComponent.js\nimport styled from '../styled';\n\n// Results in `.foo` below being transformed to `.bar`\nconst MyComponent = styled.span`\n  .foo {\n    color: red;\n  }\n`;\n```\n\n### Transform interpolations\n\n```js\n// src/styled.js\nimport styled from 'styled-components';\nimport styledTransformProxy from 'styled-transform-proxy';\nimport { map, path, when, is } from 'ramda';\n\nconst transformInterpolations = map(when(is(Array), path));\n\nconst transform = (strings, ...interpolations) =\u003e [\n  strings,\n  ...transformInterpolations(interpolations),\n];\n\nexport default styledTransformProxy(transform, styled);\n\n// src/components/MyComponent.js\nimport styled from '../styled';\n\nconst MyComponent = styled.span`\n  color: ${['colors', 'foreground']};\n  background-color: ${['colors', 'background']}\n`;\n\n// The above is equivalent to:\nconst MyComponent = styled.span`\n  color: ${(props) =\u003e props.colors.foreground};\n  background-color: ${(props) =\u003e props.colors.background};\n`;\n```\n\n### Composing transforms\n\nThe wrapper function being curried means that composing multiple transformations together\nis simple:\n\n```js\n// src/styled.js\nimport styled from 'styled-components';\nimport styledTransformProxy from 'styled-transform-proxy';\nimport { compose } from 'ramda';\n\nconst transformFoo = (strings, ...interpolations) =\u003e [...];\nconst transformBar = (strings, ...interpolations) =\u003e [...];\n\nconst applyTransforms = compose(\n  styledTransformProxy(transformFoo),\n  styledTransformProxy(transformBar),\n);\n\nexport default applyTransforms(styled);\n```\n\n### Third-party libraries\n\nIf you're creating a third-party package that utilizes `styled-transform-proxy` you can simplify things a bit compared to the above examples. In addition to the wrapper function being curried, it takes the original `styled` function as its last argument, meaning instead of this:\n\n```js\nexport default (styled) =\u003e styledTransformProxy(transform, styled);\n```\n\n...you can simply do this:\n\n```js\nexport default styledTransformProxy(transform);\n```\n\n## Caveats\n\nCurrently there is no straightforward way to tap into the `extend` method on a styled\ncomponent, so the transform function will not be applied when using `extend`. So instead\nof this:\n\n```js\nconst ChildComponent = ParentComponent.extend`...`;\n```\n\n...you'll need to do this:\n\n```js\nconst ChildComponent = styled(ParentComponent)`...`;\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesm87%2Fstyled-transform-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesm87%2Fstyled-transform-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesm87%2Fstyled-transform-proxy/lists"}