{"id":13880714,"url":"https://github.com/marcoroth/turbo_power","last_synced_at":"2025-05-14T14:09:32.491Z","repository":{"id":58033970,"uuid":"529402588","full_name":"marcoroth/turbo_power","owner":"marcoroth","description":"Custom Actions power-pack for Turbo Streams","archived":false,"fork":false,"pushed_at":"2025-05-09T11:47:59.000Z","size":1236,"stargazers_count":473,"open_issues_count":8,"forks_count":17,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-12T01:06:18.047Z","etag":null,"topics":["cableready","hacktoberfest","hotwire","rails","streams","turbo","turbostreams"],"latest_commit_sha":null,"homepage":"","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/marcoroth.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"marcoroth"}},"created_at":"2022-08-26T20:56:06.000Z","updated_at":"2025-05-09T11:47:32.000Z","dependencies_parsed_at":"2024-02-06T02:42:02.291Z","dependency_job_id":"69fcf701-0c8f-40dd-a86d-cbac16bd4e60","html_url":"https://github.com/marcoroth/turbo_power","commit_stats":{"total_commits":289,"total_committers":14,"mean_commits":"20.642857142857142","dds":0.5121107266435987,"last_synced_commit":"a746f78488a112625eabf6610219418c1db0501c"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Fturbo_power","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Fturbo_power/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Fturbo_power/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Fturbo_power/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcoroth","download_url":"https://codeload.github.com/marcoroth/turbo_power/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160413,"owners_count":22024568,"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":["cableready","hacktoberfest","hotwire","rails","streams","turbo","turbostreams"],"created_at":"2024-08-06T08:03:25.240Z","updated_at":"2025-05-14T14:09:27.478Z","avatar_url":"https://github.com/marcoroth.png","language":"TypeScript","funding_links":["https://github.com/sponsors/marcoroth"],"categories":["TypeScript","**Awesome Hotwire** [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)"],"sub_categories":["Turbo"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets/hero-dark.png\"\u003e\n    \u003cimg src=\"assets/hero.png\" height=\"340px\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eTurboPower\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/marcoroth/turbo_power\"\u003e\n    \u003cimg src=\"https://github.com/marcoroth/turbo_power/actions/workflows/tests.yml/badge.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/turbo_power\"\u003e\n    \u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/turbo_power?logo=npm\u0026color=38C160\"\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://www.npmjs.com/package/turbo_power\"\u003e\n    \u003cimg alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dm/turbo_power?logo=npm\u0026color=38C160\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/package/turbo_power\"\u003e\n    \u003cimg alt=\"NPM Bundle Size\" src=\"https://img.shields.io/bundlephobia/minzip/turbo_power?label=bundle%20size\u0026logo=npm\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Getting Started\n\n`turbo_power` is a power-pack for Turbo Streams. It provides Turbo Streams with a bunch of new actions and additionally adds the `morph` action from [`turbo-morph`](https://github.com/marcoroth/turbo-morph).\n\n**Note:** Requires Turbo **7.2+**\n\n## Getting Started\n\n```bash\nyarn add turbo_power\n```\n\n```diff\n// application.js\nimport * as Turbo from '@hotwired/turbo'\n\n+import TurboPower from 'turbo_power'\n+TurboPower.initialize(Turbo.StreamActions)\n```\n\n## Getting Started with Rails\n\nCheckout the instructions in the [`turbo_power-rails`](https://github.com/marcoroth/turbo_power-rails) repo.\n\n## Getting Started with Django\n\nCheckout the doc of the [`django-turbo-helper`](https://github.com/rails-inspire-django/django-turbo-helper) repo.\n\n## Custom Actions\n\n### DOM Actions\n\n* `turbo_stream.graft(target, parent, **attributes)`\n* [`turbo_stream.morph(target, html = nil, **attributes, \u0026block)`](https://github.com/marcoroth/turbo-morph)\n* `turbo_stream.inner_html(target, html = nil, **attributes, \u0026block)`\n* `turbo_stream.insert_adjacent_html(target, html = nil, position: 'beforeend', **attributes, \u0026block)`\n* `turbo_stream.insert_adjacent_text(target, text, position: 'beforebegin', **attributes)`\n* `turbo_stream.outer_html(target, html = nil, **attributes, \u0026block)`\n* `turbo_stream.text_content(target, text, **attributes)`\n* `turbo_stream.set_meta(name, content)`\n\n\n### Attribute Actions\n\n* `turbo_stream.add_css_class(target, classes, **attributes)`\n* `turbo_stream.remove_attribute(target, attribute, **attributes)`\n* `turbo_stream.remove_css_class(target, classes, **attributes)`\n* `turbo_stream.set_attribute(target, attribute, value, **attributes)`\n* `turbo_stream.set_dataset_attribute(target, attribute, value, **attributes)`\n* `turbo_stream.set_property(target, property, value, **attributes)`\n* `turbo_stream.set_style(target, name, value, **attributes)`\n* `turbo_stream.set_styles(target, styles, **attributes)`\n* `turbo_stream.set_value(target, value, **attributes)`\n* `turbo_stream.toggle_attribute(target, attribute, force, **attributes)`\n* `turbo_stream.toggle_css_class(target, classes, **attributes)`\n* `turbo_stream.replace_css_class(target, from, to, **attributes)`\n\n\n### Event Actions\n\n* `turbo_stream.dispatch_event(target, name, detail: {}, **attributes)`\n\n\n### Form Actions\n\n* `turbo_stream.reset_form(target, **attributes)`\n\n\n### Storage Actions\n\n* `turbo_stream.clear_storage(type, **attributes)`\n* `turbo_stream.clear_local_storage(**attributes)`\n* `turbo_stream.clear_session_storage(**attributes)`\n* `turbo_stream.remove_storage_item(key, type, **attributes)`\n* `turbo_stream.remove_local_storage_item(key, **attributes)`\n* `turbo_stream.remove_session_storage_item(key, **attributes)`\n* `turbo_stream.set_storage_item(key, value, type, **attributes)`\n* `turbo_stream.set_local_storage_item(key, value, **attributes)`\n* `turbo_stream.set_session_storage_item(key, value, **attributes)`\n\n\n### Browser Actions\n\n* `turbo_stream.reload(**attributes)`\n* `turbo_stream.scroll_into_view(**attributes)`\n  * `turbo_stream.scroll_into_view(targets)`\n  * `turbo_stream.scroll_into_view(targets, align_to_top)`\n  * `turbo_stream.scroll_into_view(targets, behavior:,  block:, inline:)`\n* `turbo_stream.set_focus(target, **attributes)`\n* `turbo_stream.set_title(title, **attributes)`\n\n\n### Document Actions\n\n* `turbo_stream.set_cookie(cookie, **attributes)`\n* `turbo_stream.set_cookie_item(key, value, **attributes)`\n\n\n### Browser History Actions\n\n* `turbo_stream.history_back(**attributes)`\n* `turbo_stream.history_forward(**attributes)`\n* `turbo_stream.history_go(delta, **attributes)`\n* `turbo_stream.push_state(url, title = nil, state = nil, **attributes)`\n* `turbo_stream.replace_state(url, title = nil, state = nil, **attributes)`\n\n\n### Debug Actions\n\n* `turbo_stream.console_log(message, level = :log)`\n* `turbo_stream.console_table(data, columns)`\n\n\n### Notification Actions\n\n* `turbo_stream.notification(title, **options)`\n\n\n### Turbo Actions\n\n* `turbo_stream.redirect_to(url, turbo_action = nil, turbo_frame = nil, **attributes)`\n* `turbo_stream.turbo_clear_cache()`\n\n\n### Turbo Progress Bar Actions\n\n* `turbo_stream.turbo_progress_bar_show()`\n* `turbo_stream.turbo_progress_bar_hide()`\n* `turbo_stream.turbo_progress_bar_set_value(value)`\n\n\n### Turbo Frame Actions\n\n* `turbo_stream.turbo_frame_reload(frame_id)`\n* `turbo_stream.turbo_frame_set_src(frame_id, src)`\n\n\n\n## Previous Art\n\nTurboPower is heavily inspired by [CableReady](https://github.com/stimulusreflex/cable_ready) and its operations. This library aims to bring the same level of operation-diversity to Turbo Streams.\n\n## Development\n\nTo run the test runner:\n\n```plain\nyarn build\nyarn test\n```\n\n## Acknowledgments\n\n`turbo_power` is [MIT-licensed](LICENSE) open-source software from [Marco Roth](https://github.com/marcoroth).\n\n`turbo-morph` is [MIT-licensed](https://github.com/marcoroth/turbo-morph/blob/master/LICENSE) open-source software from [Marco Roth](https://github.com/marcoroth).\n\nTurbo is [MIT-licensed](https://github.com/hotwired/turbo/blob/main/MIT-LICENSE) open-source software from [Basecamp](https://basecamp.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoroth%2Fturbo_power","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcoroth%2Fturbo_power","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoroth%2Fturbo_power/lists"}