turbo_reflex 0.0.11 → 0.0.13

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: de822e8665418ea51ade1decc2e3cf51b2fe96e31e969c12510c2dbe3070036c
4
- data.tar.gz: 3e418cf5f99246e1a75006460357865657192b8f47e0b21726d0d18ed8f67cdd
3
+ metadata.gz: 148653f6e602f340ed943feddcc574c059571baae1971c47816df9cd97c672f5
4
+ data.tar.gz: 32d37a9dc870c39886d7218b2e6d9cdeba1f299cf747d7d165b4e5673f67d4dd
5
5
  SHA512:
6
- metadata.gz: 86dc8b0bc50845abf63f3857e8bbe136cad72c251019766ed86679cca7df552f733b193cc9685d9b4c6daeb99fa04bf36a5e49694b058088430335e078394f15
7
- data.tar.gz: f3dc656498c73837d5b85596b074522255849722b4a36bf07ce71c08e6833440ec49a5c8fd56872c2c05eb4e76c9f4c6510743d8f0f3d644ac7522ed30fefe4e
6
+ metadata.gz: e2f5c538fcb479478fc87789145ccf0aa9908b0bf72b7f3a7f0ba24af5da45951c5b6bf6c776e160adc1d4e07b425f0cdca93d535a7dbf5dba14c8f565a44e8c
7
+ data.tar.gz: 8a68c4b30fbd18ecc9a213107274c93f2da711c2843fbd8406f2387bec1127967bccfef24f426c0927010add654a08660d203c8e3a9cb5dd18c62617b6a55c85
data/Gemfile CHANGED
@@ -5,5 +5,3 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
 
6
6
  # Specify your gem's dependencies in turbo_reflex.gemspec.
7
7
  gemspec
8
-
9
- gem "capybara", github: "teamcapybara/capybara"
data/Gemfile.lock CHANGED
@@ -1,21 +1,7 @@
1
- GIT
2
- remote: https://github.com/teamcapybara/capybara.git
3
- revision: 2d05c203d79bca7b3b093c37f866ee41f294925b
4
- specs:
5
- capybara (3.38.0)
6
- addressable
7
- matrix
8
- mini_mime (>= 0.1.3)
9
- nokogiri (~> 1.8)
10
- rack (>= 1.6.0)
11
- rack-test (>= 0.6.3)
12
- regexp_parser (>= 1.5, < 3.0)
13
- xpath (~> 3.2)
14
-
15
1
  PATH
16
2
  remote: .
17
3
  specs:
18
- turbo_reflex (0.0.11)
4
+ turbo_reflex (0.0.13)
19
5
  rails (>= 6.1)
20
6
  turbo-rails (>= 1.1)
21
7
  turbo_ready (>= 0.1)
@@ -95,6 +81,15 @@ GEM
95
81
  bindex (0.8.1)
96
82
  builder (3.2.4)
97
83
  byebug (11.1.3)
84
+ capybara (3.37.1)
85
+ addressable
86
+ matrix
87
+ mini_mime (>= 0.1.3)
88
+ nokogiri (~> 1.8)
89
+ rack (>= 1.6.0)
90
+ rack-test (>= 0.6.3)
91
+ regexp_parser (>= 1.5, < 3.0)
92
+ xpath (~> 3.2)
98
93
  childprocess (4.1.0)
99
94
  coderay (1.1.3)
100
95
  concurrent-ruby (1.1.10)
@@ -161,7 +156,7 @@ GEM
161
156
  pry-rails (0.3.9)
162
157
  pry (>= 0.10.4)
163
158
  public_suffix (5.0.0)
164
- puma (6.0.0)
159
+ puma (5.6.5)
165
160
  nio4r (~> 2.0)
166
161
  racc (1.6.0)
167
162
  rack (2.2.4)
@@ -227,7 +222,6 @@ GEM
227
222
  actionpack (>= 5.2)
228
223
  activesupport (>= 5.2)
229
224
  sprockets (>= 3.0.0)
230
- sqlite3 (1.5.3-aarch64-linux)
231
225
  sqlite3 (1.5.3-arm64-darwin)
232
226
  standard (1.16.1)
233
227
  rubocop (= 1.35.1)
@@ -275,7 +269,7 @@ PLATFORMS
275
269
  arm64-darwin-21
276
270
 
277
271
  DEPENDENCIES
278
- capybara!
272
+ capybara
279
273
  cuprite
280
274
  foreman
281
275
  importmap-rails
@@ -285,7 +279,7 @@ DEPENDENCIES
285
279
  pry-byebug
286
280
  pry-doc
287
281
  pry-rails
288
- puma
282
+ puma (~> 5.6.5)
289
283
  rake
290
284
  rexml
291
285
  rouge
@@ -4,14 +4,6 @@ module TurboReflex::Controller
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  module ClassMethods
7
- def turbo_reflex_state_cookie_max_bytesize
8
- TurboReflex::StateManager.cookie_max_bytesize
9
- end
10
-
11
- def turbo_reflex_state_cookie_max_bytesize=(value)
12
- TurboReflex::StateManager.cookie_max_bytesize = value
13
- end
14
-
15
7
  def turbo_reflex_state(&block)
16
8
  TurboReflex::StateManager.add_state_override_block name, block
17
9
  end
@@ -154,15 +154,20 @@ class TurboReflex::Runner
154
154
 
155
155
  def render_response(html: "", status: nil, headers: {TurboReflex: :Append})
156
156
  headers.each { |key, value| response.set_header key.to_s, value.to_s }
157
- controller.render html: html, layout: false, status: status || response_status
157
+ render html: html, layout: false, status: status || response_status
158
158
  end
159
159
 
160
160
  def turbo_stream
161
- @turbo_stream ||= Turbo::Streams::TagBuilder.new(controller.view_context)
161
+ @turbo_stream ||= Turbo::Streams::TagBuilder.new(view_context)
162
162
  end
163
163
 
164
164
  def message_verifier
165
- ActiveSupport::MessageVerifier.new session.id.to_s, digest: "SHA256"
165
+ ActiveSupport::MessageVerifier.new Rails.application.secret_key_base, digest: "SHA256"
166
+ end
167
+
168
+ # Same implementation as ActionController::Base but with public visibility
169
+ def cookies
170
+ request.cookie_jar
166
171
  end
167
172
 
168
173
  private
@@ -180,7 +185,7 @@ class TurboReflex::Runner
180
185
  end
181
186
 
182
187
  def server_token
183
- session[:turbo_reflex_token]
188
+ cookies.encrypted["turbo_reflex.token"]
184
189
  end
185
190
 
186
191
  def client_token
@@ -195,8 +200,8 @@ class TurboReflex::Runner
195
200
  end
196
201
 
197
202
  def should_redirect?
198
- return false if controller.request.method.match?(/GET/i)
199
- controller.request.accepts.include? Mime::Type.lookup_by_extension(:turbo_stream)
203
+ return false if request.method.match?(/GET/i)
204
+ request.accepts.include? Mime::Type.lookup_by_extension(:turbo_stream)
200
205
  end
201
206
 
202
207
  def response_status
@@ -205,7 +210,7 @@ class TurboReflex::Runner
205
210
  end
206
211
 
207
212
  def response_type
208
- body = controller.response_body.to_s.strip
213
+ body = response_body.to_s.strip
209
214
  return :body if body.match?(/<\/\s*body.*>/i)
210
215
  return :frame if body.match?(/<\/\s*turbo-frame.*>/i)
211
216
  return :stream if body.match?(/<\/\s*turbo-stream.*>/i)
@@ -229,7 +234,7 @@ class TurboReflex::Runner
229
234
  end
230
235
 
231
236
  def append_meta_tag_to_response_body
232
- session[:turbo_reflex_token] = new_token
237
+ cookies.encrypted["turbo_reflex.token"] = {value: new_token, path: "/"}
233
238
  append_to_response_body turbo_stream.invoke("morph", args: [meta_tag], selector: "#turbo-reflex")
234
239
  end
235
240
 
@@ -261,7 +266,7 @@ class TurboReflex::Runner
261
266
  case response_type
262
267
  when :body then response.body.sub!(/<\/\s*body.*>/i, "#{sanitized_content}</body>")
263
268
  when :frame then response.body.sub!(/<\/\s*turbo-frame.*>/i, "#{sanitized_content}</turbo-frame>")
264
- else controller.response_body << sanitized_content
269
+ else response_body << sanitized_content
265
270
  end
266
271
  end
267
272
  end
@@ -41,6 +41,7 @@ class TurboReflex::StateManager
41
41
  # For ActiveModel::Dirty tracking
42
42
  define_attribute_methods :state
43
43
 
44
+ delegate :cookies, to: :runner
44
45
  delegate :request, :response, to: :"runner.controller"
45
46
 
46
47
  def initialize(runner)
@@ -77,7 +78,7 @@ class TurboReflex::StateManager
77
78
  return unless changed?
78
79
  state.shrink!
79
80
  state.prune! max_bytesize: TurboReflex::StateManager.cookie_max_bytesize
80
- response.set_cookie "_turbo_reflex_state", value: state.ordinal_payload, path: "/", expires: 1.day.from_now
81
+ cookies["turbo_reflex.state"] = {value: state.ordinal_payload, path: "/", expires: 1.day.from_now}
81
82
  changes_applied
82
83
  end
83
84
 
@@ -97,6 +98,6 @@ class TurboReflex::StateManager
97
98
 
98
99
  # State that the server last rendered with.
99
100
  def cookie
100
- request.cookies["_turbo_reflex_state"]
101
+ cookies["turbo_reflex.state"]
101
102
  end
102
103
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboReflex
4
- VERSION = "0.0.11"
4
+ VERSION = "0.0.13"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbo_reflex",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Reflexes for Turbo Frames that help you build robust reactive applications",
5
5
  "main": "app/javascript/index.js",
6
6
  "repository": "https://github.com/hopsoft/turbo_reflex",
data/tags CHANGED
@@ -4260,7 +4260,6 @@ $z node_modules/angular-html-parser/lib/compiler/src/chars.d.ts /^export declare
4260
4260
  .col-span-3 node_modules/flowbite/dist/flowbite.min.css /^\/*! tailwindcss v3.1.6 | MIT License | https:\/\/tailwindcss.com*\/*,:after,:before{border:0 so/;" c
4261
4261
  .col-span-6 node_modules/flowbite/dist/flowbite.css /^.col-span-6 {$/;" c
4262
4262
  .col-span-6 node_modules/flowbite/dist/flowbite.min.css /^\/*! tailwindcss v3.1.6 | MIT License | https:\/\/tailwindcss.com*\/*,:after,:before{border:0 so/;" c
4263
- .collapse test/dummy/app/assets/builds/tailwind.css /^\/*! tailwindcss v3.2.1 | MIT License | https:\/\/tailwindcss.com*\/*,:after,:before{border:0 so/;" c
4264
4263
  .compile(Object schema) -&gt; Function&lt;Object data&gt; node_modules/ajv/README.md /^##### .compile(Object schema) -&gt; Function&lt;Object data&gt;$/;" T section:Ajv: Another JSON Schema Validator""API
4265
4264
  .container node_modules/flowbite/dist/flowbite.css /^ .container {$/;" c
4266
4265
  .container node_modules/flowbite/dist/flowbite.css /^.container {$/;" c
@@ -216622,7 +216621,7 @@ VDash node_modules/parse-srcset/tests/he.js /^ var decodeMap = {'Aacute':'\\xC1'
216622
216621
  VDash node_modules/simple-html-tokenizer/dist/es6/index.js /^ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳",/;" p variable:namedCharRefs
216623
216622
  VDash node_modules/simple-html-tokenizer/dist/simple-html-tokenizer.js /^ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾/;" p variable:anonymousFunction3825d8d70300.namedCharRefs
216624
216623
  VDash node_modules/simple-html-tokenizer/dist/types/generated/html5-named-char-refs.d.ts /^ VDash: string;$/;" C
216625
- VERSION lib/turbo_reflex/version.rb /^ VERSION = "0.0.11"$/;" C module:TurboReflex
216624
+ VERSION lib/turbo_reflex/version.rb /^ VERSION = "0.0.13"$/;" C module:TurboReflex
216626
216625
  VERSION node_modules/@angular/compiler/esm2015/src/output/source_map.js /^const VERSION = 3;$/;" C
216627
216626
  VERSION node_modules/@angular/compiler/esm2015/src/version.js /^export const VERSION = new Version('8.2.14');$/;" C
216628
216627
  VERSION node_modules/@angular/compiler/esm5/src/output/source_map.js /^var VERSION = 3;$/;" v
@@ -468395,7 +468394,7 @@ version node_modules/yaml/dist/index.js /^ version: '1.2'$/;" p variable:defaul
468395
468394
  version node_modules/yaml/dist/test-events.js /^ version: '1.2'$/;" p variable:testEvents.anonymousObjecta2b129440205
468396
468395
  version node_modules/yaml/package.json /^ "version": "1.8.3",$/;" s
468397
468396
  version node_modules/yocto-queue/package.json /^ "version": "0.1.0",$/;" s
468398
- version package.json /^ "version": "0.0.10",$/;" s
468397
+ version package.json /^ "version": "0.0.11",$/;" s
468399
468398
  versionIncluded node_modules/prettier-standard/src/vendor/node_modules/resolve/lib/core.js /^function versionIncluded(specifierValue) {$/;" f
468400
468399
  versionIncluded node_modules/resolve/lib/core.js /^function versionIncluded(specifierValue) {$/;" f
468401
468400
  versionInfo node_modules/graphql/version.d.ts /^export const versionInfo: {$/;" C
data/turbo_reflex.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency "pry-byebug"
33
33
  s.add_development_dependency "pry-doc"
34
34
  s.add_development_dependency "pry-rails"
35
- s.add_development_dependency "puma"
35
+ s.add_development_dependency "puma", "~> 5.6.5" # pin until capybara catches up
36
36
  s.add_development_dependency "rake"
37
37
  s.add_development_dependency "rexml"
38
38
  s.add_development_dependency "rouge"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_reflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Hopkins (hopsoft)
@@ -196,16 +196,16 @@ dependencies:
196
196
  name: puma
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ">="
199
+ - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0'
201
+ version: 5.6.5
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ">="
206
+ - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0'
208
+ version: 5.6.5
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: rake
211
211
  requirement: !ruby/object:Gem::Requirement