proscenium 0.2.1-arm64-darwin → 0.4.0-arm64-darwin
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/bin/esbuild +0 -0
 - data/lib/proscenium/compilers/esbuild/env_plugin.js +24 -3
 - data/lib/proscenium/phlex/component.rb +9 -0
 - data/lib/proscenium/phlex/react_component.rb +25 -0
 - data/lib/proscenium/phlex.rb +24 -0
 - data/lib/proscenium/version.rb +1 -1
 - data/{app/components → lib/proscenium/view_component}/react_component.rb +2 -2
 - data/lib/proscenium/view_component.rb +5 -2
 - metadata +19 -4
 - data/app/components/application_component.rb +0 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3a71069b55cb923c3557b54da0f5bfda8f63b862f3c223e1e2f1408242195c1f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: cbe7532e87bcbac6c3a16444781c09cdd59792edce998b2b1c1c8a0ef57a6803
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ff89bc3894fcb917891cd567afb148e47d96055f9ab19a1b530694195c6f4d30f5ce2ed861347b742db3fc4872251f0bf2d9b184352cd7800d5a4a5c23b33dea
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 147faf9f9295ce0aa82815aa8465bad5ae95eeb064f485526c6fc41696de0e775db2da8942117a574ee6dc44b631517d516d3ec0b6e29a3eb512a5758d507aa2
         
     | 
    
        data/bin/esbuild
    CHANGED
    
    | 
         Binary file 
     | 
| 
         @@ -1,10 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import setup from './setup_plugin.js'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            // Export environment variables as named exports only. You can also import from `env:ENV_VAR_NAME`,
         
     | 
| 
      
 4 
     | 
    
         
            +
            // which will return the value of the environment variable as the default export. This allows you to
         
     | 
| 
      
 5 
     | 
    
         
            +
            // safely import a variable regardless of its existence.
         
     | 
| 
       3 
6 
     | 
    
         
             
            export default setup('env', () => {
         
     | 
| 
       4 
7 
     | 
    
         
             
              return [
         
     | 
| 
       5 
8 
     | 
    
         
             
                {
         
     | 
| 
       6 
9 
     | 
    
         
             
                  type: 'onResolve',
         
     | 
| 
       7 
     | 
    
         
            -
                  filter: /^env 
     | 
| 
      
 10 
     | 
    
         
            +
                  filter: /^env(:.+)?$/,
         
     | 
| 
       8 
11 
     | 
    
         
             
                  callback({ path }) {
         
     | 
| 
       9 
12 
     | 
    
         
             
                    return { path, namespace: 'env' }
         
     | 
| 
       10 
13 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -14,9 +17,27 @@ export default setup('env', () => { 
     | 
|
| 
       14 
17 
     | 
    
         
             
                  type: 'onLoad',
         
     | 
| 
       15 
18 
     | 
    
         
             
                  filter: /.*/,
         
     | 
| 
       16 
19 
     | 
    
         
             
                  namespace: 'env',
         
     | 
| 
       17 
     | 
    
         
            -
                  callback() {
         
     | 
| 
      
 20 
     | 
    
         
            +
                  callback({ path }) {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    if (path.includes(':')) {
         
     | 
| 
      
 22 
     | 
    
         
            +
                      return {
         
     | 
| 
      
 23 
     | 
    
         
            +
                        loader: 'js',
         
     | 
| 
      
 24 
     | 
    
         
            +
                        contents: `export default ${Deno.env.get(path.split(':')[1])}`
         
     | 
| 
      
 25 
     | 
    
         
            +
                      }
         
     | 
| 
      
 26 
     | 
    
         
            +
                    }
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       18 
28 
     | 
    
         
             
                    const env = Deno.env.toObject()
         
     | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
      
 29 
     | 
    
         
            +
                    const contents = []
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                    for (const key in env) {
         
     | 
| 
      
 32 
     | 
    
         
            +
                      if (Object.hasOwnProperty.call(env, key)) {
         
     | 
| 
      
 33 
     | 
    
         
            +
                        contents.push(`export const ${key} = '${env[key]}'`)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      }
         
     | 
| 
      
 35 
     | 
    
         
            +
                    }
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    return {
         
     | 
| 
      
 38 
     | 
    
         
            +
                      loader: 'js',
         
     | 
| 
      
 39 
     | 
    
         
            +
                      contents: contents.join(';')
         
     | 
| 
      
 40 
     | 
    
         
            +
                    }
         
     | 
| 
       20 
41 
     | 
    
         
             
                  }
         
     | 
| 
       21 
42 
     | 
    
         
             
                }
         
     | 
| 
       22 
43 
     | 
    
         
             
              ]
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Renders a div for use with component-manager.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            class Proscenium::Phlex::ReactComponent < Proscenium::Phlex::Component
         
     | 
| 
      
 7 
     | 
    
         
            +
              attr_accessor :props, :lazy
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              # @param props: [Hash]
         
     | 
| 
      
 10 
     | 
    
         
            +
              # @param lazy: [Boolean] Lazy load the component using IntersectionObserver. Default: true.
         
     | 
| 
      
 11 
     | 
    
         
            +
              def initialize(props: {}, lazy: true) # rubocop:disable Lint/MissingSuper
         
     | 
| 
      
 12 
     | 
    
         
            +
                @props = props
         
     | 
| 
      
 13 
     | 
    
         
            +
                @lazy = lazy
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              # @yield the given block to a `div` within the top level component div. If not given,
         
     | 
| 
      
 17 
     | 
    
         
            +
              #   `<div>loading...</div>` will be rendered. Use this to display a loading UI while the component
         
     | 
| 
      
 18 
     | 
    
         
            +
              #   is loading and rendered.
         
     | 
| 
      
 19 
     | 
    
         
            +
              def template(&block)
         
     | 
| 
      
 20 
     | 
    
         
            +
                div class: ['componentManagedByProscenium', '@component'],
         
     | 
| 
      
 21 
     | 
    
         
            +
                    data: { component: { path: virtual_path, props: props, lazy: lazy }.to_json } do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  block ? div(&block) : div { 'loading...' }
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/proscenium/phlex.rb
    CHANGED
    
    | 
         @@ -1,7 +1,30 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require 'phlex'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       3 
5 
     | 
    
         
             
            module Proscenium
         
     | 
| 
       4 
6 
     | 
    
         
             
              class Phlex < ::Phlex::View
         
     | 
| 
      
 7 
     | 
    
         
            +
                extend ActiveSupport::Autoload
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                autoload :Component
         
     | 
| 
      
 10 
     | 
    
         
            +
                autoload :ReactComponent
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                module Helpers
         
     | 
| 
      
 13 
     | 
    
         
            +
                  def side_load_javascripts(...)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    if (output = @_view_context.side_load_javascripts(...))
         
     | 
| 
      
 15 
     | 
    
         
            +
                      @_target << output
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  %i[side_load_stylesheets proscenium_dev].each do |name|
         
     | 
| 
      
 20 
     | 
    
         
            +
                    define_method name do
         
     | 
| 
      
 21 
     | 
    
         
            +
                      if (output = @_view_context.send(name))
         
     | 
| 
      
 22 
     | 
    
         
            +
                        @_target << output
         
     | 
| 
      
 23 
     | 
    
         
            +
                      end
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       5 
28 
     | 
    
         
             
                module Sideload
         
     | 
| 
       6 
29 
     | 
    
         
             
                  def template(...)
         
     | 
| 
       7 
30 
     | 
    
         
             
                    Proscenium::SideLoad.append self.class.path if Rails.application.config.proscenium.side_load
         
     | 
| 
         @@ -18,6 +41,7 @@ module Proscenium 
     | 
|
| 
       18 
41 
     | 
    
         
             
                    child.path = path.delete_prefix(::Rails.root.to_s).delete_suffix('.rb')[1..]
         
     | 
| 
       19 
42 
     | 
    
         | 
| 
       20 
43 
     | 
    
         
             
                    child.prepend Sideload
         
     | 
| 
      
 44 
     | 
    
         
            +
                    child.include Helpers
         
     | 
| 
       21 
45 
     | 
    
         | 
| 
       22 
46 
     | 
    
         
             
                    super
         
     | 
| 
       23 
47 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/proscenium/version.rb
    CHANGED
    
    
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            class ReactComponent <  
     | 
| 
      
 3 
     | 
    
         
            +
            class Proscenium::ViewComponent::ReactComponent < Proscenium::ViewComponent
         
     | 
| 
       4 
4 
     | 
    
         
             
              attr_accessor :props, :lazy
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
              # @param props: [Hash]
         
     | 
| 
         @@ -15,7 +15,7 @@ class ReactComponent < ApplicationComponent 
     | 
|
| 
       15 
15 
     | 
    
         
             
              def call
         
     | 
| 
       16 
16 
     | 
    
         
             
                tag.div class: ['componentManagedByProscenium', css_module(:component)],
         
     | 
| 
       17 
17 
     | 
    
         
             
                        data: { component: { path: virtual_path, props: props, lazy: lazy } } do
         
     | 
| 
       18 
     | 
    
         
            -
                  tag.div content
         
     | 
| 
      
 18 
     | 
    
         
            +
                  tag.div content || 'loading...'
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,12 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'view_component'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class Proscenium::ViewComponent < ViewComponent::Base
         
     | 
| 
       4 
6 
     | 
    
         
             
              extend ActiveSupport::Autoload
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
8 
     | 
    
         
             
              autoload :TagBuilder
         
     | 
| 
      
 9 
     | 
    
         
            +
              autoload :ReactComponent
         
     | 
| 
       7 
10 
     | 
    
         | 
| 
       8 
11 
     | 
    
         
             
              def render_in(...)
         
     | 
| 
       9 
     | 
    
         
            -
                cssm.compile_class_names(super)
         
     | 
| 
      
 12 
     | 
    
         
            +
                cssm.compile_class_names(super(...))
         
     | 
| 
       10 
13 
     | 
    
         
             
              end
         
     | 
| 
       11 
14 
     | 
    
         | 
| 
       12 
15 
     | 
    
         
             
              def before_render
         
     | 
    
        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.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: arm64-darwin
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Joel Moss
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-10-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: actioncable
         
     | 
| 
         @@ -92,6 +92,20 @@ dependencies: 
     | 
|
| 
       92 
92 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       93 
93 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       94 
94 
     | 
    
         
             
                    version: '3.13'
         
     | 
| 
      
 95 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 96 
     | 
    
         
            +
              name: phlex
         
     | 
| 
      
 97 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 98 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 99 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 100 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 101 
     | 
    
         
            +
                    version: 0.4.0
         
     | 
| 
      
 102 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 103 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 104 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 105 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 106 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 107 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 108 
     | 
    
         
            +
                    version: 0.4.0
         
     | 
| 
       95 
109 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       96 
110 
     | 
    
         
             
              name: railties
         
     | 
| 
       97 
111 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -140,8 +154,6 @@ files: 
     | 
|
| 
       140 
154 
     | 
    
         
             
            - README.md
         
     | 
| 
       141 
155 
     | 
    
         
             
            - app/channels/proscenium/connection.rb
         
     | 
| 
       142 
156 
     | 
    
         
             
            - app/channels/proscenium/reload_channel.rb
         
     | 
| 
       143 
     | 
    
         
            -
            - app/components/application_component.rb
         
     | 
| 
       144 
     | 
    
         
            -
            - app/components/react_component.rb
         
     | 
| 
       145 
157 
     | 
    
         
             
            - bin/esbuild
         
     | 
| 
       146 
158 
     | 
    
         
             
            - bin/lightningcss
         
     | 
| 
       147 
159 
     | 
    
         
             
            - config/routes.rb
         
     | 
| 
         @@ -171,6 +183,8 @@ files: 
     | 
|
| 
       171 
183 
     | 
    
         
             
            - lib/proscenium/middleware/runtime.rb
         
     | 
| 
       172 
184 
     | 
    
         
             
            - lib/proscenium/middleware/static.rb
         
     | 
| 
       173 
185 
     | 
    
         
             
            - lib/proscenium/phlex.rb
         
     | 
| 
      
 186 
     | 
    
         
            +
            - lib/proscenium/phlex/component.rb
         
     | 
| 
      
 187 
     | 
    
         
            +
            - lib/proscenium/phlex/react_component.rb
         
     | 
| 
       174 
188 
     | 
    
         
             
            - lib/proscenium/precompile.rb
         
     | 
| 
       175 
189 
     | 
    
         
             
            - lib/proscenium/railtie.rb
         
     | 
| 
       176 
190 
     | 
    
         
             
            - lib/proscenium/runtime/auto_reload.js
         
     | 
| 
         @@ -180,6 +194,7 @@ files: 
     | 
|
| 
       180 
194 
     | 
    
         
             
            - lib/proscenium/utils.js
         
     | 
| 
       181 
195 
     | 
    
         
             
            - lib/proscenium/version.rb
         
     | 
| 
       182 
196 
     | 
    
         
             
            - lib/proscenium/view_component.rb
         
     | 
| 
      
 197 
     | 
    
         
            +
            - lib/proscenium/view_component/react_component.rb
         
     | 
| 
       183 
198 
     | 
    
         
             
            - lib/proscenium/view_component/tag_builder.rb
         
     | 
| 
       184 
199 
     | 
    
         
             
            - lib/tasks/assets.rake
         
     | 
| 
       185 
200 
     | 
    
         
             
            homepage: https://github.com/joelmoss/proscenium
         
     |