bullet_train 1.20.0 → 1.21.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: 19a424300ea4463b1cd40cd375f81a9783a643a685f532ce54ef7ece2509850b
4
- data.tar.gz: cacee499473769cf2fb7ec70bbc5adf23b762d7b15bbdd2535bfb1c4dc01e9ec
3
+ metadata.gz: e96df89a7d40b6e275f57575a3157fc6ee8bccfae6b9c2a14d0b872c894bf5e3
4
+ data.tar.gz: f727d6df61d995e6e4d8b9e0a8f7143fd3881ab95b8baaa321f6e75ade40c9dd
5
5
  SHA512:
6
- metadata.gz: 6cc3b2cdecd60971309399675842e3c06266a2d4b6687bcdf88d93955cf776d1d8b78968a13240edf16a9ee34e6163baf843083701f6062eb16e25f758ad2a76
7
- data.tar.gz: '083b5681eda4de9d756d2c7ab81a51c5f684833bb641308dfe34bc051c853d9db70fde0fbbdab0da3d55a76625f4d7fba8503136aaf959b54027e8f90177c5fc'
6
+ metadata.gz: caf9f4bc490dae9ed4e1d05a6ea89d3e161c87862856229a13a87ec61c721480c6da32af4101143307bd748be22833a6956c8bac981210946feaf31eeb0937de
7
+ data.tar.gz: 914984adb93662453c4d0fd6f1c2c58624f3fbc4bef6e2560a9451ba8f153fe28386877443fe838b5cf02bfdd8f4c8f9e971e8122ccde6e59db7efb55f8f9fb8
@@ -1,3 +1,5 @@
1
1
  export * from './controllers'
2
2
  import './electron'
3
- import './support/turn'
3
+
4
+ import Turn from '@domchristie/turn'
5
+ Turn.start();
@@ -13,17 +13,17 @@
13
13
 
14
14
  <div class="space-y-3 pb-1">
15
15
  <p><%= raw t('.accept_the_invitation', user_email: current_user.email) %></p>
16
- <%= link_to t('.buttons.join_team'), accept_account_invitation_path(@invitation.uuid), method: :post, class: 'button full' %>
16
+ <%= link_to t('.buttons.join_team'), accept_account_invitation_path(@invitation.uuid), data: { turbo_method: :post }, class: 'button full' %>
17
17
  </div>
18
18
 
19
19
  <%= render 'account/shared/decision_line' %>
20
20
 
21
21
  <div class="space-y-3">
22
22
  <p><%= t('.sign_out') %></p>
23
- <%= link_to t('.buttons.logout'), main_app.destroy_user_session_path, method: 'delete', class: 'button-alternative full' %>
23
+ <%= link_to t('.buttons.logout'), main_app.destroy_user_session_path, data: { turbo_method: 'delete' }, class: 'button-alternative full' %>
24
24
  </div>
25
25
  <% else %>
26
- <%= link_to t('.buttons.join_team'), accept_account_invitation_path(@invitation.uuid), method: :post, class: 'button full' %>
26
+ <%= link_to t('.buttons.join_team'), accept_account_invitation_path(@invitation.uuid), data: { turbo_method: :post }, class: 'button full' %>
27
27
  <% end %>
28
28
  </div>
29
29
  <% end %>
@@ -47,7 +47,7 @@
47
47
  <% end %>
48
48
  </td>
49
49
  <td class="text-right">
50
- <%= link_to t('.buttons.reinvite'), [:reinvite, :account, membership], class: 'button-secondary button-smaller', method: :post, data: {confirm: t('.buttons.confirmations.reinvite', membership_name: membership.name)} if can? :edit, membership %>
50
+ <%= link_to t('.buttons.reinvite'), [:reinvite, :account, membership], class: 'button-secondary button-smaller', data: { turbo_method: :post, turbo_confirm: t('.buttons.confirmations.reinvite', membership_name: membership.name)} if can? :edit, membership %>
51
51
  <%= link_to t('.buttons.show'), [:account, membership], class: 'button-secondary button-smaller' %>
52
52
  </td>
53
53
  </tr>
@@ -9,7 +9,7 @@
9
9
  <% if can? :destroy, @membership %>
10
10
  <%= render 'account/shared/box', divider: true do |box| %>
11
11
  <% box.t title: '.remove_header', description: '.remove_description' %>
12
- <% box.body.button_to t('.buttons.destroy'), [:account, @membership], method: :delete, data: { confirm: t('.buttons.confirmations.destroy') }, class: 'button' %>
12
+ <% box.body.button_to t('.buttons.destroy'), [:account, @membership], data: { turbo_method: :delete, turbo_confirm: t('.buttons.confirmations.destroy') }, class: 'button' %>
13
13
  <% end %>
14
14
  <% end %>
15
15
  <% end %>
@@ -34,19 +34,19 @@
34
34
 
35
35
  <% box.actions do %>
36
36
  <% if @membership.tombstone? %>
37
- <%= link_to t('.buttons.reinvite'), [:reinvite, :account, @membership], class: first_button_primary, method: :post, data: {confirm: t('.buttons.confirmations.reinvite', membership_name: @membership.name)} if can? :edit, @membership %>
37
+ <%= link_to t('.buttons.reinvite'), [:reinvite, :account, @membership], class: first_button_primary, data: {turbo_method: :post, turbo_confirm: t('.buttons.confirmations.reinvite', membership_name: @membership.name)} if can? :edit, @membership %>
38
38
  <% end %>
39
39
 
40
40
  <%= link_to t('.buttons.edit'), [:edit, :account, @membership], class: first_button_primary if can? :edit, @membership %>
41
41
 
42
42
  <% unless @membership.tombstone? %>
43
43
  <% if @membership.admin? %>
44
- <%= link_to t('.buttons.demote'), [:demote, :account, @membership], method: :post, data: { confirm: t('global.confirm_message') }, class: first_button_primary if can? :demote, @membership %>
44
+ <%= link_to t('.buttons.demote'), [:demote, :account, @membership], data: { turbo_method: :post, turbo_confirm: t('global.confirm_message') }, class: first_button_primary if can? :demote, @membership %>
45
45
  <% else %>
46
- <%= link_to t('.buttons.promote'), [:promote, :account, @membership], method: :post, data: { confirm: t('global.confirm_message') }, class: first_button_primary if can? :promote, @membership %>
46
+ <%= link_to t('.buttons.promote'), [:promote, :account, @membership], data: { turbo_method: :post, turbo_confirm: t('global.confirm_message') }, class: first_button_primary if can? :promote, @membership %>
47
47
  <% end %>
48
48
  <% if (can? :destroy, @membership) && (!@membership.platform_agent) %>
49
- <%= button_to t(".buttons.#{membership_destroy_locale_key(@membership)}"), [:account, @membership], method: :delete, data: { confirm: t(".buttons.confirmations.#{membership_destroy_locale_key(@membership)}", model_locales(@membership)) }, class: first_button_primary %>
49
+ <%= button_to t(".buttons.#{membership_destroy_locale_key(@membership)}"), [:account, @membership], method: :delete, data: { turbo_confirm: t(".buttons.confirmations.#{membership_destroy_locale_key(@membership)}", model_locales(@membership)) }, class: first_button_primary %>
50
50
  <% end %>
51
51
  <% end %>
52
52
 
@@ -22,7 +22,7 @@
22
22
  <% if other_teams.any? %>
23
23
  <%= link_to t('global.buttons.back'), main_app.account_teams_path, class: first_button_primary %>
24
24
  <% else %>
25
- <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path(@user, onboard_logout: true), class: first_button_primary, method: 'delete' %>
25
+ <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path(@user, onboard_logout: true), class: first_button_primary, data: {turbo_method: 'delete'} %>
26
26
  <% end %>
27
27
  </div>
28
28
  <% end %>
@@ -39,7 +39,7 @@
39
39
  <% if other_teams.any? %>
40
40
  <%= link_to t('global.buttons.back'), main_app.account_teams_path, class: first_button_primary %>
41
41
  <% else %>
42
- <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path(@user, onboard_logout: true), class: first_button_primary, method: 'delete' %>
42
+ <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path(@user, onboard_logout: true), class: first_button_primary, data: {turbo_method: 'delete'} %>
43
43
  <% end %>
44
44
  </div>
45
45
  <% end %>
@@ -24,7 +24,7 @@
24
24
  <% if current_user.teams.any? %>
25
25
  <%= link_to t('global.buttons.back'), main_app.account_teams_path, class: first_button_primary %>
26
26
  <% else %>
27
- <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path, class: first_button_primary, method: 'delete' %>
27
+ <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path, class: first_button_primary, data:{turbo_method: 'delete'} %>
28
28
  <% end %>
29
29
  </div>
30
30
  <% end %>
@@ -18,7 +18,7 @@
18
18
  <div class="buttons">
19
19
  <%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
20
20
  <% if controller.action_name == "edit" %>
21
- <%= link_to t('account.teams.buttons.destroy'), [:account, team], method: :delete, data: { confirm: t('account.teams.buttons.confirmations.destroy') } %>
21
+ <%= link_to t('account.teams.buttons.destroy'), [:account, team], data: { turbo_method: :delete, turbo_confirm: t('account.teams.buttons.confirmations.destroy') } %>
22
22
  <% end %>
23
23
  <%= link_to t('global.buttons.cancel'), form.object.persisted? ? [:account, team] : [:account, :teams], class: "button-secondary" %>
24
24
  </div>
@@ -33,7 +33,7 @@ end
33
33
  <p><%= t('.log_out') %></p>
34
34
  </div>
35
35
 
36
- <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path, class: 'button-alternative full', method: 'delete' %></p>
36
+ <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path, class: 'button-alternative full', dat:{turbo_method: 'delete'} %></p>
37
37
 
38
38
  <%= render 'account/shared/decision_line' %>
39
39
 
@@ -70,7 +70,7 @@ end
70
70
  <% if current_user.teams.any? %>
71
71
  <%= link_to t('global.buttons.back'), main_app.account_teams_path, class: first_button_primary %>
72
72
  <% else %>
73
- <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path, class: first_button_primary, method: 'delete' %>
73
+ <%= link_to t('menus.main.labels.logout'), main_app.destroy_user_session_path, class: first_button_primary, data:{turbo_method: 'delete'} %>
74
74
  <% end %>
75
75
  </div>
76
76
  <% end %>
@@ -52,9 +52,9 @@
52
52
  <% end %>
53
53
 
54
54
  <% if current_user.otp_required_for_login? %>
55
- <%= link_to t('users.edit.two_factor.buttons.disable'), account_two_factor_path, method: :delete, remote: true, class: "button" %>
55
+ <%= link_to t('users.edit.two_factor.buttons.disable'), account_two_factor_path, data:{turbo_method: :delete}, remote: true, class: "button" %>
56
56
  <% else %>
57
- <%= link_to t('users.edit.two_factor.buttons.enable'), account_two_factor_path, method: :post, remote: true, class: "button" %>
57
+ <%= link_to t('users.edit.two_factor.buttons.enable'), account_two_factor_path, data:{turbo_method: :post}, remote: true, class: "button" %>
58
58
  <% end %>
59
59
  </div>
60
60
  <% end %>
@@ -38,6 +38,6 @@
38
38
 
39
39
  <h3><%= t('devise.headers.cancel_account') %></h3>
40
40
 
41
- <p>Unhappy? <%= button_to t('devise.buttons.cancel_account'), registration_path(resource_name), data: { confirm: t('global.confirm_message') }, method: :delete %></p>
41
+ <p>Unhappy? <%= button_to t('devise.buttons.cancel_account'), registration_path(resource_name), data: { turbo_confirm: t('global.confirm_message') }, method: :delete %></p>
42
42
 
43
43
  <%= link_to t('global.buttons.back'), :back %>
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.20.0"
2
+ VERSION = "1.21.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.0
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -437,7 +437,6 @@ files:
437
437
  - app/javascript/controllers/text_toggle_controller.js
438
438
  - app/javascript/electron/index.js
439
439
  - app/javascript/index.js
440
- - app/javascript/support/turn.js
441
440
  - app/mailers/concerns/mailers/base.rb
442
441
  - app/mailers/devise_mailer.rb
443
442
  - app/mailers/user_mailer.rb
@@ -1,183 +0,0 @@
1
- // MIT License
2
- //
3
- // Copyright (c) 2021 Dom Christie
4
- //
5
- // Permission is hereby granted, free of charge, to any person obtaining a copy
6
- // of this software and associated documentation files (the "Software"), to deal
7
- // in the Software without restriction, including without limitation the rights
8
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- // copies of the Software, and to permit persons to whom the Software is
10
- // furnished to do so, subject to the following conditions:
11
- //
12
- // The above copyright notice and this permission notice shall be included in all
13
- // copies or substantial portions of the Software.
14
- //
15
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- // SOFTWARE.
22
-
23
- class Turn {
24
- constructor (action) {
25
- this.action = action
26
- this.beforeExitClasses = new Set()
27
- this.exitClasses = new Set()
28
- this.enterClasses = new Set()
29
- }
30
-
31
- exit () {
32
- this.animateOut = animationsEnd('[data-turn-exit]')
33
- this.addClasses('before-exit')
34
- requestAnimationFrame(() => {
35
- this.addClasses('exit')
36
- this.removeClasses('before-exit')
37
- })
38
- }
39
-
40
- async beforeEnter (event) {
41
- if (this.action === 'restore') return
42
-
43
- event.preventDefault()
44
-
45
- if (this.isPreview) {
46
- this.hasPreview = true
47
- await this.animateOut
48
- } else {
49
- await this.animateOut
50
- if (this.animateIn) await this.animateIn
51
- }
52
-
53
- event.detail.resume()
54
- }
55
-
56
- async enter () {
57
- this.removeClasses('exit')
58
-
59
- if (this.shouldAnimateEnter) {
60
- this.animateIn = animationsEnd('[data-turn-enter]')
61
- this.addClasses('enter')
62
- }
63
- }
64
-
65
- async complete () {
66
- await this.animateIn
67
- this.removeClasses('enter')
68
- }
69
-
70
- abort () {
71
- this.removeClasses('before-exit')
72
- this.removeClasses('exit')
73
- this.removeClasses('enter')
74
- }
75
-
76
- get shouldAnimateEnter () {
77
- if (this.action === 'restore') return false
78
- if (this.isPreview) return true
79
- if (this.hasPreview) return false
80
- return true
81
- }
82
-
83
- get isPreview () {
84
- return document.documentElement.hasAttribute('data-turbo-preview')
85
- }
86
-
87
- addClasses (type) {
88
- document.documentElement.classList.add(`turn-${type}`)
89
-
90
- Array.from(document.querySelectorAll(`[data-turn-${type}]`)).forEach((element) => {
91
- element.dataset[`turn${pascalCase(type)}`].split(/\s+/).forEach((klass) => {
92
- if (klass) {
93
- element.classList.add(klass)
94
- this[`${camelCase(type)}Classes`].add(klass)
95
- }
96
- })
97
- })
98
- }
99
-
100
- removeClasses (type) {
101
- document.documentElement.classList.remove(`turn-${type}`)
102
-
103
- Array.from(document.querySelectorAll(`[data-turn-${type}]`)).forEach((element) => {
104
- this[`${camelCase(type)}Classes`].forEach((klass) => element.classList.remove(klass))
105
- })
106
- }
107
- }
108
-
109
- Turn.start = function () {
110
- if (motionSafe()) {
111
- for (var event in this.eventListeners) {
112
- addEventListener(event, this.eventListeners[event])
113
- }
114
- }
115
- }
116
-
117
- Turn.stop = function () {
118
- for (var event in this.eventListeners) {
119
- removeEventListener(event, this.eventListeners[event])
120
- }
121
- delete this.currentTurn
122
- }
123
-
124
- Turn.eventListeners = {
125
- 'turbo:visit': function (event) {
126
- if (this.currentTurn) this.currentTurn.abort()
127
- this.currentTurn = new this(event.detail.action)
128
- this.currentTurn.exit()
129
- }.bind(Turn),
130
- 'turbo:before-render': function (event) {
131
- this.currentTurn.beforeEnter(event)
132
- }.bind(Turn),
133
- 'turbo:render': function () {
134
- this.currentTurn.enter()
135
- }.bind(Turn),
136
- 'turbo:load': function () {
137
- if (this.currentTurn) this.currentTurn.complete()
138
- }.bind(Turn),
139
- 'popstate': function () {
140
- if (this.currentTurn && this.currentTurn.action !== 'restore') {
141
- this.currentTurn.abort()
142
- }
143
- }.bind(Turn)
144
- }
145
-
146
- function prefersReducedMotion () {
147
- const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)')
148
- return !mediaQuery || mediaQuery.matches
149
- }
150
-
151
- function motionSafe () {
152
- return !prefersReducedMotion()
153
- }
154
-
155
- function animationsEnd (selector) {
156
- const elements = [...document.querySelectorAll(selector)]
157
-
158
- return Promise.all(elements.map((element) => {
159
- return new Promise((resolve) => {
160
- function listener () {
161
- element.removeEventListener('animationend', listener)
162
- resolve()
163
- }
164
- element.addEventListener('animationend', listener)
165
- })
166
- }))
167
- }
168
-
169
- function pascalCase (string) {
170
- return string.split(/[^\w]/).map(capitalize).join('')
171
- }
172
-
173
- function camelCase (string) {
174
- return string.split(/[^\w]/).map(
175
- (w, i) => i === 0 ? w.toLowerCase() : capitalize(w)
176
- ).join('')
177
- }
178
-
179
- function capitalize (string) {
180
- return string.replace(/^\w/, (c) => c.toUpperCase())
181
- }
182
-
183
- Turn.start()