turbo_reflex 0.0.21 → 0.0.22

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: 14ea470bd66a4d392babd0d00d219091b5a778f9723383cc0746ea1ce58a3cc0
4
- data.tar.gz: 14cbf3b9d078897ac2e4d00810a9988d5e5781339a2271e9565d26b2a5fffe31
3
+ metadata.gz: 0a7328a5d0699434ae297cf74bd329fff233f070838fdf432cc97639346d10fc
4
+ data.tar.gz: 3d81fc83f65dce19ae4feebf8ddf2b70cb1e8f9cbea30fe326375b5eb231e7b0
5
5
  SHA512:
6
- metadata.gz: 2483370dcdd02c59cfcdadfd84826f7c87ae64151d8fbc8a226df8b0055812c860b8347bdecdb5ad745b0a395e564159300278f05a5fbb102deff3bc5821b82e
7
- data.tar.gz: b9bf3a744c88330bf715abdb16da828712183fd005366c7ebb730e2dd170e0e68cb06c913f9589a2955ffc0233de5643ce46d6647c17482e234aef8d33378cf8
6
+ metadata.gz: 49cbf87cb1923f54495f888ceee1520ba889a02d85b84f85014ed2a74a1bbdd0039d975675e1d8f12a028cf4a4a5a526603e0645b081d957d435553736ade6b8
7
+ data.tar.gz: 39bdf7de08fb53445a261737dd4c87c142c727408c5ae29b80f257bb025087c31ff14ccdc3029d8e5ddbe76e22823ea9df0703acb6dc5375fc8b1e70da4bd2b0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_reflex (0.0.21)
4
+ turbo_reflex (0.0.22)
5
5
  rails (>= 6.1)
6
6
  turbo-rails (>= 1.1)
7
7
  turbo_ready (>= 0.1)
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  </h1>
9
9
  <p align="center">
10
10
  <a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/">
11
- <img alt="Lines of Code" src="https://img.shields.io/badge/loc-1187-47d299.svg" />
11
+ <img alt="Lines of Code" src="https://img.shields.io/badge/loc-1188-47d299.svg" />
12
12
  </a>
13
13
  <a href="https://codeclimate.com/github/hopsoft/turbo_reflex/maintainability">
14
14
  <img src="https://api.codeclimate.com/v1/badges/fe1162a742fe83a4fdfd/maintainability" />
@@ -213,9 +213,9 @@ class TurboReflex::Runner
213
213
 
214
214
  def response_type
215
215
  body = (response_body.try(:join) || response_body.to_s).strip
216
- return :body if body.match?(/<\/\s*body.*>/i)
217
- return :frame if body.match?(/<\/\s*turbo-frame.*>/i)
218
- return :stream if body.match?(/<\/\s*turbo-stream.*>/i)
216
+ return :body if body.match?(/<\/\s*body/i)
217
+ return :frame if body.match?(/<\/\s*turbo-frame/i)
218
+ return :stream if body.match?(/<\/\s*turbo-stream/i)
219
219
  :unknown
220
220
  end
221
221
 
@@ -267,17 +267,18 @@ class TurboReflex::Runner
267
267
  sanitized_content = content_sanitizer.sanitize(content).html_safe
268
268
  return if sanitized_content.blank?
269
269
 
270
- # TODO: setup negative lookahead instead of using match
271
- case response_type
270
+ html = case response_type
272
271
  when :body
273
- match = response.body.match(/<\/\s*body.*>/i).to_s
274
- response.body.sub!(match, match.prepend(sanitized_content))
272
+ match = response.body.match(/<\/\s*body/i).to_s
273
+ response.body.sub match, [sanitized_content, match].join
275
274
  when :frame
276
- match = response.body.match(/<\/\s*turbo-frame.*>/i).to_s
277
- response.body.sub!(match, match.prepend(sanitized_content))
275
+ match = response.body.match(/<\/\s*turbo-frame/i).to_s
276
+ response.body.sub match, [sanitized_content, match].join
278
277
  else
279
- response_body << sanitized_content
278
+ [response.body, sanitized_content].join
280
279
  end
280
+
281
+ response.body = html
281
282
  rescue => error
282
283
  Rails.logger.error "TurboReflex::Runner failed to append to the response! #{error.message}"
283
284
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboReflex
4
- VERSION = "0.0.21"
4
+ VERSION = "0.0.22"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbo_reflex",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
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
@@ -216620,7 +216620,7 @@ VDash node_modules/parse-srcset/tests/he.js /^ var decodeMap = {'Aacute':'\\xC1'
216620
216620
  VDash node_modules/simple-html-tokenizer/dist/es6/index.js /^ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳",/;" p variable:namedCharRefs
216621
216621
  VDash node_modules/simple-html-tokenizer/dist/simple-html-tokenizer.js /^ Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾/;" p variable:anonymousFunction3825d8d70300.namedCharRefs
216622
216622
  VDash node_modules/simple-html-tokenizer/dist/types/generated/html5-named-char-refs.d.ts /^ VDash: string;$/;" C
216623
- VERSION lib/turbo_reflex/version.rb /^ VERSION = "0.0.21"$/;" C module:TurboReflex
216623
+ VERSION lib/turbo_reflex/version.rb /^ VERSION = "0.0.22"$/;" C module:TurboReflex
216624
216624
  VERSION node_modules/@angular/compiler/esm2015/src/output/source_map.js /^const VERSION = 3;$/;" C
216625
216625
  VERSION node_modules/@angular/compiler/esm2015/src/version.js /^export const VERSION = new Version('8.2.14');$/;" C
216626
216626
  VERSION node_modules/@angular/compiler/esm5/src/output/source_map.js /^var VERSION = 3;$/;" v
@@ -468457,7 +468457,7 @@ version node_modules/yaml/dist/index.js /^ version: '1.2'$/;" p variable:defaul
468457
468457
  version node_modules/yaml/dist/test-events.js /^ version: '1.2'$/;" p variable:testEvents.anonymousObjecta2b129440205
468458
468458
  version node_modules/yaml/package.json /^ "version": "1.8.3",$/;" s
468459
468459
  version node_modules/yocto-queue/package.json /^ "version": "0.1.0",$/;" s
468460
- version package.json /^ "version": "0.0.20",$/;" s
468460
+ version package.json /^ "version": "0.0.21",$/;" s
468461
468461
  versionIncluded node_modules/prettier-standard/src/vendor/node_modules/resolve/lib/core.js /^function versionIncluded(specifierValue) {$/;" f
468462
468462
  versionIncluded node_modules/resolve/lib/core.js /^function versionIncluded(specifierValue) {$/;" f
468463
468463
  versionInfo node_modules/graphql/version.d.ts /^export const versionInfo: {$/;" C
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.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Hopkins (hopsoft)