{"id":16760265,"url":"https://github.com/ryanve/cader","last_synced_at":"2025-03-16T09:16:33.011Z","repository":{"id":57192621,"uuid":"115646566","full_name":"ryanve/cader","owner":"ryanve","description":"Facade your cascade.","archived":false,"fork":false,"pushed_at":"2018-01-17T20:01:50.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T21:51:21.083Z","etag":null,"topics":["classname","classnames","javascript","opensource","ssv"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cader","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-28T17:45:53.000Z","updated_at":"2018-01-04T01:17:24.000Z","dependencies_parsed_at":"2022-08-24T05:21:18.347Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/cader","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fcader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fcader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fcader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fcader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/cader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847056,"owners_count":20357317,"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":["classname","classnames","javascript","opensource","ssv"],"created_at":"2024-10-13T04:22:55.716Z","updated_at":"2025-03-16T09:16:32.770Z","avatar_url":"https://github.com/ryanve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cader\nFacade your cascade.\n\n```\nnpm install cader\n```\n\n```js\nconst cader = require(\"cader\")\nconst cade = new cader\n\ncade.save({\n  \"Box\": \"border-box m0 p0 border-none\",\n  \"Fit\": \"width-fit height-fit\",\n  \"Tap\": \"preset-tap font-control\",\n  \"PadWide\": \"px2 py1\",\n  \"PadTall\": \"px1 py2\",\n  \"Raised\": \"shadow-raised\",\n}).save({\n  \"ButtonTallRaised\": cade.fuse(\"Tap PadTall Raised\"),\n  \"ButtonWideRaised\": cade.fuse(\"Tap PadWide Raised\"),\n  \"Circle\": cade.bond(\"Box radii-circle\"),\n})\n```\n\n## API\n\n### `.save(mapping)`\n\n- Save `mapping` to the instance\n- `@param {Object} mapping`\n- `@return this` for chaining\n\n```js\nconst cade = new cader\n\ncade.save({\n  \"Box\": \"border-box m0 p0 border-none\",\n  \"Contain\": \"clearfix relative\",\n})\n\ncade.fuse(\"Box\") // border-box m0 p0 border-none\ncade.fuse(\"Contain\") // clearfix relative\ncade.fuse(\"Box Contain\") // border-box m0 p0 border-none clearfix relative\ncade.bond(\"Box another\") // border-box m0 p0 border-none another\n```\n\n### `.fuse(atoms)`\n\n- fuse atoms into string\n- `atoms` is a space-separated string of saved atoms only\n- throws error if attempting to fuse unsaved atoms\n- `@return string`\n\n```js\nconst cade = new cader\n\ncade.save({\n  \"Box\": \"border-box m0 p0 border-none\",\n  \"ViewportSize\": \"w-100vw h-100vh\"\n})\n\ncade.fuse(\"Box ViewportSize\")  // border-box m0 p0 border-none w-100vw h-100vh\n```\n\n### `.bond(atoms)`\n\n- bond atoms into string\n- `atoms` is a space-separated string of saved atoms or foreign particles\n- foreign particles are included as is\n- `@return string`\n\n```js\nconst cade = new cader\n\ncade.save({\n  \"Box\": \"border-box m0 p0 border-none\",\n  \"ViewportSize\": \"w-100vw h-100vh\"\n})\n\ncade.bond(\"Box ViewportSize p2\")  // border-box m0 p0 border-none w-100vw h-100vh p2\n```\n\n### `.freeze()`\n\n- freeze mapping to prevent new atoms from being saved\n- facilitates immutability\n- `@return this` for chaining\n\n```js\nconst cade = new cader\ncade.freeze()\ncade.save({ \"Unable\": \"example\" }) // throws Error\n```\n\n### `.clone()`\n\n- clone instance\n- useful for extending frozen instances without mutating them\n- `@return` new instance with cloned mapping\n\n```js\nconst library = new cader\nlibrary.save({/* ... */}).freeze() // save library atoms and then freeze export\nconst feature = library.clone() // new instance has access to atoms from library\nfeature.save({/* ... */})  // can save more atoms if unique from library atoms\n```\n\n### `.pair(mate)`\n\n- pair instance with another instance\n- shortcut for `.clone().save(mate.port())`\n- will `throw` if there are conflicts\n- `@return` clone containing atoms from both\n\n```js\nconst shape = new cader\nconst paint = new cader\n/* ... */\nconst super = shape.pair(paint)\n```\n\n### `.port()`\n\n- get serializable object representing atom mapping\n- mainly for internal use or inspection\n- `@return` serializable plain object\n\n### `.help()`\n\n- log [helpful info](https://github.com/ryanve/cader/pull/22) about an instance including atom mapping and methods\n- useful for inspection, debugging, learning\n- `@return this` for chaining\n\n## Compatibility\n- ES5+\n- CommonJS\n- Node\n- Web via `webpack` | `rollup` | `browserify`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fcader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Fcader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fcader/lists"}