phlex-reactive 0.15.0 → 0.15.2
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/CHANGELOG.md +114 -0
- data/README.md +91 -11
- data/app/controllers/phlex/reactive/actions_controller.rb +4 -1
- data/app/javascript/phlex/reactive/compute.js +14 -1
- data/app/javascript/phlex/reactive/compute.min.js +2 -2
- data/app/javascript/phlex/reactive/compute.min.js.map +3 -3
- data/app/javascript/phlex/reactive/core.min.js +6 -5
- data/app/javascript/phlex/reactive/core.min.js.map +3 -3
- data/app/javascript/phlex/reactive/early.js +12 -4
- data/app/javascript/phlex/reactive/early.min.js +2 -2
- data/app/javascript/phlex/reactive/early.min.js.map +3 -3
- data/app/javascript/phlex/reactive/features/bindings.js +47 -0
- data/app/javascript/phlex/reactive/features/bindings.min.js +2 -2
- data/app/javascript/phlex/reactive/features/bindings.min.js.map +3 -3
- data/app/javascript/phlex/reactive/reactive_controller.min.js +4 -3
- data/app/javascript/phlex/reactive/reactive_controller.min.js.map +4 -4
- data/app/javascript/phlex/reactive/runtime.js +479 -20
- data/lib/phlex/reactive/component/helpers.rb +30 -0
- data/lib/phlex/reactive/component/media_binding.rb +85 -0
- data/lib/phlex/reactive/held_fields.rb +87 -0
- data/lib/phlex/reactive/js.rb +162 -29
- data/lib/phlex/reactive/shortcut.rb +18 -5
- data/lib/phlex/reactive/streamable.rb +31 -2
- data/lib/phlex/reactive/test_helpers.rb +11 -2
- data/lib/phlex/reactive/version.rb +1 -1
- metadata +3 -1
|
@@ -93,14 +93,23 @@ module Phlex
|
|
|
93
93
|
# after_commit broadcasts behave.
|
|
94
94
|
# 5. authorization — a registered authorization error RAISES (the endpoint
|
|
95
95
|
# maps it to 403; a unit test asserts the real exception).
|
|
96
|
-
|
|
96
|
+
#
|
|
97
|
+
# `held:` stands in for the X-Reactive-Held header (issue #370): the field
|
|
98
|
+
# names a morph held over a changed server value, filtered to the action's
|
|
99
|
+
# declared params exactly as the endpoint filters them, and returned by
|
|
100
|
+
# reactive_held_fields inside the action. `held` is therefore reserved
|
|
101
|
+
# here: an action param literally named `held` can't be passed through.
|
|
102
|
+
#
|
|
103
|
+
# run_reactive(form, :save, held: ["title"], title: "Draft by B")
|
|
104
|
+
def run_reactive(component, action, held: [], **params)
|
|
97
105
|
klass = component.class
|
|
98
106
|
action_def = klass.reactive_actions[action.to_sym] || raise_undeclared(klass, action)
|
|
99
107
|
|
|
100
108
|
rebuilt = rebuild_from_identity(component, klass)
|
|
101
109
|
coerced = action_def.schema.coerce(stringify_params(params))
|
|
102
110
|
|
|
103
|
-
|
|
111
|
+
held_fields = Phlex::Reactive::HeldFields.parse(Array(held).map(&:to_s).to_json, action_def)
|
|
112
|
+
returned = Phlex::Reactive::HeldFields.with(held_fields) { run_reactive_action(rebuilt, action_def, coerced) }
|
|
104
113
|
Result.new(returned:, component: rebuilt)
|
|
105
114
|
end
|
|
106
115
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phlex-reactive
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.15.
|
|
4
|
+
version: 0.15.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mikael Henriksson
|
|
@@ -198,6 +198,7 @@ files:
|
|
|
198
198
|
- lib/phlex/reactive/component/helpers.rb
|
|
199
199
|
- lib/phlex/reactive/component/identity.rb
|
|
200
200
|
- lib/phlex/reactive/component/lazy.rb
|
|
201
|
+
- lib/phlex/reactive/component/media_binding.rb
|
|
201
202
|
- lib/phlex/reactive/component/presence_declaration.rb
|
|
202
203
|
- lib/phlex/reactive/component/registry.rb
|
|
203
204
|
- lib/phlex/reactive/component/selection.rb
|
|
@@ -210,6 +211,7 @@ files:
|
|
|
210
211
|
- lib/phlex/reactive/effects.rb
|
|
211
212
|
- lib/phlex/reactive/engine.rb
|
|
212
213
|
- lib/phlex/reactive/fragment.rb
|
|
214
|
+
- lib/phlex/reactive/held_fields.rb
|
|
213
215
|
- lib/phlex/reactive/inspector.rb
|
|
214
216
|
- lib/phlex/reactive/inspector/report.rb
|
|
215
217
|
- lib/phlex/reactive/js.rb
|