{"id":13580249,"url":"https://github.com/daybrush/ruler","last_synced_at":"2025-05-16T14:08:29.534Z","repository":{"id":35986616,"uuid":"220633722","full_name":"daybrush/ruler","owner":"daybrush","description":"A Ruler component that can draw grids and scroll infinitely.","archived":false,"fork":false,"pushed_at":"2023-06-02T16:24:48.000Z","size":2632,"stargazers_count":346,"open_issues_count":20,"forks_count":41,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-10T05:03:09.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://daybrush.com/ruler/","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/daybrush.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-11-09T11:41:17.000Z","updated_at":"2025-04-23T19:16:49.000Z","dependencies_parsed_at":"2024-02-05T22:03:47.657Z","dependency_job_id":"5c74bef5-b923-416c-8843-06f95b5cf12d","html_url":"https://github.com/daybrush/ruler","commit_stats":{"total_commits":136,"total_committers":5,"mean_commits":27.2,"dds":0.4632352941176471,"last_synced_commit":"e8b427fb413aeb3e05b6e06703a890096292847d"},"previous_names":[],"tags_count":148,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fruler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fruler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fruler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fruler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daybrush","download_url":"https://codeload.github.com/daybrush/ruler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"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-01T15:01:49.122Z","updated_at":"2025-05-16T14:08:24.527Z","avatar_url":"https://github.com/daybrush.png","language":"TypeScript","readme":"\n\u003cp align=\"middle\" \u003e\u003cimg src=\"https://raw.githubusercontent.com/daybrush/ruler/master/demo/images/ruler.png\"/\u003e\u003c/p\u003e\n\u003ch2 align=\"middle\"\u003eRuler\u003c/h2\u003e\n\u003cp align=\"middle\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/@scena/ruler\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@scena/ruler.svg?style=flat-square\u0026color=007acc\u0026label=version\" alt=\"npm version\" /\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/language-typescript-blue.svg?style=flat-square\"/\u003e\n\u003ca href=\"https://github.com/daybrush/ruler/blob/master/LICENSE\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/license/daybrush/ruler.svg?style=flat-square\u0026label=license\u0026color=08CE5D\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/ruler/tree/master/packages/react-ruler\" target=\"_blank\"\u003e\u003cimg alt=\"React\" src=\"https://img.shields.io/static/v1.svg?label=\u0026message=React\u0026style=flat-square\u0026color=61daeb\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/ruler/tree/master/packages/preact-ruler\" target=\"_blank\"\u003e\u003cimg alt=\"Preact\" src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Preact\u0026style=flat-square\u0026color=673ab8\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/ruler/tree/master/packages/ngx-ruler\" target=\"_blank\"\u003e\u003cimg alt=\"Angular\" src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Angular\u0026style=flat-square\u0026color=C82B38\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/ruler/tree/master/packages/vue-ruler\" target=\"_blank\"\u003e\u003cimg\n    alt=\"Vue\"\n    src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Vue\u0026style=flat-square\u0026color=3fb984\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/ruler/tree/master/packages/svelte-ruler\" target=\"_blank\"\u003e\u003cimg\n    alt=\"Vue\"\n    src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Svelte\u0026style=flat-square\u0026color=C82B38\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"middle\"\u003eA Ruler component that can draw grids and scroll infinitely.\u003c/p\u003e\n\u003cp align=\"middle\"\u003e\n    \u003ca href=\"https://daybrush.com/ruler\" target=\"_blank\"\u003e\u003cstrong\u003eDemo\u003c/strong\u003e\u003c/a\u003e /\n    \u003ca href=\"https://daybrush.com/ruler/release/latest/doc/\" target=\"_blank\"\u003e\u003cstrong\u003eAPI\u003c/strong\u003e\u003c/a\u003e /\n    \u003ca href=\"https://github.com/daybrush/guides\" target=\"_blank\"\u003e\u003cstrong\u003eGuides\u003c/strong\u003e\u003c/a\u003e /\n    \u003ca href=\"https://github.com/daybrush/scena\" target=\"_blank\"\u003e\u003cstrong\u003eMain Project\u003c/strong\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n## ⚙️ Installation\n### npm\n```sh\n$ npm i @scena/ruler\n```\n\n### scripts\n```html\n\u003cscript src=\"//daybrush.com/ruler/release/latest/dist/ruler.min.js\"\u003e\u003c/script\u003e\n```\n\n\n## 🚀 How to use\n```ts\nimport Ruler from \"@scena/ruler\";\n\nconst ruler = new Ruler(document.body, {\n    type: \"horizontal\",\n});\n\n\nwindow.addEventListener(\"resize\", () =\u003e {\n    ruler.resize();\n});\n\nexport interface RulerInterface {\n    scroll(scrollPos: number): any;\n    resize(): any;\n}\nexport interface RulerProps {\n    type?: \"horizontal\" | \"vertical\";\n    width?: number;\n    height?: number;\n    unit?: number;\n    zoom?: number;\n    direction?: \"start\" | \"end\";\n    style?: IObject\u003cany\u003e;\n    backgroundColor?: string;\n    lineColor?: string;\n    textColor?: string;\n    textFormat?: (scale: number) =\u003e string;\n}\n```\n### Ruler Units\n\nThe default unit is px, and a line is drawn every 50px. If you want to use a different unit instead of the px unit, use it like this:\n\n* 1px (Default)\n    * zoom: 1\n    * unit: 50 (every 50px)\n* 1cm = 37.7952px\n    * zoom: 37.7952\n    * unit: 1 (every 1cm)\n* 1in = 96px = 2.54cm\n    * zoom: 96\n    * unit: 1 (every 1in)\n\n\n\n## ⚙️ Developments\nThe `ruler` repo is managed as a [monorepo](https://github.com/lerna/lerna) with `yarn`.\n\n```sh\nyarn config set registry https://registry.npmjs.org/\n```\n\n## ⭐️ Show Your Support\nPlease give a ⭐️ if this project helped you!\n\n## 👏 Contributing\n\nIf you have any questions or requests or want to contribute to `ruler` or other packages, please write the [issue](https://github.com/daybrush/ruler/issues) or give me a Pull Request freely.\n\n## 🐞 Bug Report\n\nIf you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/ruler/issues) on GitHub.\n\n\n## 📝 License\n\nThis project is [MIT](https://github.com/daybrush/ruler/blob/master/LICENSE) licensed.\n\n```\nMIT License\n\nCopyright (c) 2019 Daybrush\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":[],"categories":["TypeScript","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaybrush%2Fruler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaybrush%2Fruler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaybrush%2Fruler/lists"}