proscenium 0.19.0.beta19-aarch64-linux → 0.20.0-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -104
- data/lib/proscenium/builder.rb +1 -0
- data/lib/proscenium/css_module/path.rb +2 -1
- data/lib/proscenium/css_module/transformer.rb +1 -1
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/helper.rb +0 -12
- data/lib/proscenium/importer.rb +1 -1
- data/lib/proscenium/log_subscriber.rb +0 -2
- data/lib/proscenium/middleware.rb +11 -19
- data/lib/proscenium/monkey.rb +7 -6
- data/lib/proscenium/railtie.rb +6 -1
- data/lib/proscenium/react_componentable.rb +1 -1
- data/lib/proscenium/side_load.rb +4 -3
- data/lib/proscenium/version.rb +1 -1
- data/lib/proscenium.rb +0 -1
- metadata +2 -49
- data/lib/proscenium/css_module/rewriter.rb +0 -76
- data/lib/proscenium/phlex/asset_inclusions.rb +0 -16
- data/lib/proscenium/phlex/css_modules.rb +0 -80
- data/lib/proscenium/phlex/react_component.rb +0 -32
- data/lib/proscenium/phlex.rb +0 -43
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f732bbb4ca60aaa281b4de37e84dec4eeffd7978a5fa9f87a7948202887ba157
         | 
| 4 | 
            +
              data.tar.gz: c5cc0839a611c3599a12b46646fe05f8f0a5c46594449f375b6d54258a3b0da9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e1c94f9ee0ad1e5c5bfb782d904a6c502ba0985149fdc7024cf92802298f4bc85fd562d23ab491c450eb527ee0af952e893a0dc975c9ae6823a70702c284055b
         | 
| 7 | 
            +
              data.tar.gz: a92e3e734d397cb1161d609231cc04dddf3ce6a294ad64b1fcc5301155b4750f9ed7dc197e5858193491fe98fe9da99b966f235deaa1c74bf01b0206002e91fa
         | 
    
        data/README.md
    CHANGED
    
    | @@ -6,17 +6,17 @@ | |
| 6 6 | 
             
            >
         | 
| 7 7 | 
             
            > - _the part of a theatre stage in front of the curtain._
         | 
| 8 8 |  | 
| 9 | 
            -
            **_Proscenium_** treats your frontend and client-side code as first class citizens of your Rails app, and assumes a "fast by default" internet. It bundles and minifies JavaScript (+ | 
| 9 | 
            +
            **_Proscenium_** treats your frontend and client-side code as first class citizens of your Rails app, and assumes a "fast by default" internet. It bundles and minifies JavaScript (+JSX), TypeScript (+TSX) and CSS in real time, on demand, and with zero configuration.
         | 
| 10 10 |  | 
| 11 11 | 
             
            **The highlights:**
         | 
| 12 12 |  | 
| 13 13 | 
             
            - Fast, real-time bundling, tree-shaking, code-splitting and minification of Javascript (.js,.jsx), Typescript (.ts,.tsx) and CSS (.css).
         | 
| 14 14 | 
             
            - NO JavaScript runtime needed (eg. Node) - just the browser!
         | 
| 15 15 | 
             
            - NO build step or pre-compilation.
         | 
| 16 | 
            -
            - NO additional process or server - Just run `rails  | 
| 16 | 
            +
            - NO additional process or server - Just run `rails server`!
         | 
| 17 17 | 
             
            - Transforms newer JavaScript and CSS syntax to older syntax for older browsers.
         | 
| 18 18 | 
             
            - Deep integration with Rails.
         | 
| 19 | 
            -
            - Automatically side-load your layouts, views, and partials.
         | 
| 19 | 
            +
            - Automatically side-load JS and CSS for your layouts, views, and partials.
         | 
| 20 20 | 
             
            - Import from NPM, URL's, and locally.
         | 
| 21 21 | 
             
            - Server-side import map support.
         | 
| 22 22 | 
             
            - CSS Modules & mixins.
         | 
| @@ -48,7 +48,6 @@ | |
| 48 48 | 
             
              - [Typescript Caveats](#typescript-caveats)
         | 
| 49 49 | 
             
            - [JSX](#jsx)
         | 
| 50 50 | 
             
            - [JSON](#json)
         | 
| 51 | 
            -
            - [Phlex Support](#phlex-support)
         | 
| 52 51 | 
             
            - [Cache Busting](#cache-busting)
         | 
| 53 52 | 
             
            - [rjs is back!](#rjs-is-back)
         | 
| 54 53 | 
             
            - [Resolution](#resolution)
         | 
| @@ -76,15 +75,15 @@ gem 'proscenium' | |
| 76 75 |  | 
| 77 76 | 
             
            Please note that Proscenium is designed solely for use with Rails.
         | 
| 78 77 |  | 
| 79 | 
            -
            Now if you start your Rails app, you can open any front end code (JS, CSS, etc.). For example, a file at `app/assets/stylesheets/application.css` can be accessed at `https://localhost:3000/app/assets/stylesheets/application.css`, which will be  | 
| 78 | 
            +
            Now if you start your Rails app, you can open any front end code (JS, CSS, etc.). For example, a file at `app/assets/stylesheets/application.css` can be accessed at `https://localhost:3000/app/assets/stylesheets/application.css`, which will be transformed, bundled, and minified [in production] in real time.
         | 
| 80 79 |  | 
| 81 80 | 
             
            ## Client-Side Code Anywhere
         | 
| 82 81 |  | 
| 83 | 
            -
            Proscenium believes that your frontend code is just as important as your backend code, and is not an afterthought - they should be first class citizens of your Rails app. So instead of having to throw all your JS and CSS into a "app/assets" directory, and then requiring a separate process to compile or bundle,  | 
| 82 | 
            +
            Proscenium believes that your frontend code is just as important as your backend code, and is not an afterthought - they should be first class citizens of your Rails app. So instead of having to throw all your JS and CSS into a "app/assets" directory, and then requiring a separate process to compile or bundle, you can simply put them wherever you want within your app, and just run Rails!
         | 
| 84 83 |  | 
| 85 84 | 
             
            For example, if you have some JS that is required by your `app/views/users/index.html.erb` view, just create a JS file alongside it at `app/views/users/index.js`. Or if you have some CSS that is used by your entire application, put it in `app/views/layouts/application.css` and load it alongside your layout. Maybe you have a few JS utility functions, so put them in `lib/utils.js`.
         | 
| 86 85 |  | 
| 87 | 
            -
            Simply put your JS(X) and CSS anywhere you want, and they will be served by your Rails app from the location where you placed them.
         | 
| 86 | 
            +
            Simply put your JS(X) and CSS anywhere you want, and they will be served by your Rails app from the same location where you placed them.
         | 
| 88 87 |  | 
| 89 88 | 
             
            Using the examples above...
         | 
| 90 89 |  | 
| @@ -96,15 +95,15 @@ Using the examples above... | |
| 96 95 |  | 
| 97 96 | 
             
            ## Side Loading
         | 
| 98 97 |  | 
| 99 | 
            -
            Proscenium is best experienced when your assets are  | 
| 98 | 
            +
            Proscenium is best experienced when your assets are automatically side loaded.
         | 
| 100 99 |  | 
| 101 100 | 
             
            ### The Problem
         | 
| 102 101 |  | 
| 103 | 
            -
            With Rails you would typically  | 
| 102 | 
            +
            With Rails you would typically load your JavaScript and CSS assets declaratively using the `javascript_include_tag` and `stylesheet_link_tag` helpers.
         | 
| 104 103 |  | 
| 105 | 
            -
            For example, you may have top-level "application"  | 
| 104 | 
            +
            For example, you may have top-level "application" styles located in a file at `/app/assets/stylesheets/application.css`. Likewise, you may have some global JavaScript located in a file at `/app/javascript/application.js`.
         | 
| 106 105 |  | 
| 107 | 
            -
            You would manually and declaratively include those two files in your  | 
| 106 | 
            +
            You would manually and declaratively include those two files in each of your layouts, something like this:
         | 
| 108 107 |  | 
| 109 108 | 
             
            ```erb
         | 
| 110 109 | 
             
            <%# /app/views/layouts/application.html.erb %>
         | 
| @@ -142,7 +141,9 @@ The main problem is that you have to keep track of all these assets, and make su | |
| 142 141 |  | 
| 143 142 | 
             
            When side loading your JavaScript, Typescript and CSS with Proscenium, they are automatically included alongside your views, partials, layouts, and components, and only when needed.
         | 
| 144 143 |  | 
| 145 | 
            -
            Side loading works by looking for a JS/TS/CSS file with the same name as your view, partial, layout or component. For example, if you have a view at `app/views/users/index.html.erb`, then Proscenium will look for a JS | 
| 144 | 
            +
            Side loading works by looking for a JS/TS/CSS file with the same name as your view, partial, layout or component. For example, if you have a view at `app/views/users/index.html.erb`, then Proscenium will look for a JS and CSS file at `app/views/users/index.js` (or TypeScript with a .ts extension) and `app/views/users/index.css`. If it finds one, it will automatically include it in the HTML for that view. And only for that view.
         | 
| 145 | 
            +
             | 
| 146 | 
            +
            This allows you to keep your assets organized alongside the views, partials, and components that use them, without having to manually track and include them. It also means only the assets that are needed are included.
         | 
| 146 147 |  | 
| 147 148 | 
             
            JSX is also supported for JavaScript and Typescript. Simply use the `.jsx` or `.tsx` extension instead of `.js` or `.ts`.
         | 
| 148 149 |  | 
| @@ -273,6 +274,14 @@ Then just import as normal: | |
| 273 274 | 
             
            import React from "react";
         | 
| 274 275 | 
             
            ```
         | 
| 275 276 |  | 
| 277 | 
            +
            Or if you don't want any bundling at all, simply turn it off application-wide:
         | 
| 278 | 
            +
             | 
| 279 | 
            +
            ```ruby
         | 
| 280 | 
            +
            config.proscenium.bundle = false
         | 
| 281 | 
            +
            ```
         | 
| 282 | 
            +
             | 
| 283 | 
            +
            This will mean every asset and import will be loaded independently.
         | 
| 284 | 
            +
             | 
| 276 285 | 
             
            ## Import Maps
         | 
| 277 286 |  | 
| 278 287 | 
             
            > **[WIP]**
         | 
| @@ -406,13 +415,17 @@ if (typeof proscenium.env?.UNKNOWN !== "undefined") { | |
| 406 415 |  | 
| 407 416 | 
             
            ## i18n
         | 
| 408 417 |  | 
| 409 | 
            -
             | 
| 418 | 
            +
            Support is provided for importing your Rails locale files from `config/locales/*.yml`, exporting them as JSON.
         | 
| 410 419 |  | 
| 411 420 | 
             
            ```js
         | 
| 412 421 | 
             
            import translations from "proscenium/i18n";
         | 
| 413 422 | 
             
            // translations.en.*
         | 
| 414 423 | 
             
            ```
         | 
| 415 424 |  | 
| 425 | 
            +
            If you have multiple locale files, they will be merged together. into one json object.
         | 
| 426 | 
            +
             | 
| 427 | 
            +
            Note that because it is assumed that you will be consuming these translations in the browser, all keys are converted to camelCase, as per the JavaScript conventions.
         | 
| 428 | 
            +
             | 
| 416 429 | 
             
            ## Javascript
         | 
| 417 430 |  | 
| 418 431 | 
             
            By default, Proscenium's output will take advantage of all modern JS features from the ES2022 spec and earlier. For example, `a !== void 0 && a !== null ? a : b` will become `a ?? b` when minifying (enabled by default in production), which makes use of syntax from the ES2020 version of JavaScript. Any syntax feature that is not supported by ES2020 will be transformed into older JavaScript syntax that is more widely supported.
         | 
| @@ -442,8 +455,6 @@ one(); | |
| 442 455 |  | 
| 443 456 | 
             
            ### Code Splitting
         | 
| 444 457 |  | 
| 445 | 
            -
            > Available in `>=0.10.0`.
         | 
| 446 | 
            -
             | 
| 447 458 | 
             
            [Side loaded](#side-loading) assets are automatically code split. This means that if you have a file that is imported and used imported several times, and by different files, it will be split off into a separate file.
         | 
| 448 459 |  | 
| 449 460 | 
             
            As an example:
         | 
| @@ -681,97 +692,8 @@ import { version } from "./package.json"; | |
| 681 692 | 
             
            console.log(version);
         | 
| 682 693 | 
             
            ```
         | 
| 683 694 |  | 
| 684 | 
            -
            ## Phlex Support
         | 
| 685 | 
            -
             | 
| 686 | 
            -
            [Phlex](https://www.phlex.fun/) is a framework for building fast, reusable, testable views in pure Ruby. Proscenium works perfectly with Phlex, with support for side-loading, CSS modules, and more. Simply write your Phlex classes and inherit from `Proscenium::Phlex`.
         | 
| 687 | 
            -
             | 
| 688 | 
            -
            ```ruby
         | 
| 689 | 
            -
            class MyView < Proscenium::Phlex
         | 
| 690 | 
            -
              def view_template
         | 
| 691 | 
            -
                h1 { 'Hello World' }
         | 
| 692 | 
            -
              end
         | 
| 693 | 
            -
            end
         | 
| 694 | 
            -
            ```
         | 
| 695 | 
            -
             | 
| 696 | 
            -
            In your layouts, include `Proscenium::Phlex::AssetInclusions`, and call the `include_assets` helper.
         | 
| 697 | 
            -
             | 
| 698 | 
            -
            ```ruby
         | 
| 699 | 
            -
            class ApplicationLayout < Proscenium::Phlex
         | 
| 700 | 
            -
              include Proscenium::Phlex::AssetInclusions # <--
         | 
| 701 | 
            -
             | 
| 702 | 
            -
              def view_template(&)
         | 
| 703 | 
            -
                doctype
         | 
| 704 | 
            -
                html do
         | 
| 705 | 
            -
                  head do
         | 
| 706 | 
            -
                    title { 'My Awesome App' }
         | 
| 707 | 
            -
                    include_assets # <--
         | 
| 708 | 
            -
                  end
         | 
| 709 | 
            -
                  body(&)
         | 
| 710 | 
            -
                end
         | 
| 711 | 
            -
              end
         | 
| 712 | 
            -
            end
         | 
| 713 | 
            -
            ```
         | 
| 714 | 
            -
             | 
| 715 | 
            -
            You can specifically include CCS and JS assets using the `include_stylesheets` and `include_javascripts` helpers, allowing you to control where they are included in the HTML.
         | 
| 716 | 
            -
             | 
| 717 | 
            -
            ### Side-loading
         | 
| 718 | 
            -
             | 
| 719 | 
            -
            Any Phlex class that inherits `Proscenium::Phlex` will automatically be [side-loaded](#side-loading).
         | 
| 720 | 
            -
             | 
| 721 | 
            -
            ### CSS Modules
         | 
| 722 | 
            -
             | 
| 723 | 
            -
            [CSS Modules](#css-modules) are fully supported in Phlex classes, with access to the [`css_module` helper](#in-your-views) if you need it. However, there is a better and more seemless way to reference CSS module classes in your Phlex classes.
         | 
| 724 | 
            -
             | 
| 725 | 
            -
            Within your Phlex classes, any class names that begin with `@` will be treated as a CSS module class.
         | 
| 726 | 
            -
             | 
| 727 | 
            -
            ```ruby
         | 
| 728 | 
            -
            # /app/views/users/show_view.rb
         | 
| 729 | 
            -
            class Users::ShowView < Proscenium::Phlex
         | 
| 730 | 
            -
              def view_template
         | 
| 731 | 
            -
                h1 class: :@user_name do
         | 
| 732 | 
            -
                  @user.name
         | 
| 733 | 
            -
                end
         | 
| 734 | 
            -
              end
         | 
| 735 | 
            -
            end
         | 
| 736 | 
            -
            ```
         | 
| 737 | 
            -
             | 
| 738 | 
            -
            ```css
         | 
| 739 | 
            -
            /* /app/views/users/show_view.module.css */
         | 
| 740 | 
            -
            .userName {
         | 
| 741 | 
            -
              color: red;
         | 
| 742 | 
            -
              font-size: 50px;
         | 
| 743 | 
            -
            }
         | 
| 744 | 
            -
            ```
         | 
| 745 | 
            -
             | 
| 746 | 
            -
            In the above `Users::ShowView` Phlex class, the `@user_name` class will be resolved to the `userName` class in the `users/show_view.module.css` file.
         | 
| 747 | 
            -
             | 
| 748 | 
            -
            The view above will be rendered something like this:
         | 
| 749 | 
            -
             | 
| 750 | 
            -
            ```html
         | 
| 751 | 
            -
            <h1 class="user_name-ABCD1234"></h1>
         | 
| 752 | 
            -
            ```
         | 
| 753 | 
            -
             | 
| 754 | 
            -
            You can of course continue to reference regular class names in your view, and they will be passed through as is. This will allow you to mix and match CSS modules and regular CSS classes in your views.
         | 
| 755 | 
            -
             | 
| 756 | 
            -
            ```ruby
         | 
| 757 | 
            -
            # /app/views/users/show_view.rb
         | 
| 758 | 
            -
            class Users::ShowView < Proscenium::Phlex
         | 
| 759 | 
            -
              def view_template
         | 
| 760 | 
            -
                h1 class: :[@user_name, :title] do
         | 
| 761 | 
            -
                  @user.name
         | 
| 762 | 
            -
                end
         | 
| 763 | 
            -
              end
         | 
| 764 | 
            -
            end
         | 
| 765 | 
            -
            ```
         | 
| 766 | 
            -
             | 
| 767 | 
            -
            ```html
         | 
| 768 | 
            -
            <h1 class="user_name-ABCD1234 title">Joel Moss</h1>
         | 
| 769 | 
            -
            ```
         | 
| 770 | 
            -
             | 
| 771 695 | 
             
            ## Cache Busting
         | 
| 772 696 |  | 
| 773 | 
            -
            > _COMING SOON_
         | 
| 774 | 
            -
             | 
| 775 697 | 
             
            By default, all assets are not cached by the browser. But if in production, you populate the `REVISION` env variable, all CSS and JS URL's will be appended with its value as a query string, and the `Cache-Control` response header will be set to `public` and a max-age of 30 days.
         | 
| 776 698 |  | 
| 777 699 | 
             
            For example, if you set `REVISION=v1`, URL's will be appended with `?v1`: `/my/imported/file.js?v1`.
         | 
    
        data/lib/proscenium/builder.rb
    CHANGED
    
    
| @@ -18,7 +18,8 @@ module Proscenium | |
| 18 18 | 
             
                  unless @css_module_path
         | 
| 19 19 | 
             
                    klass = superclass
         | 
| 20 20 |  | 
| 21 | 
            -
                    while klass.respond_to?(:css_module_path) && | 
| 21 | 
            +
                    while klass.respond_to?(:css_module_path) &&
         | 
| 22 | 
            +
                          (klass.respond_to?(:abstract_class) ? !klass.abstract_class : true)
         | 
| 22 23 | 
             
                      break if (@css_module_path = klass.css_module_path)
         | 
| 23 24 |  | 
| 24 25 | 
             
                      klass = klass.superclass
         | 
| @@ -70,7 +70,7 @@ module Proscenium | |
| 70 70 | 
             
                  digest = Importer.import(resolved_path)
         | 
| 71 71 |  | 
| 72 72 | 
             
                  transformed_path = ''
         | 
| 73 | 
            -
                  transformed_path = "__#{resolved_path[1..].gsub(%r{[ | 
| 73 | 
            +
                  transformed_path = "__#{resolved_path[1..].gsub(%r{[@/.+]}, '-')}" if Rails.env.development?
         | 
| 74 74 | 
             
                  transformed_name = name.to_s
         | 
| 75 75 | 
             
                  transformed_name = if transformed_name.start_with?('_')
         | 
| 76 76 | 
             
                                       "_#{transformed_name[1..]}-#{digest}#{transformed_path}"
         | 
| Binary file | 
    
        data/lib/proscenium/helper.rb
    CHANGED
    
    | @@ -40,18 +40,6 @@ module Proscenium | |
| 40 40 | 
             
                                        .map { |name, _| name }.join(' ')
         | 
| 41 41 | 
             
                end
         | 
| 42 42 |  | 
| 43 | 
            -
                # @param name [String,Symbol,Array<String,Symbol>]
         | 
| 44 | 
            -
                # @param path [Pathname] the path to the CSS file to use for the transformation.
         | 
| 45 | 
            -
                # @return [String] the transformed CSS module names concatenated as a string.
         | 
| 46 | 
            -
                def class_names(*names, path: nil)
         | 
| 47 | 
            -
                  names = names.flatten.compact
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                  return if names.empty?
         | 
| 50 | 
            -
             | 
| 51 | 
            -
                  path ||= Pathname.new(@lookup_context.find(@virtual_path).identifier).sub_ext('')
         | 
| 52 | 
            -
                  CssModule::Transformer.new(path).class_names(*names).map { |name, _| name }.join(' ')
         | 
| 53 | 
            -
                end
         | 
| 54 | 
            -
             | 
| 55 43 | 
             
                def include_assets
         | 
| 56 44 | 
             
                  include_stylesheets + include_javascripts
         | 
| 57 45 | 
             
                end
         | 
    
        data/lib/proscenium/importer.rb
    CHANGED
    
    
| @@ -13,10 +13,6 @@ module Proscenium | |
| 13 13 |  | 
| 14 14 | 
             
                def initialize(app)
         | 
| 15 15 | 
             
                  @app = app
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                  chunks_path = Rails.public_path.join('assets').to_s
         | 
| 18 | 
            -
                  headers = Rails.application.config.public_file_server.headers || {}
         | 
| 19 | 
            -
                  @chunk_handler = ::ActionDispatch::FileHandler.new(chunks_path, headers:)
         | 
| 20 16 | 
             
                end
         | 
| 21 17 |  | 
| 22 18 | 
             
                def call(env)
         | 
| @@ -24,23 +20,19 @@ module Proscenium | |
| 24 20 |  | 
| 25 21 | 
             
                  return @app.call(env) if !request.get? && !request.head?
         | 
| 26 22 |  | 
| 23 | 
            +
                  # If this is a request for an asset chunk, we want to serve it with a very long
         | 
| 24 | 
            +
                  # cache lifetime, since these are content-hashed and will never change.
         | 
| 27 25 | 
             
                  if request.path.match?(%r{^/_asset_chunks/})
         | 
| 28 | 
            -
                     | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
                      response.body = []
         | 
| 38 | 
            -
                    end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                    return response.finish
         | 
| 26 | 
            +
                    ::ActionDispatch::FileHandler.new(
         | 
| 27 | 
            +
                      Rails.public_path.join('assets').to_s,
         | 
| 28 | 
            +
                      headers: {
         | 
| 29 | 
            +
                        'Cache-Control' => "public, max-age=#{100.years}, immutable",
         | 
| 30 | 
            +
                        'etag' => request.path.match(/-\$([a-z0-9]+)\$/i)[1]
         | 
| 31 | 
            +
                      }
         | 
| 32 | 
            +
                    ).attempt(env) || @app.call(env)
         | 
| 33 | 
            +
                  else
         | 
| 34 | 
            +
                    attempt(request) || @app.call(env)
         | 
| 41 35 | 
             
                  end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                  attempt(request) || @app.call(env)
         | 
| 44 36 | 
             
                end
         | 
| 45 37 |  | 
| 46 38 | 
             
                private
         | 
    
        data/lib/proscenium/monkey.rb
    CHANGED
    
    | @@ -9,11 +9,11 @@ module Proscenium | |
| 9 9 | 
             
                    result = super
         | 
| 10 10 | 
             
                    return result if !view.controller || !Proscenium.config.side_load
         | 
| 11 11 |  | 
| 12 | 
            -
                    to_sideload = if template.respond_to?(: | 
| 12 | 
            +
                    to_sideload = if template.respond_to?(:identifier) &&
         | 
| 13 13 | 
             
                                     template.respond_to?(:type) && template.type == :html
         | 
| 14 14 | 
             
                                    template
         | 
| 15 15 | 
             
                                  end
         | 
| 16 | 
            -
                    if to_sideload
         | 
| 16 | 
            +
                    if to_sideload && view.controller.respond_to?(:sideload_assets_options)
         | 
| 17 17 | 
             
                      options = view.controller.sideload_assets_options
         | 
| 18 18 | 
             
                      layout = find_layout(layout_name, locals.keys, [formats.first])
         | 
| 19 19 | 
             
                      sideload_template_assets layout, view.controller, options if layout
         | 
| @@ -40,7 +40,7 @@ module Proscenium | |
| 40 40 | 
             
                      options[k] = controller.instance_eval(&options[k]) if options[k].is_a?(Proc)
         | 
| 41 41 | 
             
                    end
         | 
| 42 42 |  | 
| 43 | 
            -
                    Importer.sideload  | 
| 43 | 
            +
                    Importer.sideload Pathname.new(tpl.identifier), **options
         | 
| 44 44 | 
             
                  end
         | 
| 45 45 | 
             
                end
         | 
| 46 46 |  | 
| @@ -52,8 +52,9 @@ module Proscenium | |
| 52 52 |  | 
| 53 53 | 
             
                    return result if !view.controller || !Proscenium.config.side_load
         | 
| 54 54 |  | 
| 55 | 
            -
                    if template.respond_to?(: | 
| 56 | 
            -
                       template.respond_to?(:type) && template.type == :html
         | 
| 55 | 
            +
                    if template.respond_to?(:identifier) &&
         | 
| 56 | 
            +
                       template.respond_to?(:type) && template.type == :html &&
         | 
| 57 | 
            +
                       view.controller.respond_to?(:sideload_assets_options)
         | 
| 57 58 | 
             
                      options = view.controller.sideload_assets_options
         | 
| 58 59 | 
             
                      sideload_template_assets layout, options if layout
         | 
| 59 60 | 
             
                      sideload_template_assets template, options
         | 
| @@ -79,7 +80,7 @@ module Proscenium | |
| 79 80 | 
             
                      options[k] = controller.instance_eval(&options[k]) if options[k].is_a?(Proc)
         | 
| 80 81 | 
             
                    end
         | 
| 81 82 |  | 
| 82 | 
            -
                    Importer.sideload  | 
| 83 | 
            +
                    Importer.sideload Pathname.new(tpl.identifier), **options
         | 
| 83 84 | 
             
                  end
         | 
| 84 85 | 
             
                end
         | 
| 85 86 | 
             
              end
         | 
    
        data/lib/proscenium/railtie.rb
    CHANGED
    
    | @@ -1,7 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'rails'
         | 
| 4 | 
            -
            require 'proscenium/log_subscriber'
         | 
| 5 4 |  | 
| 6 5 | 
             
            ENV['RAILS_ENV'] = Rails.env
         | 
| 7 6 |  | 
| @@ -11,6 +10,7 @@ module Proscenium | |
| 11 10 |  | 
| 12 11 | 
             
                config.proscenium = ActiveSupport::OrderedOptions.new
         | 
| 13 12 | 
             
                config.proscenium.debug = false
         | 
| 13 | 
            +
                config.proscenium.logging = true
         | 
| 14 14 | 
             
                config.proscenium.bundle = true
         | 
| 15 15 | 
             
                config.proscenium.side_load = true
         | 
| 16 16 | 
             
                config.proscenium.code_splitting = true
         | 
| @@ -28,6 +28,11 @@ module Proscenium | |
| 28 28 | 
             
                }
         | 
| 29 29 |  | 
| 30 30 | 
             
                config.after_initialize do |_app|
         | 
| 31 | 
            +
                  if config.proscenium.logging
         | 
| 32 | 
            +
                    require 'proscenium/log_subscriber'
         | 
| 33 | 
            +
                    Proscenium::LogSubscriber.attach_to :proscenium
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 31 36 | 
             
                  ActiveSupport.on_load(:action_view) do
         | 
| 32 37 | 
             
                    include Proscenium::Helper
         | 
| 33 38 | 
             
                  end
         | 
| @@ -11,7 +11,7 @@ module Proscenium | |
| 11 11 | 
             
                  # The HTML tag to use as the wrapping element for the component. You can reassign this in your
         | 
| 12 12 | 
             
                  # component class to use a different tag:
         | 
| 13 13 | 
             
                  #
         | 
| 14 | 
            -
                  #   class MyComponent < Proscenium:: | 
| 14 | 
            +
                  #   class MyComponent < Proscenium::ReactComponent
         | 
| 15 15 | 
             
                  #     self.root_tag = :span
         | 
| 16 16 | 
             
                  #   end
         | 
| 17 17 | 
             
                  #
         | 
    
        data/lib/proscenium/side_load.rb
    CHANGED
    
    | @@ -116,7 +116,8 @@ module Proscenium | |
| 116 116 | 
             
                    css_imports = []
         | 
| 117 117 |  | 
| 118 118 | 
             
                    klass = obj.class
         | 
| 119 | 
            -
                    while klass.respond_to?(:source_path) && klass.source_path && | 
| 119 | 
            +
                    while klass.respond_to?(:source_path) && klass.source_path &&
         | 
| 120 | 
            +
                          (klass.respond_to?(:abstract_class) ? !klass.abstract_class : true)
         | 
| 120 121 | 
             
                      if options[:css] == false
         | 
| 121 122 | 
             
                        Importer.sideload klass.source_path, **options
         | 
| 122 123 | 
             
                      else
         | 
| @@ -133,7 +134,7 @@ module Proscenium | |
| 133 134 | 
             
                    # in the ancestry is also sideloaded in addition to the regular CSS files. This is because
         | 
| 134 135 | 
             
                    # the CSS module digest will be different for each file, so we only sideload the first CSS
         | 
| 135 136 | 
             
                    # module.
         | 
| 136 | 
            -
                    css_imports.each do |it|
         | 
| 137 | 
            +
                    css_imports.each do |it| # rubocop:disable Style/ItAssignment
         | 
| 137 138 | 
             
                      break if Importer.sideload_css_module(it, **options).present?
         | 
| 138 139 | 
             
                    end
         | 
| 139 140 |  | 
| @@ -142,7 +143,7 @@ module Proscenium | |
| 142 143 | 
             
                    # The reason why we sideload CSS after JS is because the order of CSS is important.
         | 
| 143 144 | 
             
                    # Basically, the layout should be loaded before the view so that CSS cascading works in the
         | 
| 144 145 | 
             
                    # right direction.
         | 
| 145 | 
            -
                    css_imports.reverse_each do |it|
         | 
| 146 | 
            +
                    css_imports.reverse_each do |it| # rubocop:disable Style/ItAssignment
         | 
| 146 147 | 
             
                      Importer.sideload_css it, **options
         | 
| 147 148 | 
             
                    end
         | 
| 148 149 | 
             
                  end
         | 
    
        data/lib/proscenium/version.rb
    CHANGED
    
    
    
        data/lib/proscenium.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: proscenium
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.20.0
         | 
| 5 5 | 
             
            platform: aarch64-linux
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Joel Moss
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2025- | 
| 11 | 
            +
            date: 2025-10-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: ffi
         | 
| @@ -24,34 +24,6 @@ dependencies: | |
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: 1.17.0
         | 
| 27 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name: phlex-rails
         | 
| 29 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            -
                requirements:
         | 
| 31 | 
            -
                - - "~>"
         | 
| 32 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: '1.2'
         | 
| 34 | 
            -
              type: :runtime
         | 
| 35 | 
            -
              prerelease: false
         | 
| 36 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            -
                requirements:
         | 
| 38 | 
            -
                - - "~>"
         | 
| 39 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '1.2'
         | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: prism
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - ">="
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '0'
         | 
| 48 | 
            -
              type: :runtime
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - ">="
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '0'
         | 
| 55 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 28 | 
             
              name: rails
         | 
| 57 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -72,20 +44,6 @@ dependencies: | |
| 72 44 | 
             
                - - "<"
         | 
| 73 45 | 
             
                  - !ruby/object:Gem::Version
         | 
| 74 46 | 
             
                    version: '9.0'
         | 
| 75 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 76 | 
            -
              name: require-hooks
         | 
| 77 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 78 | 
            -
                requirements:
         | 
| 79 | 
            -
                - - "~>"
         | 
| 80 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 81 | 
            -
                    version: '0.2'
         | 
| 82 | 
            -
              type: :runtime
         | 
| 83 | 
            -
              prerelease: false
         | 
| 84 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 85 | 
            -
                requirements:
         | 
| 86 | 
            -
                - - "~>"
         | 
| 87 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 88 | 
            -
                    version: '0.2'
         | 
| 89 47 | 
             
            description:
         | 
| 90 48 | 
             
            email:
         | 
| 91 49 | 
             
            - joel@developwithstyle.com
         | 
| @@ -101,7 +59,6 @@ files: | |
| 101 59 | 
             
            - lib/proscenium/bundled_gems.rb
         | 
| 102 60 | 
             
            - lib/proscenium/css_module.rb
         | 
| 103 61 | 
             
            - lib/proscenium/css_module/path.rb
         | 
| 104 | 
            -
            - lib/proscenium/css_module/rewriter.rb
         | 
| 105 62 | 
             
            - lib/proscenium/css_module/transformer.rb
         | 
| 106 63 | 
             
            - lib/proscenium/ensure_loaded.rb
         | 
| 107 64 | 
             
            - lib/proscenium/ext/proscenium
         | 
| @@ -114,10 +71,6 @@ files: | |
| 114 71 | 
             
            - lib/proscenium/middleware/esbuild.rb
         | 
| 115 72 | 
             
            - lib/proscenium/middleware/ruby_gems.rb
         | 
| 116 73 | 
             
            - lib/proscenium/monkey.rb
         | 
| 117 | 
            -
            - lib/proscenium/phlex.rb
         | 
| 118 | 
            -
            - lib/proscenium/phlex/asset_inclusions.rb
         | 
| 119 | 
            -
            - lib/proscenium/phlex/css_modules.rb
         | 
| 120 | 
            -
            - lib/proscenium/phlex/react_component.rb
         | 
| 121 74 | 
             
            - lib/proscenium/railtie.rb
         | 
| 122 75 | 
             
            - lib/proscenium/react-manager/index.jsx
         | 
| 123 76 | 
             
            - lib/proscenium/react-manager/react.js
         | 
| @@ -1,76 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'prism'
         | 
| 4 | 
            -
            require 'require-hooks/setup'
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            module Proscenium
         | 
| 7 | 
            -
              module CssModule
         | 
| 8 | 
            -
                class Rewriter
         | 
| 9 | 
            -
                  def self.init(include: [], exclude: [])
         | 
| 10 | 
            -
                    RequireHooks.source_transform(
         | 
| 11 | 
            -
                      patterns: include,
         | 
| 12 | 
            -
                      exclude_patterns: exclude
         | 
| 13 | 
            -
                    ) do |path, source|
         | 
| 14 | 
            -
                      source ||= File.read(path)
         | 
| 15 | 
            -
                      Processor.call(source)
         | 
| 16 | 
            -
                    end
         | 
| 17 | 
            -
                  end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                  class Processor < Prism::Visitor
         | 
| 20 | 
            -
                    def self.call(source)
         | 
| 21 | 
            -
                      visitor = new
         | 
| 22 | 
            -
                      visitor.visit(Prism.parse(source).value)
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                      buffer = source.dup
         | 
| 25 | 
            -
                      annotations = visitor.annotations
         | 
| 26 | 
            -
                      annotations.sort_by!(&:first)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                      annotations.reverse_each do |offset, action|
         | 
| 29 | 
            -
                        case action
         | 
| 30 | 
            -
                        when :start
         | 
| 31 | 
            -
                          buffer.insert(offset, 'class_names(*')
         | 
| 32 | 
            -
                        when :end
         | 
| 33 | 
            -
                          buffer.insert(offset, ')')
         | 
| 34 | 
            -
                        else
         | 
| 35 | 
            -
                          raise 'Invalid annotation'
         | 
| 36 | 
            -
                        end
         | 
| 37 | 
            -
                      end
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                      buffer
         | 
| 40 | 
            -
                    end
         | 
| 41 | 
            -
             | 
| 42 | 
            -
                    def initialize
         | 
| 43 | 
            -
                      @annotations = []
         | 
| 44 | 
            -
                    end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                    PREFIX = '@'
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                    attr_reader :annotations
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                    def visit_assoc_node(node)
         | 
| 51 | 
            -
                      # Skip if the key is not a symbol or string
         | 
| 52 | 
            -
                      return if %i[symbol_node string_node].exclude?(node.key.type)
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                      return if node.key.type == :symbol_node && node.key.value != 'class'
         | 
| 55 | 
            -
                      return if node.key.type == :string_node && node.key.content != 'class'
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                      value = node.value
         | 
| 58 | 
            -
                      type = value.type
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                      if (type == :symbol_node && value.value.start_with?(PREFIX)) ||
         | 
| 61 | 
            -
                         (type == :array_node && value.elements.any? { |it| it.value.start_with?(PREFIX) })
         | 
| 62 | 
            -
                        build_annotation value
         | 
| 63 | 
            -
                      end
         | 
| 64 | 
            -
                    end
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                    def build_annotation(value)
         | 
| 67 | 
            -
                      location = value.location
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                      @annotations <<
         | 
| 70 | 
            -
                        [location.start_character_offset, :start] <<
         | 
| 71 | 
            -
                        [location.end_character_offset, :end]
         | 
| 72 | 
            -
                    end
         | 
| 73 | 
            -
                  end
         | 
| 74 | 
            -
                end
         | 
| 75 | 
            -
              end
         | 
| 76 | 
            -
            end
         | 
| @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Proscenium::Phlex::AssetInclusions
         | 
| 4 | 
            -
              def include_stylesheets
         | 
| 5 | 
            -
                comment { '[PROSCENIUM_STYLESHEETS]' }
         | 
| 6 | 
            -
              end
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              def include_javascripts
         | 
| 9 | 
            -
                comment { '[PROSCENIUM_JAVASCRIPTS]' }
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
              def include_assets
         | 
| 13 | 
            -
                include_stylesheets
         | 
| 14 | 
            -
                include_javascripts
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
            end
         | 
| @@ -1,80 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Proscenium
         | 
| 4 | 
            -
              module Phlex::CssModules
         | 
| 5 | 
            -
                def self.included(base)
         | 
| 6 | 
            -
                  base.extend CssModule::Path
         | 
| 7 | 
            -
                  base.extend ClassMethods
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                module ClassMethods
         | 
| 11 | 
            -
                  # Set of CSS module paths that have been resolved after being transformed from 'class' HTML
         | 
| 12 | 
            -
                  # attributes. See #process_attributes. This is here because Phlex caches attributes. Which
         | 
| 13 | 
            -
                  # means while the CSS class names will be transformed, any resolved paths will be lost in
         | 
| 14 | 
            -
                  # subsequent requests.
         | 
| 15 | 
            -
                  attr_accessor :resolved_css_module_paths
         | 
| 16 | 
            -
                end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                def before_template
         | 
| 19 | 
            -
                  self.class.resolved_css_module_paths ||= Concurrent::Set.new
         | 
| 20 | 
            -
                  super
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                def after_template
         | 
| 24 | 
            -
                  self.class.resolved_css_module_paths ||= Concurrent::Set.new
         | 
| 25 | 
            -
                  self.class.resolved_css_module_paths.each do |path|
         | 
| 26 | 
            -
                    Proscenium::Importer.import path, sideloaded: true
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                  super
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                # Resolve and side load any CSS modules in the "class" attributes, where a CSS module is a class
         | 
| 33 | 
            -
                # name beginning with a `@`. The class name is resolved to a CSS module name based on the file
         | 
| 34 | 
            -
                # system path of the Phlex class, and any CSS file is side loaded.
         | 
| 35 | 
            -
                #
         | 
| 36 | 
            -
                # For example, the following will side load the CSS module file at
         | 
| 37 | 
            -
                # app/components/user/component.module.css, and add the CSS Module name `user_name` to the
         | 
| 38 | 
            -
                # <div>.
         | 
| 39 | 
            -
                #
         | 
| 40 | 
            -
                #   # app/components/user/component.rb
         | 
| 41 | 
            -
                #   class User::Component < Proscenium::Phlex
         | 
| 42 | 
            -
                #     def view_template
         | 
| 43 | 
            -
                #       div class: :@user_name do
         | 
| 44 | 
            -
                #         'Joel Moss'
         | 
| 45 | 
            -
                #       end
         | 
| 46 | 
            -
                #     end
         | 
| 47 | 
            -
                #   end
         | 
| 48 | 
            -
                #
         | 
| 49 | 
            -
                # Additionally, any class name containing a `/` is resolved as a CSS module path. Allowing you
         | 
| 50 | 
            -
                # to use the same syntax as a CSS module, but without the need to manually import the CSS file.
         | 
| 51 | 
            -
                #
         | 
| 52 | 
            -
                # For example, the following will side load the CSS module file at /lib/users.module.css, and
         | 
| 53 | 
            -
                # add the CSS Module name `name` to the <div>.
         | 
| 54 | 
            -
                #
         | 
| 55 | 
            -
                #   class User::Component < Proscenium::Phlex
         | 
| 56 | 
            -
                #     def view_template
         | 
| 57 | 
            -
                #       div class: '/lib/users@name' do
         | 
| 58 | 
            -
                #         'Joel Moss'
         | 
| 59 | 
            -
                #       end
         | 
| 60 | 
            -
                #     end
         | 
| 61 | 
            -
                #   end
         | 
| 62 | 
            -
                #
         | 
| 63 | 
            -
                # @raise [Proscenium::CssModule::Resolver::NotFound] If a CSS module file is not found for the
         | 
| 64 | 
            -
                #   Phlex class file path.
         | 
| 65 | 
            -
                def process_attributes(**attributes)
         | 
| 66 | 
            -
                  if attributes.key?(:class) && (attributes[:class] = tokens(attributes[:class])).include?('@')
         | 
| 67 | 
            -
                    names = attributes[:class].is_a?(Array) ? attributes[:class] : attributes[:class].split
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                    self.class.resolved_css_module_paths ||= Concurrent::Set.new
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                    attributes[:class] = cssm.class_names(*names).map do |name, path|
         | 
| 72 | 
            -
                      self.class.resolved_css_module_paths << path if path
         | 
| 73 | 
            -
                      name
         | 
| 74 | 
            -
                    end
         | 
| 75 | 
            -
                  end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                  attributes
         | 
| 78 | 
            -
                end
         | 
| 79 | 
            -
              end
         | 
| 80 | 
            -
            end
         | 
| @@ -1,32 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Proscenium
         | 
| 4 | 
            -
              # Renders a <div> for use with React components, with data attributes specifying the component
         | 
| 5 | 
            -
              # path and props.
         | 
| 6 | 
            -
              #
         | 
| 7 | 
            -
              # If a block is given, it will be yielded within the div, allowing for a custom "loading" UI. If
         | 
| 8 | 
            -
              # no block is given, then a "loading..." text will be rendered. It is intended that the component
         | 
| 9 | 
            -
              # is mounted to this div, and the loading UI will then be replaced with the component's rendered
         | 
| 10 | 
            -
              # output.
         | 
| 11 | 
            -
              #
         | 
| 12 | 
            -
              # You can pass props to the component in the `:props` keyword argument.
         | 
| 13 | 
            -
              class Phlex::ReactComponent < Phlex
         | 
| 14 | 
            -
                self.abstract_class = true
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                include ReactComponentable
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                # Override this to provide your own loading UI.
         | 
| 19 | 
            -
                #
         | 
| 20 | 
            -
                # @example
         | 
| 21 | 
            -
                #   def view_template(**attributes, &block)
         | 
| 22 | 
            -
                #     super do
         | 
| 23 | 
            -
                #       'Look at me! I am loading now...'
         | 
| 24 | 
            -
                #     end
         | 
| 25 | 
            -
                #   end
         | 
| 26 | 
            -
                #
         | 
| 27 | 
            -
                # @yield the given block to a `div` within the top level component div.
         | 
| 28 | 
            -
                def view_template(**attributes, &)
         | 
| 29 | 
            -
                  send(root_tag, **{ data: data_attributes }.deep_merge(attributes), &)
         | 
| 30 | 
            -
                end
         | 
| 31 | 
            -
              end
         | 
| 32 | 
            -
            end
         | 
    
        data/lib/proscenium/phlex.rb
    DELETED
    
    | @@ -1,43 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'phlex-rails'
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            module Proscenium
         | 
| 6 | 
            -
              class Phlex < ::Phlex::HTML
         | 
| 7 | 
            -
                extend ActiveSupport::Autoload
         | 
| 8 | 
            -
             | 
| 9 | 
            -
                autoload :CssModules
         | 
| 10 | 
            -
                autoload :ReactComponent
         | 
| 11 | 
            -
                autoload :AssetInclusions
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                include Proscenium::SourcePath
         | 
| 14 | 
            -
                include Proscenium::CssModule
         | 
| 15 | 
            -
                include CssModules
         | 
| 16 | 
            -
                include AssetInclusions
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                module Sideload
         | 
| 19 | 
            -
                  def before_template
         | 
| 20 | 
            -
                    Proscenium::SideLoad.sideload_inheritance_chain self,
         | 
| 21 | 
            -
                                                                    helpers.controller.sideload_assets_options
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                    super
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                class_attribute :sideload_assets_options
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                class << self
         | 
| 30 | 
            -
                  attr_accessor :abstract_class
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                  def inherited(child)
         | 
| 33 | 
            -
                    child.prepend Sideload
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                    super
         | 
| 36 | 
            -
                  end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                  def sideload_assets(value)
         | 
| 39 | 
            -
                    self.sideload_assets_options = value
         | 
| 40 | 
            -
                  end
         | 
| 41 | 
            -
                end
         | 
| 42 | 
            -
              end
         | 
| 43 | 
            -
            end
         |