zova-jsx 1.1.20 → 1.1.22

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -13
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { compose } from '@cabloy/compose';
2
- import { celEnvBase, getProperty, evaluateExpressions, isPromise } from '@cabloy/utils';
2
+ import { celEnvBase, getProperty, evaluateExpressions, isEmptyObject, isNil, isPromise } from '@cabloy/utils';
3
3
  import { toUpperCaseFirstChar } from '@cabloy/word-utils';
4
4
  import { classes } from 'typestyle';
5
5
  import { h, createTextVNode } from 'vue';
6
- import { BeanSimple, objectAssignReactive, cast, beanFullNameFromOnionName, deepExtend } from 'zova-core';
6
+ import { BeanSimple, objectAssignReactive, cast, beanFullNameFromOnionName } from 'zova-core';
7
7
 
8
8
  const renderFieldJsxPropsSystem = ['children', 'v-slot', 'v-slot-scope', 'v-if', 'v-for', 'v-each', 'key'];
9
9
 
@@ -162,9 +162,7 @@ class ZovaJsx extends BeanSimple {
162
162
  const actionChildPrev = actionChildren[index - 1];
163
163
  const resName = cast(actionChildPrev.props)?.res;
164
164
  if (resName) {
165
- celScope = objectAssignReactive({}, celScope, {
166
- [resName]: actionRes
167
- });
165
+ celScope[resName] = actionRes;
168
166
  }
169
167
  }
170
168
  // vIf
@@ -173,9 +171,7 @@ class ZovaJsx extends BeanSimple {
173
171
  // action
174
172
  if (actionChild.type === 'actionVar') {
175
173
  const props = this.renderJsxProps(actionChild.props, {}, celScope, renderContext);
176
- celScope = objectAssignReactive({}, celScope, {
177
- [cast(props).name]: cast(props).value
178
- });
174
+ celScope[cast(props).name] = cast(props).value;
179
175
  return next(undefined);
180
176
  } else if (actionChild.type === 'actionExpr') {
181
177
  const expression = this.evaluateExpression(cast(actionChild.props)?.expression, celScope);
@@ -211,8 +207,9 @@ class ZovaJsx extends BeanSimple {
211
207
  const onionOptions = beanInstance.$onionOptions;
212
208
  // props
213
209
  let props = this.renderJsxProps(actionChild.props, {}, celScope, renderContext);
214
- if (onionOptions) {
215
- props = deepExtend({}, onionOptions, props);
210
+ if (!isEmptyObject(onionOptions)) {
211
+ // not use deepExtend, maybe: Maximum call stack size exceeded
212
+ props = Object.assign({}, onionOptions, props);
216
213
  }
217
214
  if (!renderContext) throw new Error('should provide renderContext');
218
215
  return beanInstance.execute(props, renderContext, next);
@@ -374,9 +371,17 @@ class ZovaJsx extends BeanSimple {
374
371
  if (isJsxComponent(jsxChild)) {
375
372
  if (jsxChild.type === 'var') {
376
373
  const props = this.renderJsxProps(jsxChild.props, {}, celScope, renderContext);
377
- celScope = objectAssignReactive({}, celScope, {
378
- [cast(props).name]: cast(props).value
379
- });
374
+ celScope[cast(props).name] = cast(props).value;
375
+ child = undefined;
376
+ } else if (jsxChild.type === 'log') {
377
+ const props = this.renderJsxProps(jsxChild.props, {}, celScope, renderContext);
378
+ const name = cast(props).name;
379
+ const message = cast(props).message;
380
+ if (isNil(name)) {
381
+ console.log(message);
382
+ } else {
383
+ console.log(name, message);
384
+ }
380
385
  child = undefined;
381
386
  } else {
382
387
  child = this.render(jsxChild, undefined, celScope, renderContext);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-jsx",
3
- "version": "1.1.20",
4
- "gitHead": "105e4dce1e85740f1f8a7ba9add2029beeaf9316",
3
+ "version": "1.1.22",
4
+ "gitHead": "8d42f31a8ee23be4564814a901d770307635c849",
5
5
  "description": "Zova JSX",
6
6
  "keywords": [
7
7
  "ioc",
@@ -41,10 +41,10 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@cabloy/compose": "^2.1.4",
44
- "@cabloy/utils": "^2.1.6",
44
+ "@cabloy/utils": "^2.1.9",
45
45
  "@cabloy/word-utils": "^2.1.8",
46
46
  "typestyle": "^2.4.0",
47
47
  "vue": "^3.5.32",
48
- "zova-core": "^5.1.20"
48
+ "zova-core": "^5.1.21"
49
49
  }
50
50
  }