babel-plugin-jsx-dom-expressions 0.35.2 → 0.35.4
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.
- package/README.md +46 -3
- package/index.js +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Compiles to:
|
|
|
39
39
|
|
|
40
40
|
```jsx
|
|
41
41
|
import { insert as _$insert } from "dom";
|
|
42
|
-
import {
|
|
42
|
+
import { effect as _$effect } from "dom";
|
|
43
43
|
|
|
44
44
|
const _tmpl$ = document.createElement("template");
|
|
45
45
|
_tmpl$.innerHTML = `<tr><td class="col-md-1"></td><td class="col-md-4"><a></a></td><td class="col-md-1"><a><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></td><td class="col-md-6"></td></tr>`;
|
|
@@ -53,7 +53,7 @@ const view = ({ item }) => {
|
|
|
53
53
|
_el$4 = _el$3.firstChild,
|
|
54
54
|
_el$5 = _el$3.nextSibling,
|
|
55
55
|
_el$6 = _el$5.firstChild;
|
|
56
|
-
_$
|
|
56
|
+
_$effect(() => (_el$.className = itemId === selected() ? "danger" : ""));
|
|
57
57
|
_$insert(_el$2, itemId);
|
|
58
58
|
_el$4.onclick = e => select(item, e);
|
|
59
59
|
_$insert(_el$4, () => item.label);
|
|
@@ -73,34 +73,77 @@ The use of cloneNode improves repeat insert performance and precompilation reduc
|
|
|
73
73
|
|
|
74
74
|
## Plugin Options
|
|
75
75
|
|
|
76
|
-
### moduleName
|
|
76
|
+
### moduleName
|
|
77
|
+
|
|
78
|
+
- Type: `string`
|
|
79
|
+
- Required: Yes
|
|
77
80
|
|
|
78
81
|
The name of the runtime module to import the methods from.
|
|
79
82
|
|
|
80
83
|
### generate
|
|
81
84
|
|
|
85
|
+
- Type: `'dom' | 'ssr'`
|
|
86
|
+
- Default: `'dom'`
|
|
87
|
+
|
|
82
88
|
The output mode of the compiler. Can be "dom"(default), "ssr". "dom" is standard output. "ssr" is for server side rendering of strings.
|
|
83
89
|
|
|
84
90
|
### hydratable
|
|
85
91
|
|
|
92
|
+
- Type: `boolean`
|
|
93
|
+
- Default: `false`
|
|
94
|
+
|
|
86
95
|
Indicate whether the output should contain hydratable markers.
|
|
87
96
|
|
|
88
97
|
### delegateEvents
|
|
89
98
|
|
|
99
|
+
- Type: `boolean`
|
|
100
|
+
- Default: `true`
|
|
101
|
+
|
|
90
102
|
Boolean to indicate whether to enable automatic event delegation on camelCase.
|
|
91
103
|
|
|
92
104
|
### wrapConditionals
|
|
93
105
|
|
|
106
|
+
- Type: `boolean`
|
|
107
|
+
- Default: `true`
|
|
108
|
+
|
|
94
109
|
Boolean indicates whether smart conditional detection should be used. This optimizes simple boolean expressions and ternaries in JSX.
|
|
95
110
|
|
|
96
111
|
### contextToCustomElements
|
|
97
112
|
|
|
113
|
+
- Type: `boolean`
|
|
114
|
+
- Default: `false`
|
|
115
|
+
|
|
98
116
|
Boolean indicates whether to set current render context on Custom Elements and slots. Useful for seemless Context API with Web Components.
|
|
99
117
|
|
|
100
118
|
### builtIns
|
|
101
119
|
|
|
120
|
+
- Type: `boolean`
|
|
121
|
+
- Default: `string[]`
|
|
122
|
+
|
|
102
123
|
Array of Component exports from module, that aren't included by default with the library. This plugin will automatically import them if it comes across them in the JSX.
|
|
103
124
|
|
|
125
|
+
### effectWrapper
|
|
126
|
+
|
|
127
|
+
- Type: `string`
|
|
128
|
+
- Default: `effect`
|
|
129
|
+
|
|
130
|
+
This plugin leverages a heuristic for reactive wrapping and lazy evaluation of JSX expressions. This option indicates the reactive wrapper function name (`effect`), defaults to `effect`.
|
|
131
|
+
|
|
132
|
+
### staticMarker
|
|
133
|
+
|
|
134
|
+
- Type: `string`
|
|
135
|
+
- Default: `@once`
|
|
136
|
+
|
|
137
|
+
Comment decorator string indicates the static expression, used to tell the compiler not to wrap them by `effect` function, defaults to `@once`.
|
|
138
|
+
|
|
139
|
+
### memoWrapper
|
|
140
|
+
|
|
141
|
+
- Type: `string`
|
|
142
|
+
- Default: `memo`
|
|
143
|
+
|
|
144
|
+
Memos let you efficiently use a derived value in many reactive computations. This option indicates the memo function name, defaults to `memo`.
|
|
145
|
+
|
|
146
|
+
|
|
104
147
|
## Special Binding
|
|
105
148
|
|
|
106
149
|
### ref
|
package/index.js
CHANGED
|
@@ -1476,7 +1476,7 @@ function processSpreads$1(path, attributes, { elem, isSVG, hasChildren, wrapCond
|
|
|
1476
1476
|
runningObject.push(
|
|
1477
1477
|
t__namespace.objectProperty(
|
|
1478
1478
|
t__namespace.stringLiteral(key),
|
|
1479
|
-
isContainer ? node.value.expression : node.value || Properties.has(key) ? t__namespace.booleanLiteral(true) : t__namespace.stringLiteral("")
|
|
1479
|
+
isContainer ? node.value.expression : node.value || (Properties.has(key) ? t__namespace.booleanLiteral(true) : t__namespace.stringLiteral(""))
|
|
1480
1480
|
)
|
|
1481
1481
|
);
|
|
1482
1482
|
}
|
|
@@ -2196,10 +2196,10 @@ function createElement(path, { topLevel, hydratable }) {
|
|
|
2196
2196
|
if (v.length) memo.push(t__namespace.stringLiteral(v));
|
|
2197
2197
|
} else {
|
|
2198
2198
|
const child = transformNode(path);
|
|
2199
|
-
if (markers && child.exprs.length) memo.push(t__namespace.stringLiteral("<!--#-->"));
|
|
2199
|
+
if (markers && child.exprs.length && !child.spreadElement) memo.push(t__namespace.stringLiteral("<!--#-->"));
|
|
2200
2200
|
if (child.exprs.length && !child.spreadElement) child.exprs[0] = escapeExpression(path, child.exprs[0]);
|
|
2201
2201
|
memo.push(getCreateTemplate(config, path, child)(path, child, true));
|
|
2202
|
-
if (markers && child.exprs.length) memo.push(t__namespace.stringLiteral("<!--/-->"));
|
|
2202
|
+
if (markers && child.exprs.length && !child.spreadElement) memo.push(t__namespace.stringLiteral("<!--/-->"));
|
|
2203
2203
|
}
|
|
2204
2204
|
return memo;
|
|
2205
2205
|
}, []);
|
|
@@ -2890,9 +2890,9 @@ function transformComponent(path) {
|
|
|
2890
2890
|
if (childResult && childResult[0]) {
|
|
2891
2891
|
if (childResult[1]) {
|
|
2892
2892
|
const body =
|
|
2893
|
-
t__namespace.isCallExpression(childResult[0]) && t__namespace.isFunction(childResult[0].
|
|
2894
|
-
? childResult[0].
|
|
2895
|
-
: childResult[0].body;
|
|
2893
|
+
t__namespace.isCallExpression(childResult[0]) && t__namespace.isFunction(childResult[0].arguments[0])
|
|
2894
|
+
? childResult[0].arguments[0].body
|
|
2895
|
+
: childResult[0].body ? childResult[0].body : childResult[0];
|
|
2896
2896
|
runningObject.push(
|
|
2897
2897
|
t__namespace.objectMethod(
|
|
2898
2898
|
"get",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-jsx-dom-expressions",
|
|
3
3
|
"description": "A JSX to DOM plugin that wraps expressions for fine grained change detection",
|
|
4
|
-
"version": "0.35.
|
|
4
|
+
"version": "0.35.4",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@babel/core": "^7.0.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "dcc322b7f4bf7d651196b99504b2d17bb80f1973"
|
|
31
31
|
}
|