toastify 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90839e2783e1a2fb7011195f55d7fef2d41407a7e6d0559f4d00751315895b2a
4
- data.tar.gz: 916288f67f30353a27a67de7168dc146f6109a0592c8218f24493655d46dd43a
3
+ metadata.gz: cc7349a13221be5cd792458f297854e87cbfe246996e3a1a605a601adbbb487c
4
+ data.tar.gz: 5c3312cb801c7f50b92b4ff32ac9d5a1005bacf791ce27732ee1bd176b5dfbf1
5
5
  SHA512:
6
- metadata.gz: 16da282d92daea5d5d67d4d70a5ef6db58cec9cf877d4c785cb7b3cf9ef21b805cce68a60da09180c726570e217a80dce45ce66039ab7c81e7d5964c8d6e7a5e
7
- data.tar.gz: 3e27ec8a357376fb25bc22b64f9ac370b83f39f0bbba2522c031f03e7726fb8b37dd14f9ca70014cc4f230a73133278ed5919d3cc39c22dfaf4328b9b3ef313c
6
+ metadata.gz: a5d2762be86db79033de87a095201bcd717087778449f39f6d59cc8516443208dffd214a268a7c0fd8f9acff569be3c2a6c21cf8a40015606087be1db5c8286a
7
+ data.tar.gz: a12bf06c49a854ad24f49935fa16a2b9333401bf56c00db3ece9d070f9dc67fb8db762b6b78ac01f7ed7484cf3f4ed0d84a7487e9182c6fcb8ab7c960f7d7833
data/README.md CHANGED
@@ -5,13 +5,12 @@
5
5
  Compatible with Rails 4+ and also integrates seamlessly with Turbo Stream requests.
6
6
  It can also be used directly in JavaScript (e.g., `Toastify.success("Saved!")`).
7
7
 
8
- ### Example Images
9
-
10
- <img width="346" height="85" alt="Light Theme Example" src="https://github.com/user-attachments/assets/b7a3123a-89a3-4f49-97ff-aa25f4b870d0" />
8
+ [![Gem Version](https://badge.fury.io/rb/toastify.svg)](https://rubygems.org/gems/toastify)
9
+ [![GitHub Release](https://img.shields.io/github/v/release/vasanthakumar-a/toastify)](https://github.com/vasanthakumar-a/toastify/releases)
11
10
 
12
- <img width="338" height="87" alt="Dark Theme Example" src="https://github.com/user-attachments/assets/65671ac6-91d7-471f-9c03-6458023f3ae2" />
11
+ ### Example Images
13
12
 
14
- <img width="339" height="83" alt="Colored Theme Example" src="https://github.com/user-attachments/assets/1c99ffdb-dc3c-4fef-aa16-b7eff08e0cde" />
13
+ <img width="340" height="222" alt="Theme Examples" src="https://github.com/user-attachments/assets/ed0350ef-295d-4ba6-ab51-94a9e071eac4" />
15
14
 
16
15
  ## Installation
17
16
 
@@ -12,11 +12,11 @@ const TRANSITIONS = { SLIDE: "slide", BOUNCE: "bounce", ZOOM: "zoom", FLIP: "fli
12
12
  const TYPES = { SUCCESS: "success", ERROR: "error", WARNING: "warning", INFO: "info", DEFAULT: "default" }
13
13
 
14
14
  const ICONS = {
15
- success: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="20" height="20"><circle cx="12" cy="12" r="10"/><path d="M8 12l3 3 5-5"/></svg>`,
15
+ success: `<svg fill="currentColor" width="20" height="20" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12,2 C17.5228475,2 22,6.4771525 22,12 C22,17.5228475 17.5228475,22 12,22 C6.4771525,22 2,17.5228475 2,12 C2,6.4771525 6.4771525,2 12,2 Z M12,4 C7.581722,4 4,7.581722 4,12 C4,16.418278 7.581722,20 12,20 C16.418278,20 20,16.418278 20,12 C20,7.581722 16.418278,4 12,4 Z M15.2928932,8.29289322 L10,13.5857864 L8.70710678,12.2928932 C8.31658249,11.9023689 7.68341751,11.9023689 7.29289322,12.2928932 C6.90236893,12.6834175 6.90236893,13.3165825 7.29289322,13.7071068 L9.29289322,15.7071068 C9.68341751,16.0976311 10.3165825,16.0976311 10.7071068,15.7071068 L16.7071068,9.70710678 C17.0976311,9.31658249 17.0976311,8.68341751 16.7071068,8.29289322 C16.3165825,7.90236893 15.6834175,7.90236893 15.2928932,8.29289322 Z"/></svg>`,
16
16
  error: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="20" height="20"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>`,
17
- warning: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="20" height="20"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`,
18
- info: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="20" height="20"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>`,
19
- default: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="20" height="20"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>`,
17
+ warning: `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 14a1 1 0 0 1-1-1v-3a1 1 0 1 1 2 0v3a1 1 0 0 1-1 1zm-1.5 2.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0z" fill="currentColor"/><path d="M10.23 3.216c.75-1.425 2.79-1.425 3.54 0l8.343 15.852C22.814 20.4 21.85 22 20.343 22H3.657c-1.505 0-2.47-1.6-1.77-2.931L10.23 3.216zM20.344 20L12 4.147 3.656 20h16.688z" fill="currentColor"/></svg>`,
18
+ info: `<svg fill="currentColor" width="20" height="20" viewBox="-2 -2 24 24" preserveAspectRatio="xMinYMin"><path d='M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-10a1 1 0 0 1 1 1v5a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1zm0-1a1 1 0 1 1 0-2 1 1 0 0 1 0 2z'/></svg>`,
19
+ default: `<svg fill="currentColor" width="20" height="20" viewBox="-2 -2 24 24" preserveAspectRatio="xMinYMin"><path d='M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-10a1 1 0 0 1 1 1v5a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1zm0-1a1 1 0 1 1 0-2 1 1 0 0 1 0 2z'/></svg>`,
20
20
  }
21
21
 
22
22
  const ENTER_ANIMS = {
@@ -3,13 +3,13 @@ module Toastify
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- after_action :append_toastify_to_stream
6
+ after_action :append_toastify_to_response
7
7
  end
8
8
 
9
9
  private
10
10
 
11
- def append_toastify_to_stream
12
- return unless request.format.turbo_stream?
11
+ def append_toastify_to_response
12
+ return unless request.format.turbo_stream? || turbo_frame_request?
13
13
 
14
14
  toast_flashes = flash.reject { |type, _| type.to_s.start_with?("toast_") }
15
15
  return unless toast_flashes.any?
@@ -17,12 +17,23 @@ module Toastify
17
17
  script_content = helpers.toastify_script_tag
18
18
  return if script_content.blank?
19
19
 
20
- stream_tag = turbo_stream.append("flash-outlet", script_content)
20
+ if request.format.turbo_stream?
21
+ payload = turbo_stream.append("flash-outlet", script_content).to_s
21
22
 
22
- if response.body.is_a?(String)
23
- response.body += stream_tag.to_s
23
+ if response.body.is_a?(String)
24
+ response.body += payload
25
+ else
26
+ response.body = response.body.to_s + payload
27
+ end
24
28
  else
25
- response.body = response.body.to_s + stream_tag.to_s
29
+ body = response.body.to_s
30
+ frame_closing_tag = "</turbo-frame>"
31
+
32
+ if body.include?(frame_closing_tag)
33
+ response.body = body.sub(frame_closing_tag, "#{script_content}#{frame_closing_tag}")
34
+ else
35
+ response.body = body + script_content.to_s
36
+ end
26
37
  end
27
38
  end
28
39
  end
@@ -1,3 +1,3 @@
1
1
  module Toastify
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toastify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vasanthakumar-a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-06 00:00:00.000000000 Z
11
+ date: 2026-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails