From 1b1b3c75dad40ca1b20a66b93e1fb4cdc9ce3133 Mon Sep 17 00:00:00 2001 From: Christian Blavier Date: Tue, 14 Feb 2023 17:29:44 +0100 Subject: [PATCH] =?UTF-8?q?renamed=20project=20to=20phoenix=5Fstorybook=20?= =?UTF-8?q?=F0=9F=94=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .formatter.exs | 2 +- .gitignore | 2 +- CHANGELOG.md | 39 ++++++------ CONTRIBUTING.md | 16 ++--- README.md | 36 +++++------ assets/package-lock.json | 4 +- assets/package.json | 6 +- config/config.exs | 4 +- config/prod.exs | 2 +- coveralls.json | 2 +- guides/components.md | 18 +++--- guides/icons.md | 8 +-- guides/sandboxing.md | 12 ++-- guides/setup.md | 18 +++--- guides/theming.md | 2 +- lib/mix/tasks/dev.storybook.ex | 2 +- lib/mix/tasks/phx.gen.storybook.ex | 6 +- ...live_storybook.ex => phoenix_storybook.ex} | 28 ++++----- lib/phoenix_storybook/application.ex | 20 ++++++ .../components/icon.ex | 8 +-- .../controllers/asset_not_found_controller.ex | 8 +-- .../entries.ex | 12 ++-- .../events/event_log.ex | 2 +- .../events/instrumenter.ex | 8 +-- .../exs_compiler.ex | 2 +- .../guides/guide_macros.ex | 2 +- .../guides/guides.ex | 4 +- .../helpers/asset_helpers.ex | 2 +- .../helpers/extra_assigns_helpers.ex | 8 +-- .../helpers/navigation_helpers.ex | 2 +- .../helpers/search_helpers.ex | 2 +- .../helpers/template_helpers.ex | 2 +- .../helpers/theme_helpers.ex | 2 +- .../helpers/validation_helpers.ex | 2 +- .../live/error_view.ex | 4 +- .../live/search.ex | 8 +-- .../live/sidebar.ex | 10 +-- .../live/story/component_iframe_live.ex | 18 +++--- .../live/story/playground.ex | 18 +++--- .../live/story/playground_preview_live.ex | 20 +++--- .../live/story_live.ex | 34 +++++----- .../live/visual_test_live.ex | 20 +++--- .../mount.ex | 2 +- .../rendering/code_renderer.ex | 10 +-- .../rendering/component_renderer.ex | 6 +- .../rendering/rendering_context.ex | 8 +-- .../rendering/rendering_variation.ex | 2 +- .../router.ex | 34 +++++----- .../stories/attr.ex | 4 +- .../stories/doc.ex | 2 +- .../stories/index.ex | 8 +-- .../stories/index_validator.ex | 4 +- .../stories/slot.ex | 4 +- .../stories/story.ex | 24 +++---- .../stories/story_source.ex | 2 +- .../stories/story_validator.ex | 6 +- .../stories/variation.ex | 6 +- .../templates/layout/_favicon.html.heex | 0 .../templates/layout/live.html.heex | 4 +- .../templates/layout/live_iframe.html.heex | 0 .../templates/layout/root.html.heex | 0 .../templates/layout/root_iframe.html.heex | 0 .../views/layout_view.ex | 14 ++--- .../web.ex | 18 +++--- lib/phx_live_storybook/application.ex | 20 ------ mix.exs | 18 +++--- .../phx.gen.storybook/_root.index.exs | 4 +- .../core_components/button.story.exs.eex | 2 +- .../core_components/flash.story.exs.eex | 2 +- .../core_components/header.story.exs.eex | 2 +- .../core_components/input.story.exs.eex | 2 +- .../core_components/list.story.exs.eex | 2 +- .../core_components/modal.story.exs.eex | 2 +- .../core_components/table.story.exs.eex | 2 +- .../examples/core_components.story.exs.eex | 2 +- .../phx.gen.storybook/storybook.css.eex | 2 +- .../phx.gen.storybook/storybook.ex.eex | 2 +- .../phx.gen.storybook/storybook.tailwind.css | 2 +- .../phx.gen.storybook/welcome.story.exs | 10 +-- test/fixtures/exs/bad_script.exs | 2 +- test/fixtures/exs/script.exs | 2 +- test/fixtures/indexes/bad_entry.index.exs | 2 +- .../indexes/bad_entry_icon_provider.index.exs | 2 +- .../indexes/bad_folder_icon.index.exs | 2 +- .../indexes/bad_folder_name.index.exs | 2 +- test/fixtures/indexes/empty.index.exs | 2 +- test/fixtures/indexes/valid.index.exs | 2 +- .../flat_list/a_component.story.exs | 2 +- .../flat_list/b_component.story.exs | 2 +- .../render_page_crash/a_page.story.exs | 2 +- .../storybook_content/tree/_root.index.exs | 2 +- .../tree/a_folder/_a_folder.index.exs | 2 +- .../tree/a_folder/component.story.exs | 2 +- .../tree/a_folder/live_component.story.exs | 2 +- .../storybook_content/tree/a_page.story.exs | 2 +- .../tree/b_folder/_b_folder.index.exs | 2 +- .../b_folder/all_types_component.story.exs | 2 +- .../tree/b_folder/component.story.exs | 2 +- .../tree/b_folder/nested_component.story.exs | 2 +- .../tree/b_folder/with_id_component.story.exs | 2 +- .../storybook_content/tree/b_page.story.exs | 2 +- .../tree/component.story.exs | 2 +- .../tree/event/_event.index.exs | 2 +- .../tree/event/event_component.story.exs | 2 +- .../tree/event/event_live_component.story.exs | 2 +- .../tree/examples/example.story.exs | 2 +- .../tree/let/let_component.story.exs | 2 +- .../tree/let/let_live_component.story.exs | 2 +- .../tree/live_component.story.exs | 2 +- .../invalid_template_component.story.exs | 2 +- .../templates/template_component.story.exs | 2 +- .../template_iframe_component.story.exs | 2 +- .../template_live_component.story.exs | 2 +- .../bb_folder/b_ba_component.story.exs | 2 +- .../bb_folder/b_bb_component.story.exs | 2 +- test/fixtures/stubs/component_stub.ex | 6 +- test/fixtures/stubs/example_stub.ex | 4 +- test/fixtures/stubs/live_component_stub.ex | 6 +- test/fixtures/stubs/page_stub.ex | 4 +- test/mix/tasks/dev.storybook_test.exs | 6 +- test/mix/tasks/phx.gen.storybook_test.exs | 16 ++--- test/mix_helper.exs | 2 +- .../components/icon_test.exs | 4 +- .../asset_not_found_controller_test.exs | 8 +-- .../exs_compiler_test.exs | 12 ++-- .../guides/guides_test.exs | 4 +- .../helpers/asset_helpers_test.exs | 4 +- .../helpers/extra_assigns_helpers_test.exs | 10 +-- .../helpers/search_helpers_test.exs | 4 +- .../helpers/template_helpers_test.exs | 4 +- .../live/component_iframe_live_test.exs | 4 +- .../live/playground_live_test.exs | 8 +-- .../live/search_test.exs | 6 +- .../live/sidebar_test.exs | 6 +- .../live/story_live_test.exs | 10 +-- .../live/visual_test_live_test.exs | 10 +-- .../rendering/code_renderer_test.exs | 6 +- .../rendering/component_renderer_test.exs | 10 +-- .../router_test.exs | 6 +- .../stories/doc_test.exs | 14 ++--- .../stories/index_validator_test.exs | 2 +- .../stories/story_source_test.exs | 6 +- .../stories/story_test.exs | 18 +++--- .../stories/story_validator_test.exs | 12 ++-- ...ok_test.exs => phoenix_storybook_test.exs} | 10 +-- test/test_helper.exs | 62 +++++++++---------- 146 files changed, 507 insertions(+), 506 deletions(-) rename lib/{phx_live_storybook.ex => phoenix_storybook.ex} (90%) create mode 100644 lib/phoenix_storybook/application.ex rename lib/{phx_live_storybook => phoenix_storybook}/components/icon.ex (94%) rename lib/{phx_live_storybook => phoenix_storybook}/controllers/asset_not_found_controller.ex (65%) rename lib/{phx_live_storybook => phoenix_storybook}/entries.ex (95%) rename lib/{phx_live_storybook => phoenix_storybook}/events/event_log.ex (89%) rename lib/{phx_live_storybook => phoenix_storybook}/events/instrumenter.ex (88%) rename lib/{phx_live_storybook => phoenix_storybook}/exs_compiler.ex (96%) rename lib/{phx_live_storybook => phoenix_storybook}/guides/guide_macros.ex (90%) rename lib/{phx_live_storybook => phoenix_storybook}/guides/guides.ex (84%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/asset_helpers.ex (92%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/extra_assigns_helpers.ex (96%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/navigation_helpers.ex (95%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/search_helpers.ex (99%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/template_helpers.ex (98%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/theme_helpers.ex (94%) rename lib/{phx_live_storybook => phoenix_storybook}/helpers/validation_helpers.ex (98%) rename lib/{phx_live_storybook => phoenix_storybook}/live/error_view.ex (85%) rename lib/{phx_live_storybook => phoenix_storybook}/live/search.ex (96%) rename lib/{phx_live_storybook => phoenix_storybook}/live/sidebar.ex (96%) rename lib/{phx_live_storybook => phoenix_storybook}/live/story/component_iframe_live.ex (91%) rename lib/{phx_live_storybook => phoenix_storybook}/live/story/playground.ex (98%) rename lib/{phx_live_storybook => phoenix_storybook}/live/story/playground_preview_live.ex (92%) rename lib/{phx_live_storybook => phoenix_storybook}/live/story_live.ex (96%) rename lib/{phx_live_storybook => phoenix_storybook}/live/visual_test_live.ex (93%) rename lib/{phx_live_storybook => phoenix_storybook}/mount.ex (91%) rename lib/{phx_live_storybook => phoenix_storybook}/rendering/code_renderer.ex (97%) rename lib/{phx_live_storybook => phoenix_storybook}/rendering/component_renderer.ex (97%) rename lib/{phx_live_storybook => phoenix_storybook}/rendering/rendering_context.ex (93%) rename lib/{phx_live_storybook => phoenix_storybook}/rendering/rendering_variation.ex (66%) rename lib/{phx_live_storybook => phoenix_storybook}/router.ex (84%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/attr.ex (98%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/doc.ex (98%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/index.ex (90%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/index_validator.ex (91%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/slot.ex (96%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/story.ex (92%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/story_source.ex (98%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/story_validator.ex (99%) rename lib/{phx_live_storybook => phoenix_storybook}/stories/variation.ex (94%) rename lib/{phx_live_storybook => phoenix_storybook}/templates/layout/_favicon.html.heex (100%) rename lib/{phx_live_storybook => phoenix_storybook}/templates/layout/live.html.heex (97%) rename lib/{phx_live_storybook => phoenix_storybook}/templates/layout/live_iframe.html.heex (100%) rename lib/{phx_live_storybook => phoenix_storybook}/templates/layout/root.html.heex (100%) rename lib/{phx_live_storybook => phoenix_storybook}/templates/layout/root_iframe.html.heex (100%) rename lib/{phx_live_storybook => phoenix_storybook}/views/layout_view.ex (93%) rename lib/{phx_live_storybook => phoenix_storybook}/web.ex (72%) delete mode 100644 lib/phx_live_storybook/application.ex rename test/{phx_live_storybook => phoenix_storybook}/components/icon_test.exs (97%) rename test/{phx_live_storybook => phoenix_storybook}/controllers/asset_not_found_controller_test.exs (59%) rename test/{phx_live_storybook => phoenix_storybook}/exs_compiler_test.exs (73%) rename test/{phx_live_storybook => phoenix_storybook}/guides/guides_test.exs (83%) rename test/{phx_live_storybook => phoenix_storybook}/helpers/asset_helpers_test.exs (94%) rename test/{phx_live_storybook => phoenix_storybook}/helpers/extra_assigns_helpers_test.exs (95%) rename test/{phx_live_storybook => phoenix_storybook}/helpers/search_helpers_test.exs (92%) rename test/{phx_live_storybook => phoenix_storybook}/helpers/template_helpers_test.exs (98%) rename test/{phx_live_storybook => phoenix_storybook}/live/component_iframe_live_test.exs (96%) rename test/{phx_live_storybook => phoenix_storybook}/live/playground_live_test.exs (99%) rename test/{phx_live_storybook => phoenix_storybook}/live/search_test.exs (85%) rename test/{phx_live_storybook => phoenix_storybook}/live/sidebar_test.exs (96%) rename test/{phx_live_storybook => phoenix_storybook}/live/story_live_test.exs (98%) rename test/{phx_live_storybook => phoenix_storybook}/live/visual_test_live_test.exs (87%) rename test/{phx_live_storybook => phoenix_storybook}/rendering/code_renderer_test.exs (98%) rename test/{phx_live_storybook => phoenix_storybook}/rendering/component_renderer_test.exs (96%) rename test/{phx_live_storybook => phoenix_storybook}/router_test.exs (92%) rename test/{phx_live_storybook => phoenix_storybook}/stories/doc_test.exs (85%) rename test/{phx_live_storybook => phoenix_storybook}/stories/index_validator_test.exs (95%) rename test/{phx_live_storybook => phoenix_storybook}/stories/story_source_test.exs (92%) rename test/{phx_live_storybook => phoenix_storybook}/stories/story_test.exs (93%) rename test/{phx_live_storybook => phoenix_storybook}/stories/story_validator_test.exs (99%) rename test/{phx_live_storybook_test.exs => phoenix_storybook_test.exs} (93%) diff --git a/.formatter.exs b/.formatter.exs index a90e56f3..249f7a2a 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -4,7 +4,7 @@ inputs: [ "*.{ex,exs}", "{config,lib,priv}/**/*.{ex,exs,eex}", - "test/phx_live_storybook/**/*.{ex,exs}", + "test/phoenix_storybook/**/*.{ex,exs}", "test/*.{ex,exs}" ] ] diff --git a/.gitignore b/.gitignore index f209b095..3828665e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ erl_crash.dump *.ez # Ignore package tarball (built via "mix hex.build"). -phx_live_storybook-*.tar +phoenix_storybook-*.tar /priv/static/**/*.gz /priv/static/**/*-????????????????????????????????.* diff --git a/CHANGELOG.md b/CHANGELOG.md index c681b735..44b3efab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,20 +2,21 @@ ## v0.5.0 (not yet released) -- **change (breaking!)**: [component description is no longer a function defined](https://github.com/phenixdigital/phx_live_storybook/issues/138) +- **change (breaking!)**: project has been renamed from `phx_live_storybook` to `phoenix_storybook`! +- **change (breaking!)**: [component description is no longer a function defined](https://github.com/phenixdigital/phoenix_storybook/issues/138) in your story file but is fetched from your component `@doc` or your live_component `@moduledoc` comments. -- **feature**: [support for Example stories](https://github.com/phenixdigital/phx_live_storybook/issues/213) -- **feature**: [visual regression endpoints](https://github.com/phenixdigital/phx_live_storybook/issues/215). +- **feature**: [support for Example stories](https://github.com/phenixdigital/phoenix_storybook/issues/213) +- **feature**: [visual regression endpoints](https://github.com/phenixdigital/phoenix_storybook/issues/215). This endpoint can output bare components without the storybook's UI so that you can automate visual tests screenshots. -- **improvement**: [mix phx.gen.storybook now prints formatter instructions](https://github.com/phenixdigital/phx_live_storybook/issues/153) -- **improvement**: [new theme strategies](https://github.com/phenixdigital/phx_live_storybook/issues/177). Theming guide has been updated. -- **improvement**: [boolean attributes are rendered with their shorthand notation](https://github.com/phenixdigital/phx_live_storybook/issues/169) -- **improvement**: [generating stories for Phoenix 1.7 core components](https://github.com/phenixdigital/phx_live_storybook/issues/187) -- **bugfix**: [a project without heroicons will no longer raise on the generated icon story](https://github.com/phenixdigital/phx_live_storybook/issues/152) -- **bugfix**: [fixed variation crash with a large binary in a map](https://github.com/phenixdigital/phx_live_storybook/pull/161) -- **bugfix**: [fixed slots crash if rendered more than once ](https://github.com/phenixdigital/phx_live_storybook/issues/206) +- **improvement**: [mix phx.gen.storybook now prints formatter instructions](https://github.com/phenixdigital/phoenix_storybook/issues/153) +- **improvement**: [new theme strategies](https://github.com/phenixdigital/phoenix_storybook/issues/177). Theming guide has been updated. +- **improvement**: [boolean attributes are rendered with their shorthand notation](https://github.com/phenixdigital/phoenix_storybook/issues/169) +- **improvement**: [generating stories for Phoenix 1.7 core components](https://github.com/phenixdigital/phoenix_storybook/issues/187) +- **bugfix**: [a project without heroicons will no longer raise on the generated icon story](https://github.com/phenixdigital/phoenix_storybook/issues/152) +- **bugfix**: [fixed variation crash with a large binary in a map](https://github.com/phenixdigital/phoenix_storybook/pull/161) +- **bugfix**: [fixed slots crash if rendered more than once ](https://github.com/phenixdigital/phoenix_storybook/issues/206) ## v0.4.5 (2022-10-10) @@ -24,16 +25,16 @@ ## v0.4.4 (2022-10-10) -- **feature**: [you can now customize your story div container](https://github.com/phenixdigital/phx_live_storybook/issues/135) -- **improvement**: [removed routes helpers](https://github.com/phenixdigital/phx_live_storybook/pull/137) +- **feature**: [you can now customize your story div container](https://github.com/phenixdigital/phoenix_storybook/issues/135) +- **improvement**: [removed routes helpers](https://github.com/phenixdigital/phoenix_storybook/pull/137) (will help transition to Phoenix 1.7) -- **improvement**: [pass connect params to story page](https://github.com/phenixdigital/phx_live_storybook/pull/130) -- **bugfix**: [add :live_session and :as options to router](https://github.com/phenixdigital/phx_live_storybook/pull/127) -- **bugfix**: [missing playground tab icons](https://github.com/phenixdigital/phx_live_storybook/issues/134) +- **improvement**: [pass connect params to story page](https://github.com/phenixdigital/phoenix_storybook/pull/130) +- **bugfix**: [add :live_session and :as options to router](https://github.com/phenixdigital/phoenix_storybook/pull/127) +- **bugfix**: [missing playground tab icons](https://github.com/phenixdigital/phoenix_storybook/issues/134) ## v0.4.3 (2022-10-04) -- **bugfix**: [mounting several storybooks in router is now possible](https://github.com/phenixdigital/phx_live_storybook/issues/126) +- **bugfix**: [mounting several storybooks in router is now possible](https://github.com/phenixdigital/phoenix_storybook/issues/126) - **bugfix**: fixed mobile layout ## v0.4.2 (2022-10-02) @@ -43,10 +44,10 @@ ## v0.4.1 (2022-09-30) -- **bugfix**: sidebar, tabs & theme icon [rendering issues have been fixed](https://github.com/phenixdigital/phx_live_storybook/issues/111). Icons are no longer rendered within the CSS sandbox and should be +- **bugfix**: sidebar, tabs & theme icon [rendering issues have been fixed](https://github.com/phenixdigital/phoenix_storybook/issues/111). Icons are no longer rendered within the CSS sandbox and should be styles with `lsb-*` classes. -- **bugfix**: [search panel no longer binds the `/` key](https://github.com/phenixdigital/phx_live_storybook/issues/110). -- **bugfix**: [component generated by the `mix phx.gen.storybook` is no longer crashing.](https://github.com/phenixdigital/phx_live_storybook/pull/116) +- **bugfix**: [search panel no longer binds the `/` key](https://github.com/phenixdigital/phoenix_storybook/issues/110). +- **bugfix**: [component generated by the `mix phx.gen.storybook` is no longer crashing.](https://github.com/phenixdigital/phoenix_storybook/pull/116) ## v0.4.0 (2022-09-29) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 405e04ff..9c6003cd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# PhxLiveStorybook contributing guide +# PhoenixStorybook contributing guide Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved! @@ -50,7 +50,7 @@ For modules, protocols and types say what it is. For example write something like: ```elixir -defmodule PhxLiveStorybook.Foo do +defmodule PhoenixStorybook.Foo do @moduledoc """ Conveniences for working on Foo. ... @@ -96,11 +96,11 @@ in order to craft an excellent pull request ```bash # Clone your fork of the repo into the current directory -git clone https://github.com//phx_live_storybook +git clone https://github.com//phoenix_storybook # Navigate to the newly cloned directory -cd phx_live_storybook +cd phoenix_storybook # Assign the original repo to a remote called "upstream" -git remote add upstream https://github.com/phenixdigital/phx_live_storybook +git remote add upstream https://github.com/phenixdigital/phoenix_storybook ``` 2. If you cloned a while ago, get the latest changes from upstream, and update your fork: @@ -111,14 +111,14 @@ git pull upstream main git push ``` -3. Clone phx_live_storybook_sample alongside this repository. +3. Clone phoenix_storybook_sample alongside this repository. ```bash cd .. -git clone git@github.com:phenixdigital/phx_live_storybook_sample.git +git clone git@github.com:phenixdigital/phoenix_storybook_sample.git ``` -And follow [phx_live_storybook_sample README.md](https://github.com/phenixdigital/phx_live_storybook_sample) instructions. +And follow [phoenix_storybook_sample README.md](https://github.com/phenixdigital/phoenix_storybook_sample) instructions. 4. Create a new feature branch (off of `main`) to contain your feature, change, or fix. diff --git a/README.md b/README.md index 09bd6631..80442435 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,32 @@ -# PhxLiveStorybook +# PhoenixStorybook -[![github](https://github.com/phenixdigital/phx_live_storybook/actions/workflows/elixir.yml/badge.svg)](https://github.com/phenixdigital/phx_live_storybook/actions/workflows/elixir.yml) -[![codecov](https://codecov.io/gh/phenixdigital/phx_live_storybook/branch/main/graph/badge.svg)](https://codecov.io/gh/phenixdigital/phx_live_storybook) -[![GitHub release](https://img.shields.io/github/v/release/phenixdigital/phx_live_storybook.svg)](https://github.com/phenixdigital/phx_live_storybook/releases/) +[![github](https://github.com/phenixdigital/phoenix_storybook/actions/workflows/elixir.yml/badge.svg)](https://github.com/phenixdigital/phoenix_storybook/actions/workflows/elixir.yml) +[![codecov](https://codecov.io/gh/phenixdigital/phoenix_storybook/branch/main/graph/badge.svg)](https://codecov.io/gh/phenixdigital/phoenix_storybook) +[![GitHub release](https://img.shields.io/github/v/release/phenixdigital/phoenix_storybook.svg)](https://github.com/phenixdigital/phoenix_storybook/releases/) -📚 [Documentation](https://hexdocs.pm/phx_live_storybook) +📚 [Documentation](https://hexdocs.pm/phoenix_storybook)   -   🔎 [Demo](http://phx-live-storybook-sample.fly.dev/storybook)   -   -🎓 [Sample repository](https://github.com/phenixdigital/phx_live_storybook_sample) +🎓 [Sample repository](https://github.com/phenixdigital/phoenix_storybook_sample)   -   🍿 [Getting started video](https://www.youtube.com/watch?v=MTE7dLhkQ8Q) -PhxLiveStorybook provides a [_storybook-like_](https://storybook.js.org) UI interface for your +PhoenixStorybook provides a [_storybook-like_](https://storybook.js.org) UI interface for your Phoenix LiveView components. - Explore all your components, and showcase them with different variations. - Browse your component's documentation, with their supported attributes. - Learn how components behave by using an interactive playground. -![screenshot](https://github.com/phenixdigital/phx_live_storybook/raw/main/screenshots/screenshot-01.jpg) -![screenshot](https://github.com/phenixdigital/phx_live_storybook/raw/main/screenshots/screenshot-02.jpg) +![screenshot](https://github.com/phenixdigital/phoenix_storybook/raw/main/screenshots/screenshot-01.jpg) +![screenshot](https://github.com/phenixdigital/phoenix_storybook/raw/main/screenshots/screenshot-02.jpg) ## How does it work? -PhxLiveStorybook is mounted in your application router and serves its UI at the mounting point of +PhoenixStorybook is mounted in your application router and serves its UI at the mounting point of your choice. It performs automatic discovery of your storybook content under a specified folder (`:content_path`) @@ -41,19 +41,19 @@ Three kinds of stories are supported: ## Installation -To start using `PhxLiveStorybook` in your phoenix application you will need to follow these steps: +To start using `PhoenixStorybook` in your phoenix application you will need to follow these steps: -1. Add the `phx_live_storybook` dependency +1. Add the `phoenix_storybook` dependency 2. Run the generator -### 1. Add the `phx_live_storybook` dependency +### 1. Add the `phoenix_storybook` dependency Add the following to your mix.exs and run mix deps.get: ```elixir def deps do [ - {:phx_live_storybook, "~> 0.4.0"} + {:phoenix_storybook, "~> 0.4.0"} ] end ``` @@ -78,14 +78,14 @@ Of all config settings, only the `:otp_app`, and `:content_path` keys are mandat ```elixir # lib/my_app_web/storybook.ex defmodule MyAppWeb.Storybook do - use PhxLiveStorybook, + use PhoenixStorybook, # OTP name of your application. otp_app: :my_app, # Path to your storybook stories (required). content_path: Path.expand("../storybook", __DIR__), - # Path to your JS asset, which will be loaded just before PhxLiveStorybook's own + # Path to your JS asset, which will be loaded just before PhoenixStorybook's own # JS. It's mainly intended to define your LiveView Hooks in `window.storybook.Hooks`. # Remote path (not local file-system path) which means this file should be served # by your own application endpoint. @@ -150,11 +150,11 @@ config :my_app, MyAppWeb.Storybook, We would love your PRs! -1. Pull down phx_live_storybook to a directory next to your project (`../phx_live_storybook`). +1. Pull down phoenix_storybook to a directory next to your project (`../phoenix_storybook`). 2. Change your mix file to point to this directory: ```elixir -{:phx_live_storybook, path: "../phx_live_storybook"}, +{:phoenix_storybook, path: "../phoenix_storybook"}, ``` 3. Run dev.storybook mix task from your project diff --git a/assets/package-lock.json b/assets/package-lock.json index 6806a3a4..2d6003f7 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -1,11 +1,11 @@ { - "name": "phx_live_storybook", + "name": "phoenix_storybook", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "phx_live_storybook", + "name": "phoenix_storybook", "version": "1.0.0", "license": "ISC", "devDependencies": { diff --git a/assets/package.json b/assets/package.json index 17f063c1..c1a9af85 100644 --- a/assets/package.json +++ b/assets/package.json @@ -1,8 +1,8 @@ { - "name": "phx_live_storybook", + "name": "phoenix_storybook", "version": "1.0.0", - "description": "PhxLiveStorybook assets", - "main": "./assets/js/phx_live_storybook.js", + "description": "PhoenixStorybook assets", + "main": "./assets/js/phoenix_storybook.js", "scripts": { "build:css": "tailwindcss --minify -i css/app.css -o ../priv/static/css/app.css", "build:fonts_css": "tailwindcss --minify -i css/fonts.css -o ../priv/static/css/fonts.css", diff --git a/config/config.exs b/config/config.exs index 6078a131..19684486 100644 --- a/config/config.exs +++ b/config/config.exs @@ -2,7 +2,7 @@ import Config config :phoenix, :json_library, Jason -config :phx_live_storybook, :env, config_env() -config :phx_live_storybook, :gzip_assets, false +config :phoenix_storybook, :env, config_env() +config :phoenix_storybook, :gzip_assets, false import_config "#{config_env()}.exs" diff --git a/config/prod.exs b/config/prod.exs index 5d0f769e..537952b3 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,2 +1,2 @@ import Config -config :phx_live_storybook, :gzip_assets, true +config :phoenix_storybook, :gzip_assets, true diff --git a/coveralls.json b/coveralls.json index ef384162..2e5484eb 100644 --- a/coveralls.json +++ b/coveralls.json @@ -3,5 +3,5 @@ "output_dir": "coverage/", "treat_no_relevant_lines_as_covered": true }, - "skip_files": ["test/fixtures", "lib/phx_live_storybook/web.ex"] + "skip_files": ["test/fixtures", "lib/phoenix_storybook/web.ex"] } diff --git a/guides/components.md b/guides/components.md index 08b19455..541a8a49 100644 --- a/guides/components.md +++ b/guides/components.md @@ -1,6 +1,6 @@ # Component stories -Basic component documentation is in `PhxLiveStorybook.Story`. +Basic component documentation is in `PhoenixStorybook.Story`. ## Documentation @@ -9,7 +9,7 @@ Component documentation is fetched from your component doc tags: - For a live_component, fetches `@moduledoc` content. - For a function component, fetches `@doc` content from the matching function. -If you are deploying `phx_live_storybook` in production with an Elixir release, make sure your +If you are deploying `phoenix_storybook` in production with an Elixir release, make sure your doc chunks are not [stripped out from the release.](https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-customization) ```elixir @@ -25,7 +25,7 @@ releases: [ ## Variation groups You may want to present different variations of a component in a single variation block. -It is possible using `PhxLiveStorybook.VariationGroup`. +It is possible using `PhoenixStorybook.VariationGroup`. ## Container @@ -35,7 +35,7 @@ You can pass additional HTML attributes or extend the class attribute. ```elixir # storybook/my_component.story.exs defmodule Storybook.MyComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def container, do: {:div, class: "block"} end ``` @@ -45,7 +45,7 @@ If you need further _sandboxing_ you can opt in for `iframe` rendering. ```elixir # storybook/my_component.story.exs defmodule Storybook.MyComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def container, do: :iframe end ``` @@ -62,7 +62,7 @@ Here is an example defining both: ```elixir defmodule NestedComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &NestedComponent.nested_component/1 def aliases, do: [MyStorybook.Helpers.JSHelpers] @@ -159,7 +159,7 @@ classes through [JS commands](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveV ```elixir defmodule Storybook.Components.Modal do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Components.Modal.modal/1 @@ -188,12 +188,12 @@ end Some components don't rely on JS commands but need external assigns, like a modal that takes a `show={true}` or `show={false}` assign to manage its visibility state. -`PhxLiveStorybook` handles special `assign` and `toggle` events that you +`PhoenixStorybook` handles special `assign` and `toggle` events that you can leverage on to update some properties that will be passed to your components as _extra assigns_. ```elixir defmodule Storybook.Components.Slideover do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Components.Slideover.slideover/1 def template do diff --git a/guides/icons.md b/guides/icons.md index d108da34..b5f06bc5 100644 --- a/guides/icons.md +++ b/guides/icons.md @@ -3,7 +3,7 @@ You can provide custom sidebar & header icons for your stories. Page stories can also provide iconized navigation tabs. -PhxLiveStorybook gives you the ability to render icons with 2 different providers: +PhoenixStorybook gives you the ability to render icons with 2 different providers: - [FontAwesome](https://fontawesome.com) which offers a decent set of free icons and a lot of additional styles with paid plans @@ -28,7 +28,7 @@ The two last tuple elements are optional. ## FontAwesome icons -PhxLiveStorybook is built with a very small subset of FontAwesome free icons. If you want to use +PhoenixStorybook is built with a very small subset of FontAwesome free icons. If you want to use other FontAwesome icons you need to provide a valid **FontAwesome kit id**. It can be either free or paid, so you also need to configure your FontAwesome plan. @@ -36,7 +36,7 @@ It can be either free or paid, so you also need to configure your FontAwesome pl ```elixir # lib/my_app_web/storybook.ex defmodule MyAppWeb.Storybook do - use PhxLiveStorybook, + use PhoenixStorybook, otp_app: :my_app, font_awesome_plan: :pro, # default value is :free font_awesome_kit_id: "foo8b41bar4625", @@ -45,7 +45,7 @@ end ## HeroIcons -PhxLiveStorybook delegates icon rendering to [heroicons_elixir](https://github.com/mveytsman/heroicons_elixir). +PhoenixStorybook delegates icon rendering to [heroicons_elixir](https://github.com/mveytsman/heroicons_elixir). Make sure to add their dependency in your `mix.exs` file. ```elixir diff --git a/guides/sandboxing.md b/guides/sandboxing.md index 10d17975..e5cf252a 100644 --- a/guides/sandboxing.md +++ b/guides/sandboxing.md @@ -1,6 +1,6 @@ # Sandboxing components -In `PhxLiveStorybook` your components live within the storybook, so they share some context with +In `PhoenixStorybook` your components live within the storybook, so they share some context with the storybook: **styling** and **scripts**. While the original Storybook for React only [relies on iframes](https://storybook.js.org/docs/react/configure/story-rendering), @@ -15,7 +15,7 @@ This guide will explain: ## 1. What JS context do your components share with the storybook? -`PhxLiveStorybook` runs with Phoenix LiveView and therefore requires its `LiveSocket`. This +`PhoenixStorybook` runs with Phoenix LiveView and therefore requires its `LiveSocket`. This LiveSocket is the same used by your components: you just need to inject it with your own `Hooks`, `Params` and `Uploaders`. @@ -46,7 +46,7 @@ There is currently no way to access them in component or live component stories. ## 2. How is the storybook styled? -`PhxLiveStorybook` is using [TailwindCSS](https://tailwindcss.com) with +`PhoenixStorybook` is using [TailwindCSS](https://tailwindcss.com) with [preflight](https://tailwindcss.com/docs/preflight) (which means all default HTML styles from your browser are removed) and a [custom prefix](https://tailwindcss.com/docs/configuration#prefix): `lsb-` (which means that instead of using `bg-blue-400` the storybook uses `lsb-bg-blue-400`). @@ -72,12 +72,12 @@ carry the `.lsb-sandbox` CSS class and a **custom sandboxing class of your choic You can leverage this to scope your styles with this class. Here is how you can do it with `TailwindCSS`: -- configure `phx_live_storybook` with a custom `sandbox_class`: +- configure `phoenix_storybook` with a custom `sandbox_class`: ```elixir # lib/my_app_web/storybook.ex defmodule MyAppWeb.Storybook do - use PhxLiveStorybook, + use PhoenixStorybook, ... sandbox_class: "my-app-sandbox", ``` @@ -136,7 +136,7 @@ Just add the `iframe` option to it. # storybook/components/button.exs defmodule MyAppWeb.Storybook.Components.Button do alias MyAppWeb.Components.Button - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Button.button/1 def container, do: :iframe diff --git a/guides/setup.md b/guides/setup.md index 31af136b..8afbb436 100644 --- a/guides/setup.md +++ b/guides/setup.md @@ -1,21 +1,21 @@ # Manual setup -To start using `PhxLiveStorybook` in your phoenix application you will need to follow these steps: +To start using `PhoenixStorybook` in your phoenix application you will need to follow these steps: -1. Add the `phx_live_storybook` dependency +1. Add the `phoenix_storybook` dependency 2. Create your storybook backend module 3. Add storybook access to your router 4. Make your components assets available 5. Create some content -## 1. Add the `phx_live_storybook` dependency +## 1. Add the `phoenix_storybook` dependency Add the following to your mix.exs and run mix deps.get: ```elixir def deps do [ - {:phx_live_storybook, "~> 0.4.0"} + {:phoenix_storybook, "~> 0.4.0"} ] end ``` @@ -27,7 +27,7 @@ Create a new module under your application lib folder: ```elixir # lib/my_app_web/storybook.ex defmodule MyAppWeb.Storybook do - use PhxLiveStorybook, + use PhoenixStorybook, otp_app: :my_app, content_path: Path.expand("../storybook", __DIR__), # assets path are remote path, not local file-system paths @@ -38,19 +38,19 @@ end ## 3. Add storybook access to your router -Once installed, update your router's configuration to forward requests to a `PhxLiveStorybook` +Once installed, update your router's configuration to forward requests to a `PhoenixStorybook` with a unique name of your choice: ```elixir # lib/my_app_web/router.ex use MyAppWeb, :router -import PhxLiveStorybook.Router +import PhoenixStorybook.Router ... scope "/" do storybook_assets() end -scope "/", PhxLiveStorybookSampleWeb do +scope "/", PhoenixStorybookSampleWeb do pipe_through(:browser) ... live_storybook "/storybook", backend_module: MyAppWeb.Storybook @@ -104,7 +104,7 @@ defmodule MyAppWeb.Storybook.Components.Button do alias MyAppWeb.Components.Button # :live_component or :page are also available - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Button.button/1 diff --git a/guides/theming.md b/guides/theming.md index 5c7b3cd5..9319b6df 100644 --- a/guides/theming.md +++ b/guides/theming.md @@ -14,7 +14,7 @@ The following strategies are available: Here is how you can use these strategies. In your `storybook.ex`: ```elixir -use PhxLiveStorybook, +use PhoenixStorybook, themes_strategies: [ sandbox_class: "prefix", # will set a class prefixed by `prefix-` on the sandbox container assign: :theme, diff --git a/lib/mix/tasks/dev.storybook.ex b/lib/mix/tasks/dev.storybook.ex index b3c08f30..72eb2e28 100644 --- a/lib/mix/tasks/dev.storybook.ex +++ b/lib/mix/tasks/dev.storybook.ex @@ -13,7 +13,7 @@ defmodule Mix.Tasks.Dev.Storybook do @doc false def run(_args) do Mix.shell().info("Setting up storybook for local development.") - storybook_app = :phx_live_storybook + storybook_app = :phoenix_storybook current_app = Mix.Project.config()[:app] if storybook_app == current_app do diff --git a/lib/mix/tasks/phx.gen.storybook.ex b/lib/mix/tasks/phx.gen.storybook.ex index fb9c1184..700b9f9f 100644 --- a/lib/mix/tasks/phx.gen.storybook.ex +++ b/lib/mix/tasks/phx.gen.storybook.ex @@ -65,7 +65,7 @@ defmodule Mix.Tasks.Phx.Gen.Storybook do [{"storybook.js", Path.join(js_folder, "storybook.js")}] for {source_file_path, target} <- mapping do - templates_folder = Application.app_dir(:phx_live_storybook, @templates_folder) + templates_folder = Application.app_dir(:phoenix_storybook, @templates_folder) source = Path.join(templates_folder, source_file_path) source_content = @@ -91,7 +91,7 @@ defmodule Mix.Tasks.Phx.Gen.Storybook do end defp maybe_core_components(core_components_module, folder) do - dir = Application.app_dir(:phx_live_storybook, @templates_folder) + dir = Application.app_dir(:phoenix_storybook, @templates_folder) stories = dir |> Path.join("/core_components/*.story.*") |> Path.wildcard() for story_path <- stories, @@ -163,7 +163,7 @@ defmodule Mix.Tasks.Phx.Gen.Storybook do Add the following to your #{IO.ANSI.bright()}router.ex#{IO.ANSI.reset()}: use #{web_module}, :router - import PhxLiveStorybook.Router + import PhoenixStorybook.Router scope "/" do storybook_assets() diff --git a/lib/phx_live_storybook.ex b/lib/phoenix_storybook.ex similarity index 90% rename from lib/phx_live_storybook.ex rename to lib/phoenix_storybook.ex index 2989ca74..a3dbeb40 100644 --- a/lib/phx_live_storybook.ex +++ b/lib/phoenix_storybook.ex @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.BackendBehaviour do +defmodule PhoenixStorybook.BackendBehaviour do @moduledoc """ Behaviour implemented by your backend module. """ - alias PhxLiveStorybook.{FolderEntry, StoryEntry} + alias PhoenixStorybook.{FolderEntry, StoryEntry} @doc """ Returns a configuration value from your config.exs storybook settings. @@ -39,16 +39,16 @@ defmodule PhxLiveStorybook.BackendBehaviour do @callback storybook_path(atom()) :: String.t() end -defmodule PhxLiveStorybook do +defmodule PhoenixStorybook do @external_resource "README.md" @moduledoc @external_resource |> File.read!() |> String.split("") |> Enum.fetch!(1) - alias PhxLiveStorybook.Entries - alias PhxLiveStorybook.ExsCompiler - alias PhxLiveStorybook.Stories.StoryValidator + alias PhoenixStorybook.Entries + alias PhoenixStorybook.ExsCompiler + alias PhoenixStorybook.Stories.StoryValidator require Logger @@ -74,9 +74,9 @@ defmodule PhxLiveStorybook do defp main_quote(opts) do quote do - @behaviour PhxLiveStorybook.BackendBehaviour + @behaviour PhoenixStorybook.BackendBehaviour - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def storybook_path(story_module) do if Code.ensure_loaded?(story_module) do content_path = Keyword.get(unquote(opts), :content_path) @@ -168,7 +168,7 @@ defmodule PhxLiveStorybook do find_entry_by_path_quotes = for entry <- entries do quote do - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def find_entry_by_path(unquote(entry.path)) do unquote(Macro.escape(entry)) end @@ -177,16 +177,16 @@ defmodule PhxLiveStorybook do single_quote = quote do - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def find_entry_by_path(_), do: nil - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def content_tree, do: unquote(Macro.escape(content_tree)) - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def leaves, do: unquote(Macro.escape(Entries.leaves(leaves))) - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def flat_list, do: unquote(Macro.escape(entries)) end @@ -216,7 +216,7 @@ defmodule PhxLiveStorybook do @doc false defp config_quotes(opts) do quote do - @impl PhxLiveStorybook.BackendBehaviour + @impl PhoenixStorybook.BackendBehaviour def config(key, default \\ nil) do Keyword.get(unquote(opts), key, default) end diff --git a/lib/phoenix_storybook/application.ex b/lib/phoenix_storybook/application.ex new file mode 100644 index 00000000..4b33908e --- /dev/null +++ b/lib/phoenix_storybook/application.ex @@ -0,0 +1,20 @@ +defmodule PhoenixStorybook.Application do + @moduledoc false + + use Application + alias PhoenixStorybook.Events.Instrumenter + + @impl true + def start(_type, _args) do + Instrumenter.setup() + + Supervisor.start_link( + [ + {Phoenix.PubSub, name: PhoenixStorybook.PubSub}, + {PhoenixStorybook.ExsCompiler, []} + ], + strategy: :one_for_one, + name: PhoenixStorybook.Supervisor + ) + end +end diff --git a/lib/phx_live_storybook/components/icon.ex b/lib/phoenix_storybook/components/icon.ex similarity index 94% rename from lib/phx_live_storybook/components/icon.ex rename to lib/phoenix_storybook/components/icon.ex index 0b9c7fe4..a88ad4ad 100644 --- a/lib/phx_live_storybook/components/icon.ex +++ b/lib/phoenix_storybook/components/icon.ex @@ -1,6 +1,6 @@ -defmodule PhxLiveStorybook.Components.Icon do +defmodule PhoenixStorybook.Components.Icon do @moduledoc false - use PhxLiveStorybook.Web, :component + use PhoenixStorybook.Web, :component @type icon_provider :: :fa | :hero @@ -10,7 +10,7 @@ defmodule PhxLiveStorybook.Components.Icon do | {icon_provider(), String.t(), atom, String.t()} @doc """ - FontAwesome icons for internal phx_live_storybook usage. + FontAwesome icons for internal phoenix_storybook usage. ## Examples @@ -44,7 +44,7 @@ defmodule PhxLiveStorybook.Components.Icon do end @doc """ - HeroIcons icons for internal phx_live_storybook usage. Requires :heroicons as a mix dependency. + HeroIcons icons for internal phoenix_storybook usage. Requires :heroicons as a mix dependency. ## Examples diff --git a/lib/phx_live_storybook/controllers/asset_not_found_controller.ex b/lib/phoenix_storybook/controllers/asset_not_found_controller.ex similarity index 65% rename from lib/phx_live_storybook/controllers/asset_not_found_controller.ex rename to lib/phoenix_storybook/controllers/asset_not_found_controller.ex index 041ef1e3..7fc93dc0 100644 --- a/lib/phx_live_storybook/controllers/asset_not_found_controller.ex +++ b/lib/phoenix_storybook/controllers/asset_not_found_controller.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.AssetNotFoundController do +defmodule PhoenixStorybook.AssetNotFoundController do @moduledoc false # Dummy controller that only exists because `Plug.Static` requires # that a route matches an actual path to be executed. @@ -6,14 +6,14 @@ defmodule PhxLiveStorybook.AssetNotFoundController do # Any valid asset request will halt before this controller is executed. # Only bad requests (404) will reach to here. - use PhxLiveStorybook.Web, :controller + use PhoenixStorybook.Web, :controller def asset(_conn, path) do - raise PhxLiveStorybook.AssetNotFound, "unknown asset #{inspect(path)}" + raise PhoenixStorybook.AssetNotFound, "unknown asset #{inspect(path)}" end end -defmodule PhxLiveStorybook.AssetNotFound do +defmodule PhoenixStorybook.AssetNotFound do @moduledoc false defexception [:message, plug_status: 404] end diff --git a/lib/phx_live_storybook/entries.ex b/lib/phoenix_storybook/entries.ex similarity index 95% rename from lib/phx_live_storybook/entries.ex rename to lib/phoenix_storybook/entries.ex index a9ed2b33..b6337b2e 100644 --- a/lib/phx_live_storybook/entries.ex +++ b/lib/phoenix_storybook/entries.ex @@ -1,24 +1,24 @@ -defmodule PhxLiveStorybook.StoryEntry do +defmodule PhoenixStorybook.StoryEntry do @moduledoc false defstruct [:path, :name, :icon] end -defmodule PhxLiveStorybook.IndexEntry do +defmodule PhoenixStorybook.IndexEntry do @moduledoc false defstruct [:path, :folder_name, :folder_icon, :folder_open?, :entry] end -defmodule PhxLiveStorybook.FolderEntry do +defmodule PhoenixStorybook.FolderEntry do @moduledoc false defstruct [:name, :entries, :path, :icon, open?: false] end # This module performs a recursive scan of all files/folders under :content_path # and creates an in-memory tree hierarchy of content using above Story structs. -defmodule PhxLiveStorybook.Entries do +defmodule PhoenixStorybook.Entries do @moduledoc false - alias PhxLiveStorybook.ExsCompiler - alias PhxLiveStorybook.{FolderEntry, IndexEntry, StoryEntry} + alias PhoenixStorybook.ExsCompiler + alias PhoenixStorybook.{FolderEntry, IndexEntry, StoryEntry} require Logger diff --git a/lib/phx_live_storybook/events/event_log.ex b/lib/phoenix_storybook/events/event_log.ex similarity index 89% rename from lib/phx_live_storybook/events/event_log.ex rename to lib/phoenix_storybook/events/event_log.ex index 49491598..cf1c8956 100644 --- a/lib/phx_live_storybook/events/event_log.ex +++ b/lib/phoenix_storybook/events/event_log.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Events.EventLog do +defmodule PhoenixStorybook.Events.EventLog do @moduledoc false # Data structure for event logs displayed in each story's playground diff --git a/lib/phx_live_storybook/events/instrumenter.ex b/lib/phoenix_storybook/events/instrumenter.ex similarity index 88% rename from lib/phx_live_storybook/events/instrumenter.ex rename to lib/phoenix_storybook/events/instrumenter.ex index 730f89ab..75e593b1 100644 --- a/lib/phx_live_storybook/events/instrumenter.ex +++ b/lib/phoenix_storybook/events/instrumenter.ex @@ -1,8 +1,8 @@ -defmodule PhxLiveStorybook.Events.Instrumenter do +defmodule PhoenixStorybook.Events.Instrumenter do @moduledoc false # Event handlers for LiveView exposed telemetry events alias Phoenix.PubSub - alias PhxLiveStorybook.Events.EventLog + alias PhoenixStorybook.Events.EventLog def setup do events = [ @@ -15,7 +15,7 @@ defmodule PhxLiveStorybook.Events.Instrumenter do def handle_event([:phoenix, :live_view, :handle_event, :stop], _measurements, metadata, _config) do PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, "event_logs:#{inspect(metadata.socket.root_pid)}", %{metadata_to_event_log(metadata) | type: :live_view} ) @@ -28,7 +28,7 @@ defmodule PhxLiveStorybook.Events.Instrumenter do _config ) do PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, "event_logs:#{inspect(metadata.socket.root_pid)}", %{metadata_to_event_log(metadata) | type: :component} ) diff --git a/lib/phx_live_storybook/exs_compiler.ex b/lib/phoenix_storybook/exs_compiler.ex similarity index 96% rename from lib/phx_live_storybook/exs_compiler.ex rename to lib/phoenix_storybook/exs_compiler.ex index d0a3672e..9a2f55a6 100644 --- a/lib/phx_live_storybook/exs_compiler.ex +++ b/lib/phoenix_storybook/exs_compiler.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.ExsCompiler do +defmodule PhoenixStorybook.ExsCompiler do @moduledoc false # This module is intended to compile exs files non concurrently. diff --git a/lib/phx_live_storybook/guides/guide_macros.ex b/lib/phoenix_storybook/guides/guide_macros.ex similarity index 90% rename from lib/phx_live_storybook/guides/guide_macros.ex rename to lib/phoenix_storybook/guides/guide_macros.ex index 8822291b..4b9c9706 100644 --- a/lib/phx_live_storybook/guides/guide_macros.ex +++ b/lib/phoenix_storybook/guides/guide_macros.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStoryBook.Guides.Macros do +defmodule PhoenixStorybook.Guides.Macros do @moduledoc false defmacro __using__(__opts \\ []) do diff --git a/lib/phx_live_storybook/guides/guides.ex b/lib/phoenix_storybook/guides/guides.ex similarity index 84% rename from lib/phx_live_storybook/guides/guides.ex rename to lib/phoenix_storybook/guides/guides.ex index d5de5d0e..1d31a602 100644 --- a/lib/phx_live_storybook/guides/guides.ex +++ b/lib/phoenix_storybook/guides/guides.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStoryBook.Guides do +defmodule PhoenixStorybook.Guides do @moduledoc """ This module is meant to be used from generated `welcome.story.exs` page. It renders HTML markup from markdown guides located in the guides/folder. @@ -15,5 +15,5 @@ defmodule PhxLiveStoryBook.Guides do ``` """ - use PhxLiveStoryBook.Guides.Macros + use PhoenixStorybook.Guides.Macros end diff --git a/lib/phx_live_storybook/helpers/asset_helpers.ex b/lib/phoenix_storybook/helpers/asset_helpers.ex similarity index 92% rename from lib/phx_live_storybook/helpers/asset_helpers.ex rename to lib/phoenix_storybook/helpers/asset_helpers.ex index d46a22c0..19b8e45c 100644 --- a/lib/phx_live_storybook/helpers/asset_helpers.ex +++ b/lib/phoenix_storybook/helpers/asset_helpers.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.AssetHelpers do +defmodule PhoenixStorybook.AssetHelpers do @moduledoc false def parse_manifest(manifest_path) do diff --git a/lib/phx_live_storybook/helpers/extra_assigns_helpers.ex b/lib/phoenix_storybook/helpers/extra_assigns_helpers.ex similarity index 96% rename from lib/phx_live_storybook/helpers/extra_assigns_helpers.ex rename to lib/phoenix_storybook/helpers/extra_assigns_helpers.ex index 11021f2e..a0e91156 100644 --- a/lib/phx_live_storybook/helpers/extra_assigns_helpers.ex +++ b/lib/phoenix_storybook/helpers/extra_assigns_helpers.ex @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.ExtraAssignsHelpers do +defmodule PhoenixStorybook.ExtraAssignsHelpers do @moduledoc false - alias PhxLiveStorybook.Stories.Attr - alias PhxLiveStorybook.Stories.{Variation, VariationGroup} - alias PhxLiveStorybook.ThemeHelpers + alias PhoenixStorybook.Stories.Attr + alias PhoenixStorybook.Stories.{Variation, VariationGroup} + alias PhoenixStorybook.ThemeHelpers def init_variation_extra_assigns(type, story) when type in [:component, :live_component] do extra_assigns = diff --git a/lib/phx_live_storybook/helpers/navigation_helpers.ex b/lib/phoenix_storybook/helpers/navigation_helpers.ex similarity index 95% rename from lib/phx_live_storybook/helpers/navigation_helpers.ex rename to lib/phoenix_storybook/helpers/navigation_helpers.ex index 1bac0fac..66e1e848 100644 --- a/lib/phx_live_storybook/helpers/navigation_helpers.ex +++ b/lib/phoenix_storybook/helpers/navigation_helpers.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.NavigationHelpers do +defmodule PhoenixStorybook.NavigationHelpers do @moduledoc false alias Phoenix.LiveView diff --git a/lib/phx_live_storybook/helpers/search_helpers.ex b/lib/phoenix_storybook/helpers/search_helpers.ex similarity index 99% rename from lib/phx_live_storybook/helpers/search_helpers.ex rename to lib/phoenix_storybook/helpers/search_helpers.ex index 0112ebf1..31a3bf33 100644 --- a/lib/phx_live_storybook/helpers/search_helpers.ex +++ b/lib/phoenix_storybook/helpers/search_helpers.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.SearchHelpers do +defmodule PhoenixStorybook.SearchHelpers do @moduledoc false # Credits to https://github.com/tajmone/fuzzy-search/tree/master/fts_fuzzy_match/0.2.0/elixir diff --git a/lib/phx_live_storybook/helpers/template_helpers.ex b/lib/phoenix_storybook/helpers/template_helpers.ex similarity index 98% rename from lib/phx_live_storybook/helpers/template_helpers.ex rename to lib/phoenix_storybook/helpers/template_helpers.ex index dd8bc768..6f4a8082 100644 --- a/lib/phx_live_storybook/helpers/template_helpers.ex +++ b/lib/phoenix_storybook/helpers/template_helpers.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.TemplateHelpers do +defmodule PhoenixStorybook.TemplateHelpers do @moduledoc false @variation_regex ~r{(<\.lsb-variation\/>)|(<\.lsb-variation\s[^(\>)]*\/>)} diff --git a/lib/phx_live_storybook/helpers/theme_helpers.ex b/lib/phoenix_storybook/helpers/theme_helpers.ex similarity index 94% rename from lib/phx_live_storybook/helpers/theme_helpers.ex rename to lib/phoenix_storybook/helpers/theme_helpers.ex index d8751456..467154d7 100644 --- a/lib/phx_live_storybook/helpers/theme_helpers.ex +++ b/lib/phoenix_storybook/helpers/theme_helpers.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.ThemeHelpers do +defmodule PhoenixStorybook.ThemeHelpers do @moduledoc false def theme_sandbox_class(backend_module, theme) do diff --git a/lib/phx_live_storybook/helpers/validation_helpers.ex b/lib/phoenix_storybook/helpers/validation_helpers.ex similarity index 98% rename from lib/phx_live_storybook/helpers/validation_helpers.ex rename to lib/phoenix_storybook/helpers/validation_helpers.ex index 3d18971d..7a9a4747 100644 --- a/lib/phx_live_storybook/helpers/validation_helpers.ex +++ b/lib/phoenix_storybook/helpers/validation_helpers.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.ValidationHelpers do +defmodule PhoenixStorybook.ValidationHelpers do @moduledoc false def validate_type!(file, term, types, message) when is_list(types) do diff --git a/lib/phx_live_storybook/live/error_view.ex b/lib/phoenix_storybook/live/error_view.ex similarity index 85% rename from lib/phx_live_storybook/live/error_view.ex rename to lib/phoenix_storybook/live/error_view.ex index f7d78d43..6fc58aab 100644 --- a/lib/phx_live_storybook/live/error_view.ex +++ b/lib/phoenix_storybook/live/error_view.ex @@ -1,5 +1,5 @@ -defmodule PhxLiveStorybook.ErrorView do - use PhxLiveStorybook.Web, :view +defmodule PhoenixStorybook.ErrorView do + use PhoenixStorybook.Web, :view # If you want to customize a particular status code # for a certain format, you may uncomment below. diff --git a/lib/phx_live_storybook/live/search.ex b/lib/phoenix_storybook/live/search.ex similarity index 96% rename from lib/phx_live_storybook/live/search.ex rename to lib/phoenix_storybook/live/search.ex index 0dcff733..ba84343e 100644 --- a/lib/phx_live_storybook/live/search.ex +++ b/lib/phoenix_storybook/live/search.ex @@ -1,10 +1,10 @@ -defmodule PhxLiveStorybook.Search do +defmodule PhoenixStorybook.Search do @moduledoc false - use PhxLiveStorybook.Web, :live_component + use PhoenixStorybook.Web, :live_component alias Phoenix.LiveView.JS - alias PhxLiveStorybook.LayoutView - alias PhxLiveStorybook.SearchHelpers + alias PhoenixStorybook.LayoutView + alias PhoenixStorybook.SearchHelpers def mount(socket) do {:ok, socket} diff --git a/lib/phx_live_storybook/live/sidebar.ex b/lib/phoenix_storybook/live/sidebar.ex similarity index 96% rename from lib/phx_live_storybook/live/sidebar.ex rename to lib/phoenix_storybook/live/sidebar.ex index ff8a1ff3..18146b99 100644 --- a/lib/phx_live_storybook/live/sidebar.ex +++ b/lib/phoenix_storybook/live/sidebar.ex @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.Sidebar do +defmodule PhoenixStorybook.Sidebar do @moduledoc false - use PhxLiveStorybook.Web, :live_component + use PhoenixStorybook.Web, :live_component alias Phoenix.LiveView.JS - alias PhxLiveStorybook.{FolderEntry, StoryEntry} + alias PhoenixStorybook.{FolderEntry, StoryEntry} def mount(socket) do {:ok, assign(socket, :opened_folders, MapSet.new())} @@ -101,9 +101,9 @@ defmodule PhxLiveStorybook.Sidebar do
- <%= link to: "https://github.com/phenixdigital/phx_live_storybook", target: "_blank", class: "lsb" do %> + <%= link to: "https://github.com/phenixdigital/phoenix_storybook", target: "_blank", class: "lsb" do %> <.fa_icon style={:brands} name="github" plan={:pro} /> - - <%= Application.spec(:phx_live_storybook, :vsn) %> + - <%= Application.spec(:phoenix_storybook, :vsn) %> <% end %>
<.hidden_icons fa_plan={@fa_plan} content_flat_list={@content_flat_list} /> diff --git a/lib/phx_live_storybook/live/story/component_iframe_live.ex b/lib/phoenix_storybook/live/story/component_iframe_live.ex similarity index 91% rename from lib/phx_live_storybook/live/story/component_iframe_live.ex rename to lib/phoenix_storybook/live/story/component_iframe_live.ex index f97264af..4a401518 100644 --- a/lib/phx_live_storybook/live/story/component_iframe_live.ex +++ b/lib/phoenix_storybook/live/story/component_iframe_live.ex @@ -1,17 +1,17 @@ -defmodule PhxLiveStorybook.Story.ComponentIframeLive do +defmodule PhoenixStorybook.Story.ComponentIframeLive do @moduledoc false use Phoenix.LiveView alias Phoenix.PubSub - alias PhxLiveStorybook.ExtraAssignsHelpers - alias PhxLiveStorybook.Rendering.{ComponentRenderer, RenderingContext} - alias PhxLiveStorybook.Story.PlaygroundPreviewLive - alias PhxLiveStorybook.Stories.{Variation, VariationGroup} - alias PhxLiveStorybook.StoryNotFound - alias PhxLiveStorybook.ThemeHelpers + alias PhoenixStorybook.ExtraAssignsHelpers + alias PhoenixStorybook.Rendering.{ComponentRenderer, RenderingContext} + alias PhoenixStorybook.Story.PlaygroundPreviewLive + alias PhoenixStorybook.Stories.{Variation, VariationGroup} + alias PhoenixStorybook.StoryNotFound + alias PhoenixStorybook.ThemeHelpers def mount(_params, _session, socket) do - {:ok, assign(socket, []), layout: {PhxLiveStorybook.LayoutView, :live_iframe}} + {:ok, assign(socket, []), layout: {PhoenixStorybook.LayoutView, :live_iframe}} end def handle_params(params = %{"story" => story_path}, _uri, socket) do @@ -19,7 +19,7 @@ defmodule PhxLiveStorybook.Story.ComponentIframeLive do {:ok, story} -> if params["topic"] do PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, params["topic"], {:component_iframe_pid, self()} ) diff --git a/lib/phx_live_storybook/live/story/playground.ex b/lib/phoenix_storybook/live/story/playground.ex similarity index 98% rename from lib/phx_live_storybook/live/story/playground.ex rename to lib/phoenix_storybook/live/story/playground.ex index 384e9213..3eda1fdc 100644 --- a/lib/phx_live_storybook/live/story/playground.ex +++ b/lib/phoenix_storybook/live/story/playground.ex @@ -1,14 +1,14 @@ -defmodule PhxLiveStorybook.Story.Playground do +defmodule PhoenixStorybook.Story.Playground do @moduledoc false - use PhxLiveStorybook.Web, :live_component + use PhoenixStorybook.Web, :live_component alias Phoenix.{LiveView.JS, PubSub} - alias PhxLiveStorybook.Rendering.{CodeRenderer, RenderingContext} - alias PhxLiveStorybook.Story.PlaygroundPreviewLive - alias PhxLiveStorybook.TemplateHelpers - alias PhxLiveStorybook.Stories.{Attr, Slot, Variation, VariationGroup} + alias PhoenixStorybook.Rendering.{CodeRenderer, RenderingContext} + alias PhoenixStorybook.Story.PlaygroundPreviewLive + alias PhoenixStorybook.TemplateHelpers + alias PhoenixStorybook.Stories.{Attr, Slot, Variation, VariationGroup} - import PhxLiveStorybook.NavigationHelpers + import PhoenixStorybook.NavigationHelpers def mount(socket) do {:ok, assign(socket, event_logs: [], event_logs_unread: 0)} @@ -890,14 +890,14 @@ defmodule PhxLiveStorybook.Story.Playground do Enum.reject(attributes, fn {_attr_id, value} -> value == :locked end) |> Map.new() PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, topic, {:new_attributes_input, attributes} ) end defp send_new_variation(topic, variation) do - PubSub.broadcast!(PhxLiveStorybook.PubSub, topic, {:set_variation, variation}) + PubSub.broadcast!(PhoenixStorybook.PubSub, topic, {:set_variation, variation}) end defp cast_value(story, attr_id, value) do diff --git a/lib/phx_live_storybook/live/story/playground_preview_live.ex b/lib/phoenix_storybook/live/story/playground_preview_live.ex similarity index 92% rename from lib/phx_live_storybook/live/story/playground_preview_live.ex rename to lib/phoenix_storybook/live/story/playground_preview_live.ex index 39fa4c35..abfe1b68 100644 --- a/lib/phx_live_storybook/live/story/playground_preview_live.ex +++ b/lib/phoenix_storybook/live/story/playground_preview_live.ex @@ -1,21 +1,21 @@ -defmodule PhxLiveStorybook.Story.PlaygroundPreviewLive do +defmodule PhoenixStorybook.Story.PlaygroundPreviewLive do @moduledoc false - use PhxLiveStorybook.Web, :live_view + use PhoenixStorybook.Web, :live_view alias Phoenix.PubSub - alias PhxLiveStorybook.ExtraAssignsHelpers - alias PhxLiveStorybook.LayoutView - alias PhxLiveStorybook.Rendering.{ComponentRenderer, RenderingContext} - alias PhxLiveStorybook.Stories.{Variation, VariationGroup} + alias PhoenixStorybook.ExtraAssignsHelpers + alias PhoenixStorybook.LayoutView + alias PhoenixStorybook.Rendering.{ComponentRenderer, RenderingContext} + alias PhoenixStorybook.Stories.{Variation, VariationGroup} def mount(_params, session, socket) do story = session["story"] if connected?(socket) && session["topic"] do - PubSub.subscribe(PhxLiveStorybook.PubSub, session["topic"]) + PubSub.subscribe(PhoenixStorybook.PubSub, session["topic"]) PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, session["topic"], {:playground_preview_pid, self()} ) @@ -104,7 +104,7 @@ defmodule PhxLiveStorybook.Story.PlaygroundPreviewLive do # know their current value. def lsb_inspect(playground_topic, variation_id, key, val) do PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, playground_topic, {:new_template_attributes, %{variation_id => %{key => val}}} ) @@ -187,7 +187,7 @@ defmodule PhxLiveStorybook.Story.PlaygroundPreviewLive do defp send_variations_attributes(topic, variation_attributes) do PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, topic, {:new_variations_attributes, variation_attributes} ) diff --git a/lib/phx_live_storybook/live/story_live.ex b/lib/phoenix_storybook/live/story_live.ex similarity index 96% rename from lib/phx_live_storybook/live/story_live.ex rename to lib/phoenix_storybook/live/story_live.ex index 39486ede..3b3ea851 100644 --- a/lib/phx_live_storybook/live/story_live.ex +++ b/lib/phoenix_storybook/live/story_live.ex @@ -1,18 +1,18 @@ -defmodule PhxLiveStorybook.StoryLive do - use PhxLiveStorybook.Web, :live_view +defmodule PhoenixStorybook.StoryLive do + use PhoenixStorybook.Web, :live_view alias Phoenix.HTML.Safe alias Phoenix.{LiveView.JS, PubSub} - alias PhxLiveStorybook.Events.EventLog - alias PhxLiveStorybook.ExtraAssignsHelpers - alias PhxLiveStorybook.LayoutView - alias PhxLiveStorybook.Rendering.{CodeRenderer, ComponentRenderer, RenderingContext} - alias PhxLiveStorybook.Story.{Playground, PlaygroundPreviewLive} - alias PhxLiveStorybook.{StoryNotFound, StoryTabNotFound} - alias PhxLiveStorybook.ThemeHelpers + alias PhoenixStorybook.Events.EventLog + alias PhoenixStorybook.ExtraAssignsHelpers + alias PhoenixStorybook.LayoutView + alias PhoenixStorybook.Rendering.{CodeRenderer, ComponentRenderer, RenderingContext} + alias PhoenixStorybook.Story.{Playground, PlaygroundPreviewLive} + alias PhoenixStorybook.{StoryNotFound, StoryTabNotFound} + alias PhoenixStorybook.ThemeHelpers - import PhxLiveStorybook.NavigationHelpers + import PhoenixStorybook.NavigationHelpers def mount(_params, _session, socket) do connect_params = get_connect_params(socket)["extra"] @@ -20,8 +20,8 @@ defmodule PhxLiveStorybook.StoryLive do event_logs_topic = "event_logs:#{inspect(self())}" if connected?(socket) do - PubSub.subscribe(PhxLiveStorybook.PubSub, playground_topic) - PubSub.subscribe(PhxLiveStorybook.PubSub, event_logs_topic) + PubSub.subscribe(PhoenixStorybook.PubSub, playground_topic) + PubSub.subscribe(PhoenixStorybook.PubSub, event_logs_topic) end backend_module = socket.assigns.backend_module @@ -520,7 +520,7 @@ defmodule PhxLiveStorybook.StoryLive do defp remove_example_code(code) do code # removing specifc storybook use - |> String.replace(~r|use\s+PhxLiveStorybook\.Story\s*,\s*:example|, "use Phoenix.LiveView") + |> String.replace(~r|use\s+PhoenixStorybook\.Story\s*,\s*:example|, "use Phoenix.LiveView") # removing multiline doc and extra_sources definition |> String.replace(~r/def\s+(doc|extra_sources)\s*,\s*do:((?!end).)*end\s*/s, "") # removing inline doc and extra_sources definition @@ -548,7 +548,7 @@ defmodule PhxLiveStorybook.StoryLive do def handle_event("set-theme", %{"theme" => theme}, socket) do PubSub.broadcast!( - PhxLiveStorybook.PubSub, + PhoenixStorybook.PubSub, socket.assigns.playground_topic, {:set_theme, String.to_atom(theme)} ) @@ -612,7 +612,7 @@ defmodule PhxLiveStorybook.StoryLive do end def handle_info({:component_iframe_pid, pid}, socket) do - PubSub.subscribe(PhxLiveStorybook.PubSub, "event_logs:#{inspect(pid)}") + PubSub.subscribe(PhoenixStorybook.PubSub, "event_logs:#{inspect(pid)}") {:noreply, socket} end @@ -643,12 +643,12 @@ defmodule PhxLiveStorybook.StoryLive do def handle_info(_, socket), do: {:noreply, socket} end -defmodule PhxLiveStorybook.StoryNotFound do +defmodule PhoenixStorybook.StoryNotFound do @moduledoc false defexception [:message, plug_status: 404] end -defmodule PhxLiveStorybook.StoryTabNotFound do +defmodule PhoenixStorybook.StoryTabNotFound do @moduledoc false defexception [:message, plug_status: 404] end diff --git a/lib/phx_live_storybook/live/visual_test_live.ex b/lib/phoenix_storybook/live/visual_test_live.ex similarity index 93% rename from lib/phx_live_storybook/live/visual_test_live.ex rename to lib/phoenix_storybook/live/visual_test_live.ex index ad21fb69..21ef807a 100644 --- a/lib/phx_live_storybook/live/visual_test_live.ex +++ b/lib/phoenix_storybook/live/visual_test_live.ex @@ -1,15 +1,15 @@ -defmodule PhxLiveStorybook.VisualTestLive do +defmodule PhoenixStorybook.VisualTestLive do @moduledoc false - use PhxLiveStorybook.Web, :live_view + use PhoenixStorybook.Web, :live_view - alias PhxLiveStorybook.ExtraAssignsHelpers - alias PhxLiveStorybook.LayoutView - alias PhxLiveStorybook.Rendering.{ComponentRenderer, RenderingContext} - alias PhxLiveStorybook.StoryEntry - alias PhxLiveStorybook.StoryNotFound - alias PhxLiveStorybook.ThemeHelpers + alias PhoenixStorybook.ExtraAssignsHelpers + alias PhoenixStorybook.LayoutView + alias PhoenixStorybook.Rendering.{ComponentRenderer, RenderingContext} + alias PhoenixStorybook.StoryEntry + alias PhoenixStorybook.StoryNotFound + alias PhoenixStorybook.ThemeHelpers - import PhxLiveStorybook.NavigationHelpers + import PhoenixStorybook.NavigationHelpers def mount(params, _session, socket) do backend_module = socket.assigns.backend_module @@ -18,7 +18,7 @@ defmodule PhxLiveStorybook.VisualTestLive do assign(socket, theme: current_theme(params, socket), fa_plan: backend_module.config(:font_awesome_plan, :free) - ), layout: {PhxLiveStorybook.LayoutView, :live_iframe}} + ), layout: {PhoenixStorybook.LayoutView, :live_iframe}} end def handle_params( diff --git a/lib/phx_live_storybook/mount.ex b/lib/phoenix_storybook/mount.ex similarity index 91% rename from lib/phx_live_storybook/mount.ex rename to lib/phoenix_storybook/mount.ex index 6ac96db4..dfe3c7a6 100644 --- a/lib/phx_live_storybook/mount.ex +++ b/lib/phoenix_storybook/mount.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Mount do +defmodule PhoenixStorybook.Mount do @moduledoc false import Phoenix.Component, only: [assign: 2] diff --git a/lib/phx_live_storybook/rendering/code_renderer.ex b/lib/phoenix_storybook/rendering/code_renderer.ex similarity index 97% rename from lib/phx_live_storybook/rendering/code_renderer.ex rename to lib/phoenix_storybook/rendering/code_renderer.ex index 7ee5e556..12389382 100644 --- a/lib/phx_live_storybook/rendering/code_renderer.ex +++ b/lib/phoenix_storybook/rendering/code_renderer.ex @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.Rendering.CodeRenderer do +defmodule PhoenixStorybook.Rendering.CodeRenderer do @moduledoc """ Responsible for rendering your components code snippet, for a given - `PhxLiveStorybook.Variation`. + `PhoenixStorybook.Variation`. Uses the `Makeup` libray for syntax highlighting. """ @@ -11,9 +11,9 @@ defmodule PhxLiveStorybook.Rendering.CodeRenderer do alias Makeup.Formatters.HTML.HTMLFormatter alias Makeup.Lexers.{ElixirLexer, HEExLexer} alias Phoenix.HTML - alias PhxLiveStorybook.Rendering.{RenderingContext, RenderingVariation} - alias PhxLiveStorybook.Stories.Attr - alias PhxLiveStorybook.TemplateHelpers + alias PhoenixStorybook.Rendering.{RenderingContext, RenderingVariation} + alias PhoenixStorybook.Stories.Attr + alias PhoenixStorybook.TemplateHelpers @doc """ Renders a component code snippet from a `RenderingContext`. diff --git a/lib/phx_live_storybook/rendering/component_renderer.ex b/lib/phoenix_storybook/rendering/component_renderer.ex similarity index 97% rename from lib/phx_live_storybook/rendering/component_renderer.ex rename to lib/phoenix_storybook/rendering/component_renderer.ex index 2c773b02..89fafa6b 100644 --- a/lib/phx_live_storybook/rendering/component_renderer.ex +++ b/lib/phoenix_storybook/rendering/component_renderer.ex @@ -1,12 +1,12 @@ -defmodule PhxLiveStorybook.Rendering.ComponentRenderer do +defmodule PhoenixStorybook.Rendering.ComponentRenderer do @moduledoc """ Responsible for rendering your function & live components. """ alias Phoenix.LiveView.Engine, as: LiveViewEngine alias Phoenix.LiveView.HTMLEngine - alias PhxLiveStorybook.Rendering.{RenderingContext, RenderingVariation} - alias PhxLiveStorybook.TemplateHelpers + alias PhoenixStorybook.Rendering.{RenderingContext, RenderingVariation} + alias PhoenixStorybook.TemplateHelpers @doc """ Renders a component from a `RenderingContext`. diff --git a/lib/phx_live_storybook/rendering/rendering_context.ex b/lib/phoenix_storybook/rendering/rendering_context.ex similarity index 93% rename from lib/phx_live_storybook/rendering/rendering_context.ex rename to lib/phoenix_storybook/rendering/rendering_context.ex index b842594c..d50db2f8 100644 --- a/lib/phx_live_storybook/rendering/rendering_context.ex +++ b/lib/phoenix_storybook/rendering/rendering_context.ex @@ -1,12 +1,12 @@ -defmodule PhxLiveStorybook.Rendering.RenderingContext do +defmodule PhoenixStorybook.Rendering.RenderingContext do @moduledoc """ A struct holding all data needed by `ComponentRenderer` and `CodeRenderer` to render story variations. """ - alias PhxLiveStorybook.Rendering.{RenderingContext, RenderingVariation} - alias PhxLiveStorybook.Stories.{Variation, VariationGroup} - alias PhxLiveStorybook.TemplateHelpers + alias PhoenixStorybook.Rendering.{RenderingContext, RenderingVariation} + alias PhoenixStorybook.Stories.{Variation, VariationGroup} + alias PhoenixStorybook.TemplateHelpers @enforce_keys [:group_id, :dom_id, :type, :story] defstruct [ diff --git a/lib/phx_live_storybook/rendering/rendering_variation.ex b/lib/phoenix_storybook/rendering/rendering_variation.ex similarity index 66% rename from lib/phx_live_storybook/rendering/rendering_variation.ex rename to lib/phoenix_storybook/rendering/rendering_variation.ex index 85fc0eac..8e0a1817 100644 --- a/lib/phx_live_storybook/rendering/rendering_variation.ex +++ b/lib/phoenix_storybook/rendering/rendering_variation.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Rendering.RenderingVariation do +defmodule PhoenixStorybook.Rendering.RenderingVariation do @moduledoc false @enforce_keys [:id, :dom_id] diff --git a/lib/phx_live_storybook/router.ex b/lib/phoenix_storybook/router.ex similarity index 84% rename from lib/phx_live_storybook/router.ex rename to lib/phoenix_storybook/router.ex index 352c46be..1df16f6e 100644 --- a/lib/phx_live_storybook/router.ex +++ b/lib/phoenix_storybook/router.ex @@ -1,10 +1,10 @@ -defmodule PhxLiveStorybook.Router do +defmodule PhoenixStorybook.Router do @moduledoc """ Provides LiveView routing for storybook. """ @doc """ - Defines a PhxLiveStorybook route. + Defines a PhoenixStorybook route. It expects the `path` the storybook will be mounted at and a set of options. @@ -38,7 +38,7 @@ defmodule PhxLiveStorybook.Router do ```elixir # lib/my_app_web/router.ex use MyAppWeb, :router - import PhxLiveStorybook.Router + import PhoenixStorybook.Router ... scope "/" do @@ -76,26 +76,26 @@ defmodule PhxLiveStorybook.Router do pipe_through(:storybook_browser) {session_name, session_opts, route_opts} = - PhxLiveStorybook.Router.__options__(opts, path, session_name_iframe_opt, :root_iframe) + PhoenixStorybook.Router.__options__(opts, path, session_name_iframe_opt, :root_iframe) live_session session_name, session_opts do - live("/visual_tests", PhxLiveStorybook.VisualTestLive, :range, route_opts) - live("/visual_tests/*story", PhxLiveStorybook.VisualTestLive, :show, route_opts) + live("/visual_tests", PhoenixStorybook.VisualTestLive, :range, route_opts) + live("/visual_tests/*story", PhoenixStorybook.VisualTestLive, :show, route_opts) live( "/iframe/*story", - PhxLiveStorybook.Story.ComponentIframeLive, + PhoenixStorybook.Story.ComponentIframeLive, :story_iframe, route_opts ) end {session_name, session_opts, route_opts} = - PhxLiveStorybook.Router.__options__(opts, path, session_name_opt, :root) + PhoenixStorybook.Router.__options__(opts, path, session_name_opt, :root) live_session session_name, session_opts do - live("/", PhxLiveStorybook.StoryLive, :root, route_opts) - live("/*story", PhxLiveStorybook.StoryLive, :story, route_opts) + live("/", PhoenixStorybook.StoryLive, :root, route_opts) + live("/*story", PhoenixStorybook.StoryLive, :story, route_opts) end end end @@ -117,8 +117,8 @@ defmodule PhxLiveStorybook.Router do { session_name, [ - root_layout: {PhxLiveStorybook.LayoutView, root_layout}, - on_mount: PhxLiveStorybook.Mount, + root_layout: {PhoenixStorybook.LayoutView, root_layout}, + on_mount: PhoenixStorybook.Mount, session: %{ "backend_module" => backend_module, "assets_path" => assets_path, @@ -137,10 +137,10 @@ defmodule PhxLiveStorybook.Router do } end - @gzip_assets Application.compile_env(:phx_live_storybook, :gzip_assets, false) + @gzip_assets Application.compile_env(:phoenix_storybook, :gzip_assets, false) @doc """ - Defines routes for PhxLiveStorybook static assets. + Defines routes for PhoenixStorybook static assets. Static assets should not be CSRF protected. So they need to be mounted in your router in a different pipeline than storybook's. @@ -153,7 +153,7 @@ defmodule PhxLiveStorybook.Router do ```elixir # lib/my_app_web/router.ex use MyAppWeb, :router - import PhxLiveStorybook.Router + import PhoenixStorybook.Router ... scope "/" do @@ -165,11 +165,11 @@ defmodule PhxLiveStorybook.Router do gzip_assets? = @gzip_assets quote bind_quoted: binding() do - scope "/", PhxLiveStorybook do + scope "/", PhoenixStorybook do pipeline :storybook_assets do plug(Plug.Static, at: path, - from: :phx_live_storybook, + from: :phoenix_storybook, only: ~w(css js images fonts favicon), gzip: gzip_assets? ) diff --git a/lib/phx_live_storybook/stories/attr.ex b/lib/phoenix_storybook/stories/attr.ex similarity index 98% rename from lib/phx_live_storybook/stories/attr.ex rename to lib/phoenix_storybook/stories/attr.ex index bab7aba6..ec0333e6 100644 --- a/lib/phx_live_storybook/stories/attr.ex +++ b/lib/phoenix_storybook/stories/attr.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Stories.Attr do +defmodule PhoenixStorybook.Stories.Attr do @moduledoc """ An attr is one of your component attributes. Its structure mimics the LiveView 0.18.0 declarative assigns. @@ -7,7 +7,7 @@ defmodule PhxLiveStorybook.Stories.Attr do components. """ - alias PhxLiveStorybook.Stories.Attr + alias PhoenixStorybook.Stories.Attr require Logger diff --git a/lib/phx_live_storybook/stories/doc.ex b/lib/phoenix_storybook/stories/doc.ex similarity index 98% rename from lib/phx_live_storybook/stories/doc.ex rename to lib/phoenix_storybook/stories/doc.ex index 9d113d3c..fb4d1ecb 100644 --- a/lib/phx_live_storybook/stories/doc.ex +++ b/lib/phoenix_storybook/stories/doc.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Stories.Doc do +defmodule PhoenixStorybook.Stories.Doc do @moduledoc """ Functions to fetch component documentation and render it at HTML. """ diff --git a/lib/phx_live_storybook/stories/index.ex b/lib/phoenix_storybook/stories/index.ex similarity index 90% rename from lib/phx_live_storybook/stories/index.ex rename to lib/phoenix_storybook/stories/index.ex index 329a99d7..895fb299 100644 --- a/lib/phx_live_storybook/stories/index.ex +++ b/lib/phoenix_storybook/stories/index.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Index do +defmodule PhoenixStorybook.Index do @moduledoc """ An index is an optional file you can create in every folder of your storybook content tree to improve rendering of the storybook sidebar. @@ -16,7 +16,7 @@ defmodule PhxLiveStorybook.Index do ```elixir # storybook/_components.index.exs defmodule MyAppWeb.Storybook.Components do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_name, do: "My Components" def folder_icon, do: {:fa, "icon"} @@ -30,7 +30,7 @@ defmodule PhxLiveStorybook.Index do defmodule IndexBehaviour do @moduledoc false - alias PhxLiveStorybook.Components.Icon + alias PhoenixStorybook.Components.Icon @callback folder_name() :: nil | String.t() @callback folder_icon() :: nil | Icon.t() @@ -45,7 +45,7 @@ defmodule PhxLiveStorybook.Index do quote do @behaviour IndexBehaviour - @on_definition {PhxLiveStorybook.Stories.IndexValidator, :on_definition} + @on_definition {PhoenixStorybook.Stories.IndexValidator, :on_definition} @impl IndexBehaviour def folder_name, do: nil diff --git a/lib/phx_live_storybook/stories/index_validator.ex b/lib/phoenix_storybook/stories/index_validator.ex similarity index 91% rename from lib/phx_live_storybook/stories/index_validator.ex rename to lib/phoenix_storybook/stories/index_validator.ex index b67943cf..525d81e2 100644 --- a/lib/phx_live_storybook/stories/index_validator.ex +++ b/lib/phoenix_storybook/stories/index_validator.ex @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.Stories.IndexValidator do +defmodule PhoenixStorybook.Stories.IndexValidator do @moduledoc false - import PhxLiveStorybook.ValidationHelpers + import PhoenixStorybook.ValidationHelpers def on_definition(env, :def, :folder_name, [], _guards, body) do {[do: term], _} = Code.eval_quoted(body, [], env) diff --git a/lib/phx_live_storybook/stories/slot.ex b/lib/phoenix_storybook/stories/slot.ex similarity index 96% rename from lib/phx_live_storybook/stories/slot.ex rename to lib/phoenix_storybook/stories/slot.ex index 010909b3..f67d9b26 100644 --- a/lib/phx_live_storybook/stories/slot.ex +++ b/lib/phoenix_storybook/stories/slot.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Stories.Slot do +defmodule PhoenixStorybook.Stories.Slot do @moduledoc """ A slot is one of your component slots. Its structure mimics the LiveView 0.18.0 declarative assigns. @@ -13,7 +13,7 @@ defmodule PhxLiveStorybook.Stories.Slot do - `required`: `true` if the attribute is mandatory. """ - alias PhxLiveStorybook.Stories.Slot + alias PhoenixStorybook.Stories.Slot require Logger @type t :: %__MODULE__{ diff --git a/lib/phx_live_storybook/stories/story.ex b/lib/phoenix_storybook/stories/story.ex similarity index 92% rename from lib/phx_live_storybook/stories/story.ex rename to lib/phoenix_storybook/stories/story.ex index 34b3cdd4..9dd920e8 100644 --- a/lib/phx_live_storybook/stories/story.ex +++ b/lib/phoenix_storybook/stories/story.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Story do +defmodule PhoenixStorybook.Story do @moduledoc """ A story designates any kind of content in your storybook. For now only following kinds of stories are supported `:component`, `:live_component`, and `:page`. @@ -16,13 +16,13 @@ defmodule PhxLiveStorybook.Story do Implement your component as such. Confer to: - - `PhxLiveStorybook.Variation` documentation for variations. - - `PhxLiveStorybook.Attr` documentation for attributes. + - `PhoenixStorybook.Variation` documentation for variations. + - `PhoenixStorybook.Attr` documentation for attributes. ```elixir # storybook/my_component.exs defmodule MyAppWeb.Storybook.MyComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component # required def function, do: &MyAppWeb.MyComponent.my_component/1 @@ -41,7 +41,7 @@ defmodule PhxLiveStorybook.Story do ```elixir # storybook/my_live_component.exs defmodule MyAppWeb.Storybook.MyLiveComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component # required def component, do: MyAppWeb.MyLiveComponent @@ -65,7 +65,7 @@ defmodule PhxLiveStorybook.Story do ```elixir # storybook/my_page.exs defmodule MyAppWeb.Storybook.MyPage do - use PhxLiveStorybook.Story, :page + use PhoenixStorybook.Story, :page def doc, do: "My page description" @@ -97,7 +97,7 @@ defmodule PhxLiveStorybook.Story do ```elixir # storybook/my_example.exs defmodule MyAppWeb.Storybook.MyPage do - use PhxLiveStorybook.Story, :example + use PhoenixStorybook.Story, :example def doc, do: "My page description" @@ -117,9 +117,9 @@ defmodule PhxLiveStorybook.Story do ``` """ - alias PhxLiveStorybook.Components.Icon - alias PhxLiveStorybook.Stories.{Attr, Slot, Variation, VariationGroup} - alias PhxLiveStorybook.Stories.StorySource + alias PhoenixStorybook.Components.Icon + alias PhoenixStorybook.Stories.{Attr, Slot, Variation, VariationGroup} + alias PhoenixStorybook.Stories.StorySource defmodule StoryBehaviour do @moduledoc false @@ -181,7 +181,7 @@ defmodule PhxLiveStorybook.Story do import Phoenix.Component alias Phoenix.LiveView.JS - alias PhxLiveStorybook.Stories.{Attr, Doc, Slot, Variation, VariationGroup} + alias PhoenixStorybook.Stories.{Attr, Doc, Slot, Variation, VariationGroup} @impl StoryBehaviour def storybook_type, do: unquote(storybook_type(live?)) @@ -210,7 +210,7 @@ defmodule PhxLiveStorybook.Story do def variations, do: [] @impl unquote(component_behaviour(live?)) - def template, do: PhxLiveStorybook.TemplateHelpers.default_template() + def template, do: PhoenixStorybook.TemplateHelpers.default_template() if unquote(live?) do def merged_attributes, do: Attr.merge_attributes(component(), attributes()) diff --git a/lib/phx_live_storybook/stories/story_source.ex b/lib/phoenix_storybook/stories/story_source.ex similarity index 98% rename from lib/phx_live_storybook/stories/story_source.ex rename to lib/phoenix_storybook/stories/story_source.ex index e2b63782..c1a28ea3 100644 --- a/lib/phx_live_storybook/stories/story_source.ex +++ b/lib/phoenix_storybook/stories/story_source.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Stories.StorySource do +defmodule PhoenixStorybook.Stories.StorySource do @moduledoc false require Logger diff --git a/lib/phx_live_storybook/stories/story_validator.ex b/lib/phoenix_storybook/stories/story_validator.ex similarity index 99% rename from lib/phx_live_storybook/stories/story_validator.ex rename to lib/phoenix_storybook/stories/story_validator.ex index 37efd8fa..7b2110e8 100644 --- a/lib/phx_live_storybook/stories/story_validator.ex +++ b/lib/phoenix_storybook/stories/story_validator.ex @@ -1,8 +1,8 @@ -defmodule PhxLiveStorybook.Stories.StoryValidator do +defmodule PhoenixStorybook.Stories.StoryValidator do @moduledoc false - alias PhxLiveStorybook.Stories.{Attr, Slot, Variation, VariationGroup} - import PhxLiveStorybook.ValidationHelpers + alias PhoenixStorybook.Stories.{Attr, Slot, Variation, VariationGroup} + import PhoenixStorybook.ValidationHelpers require Logger @dialyzer {:no_return, bad_type!: 3} diff --git a/lib/phx_live_storybook/stories/variation.ex b/lib/phoenix_storybook/stories/variation.ex similarity index 94% rename from lib/phx_live_storybook/stories/variation.ex rename to lib/phoenix_storybook/stories/variation.ex index 87c560fd..508e8c0a 100644 --- a/lib/phx_live_storybook/stories/variation.ex +++ b/lib/phoenix_storybook/stories/variation.ex @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Stories.Variation do +defmodule PhoenixStorybook.Stories.Variation do @moduledoc """ A variation captures the rendered state of a UI component. Developers write multiple variations per component that describe all the “interesting” states a component can support. @@ -46,7 +46,7 @@ defmodule PhxLiveStorybook.Stories.Variation do defstruct [:id, :description, :let, slots: [], attributes: %{}, template: :unset] end -defmodule PhxLiveStorybook.Stories.VariationGroup do +defmodule PhoenixStorybook.Stories.VariationGroup do @moduledoc """ A variation group is a set of similar variations that will be rendered together in a single preview
 block.
@@ -78,7 +78,7 @@ defmodule PhxLiveStorybook.Stories.VariationGroup do
   ```
   """
 
-  alias PhxLiveStorybook.Stories.Variation
+  alias PhoenixStorybook.Stories.Variation
 
   @type t :: %__MODULE__{
           id: atom,
diff --git a/lib/phx_live_storybook/templates/layout/_favicon.html.heex b/lib/phoenix_storybook/templates/layout/_favicon.html.heex
similarity index 100%
rename from lib/phx_live_storybook/templates/layout/_favicon.html.heex
rename to lib/phoenix_storybook/templates/layout/_favicon.html.heex
diff --git a/lib/phx_live_storybook/templates/layout/live.html.heex b/lib/phoenix_storybook/templates/layout/live.html.heex
similarity index 97%
rename from lib/phx_live_storybook/templates/layout/live.html.heex
rename to lib/phoenix_storybook/templates/layout/live.html.heex
index cebc4de4..2140e114 100644
--- a/lib/phx_live_storybook/templates/layout/live.html.heex
+++ b/lib/phoenix_storybook/templates/layout/live.html.heex
@@ -63,7 +63,7 @@
     
 
 
 <.live_component 
-  id="search" module={PhxLiveStorybook.Search}
+  id="search" module={PhoenixStorybook.Search}
   backend_module={@backend_module}
   root_path={@root_path}
 />
diff --git a/lib/phx_live_storybook/templates/layout/live_iframe.html.heex b/lib/phoenix_storybook/templates/layout/live_iframe.html.heex
similarity index 100%
rename from lib/phx_live_storybook/templates/layout/live_iframe.html.heex
rename to lib/phoenix_storybook/templates/layout/live_iframe.html.heex
diff --git a/lib/phx_live_storybook/templates/layout/root.html.heex b/lib/phoenix_storybook/templates/layout/root.html.heex
similarity index 100%
rename from lib/phx_live_storybook/templates/layout/root.html.heex
rename to lib/phoenix_storybook/templates/layout/root.html.heex
diff --git a/lib/phx_live_storybook/templates/layout/root_iframe.html.heex b/lib/phoenix_storybook/templates/layout/root_iframe.html.heex
similarity index 100%
rename from lib/phx_live_storybook/templates/layout/root_iframe.html.heex
rename to lib/phoenix_storybook/templates/layout/root_iframe.html.heex
diff --git a/lib/phx_live_storybook/views/layout_view.ex b/lib/phoenix_storybook/views/layout_view.ex
similarity index 93%
rename from lib/phx_live_storybook/views/layout_view.ex
rename to lib/phoenix_storybook/views/layout_view.ex
index 8414766c..53b52580 100644
--- a/lib/phx_live_storybook/views/layout_view.ex
+++ b/lib/phoenix_storybook/views/layout_view.ex
@@ -1,12 +1,12 @@
-defmodule PhxLiveStorybook.LayoutView do
+defmodule PhoenixStorybook.LayoutView do
   @moduledoc false
-  use PhxLiveStorybook.Web, :view
+  use PhoenixStorybook.Web, :view
 
   alias Makeup.Styles.HTML.StyleMap
   alias Phoenix.LiveView.JS
-  alias PhxLiveStorybook.AssetHelpers
-  alias PhxLiveStorybook.{FolderEntry, StoryEntry}
-  alias PhxLiveStorybook.ThemeHelpers
+  alias PhoenixStorybook.AssetHelpers
+  alias PhoenixStorybook.{FolderEntry, StoryEntry}
+  alias PhoenixStorybook.ThemeHelpers
 
   def render_breadcrumb(socket, story_path, opts \\ []) do
     assigns = %{
@@ -82,10 +82,10 @@ defmodule PhxLiveStorybook.LayoutView do
     Path.join(assets_path, asset_file_name(path))
   end
 
-  @manifest_path Path.expand("static/cache_manifest.json", :code.priv_dir(:phx_live_storybook))
+  @manifest_path Path.expand("static/cache_manifest.json", :code.priv_dir(:phoenix_storybook))
   @external_resource @manifest_path
 
-  if Application.compile_env(:phx_live_storybook, :env) == :prod do
+  if Application.compile_env(:phoenix_storybook, :env) == :prod do
     @manifest AssetHelpers.parse_manifest(@manifest_path)
 
     defp asset_file_name(asset) do
diff --git a/lib/phx_live_storybook/web.ex b/lib/phoenix_storybook/web.ex
similarity index 72%
rename from lib/phx_live_storybook/web.ex
rename to lib/phoenix_storybook/web.ex
index 8da59bc5..0f06e4d5 100644
--- a/lib/phx_live_storybook/web.ex
+++ b/lib/phoenix_storybook/web.ex
@@ -1,4 +1,4 @@
-defmodule PhxLiveStorybook.Web do
+defmodule PhoenixStorybook.Web do
   @moduledoc false
 
   @doc false
@@ -6,7 +6,7 @@ defmodule PhxLiveStorybook.Web do
     quote do
       @moduledoc false
 
-      use Phoenix.Controller, namespace: PhxLiveStorybook
+      use Phoenix.Controller, namespace: PhoenixStorybook
       import Plug.Conn
       unquote(view_helpers())
     end
@@ -18,10 +18,10 @@ defmodule PhxLiveStorybook.Web do
       @moduledoc false
 
       use Phoenix.View,
-        namespace: PhxLiveStorybook,
-        root: "lib/phx_live_storybook/templates"
+        namespace: PhoenixStorybook,
+        root: "lib/phoenix_storybook/templates"
 
-      import PhxLiveStorybook.Components.Icon
+      import PhoenixStorybook.Components.Icon
 
       unquote(view_helpers())
     end
@@ -32,9 +32,9 @@ defmodule PhxLiveStorybook.Web do
     quote do
       @moduledoc false
       use Phoenix.LiveView,
-        layout: {PhxLiveStorybook.LayoutView, :live}
+        layout: {PhoenixStorybook.LayoutView, :live}
 
-      import PhxLiveStorybook.Components.Icon
+      import PhoenixStorybook.Components.Icon
 
       unquote(view_helpers())
     end
@@ -54,7 +54,7 @@ defmodule PhxLiveStorybook.Web do
     quote do
       @moduledoc false
       use Phoenix.LiveComponent
-      import PhxLiveStorybook.Components.Icon
+      import PhoenixStorybook.Components.Icon
       unquote(view_helpers())
     end
   end
@@ -67,7 +67,7 @@ defmodule PhxLiveStorybook.Web do
       # Import convenience functions for LiveView rendering
       import Phoenix.Component
 
-      alias PhxLiveStorybook.Router.Helpers, as: Routes
+      alias PhoenixStorybook.Router.Helpers, as: Routes
     end
   end
 
diff --git a/lib/phx_live_storybook/application.ex b/lib/phx_live_storybook/application.ex
deleted file mode 100644
index 19a1e2d7..00000000
--- a/lib/phx_live_storybook/application.ex
+++ /dev/null
@@ -1,20 +0,0 @@
-defmodule PhxLiveStorybook.Application do
-  @moduledoc false
-
-  use Application
-  alias PhxLiveStorybook.Events.Instrumenter
-
-  @impl true
-  def start(_type, _args) do
-    Instrumenter.setup()
-
-    Supervisor.start_link(
-      [
-        {Phoenix.PubSub, name: PhxLiveStorybook.PubSub},
-        {PhxLiveStorybook.ExsCompiler, []}
-      ],
-      strategy: :one_for_one,
-      name: PhxLiveStorybook.Supervisor
-    )
-  end
-end
diff --git a/mix.exs b/mix.exs
index b0ba567b..8355ab39 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,19 +1,19 @@
-defmodule PhxLiveStorybook.MixProject do
+defmodule PhoenixStorybook.MixProject do
   use Mix.Project
 
   @version "0.5.0"
 
   def project do
     [
-      app: :phx_live_storybook,
+      app: :phoenix_storybook,
       version: @version,
       elixir: "~> 1.13",
       start_permanent: Mix.env() == :prod,
       config_path: "./config/config.exs",
       elixirc_paths: elixirc_paths(Mix.env()),
-      name: "phx_live_storybook",
+      name: "phoenix_storybook",
       description: "A pluggable storybook for your LiveView components.",
-      source_url: "https://github.com/phenixdigital/phx_live_storybook",
+      source_url: "https://github.com/phenixdigital/phoenix_storybook",
       aliases: aliases(),
       deps: deps(),
       package: package(),
@@ -34,7 +34,7 @@ defmodule PhxLiveStorybook.MixProject do
   # Run "mix help compile.app" to learn about applications.
   def application do
     [
-      mod: {PhxLiveStorybook.Application, []},
+      mod: {PhoenixStorybook.Application, []},
       extra_applications: [:logger]
     ]
   end
@@ -63,12 +63,12 @@ defmodule PhxLiveStorybook.MixProject do
 
   defp docs do
     [
-      main: "PhxLiveStorybook",
+      main: "PhoenixStorybook",
       source_ref: "v#{@version}",
-      source_url: "https://github.com/phenixdigital/phx_live_storybook",
+      source_url: "https://github.com/phenixdigital/phoenix_storybook",
       extra_section: "GUIDES",
       extras: extras(),
-      nest_modules_by_prefix: [PhxLiveStorybook]
+      nest_modules_by_prefix: [PhoenixStorybook]
     ]
   end
 
@@ -87,7 +87,7 @@ defmodule PhxLiveStorybook.MixProject do
       maintainers: ["Christian Blavier"],
       files: ~w(mix.exs priv lib guides README.md LICENSE.md CHANGELOG.md CONTRIBUTING.md),
       licenses: ["MIT"],
-      links: %{"GitHub" => "https://github.com/phenixdigital/phx_live_storybook"}
+      links: %{"GitHub" => "https://github.com/phenixdigital/phoenix_storybook"}
     ]
   end
 
diff --git a/priv/templates/phx.gen.storybook/_root.index.exs b/priv/templates/phx.gen.storybook/_root.index.exs
index cbee1901..156152a8 100644
--- a/priv/templates/phx.gen.storybook/_root.index.exs
+++ b/priv/templates/phx.gen.storybook/_root.index.exs
@@ -1,8 +1,8 @@
 defmodule Storybook.Root do
-  # See https://hexdocs.pm/phx_live_storybook/PhxLiveStorybook.Index.html for full index
+  # See https://hexdocs.pm/phoenix_storybook/PhoenixStorybook.Index.html for full index
   # documentation.
 
-  use PhxLiveStorybook.Index
+  use PhoenixStorybook.Index
 
   def folder_icon, do: {:fa, "book-open", :light, "lsb-mr-1"}
   def folder_name, do: "Storybook"
diff --git a/priv/templates/phx.gen.storybook/core_components/button.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/button.story.exs.eex
index 862b0a2d..f1c16280 100644
--- a/priv/templates/phx.gen.storybook/core_components/button.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/button.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.Button do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
 
   def function, do: &<%= schema.core_components_module %>.button/1
 
diff --git a/priv/templates/phx.gen.storybook/core_components/flash.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/flash.story.exs.eex
index 7327fbaf..8d2de7a8 100644
--- a/priv/templates/phx.gen.storybook/core_components/flash.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/flash.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.Flash do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
   alias <%= schema.core_components_module %>
 
   def function, do: &CoreComponents.flash/1
diff --git a/priv/templates/phx.gen.storybook/core_components/header.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/header.story.exs.eex
index 0d5b03d7..e3c05b53 100644
--- a/priv/templates/phx.gen.storybook/core_components/header.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/header.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.Header do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
   alias <%= schema.core_components_module %>
 
   def function, do: &CoreComponents.header/1
diff --git a/priv/templates/phx.gen.storybook/core_components/input.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/input.story.exs.eex
index 76aaece6..dbc659b5 100644
--- a/priv/templates/phx.gen.storybook/core_components/input.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/input.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.Input do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
   alias <%= schema.core_components_module %>
 
   def function, do: &CoreComponents.input/1
diff --git a/priv/templates/phx.gen.storybook/core_components/list.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/list.story.exs.eex
index e9f68e2c..0409f662 100644
--- a/priv/templates/phx.gen.storybook/core_components/list.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/list.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.List do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
 
   def function, do: &<%= schema.core_components_module %>.list/1
 
diff --git a/priv/templates/phx.gen.storybook/core_components/modal.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/modal.story.exs.eex
index 68606497..4e102454 100644
--- a/priv/templates/phx.gen.storybook/core_components/modal.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/modal.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.Modal do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
   alias <%= schema.core_components_module %>
 
   def function, do: &CoreComponents.modal/1
diff --git a/priv/templates/phx.gen.storybook/core_components/table.story.exs.eex b/priv/templates/phx.gen.storybook/core_components/table.story.exs.eex
index 8a25dcd0..25a83867 100644
--- a/priv/templates/phx.gen.storybook/core_components/table.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/core_components/table.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.CoreComponents.Table do
-  use PhxLiveStorybook.Story, :component
+  use PhoenixStorybook.Story, :component
   alias <%= schema.core_components_module %>
 
   def function, do: &CoreComponents.table/1
diff --git a/priv/templates/phx.gen.storybook/examples/core_components.story.exs.eex b/priv/templates/phx.gen.storybook/examples/core_components.story.exs.eex
index e448a99a..de08db80 100644
--- a/priv/templates/phx.gen.storybook/examples/core_components.story.exs.eex
+++ b/priv/templates/phx.gen.storybook/examples/core_components.story.exs.eex
@@ -1,5 +1,5 @@
 defmodule Storybook.Examples.CoreComponents do
-  use PhxLiveStorybook.Story, :example
+  use PhoenixStorybook.Story, :example
   import <%= schema.core_components_module %>
 
   alias Phoenix.LiveView.JS
diff --git a/priv/templates/phx.gen.storybook/storybook.css.eex b/priv/templates/phx.gen.storybook/storybook.css.eex
index 12079b9c..9b9bdee1 100644
--- a/priv/templates/phx.gen.storybook/storybook.css.eex
+++ b/priv/templates/phx.gen.storybook/storybook.css.eex
@@ -1,7 +1,7 @@
 /* 
  * This is your custom storybook stylesheet.
  * Put your component styling under .<%= inspect schema.sandbox_class %> scope. 
- * See the https://hexdocs.pm/phx_live_storybook/sandboxing.html guide for more info.
+ * See the https://hexdocs.pm/phoenix_storybook/sandboxing.html guide for more info.
  */
 
 .lsb-sandbox, .<%= schema.sandbox_class %> {
diff --git a/priv/templates/phx.gen.storybook/storybook.ex.eex b/priv/templates/phx.gen.storybook/storybook.ex.eex
index 3c1766f8..74c82185 100644
--- a/priv/templates/phx.gen.storybook/storybook.ex.eex
+++ b/priv/templates/phx.gen.storybook/storybook.ex.eex
@@ -1,5 +1,5 @@
 defmodule <%= inspect schema.module %>.Storybook do
-  use PhxLiveStorybook,
+  use PhoenixStorybook,
     otp_app: <%= inspect schema.app %>,
     content_path: Path.expand("../../storybook", __DIR__),
     # assets path are remote path, not local file-system paths
diff --git a/priv/templates/phx.gen.storybook/storybook.tailwind.css b/priv/templates/phx.gen.storybook/storybook.tailwind.css
index 67df8b59..5bb65fa4 100644
--- a/priv/templates/phx.gen.storybook/storybook.tailwind.css
+++ b/priv/templates/phx.gen.storybook/storybook.tailwind.css
@@ -5,7 +5,7 @@
 
 /*
  * Put your component styling within the Tailwind utilities layer. 
- * See the https://hexdocs.pm/phx_live_storybook/sandboxing.html guide for more info.
+ * See the https://hexdocs.pm/phoenix_storybook/sandboxing.html guide for more info.
  */
 @layer utilities {
   * {
diff --git a/priv/templates/phx.gen.storybook/welcome.story.exs b/priv/templates/phx.gen.storybook/welcome.story.exs
index fba71266..6bc9a387 100644
--- a/priv/templates/phx.gen.storybook/welcome.story.exs
+++ b/priv/templates/phx.gen.storybook/welcome.story.exs
@@ -1,7 +1,7 @@
 defmodule Storybook.MyPage do
-  # See https://hexdocs.pm/phx_live_storybook/PhxLiveStorybook.Story.html for full story
+  # See https://hexdocs.pm/phoenix_storybook/PhoenixStorybook.Story.html for full story
   # documentation.
-  use PhxLiveStorybook.Story, :page
+  use PhoenixStorybook.Story, :page
 
   def doc, do: "Your very first steps into using Phoenix Storybook"
 
@@ -48,14 +48,14 @@ defmodule Storybook.MyPage do
     assigns =
       assign(assigns,
         guide: guide,
-        guide_content: PhxLiveStoryBook.Guides.markup("#{guide}.md")
+        guide_content: PhoenixStorybook.Guides.markup("#{guide}.md")
       )
 
     ~H"""
     

This and other guides are also available on HexDocs. @@ -95,6 +95,6 @@ defmodule Storybook.MyPage do end defp doc_link(page) do - "https://hexdocs.pm/phx_live_storybook/PhxLiveStorybook.#{page}.html" + "https://hexdocs.pm/phoenix_storybook/PhoenixStorybook.#{page}.html" end end diff --git a/test/fixtures/exs/bad_script.exs b/test/fixtures/exs/bad_script.exs index afbb15a8..fc6ffa0f 100644 --- a/test/fixtures/exs/bad_script.exs +++ b/test/fixtures/exs/bad_script.exs @@ -1 +1 @@ -defmodule PhxLiveStorybook.BadScript do +defmodule PhoenixStorybook.BadScript do diff --git a/test/fixtures/exs/script.exs b/test/fixtures/exs/script.exs index 98649fe2..d07fb10c 100644 --- a/test/fixtures/exs/script.exs +++ b/test/fixtures/exs/script.exs @@ -1,2 +1,2 @@ -defmodule PhxLiveStorybook.Script do +defmodule PhoenixStorybook.Script do end diff --git a/test/fixtures/indexes/bad_entry.index.exs b/test/fixtures/indexes/bad_entry.index.exs index f2d1fb9b..9cfe8ef0 100644 --- a/test/fixtures/indexes/bad_entry.index.exs +++ b/test/fixtures/indexes/bad_entry.index.exs @@ -1,5 +1,5 @@ defmodule Storybook.BadEntry do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_icon, do: {:fa, "book-open"} def folder_name, do: "Storybook" diff --git a/test/fixtures/indexes/bad_entry_icon_provider.index.exs b/test/fixtures/indexes/bad_entry_icon_provider.index.exs index 141fb71f..1d735111 100644 --- a/test/fixtures/indexes/bad_entry_icon_provider.index.exs +++ b/test/fixtures/indexes/bad_entry_icon_provider.index.exs @@ -1,5 +1,5 @@ defmodule Storybook.BadEntryIconProvider do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_icon, do: {:fa, "book-open"} def folder_name, do: "Storybook" diff --git a/test/fixtures/indexes/bad_folder_icon.index.exs b/test/fixtures/indexes/bad_folder_icon.index.exs index 26b5ac99..c3ee9100 100644 --- a/test/fixtures/indexes/bad_folder_icon.index.exs +++ b/test/fixtures/indexes/bad_folder_icon.index.exs @@ -1,5 +1,5 @@ defmodule Storybook.BadFolderIcon do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_icon, do: :icon def folder_name, do: "Storybook" diff --git a/test/fixtures/indexes/bad_folder_name.index.exs b/test/fixtures/indexes/bad_folder_name.index.exs index 81d5ae34..1af05b1c 100644 --- a/test/fixtures/indexes/bad_folder_name.index.exs +++ b/test/fixtures/indexes/bad_folder_name.index.exs @@ -1,5 +1,5 @@ defmodule Storybook.BadFolderName do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_icon, do: {:fa, "book-open", :light} def folder_name, do: :storybook diff --git a/test/fixtures/indexes/empty.index.exs b/test/fixtures/indexes/empty.index.exs index 77474ba8..9e2a0a4c 100644 --- a/test/fixtures/indexes/empty.index.exs +++ b/test/fixtures/indexes/empty.index.exs @@ -1,3 +1,3 @@ defmodule Storybook.Empty do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index end diff --git a/test/fixtures/indexes/valid.index.exs b/test/fixtures/indexes/valid.index.exs index 9e636c54..fcc911c4 100644 --- a/test/fixtures/indexes/valid.index.exs +++ b/test/fixtures/indexes/valid.index.exs @@ -1,5 +1,5 @@ defmodule Storybook.Valid do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_icon, do: {:fa, "book-open", :light} def folder_name, do: "Storybook" diff --git a/test/fixtures/storybook_content/flat_list/a_component.story.exs b/test/fixtures/storybook_content/flat_list/a_component.story.exs index 7ed17dd0..64c7af78 100644 --- a/test/fixtures/storybook_content/flat_list/a_component.story.exs +++ b/test/fixtures/storybook_content/flat_list/a_component.story.exs @@ -1,4 +1,4 @@ defmodule FlatListStorybook.AComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: nil end diff --git a/test/fixtures/storybook_content/flat_list/b_component.story.exs b/test/fixtures/storybook_content/flat_list/b_component.story.exs index fe8873a6..be8b5637 100644 --- a/test/fixtures/storybook_content/flat_list/b_component.story.exs +++ b/test/fixtures/storybook_content/flat_list/b_component.story.exs @@ -1,4 +1,4 @@ defmodule FlatListStorybook.BComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: nil end diff --git a/test/fixtures/storybook_content/render_page_crash/a_page.story.exs b/test/fixtures/storybook_content/render_page_crash/a_page.story.exs index e8a63f17..68ee4d4f 100644 --- a/test/fixtures/storybook_content/render_page_crash/a_page.story.exs +++ b/test/fixtures/storybook_content/render_page_crash/a_page.story.exs @@ -1,5 +1,5 @@ defmodule RenderPageCrashStorybook.APage do - use PhxLiveStorybook.Story, :page + use PhoenixStorybook.Story, :page def render(_assigns) do raise "crash" diff --git a/test/fixtures/storybook_content/tree/_root.index.exs b/test/fixtures/storybook_content/tree/_root.index.exs index 01bf5f55..63105634 100644 --- a/test/fixtures/storybook_content/tree/_root.index.exs +++ b/test/fixtures/storybook_content/tree/_root.index.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Root do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_name, do: "Root" diff --git a/test/fixtures/storybook_content/tree/a_folder/_a_folder.index.exs b/test/fixtures/storybook_content/tree/a_folder/_a_folder.index.exs index 082396e6..e06f02bd 100644 --- a/test/fixtures/storybook_content/tree/a_folder/_a_folder.index.exs +++ b/test/fixtures/storybook_content/tree/a_folder/_a_folder.index.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.AFolder do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_name, do: "A Folder" def folder_icon, do: {:fa, "icon"} diff --git a/test/fixtures/storybook_content/tree/a_folder/component.story.exs b/test/fixtures/storybook_content/tree/a_folder/component.story.exs index 19278355..4a84a801 100644 --- a/test/fixtures/storybook_content/tree/a_folder/component.story.exs +++ b/test/fixtures/storybook_content/tree/a_folder/component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.AFolder.Component do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.component/1 def container, do: {:div, class: "block", "data-foo": "bar"} diff --git a/test/fixtures/storybook_content/tree/a_folder/live_component.story.exs b/test/fixtures/storybook_content/tree/a_folder/live_component.story.exs index 5d1d16b4..24eadc01 100644 --- a/test/fixtures/storybook_content/tree/a_folder/live_component.story.exs +++ b/test/fixtures/storybook_content/tree/a_folder/live_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.AFolder.LiveComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: LiveComponent def attributes do diff --git a/test/fixtures/storybook_content/tree/a_page.story.exs b/test/fixtures/storybook_content/tree/a_page.story.exs index 12baf519..ccbbf0c4 100644 --- a/test/fixtures/storybook_content/tree/a_page.story.exs +++ b/test/fixtures/storybook_content/tree/a_page.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.APage do - use PhxLiveStorybook.Story, :page + use PhoenixStorybook.Story, :page def doc, do: "a page" diff --git a/test/fixtures/storybook_content/tree/b_folder/_b_folder.index.exs b/test/fixtures/storybook_content/tree/b_folder/_b_folder.index.exs index 3d2129bc..8b16effe 100644 --- a/test/fixtures/storybook_content/tree/b_folder/_b_folder.index.exs +++ b/test/fixtures/storybook_content/tree/b_folder/_b_folder.index.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.BFolder do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def folder_name, do: "Config Name" def folder_open?, do: true diff --git a/test/fixtures/storybook_content/tree/b_folder/all_types_component.story.exs b/test/fixtures/storybook_content/tree/b_folder/all_types_component.story.exs index 1af36a41..bb5a63b7 100644 --- a/test/fixtures/storybook_content/tree/b_folder/all_types_component.story.exs +++ b/test/fixtures/storybook_content/tree/b_folder/all_types_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.BFolder.AllTypesComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &AllTypesComponent.all_types_component/1 def attributes do diff --git a/test/fixtures/storybook_content/tree/b_folder/component.story.exs b/test/fixtures/storybook_content/tree/b_folder/component.story.exs index 01ef2b77..d47622e4 100644 --- a/test/fixtures/storybook_content/tree/b_folder/component.story.exs +++ b/test/fixtures/storybook_content/tree/b_folder/component.story.exs @@ -1,4 +1,4 @@ defmodule TreeStorybook.BFolder.Component do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.component/1 end diff --git a/test/fixtures/storybook_content/tree/b_folder/nested_component.story.exs b/test/fixtures/storybook_content/tree/b_folder/nested_component.story.exs index 6c36dd3b..0ea8d408 100644 --- a/test/fixtures/storybook_content/tree/b_folder/nested_component.story.exs +++ b/test/fixtures/storybook_content/tree/b_folder/nested_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.BFolder.NestedComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &NestedComponent.nested_component/1 diff --git a/test/fixtures/storybook_content/tree/b_folder/with_id_component.story.exs b/test/fixtures/storybook_content/tree/b_folder/with_id_component.story.exs index 5ca2827c..b1d933dc 100644 --- a/test/fixtures/storybook_content/tree/b_folder/with_id_component.story.exs +++ b/test/fixtures/storybook_content/tree/b_folder/with_id_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.BFolder.WithIdComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.component/1 def attributes do diff --git a/test/fixtures/storybook_content/tree/b_page.story.exs b/test/fixtures/storybook_content/tree/b_page.story.exs index e24c004f..1109f59a 100644 --- a/test/fixtures/storybook_content/tree/b_page.story.exs +++ b/test/fixtures/storybook_content/tree/b_page.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.BPage do - use PhxLiveStorybook.Story, :page + use PhoenixStorybook.Story, :page def navigation do [{:tab_1, "Tab 1", nil}, {:tab_2, "Tab 2", nil}] diff --git a/test/fixtures/storybook_content/tree/component.story.exs b/test/fixtures/storybook_content/tree/component.story.exs index dad6d499..1616508d 100644 --- a/test/fixtures/storybook_content/tree/component.story.exs +++ b/test/fixtures/storybook_content/tree/component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Component do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.component/1 def attributes do diff --git a/test/fixtures/storybook_content/tree/event/_event.index.exs b/test/fixtures/storybook_content/tree/event/_event.index.exs index 31ce6f99..23d527f3 100644 --- a/test/fixtures/storybook_content/tree/event/_event.index.exs +++ b/test/fixtures/storybook_content/tree/event/_event.index.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Event do - use PhxLiveStorybook.Index + use PhoenixStorybook.Index def entry("event_live_component"), do: [name: "Live Event Component (root)"] end diff --git a/test/fixtures/storybook_content/tree/event/event_component.story.exs b/test/fixtures/storybook_content/tree/event/event_component.story.exs index 64d8c335..4bdede4d 100644 --- a/test/fixtures/storybook_content/tree/event/event_component.story.exs +++ b/test/fixtures/storybook_content/tree/event/event_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Event.EventComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &EventComponent.component/1 def attributes do diff --git a/test/fixtures/storybook_content/tree/event/event_live_component.story.exs b/test/fixtures/storybook_content/tree/event/event_live_component.story.exs index e2b5153c..3ceed524 100644 --- a/test/fixtures/storybook_content/tree/event/event_live_component.story.exs +++ b/test/fixtures/storybook_content/tree/event/event_live_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Event.EventLiveComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: EventLiveComponent def variations do diff --git a/test/fixtures/storybook_content/tree/examples/example.story.exs b/test/fixtures/storybook_content/tree/examples/example.story.exs index 6c6ea9a7..99711d2b 100644 --- a/test/fixtures/storybook_content/tree/examples/example.story.exs +++ b/test/fixtures/storybook_content/tree/examples/example.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Examples.Example do - use PhxLiveStorybook.Story, :example + use PhoenixStorybook.Story, :example def doc, do: "Example story" diff --git a/test/fixtures/storybook_content/tree/let/let_component.story.exs b/test/fixtures/storybook_content/tree/let/let_component.story.exs index 05524fcd..a26ff04e 100644 --- a/test/fixtures/storybook_content/tree/let/let_component.story.exs +++ b/test/fixtures/storybook_content/tree/let/let_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Let.LetComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &LetComponent.let_component/1 def variations do diff --git a/test/fixtures/storybook_content/tree/let/let_live_component.story.exs b/test/fixtures/storybook_content/tree/let/let_live_component.story.exs index 92c0a6da..c606810a 100644 --- a/test/fixtures/storybook_content/tree/let/let_live_component.story.exs +++ b/test/fixtures/storybook_content/tree/let/let_live_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.Let.LetLiveComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: LetLiveComponent def variations do diff --git a/test/fixtures/storybook_content/tree/live_component.story.exs b/test/fixtures/storybook_content/tree/live_component.story.exs index 29291f6d..409f155c 100644 --- a/test/fixtures/storybook_content/tree/live_component.story.exs +++ b/test/fixtures/storybook_content/tree/live_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.LiveComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: LiveComponent def container, do: :iframe diff --git a/test/fixtures/storybook_content/tree/templates/invalid_template_component.story.exs b/test/fixtures/storybook_content/tree/templates/invalid_template_component.story.exs index 86914a4d..58a6e279 100644 --- a/test/fixtures/storybook_content/tree/templates/invalid_template_component.story.exs +++ b/test/fixtures/storybook_content/tree/templates/invalid_template_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.InvalidTemplateComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &TemplateComponent.template_component/1 def template do diff --git a/test/fixtures/storybook_content/tree/templates/template_component.story.exs b/test/fixtures/storybook_content/tree/templates/template_component.story.exs index 25dc07cc..90c73276 100644 --- a/test/fixtures/storybook_content/tree/templates/template_component.story.exs +++ b/test/fixtures/storybook_content/tree/templates/template_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.TemplateComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &TemplateComponent.template_component/1 def template do diff --git a/test/fixtures/storybook_content/tree/templates/template_iframe_component.story.exs b/test/fixtures/storybook_content/tree/templates/template_iframe_component.story.exs index 3e933009..14aa4516 100644 --- a/test/fixtures/storybook_content/tree/templates/template_iframe_component.story.exs +++ b/test/fixtures/storybook_content/tree/templates/template_iframe_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.TemplateIframeComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &TemplateComponent.template_component/1 def container, do: :iframe diff --git a/test/fixtures/storybook_content/tree/templates/template_live_component.story.exs b/test/fixtures/storybook_content/tree/templates/template_live_component.story.exs index d77601aa..1513390c 100644 --- a/test/fixtures/storybook_content/tree/templates/template_live_component.story.exs +++ b/test/fixtures/storybook_content/tree/templates/template_live_component.story.exs @@ -1,5 +1,5 @@ defmodule TreeStorybook.TemplateLiveComponent do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: TemplateLiveComponent def template do diff --git a/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_ba_component.story.exs b/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_ba_component.story.exs index 777d6c88..5fc8bfdb 100644 --- a/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_ba_component.story.exs +++ b/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_ba_component.story.exs @@ -1,4 +1,4 @@ defmodule TreeBStorybook.BFolder.BBFolder.BBaComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: nil end diff --git a/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_bb_component.story.exs b/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_bb_component.story.exs index eabf38c0..499dd413 100644 --- a/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_bb_component.story.exs +++ b/test/fixtures/storybook_content/tree_b/b_folder/bb_folder/b_bb_component.story.exs @@ -1,4 +1,4 @@ defmodule TreeBStorybook.BFolder.BbFolder.BbbComponent do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: nil end diff --git a/test/fixtures/stubs/component_stub.ex b/test/fixtures/stubs/component_stub.ex index b35097e4..e6712f07 100644 --- a/test/fixtures/stubs/component_stub.ex +++ b/test/fixtures/stubs/component_stub.ex @@ -1,5 +1,5 @@ -defmodule PhxLiveStorybook.ComponentStub do - alias PhxLiveStorybook.Story.{ComponentBehaviour, StoryBehaviour} +defmodule PhoenixStorybook.ComponentStub do + alias PhoenixStorybook.Story.{ComponentBehaviour, StoryBehaviour} @behaviour StoryBehaviour @behaviour ComponentBehaviour @@ -32,5 +32,5 @@ defmodule PhxLiveStorybook.ComponentStub do def variations, do: [] @impl ComponentBehaviour - def template, do: PhxLiveStorybook.TemplateHelpers.default_template() + def template, do: PhoenixStorybook.TemplateHelpers.default_template() end diff --git a/test/fixtures/stubs/example_stub.ex b/test/fixtures/stubs/example_stub.ex index b40e5d4a..cc8eb5ec 100644 --- a/test/fixtures/stubs/example_stub.ex +++ b/test/fixtures/stubs/example_stub.ex @@ -1,5 +1,5 @@ -defmodule PhxLiveStorybook.ExampleStub do - alias PhxLiveStorybook.Story.{ExampleBehaviour, StoryBehaviour} +defmodule PhoenixStorybook.ExampleStub do + alias PhoenixStorybook.Story.{ExampleBehaviour, StoryBehaviour} @behaviour StoryBehaviour @behaviour ExampleBehaviour diff --git a/test/fixtures/stubs/live_component_stub.ex b/test/fixtures/stubs/live_component_stub.ex index 764db6bb..3fd63fb6 100644 --- a/test/fixtures/stubs/live_component_stub.ex +++ b/test/fixtures/stubs/live_component_stub.ex @@ -1,5 +1,5 @@ -defmodule PhxLiveStorybook.LiveComponentStub do - alias PhxLiveStorybook.Story.{LiveComponentBehaviour, StoryBehaviour} +defmodule PhoenixStorybook.LiveComponentStub do + alias PhoenixStorybook.Story.{LiveComponentBehaviour, StoryBehaviour} @behaviour StoryBehaviour @behaviour LiveComponentBehaviour @@ -32,5 +32,5 @@ defmodule PhxLiveStorybook.LiveComponentStub do def variations, do: [] @impl LiveComponentBehaviour - def template, do: PhxLiveStorybook.TemplateHelpers.default_template() + def template, do: PhoenixStorybook.TemplateHelpers.default_template() end diff --git a/test/fixtures/stubs/page_stub.ex b/test/fixtures/stubs/page_stub.ex index a12068be..74f2c60b 100644 --- a/test/fixtures/stubs/page_stub.ex +++ b/test/fixtures/stubs/page_stub.ex @@ -1,6 +1,6 @@ -defmodule PhxLiveStorybook.PageStub do +defmodule PhoenixStorybook.PageStub do import Phoenix.Component - alias PhxLiveStorybook.Story.{PageBehaviour, StoryBehaviour} + alias PhoenixStorybook.Story.{PageBehaviour, StoryBehaviour} @behaviour StoryBehaviour @behaviour PageBehaviour diff --git a/test/mix/tasks/dev.storybook_test.exs b/test/mix/tasks/dev.storybook_test.exs index 1a197cbb..7cc715fd 100644 --- a/test/mix/tasks/dev.storybook_test.exs +++ b/test/mix/tasks/dev.storybook_test.exs @@ -9,9 +9,9 @@ defmodule Mix.Tasks.Dev.StorybookTest do test "mix dev.storybook" do Storybook.run([]) - assert_receive {:mix_shell, :info, ["* Running mix deps.get for phx_live_storybook dependency"]} - assert_receive {:mix_shell, :info, ["* Running npm ci for phx_live_storybook dependency"]} - assert_receive {:mix_shell, :info, ["* Running mix assets.build for phx_live_storybook dependency"]} + assert_receive {:mix_shell, :info, ["* Running mix deps.get for phoenix_storybook dependency"]} + assert_receive {:mix_shell, :info, ["* Running npm ci for phoenix_storybook dependency"]} + assert_receive {:mix_shell, :info, ["* Running mix assets.build for phoenix_storybook dependency"]} end end diff --git a/test/mix/tasks/phx.gen.storybook_test.exs b/test/mix/tasks/phx.gen.storybook_test.exs index 640458fc..7eb520a0 100644 --- a/test/mix/tasks/phx.gen.storybook_test.exs +++ b/test/mix/tasks/phx.gen.storybook_test.exs @@ -2,7 +2,7 @@ Code.require_file("../../mix_helper.exs", __DIR__) defmodule Mix.Tasks.Phx.Gen.StorybookTest do use ExUnit.Case - import PhxLiveStorybook.MixHelper + import PhoenixStorybook.MixHelper alias Mix.Tasks.Phx.Gen.Storybook setup do @@ -22,9 +22,9 @@ defmodule Mix.Tasks.Phx.Gen.StorybookTest do [{page, _}] = Code.compile_file("storybook/welcome.story.exs") assert page.storybook_type() == :page - [{backend, _}] = Code.compile_file("lib/phx_live_storybook_web/storybook.ex") - assert backend.config(:otp_app) == :phx_live_storybook_web - assert backend.config(:sandbox_class) == "phx-live-storybook-web" + [{backend, _}] = Code.compile_file("lib/phoenix_storybook_web/storybook.ex") + assert backend.config(:otp_app) == :phoenix_storybook_web + assert backend.config(:sandbox_class) == "phoenix-storybook-web" assert_file("assets/js/storybook.js") assert_file("assets/css/storybook.css", fn file -> @@ -32,7 +32,7 @@ defmodule Mix.Tasks.Phx.Gen.StorybookTest do end) assert_shell_receive :info, ~r|Starting storybook generation| - assert_shell_receive :info, ~r|creating lib/phx_live_storybook_web/storybook.ex| + assert_shell_receive :info, ~r|creating lib/phoenix_storybook_web/storybook.ex| assert_shell_receive :info, ~r|creating storybook/_root.index.exs| assert_shell_receive :info, ~r|creating storybook/welcome.story.exs| assert_shell_receive :info, ~r|creating storybook/core_components/button.story.exs| @@ -56,7 +56,7 @@ defmodule Mix.Tasks.Phx.Gen.StorybookTest do assert_file("storybook/_root.index.exs") assert_file("storybook/welcome.story.exs") - assert_file("lib/phx_live_storybook_web/storybook.ex") + assert_file("lib/phoenix_storybook_web/storybook.ex") assert_file("assets/js/storybook.js") assert_file("assets/css/storybook.css", fn file -> @@ -64,7 +64,7 @@ defmodule Mix.Tasks.Phx.Gen.StorybookTest do end) assert_shell_receive :info, ~r|Starting storybook generation| - assert_shell_receive :info, ~r|creating lib/phx_live_storybook_web/storybook.ex| + assert_shell_receive :info, ~r|creating lib/phoenix_storybook_web/storybook.ex| assert_shell_receive :info, ~r|creating storybook/_root.index.exs| assert_shell_receive :info, ~r|creating storybook/welcome.story.exs| assert_shell_receive :info, ~r|creating storybook/core_components/button.story.exs| @@ -93,7 +93,7 @@ defmodule Mix.Tasks.Phx.Gen.StorybookTest do end -defmodule PhxLiveStorybookWeb.CoreComponents do +defmodule PhoenixStorybookWeb.CoreComponents do use Phoenix.Component def button(assigns), do: ~H[] def table(assigns), do: ~H[] diff --git a/test/mix_helper.exs b/test/mix_helper.exs index 6d065b66..86479394 100644 --- a/test/mix_helper.exs +++ b/test/mix_helper.exs @@ -1,7 +1,7 @@ # https://github.com/phoenixframework/phoenix/blob/master/installer/test/mix_helper.exs Mix.shell(Mix.Shell.Process) -defmodule PhxLiveStorybook.MixHelper do +defmodule PhoenixStorybook.MixHelper do import ExUnit.Assertions def tmp_path, do: Path.expand("../tmp", __DIR__) diff --git a/test/phx_live_storybook/components/icon_test.exs b/test/phoenix_storybook/components/icon_test.exs similarity index 97% rename from test/phx_live_storybook/components/icon_test.exs rename to test/phoenix_storybook/components/icon_test.exs index 1f137823..7d1ee748 100644 --- a/test/phx_live_storybook/components/icon_test.exs +++ b/test/phoenix_storybook/components/icon_test.exs @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.Components.IconTest do +defmodule PhoenixStorybook.Components.IconTest do use ExUnit.Case, async: true - import PhxLiveStorybook.Components.Icon + import PhoenixStorybook.Components.Icon import Phoenix.Component, only: [sigil_H: 2] import Phoenix.LiveViewTest, only: [rendered_to_string: 1] diff --git a/test/phx_live_storybook/controllers/asset_not_found_controller_test.exs b/test/phoenix_storybook/controllers/asset_not_found_controller_test.exs similarity index 59% rename from test/phx_live_storybook/controllers/asset_not_found_controller_test.exs rename to test/phoenix_storybook/controllers/asset_not_found_controller_test.exs index d5ff535b..ddfb3b96 100644 --- a/test/phx_live_storybook/controllers/asset_not_found_controller_test.exs +++ b/test/phoenix_storybook/controllers/asset_not_found_controller_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.AssetNotFoundControllerTest do +defmodule PhoenixStorybook.AssetNotFoundControllerTest do use ExUnit.Case, async: true import Phoenix.ConnTest, only: [build_conn: 0, get: 2] - alias PhxLiveStorybook.TestRouter.Helpers, as: Routes - @endpoint PhxLiveStorybook.AssetNotFoundControllerEndpoint + alias PhoenixStorybook.TestRouter.Helpers, as: Routes + @endpoint PhoenixStorybook.AssetNotFoundControllerEndpoint @moduletag :capture_log setup_all do @@ -12,7 +12,7 @@ defmodule PhxLiveStorybook.AssetNotFoundControllerTest do end test "it raises, whatever the path", %{conn: conn} do - assert_raise PhxLiveStorybook.AssetNotFound, fn -> + assert_raise PhoenixStorybook.AssetNotFound, fn -> get(conn, Routes.storybook_asset_path(conn, :asset, ["foo"])) end end diff --git a/test/phx_live_storybook/exs_compiler_test.exs b/test/phoenix_storybook/exs_compiler_test.exs similarity index 73% rename from test/phx_live_storybook/exs_compiler_test.exs rename to test/phoenix_storybook/exs_compiler_test.exs index b47f33f1..eb396ec0 100644 --- a/test/phx_live_storybook/exs_compiler_test.exs +++ b/test/phoenix_storybook/exs_compiler_test.exs @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.ExsCompilerTest do +defmodule PhoenixStorybook.ExsCompilerTest do use ExUnit.Case, async: true import ExUnit.CaptureLog - alias PhxLiveStorybook.ExsCompiler + alias PhoenixStorybook.ExsCompiler setup do [ @@ -13,12 +13,12 @@ defmodule PhxLiveStorybook.ExsCompilerTest do describe "compile_exs/2" do test "can load an exs", %{exs: exs, path: path} do - assert ExsCompiler.compile_exs(exs, path) == {:ok, PhxLiveStorybook.Script} + assert ExsCompiler.compile_exs(exs, path) == {:ok, PhoenixStorybook.Script} end test "can load same exs twice", %{exs: exs, path: path} do - assert ExsCompiler.compile_exs(exs, path) == {:ok, PhxLiveStorybook.Script} - assert ExsCompiler.compile_exs(exs, path) == {:ok, PhxLiveStorybook.Script} + assert ExsCompiler.compile_exs(exs, path) == {:ok, PhoenixStorybook.Script} + assert ExsCompiler.compile_exs(exs, path) == {:ok, PhoenixStorybook.Script} end test "returns an error tuple with bad script", %{bad_exs: exs, path: path} do @@ -29,7 +29,7 @@ defmodule PhxLiveStorybook.ExsCompilerTest do describe "compile_exs!/2" do test "can load a valid exs", %{exs: exs, path: path} do - assert ExsCompiler.compile_exs!(exs, path) == PhxLiveStorybook.Script + assert ExsCompiler.compile_exs!(exs, path) == PhoenixStorybook.Script end test "it raises with bad script", %{bad_exs: exs, path: path} do diff --git a/test/phx_live_storybook/guides/guides_test.exs b/test/phoenix_storybook/guides/guides_test.exs similarity index 83% rename from test/phx_live_storybook/guides/guides_test.exs rename to test/phoenix_storybook/guides/guides_test.exs index 9227742d..af6da1d1 100644 --- a/test/phx_live_storybook/guides/guides_test.exs +++ b/test/phoenix_storybook/guides/guides_test.exs @@ -1,8 +1,8 @@ -defmodule PhxLiveStorybook.Guides.GuidesTest do +defmodule PhoenixStorybook.Guides.GuidesTest do use ExUnit.Case, async: true defmodule Guides do - use PhxLiveStoryBook.Guides.Macros + use PhoenixStorybook.Guides.Macros end test "components guide" do diff --git a/test/phx_live_storybook/helpers/asset_helpers_test.exs b/test/phoenix_storybook/helpers/asset_helpers_test.exs similarity index 94% rename from test/phx_live_storybook/helpers/asset_helpers_test.exs rename to test/phoenix_storybook/helpers/asset_helpers_test.exs index 17e2ab65..68fd5e4b 100644 --- a/test/phx_live_storybook/helpers/asset_helpers_test.exs +++ b/test/phoenix_storybook/helpers/asset_helpers_test.exs @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.AssetHelpersTest do +defmodule PhoenixStorybook.AssetHelpersTest do use ExUnit.Case, async: true - import PhxLiveStorybook.AssetHelpers + import PhoenixStorybook.AssetHelpers describe "parse_manifest/2" do test "it parses a valid manifest" do diff --git a/test/phx_live_storybook/helpers/extra_assigns_helpers_test.exs b/test/phoenix_storybook/helpers/extra_assigns_helpers_test.exs similarity index 95% rename from test/phx_live_storybook/helpers/extra_assigns_helpers_test.exs rename to test/phoenix_storybook/helpers/extra_assigns_helpers_test.exs index cb7a1009..519e49de 100644 --- a/test/phx_live_storybook/helpers/extra_assigns_helpers_test.exs +++ b/test/phoenix_storybook/helpers/extra_assigns_helpers_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.ExtraAssignsHelpersTest do +defmodule PhoenixStorybook.ExtraAssignsHelpersTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.Stories.Attr - alias PhxLiveStorybook.Story.{ComponentBehaviour, StoryBehaviour} - import PhxLiveStorybook.ExtraAssignsHelpers + alias PhoenixStorybook.Stories.Attr + alias PhoenixStorybook.Story.{ComponentBehaviour, StoryBehaviour} + import PhoenixStorybook.ExtraAssignsHelpers setup_all do Mox.defmock(StoryMock, for: [StoryBehaviour, ComponentBehaviour]) @@ -163,7 +163,7 @@ defmodule PhxLiveStorybook.ExtraAssignsHelpersTest do end defp story(_context) do - Mox.stub_with(StoryMock, PhxLiveStorybook.ComponentStub) + Mox.stub_with(StoryMock, PhoenixStorybook.ComponentStub) Mox.stub(StoryMock, :attributes, fn -> [ diff --git a/test/phx_live_storybook/helpers/search_helpers_test.exs b/test/phoenix_storybook/helpers/search_helpers_test.exs similarity index 92% rename from test/phx_live_storybook/helpers/search_helpers_test.exs rename to test/phoenix_storybook/helpers/search_helpers_test.exs index f90122b0..792671ec 100644 --- a/test/phx_live_storybook/helpers/search_helpers_test.exs +++ b/test/phoenix_storybook/helpers/search_helpers_test.exs @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.SearchHelpersTest do +defmodule PhoenixStorybook.SearchHelpersTest do use ExUnit.Case, async: true - import PhxLiveStorybook.SearchHelpers + import PhoenixStorybook.SearchHelpers describe "search/2" do test "simple search" do diff --git a/test/phx_live_storybook/helpers/template_helpers_test.exs b/test/phoenix_storybook/helpers/template_helpers_test.exs similarity index 98% rename from test/phx_live_storybook/helpers/template_helpers_test.exs rename to test/phoenix_storybook/helpers/template_helpers_test.exs index 68c72c2b..48af5d92 100644 --- a/test/phx_live_storybook/helpers/template_helpers_test.exs +++ b/test/phoenix_storybook/helpers/template_helpers_test.exs @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.TemplateHelpersTest do +defmodule PhoenixStorybook.TemplateHelpersTest do use ExUnit.Case, async: true - import PhxLiveStorybook.TemplateHelpers + import PhoenixStorybook.TemplateHelpers test "set_variation_dom_id/2" do template = diff --git a/test/phx_live_storybook/live/component_iframe_live_test.exs b/test/phoenix_storybook/live/component_iframe_live_test.exs similarity index 96% rename from test/phx_live_storybook/live/component_iframe_live_test.exs rename to test/phoenix_storybook/live/component_iframe_live_test.exs index 1de8c2d8..eeecfc6d 100644 --- a/test/phx_live_storybook/live/component_iframe_live_test.exs +++ b/test/phoenix_storybook/live/component_iframe_live_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.ComponentIframeLiveTest do +defmodule PhoenixStorybook.ComponentIframeLiveTest do use ExUnit.Case, async: true import Phoenix.ConnTest import Phoenix.LiveViewTest - @endpoint PhxLiveStorybook.ComponentIframeLiveEndpoint + @endpoint PhoenixStorybook.ComponentIframeLiveEndpoint @moduletag :capture_log setup_all do diff --git a/test/phx_live_storybook/live/playground_live_test.exs b/test/phoenix_storybook/live/playground_live_test.exs similarity index 99% rename from test/phx_live_storybook/live/playground_live_test.exs rename to test/phoenix_storybook/live/playground_live_test.exs index 7f034760..ecaea472 100644 --- a/test/phx_live_storybook/live/playground_live_test.exs +++ b/test/phoenix_storybook/live/playground_live_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.PlaygroundLiveTest do +defmodule PhoenixStorybook.PlaygroundLiveTest do use ExUnit.Case, async: true import Phoenix.ConnTest import Phoenix.LiveViewTest - @endpoint PhxLiveStorybook.PlaygroundLiveTestEndpoint + @endpoint PhoenixStorybook.PlaygroundLiveTestEndpoint @moduletag :capture_log setup_all do @@ -514,13 +514,13 @@ defmodule PhxLiveStorybook.PlaygroundLiveTest do end end -defmodule PhxLiveStorybook.PlaygroundLiveNonAsyncTest do +defmodule PhoenixStorybook.PlaygroundLiveNonAsyncTest do use ExUnit.Case, async: false import Phoenix.ConnTest import Phoenix.LiveViewTest - @endpoint PhxLiveStorybook.PlaygroundLiveTestEndpoint + @endpoint PhoenixStorybook.PlaygroundLiveTestEndpoint @moduletag :capture_log setup_all do diff --git a/test/phx_live_storybook/live/search_test.exs b/test/phoenix_storybook/live/search_test.exs similarity index 85% rename from test/phx_live_storybook/live/search_test.exs rename to test/phoenix_storybook/live/search_test.exs index 5efcf79a..a387ba43 100644 --- a/test/phx_live_storybook/live/search_test.exs +++ b/test/phoenix_storybook/live/search_test.exs @@ -1,10 +1,10 @@ -defmodule PhxLiveStorybook.SearchTest do +defmodule PhoenixStorybook.SearchTest do use ExUnit.Case, async: true import Phoenix.LiveViewTest import Floki, only: [find: 2] - alias PhxLiveStorybook.Search - alias PhxLiveStorybook.{EmptyFilesStorybook, FlatListStorybook} + alias PhoenixStorybook.Search + alias PhoenixStorybook.{EmptyFilesStorybook, FlatListStorybook} describe "search list stories" do test "has no story" do diff --git a/test/phx_live_storybook/live/sidebar_test.exs b/test/phoenix_storybook/live/sidebar_test.exs similarity index 96% rename from test/phx_live_storybook/live/sidebar_test.exs rename to test/phoenix_storybook/live/sidebar_test.exs index 8edce03b..ff0d64d4 100644 --- a/test/phx_live_storybook/live/sidebar_test.exs +++ b/test/phoenix_storybook/live/sidebar_test.exs @@ -1,10 +1,10 @@ -defmodule PhxLiveStorybook.SidebarTest do +defmodule PhoenixStorybook.SidebarTest do use ExUnit.Case, async: true import Phoenix.LiveViewTest import Floki, only: [find: 2] - alias PhxLiveStorybook.Sidebar - alias PhxLiveStorybook.{FlatListStorybook, TreeStorybook} + alias PhoenixStorybook.Sidebar + alias PhoenixStorybook.{FlatListStorybook, TreeStorybook} describe "storybook with flat list of stories" do test "sidebar contains those 2 stories" do diff --git a/test/phx_live_storybook/live/story_live_test.exs b/test/phoenix_storybook/live/story_live_test.exs similarity index 98% rename from test/phx_live_storybook/live/story_live_test.exs rename to test/phoenix_storybook/live/story_live_test.exs index d770d3ad..9e8db411 100644 --- a/test/phx_live_storybook/live/story_live_test.exs +++ b/test/phoenix_storybook/live/story_live_test.exs @@ -1,10 +1,10 @@ -defmodule PhxLiveStorybook.StoryLiveTest do +defmodule PhoenixStorybook.StoryLiveTest do use ExUnit.Case, async: true import Phoenix.ConnTest import Phoenix.LiveViewTest import ExUnit.CaptureLog - @endpoint PhxLiveStorybook.StoryLiveTestEndpoint + @endpoint PhoenixStorybook.StoryLiveTestEndpoint @moduletag :capture_log setup_all do @@ -52,7 +52,7 @@ defmodule PhxLiveStorybook.StoryLiveTest do end test "navigate to unknown tab", %{conn: conn} do - assert_raise PhxLiveStorybook.StoryTabNotFound, fn -> + assert_raise PhoenixStorybook.StoryTabNotFound, fn -> get(conn, "/storybook/component", tab: "unknown") end end @@ -111,7 +111,7 @@ defmodule PhxLiveStorybook.StoryLiveTest do assert html =~ "component: hello colorful" - Phoenix.PubSub.subscribe(PhxLiveStorybook.PubSub, "playground-#{inspect(view.pid)}") + Phoenix.PubSub.subscribe(PhoenixStorybook.PubSub, "playground-#{inspect(view.pid)}") view |> element("a.lsb-theme", "Default") |> render_click() assert_receive {:set_theme, :default} @@ -275,7 +275,7 @@ defmodule PhxLiveStorybook.StoryLiveTest do assert html =~ ~r/defmodule.*TreeStorybook\.Examples\.Example/ refute html =~ ~r/extra_sources/ refute html =~ ~r/doc/ - refute html =~ ~r/PhxLiveStorybook/ + refute html =~ ~r/PhoenixStorybook/ end test "renders an example story extra source tab", %{conn: conn} do diff --git a/test/phx_live_storybook/live/visual_test_live_test.exs b/test/phoenix_storybook/live/visual_test_live_test.exs similarity index 87% rename from test/phx_live_storybook/live/visual_test_live_test.exs rename to test/phoenix_storybook/live/visual_test_live_test.exs index b373a240..94c9889d 100644 --- a/test/phx_live_storybook/live/visual_test_live_test.exs +++ b/test/phoenix_storybook/live/visual_test_live_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.VisualTestLiveTest do +defmodule PhoenixStorybook.VisualTestLiveTest do use ExUnit.Case, async: true import Phoenix.ConnTest import Phoenix.LiveViewTest - @endpoint PhxLiveStorybook.VisualTestLiveEndpoint + @endpoint PhoenixStorybook.VisualTestLiveEndpoint setup_all do start_supervised!(@endpoint) @@ -48,21 +48,21 @@ defmodule PhxLiveStorybook.VisualTestLiveTest do @tag :capture_log test "404 on unknown story path", %{conn: conn} do - assert_raise PhxLiveStorybook.StoryNotFound, fn -> + assert_raise PhoenixStorybook.StoryNotFound, fn -> live(conn, "/storybook/visual_tests/unknown") end end @tag :capture_log test "404 on page story path", %{conn: conn} do - assert_raise PhxLiveStorybook.StoryNotFound, fn -> + assert_raise PhoenixStorybook.StoryNotFound, fn -> live(conn, "/storybook/visual_tests/a_page") end end @tag :capture_log test "404 on example story path", %{conn: conn} do - assert_raise PhxLiveStorybook.StoryNotFound, fn -> + assert_raise PhoenixStorybook.StoryNotFound, fn -> live(conn, "/storybook/visual_tests/examples/example") end end diff --git a/test/phx_live_storybook/rendering/code_renderer_test.exs b/test/phoenix_storybook/rendering/code_renderer_test.exs similarity index 98% rename from test/phx_live_storybook/rendering/code_renderer_test.exs rename to test/phoenix_storybook/rendering/code_renderer_test.exs index b41b00d1..7e37d64b 100644 --- a/test/phx_live_storybook/rendering/code_renderer_test.exs +++ b/test/phoenix_storybook/rendering/code_renderer_test.exs @@ -1,8 +1,8 @@ -defmodule PhxLiveStorybook.Rendering.CodeRendererTest do +defmodule PhoenixStorybook.Rendering.CodeRendererTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.TreeStorybook - alias PhxLiveStorybook.Rendering.{CodeRenderer, RenderingContext} + alias PhoenixStorybook.TreeStorybook + alias PhoenixStorybook.Rendering.{CodeRenderer, RenderingContext} import Phoenix.LiveViewTest, only: [rendered_to_string: 1] setup_all do diff --git a/test/phx_live_storybook/rendering/component_renderer_test.exs b/test/phoenix_storybook/rendering/component_renderer_test.exs similarity index 96% rename from test/phx_live_storybook/rendering/component_renderer_test.exs rename to test/phoenix_storybook/rendering/component_renderer_test.exs index 113f878e..d00a457e 100644 --- a/test/phx_live_storybook/rendering/component_renderer_test.exs +++ b/test/phoenix_storybook/rendering/component_renderer_test.exs @@ -1,8 +1,8 @@ -defmodule PhxLiveStorybook.Rendering.ComponentRendererTest do +defmodule PhoenixStorybook.Rendering.ComponentRendererTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.TreeStorybook - alias PhxLiveStorybook.Rendering.{ComponentRenderer, RenderingContext} + alias PhoenixStorybook.TreeStorybook + alias PhoenixStorybook.Rendering.{ComponentRenderer, RenderingContext} import Phoenix.LiveViewTest setup_all do @@ -167,7 +167,7 @@ defmodule PhxLiveStorybook.Rendering.ComponentRendererTest do test "it should not crash with a very large binary in a map" do defmodule LargeBinaryStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.component/1 def variations do @@ -189,7 +189,7 @@ defmodule PhxLiveStorybook.Rendering.ComponentRendererTest do test "it should not crash with a very long list" do defmodule LongListStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.component/1 def variations do diff --git a/test/phx_live_storybook/router_test.exs b/test/phoenix_storybook/router_test.exs similarity index 92% rename from test/phx_live_storybook/router_test.exs rename to test/phoenix_storybook/router_test.exs index 62dd036a..d6373ad0 100644 --- a/test/phx_live_storybook/router_test.exs +++ b/test/phoenix_storybook/router_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybook.RouterTest do +defmodule PhoenixStorybook.RouterTest do use ExUnit.Case, async: true import Phoenix.ConnTest, only: [build_conn: 0] - alias PhxLiveStorybook.TestRouter.Helpers, as: Routes + alias PhoenixStorybook.TestRouter.Helpers, as: Routes describe "live_storybook_path/2" do test "generates helper for home" do @@ -40,7 +40,7 @@ defmodule PhxLiveStorybook.RouterTest do assert_raise(RuntimeError, fn -> defmodule NoBackendModuleRouter do use Phoenix.Router - import PhxLiveStorybook.Router + import PhoenixStorybook.Router live_storybook("/storybook", []) end diff --git a/test/phx_live_storybook/stories/doc_test.exs b/test/phoenix_storybook/stories/doc_test.exs similarity index 85% rename from test/phx_live_storybook/stories/doc_test.exs rename to test/phoenix_storybook/stories/doc_test.exs index 8e6eb4d3..9c53aa57 100644 --- a/test/phx_live_storybook/stories/doc_test.exs +++ b/test/phoenix_storybook/stories/doc_test.exs @@ -1,10 +1,10 @@ -defmodule PhxLiveStorybook.Stories.DocTest do +defmodule PhoenixStorybook.Stories.DocTest do use ExUnit.Case, async: true import ExUnit.CaptureLog - alias PhxLiveStorybook.ExsCompiler - alias PhxLiveStorybook.Stories.Doc + alias PhoenixStorybook.ExsCompiler + alias PhoenixStorybook.Stories.Doc describe "fetch_doc_as_html/2" do test "it returns a function component documentation" do @@ -32,7 +32,7 @@ defmodule PhxLiveStorybook.Stories.DocTest do end defmodule NoDocStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &NoDocComponent.no_doc_component/1 end @@ -42,7 +42,7 @@ defmodule PhxLiveStorybook.Stories.DocTest do end) assert log =~ - "could not fetch function docs from PhxLiveStorybook.Stories.DocTest.NoDocComponent" + "could not fetch function docs from PhoenixStorybook.Stories.DocTest.NoDocComponent" end test "it returns [] when live_component doc has not yet been compiled" do @@ -52,7 +52,7 @@ defmodule PhxLiveStorybook.Stories.DocTest do end defmodule NoDocStory do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: NoDocLiveComponent end @@ -62,7 +62,7 @@ defmodule PhxLiveStorybook.Stories.DocTest do end) assert log =~ - "could not fetch module doc from PhxLiveStorybook.Stories.DocTest.NoDocLiveComponent" + "could not fetch module doc from PhoenixStorybook.Stories.DocTest.NoDocLiveComponent" end end diff --git a/test/phx_live_storybook/stories/index_validator_test.exs b/test/phoenix_storybook/stories/index_validator_test.exs similarity index 95% rename from test/phx_live_storybook/stories/index_validator_test.exs rename to test/phoenix_storybook/stories/index_validator_test.exs index ca5c90ff..f618de52 100644 --- a/test/phx_live_storybook/stories/index_validator_test.exs +++ b/test/phoenix_storybook/stories/index_validator_test.exs @@ -1,4 +1,4 @@ -defmodule PhxLiveStorybook.Stories.IndexValidatorTest do +defmodule PhoenixStorybook.Stories.IndexValidatorTest do use ExUnit.Case, async: true setup do diff --git a/test/phx_live_storybook/stories/story_source_test.exs b/test/phoenix_storybook/stories/story_source_test.exs similarity index 92% rename from test/phx_live_storybook/stories/story_source_test.exs rename to test/phoenix_storybook/stories/story_source_test.exs index 82489486..ede3492e 100644 --- a/test/phx_live_storybook/stories/story_source_test.exs +++ b/test/phoenix_storybook/stories/story_source_test.exs @@ -1,7 +1,7 @@ -defmodule PhxLiveStorybook.Stories.StorySourceTest do +defmodule PhoenixStorybook.Stories.StorySourceTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.TreeStorybook + alias PhoenixStorybook.TreeStorybook describe "__component_source__/0" do test "it returns component source" do @@ -12,7 +12,7 @@ defmodule PhxLiveStorybook.Stories.StorySourceTest do @tag :capture_log test "it fails gracefully if source cannot be loaded" do defmodule SourceFailStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component import Phoenix.Component def function, do: &badge/1 defp badge(assigns), do: ~H"Hello World" diff --git a/test/phx_live_storybook/stories/story_test.exs b/test/phoenix_storybook/stories/story_test.exs similarity index 93% rename from test/phx_live_storybook/stories/story_test.exs rename to test/phoenix_storybook/stories/story_test.exs index c31090d9..f42ed1ea 100644 --- a/test/phx_live_storybook/stories/story_test.exs +++ b/test/phoenix_storybook/stories/story_test.exs @@ -1,12 +1,12 @@ -defmodule PhxLiveStorybook.StoryTest do +defmodule PhoenixStorybook.StoryTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.Stories.{Attr, Slot} + alias PhoenixStorybook.Stories.{Attr, Slot} describe "component story" do test "component story default behaviors" do defmodule MyComponentStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: nil end @@ -23,7 +23,7 @@ defmodule PhxLiveStorybook.StoryTest do end defmodule ComponentStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &Component.my_component/1 def attributes do @@ -78,7 +78,7 @@ defmodule PhxLiveStorybook.StoryTest do end defmodule SlotComponentStory do - use PhxLiveStorybook.Story, :component + use PhoenixStorybook.Story, :component def function, do: &SlotComponent.slot_component/1 def slots do @@ -100,7 +100,7 @@ defmodule PhxLiveStorybook.StoryTest do describe "live_component story" do test "live_component story default behaviors" do defmodule MyLiveComponentStory do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: nil end @@ -117,7 +117,7 @@ defmodule PhxLiveStorybook.StoryTest do end defmodule LiveComponentStory do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: LiveComponent def attributes do @@ -172,7 +172,7 @@ defmodule PhxLiveStorybook.StoryTest do end defmodule SlotLiveComponentStory do - use PhxLiveStorybook.Story, :live_component + use PhoenixStorybook.Story, :live_component def component, do: SlotLiveComponent def slots do @@ -194,7 +194,7 @@ defmodule PhxLiveStorybook.StoryTest do describe "page story" do test "page story default behaviors" do defmodule MyPageStory do - use PhxLiveStorybook.Story, :page + use PhoenixStorybook.Story, :page end assert MyPageStory.storybook_type() == :page diff --git a/test/phx_live_storybook/stories/story_validator_test.exs b/test/phoenix_storybook/stories/story_validator_test.exs similarity index 99% rename from test/phx_live_storybook/stories/story_validator_test.exs rename to test/phoenix_storybook/stories/story_validator_test.exs index 4686e810..9706698e 100644 --- a/test/phx_live_storybook/stories/story_validator_test.exs +++ b/test/phoenix_storybook/stories/story_validator_test.exs @@ -1,17 +1,17 @@ -defmodule PhxLiveStorybook.Stories.StoryValidatorTest do +defmodule PhoenixStorybook.Stories.StoryValidatorTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.Story.{ + alias PhoenixStorybook.Story.{ ComponentBehaviour, LiveComponentBehaviour, ExampleBehaviour, PageBehaviour } - alias PhxLiveStorybook.Story.StoryBehaviour - alias PhxLiveStorybook.{ComponentStub, LiveComponentStub, ExampleStub, PageStub} - alias PhxLiveStorybook.Stories.{Attr, Slot, Variation, VariationGroup} - alias PhxLiveStorybook.Stories.StoryValidator + alias PhoenixStorybook.Story.StoryBehaviour + alias PhoenixStorybook.{ComponentStub, LiveComponentStub, ExampleStub, PageStub} + alias PhoenixStorybook.Stories.{Attr, Slot, Variation, VariationGroup} + alias PhoenixStorybook.Stories.StoryValidator defmodule MyModuleStruct, do: defstruct([]) diff --git a/test/phx_live_storybook_test.exs b/test/phoenix_storybook_test.exs similarity index 93% rename from test/phx_live_storybook_test.exs rename to test/phoenix_storybook_test.exs index 13542d48..0ea1894c 100644 --- a/test/phx_live_storybook_test.exs +++ b/test/phoenix_storybook_test.exs @@ -1,9 +1,9 @@ -defmodule PhxLiveStorybookTest do +defmodule PhoenixStorybookTest do use ExUnit.Case, async: true - alias PhxLiveStorybook.{FolderEntry, StoryEntry} + alias PhoenixStorybook.{FolderEntry, StoryEntry} - alias PhxLiveStorybook.{ + alias PhoenixStorybook.{ EmptyFilesStorybook, EmptyFoldersStorybook, FlatListStorybook, @@ -14,8 +14,8 @@ defmodule PhxLiveStorybookTest do describe "stories/0" do test "when no content path set it should raise" do assert_raise RuntimeError, "content_path key must be set", fn -> - defmodule PhxLiveStorybook.NoContentStorybook do - use Elixir.PhxLiveStorybook, otp_app: :phx_live_storybook + defmodule PhoenixStorybook.NoContentStorybook do + use Elixir.PhoenixStorybook, otp_app: :phoenix_storybook end end end diff --git a/test/test_helper.exs b/test/test_helper.exs index 668f42cc..878f9b9d 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,37 +1,37 @@ ExUnit.start() -defmodule PhxLiveStorybook.EmptyFilesStorybook do - use PhxLiveStorybook, - otp_app: :phx_live_storybook, +defmodule PhoenixStorybook.EmptyFilesStorybook do + use PhoenixStorybook, + otp_app: :phoenix_storybook, content_path: Path.expand("./fixtures/storybook_content/empty_files", __DIR__) end -defmodule PhxLiveStorybook.EmptyFoldersStorybook do - use PhxLiveStorybook, - otp_app: :phx_live_storybook, +defmodule PhoenixStorybook.EmptyFoldersStorybook do + use PhoenixStorybook, + otp_app: :phoenix_storybook, content_path: Path.expand("./fixtures/storybook_content/empty_folders", __DIR__) end -defmodule PhxLiveStorybook.FlatListStorybook do - use PhxLiveStorybook, - otp_app: :phx_live_storybook, +defmodule PhoenixStorybook.FlatListStorybook do + use PhoenixStorybook, + otp_app: :phoenix_storybook, content_path: Path.expand("./fixtures/storybook_content/flat_list", __DIR__) end -defmodule PhxLiveStorybook.TreeStorybook do - use PhxLiveStorybook, - otp_app: :phx_live_storybook, +defmodule PhoenixStorybook.TreeStorybook do + use PhoenixStorybook, + otp_app: :phoenix_storybook, content_path: Path.expand("./fixtures/storybook_content/tree", __DIR__), compilation_mode: :lazy end -defmodule PhxLiveStorybook.TreeBStorybook do - use PhxLiveStorybook, +defmodule PhoenixStorybook.TreeBStorybook do + use PhoenixStorybook, content_path: Path.expand("./fixtures/storybook_content/tree_b", __DIR__) end -defmodule PhxLiveStorybook.TestStorybook do - use PhxLiveStorybook, +defmodule PhoenixStorybook.TestStorybook do + use PhoenixStorybook, content_path: Path.expand("./fixtures/storybook_content/tree", __DIR__), compilation_mode: :lazy, themes: [ @@ -44,21 +44,21 @@ defmodule PhxLiveStorybook.TestStorybook do ] end -defmodule PhxLiveStorybook.TestRouter do +defmodule PhoenixStorybook.TestRouter do use Phoenix.Router - import PhxLiveStorybook.Router + import PhoenixStorybook.Router storybook_assets() live_storybook("/storybook", - otp_app: :phx_live_storybook, - backend_module: PhxLiveStorybook.TestStorybook + otp_app: :phoenix_storybook, + backend_module: PhoenixStorybook.TestStorybook ) scope "/admin" do live_storybook("/storybook", - otp_app: :phx_live_storybook, - backend_module: PhxLiveStorybook.TestStorybook, + otp_app: :phoenix_storybook, + backend_module: PhoenixStorybook.TestStorybook, session_name: :live_storybook_admin, as: :admin_live_storybook, pipeline: false @@ -67,14 +67,14 @@ defmodule PhxLiveStorybook.TestRouter do end for endpoint <- [ - PhxLiveStorybook.AssetNotFoundControllerEndpoint, - PhxLiveStorybook.ComponentIframeLiveEndpoint, - PhxLiveStorybook.StoryLiveTestEndpoint, - PhxLiveStorybook.PlaygroundLiveTestEndpoint, - PhxLiveStorybook.VisualTestLiveEndpoint + PhoenixStorybook.AssetNotFoundControllerEndpoint, + PhoenixStorybook.ComponentIframeLiveEndpoint, + PhoenixStorybook.StoryLiveTestEndpoint, + PhoenixStorybook.PlaygroundLiveTestEndpoint, + PhoenixStorybook.VisualTestLiveEndpoint ] do defmodule endpoint do - use Phoenix.Endpoint, otp_app: :phx_live_storybook + use Phoenix.Endpoint, otp_app: :phoenix_storybook plug(Plug.Session, store: :cookie, @@ -82,14 +82,14 @@ for endpoint <- [ signing_salt: "/VEDsdfsffMnp5" ) - plug(PhxLiveStorybook.TestRouter) + plug(PhoenixStorybook.TestRouter) end - Application.put_env(:phx_live_storybook, endpoint, + Application.put_env(:phoenix_storybook, endpoint, url: [host: "localhost", port: 4000], secret_key_base: "Hu4qQN3iKzTV4fJxhorPQlA/osH9fAMtbtjVS58PFgfw3ja5Z18Q/WSNR9wP4OfW", live_view: [signing_salt: "hMegieSe"], check_origin: false, - render_errors: [view: PhxLiveStorybook.ErrorView] + render_errors: [view: PhoenixStorybook.ErrorView] ) end