proscenium 0.17.0-arm64-darwin → 0.18.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 937b6e0f9452ff63dda1b46b39fe120e592d0dfa0477f14b0df55e5a755c5321
4
- data.tar.gz: 3fce8038c65d3c478983a62c4e108e885bc28b8dff6e01dba37e4cd237fc14dd
3
+ metadata.gz: 97b6762190186f202a4c47c31df4b917b1ac8aba94617a556bab8a3b405f10cb
4
+ data.tar.gz: 1aafadc1a8b26192d92982399e00552e3e2e21c2fe2cabb1699e2ce5bc19a371
5
5
  SHA512:
6
- metadata.gz: c8160f6c0bfd5362f0a3b35ffdd6d860e30701ab13111fcc1752688321196c5a73803150d3b617fa7f7d1297aedb8892d7374708d22b56e4909124dee04636a4
7
- data.tar.gz: 5138c19dc2ce1fba33dbf03b7c1f19f1c4de145f00f1aaa7048048ef926183f8abaf908c83d799520fa3eb5ec7dc29c2565c54fabd1f0481738d8b5bb382b7ec
6
+ metadata.gz: 955b20a69c4dab9a8ec2fc17892a819dbda39ddfb440e9a0a7b184f3f124f40a82dcb4b31c46c13b91d231b66811399fb465e493ce6399499583c27a15309bce
7
+ data.tar.gz: e10d3aec815547b202fffa97242f40afd76f16e8adf01405192135f26dc267cb271fa0e54560931775cba61b24d88a9ac3f0bccf9ba594fa2cd02ee8e9f9d9c3
data/README.md CHANGED
@@ -890,7 +890,7 @@ bundle exec rake compile:local
890
890
  We have tests for both Ruby and Go. To run the Ruby tests:
891
891
 
892
892
  ```bash
893
- bundle exec sus
893
+ bin/test
894
894
  ```
895
895
 
896
896
  To run the Go tests:
Binary file
@@ -21,12 +21,10 @@ module Proscenium
21
21
  # /app/javascript.
22
22
  def compute_asset_path(path, options = {})
23
23
  if %i[javascript stylesheet].include?(options[:type])
24
- if !path.start_with?("./", "../")
25
- path.prepend DEFAULT_RAILS_ASSET_PATHS[options[:type]]
26
- end
24
+ path.prepend DEFAULT_RAILS_ASSET_PATHS[options[:type]] unless path.start_with?('./', '../')
27
25
 
28
26
  result = Proscenium::Builder.build_to_path(path, base_url: request.base_url)
29
- return result.split("::").last.delete_prefix "public"
27
+ return result.split('::').last.delete_prefix 'public'
30
28
  end
31
29
 
32
30
  super
@@ -61,7 +59,7 @@ module Proscenium
61
59
  end
62
60
 
63
61
  def include_stylesheets
64
- '<!-- [PROSCENIUM_STYLESHEETS] -->'.html_safe
62
+ SideLoad::CSS_COMMENT.html_safe
65
63
  end
66
64
  alias side_load_stylesheets include_stylesheets
67
65
  deprecate side_load_stylesheets: 'Use `include_stylesheets` instead', deprecator: Deprecator.new
@@ -70,7 +68,7 @@ module Proscenium
70
68
  #
71
69
  # @return [String] the HTML tags for the javascripts.
72
70
  def include_javascripts
73
- '<!-- [PROSCENIUM_LAZY_SCRIPTS] --><!-- [PROSCENIUM_JAVASCRIPTS] -->'.html_safe
71
+ (SideLoad::LAZY_COMMENT + SideLoad::JS_COMMENT).html_safe
74
72
  end
75
73
  alias side_load_javascripts include_javascripts
76
74
  deprecate side_load_javascripts: 'Use `include_javascripts` instead', deprecator: Deprecator.new
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Proscenium
4
4
  class SideLoad
5
+ JS_COMMENT = '<!-- [PROSCENIUM_JAVASCRIPTS] -->'
6
+ CSS_COMMENT = '<!-- [PROSCENIUM_STYLESHEETS] -->'
7
+ LAZY_COMMENT = '<!-- [PROSCENIUM_LAZY_SCRIPTS] -->'
8
+
5
9
  module Controller
6
10
  def self.included(child)
7
11
  child.class_eval do
@@ -23,7 +27,13 @@ module Proscenium
23
27
  def capture_and_replace_proscenium_stylesheets
24
28
  return if response_body.nil?
25
29
  return if response_body.first.blank? || !Proscenium::Importer.css_imported?
26
- return unless response_body.first.include? '<!-- [PROSCENIUM_STYLESHEETS] -->'
30
+
31
+ included_comment = response_body.first.include?(CSS_COMMENT)
32
+ fragments = if (fragment_header = request.headers['X-Fragment'])
33
+ fragment_header.split
34
+ end
35
+
36
+ return if !fragments && !included_comment
27
37
 
28
38
  imports = Proscenium::Importer.imported.dup
29
39
  paths_to_build = []
@@ -44,12 +54,17 @@ module Proscenium
44
54
 
45
55
  import = imports[inpath]
46
56
  opts = import[:css].is_a?(Hash) ? import[:css] : {}
57
+ opts[:preload_links_header] = false if fragments
47
58
  opts[:data] ||= {}
48
59
  opts[:data][:original_href] = inpath
49
60
  out << helpers.stylesheet_link_tag(outpath, extname: false, **opts)
50
61
  end
51
62
 
52
- response_body.first.gsub! '<!-- [PROSCENIUM_STYLESHEETS] -->', out.join.html_safe
63
+ if fragments
64
+ response_body.first.prepend out.join.html_safe
65
+ elsif included_comment
66
+ response_body.first.gsub! CSS_COMMENT, out.join.html_safe
67
+ end
53
68
  end
54
69
 
55
70
  def capture_and_replace_proscenium_javascripts
@@ -65,7 +80,13 @@ module Proscenium
65
80
  result = Proscenium::Builder.build_to_path(paths_to_build.join(';'),
66
81
  base_url: helpers.request.base_url)
67
82
 
68
- if response_body.first.include? '<!-- [PROSCENIUM_JAVASCRIPTS] -->'
83
+ included_js_comment = response_body.first.include?(JS_COMMENT)
84
+ included_lazy_comment = response_body.first.include?(LAZY_COMMENT)
85
+ fragments = if (fragment_header = request.headers['X-Fragment'])
86
+ fragment_header.split
87
+ end
88
+
89
+ if fragments || included_js_comment
69
90
  out = []
70
91
  scripts = {}
71
92
  result.split(';').each do |x|
@@ -79,14 +100,19 @@ module Proscenium
79
100
  scripts[inpath] = import.merge(outpath:)
80
101
  else
81
102
  opts = import[:js].is_a?(Hash) ? import[:js] : {}
103
+ opts[:preload_links_header] = false if fragments
82
104
  out << helpers.javascript_include_tag(outpath, extname: false, **opts)
83
105
  end
84
106
  end
85
107
 
86
- response_body.first.gsub! '<!-- [PROSCENIUM_JAVASCRIPTS] -->', out.join.html_safe
108
+ if fragments
109
+ response_body.first.prepend out.join.html_safe
110
+ elsif included_js_comment
111
+ response_body.first.gsub! JS_COMMENT, out.join.html_safe
112
+ end
87
113
  end
88
114
 
89
- return unless response_body.first.include? '<!-- [PROSCENIUM_LAZY_SCRIPTS] -->'
115
+ return if !fragments && !included_lazy_comment
90
116
 
91
117
  lazy_script = ''
92
118
  if scripts.present?
@@ -96,7 +122,11 @@ module Proscenium
96
122
  end
97
123
  end
98
124
 
99
- response_body.first.gsub! '<!-- [PROSCENIUM_LAZY_SCRIPTS] -->', lazy_script
125
+ if fragments
126
+ response_body.first.prepend lazy_script
127
+ elsif included_lazy_comment
128
+ response_body.first.gsub! LAZY_COMMENT, lazy_script
129
+ end
100
130
  end
101
131
  end
102
132
 
@@ -1,6 +1,6 @@
1
1
  @layer proscenium-ui-component {
2
2
  /*
3
- * Custom properties:
3
+ * Properties:
4
4
  *
5
5
  * --puiBreadcrumbs--link-color: LinkText;
6
6
  * --puiBreadcrumbs--link-hover-color: HighlightText;
@@ -1,28 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'literal'
4
+
3
5
  module Proscenium::UI
4
6
  class Breadcrumbs::Component < Component
7
+ extend Literal::Properties
5
8
  include Phlex::Rails::Helpers::URLFor
6
9
 
7
10
  # The path (route) to use as the HREF for the home segment. Defaults to `:root`.
8
- option :home_path, Types::String | Types::Symbol, default: -> { :root }
11
+ prop :home_path, _Union(String, Symbol), default: -> { :root }
9
12
 
10
13
  # Assign false to hide the home segment.
11
- option :with_home, Types::Bool, default: -> { true }
12
-
13
- # One or more class name(s) for the base div element which will be appended to the default.
14
- option :class, Types::Coercible::String | Types::Array.of(Types::Coercible::String),
15
- as: :class_name, default: -> { [] }
16
-
17
- # One or more class name(s) for the base div element which will replace the default. If both
18
- # `class` and `class!` are provided, all values will be merged. Defaults to `:@base`.
19
- option :class!, Types::Coercible::String | Types::Array.of(Types::Coercible::String),
20
- as: :class_name_override, default: -> { :@base }
14
+ prop :with_home, _Boolean, default: -> { true }
21
15
 
22
16
  def view_template
23
- div class: [*class_name_override, *class_name] do
17
+ div class: :@base do
24
18
  ol do
25
- if with_home
19
+ if @with_home
26
20
  li do
27
21
  home_template
28
22
  end
@@ -48,7 +42,7 @@ module Proscenium::UI
48
42
  # super { 'hello' }
49
43
  # end
50
44
  def home_template(&block)
51
- a(href: url_for(home_path)) do
45
+ a(href: url_for(@home_path)) do
52
46
  if block
53
47
  yield
54
48
  else
@@ -1,11 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry-initializer'
4
-
5
3
  module Proscenium::UI
6
4
  class Component < Proscenium::Phlex
7
5
  self.abstract_class = true
8
-
9
- extend Dry::Initializer
10
6
  end
11
7
  end
data/lib/proscenium/ui.rb CHANGED
@@ -1,14 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry-types'
4
-
5
3
  module Proscenium::UI
6
4
  extend ActiveSupport::Autoload
7
5
 
8
6
  autoload :Component
9
7
  autoload :Breadcrumbs
10
-
11
- module Types
12
- include Dry.Types()
13
- end
14
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.17.0'
4
+ VERSION = '0.18.0'
5
5
  end
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.17.0
4
+ version: 0.18.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: 2024-10-29 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,34 +30,6 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8.0'
33
- - !ruby/object:Gem::Dependency
34
- name: dry-initializer
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3.1'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '3.1'
47
- - !ruby/object:Gem::Dependency
48
- name: dry-types
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1.7'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.7'
61
33
  - !ruby/object:Gem::Dependency
62
34
  name: ffi
63
35
  requirement: !ruby/object:Gem::Requirement
@@ -73,33 +45,33 @@ dependencies:
73
45
  - !ruby/object:Gem::Version
74
46
  version: 1.17.0
75
47
  - !ruby/object:Gem::Dependency
76
- name: oj
48
+ name: literal
77
49
  requirement: !ruby/object:Gem::Requirement
78
50
  requirements:
79
51
  - - "~>"
80
52
  - !ruby/object:Gem::Version
81
- version: '3.13'
53
+ version: '1.0'
82
54
  type: :runtime
83
55
  prerelease: false
84
56
  version_requirements: !ruby/object:Gem::Requirement
85
57
  requirements:
86
58
  - - "~>"
87
59
  - !ruby/object:Gem::Version
88
- version: '3.13'
60
+ version: '1.0'
89
61
  - !ruby/object:Gem::Dependency
90
- name: phlex-rails
62
+ name: oj
91
63
  requirement: !ruby/object:Gem::Requirement
92
64
  requirements:
93
65
  - - "~>"
94
66
  - !ruby/object:Gem::Version
95
- version: 1.2.1
67
+ version: '3.13'
96
68
  type: :runtime
97
69
  prerelease: false
98
70
  version_requirements: !ruby/object:Gem::Requirement
99
71
  requirements:
100
72
  - - "~>"
101
73
  - !ruby/object:Gem::Version
102
- version: 1.2.1
74
+ version: '3.13'
103
75
  - !ruby/object:Gem::Dependency
104
76
  name: railties
105
77
  requirement: !ruby/object:Gem::Requirement