signum 0.5.1 → 0.7.0

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: 80bcbf3b5c508331a717b1f9b17b7d14b06c88612f54635e45f87643453ddf5b
4
- data.tar.gz: 5e44b69680cd000e0a048d595aa0539114b3fb1b9424a9b5812eff94d41d80fa
3
+ metadata.gz: 63cc9c70f252bac415cd89556051daffc3449d4175726cc272b26ba50a04d04b
4
+ data.tar.gz: 66eab14fd02f1cff3a5008bcaef2e9be94389e62a9a3c2f832243f2b4ac2a490
5
5
  SHA512:
6
- metadata.gz: d698d607336e153b25d2dfbe5717bbdeb7338a88c77049dbfa7c40e24b3cbcdd2918baedb902e360b47b67a0bed9827b73bc9604562263c27de95279d89c9571
7
- data.tar.gz: a94a9bea7fb4242fd2f9fd312ffbf2730bd4f8479244828ce977f39b54ea784c7b4048e0c66b6a04a133a1665a590d633964ade726d4af7b73414f3618bd2122
6
+ metadata.gz: 0d88fa165327a524271be29b1163350df04d52736c60354378f2a7ef2226d8567d58380991ac0e12e3c8f318d660be892ff504e46d7edd1a369fefdb0c405064
7
+ data.tar.gz: 0333cebc07d9d42445be878c069528cb09f6bd272ed450479ac4168fbfa5c0ec483f561f1896dedba65bb0e1eb31406aa538a1b403c6e0f98ad4eace747bb71e
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ # https://www.fastruby.io/blog/ruby/code-quality/how-we-use-rubocop-and-standardrb.html
2
+
3
+ require:
4
+ - standard
5
+
6
+ inherit_gem:
7
+ standard: config/base.yml
8
+
9
+ AllCops:
10
+ NewCops: enable
11
+ Exclude:
12
+ - node_modules/**/*
13
+ - public/**/*
14
+ - vendor/**/*
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
5
  git_source(:entdec) { |repo_name| "git@github.com:entdec/#{repo_name}.git" }
6
6
 
@@ -17,7 +17,6 @@ gemspec
17
17
  # To use a debugger
18
18
  # gem 'byebug', group: [:development, :test]
19
19
 
20
- gem 'auxilium', '~> 3', entdec: 'auxilium'
20
+ gem "auxilium", "~> 3", entdec: "auxilium"
21
21
 
22
- gem "ruby-lsp", "~> 0.3.2", :group => :development
23
- gem "sprockets-rails"
22
+ gem "sprockets-rails"
data/Gemfile.lock CHANGED
@@ -13,15 +13,16 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- signum (0.3.18)
16
+ signum (0.6.0)
17
17
  importmap-rails
18
18
  pg
19
19
  rails (> 6.0)
20
20
  slim-rails (~> 3)
21
- state_machines-activemodel
21
+ state_machines-activerecord
22
22
  stimulus-rails
23
23
  tailwindcss-rails
24
24
  turbo-rails
25
+ view_component
25
26
 
26
27
  GEM
27
28
  remote: https://rubygems.org/
@@ -100,6 +101,7 @@ GEM
100
101
  minitest (>= 5.1)
101
102
  mutex_m
102
103
  tzinfo (~> 2.0)
104
+ ast (2.4.2)
103
105
  base64 (0.2.0)
104
106
  bigdecimal (3.1.6)
105
107
  builder (3.2.4)
@@ -107,6 +109,7 @@ GEM
107
109
  connection_pool (2.4.1)
108
110
  crass (1.0.6)
109
111
  date (3.3.4)
112
+ debug (0.2.1)
110
113
  drb (2.2.0)
111
114
  ruby2_keywords
112
115
  erubi (1.12.0)
@@ -122,7 +125,9 @@ GEM
122
125
  irb (1.11.2)
123
126
  rdoc
124
127
  reline (>= 0.4.2)
128
+ json (2.7.2)
125
129
  language_server-protocol (3.17.0.3)
130
+ lint_roller (1.1.0)
126
131
  loofah (2.22.0)
127
132
  crass (~> 1.0.2)
128
133
  nokogiri (>= 1.12.0)
@@ -132,6 +137,7 @@ GEM
132
137
  net-pop
133
138
  net-smtp
134
139
  marcel (1.0.4)
140
+ method_source (1.0.0)
135
141
  mini_mime (1.1.5)
136
142
  mini_portile2 (2.8.5)
137
143
  minitest (5.22.2)
@@ -143,14 +149,17 @@ GEM
143
149
  net-protocol
144
150
  net-protocol (0.2.2)
145
151
  timeout
146
- net-smtp (0.4.0.1)
152
+ net-smtp (0.5.0)
147
153
  net-protocol
148
- nio4r (2.7.0)
154
+ nio4r (2.7.1)
149
155
  nokogiri (1.16.2)
150
156
  mini_portile2 (~> 2.8.2)
151
157
  racc (~> 1.4)
158
+ parallel (1.24.0)
159
+ parser (3.3.0.5)
160
+ ast (~> 2.4.1)
161
+ racc
152
162
  pg (1.5.6)
153
- prettier_print (1.2.1)
154
163
  psych (5.1.2)
155
164
  stringio
156
165
  pundit (2.3.1)
@@ -193,19 +202,35 @@ GEM
193
202
  rake (>= 12.2)
194
203
  thor (~> 1.0, >= 1.2.2)
195
204
  zeitwerk (~> 2.6)
205
+ rainbow (3.1.1)
196
206
  rake (13.1.0)
197
207
  rdoc (6.6.2)
198
208
  psych (>= 4.0.0)
209
+ regexp_parser (2.9.0)
199
210
  reline (0.4.3)
200
211
  io-console (~> 0.5)
201
212
  responders (3.1.1)
202
213
  actionpack (>= 5.2)
203
214
  railties (>= 5.2)
215
+ rexml (3.2.6)
204
216
  rolify (6.0.1)
205
- ruby-lsp (0.3.8)
206
- language_server-protocol (~> 3.17.0)
207
- sorbet-runtime
208
- syntax_tree (>= 5.0.0, < 6)
217
+ rubocop (1.62.1)
218
+ json (~> 2.3)
219
+ language_server-protocol (>= 3.17.0)
220
+ parallel (~> 1.10)
221
+ parser (>= 3.3.0.2)
222
+ rainbow (>= 2.2.2, < 4.0)
223
+ regexp_parser (>= 1.8, < 3.0)
224
+ rexml (>= 3.2.5, < 4.0)
225
+ rubocop-ast (>= 1.31.1, < 2.0)
226
+ ruby-progressbar (~> 1.7)
227
+ unicode-display_width (>= 2.4.0, < 3.0)
228
+ rubocop-ast (1.31.2)
229
+ parser (>= 3.3.0.4)
230
+ rubocop-performance (1.20.2)
231
+ rubocop (>= 1.48.1, < 2.0)
232
+ rubocop-ast (>= 1.30.0, < 2.0)
233
+ ruby-progressbar (1.13.0)
209
234
  ruby2_keywords (0.0.5)
210
235
  slim (5.2.1)
211
236
  temple (~> 0.10.0)
@@ -214,7 +239,6 @@ GEM
214
239
  actionpack (>= 3.1)
215
240
  railties (>= 3.1)
216
241
  slim (>= 3.0, < 6.0, != 5.0.0)
217
- sorbet-runtime (0.5.11276)
218
242
  sprockets (4.2.1)
219
243
  concurrent-ruby (~> 1.0)
220
244
  rack (>= 2.2.4, < 4)
@@ -224,16 +248,29 @@ GEM
224
248
  sprockets (>= 3.0.0)
225
249
  sqlite3 (1.7.2)
226
250
  mini_portile2 (~> 2.8.0)
251
+ standard (1.35.1)
252
+ language_server-protocol (~> 3.17.0.2)
253
+ lint_roller (~> 1.0)
254
+ rubocop (~> 1.62.0)
255
+ standard-custom (~> 1.0.0)
256
+ standard-performance (~> 1.3)
257
+ standard-custom (1.0.2)
258
+ lint_roller (~> 1.0)
259
+ rubocop (~> 1.50)
260
+ standard-performance (1.3.1)
261
+ lint_roller (~> 1.1)
262
+ rubocop-performance (~> 1.20.2)
227
263
  state_machines (0.6.0)
228
264
  state_machines-activemodel (0.9.0)
229
265
  activemodel (>= 6.0)
230
266
  state_machines (>= 0.6.0)
267
+ state_machines-activerecord (0.9.0)
268
+ activerecord (>= 6.0)
269
+ state_machines-activemodel (>= 0.9.0)
231
270
  stimulus-rails (1.3.3)
232
271
  railties (>= 6.0.0)
233
272
  stringio (3.1.0)
234
- syntax_tree (5.3.0)
235
- prettier_print (>= 1.2.0)
236
- tailwindcss-rails (2.3.0)
273
+ tailwindcss-rails (2.4.0)
237
274
  railties (>= 6.0.0)
238
275
  temple (0.10.3)
239
276
  thor (1.3.1)
@@ -245,6 +282,11 @@ GEM
245
282
  railties (>= 6.0.0)
246
283
  tzinfo (2.0.6)
247
284
  concurrent-ruby (~> 1.0)
285
+ unicode-display_width (2.5.0)
286
+ view_component (3.11.0)
287
+ activesupport (>= 5.2.0, < 8.0)
288
+ concurrent-ruby (~> 1.0)
289
+ method_source (~> 1.0)
248
290
  webrick (1.8.1)
249
291
  websocket-driver (0.7.6)
250
292
  websocket-extensions (>= 0.1.0)
@@ -256,10 +298,12 @@ PLATFORMS
256
298
 
257
299
  DEPENDENCIES
258
300
  auxilium (~> 3)!
259
- ruby-lsp (~> 0.3.2)
301
+ debug (~> 0)
302
+ rubocop (~> 1)
260
303
  signum!
261
304
  sprockets-rails
262
305
  sqlite3
306
+ standard (~> 1)
263
307
 
264
308
  BUNDLED WITH
265
309
  2.3.17
data/README.md CHANGED
@@ -51,14 +51,14 @@ s = Signum.signal(Current.user, text: "Hello World New", title: "Icon", icon:'fa
51
51
 
52
52
  Buttons and links:
53
53
  ```ruby
54
- s = Signum.success(Current.user, text: "Hello World New", title: "Link1", metadata: {buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}]})
55
- s = Signum.signal(Current.user, text: "Hello World New", title: "Link2", metadata: {buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}]}, icon: 'fa-regular fa-t-rex')
56
- s = Signum.signal(Current.user, text: "Hello World New", title: "Link2", metadata: {buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"},{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"},{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}]})
54
+ s = Signum.success(Current.user, text: "Hello World New", title: "Link1", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}])
55
+ s = Signum.signal(Current.user, text: "Hello World New", title: "Link2", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}], icon: 'fa-regular fa-t-rex')
56
+ s = Signum.signal(Current.user, text: "Hello World New", title: "Link2", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"},{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"},{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}])
57
57
  ```
58
58
 
59
59
  You can also show a progressbar, this is based on count and total. Setting the count to total completes the progressbar.
60
60
  ```ruby
61
- s = Signum.success(Current.user, text: "Hello World New", title: "this is test title", metadata: {buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}]}, count: 75, total: 150)
61
+ s = Signum.success(Current.user, text: "Hello World New", title: "this is test title", buttons:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}], links:[{title: "Google", url:"http://www.google.com"}, {title: "Apple", url: "http://www.apple.com"}, {title: "Amazon", url: "http://www.amazon.com"}], count: 75, total: 150)
62
62
  ```
63
63
 
64
64
  You can also attach attachments
@@ -70,6 +70,18 @@ s = Signum.success(Current.user, text: "Hello World New", title: "this is test t
70
70
 
71
71
  Signum returns you the signal object. You can update these signals and they will be rebroadcasted again.
72
72
 
73
+ ### Keys
74
+
75
+ Next to using a User (or any other model) another option is to use keys instead. You could signal all users using the following:
76
+ ```ruby
77
+ s = Signum.signal(:all, text: "Hello World New", title: "Icon", icon:'fa-regular fa-t-rex')
78
+ ```
79
+
80
+ The key all is supported out of the box, any other key needs you to pass it in the Notifications::Component, here we're using the session.id:
81
+ ```slim
82
+ = render(Signum::Notifications::Component.new([request.session.id]))
83
+ ```
84
+
73
85
  ## Contributing
74
86
 
75
87
  Contribution directions go here.
data/Rakefile CHANGED
@@ -1,36 +1,36 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require "bundler/setup"
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
5
  end
6
6
 
7
- require 'rdoc/task'
7
+ require "rdoc/task"
8
8
 
9
9
  RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Signum'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
10
+ rdoc.rdoc_dir = "rdoc"
11
+ rdoc.title = "Signum"
12
+ rdoc.options << "--line-numbers"
13
+ rdoc.rdoc_files.include("README.md")
14
+ rdoc.rdoc_files.include("lib/**/*.rb")
15
15
  end
16
16
 
17
17
  APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
18
+ load "rails/tasks/engine.rake"
19
19
 
20
- load 'rails/tasks/statistics.rake'
20
+ load "rails/tasks/statistics.rake"
21
21
 
22
- require 'bundler/gem_tasks'
22
+ require "bundler/gem_tasks"
23
23
 
24
- require 'rake/testtask'
24
+ require "rake/testtask"
25
25
 
26
26
  Rake::TestTask.new(:test) do |t|
27
- t.libs << 'test'
28
- t.pattern = 'test/**/*_test.rb'
27
+ t.libs << "test"
28
+ t.pattern = "test/**/*_test.rb"
29
29
  t.verbose = false
30
30
  end
31
31
 
32
32
  task default: :test
33
33
 
34
34
  # Adds the Auxilium semver task
35
- spec = Gem::Specification.find_by_name 'auxilium'
35
+ spec = Gem::Specification.find_by_name "auxilium"
36
36
  load "#{spec.gem_dir}/lib/tasks/semver.rake"
@@ -11,11 +11,11 @@
11
11
  - if signal.text.present?
12
12
  p.signum-notification-body__mb__bc__mc__tx
13
13
  = sanitize signal.text
14
- - if signal.metadata.present? && signal.metadata["links"].present?
14
+ - if signal.links.present?
15
15
  .signum-notification-body__mb__bc__mc__lkc
16
- - signal.metadata["links"].each do | link |
16
+ - signal.links.each do | link |
17
17
  - next unless link.is_a?(Hash)
18
- a.signum-notification-body__mb__bc__mc__lkc__lk*{href: link.fetch('url', '#'), target:link.fetch("target", "_blank") }.merge(link.fetch("link_attributes", {}))
18
+ a.signum-notification-body__mb__bc__mc__lkc__lk*{href: link.fetch('url', '#'), target:link.fetch("target", "_blank"), 'data-action': button["close"] ? "click->signum-notification-body#close" : "" }.merge(link.fetch("link_attributes", {}))
19
19
  i.fas.fa-link
20
20
  =< link["title"] || link["url"] || '(...)'
21
21
  - if signal.attachments.attached?
@@ -30,12 +30,12 @@
30
30
  | Close
31
31
  svg.h-5.w-5[xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentColor" aria-hidden="true"]
32
32
  path[d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"]
33
- - if signal.metadata.present? && signal.metadata["buttons"].present?
33
+ - if signal.buttons.present?
34
34
  .signum-notification-body__mb__bmc
35
- - signal.metadata["buttons"].each do | button |
35
+ - signal.buttons.each do | button |
36
36
  - next unless button.is_a?(Hash)
37
37
  .signum-notification-body__mb__bmc__bc
38
- a.signum-notification-body__mb__bmc__bc__b*{href: button.fetch('url', '#'), target:button.fetch("target", "_blank")}.merge(button.fetch("link_attributes", {}))
38
+ a.signum-notification-body__mb__bmc__bc__b*{href: button.fetch('url', '#'), target: button.fetch("target", "_blank"), 'data-action': button["close"] ? "click->signum-notification-body#close" : "" }.merge(button.fetch("link_attributes", {}))
39
39
  = button["title"]
40
40
  - if signal.count.present?
41
41
  - percentage = signal.total.present? ? signal.count.fdiv(signal.total) * 100 : signal.count
@@ -1,7 +1,8 @@
1
- div.text-left[data-controller="signum-notification-drawer" data-action="mouseover->signum-notification-drawer#show mouseleave->signum-notification-drawer#hide"]
2
- button.signum-notification-drawer-button
3
- = "<i class='hidden #{Signum.config.icons[:unread_main]}' data-signum-notification-drawer-target='alertbellicon'></i>".html_safe
4
- = "<i class='#{Signum.config.icons[:read_main]}' data-signum-notification-drawer-target='bellicon'></i>".html_safe
1
+ div.text-left[data-controller="signum-notification-drawer" data-action="mouseover->signum-notification-drawer#show mouseleave->signum-notification-drawer#hide click->signum-notification-drawer#closeNotifications"]
2
+ button.signum-notification-drawer-button data-action="click->signum-notification-drawer#closeNotifications"
3
+ i class="hidden #{Signum.config.icons[:unread_main]}" data-signum-notification-drawer-target='alertBellIcon'
4
+ i class="#{Signum.config.icons[:read_main]}" data-signum-notification-drawer-target='bellIcon'
5
+ i.hidden.fas.fa-times.cross-icon.text-xs.absolute.top-5.right-15#crossIcon data-signum-notification-drawer-target="crossIcon" data-action="click->signum-notification-drawer#closeNotifications"
5
6
 
6
- .signum-notification-drawer-tray.hidden[data-signum-notification-drawer-target="submenu" id="#{Signum.config.drawer_notifications_container_id.call}"]
7
- = render(Signum::NotificationDrawerItem::Component.with_collection(signals))
7
+ .signum-notification-drawer-tray.hidden[data-signum-notification-drawer-target="submenu" id="#{Signum.config.drawer_notifications_container_id.call}"]
8
+ = render(Signum::NotificationDrawerItem::Component.with_collection(signals))
@@ -1,7 +1,8 @@
1
1
  import ApplicationController from "signum/controllers/application_controller"
2
2
 
3
3
  export default class extends ApplicationController {
4
- static targets = ["alertbellicon", "bellicon", "submenu", "item"]
4
+
5
+ static targets = ["alertBellIcon", "bellIcon", "submenu", "item", "crossIcon"]
5
6
 
6
7
  connect() {
7
8
  this.bounditemActivity = this.itemActivity.bind(this)
@@ -10,6 +11,7 @@ export default class extends ApplicationController {
10
11
  setTimeout(() => {
11
12
  this.manageBellIcon()
12
13
  }, 300)
14
+
13
15
  }
14
16
 
15
17
  disconnect() {
@@ -19,6 +21,7 @@ export default class extends ApplicationController {
19
21
  show(event) {
20
22
  if (this.submenuTarget.children.length > 0) {
21
23
  this.submenuTarget.classList.remove("hidden")
24
+ this.crossIconTarget.classList.remove("hidden")
22
25
  } else {
23
26
  this.submenuTarget.classList.add("hidden")
24
27
  }
@@ -26,6 +29,26 @@ export default class extends ApplicationController {
26
29
 
27
30
  hide(event) {
28
31
  this.submenuTarget.classList.add("hidden")
32
+ this.crossIconTarget.classList.add("hidden")
33
+ if (this.submenuTarget.children.length < 0) {
34
+ this.alertBellIconTarget.classList.add("hidden")
35
+ }
36
+ }
37
+
38
+ closeNotifications(event) {
39
+ fetch("/signal/close_all", {
40
+ method: "GET",
41
+ headers: {
42
+ "Content-Type": "application/json",
43
+ },
44
+ })
45
+ .then((res) => {})
46
+ .catch((err) => {
47
+ console.log(err)
48
+ })
49
+ this.crossIconTarget.style.display = 'none';
50
+ this.bellIconTarget.style.display = 'inline-block'
51
+ this.alertBellIconTarget.style.display = 'none';
29
52
  }
30
53
 
31
54
  itemActivity(event) {
@@ -38,11 +61,11 @@ export default class extends ApplicationController {
38
61
 
39
62
  manageBellIcon() {
40
63
  if (this.submenuTarget.children.length > 0) {
41
- this.alertbelliconTarget.classList.remove("hidden")
42
- this.belliconTarget.classList.add("hidden")
64
+ this.alertBellIconTarget.classList.remove("hidden")
65
+ this.bellIconTarget.classList.add("hidden")
43
66
  } else {
44
- this.alertbelliconTarget.classList.add("hidden")
45
- this.belliconTarget.classList.remove("hidden")
67
+ this.alertBellIconTarget.classList.add("hidden")
68
+ this.bellIconTarget.classList.remove("hidden")
46
69
  }
47
70
  }
48
71
  }
@@ -1,5 +1,8 @@
1
1
  = helpers.turbo_stream_from :signals
2
2
 
3
3
  .pointer-events-none.fixed.inset-0.flex.items-end.px-2.py-6.sm:items-start.sm:p-6.z-10 data-turbo-permanent="true" id="signum_notifications"
4
- #notifications_all.flex.w-full.flex-col.items-center.space-y-2.sm:items-end
4
+ / #notifications_all.flex.w-full.flex-col.items-center.space-y-2.sm:items-end
5
5
  div.flex.w-full.flex-col.items-center.space-y-2.sm:items-end[id="#{Signum.config.balloon_notifications_container_id.call}"]
6
+ div.flex.w-full.flex-col.items-center.space-y-2.sm:items-end[id="notifications_all"]
7
+ - keys&.each do |key|
8
+ div.flex.w-full.flex-col.items-center.space-y-2.sm:items-end[id="notifications_#{key}"]
@@ -1,8 +1,9 @@
1
1
  module Signum
2
2
  module Notifications
3
3
  class Component < ViewComponent::Base
4
-
5
- def initialize()
4
+ attr_reader :keys
5
+ def initialize(keys = nil)
6
+ @keys = keys
6
7
  end
7
8
  end
8
9
  end
@@ -3,11 +3,19 @@ module Signum
3
3
  def show
4
4
  signal = Signum::Signal.find(signal_params[:id])
5
5
  signal.show! if signal.broadcasted?
6
+ head :ok
6
7
  end
7
8
 
8
9
  def close
9
10
  signal = Signum::Signal.find(signal_params[:id])
10
11
  signal.close!
12
+ head :ok
13
+ end
14
+
15
+ def close_all
16
+ signals = current_user.signals.where.not(state: "closed")
17
+ signals.each(&:close!)
18
+ head :ok
11
19
  end
12
20
 
13
21
  private
@@ -1,6 +1,6 @@
1
1
  module Signum
2
2
  class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
5
  end
6
6
  end
@@ -1,8 +1,10 @@
1
1
  module Signum
2
2
  class Signal < ApplicationRecord
3
- belongs_to :signalable, polymorphic: true
3
+ belongs_to :signalable, polymorphic: true, optional: true
4
4
  belongs_to :subjectable, polymorphic: true, optional: true
5
5
 
6
+ validates :signalable, presence: true, if: -> { key.blank? }
7
+
6
8
  has_many_attached :attachments
7
9
 
8
10
  after_create_commit :broadcast_create
@@ -11,11 +13,11 @@ module Signum
11
13
  def broadcast_create
12
14
  broadcast! if can_broadcast?
13
15
 
14
- broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call(signalable, id),
15
- html: ApplicationController.render(Signum::Notification::Component.new(self)))
16
+ broadcast_prepend_to(:signals, target: Signum.config.balloon_notifications_container_id.call(key || signalable, id),
17
+ html: ApplicationController.render(Signum::Notification::Component.new(self)))
16
18
 
17
- broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call(signalable, id),
18
- html: ApplicationController.render(Signum::NotificationDrawerItem::Component.new(signal: self)))
19
+ broadcast_prepend_to(:signals, target: Signum.config.drawer_notifications_container_id.call(key || signalable, id),
20
+ html: ApplicationController.render(Signum::NotificationDrawerItem::Component.new(signal: self)))
19
21
  end
20
22
 
21
23
  def broadcast_update
@@ -26,10 +28,10 @@ module Signum
26
28
  return
27
29
  end
28
30
 
29
- broadcast_replace_to(:signals, target: "notification_balloon_#{signalable_id}_#{id}",
30
- html: ApplicationController.render(Signum::NotificationBody::Component.new(self, { type: :balloon, timeout: 5 })))
31
- broadcast_replace_to(:signals, target: "notification_drawer_item_#{signalable_id}_#{id}",
32
- html: ApplicationController.render(Signum::NotificationBody::Component.new(self, { type: :drawer_item, timeout: 5 })))
31
+ broadcast_replace_to(:signals, target: Signum.config.balloon_notifications_container_id.call(key || signalable, id),
32
+ html: ApplicationController.render(Signum::NotificationBody::Component.new(self, {type: :balloon, timeout: 5})))
33
+ broadcast_replace_to(:signals, target: Signum.config.drawer_notifications_container_id.call(key || signalable, id),
34
+ html: ApplicationController.render(Signum::NotificationBody::Component.new(self, {type: :drawer_item, timeout: 5})))
33
35
  end
34
36
 
35
37
  validates :text, presence: true
data/config/routes.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  Signum::Engine.routes.draw do
2
- post 'signal/show', to: 'signal#show'
3
- post 'signal/close', to: 'signal#close'
4
- post 'signal/open_stickies', to: 'signal#open_stickies'
2
+ post "signal/show", to: "signal#show"
3
+ post "signal/close", to: "signal#close"
4
+ get "signal/close_all", to: "signal#close_all"
5
+ post "signal/open_stickies", to: "signal#open_stickies"
5
6
  end
@@ -1,10 +1,10 @@
1
1
  class CreateSignumSignals < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :signum_signals, id: :uuid do |t|
4
- t.string :state, default: 'pending'
4
+ t.string :state, default: "pending"
5
5
  t.references :signalable, polymorphic: true, optional: false, null: false, type: :uuid
6
6
 
7
- t.string :kind, default: 'notice'
7
+ t.string :kind, default: "notice"
8
8
  t.boolean :sticky
9
9
  t.string :icon
10
10
  t.string :title
@@ -0,0 +1,6 @@
1
+ class AddLinksAndButtonsToSignals < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :signum_signals, :links, :jsonb
4
+ add_column :signum_signals, :buttons, :jsonb
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ class AddKeyToSignal < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :signum_signals, :key, :string
4
+ add_index :signum_signals, :key
5
+ # t.references :signalable, polymorphic: true, optional: false, null: false, type: :uuid
6
+ # t.string "signalable_type", null: false
7
+ # t.uuid "signalable_id", null: false
8
+ change_column_null :signum_signals, :signalable_type, true
9
+ change_column_null :signum_signals, :signalable_id, true
10
+ end
11
+
12
+ def down
13
+ remove_column :signum_signals, :key, :string
14
+ remove_index :signum_signals, :key
15
+ # t.references :signalable, polymorphic: true, optional: false, null: false, type: :uuid
16
+ # t.string "signalable_type", null: false
17
+ # t.uuid "signalable_id", null: false
18
+ change_column_null :signum_signals, :signalable_type, false
19
+ change_column_null :signum_signals, :signalable_id, false
20
+ end
21
+ end
@@ -1,10 +1,10 @@
1
- require 'rails/generators/base'
1
+ require "rails/generators/base"
2
2
 
3
3
  module Signum
4
4
  module Generators
5
5
  class TailwindConfigGenerator < Rails::Generators::Base
6
- source_root File.expand_path('../templates', __dir__)
7
- desc 'Configures tailwind.config.js and application.tailwindcss.css'
6
+ source_root File.expand_path("../templates", __dir__)
7
+ desc "Configures tailwind.config.js and application.tailwindcss.css"
8
8
 
9
9
  def add_content_to_tailwind_config
10
10
  inject_into_file "config/tailwind.config.js", before: "],\n theme: {" do
@@ -6,7 +6,7 @@ module Signum
6
6
 
7
7
  class_methods do
8
8
  def signalable
9
- has_many :signals, as: :signalable, class_name: 'Signum::Signal'
9
+ has_many :signals, as: :signalable, class_name: "Signum::Signal"
10
10
 
11
11
  send :include, Signum::ActiveRecordHelpers::InstanceMethods
12
12
  extend(Signum::ActiveRecordHelpers::ClassMethods)
@@ -18,19 +18,19 @@ module Signum
18
18
 
19
19
  module InstanceMethods
20
20
  def online!
21
- update(presence: 'online')
21
+ update(presence: "online")
22
22
  end
23
23
 
24
24
  def offline!
25
- update(presence: 'offline')
25
+ update(presence: "offline")
26
26
  end
27
27
 
28
28
  def appeared!
29
- update(presence: 'appeared')
29
+ update(presence: "appeared")
30
30
  end
31
31
 
32
32
  def away!
33
- update(presence: 'away')
33
+ update(presence: "away")
34
34
  end
35
35
  end
36
36
  end
@@ -16,7 +16,7 @@ module Signum
16
16
 
17
17
  def set_defaults!
18
18
  self.class.schema.each do |name, default|
19
- instance_variable_set("@#{name}", default)
19
+ instance_variable_set(:"@#{name}", default)
20
20
  end
21
21
  end
22
22
 
@@ -29,21 +29,21 @@ module Signum
29
29
  include Options
30
30
 
31
31
  option :logger, default: Rails.logger
32
- option :user_model_name, default: 'User'
32
+ option :user_model_name, default: "User"
33
33
  option :hide_after, default: 3000
34
- option :base_controller, default: '::ApplicationController'
35
- option :base_service, default: '::ApplicationService'
36
- option :base_service_context, default: '::ApplicationContext'
34
+ option :base_controller, default: "::ApplicationController"
35
+ option :base_service, default: "::ApplicationService"
36
+ option :base_service_context, default: "::ApplicationContext"
37
37
  option :current_user, default: -> {}
38
38
  option :drawer_notifications_container_id, default: ->(signalable = nil, id = nil) {}
39
39
  option :balloon_notifications_container_id, default: ->(signalable = nil, id = nil) {}
40
40
  option :icons,
41
- default: { info: 'fa-solid fa-circle-info fa-lg',
42
- error: 'fa-solid fa-square-xmark fa-lg',
43
- success: 'fa-solid fa-circle-check fa-lg',
44
- warning: 'fa-solid fa-triangle-exclamation fa-lg',
45
- unread_main: 'fa-solid fa-bell-ring',
46
- read_main: 'fa-solid fa-bell' }
41
+ default: {info: "fa-solid fa-circle-info fa-lg",
42
+ error: "fa-solid fa-square-xmark fa-lg",
43
+ success: "fa-solid fa-circle-check fa-lg",
44
+ warning: "fa-solid fa-triangle-exclamation fa-lg",
45
+ unread_main: "fa-solid fa-bell-ring",
46
+ read_main: "fa-solid fa-bell"}
47
47
 
48
48
  def initialize
49
49
  set_defaults!
@@ -60,7 +60,7 @@ module Signum
60
60
  def configure
61
61
  yield(config)
62
62
  end
63
- alias setup configure
63
+ alias_method :setup, :configure
64
64
 
65
65
  def reset_config!
66
66
  @config = Configuration.new
data/lib/signum/engine.rb CHANGED
@@ -1,21 +1,23 @@
1
- require 'slim'
2
- require 'tailwindcss-rails'
1
+ require "slim"
2
+ require "tailwindcss-rails"
3
3
  require "importmap-rails"
4
4
  require "turbo-rails"
5
5
  require "stimulus-rails"
6
+ require "state_machines-activerecord"
7
+ require "view_component"
6
8
 
7
9
  module Signum
8
10
  class Engine < ::Rails::Engine
9
11
  isolate_namespace Signum
10
12
 
11
- initializer 'signum.assets' do |app|
13
+ initializer "signum.assets" do |app|
12
14
  app.config.assets.paths << root.join("app/javascript")
13
15
  app.config.assets.paths << root.join("app/components")
14
16
  app.config.assets.paths << root.join("vendor/javascript")
15
17
  app.config.assets.precompile += %w[signum_manifest]
16
18
  end
17
19
 
18
- initializer 'signum.importmap', before: "importmap" do |app|
20
+ initializer "signum.importmap", before: "importmap" do |app|
19
21
  app.config.importmap.paths << root.join("config/importmap.rb")
20
22
  app.config.importmap.cache_sweepers << root.join("app/javascript")
21
23
  app.config.importmap.cache_sweepers << root.join("app/components")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Signum
4
- VERSION = "0.5.1"
4
+ VERSION = "0.7.0"
5
5
  end
data/lib/signum.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'signum/engine'
2
- require 'signum/active_record_helpers'
3
- require 'signum/configuration'
1
+ require "signum/engine"
2
+ require "signum/active_record_helpers"
3
+ require "signum/configuration"
4
4
 
5
5
  module Signum
6
6
  class Error < StandardError
@@ -30,6 +30,8 @@ module Signum
30
30
  elsif signalable_receiver.respond_to?(:each)
31
31
  signalable_receiver.each { |signalable| signal(signalable, options) }
32
32
  nil
33
+ else
34
+ Signal.create!(options.merge(key: signalable_receiver.to_s))
33
35
  end
34
36
  end
35
37
 
@@ -37,28 +39,28 @@ module Signum
37
39
  def info(signalable, options)
38
40
  return unless signalable
39
41
 
40
- signal(signalable, options.merge(kind: 'info', icon: Signum.config.icons[:info]))
42
+ signal(signalable, options.merge(kind: "info", icon: Signum.config.icons[:info]))
41
43
  end
42
44
 
43
45
  # Signal about an error
44
46
  def error(signalable, options)
45
47
  return unless signalable
46
48
 
47
- signal(signalable, options.merge(kind: 'error', icon: Signum.config.icons[:error]))
49
+ signal(signalable, options.merge(kind: "error", icon: Signum.config.icons[:error]))
48
50
  end
49
51
 
50
52
  # Signal about something that went sucessfully
51
53
  def success(signalable, options)
52
54
  return unless signalable
53
55
 
54
- signal(signalable, options.merge(kind: 'success', icon: Signum.config.icons[:success]))
56
+ signal(signalable, options.merge(kind: "success", icon: Signum.config.icons[:success]))
55
57
  end
56
58
 
57
59
  # Signal about something that could go wrong
58
60
  def warning(signalable, options)
59
61
  return unless signalable
60
62
 
61
- signal(signalable, options.merge(kind: 'warning', icon: Signum.config.icons[:warning]))
63
+ signal(signalable, options.merge(kind: "warning", icon: Signum.config.icons[:warning]))
62
64
  end
63
65
  end
64
66
 
@@ -10,4 +10,4 @@ end
10
10
  if Rake::Task.task_defined?("tailwindcss:build")
11
11
  Rake::Task["tailwindcss:build"].enhance(["signum:tailwindcss:config"])
12
12
  Rake::Task["tailwindcss:watch"].enhance(["signum:tailwindcss:config"])
13
- end
13
+ end
data/signum.gemspec CHANGED
@@ -1,33 +1,37 @@
1
- $:.push File.expand_path('lib', __dir__)
1
+ $:.push File.expand_path("lib", __dir__)
2
2
 
3
3
  # Maintain your gem's version:
4
- require 'signum/version'
4
+ require "signum/version"
5
5
 
6
6
  # Describe your gem and declare its dependencies:
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'signum'
9
- spec.version = Signum::VERSION
10
- spec.authors = ['Tom de Grunt']
11
- spec.email = ['tom@degrunt.nl']
12
- spec.homepage = 'https://github.com/entdec/signum'
13
- spec.summary = 'Replacement for flash messages, also from background jobs'
14
- spec.description = 'Rails engine with replacement for flash messages, Signum allows for messages from background jobs.'
15
- spec.license = 'MIT'
8
+ spec.name = "signum"
9
+ spec.version = Signum::VERSION
10
+ spec.authors = ["Tom de Grunt"]
11
+ spec.email = ["tom@degrunt.nl"]
12
+ spec.homepage = "https://github.com/entdec/signum"
13
+ spec.summary = "Replacement for flash messages, also from background jobs"
14
+ spec.description = "Rails engine with replacement for flash messages, Signum allows for messages from background jobs."
15
+ spec.license = "MIT"
16
16
 
17
17
  spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
18
18
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
19
  end
20
20
 
21
- spec.add_dependency 'pg'
22
- spec.add_dependency 'rails', '> 6.0'
23
- spec.add_dependency 'state_machines-activerecord'
21
+ spec.add_dependency "pg"
22
+ spec.add_dependency "rails", "> 6.0"
23
+ spec.add_dependency "state_machines-activerecord"
24
24
 
25
- spec.add_development_dependency 'auxilium', '~> 3'
26
- spec.add_development_dependency 'sqlite3'
25
+ spec.add_development_dependency "auxilium", "~> 3"
26
+ spec.add_development_dependency "sqlite3"
27
27
 
28
28
  spec.add_dependency "slim-rails", "~> 3"
29
- spec.add_dependency 'tailwindcss-rails'
30
- spec.add_dependency 'importmap-rails'
31
- spec.add_dependency 'turbo-rails'
32
- spec.add_dependency 'stimulus-rails'
29
+ spec.add_dependency "tailwindcss-rails"
30
+ spec.add_dependency "importmap-rails"
31
+ spec.add_dependency "turbo-rails"
32
+ spec.add_dependency "stimulus-rails"
33
+ spec.add_dependency "view_component"
34
+ spec.add_development_dependency "debug", "~> 0"
35
+ spec.add_development_dependency "rubocop", "~> 1"
36
+ spec.add_development_dependency "standard", "~> 1"
33
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-04 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -150,6 +150,62 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: view_component
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: debug
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '1'
195
+ - !ruby/object:Gem::Dependency
196
+ name: standard
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '1'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '1'
153
209
  description: Rails engine with replacement for flash messages, Signum allows for messages
154
210
  from background jobs.
155
211
  email:
@@ -160,6 +216,7 @@ extra_rdoc_files: []
160
216
  files:
161
217
  - ".github/workflows/gem-push.yml"
162
218
  - ".gitignore"
219
+ - ".rubocop.yml"
163
220
  - Gemfile
164
221
  - Gemfile.lock
165
222
  - MIT-LICENSE
@@ -204,6 +261,8 @@ files:
204
261
  - db/migrate/20201125175035_create_signum_signals.rb
205
262
  - db/migrate/20230317123138_add_columns_to_signum_signal.rb
206
263
  - db/migrate/20231218095011_add_subject_to_signals.rb
264
+ - db/migrate/20240405112807_add_links_and_buttons_to_signals.rb
265
+ - db/migrate/20240410100722_add_key_to_signal.rb
207
266
  - lib/generators/signum/install_generator.rb
208
267
  - lib/generators/signum/tailwind_config_generator.rb
209
268
  - lib/generators/signum/templates/config/initializers/signum.rb
@@ -216,7 +275,6 @@ files:
216
275
  - package.json
217
276
  - signum.gemspec
218
277
  - vendor/javascript/@hotwired--stimulus.js
219
- - webpack.config.js
220
278
  - yarn.lock
221
279
  homepage: https://github.com/entdec/signum
222
280
  licenses:
data/webpack.config.js DELETED
@@ -1,126 +0,0 @@
1
- const path = require('path');
2
- const CleanWebpackPlugin = require('clean-webpack-plugin')
3
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
-
5
- module.exports = {
6
- entry: './frontend/src/signum.js',
7
- output: {
8
- path: __dirname + '/frontend/dist',
9
- filename: 'signum.js',
10
- library: 'Signum',
11
- libraryTarget: 'umd'
12
- },
13
- plugins: [
14
- // new CleanWebpackPlugin(['frontend/dist'], {}),
15
- new MiniCssExtractPlugin({
16
- filename: 'signum.css'
17
- })
18
- ],
19
- module: {
20
- rules: [
21
- {
22
- test: /\.js$/,
23
- exclude: /(node_modules|bower_components)/,
24
- use: {
25
- loader: 'babel-loader',
26
- options: {
27
- presets: ['env'],
28
- plugins: ["transform-class-properties"]
29
- }
30
- }
31
- },
32
- {
33
- test: /\.(|ttf|eot|svg|woff2?)(\?[\s\S]+)?$/,
34
- use: 'file-loader',
35
- },
36
- {
37
- test: /\.(sass|scss|css)$/,
38
- use: [
39
- {
40
- loader: MiniCssExtractPlugin.loader,
41
- },
42
- 'css-loader?sourceMap=false',
43
- 'sass-loader?sourceMap=false'
44
- ]
45
- }
46
- ]
47
- },
48
- resolve: {
49
- modules: [path.resolve('./node_modules'), path.resolve('./src')],
50
- extensions: ['.json', '.js']
51
- }
52
- }
53
-
54
-
55
-
56
- // const MiniCssExtractPlugin = require("mini-css-extract-plugin");
57
- // const path = require('path');
58
-
59
- // const devMode = process.env.NODE_ENV !== 'production'
60
-
61
- // module.exports = {
62
- // mode: devMode ? "development" : "production",
63
- // entry: {
64
- // signum: ['./frontend/src/signum.js']
65
- // },
66
- // output: {
67
- // path: __dirname + '/frontend/dist',
68
- // filename: '[name].js',
69
- // },
70
-
71
- // module: {
72
- // rules: [
73
- // {
74
- // test: /\.(c|sa|sc)ss$/,
75
- // exclude: /(node_modules)/,
76
- // // Use the following loaders from right-to-left, so it will
77
- // // use sass-loader first and ending with MiniCssExtractPlugin
78
- // use: [
79
- // {
80
- // // Extracts the CSS into a separate file and uses the
81
- // // defined configurations in the 'plugins' section
82
- // loader: MiniCssExtractPlugin.loader
83
- // },
84
- // {
85
- // // Interprets CSS
86
- // loader: "css-loader",
87
- // options: {
88
- // importLoaders: 2
89
- // }
90
- // },
91
- // {
92
- // // Adds support for Sass files, if using Less, then
93
- // // use the less-loader
94
- // loader: "sass-loader"
95
- // }
96
- // ]
97
- // },
98
- // {
99
- // test: /\.js$/,
100
- // exclude: /(node_moduldes)/,
101
- // use: {
102
- // loader: 'babel-loader',
103
- // options: {
104
- // presets: ['@babel/preset-env']
105
- // }
106
- // }
107
- // },
108
- // {
109
- // test: /\.(ttf|eot|svg|woff2?)(\?[\s\S]+)?$/,
110
- // use: 'file-loader',
111
- // },
112
- // ]
113
- // },
114
- // plugins: [
115
- // // Configuration options for MiniCssExtractPlugin. Here I'm only
116
- // // indicating what the CSS output file name should be and
117
- // // the location
118
- // new MiniCssExtractPlugin({
119
- // filename: devMode ? "[name].css" : "[name].min.css"
120
- // })
121
- // ],
122
- // resolve: {
123
- // modules: [path.resolve('./node_modules'), path.resolve('./src')],
124
- // extensions: ['.json', '.js']
125
- // }
126
- // }