- Fix: digging was broken due to fragment_path being nil when calling
found_path!, and another instance where Searcher did not take Props::Options into account
- Fix: second props partial render on the same view returns nil. The
@__jsoninstance variable persisted after the first partial finalized, causing subsequent top-level renders to skipresult!and return nil.
- Performance improvements: reduce object allocations by removing cloning of options passed to arrays. Props::Base now beats Panko, making it the fastest JSON builder in Ruby. Props::Template outpaces Alba and Turbostreamer.
- Add
Props::Optionsobject andprops_optionsview helper for a chainable API when specifying partial/fragment/locals options. - Add Rails 8.1 to build matrix, remove EOL versions.
- Rename
withtoprop_optionsfor the chainable options helper.
- Fix graft path:
traveled_pathwas being cleared unnecessarily, resulting in an inaccurate graft path. - Fix
partial!when used with digging by moving the method to the top-level so both builder instances have access to it. - Ensure a key is added to pass_opts on an exact dig into an array element.
- Use instance variable if available in
active_template_virtual_path.
- Add
fragmentContext: when digging withprops_at, the found path is now relative to the fragment it was found in, producing shorter graft paths. - Fix
partial!not working when digging.
- Breaking change with how the fragments work. Where prior it was
{type: fragment_name, partial: partial_name, path: path}the payload is now changed to{id: key, path: path}. This should only affect superglue users. - Rest of API is stablizing with next release of Superglue v2
- Add ability to render a partial as a layout
- Add child! which works only within an array! block
- Add ability to disable all deferements via json.disable_deferements!
- Add a
digoption for traversing into a template. It's basically an alias of the already existingsearchoption. - Drop support for Rails 6.
New features extract!, partial!, and test improvements.
Fix issue with locals referring to an earlier item when using it in collections.
Fix issue with send_data not working due to the layout_patch not accounting for
inline templates.
Revert the removal of virtual_path_of_template, and renamed it to
active_template_virtual_path. The reason for the removal was because we tried
to replace it with "#{controller_path}/#{action_name}" in superglue for the
component identifier, but that proved a bit too hairy. We also expose the
method to all other template types as well, as using @virtual_path on HTML erbs
from the view seemed too private.
- PropsTemplate no longer adds a virtual_path_of_template method to your views.
This is used by Superglue's generated
application.json.props. This is a backward breaking change. To migrate, simply change thecomponentIdentiferin yourapplication.json.propsand update thepage_to_page_mapping.jsaccordingly.
json.componentIdentifier "#{controller_path}/#{action_name}"
- PropsTemplate will no longer automatically
camelize(:lower)on keys. Instead, be explicit about the keys we're serializing.
For example: json.currentUser instead of json.current_user. This
is backward breaking. To retain the current behavior, you can do this:
module PropsTemplateOverride
def format_key(key)
@key_cache ||= {}
@key_cache[key] ||= key.camelize(:lower)
@key_cache[key]
end
def result!
result = super
@key_cache = {}
result
end
::Props::BaseWithExtensions.prepend self
end
- Turn the local assigns
virtual_path_of_templatethat didn't work into a method on the view
- Fix #1 issues templates without layouts were not rendering
- Refactor layout_patch to make a less invasive monkey patch
- Add ruby standard
- Add CONTRIBUTING.md
- Add support for Rails 7
- rename bzq to props_at
- Added testing for Ruby 3.0
- Moved PropsTemplate to own repo
- Use version.rb instead of VERSION file.