{"id":28485334,"url":"https://github.com/rails-designer/i-runner","last_synced_at":"2025-08-25T00:47:37.955Z","repository":{"id":296813114,"uuid":"994552549","full_name":"Rails-Designer/i-runner","owner":"Rails-Designer","description":"A tiny self-destructing custom element for one-off DOM actions (focus, reset and more)","archived":false,"fork":false,"pushed_at":"2025-06-03T11:23:06.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T08:24:27.843Z","etag":null,"topics":["custom-element","custom-elements","hotwire","rails","turbo","web-component"],"latest_commit_sha":null,"homepage":"https://railsdesigner.com/i-runner/","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/Rails-Designer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-02T05:46:58.000Z","updated_at":"2025-06-03T11:23:07.000Z","dependencies_parsed_at":"2025-06-02T17:22:54.719Z","dependency_job_id":null,"html_url":"https://github.com/Rails-Designer/i-runner","commit_stats":null,"previous_names":["rails-designer/i-runner"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Rails-Designer/i-runner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fi-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fi-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fi-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fi-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rails-Designer","download_url":"https://codeload.github.com/Rails-Designer/i-runner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rails-Designer%2Fi-runner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271987486,"owners_count":24854519,"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-08-24T02:00:11.135Z","response_time":111,"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":["custom-element","custom-elements","hotwire","rails","turbo","web-component"],"created_at":"2025-06-08T00:09:49.293Z","updated_at":"2025-08-25T00:47:37.862Z","avatar_url":"https://github.com/Rails-Designer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i-runner\n\nA tiny self-destructing custom element for one-off DOM actions (focus, reset and more).\n\n\n**Sponsored By [Rails Designer](https://railsdesigner.com/)**\n\n\u003ca href=\"https://railsdesigner.com/\" target=\"_blank\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/Rails-Designer/i-runner/HEAD/.github/logo-dark.svg\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Rails-Designer/i-runner/HEAD/.github/logo-light.svg\"\u003e\n    \u003cimg alt=\"Rails Designer\" src=\"https://raw.githubusercontent.com/Rails-Designer/i-runner/HEAD/.github/logo-light.svg\" width=\"240\" style=\"max-width: 100%;\"\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\nWant to be able to understand this JavaScript code? 😊 👉 [JavaScript for Rails Developers](https://javascriptforrails.com/)\n\n\n## Installation\n\n```bash\nnpm install i-runner\n```\n\nThen in your code:\n\n```js\nimport \"i-runner\";\n```\n\n\n## Usage\n\nSimply drop the `\u003ci-run\u003e` tag in your HTML:\n```html\n\u003c!-- Focus an input with id=\"email\" --\u003e\n\u003ci-run action=\"focus\" target=\"email\"\u003e\u003c/i-run\u003e\n\n\u003c!-- Reset all forms with class=\"signup\" --\u003e\n\u003ci-run action=\"reset\" targets=\"signup\"\u003e\u003c/i-run\u003e\n```\n\n\n## Attributes\n\n-  `action` (string, required). One of the below listed actions.\n-  `target` (string, optional). An element ID to select via `#id`.\n-  `targets` (string, optional). A class name to select via `.className`.\n\n\n## Actions\n\ni-runner includes a few first-party actions.\n\n- focus; set focus to an input field;\n- reset; reset a form;\n- addClass; add one or many CSS classes to a field;\n- setAttribute; add an attribute.\n\n\n## Extensibility\n\nYou can register your own actions at runtime by tapping into the exported `ACTION_HANDLERS` map. Every action handler follows the signature:\n```\n(elements: HTMLElement[], options: { [attrName: string]: string }) ⇒ void\n```\n\n1. Import the registry (ESM) or access it from the global UMD object:\n```js\nimport { ACTION_HANDLERS } from \"i-runner\";\n```\n\n2. Define your custom `fadeOut` handler:\n```js\nfunction fadeOutAction(elements, options) {\n  const duration = Number(options[\"data-duration\"] || 300);\n  const easing = options[\"data-easing\"] || \"linear\";\n\n  elements.forEach((element) =\u003e {\n    element.style.transition = `opacity ${duration}ms ${easing}`;\n    element.style.opacity = \"0\";\n\n    setTimeout(() =\u003e {\n      // Remove the element after the fade completes\n      element.remove();\n    }, duration);\n  });\n}\n```\n\n3. Register it under a new name:\n```js\nACTION_HANDLERS.fadeOut = fadeOutAction;\n```\n\n4. Use it in your HTML:\n```html\n\u003c!-- fade out and remove .alert over 500ms with ease-out --\u003e\n\u003ci-run\n  action=\"fadeOut\"\n  targets=\"alert\"\n  data-duration=\"500\"\n  data-easing=\"ease-out\"\u003e\n\u003c/i-run\u003e\n```\n\n\n## Development\n\n```bash\n# Install dev dependencies\nnpm install\n\n# Build bundles (ESM + UMD)\nnpm run build\n\n# Preview with a local server\nnpm dev\n\n# Run basic test\nnpm test\n```\n\n\n## Release\n\nBecause I always forget how to do this and don't feel like pulling a third-party dependency for releasing.\n\n```bash\nnpm version patch # or minor, or major\nnpm publish\ngit push\ngit push --tags\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frails-designer%2Fi-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frails-designer%2Fi-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frails-designer%2Fi-runner/lists"}