Releases: rmorse/babel-plugin-jsx-template-vars
Releases · rmorse/babel-plugin-jsx-template-vars
v0.0.9
What's new:
- Greatly improved control variables
- Now supports any order of parameters in statements, eg:
'yes' === myControlVaras well asmyControlVar === 'no' - Ability to combine template vars in statements, eg:
myControlTemplateVar !== anotherControlTemplateVar - Support for ternary expressions and nested ternary expressions such as:
const className = 'input--type-' + ( multiple ? 'multiple' : 'single' )
Works for variable assignment in the component block statement as well as when used directly in JSX output:
<>{ 'Is type: ' + ( multiple ? 'multiple' : 'single' ) }</> - Added all the above logic for for statements in JSX expressions, eg:
{ myTemplateVar === anotherTemplateVar && 'Some output' }
- Now supports any order of parameters in statements, eg:
- Reworked language files to be more readable, eg, instead of
||%1||now use[%_variable_]- Notice this change is not backwards compatible and requires remaking your language files (if using custom language files)
- Added custom variables to languages (check the PHP language file) - these can be used like:
[%myVariableName]
v0.0.8
What's new:
- Reworked language injection and custom languages
- Add support for
.tvlangconfig file to define custom language - Moved custom languages + logic into client application
- Use .json format for language definition
- Supply path to a custom language location
- Add support for
- Enable support for multiple levels of nested components (in
.map())- Use contexts in client side application to track depth
- Generate variable names based on depth
- Use
traverseto locate component path rather than assuming it was the previous sibling from the.templateVarsdefinition - Fix issues with quotation marks being encoded in output - use only single quotes in language definitions (this is enforced by using json as the language format)
v0.0.5
v0.0.4
v.0.0.4
- supports list vars and .map() in JSX expressions
- supports flat arrays using primitives
- fixes listvars + control vars when used together (list vars were not being wrapped in template tags when used in expressions using control vars)
- add full example to the readme