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 +4 -4
- data/README.md +1 -1
- data/lib/proscenium/ext/proscenium +0 -0
- data/lib/proscenium/helper.rb +4 -6
- data/lib/proscenium/side_load.rb +36 -6
- data/lib/proscenium/ui/breadcrumbs/component.module.css +1 -1
- data/lib/proscenium/ui/breadcrumbs/component.rb +8 -14
- data/lib/proscenium/ui/component.rb +0 -4
- data/lib/proscenium/ui.rb +0 -6
- data/lib/proscenium/version.rb +1 -1
- metadata +8 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97b6762190186f202a4c47c31df4b917b1ac8aba94617a556bab8a3b405f10cb
|
4
|
+
data.tar.gz: 1aafadc1a8b26192d92982399e00552e3e2e21c2fe2cabb1699e2ce5bc19a371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 955b20a69c4dab9a8ec2fc17892a819dbda39ddfb440e9a0a7b184f3f124f40a82dcb4b31c46c13b91d231b66811399fb465e493ce6399499583c27a15309bce
|
7
|
+
data.tar.gz: e10d3aec815547b202fffa97242f40afd76f16e8adf01405192135f26dc267cb271fa0e54560931775cba61b24d88a9ac3f0bccf9ba594fa2cd02ee8e9f9d9c3
|
data/README.md
CHANGED
Binary file
|
data/lib/proscenium/helper.rb
CHANGED
@@ -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
|
-
|
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(
|
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
|
-
|
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
|
-
|
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
|
data/lib/proscenium/side_load.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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,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
|
-
|
11
|
+
prop :home_path, _Union(String, Symbol), default: -> { :root }
|
9
12
|
|
10
13
|
# Assign false to hide the home segment.
|
11
|
-
|
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:
|
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
|
data/lib/proscenium/ui.rb
CHANGED
data/lib/proscenium/version.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.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-
|
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:
|
48
|
+
name: literal
|
77
49
|
requirement: !ruby/object:Gem::Requirement
|
78
50
|
requirements:
|
79
51
|
- - "~>"
|
80
52
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
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: '
|
60
|
+
version: '1.0'
|
89
61
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
62
|
+
name: oj
|
91
63
|
requirement: !ruby/object:Gem::Requirement
|
92
64
|
requirements:
|
93
65
|
- - "~>"
|
94
66
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
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:
|
74
|
+
version: '3.13'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: railties
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|