plutonium 0.26.3 → 0.26.6
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 +4 -4
- data/app/assets/plutonium.css +1 -1
- data/app/assets/plutonium.js +147 -43
- data/app/assets/plutonium.js.map +3 -3
- data/app/assets/plutonium.min.js +18 -18
- data/app/assets/plutonium.min.js.map +3 -3
- data/config/initializers/action_policy.rb +9 -0
- data/lib/plutonium/action/base.rb +3 -1
- data/lib/plutonium/action_policy/sti_policy_lookup.rb +43 -0
- data/lib/plutonium/core/controller.rb +13 -4
- data/lib/plutonium/core/controllers/authorizable.rb +2 -2
- data/lib/plutonium/definition/actions.rb +1 -1
- data/lib/plutonium/railtie.rb +1 -1
- data/lib/plutonium/resource/controllers/authorizable.rb +4 -4
- data/lib/plutonium/resource/policy.rb +1 -1
- data/lib/plutonium/ui/action_button.rb +2 -2
- data/lib/plutonium/ui/color_mode_selector.rb +12 -59
- data/lib/plutonium/ui/layout/header.rb +14 -2
- data/lib/plutonium/ui/layout/sidebar.rb +0 -8
- data/lib/plutonium/ui/table/theme.rb +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/package.json +1 -1
- data/src/js/controllers/attachment_input_controller.js +41 -1
- data/src/js/controllers/color_mode_controller.js +33 -23
- data/src/js/controllers/easymde_controller.js +45 -6
- data/src/js/controllers/flatpickr_controller.js +24 -8
- data/src/js/controllers/intl_tel_input_controller.js +23 -5
- data/src/js/controllers/slim_select_controller.js +27 -12
- metadata +4 -2
@@ -12,10 +12,20 @@ export default class extends Controller {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
inputTargetConnected() {
|
15
|
-
if (!this.hasInputTarget) return;
|
15
|
+
if (!this.hasInputTarget || this.iti) return;
|
16
16
|
|
17
17
|
this.iti = window.intlTelInput(this.inputTarget, this.#buildOptions())
|
18
|
-
|
18
|
+
|
19
|
+
// Just recreate IntlTelInput after morphing - the DOM will have correct value
|
20
|
+
this.element.addEventListener("turbo:morph-element", (event) => {
|
21
|
+
if (event.target === this.element && !this.morphing) {
|
22
|
+
this.morphing = true;
|
23
|
+
requestAnimationFrame(() => {
|
24
|
+
this.#handleMorph();
|
25
|
+
this.morphing = false;
|
26
|
+
});
|
27
|
+
}
|
28
|
+
});
|
19
29
|
}
|
20
30
|
|
21
31
|
inputTargetDisconnected() {
|
@@ -25,9 +35,17 @@ export default class extends Controller {
|
|
25
35
|
}
|
26
36
|
}
|
27
37
|
|
28
|
-
|
29
|
-
this.
|
30
|
-
|
38
|
+
#handleMorph() {
|
39
|
+
if (!this.inputTarget || !this.inputTarget.isConnected) return;
|
40
|
+
|
41
|
+
// Clean up the old instance
|
42
|
+
if (this.iti) {
|
43
|
+
this.iti.destroy();
|
44
|
+
this.iti = null;
|
45
|
+
}
|
46
|
+
|
47
|
+
// Recreate the intl tel input - it will pick up the current DOM value
|
48
|
+
this.iti = window.intlTelInput(this.inputTarget, this.#buildOptions());
|
31
49
|
}
|
32
50
|
|
33
51
|
#buildOptions() {
|
@@ -3,6 +3,19 @@ import { Controller } from "@hotwired/stimulus";
|
|
3
3
|
// Connects to data-controller="slim-select"
|
4
4
|
export default class extends Controller {
|
5
5
|
connect() {
|
6
|
+
if (this.slimSelect) return;
|
7
|
+
|
8
|
+
this.#setupSlimSelect();
|
9
|
+
|
10
|
+
// Just recreate SlimSelect after morphing - the DOM will have correct selections
|
11
|
+
this.element.addEventListener("turbo:morph-element", (event) => {
|
12
|
+
if (event.target === this.element) {
|
13
|
+
requestAnimationFrame(() => this.#handleMorph());
|
14
|
+
}
|
15
|
+
});
|
16
|
+
}
|
17
|
+
|
18
|
+
#setupSlimSelect() {
|
6
19
|
const settings = {};
|
7
20
|
const modal = document.querySelector('[data-controller="remote-modal"]');
|
8
21
|
|
@@ -48,11 +61,6 @@ export default class extends Controller {
|
|
48
61
|
|
49
62
|
// Add mutation observer to track aria-expanded attribute
|
50
63
|
this.setupAriaObserver();
|
51
|
-
|
52
|
-
this.element.setAttribute(
|
53
|
-
"data-action",
|
54
|
-
"turbo:morph-element->slim-select#reconnect"
|
55
|
-
);
|
56
64
|
}
|
57
65
|
|
58
66
|
handleDropdownPosition() {
|
@@ -162,6 +170,20 @@ export default class extends Controller {
|
|
162
170
|
}
|
163
171
|
|
164
172
|
disconnect() {
|
173
|
+
this.#cleanupSlimSelect();
|
174
|
+
}
|
175
|
+
|
176
|
+
#handleMorph() {
|
177
|
+
if (!this.element.isConnected) return;
|
178
|
+
|
179
|
+
// Clean up the old instance without DOM manipulation
|
180
|
+
this.#cleanupSlimSelect();
|
181
|
+
|
182
|
+
// Recreate the select - it will automatically pick up the current DOM selections
|
183
|
+
this.#setupSlimSelect();
|
184
|
+
}
|
185
|
+
|
186
|
+
#cleanupSlimSelect() {
|
165
187
|
// Clean up event listeners
|
166
188
|
if (this.element) {
|
167
189
|
if (this.boundHandleDropdownOpen) {
|
@@ -208,11 +230,4 @@ export default class extends Controller {
|
|
208
230
|
this.modifiedSelectWrapper = null;
|
209
231
|
}
|
210
232
|
}
|
211
|
-
|
212
|
-
reconnect() {
|
213
|
-
this.disconnect();
|
214
|
-
// dispatch this on the next frame.
|
215
|
-
// there's some funny issue where my elements get removed from the DOM
|
216
|
-
setTimeout(() => this.connect(), 10);
|
217
|
-
}
|
218
233
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plutonium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Froelich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -486,6 +486,7 @@ files:
|
|
486
486
|
- app/views/rodauth/webauthn_setup.html.erb
|
487
487
|
- brakeman.ignore
|
488
488
|
- config.ru
|
489
|
+
- config/initializers/action_policy.rb
|
489
490
|
- config/initializers/hotwire_turbo_monkey_patches.rb
|
490
491
|
- config/initializers/pagy.rb
|
491
492
|
- config/initializers/rabl.rb
|
@@ -735,6 +736,7 @@ files:
|
|
735
736
|
- lib/plutonium/action/interactive.rb
|
736
737
|
- lib/plutonium/action/route_options.rb
|
737
738
|
- lib/plutonium/action/simple.rb
|
739
|
+
- lib/plutonium/action_policy/sti_policy_lookup.rb
|
738
740
|
- lib/plutonium/auth.rb
|
739
741
|
- lib/plutonium/auth/public.rb
|
740
742
|
- lib/plutonium/auth/rodauth.rb
|