phlex-rails 2.1.3 → 2.3.0
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/lib/generators/phlex/base_generator.rb +16 -0
- data/lib/generators/phlex/component/component_generator.rb +6 -8
- data/lib/generators/phlex/component/templates/component.rb.erb +1 -1
- data/lib/generators/phlex/install/templates/base_component.rb.erb +0 -2
- data/lib/generators/phlex/view/templates/view.rb.erb +1 -1
- data/lib/generators/phlex/view/view_generator.rb +6 -8
- data/lib/phlex/rails/buffered.rb +16 -0
- data/lib/phlex/rails/builder.rb +31 -0
- data/lib/phlex/rails/helper_macros.rb +2 -2
- data/lib/phlex/rails/helpers/{check_box.rb → checkbox.rb} +3 -3
- data/lib/phlex/rails/helpers/checkbox_tag.rb +8 -0
- data/lib/phlex/rails/helpers/collection_checkboxes.rb +8 -0
- data/lib/phlex/rails/helpers/collection_radio_buttons.rb +1 -1
- data/lib/phlex/rails/helpers/content_security_policy_nonce.rb +8 -0
- data/lib/phlex/rails/helpers/fields.rb +1 -1
- data/lib/phlex/rails/helpers/fields_for.rb +1 -1
- data/lib/phlex/rails/helpers/form_for.rb +1 -1
- data/lib/phlex/rails/helpers/form_with.rb +1 -1
- data/lib/phlex/rails/helpers/javascript_import_module_tag.rb +1 -1
- data/lib/phlex/rails/helpers/javascript_importmap_tags.rb +1 -1
- data/lib/phlex/rails/helpers/javascript_include_tag.rb +1 -1
- data/lib/phlex/rails/helpers/javascript_path.rb +1 -1
- data/lib/phlex/rails/helpers/javascript_tag.rb +1 -1
- data/lib/phlex/rails/helpers/javascript_url.rb +1 -1
- data/lib/phlex/rails/helpers/label.rb +1 -1
- data/lib/phlex/rails/helpers/options_for_select.rb +13 -1
- data/lib/phlex/rails/helpers/options_from_collection_for_select.rb +13 -1
- data/lib/phlex/rails/helpers/path_to_javascript.rb +1 -1
- data/lib/phlex/rails/helpers/path_to_stylesheet.rb +1 -1
- data/lib/phlex/rails/helpers/{rich_text_area.rb → rich_textarea.rb} +2 -2
- data/lib/phlex/rails/helpers/select_tag.rb +11 -1
- data/lib/phlex/rails/helpers/stylesheet_link_tag.rb +1 -1
- data/lib/phlex/rails/helpers/stylesheet_path.rb +1 -1
- data/lib/phlex/rails/helpers/stylesheet_url.rb +1 -1
- data/lib/phlex/rails/helpers/{text_area.rb → textarea.rb} +2 -2
- data/lib/phlex/rails/helpers/{text_area_tag.rb → textarea_tag.rb} +2 -2
- data/lib/phlex/rails/helpers/url_to_javascript.rb +1 -1
- data/lib/phlex/rails/helpers/url_to_stylesheet.rb +1 -1
- data/lib/phlex/rails/helpers.rb +33 -200
- data/lib/phlex/rails/layout.rb +3 -3
- data/lib/phlex/rails/never.rb +11 -0
- data/lib/phlex/rails/sgml/state.rb +1 -1
- data/lib/phlex/rails/sgml.rb +1 -9
- data/lib/phlex/rails/streaming.rb +4 -6
- data/lib/phlex/rails/version.rb +1 -1
- data/lib/phlex/rails.rb +68 -20
- data/lib/ruby_lsp/phlex_rails/addon.rb +44 -0
- metadata +30 -18
- data/lib/phlex/rails/checkbox_builder.rb +0 -10
- data/lib/phlex/rails/decorator.rb +0 -26
- data/lib/phlex/rails/form_builder.rb +0 -123
- data/lib/phlex/rails/helpers/check_box_tag.rb +0 -8
- data/lib/phlex/rails/helpers/collection_check_boxes.rb +0 -8
- data/lib/phlex/rails/html.rb +0 -12
- data/lib/phlex/rails/label_builder.rb +0 -6
- data/lib/phlex/rails/radio_button_builder.rb +0 -10
- data/lib/phlex/rails/svg.rb +0 -12
data/lib/phlex/rails/helpers.rb
CHANGED
@@ -1,204 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Phlex::Rails::Helpers
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
autoload :DateSelect, "phlex/rails/helpers/date_select"
|
38
|
-
autoload :DatetimeField, "phlex/rails/helpers/datetime_field"
|
39
|
-
autoload :DatetimeFieldTag, "phlex/rails/helpers/datetime_field_tag"
|
40
|
-
autoload :DatetimeLocalField, "phlex/rails/helpers/datetime_local_field"
|
41
|
-
autoload :DatetimeLocalFieldTag, "phlex/rails/helpers/datetime_local_field_tag"
|
42
|
-
autoload :DatetimeSelect, "phlex/rails/helpers/datetime_select"
|
43
|
-
autoload :Debug, "phlex/rails/helpers/debug"
|
44
|
-
autoload :DefaultURLOptions, "phlex/rails/helpers/default_url_options"
|
45
|
-
autoload :DistanceOfTimeInWords, "phlex/rails/helpers/distance_of_time_in_words"
|
46
|
-
autoload :DistanceOfTimeInWordsToNow, "phlex/rails/helpers/distance_of_time_in_words_to_now"
|
47
|
-
autoload :DOMClass, "phlex/rails/helpers/dom_class"
|
48
|
-
autoload :DOMID, "phlex/rails/helpers/dom_id"
|
49
|
-
autoload :EmailField, "phlex/rails/helpers/email_field"
|
50
|
-
autoload :EmailFieldTag, "phlex/rails/helpers/email_field_tag"
|
51
|
-
autoload :ErrorMessage, "phlex/rails/helpers/error_message"
|
52
|
-
autoload :ErrorWrapping, "phlex/rails/helpers/error_wrapping"
|
53
|
-
autoload :EscapeOnce, "phlex/rails/helpers/escape_once"
|
54
|
-
autoload :Excerpt, "phlex/rails/helpers/excerpt"
|
55
|
-
autoload :FaviconLinkTag, "phlex/rails/helpers/favicon_link_tag"
|
56
|
-
autoload :FieldID, "phlex/rails/helpers/field_id"
|
57
|
-
autoload :FieldName, "phlex/rails/helpers/field_name"
|
58
|
-
autoload :Fields, "phlex/rails/helpers/fields"
|
59
|
-
autoload :FieldSetTag, "phlex/rails/helpers/field_set_tag"
|
60
|
-
autoload :FieldsFor, "phlex/rails/helpers/fields_for"
|
61
|
-
autoload :FileField, "phlex/rails/helpers/file_field"
|
62
|
-
autoload :FileFieldTag, "phlex/rails/helpers/file_field_tag"
|
63
|
-
autoload :Flash, "phlex/rails/helpers/flash"
|
64
|
-
autoload :FontPath, "phlex/rails/helpers/font_path"
|
65
|
-
autoload :FontURL, "phlex/rails/helpers/font_url"
|
66
|
-
autoload :FormAuthenticityToken, "phlex/rails/helpers/form_authenticity_token"
|
67
|
-
autoload :FormFor, "phlex/rails/helpers/form_for"
|
68
|
-
autoload :FormTag, "phlex/rails/helpers/form_tag"
|
69
|
-
autoload :FormWith, "phlex/rails/helpers/form_with"
|
70
|
-
autoload :GroupedCollectionSelect, "phlex/rails/helpers/grouped_collection_select"
|
71
|
-
autoload :GroupedOptionsForSelect, "phlex/rails/helpers/grouped_options_for_select"
|
72
|
-
autoload :HiddenField, "phlex/rails/helpers/hidden_field"
|
73
|
-
autoload :HiddenFieldTag, "phlex/rails/helpers/hidden_field_tag"
|
74
|
-
autoload :Highlight, "phlex/rails/helpers/highlight"
|
75
|
-
autoload :ImagePath, "phlex/rails/helpers/image_path"
|
76
|
-
autoload :ImageSubmitTag, "phlex/rails/helpers/image_submit_tag"
|
77
|
-
autoload :ImageTag, "phlex/rails/helpers/image_tag"
|
78
|
-
autoload :ImageURL, "phlex/rails/helpers/image_url"
|
79
|
-
autoload :JavascriptImportmapTags, "phlex/rails/helpers/javascript_importmap_tags"
|
80
|
-
autoload :JavascriptImportModuleTag, "phlex/rails/helpers/javascript_import_module_tag"
|
81
|
-
autoload :JavascriptIncludeTag, "phlex/rails/helpers/javascript_include_tag"
|
82
|
-
autoload :JavascriptPath, "phlex/rails/helpers/javascript_path"
|
83
|
-
autoload :JavascriptTag, "phlex/rails/helpers/javascript_tag"
|
84
|
-
autoload :JavascriptURL, "phlex/rails/helpers/javascript_url"
|
85
|
-
autoload :L, "phlex/rails/helpers/l"
|
86
|
-
autoload :Label, "phlex/rails/helpers/label"
|
87
|
-
autoload :LabelTag, "phlex/rails/helpers/label_tag"
|
88
|
-
autoload :LinkIf, "phlex/rails/helpers/link_to_if"
|
89
|
-
autoload :LinkTo, "phlex/rails/helpers/link_to"
|
90
|
-
autoload :LinkToIf, "phlex/rails/helpers/link_to_if"
|
91
|
-
autoload :LinkToUnless, "phlex/rails/helpers/link_to_unless"
|
92
|
-
autoload :LinkToUnlessCurrent, "phlex/rails/helpers/link_to_unless_current"
|
93
|
-
autoload :Localize, "phlex/rails/helpers/localize"
|
94
|
-
autoload :MailTo, "phlex/rails/helpers/mail_to"
|
95
|
-
autoload :MonthField, "phlex/rails/helpers/month_field"
|
96
|
-
autoload :MonthFieldTag, "phlex/rails/helpers/month_field_tag"
|
97
|
-
autoload :Notice, "phlex/rails/helpers/notice"
|
98
|
-
autoload :NumberField, "phlex/rails/helpers/number_field"
|
99
|
-
autoload :NumberFieldTag, "phlex/rails/helpers/number_field_tag"
|
100
|
-
autoload :NumberToCurrency, "phlex/rails/helpers/number_to_currency"
|
101
|
-
autoload :NumberToHuman, "phlex/rails/helpers/number_to_human"
|
102
|
-
autoload :NumberToHumanSize, "phlex/rails/helpers/number_to_human_size"
|
103
|
-
autoload :NumberToPercentage, "phlex/rails/helpers/number_to_percentage"
|
104
|
-
autoload :NumberToPhone, "phlex/rails/helpers/number_to_phone"
|
105
|
-
autoload :NumberWithDelimiter, "phlex/rails/helpers/number_with_delimiter"
|
106
|
-
autoload :NumberWithPrecision, "phlex/rails/helpers/number_with_precision"
|
107
|
-
autoload :Object, "phlex/rails/helpers/object"
|
108
|
-
autoload :OptionGroupsFromCollectionForSelect, "phlex/rails/helpers/option_groups_from_collection_for_select"
|
109
|
-
autoload :OptionsForSelect, "phlex/rails/helpers/options_for_select"
|
110
|
-
autoload :OptionsFromCollectionForSelect, "phlex/rails/helpers/options_from_collection_for_select"
|
111
|
-
autoload :PasswordField, "phlex/rails/helpers/password_field"
|
112
|
-
autoload :PasswordFieldTag, "phlex/rails/helpers/password_field_tag"
|
113
|
-
autoload :PathToAsset, "phlex/rails/helpers/path_to_asset"
|
114
|
-
autoload :PathToAudio, "phlex/rails/helpers/path_to_audio"
|
115
|
-
autoload :PathToFont, "phlex/rails/helpers/path_to_font"
|
116
|
-
autoload :PathToImage, "phlex/rails/helpers/path_to_image"
|
117
|
-
autoload :PathToJavascript, "phlex/rails/helpers/path_to_javascript"
|
118
|
-
autoload :PathToStylesheet, "phlex/rails/helpers/path_to_stylesheet"
|
119
|
-
autoload :PathToVideo, "phlex/rails/helpers/path_to_video"
|
120
|
-
autoload :PhoneField, "phlex/rails/helpers/phone_field"
|
121
|
-
autoload :PhoneFieldTag, "phlex/rails/helpers/phone_field_tag"
|
122
|
-
autoload :PhoneTo, "phlex/rails/helpers/phone_to"
|
123
|
-
autoload :Pluralize, "phlex/rails/helpers/pluralize"
|
124
|
-
autoload :PreloadLinkTag, "phlex/rails/helpers/preload_link_tag"
|
125
|
-
autoload :Provide, "phlex/rails/helpers/provide"
|
126
|
-
autoload :PublicComputeAssetPath, "phlex/rails/helpers/public_compute_asset_path"
|
127
|
-
autoload :RadioButton, "phlex/rails/helpers/radio_button"
|
128
|
-
autoload :RadioButtonTag, "phlex/rails/helpers/radio_button_tag"
|
129
|
-
autoload :RangeField, "phlex/rails/helpers/range_field"
|
130
|
-
autoload :RangeFieldTag, "phlex/rails/helpers/range_field_tag"
|
131
|
-
autoload :Request, "phlex/rails/helpers/request"
|
132
|
-
autoload :ResetCycle, "phlex/rails/helpers/reset_cycle"
|
133
|
-
autoload :RichTextArea, "phlex/rails/helpers/rich_text_area"
|
134
|
-
autoload :Routes, "phlex/rails/helpers/routes"
|
135
|
-
autoload :Sanitize, "phlex/rails/helpers/sanitize"
|
136
|
-
autoload :SanitizeCSS, "phlex/rails/helpers/sanitize_css"
|
137
|
-
autoload :SearchField, "phlex/rails/helpers/search_field"
|
138
|
-
autoload :SearchFieldTag, "phlex/rails/helpers/search_field_tag"
|
139
|
-
autoload :Select, "phlex/rails/helpers/select"
|
140
|
-
autoload :SelectDate, "phlex/rails/helpers/select_date"
|
141
|
-
autoload :SelectDatetime, "phlex/rails/helpers/select_datetime"
|
142
|
-
autoload :SelectDay, "phlex/rails/helpers/select_day"
|
143
|
-
autoload :SelectHour, "phlex/rails/helpers/select_hour"
|
144
|
-
autoload :SelectMinute, "phlex/rails/helpers/select_minute"
|
145
|
-
autoload :SelectMonth, "phlex/rails/helpers/select_month"
|
146
|
-
autoload :SelectSecond, "phlex/rails/helpers/select_second"
|
147
|
-
autoload :SelectTag, "phlex/rails/helpers/select_tag"
|
148
|
-
autoload :SelectTime, "phlex/rails/helpers/select_time"
|
149
|
-
autoload :SelectYear, "phlex/rails/helpers/select_year"
|
150
|
-
autoload :SimpleFormat, "phlex/rails/helpers/simple_format"
|
151
|
-
autoload :SMSTo, "phlex/rails/helpers/sms_to"
|
152
|
-
autoload :StripLinks, "phlex/rails/helpers/strip_links"
|
153
|
-
autoload :StripTags, "phlex/rails/helpers/strip_tags"
|
154
|
-
autoload :StylesheetLinkTag, "phlex/rails/helpers/stylesheet_link_tag"
|
155
|
-
autoload :StylesheetPath, "phlex/rails/helpers/stylesheet_path"
|
156
|
-
autoload :StylesheetURL, "phlex/rails/helpers/stylesheet_url"
|
157
|
-
autoload :SubmitTag, "phlex/rails/helpers/submit_tag"
|
158
|
-
autoload :T, "phlex/rails/helpers/t"
|
159
|
-
autoload :Tag, "phlex/rails/helpers/tag"
|
160
|
-
autoload :TelephoneField, "phlex/rails/helpers/telephone_field"
|
161
|
-
autoload :TelephoneFieldTag, "phlex/rails/helpers/telephone_field_tag"
|
162
|
-
autoload :TextArea, "phlex/rails/helpers/text_area"
|
163
|
-
autoload :TextAreaTag, "phlex/rails/helpers/text_area_tag"
|
164
|
-
autoload :TextField, "phlex/rails/helpers/text_field"
|
165
|
-
autoload :TextFieldTag, "phlex/rails/helpers/text_field_tag"
|
166
|
-
autoload :TimeAgoInWords, "phlex/rails/helpers/time_ago_in_words"
|
167
|
-
autoload :TimeField, "phlex/rails/helpers/time_field"
|
168
|
-
autoload :TimeFieldTag, "phlex/rails/helpers/time_field_tag"
|
169
|
-
autoload :TimeSelect, "phlex/rails/helpers/time_select"
|
170
|
-
autoload :TimeTag, "phlex/rails/helpers/time_tag"
|
171
|
-
autoload :TimeZoneOptionsForSelect, "phlex/rails/helpers/time_zone_options_for_select"
|
172
|
-
autoload :TimeZoneSelect, "phlex/rails/helpers/time_zone_select"
|
173
|
-
autoload :TokenList, "phlex/rails/helpers/token_list"
|
174
|
-
autoload :Translate, "phlex/rails/helpers/translate"
|
175
|
-
autoload :Truncate, "phlex/rails/helpers/truncate"
|
176
|
-
autoload :TurboFrameTag, "phlex/rails/helpers/turbo_frame_tag"
|
177
|
-
autoload :TurboIncludeTags, "phlex/rails/helpers/turbo_include_tags"
|
178
|
-
autoload :TurboRefreshesWith, "phlex/rails/helpers/turbo_refreshes_with"
|
179
|
-
autoload :TurboRefreshMethodTag, "phlex/rails/helpers/turbo_refresh_method_tag"
|
180
|
-
autoload :TurboRefreshScrollTag, "phlex/rails/helpers/turbo_refresh_scroll_tag"
|
181
|
-
autoload :TurboStream, "phlex/rails/helpers/turbo_stream"
|
182
|
-
autoload :TurboStreamFrom, "phlex/rails/helpers/turbo_stream_from"
|
183
|
-
autoload :URLField, "phlex/rails/helpers/url_field"
|
184
|
-
autoload :URLFieldTag, "phlex/rails/helpers/url_field_tag"
|
185
|
-
autoload :URLFor, "phlex/rails/helpers/url_for"
|
186
|
-
autoload :URLOptions, "phlex/rails/helpers/url_options"
|
187
|
-
autoload :URLToAsset, "phlex/rails/helpers/url_to_asset"
|
188
|
-
autoload :URLToAudio, "phlex/rails/helpers/url_to_audio"
|
189
|
-
autoload :URLToFont, "phlex/rails/helpers/url_to_font"
|
190
|
-
autoload :URLToImage, "phlex/rails/helpers/url_to_image"
|
191
|
-
autoload :URLToJavascript, "phlex/rails/helpers/url_to_javascript"
|
192
|
-
autoload :URLToStylesheet, "phlex/rails/helpers/url_to_stylesheet"
|
193
|
-
autoload :URLToVideo, "phlex/rails/helpers/url_to_video"
|
194
|
-
autoload :UTF8EnforcerTag, "phlex/rails/helpers/utf8_enforcer_tag"
|
195
|
-
autoload :VideoPath, "phlex/rails/helpers/video_path"
|
196
|
-
autoload :VideoTag, "phlex/rails/helpers/video_tag"
|
197
|
-
autoload :VideoURL, "phlex/rails/helpers/video_url"
|
198
|
-
autoload :WeekdayOptionsForSelect, "phlex/rails/helpers/weekday_options_for_select"
|
199
|
-
autoload :WeekdaySelect, "phlex/rails/helpers/weekday_select"
|
200
|
-
autoload :WeekField, "phlex/rails/helpers/week_field"
|
201
|
-
autoload :WeekFieldTag, "phlex/rails/helpers/week_field_tag"
|
202
|
-
autoload :WithOutputBuffer, "phlex/rails/helpers/with_output_buffer"
|
203
|
-
autoload :WordWrap, "phlex/rails/helpers/word_wrap"
|
4
|
+
# These will not be suggested by RubyLSP, but they work as
|
5
|
+
# aliases for legacy helper names.
|
6
|
+
REDIRECTS = {
|
7
|
+
:CheckBox => :Checkbox,
|
8
|
+
:CheckBoxTag => :CheckboxTag,
|
9
|
+
:CollectionCheckBoxes => :CollectionCheckboxes,
|
10
|
+
:JavascriptImportModuleTag => :JavaScriptImportModuleTag,
|
11
|
+
:JavascriptImportmapTags => :JavaScriptImportmapTags,
|
12
|
+
:JavascriptIncludeTag => :JavaScriptIncludeTag,
|
13
|
+
:JavascriptPath => :JavaScriptPath,
|
14
|
+
:JavascriptTag => :JavaScriptTag,
|
15
|
+
:JavascriptURL => :JavaScriptURL,
|
16
|
+
:PathToJavascript => :PathToJavaScript,
|
17
|
+
:PathToStylesheet => :PathToStyleSheet,
|
18
|
+
:RichTextarea => :RichTextArea,
|
19
|
+
:StylesheetLinkTag => :StyleSheetLinkTag,
|
20
|
+
:StylesheetPath => :StyleSheetPath,
|
21
|
+
:StylesheetURL => :StyleSheetURL,
|
22
|
+
:Textarea => :TextArea,
|
23
|
+
:TextareaTag => :TextAreaTag,
|
24
|
+
:URLToJavascript => :URLToJavaScript,
|
25
|
+
:URLToStylesheet => :URLToStyleSheet,
|
26
|
+
}.freeze
|
27
|
+
|
28
|
+
def self.const_missing(name)
|
29
|
+
if (new_name = REDIRECTS[name])
|
30
|
+
mod = const_get(new_name)
|
31
|
+
const_set(name, mod)
|
32
|
+
mod
|
33
|
+
else
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
204
37
|
end
|
data/lib/phlex/rails/layout.rb
CHANGED
@@ -9,9 +9,9 @@ module Phlex::Rails
|
|
9
9
|
include Helpers::StylesheetLinkTag
|
10
10
|
include Helpers::ActionCableMetaTag
|
11
11
|
include Helpers::AutoDiscoveryLinkTag
|
12
|
-
include Helpers::
|
13
|
-
include Helpers::
|
14
|
-
include Helpers::
|
12
|
+
include Helpers::JavaScriptIncludeTag
|
13
|
+
include Helpers::JavaScriptImportmapTags
|
14
|
+
include Helpers::JavaScriptImportModuleTag
|
15
15
|
include Helpers::TurboRefreshMethodTag
|
16
16
|
include Helpers::TurboRefreshScrollTag
|
17
17
|
include Helpers::TurboRefreshesWith
|
data/lib/phlex/rails/sgml.rb
CHANGED
@@ -1,14 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Phlex::Rails::SGML
|
4
|
-
autoload :State, "phlex/rails/sgml/state"
|
5
|
-
|
6
|
-
def self.included(base)
|
7
|
-
base.extend ClassMethods
|
8
|
-
base.extend Phlex::Rails::HelperMacros
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
4
|
module ClassMethods
|
13
5
|
def render_in(...)
|
14
6
|
new.render_in(...)
|
@@ -60,7 +52,7 @@ module Phlex::Rails::SGML
|
|
60
52
|
register your own adapter via `register_output_helper` or
|
61
53
|
`register_value_helper`.
|
62
54
|
|
63
|
-
See https://
|
55
|
+
See https://www.phlex.fun/rails/helpers
|
64
56
|
MESSAGE
|
65
57
|
|
66
58
|
view_context
|
@@ -3,9 +3,7 @@
|
|
3
3
|
module Phlex::Rails::Streaming
|
4
4
|
include ActionController::Live
|
5
5
|
|
6
|
-
private
|
7
|
-
|
8
|
-
def stream(view, last_modified: Time.now.httpdate, filename: nil)
|
6
|
+
private def stream(view, last_modified: Time.now.httpdate, filename: nil)
|
9
7
|
__phlex_set_stream_headers__(last_modified:)
|
10
8
|
|
11
9
|
case view
|
@@ -18,7 +16,7 @@ module Phlex::Rails::Streaming
|
|
18
16
|
end
|
19
17
|
end
|
20
18
|
|
21
|
-
def __phlex_set_stream_headers__(last_modified:)
|
19
|
+
private def __phlex_set_stream_headers__(last_modified:)
|
22
20
|
headers.delete("Content-Length")
|
23
21
|
|
24
22
|
headers["X-Accel-Buffering"] = "no"
|
@@ -26,7 +24,7 @@ module Phlex::Rails::Streaming
|
|
26
24
|
headers["Last-Modified"] = last_modified
|
27
25
|
end
|
28
26
|
|
29
|
-
def __phlex_stream_csv__(view, filename:)
|
27
|
+
private def __phlex_stream_csv__(view, filename:)
|
30
28
|
headers["Content-Type"] = "text/csv; charset=utf-8"
|
31
29
|
headers["Content-Disposition"] = "attachment; filename=\"#{filename || view.filename}\""
|
32
30
|
|
@@ -35,7 +33,7 @@ module Phlex::Rails::Streaming
|
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
|
-
def __phlex_stream_html__(view)
|
36
|
+
private def __phlex_stream_html__(view)
|
39
37
|
headers["Content-Type"] = "text/html; charset=utf-8"
|
40
38
|
|
41
39
|
# Ensure we have a session id.
|
data/lib/phlex/rails/version.rb
CHANGED
data/lib/phlex/rails.rb
CHANGED
@@ -6,35 +6,83 @@ module Phlex
|
|
6
6
|
module Rails
|
7
7
|
class HelpersCalledBeforeRenderError < StandardError; end
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
Loader = Zeitwerk::Loader.for_gem_extension(Phlex).tap do |loader|
|
10
|
+
loader.ignore("#{__dir__}/ruby_lsp")
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
loader.inflector.inflect(
|
13
|
+
"asset_url" => "AssetURL",
|
14
|
+
"audio_url" => "AudioURL",
|
15
|
+
"csp_meta_tag" => "CSPMetaTag",
|
16
|
+
"csrf_meta_tags" => "CSRFMetaTags",
|
17
|
+
"csv" => "CSV",
|
18
|
+
"default_url_options" => "DefaultURLOptions",
|
19
|
+
"dom_class" => "DOMClass",
|
20
|
+
"dom_id" => "DOMID",
|
21
|
+
"field_id" => "FieldID",
|
22
|
+
"font_url" => "FontURL",
|
23
|
+
"image_url" => "ImageURL",
|
24
|
+
"javascript_import_module_tag" => "JavaScriptImportModuleTag",
|
25
|
+
"javascript_importmap_tags" => "JavaScriptImportmapTags",
|
26
|
+
"javascript_include_tag" => "JavaScriptIncludeTag",
|
27
|
+
"javascript_path" => "JavaScriptPath",
|
28
|
+
"javascript_tag" => "JavaScriptTag",
|
29
|
+
"javascript_url" => "JavaScriptURL",
|
30
|
+
"path_to_javascript" => "PathToJavaScript",
|
31
|
+
"path_to_stylesheet" => "PathToStyleSheet",
|
32
|
+
"rich_textarea" => "RichTextArea",
|
33
|
+
"sanitize_css" => "SanitizeCSS",
|
34
|
+
"sgml" => "SGML",
|
35
|
+
"sms_to" => "SMSTo",
|
36
|
+
"stylesheet_link_tag" => "StyleSheetLinkTag",
|
37
|
+
"stylesheet_path" => "StyleSheetPath",
|
38
|
+
"stylesheet_url" => "StyleSheetURL",
|
39
|
+
"textarea" => "TextArea",
|
40
|
+
"textarea_tag" => "TextAreaTag",
|
41
|
+
"url_field" => "URLField",
|
42
|
+
"url_field_tag" => "URLFieldTag",
|
43
|
+
"url_for" => "URLFor",
|
44
|
+
"url_options" => "URLOptions",
|
45
|
+
"url_to_asset" => "URLToAsset",
|
46
|
+
"url_to_audio" => "URLToAudio",
|
47
|
+
"url_to_font" => "URLToFont",
|
48
|
+
"url_to_image" => "URLToImage",
|
49
|
+
"url_to_javascript" => "URLToJavaScript",
|
50
|
+
"url_to_stylesheet" => "URLToStyleSheet",
|
51
|
+
"url_to_video" => "URLToVideo",
|
52
|
+
"utf8_enforcer_tag" => "UTF8EnforcerTag",
|
53
|
+
"video_url" => "VideoURL",
|
54
|
+
)
|
16
55
|
|
17
|
-
|
56
|
+
loader.collapse("#{__dir__}/phlex/errors")
|
57
|
+
loader.setup
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
CSV.prepend(Phlex::Rails::CSV)
|
62
|
+
CSV.extend(Phlex::Rails::HelperMacros)
|
63
|
+
SGML::State.prepend(Phlex::Rails::SGML::State)
|
18
64
|
|
19
|
-
|
20
|
-
|
21
|
-
|
65
|
+
class HTML
|
66
|
+
extend Phlex::Rails::SGML::ClassMethods
|
67
|
+
extend Phlex::Rails::HelperMacros
|
22
68
|
|
23
|
-
|
24
|
-
autoload :HelperMacros, "phlex/rails/helper_macros"
|
69
|
+
include Phlex::Rails::SGML
|
25
70
|
|
26
|
-
|
27
|
-
|
28
|
-
|
71
|
+
def format
|
72
|
+
:html
|
73
|
+
end
|
29
74
|
end
|
30
75
|
|
31
|
-
|
32
|
-
|
76
|
+
class SVG
|
77
|
+
extend Phlex::Rails::SGML::ClassMethods
|
78
|
+
extend Phlex::Rails::HelperMacros
|
33
79
|
|
34
|
-
|
35
|
-
SVG.include(Phlex::Rails::SVG)
|
80
|
+
include Phlex::Rails::SGML
|
36
81
|
|
37
|
-
|
82
|
+
def format
|
83
|
+
:svg
|
84
|
+
end
|
85
|
+
end
|
38
86
|
|
39
87
|
ActiveSupport::SafeBuffer.include(Phlex::SGML::SafeObject)
|
40
88
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ruby_lsp/addon"
|
4
|
+
|
5
|
+
module RubyLsp
|
6
|
+
module PhlexRails
|
7
|
+
class Addon < ::RubyLsp::Addon
|
8
|
+
def activate(global_state, message_queue)
|
9
|
+
end
|
10
|
+
|
11
|
+
def deactivate
|
12
|
+
end
|
13
|
+
|
14
|
+
def name
|
15
|
+
"PhlexRails"
|
16
|
+
end
|
17
|
+
|
18
|
+
def version
|
19
|
+
"0.1.0"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class IndexingEnhancement < RubyIndexer::Enhancement
|
24
|
+
def on_call_node_enter(node)
|
25
|
+
name = node.name
|
26
|
+
owner = @listener.current_owner
|
27
|
+
location = node.location
|
28
|
+
arguments = node.arguments&.arguments
|
29
|
+
|
30
|
+
return unless owner
|
31
|
+
return unless name in :register_output_helper | :register_value_helper
|
32
|
+
|
33
|
+
case arguments
|
34
|
+
in [Prism::SymbolNode[unescaped: String => method_name], *]
|
35
|
+
@listener.add_method(method_name, location, [
|
36
|
+
RubyIndexer::Entry::Signature.new([
|
37
|
+
RubyIndexer::Entry::ForwardingParameter.new,
|
38
|
+
]),
|
39
|
+
], visibility: :public)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlex-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Drapper
|
8
8
|
- Will Cosgrove
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '9'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: zeitwerk
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.7'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.7'
|
47
61
|
description: Object-oriented views in pure Ruby.
|
48
62
|
email:
|
49
63
|
- joel@drapper.me
|
@@ -53,6 +67,7 @@ extra_rdoc_files: []
|
|
53
67
|
files:
|
54
68
|
- LICENSE.txt
|
55
69
|
- README.md
|
70
|
+
- lib/generators/phlex/base_generator.rb
|
56
71
|
- lib/generators/phlex/component/USAGE
|
57
72
|
- lib/generators/phlex/component/component_generator.rb
|
58
73
|
- lib/generators/phlex/component/templates/component.rb.erb
|
@@ -67,10 +82,8 @@ files:
|
|
67
82
|
- lib/phlex-rails.rb
|
68
83
|
- lib/phlex/rails.rb
|
69
84
|
- lib/phlex/rails/buffered.rb
|
70
|
-
- lib/phlex/rails/
|
85
|
+
- lib/phlex/rails/builder.rb
|
71
86
|
- lib/phlex/rails/csv.rb
|
72
|
-
- lib/phlex/rails/decorator.rb
|
73
|
-
- lib/phlex/rails/form_builder.rb
|
74
87
|
- lib/phlex/rails/helper_macros.rb
|
75
88
|
- lib/phlex/rails/helpers.rb
|
76
89
|
- lib/phlex/rails/helpers/action_cable_meta_tag.rb
|
@@ -84,10 +97,10 @@ files:
|
|
84
97
|
- lib/phlex/rails/helpers/build_tag_values.rb
|
85
98
|
- lib/phlex/rails/helpers/button_tag.rb
|
86
99
|
- lib/phlex/rails/helpers/button_to.rb
|
87
|
-
- lib/phlex/rails/helpers/
|
88
|
-
- lib/phlex/rails/helpers/
|
100
|
+
- lib/phlex/rails/helpers/checkbox.rb
|
101
|
+
- lib/phlex/rails/helpers/checkbox_tag.rb
|
89
102
|
- lib/phlex/rails/helpers/class_names.rb
|
90
|
-
- lib/phlex/rails/helpers/
|
103
|
+
- lib/phlex/rails/helpers/collection_checkboxes.rb
|
91
104
|
- lib/phlex/rails/helpers/collection_radio_buttons.rb
|
92
105
|
- lib/phlex/rails/helpers/collection_select.rb
|
93
106
|
- lib/phlex/rails/helpers/color_field.rb
|
@@ -96,6 +109,7 @@ files:
|
|
96
109
|
- lib/phlex/rails/helpers/compute_asset_host.rb
|
97
110
|
- lib/phlex/rails/helpers/compute_asset_path.rb
|
98
111
|
- lib/phlex/rails/helpers/content_for.rb
|
112
|
+
- lib/phlex/rails/helpers/content_security_policy_nonce.rb
|
99
113
|
- lib/phlex/rails/helpers/content_tag.rb
|
100
114
|
- lib/phlex/rails/helpers/controller_name.rb
|
101
115
|
- lib/phlex/rails/helpers/controller_path.rb
|
@@ -201,7 +215,7 @@ files:
|
|
201
215
|
- lib/phlex/rails/helpers/range_field_tag.rb
|
202
216
|
- lib/phlex/rails/helpers/request.rb
|
203
217
|
- lib/phlex/rails/helpers/reset_cycle.rb
|
204
|
-
- lib/phlex/rails/helpers/
|
218
|
+
- lib/phlex/rails/helpers/rich_textarea.rb
|
205
219
|
- lib/phlex/rails/helpers/routes.rb
|
206
220
|
- lib/phlex/rails/helpers/sanitize.rb
|
207
221
|
- lib/phlex/rails/helpers/sanitize_css.rb
|
@@ -230,10 +244,10 @@ files:
|
|
230
244
|
- lib/phlex/rails/helpers/tag.rb
|
231
245
|
- lib/phlex/rails/helpers/telephone_field.rb
|
232
246
|
- lib/phlex/rails/helpers/telephone_field_tag.rb
|
233
|
-
- lib/phlex/rails/helpers/text_area.rb
|
234
|
-
- lib/phlex/rails/helpers/text_area_tag.rb
|
235
247
|
- lib/phlex/rails/helpers/text_field.rb
|
236
248
|
- lib/phlex/rails/helpers/text_field_tag.rb
|
249
|
+
- lib/phlex/rails/helpers/textarea.rb
|
250
|
+
- lib/phlex/rails/helpers/textarea_tag.rb
|
237
251
|
- lib/phlex/rails/helpers/time_ago_in_words.rb
|
238
252
|
- lib/phlex/rails/helpers/time_field.rb
|
239
253
|
- lib/phlex/rails/helpers/time_field_tag.rb
|
@@ -272,16 +286,14 @@ files:
|
|
272
286
|
- lib/phlex/rails/helpers/weekday_select.rb
|
273
287
|
- lib/phlex/rails/helpers/with_output_buffer.rb
|
274
288
|
- lib/phlex/rails/helpers/word_wrap.rb
|
275
|
-
- lib/phlex/rails/html.rb
|
276
|
-
- lib/phlex/rails/label_builder.rb
|
277
289
|
- lib/phlex/rails/layout.rb
|
290
|
+
- lib/phlex/rails/never.rb
|
278
291
|
- lib/phlex/rails/partial.rb
|
279
|
-
- lib/phlex/rails/radio_button_builder.rb
|
280
292
|
- lib/phlex/rails/sgml.rb
|
281
293
|
- lib/phlex/rails/sgml/state.rb
|
282
294
|
- lib/phlex/rails/streaming.rb
|
283
|
-
- lib/phlex/rails/svg.rb
|
284
295
|
- lib/phlex/rails/version.rb
|
296
|
+
- lib/ruby_lsp/phlex_rails/addon.rb
|
285
297
|
homepage: https://www.phlex.fun
|
286
298
|
licenses:
|
287
299
|
- MIT
|
@@ -305,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
317
|
- !ruby/object:Gem::Version
|
306
318
|
version: '0'
|
307
319
|
requirements: []
|
308
|
-
rubygems_version: 3.6.
|
320
|
+
rubygems_version: 3.6.6
|
309
321
|
specification_version: 4
|
310
322
|
summary: A Phlex adapter for Rails
|
311
323
|
test_files: []
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Phlex::Rails::CheckboxBuilder < Phlex::Rails::Decorator
|
4
|
-
def text(...) = @object.text(...)
|
5
|
-
def value(...) = @object.value(...)
|
6
|
-
def object(...) = @object.object(...)
|
7
|
-
|
8
|
-
output def label(...) = nil
|
9
|
-
output def checkbox(...) = nil
|
10
|
-
end
|