@joker.front/core 1.2.153 → 1.2.157

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/dist/bundle.es.js CHANGED
@@ -1302,6 +1302,9 @@ var Render;
1302
1302
  let resolve = () => {
1303
1303
  removeClassName(node, getTransitionClassName(transitionName, model, "to"));
1304
1304
  removeClassName(node, getTransitionClassName(transitionName, model, "active"));
1305
+ //可能存在越级删除,造成动画元素过早移除,
1306
+ if (!node.output)
1307
+ return;
1305
1308
  node.output.removeEventListener(`${type}end`, onEnd);
1306
1309
  if (id === node.output.__TRANSITION_EVNETID__) {
1307
1310
  callBack?.();
@@ -1337,6 +1340,8 @@ var Render;
1337
1340
  }
1338
1341
  else if (node instanceof VNode.Html) {
1339
1342
  let conatiner = document.createElement("joker-html-container");
1343
+ //@ts-ignore
1344
+ conatiner.JOKER_NODE = node;
1340
1345
  conatiner.root.innerHTML = node.html;
1341
1346
  node.output = conatiner;
1342
1347
  }
@@ -1354,6 +1359,8 @@ var Render;
1354
1359
  for (let attrName in node.attributes) {
1355
1360
  this.setAttribute(element, attrName, node.attributes[attrName]);
1356
1361
  }
1362
+ //@ts-ignore
1363
+ element.JOKER_NODE = node;
1357
1364
  node.output = element;
1358
1365
  //做穿透延迟仅对outside.click
1359
1366
  if (node.events.some((n) => n[0] === "click" && n[1].modifiers?.includes("outside"))) {
@@ -2818,11 +2825,11 @@ class ParserTemplate {
2818
2825
  this.nodeWatcherEvents = {};
2819
2826
  this.asts.length = 0;
2820
2827
  }
2821
- reParser(asts, keepalive) {
2828
+ reSetAsts(asts, keepalive) {
2822
2829
  //销毁历史产物
2823
2830
  this.destroy(keepalive);
2824
2831
  this.render = IContainer.get(Render.IRENDERIOCTAGID) ?? new Render.DomRender();
2825
- this.parserNodes(asts, this.root);
2832
+ this.asts = asts;
2826
2833
  }
2827
2834
  nodeTransition(node, mode, name, callBack, type) {
2828
2835
  if (node && node.parent?.childrens && (node instanceof VNode.Element || node instanceof VNode.Component)) {
@@ -3292,7 +3299,7 @@ class Component {
3292
3299
  }
3293
3300
  //执行一次render,则初始化一次template
3294
3301
  this.template ??= [];
3295
- this[PARSER_TEMPLATE_TARGET]?.reParser(this.template, keepalive);
3302
+ this[PARSER_TEMPLATE_TARGET]?.reSetAsts(this.template, keepalive);
3296
3303
  this[PARSER_TEMPLATE_TARGET] ??= new ParserTemplate(this.template, this, this.$root);
3297
3304
  this[PARSER_TEMPLATE_TARGET].parser();
3298
3305
  this[PARSER_TEMPLATE_TARGET].mount(this.$root);
@@ -3393,20 +3400,22 @@ class ComponentContainer extends Component {
3393
3400
  propsVaule;
3394
3401
  created() {
3395
3402
  let propsData = {};
3396
- Object.keys(this.props).forEach((p) => {
3397
- //过滤
3398
- if (typeof p !== "string")
3399
- return;
3400
- let pName = toLowerCase(p);
3401
- if (pName === "transition-name" || pName === "name" || pName === "keep-alive" || pName === "ref")
3402
- return;
3403
- propsData[p] = this.props[p];
3404
- //单项数据同步
3405
- this.$watch(() => this.props[p], () => {
3406
- this.propsVaule[p] = this.props[p];
3403
+ if (!this.props.props) {
3404
+ Object.keys(this.props).forEach((p) => {
3405
+ //过滤
3406
+ if (typeof p !== "string")
3407
+ return;
3408
+ let pName = toLowerCase(p);
3409
+ if (pName === "transition-name" || pName === "name" || pName === "keep-alive" || pName === "ref")
3410
+ return;
3411
+ propsData[p] = this.props[p];
3412
+ //单项数据同步
3413
+ this.$watch(() => this.props[p], () => {
3414
+ this.propsVaule[p] = this.props[p];
3415
+ });
3407
3416
  });
3408
- });
3409
- this.propsVaule = observer(propsData);
3417
+ this.propsVaule = observer(propsData);
3418
+ }
3410
3419
  }
3411
3420
  async loadComponent(componentName) {
3412
3421
  if (!componentName) {
@@ -3430,7 +3439,7 @@ class ComponentContainer extends Component {
3430
3439
  if (!(JOKER_COMPONENT_TAG in component)) {
3431
3440
  component = (await component()).default;
3432
3441
  }
3433
- cacheComponent = new component(this.propsVaule, this.$sections, this.isKeepAlive);
3442
+ cacheComponent = new component(this.props.props || this.propsVaule, this.$sections, this.isKeepAlive);
3434
3443
  //事件向上穿透广播
3435
3444
  cacheComponent.$on("*", (e) => {
3436
3445
  this.$trigger(e.eventName, e.data, e);
package/dist/bundle.js CHANGED
@@ -1303,6 +1303,9 @@ var Render;
1303
1303
  let resolve = () => {
1304
1304
  removeClassName(node, getTransitionClassName(transitionName, model, "to"));
1305
1305
  removeClassName(node, getTransitionClassName(transitionName, model, "active"));
1306
+ //可能存在越级删除,造成动画元素过早移除,
1307
+ if (!node.output)
1308
+ return;
1306
1309
  node.output.removeEventListener(`${type}end`, onEnd);
1307
1310
  if (id === node.output.__TRANSITION_EVNETID__) {
1308
1311
  callBack?.();
@@ -1338,6 +1341,8 @@ var Render;
1338
1341
  }
1339
1342
  else if (node instanceof exports.VNode.Html) {
1340
1343
  let conatiner = document.createElement("joker-html-container");
1344
+ //@ts-ignore
1345
+ conatiner.JOKER_NODE = node;
1341
1346
  conatiner.root.innerHTML = node.html;
1342
1347
  node.output = conatiner;
1343
1348
  }
@@ -1355,6 +1360,8 @@ var Render;
1355
1360
  for (let attrName in node.attributes) {
1356
1361
  this.setAttribute(element, attrName, node.attributes[attrName]);
1357
1362
  }
1363
+ //@ts-ignore
1364
+ element.JOKER_NODE = node;
1358
1365
  node.output = element;
1359
1366
  //做穿透延迟仅对outside.click
1360
1367
  if (node.events.some((n) => n[0] === "click" && n[1].modifiers?.includes("outside"))) {
@@ -2819,11 +2826,11 @@ class ParserTemplate {
2819
2826
  this.nodeWatcherEvents = {};
2820
2827
  this.asts.length = 0;
2821
2828
  }
2822
- reParser(asts, keepalive) {
2829
+ reSetAsts(asts, keepalive) {
2823
2830
  //销毁历史产物
2824
2831
  this.destroy(keepalive);
2825
2832
  this.render = exports.IContainer.get(Render.IRENDERIOCTAGID) ?? new Render.DomRender();
2826
- this.parserNodes(asts, this.root);
2833
+ this.asts = asts;
2827
2834
  }
2828
2835
  nodeTransition(node, mode, name, callBack, type) {
2829
2836
  if (node && node.parent?.childrens && (node instanceof exports.VNode.Element || node instanceof exports.VNode.Component)) {
@@ -3293,7 +3300,7 @@ class Component {
3293
3300
  }
3294
3301
  //执行一次render,则初始化一次template
3295
3302
  this.template ??= [];
3296
- this[PARSER_TEMPLATE_TARGET]?.reParser(this.template, keepalive);
3303
+ this[PARSER_TEMPLATE_TARGET]?.reSetAsts(this.template, keepalive);
3297
3304
  this[PARSER_TEMPLATE_TARGET] ??= new ParserTemplate(this.template, this, this.$root);
3298
3305
  this[PARSER_TEMPLATE_TARGET].parser();
3299
3306
  this[PARSER_TEMPLATE_TARGET].mount(this.$root);
@@ -3394,20 +3401,22 @@ class ComponentContainer extends Component {
3394
3401
  propsVaule;
3395
3402
  created() {
3396
3403
  let propsData = {};
3397
- Object.keys(this.props).forEach((p) => {
3398
- //过滤
3399
- if (typeof p !== "string")
3400
- return;
3401
- let pName = toLowerCase(p);
3402
- if (pName === "transition-name" || pName === "name" || pName === "keep-alive" || pName === "ref")
3403
- return;
3404
- propsData[p] = this.props[p];
3405
- //单项数据同步
3406
- this.$watch(() => this.props[p], () => {
3407
- this.propsVaule[p] = this.props[p];
3404
+ if (!this.props.props) {
3405
+ Object.keys(this.props).forEach((p) => {
3406
+ //过滤
3407
+ if (typeof p !== "string")
3408
+ return;
3409
+ let pName = toLowerCase(p);
3410
+ if (pName === "transition-name" || pName === "name" || pName === "keep-alive" || pName === "ref")
3411
+ return;
3412
+ propsData[p] = this.props[p];
3413
+ //单项数据同步
3414
+ this.$watch(() => this.props[p], () => {
3415
+ this.propsVaule[p] = this.props[p];
3416
+ });
3408
3417
  });
3409
- });
3410
- this.propsVaule = observer(propsData);
3418
+ this.propsVaule = observer(propsData);
3419
+ }
3411
3420
  }
3412
3421
  async loadComponent(componentName) {
3413
3422
  if (!componentName) {
@@ -3431,7 +3440,7 @@ class ComponentContainer extends Component {
3431
3440
  if (!(JOKER_COMPONENT_TAG in component)) {
3432
3441
  component = (await component()).default;
3433
3442
  }
3434
- cacheComponent = new component(this.propsVaule, this.$sections, this.isKeepAlive);
3443
+ cacheComponent = new component(this.props.props || this.propsVaule, this.$sections, this.isKeepAlive);
3435
3444
  //事件向上穿透广播
3436
3445
  cacheComponent.$on("*", (e) => {
3437
3446
  this.$trigger(e.eventName, e.data, e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joker.front/core",
3
- "version": "1.2.153",
3
+ "version": "1.2.157",
4
4
  "description": "",
5
5
  "main": "./dist/bundle.js",
6
6
  "module": "./dist/bundle.es.js",
@@ -197,6 +197,7 @@ export declare function getGlobalComponent(key: string): ComponentConstructor |
197
197
  export declare class ComponentContainer extends Component<{
198
198
  [key: string]: any;
199
199
  name: string;
200
+ props: object;
200
201
  "transition-name": string;
201
202
  }> {
202
203
  template: never[];
@@ -67,7 +67,7 @@ export declare class ParserTemplate {
67
67
  * 销毁
68
68
  */
69
69
  destroy(keepalive?: boolean): void;
70
- reParser(asts: AST.Node[], keepalive?: boolean): void;
70
+ reSetAsts(asts: AST.Node[], keepalive?: boolean): void;
71
71
  nodeTransition(node: VNode.Node | undefined, mode: "enter" | "leave", name?: string, callBack?: Function, type?: "transition" | "animation"): boolean;
72
72
  }
73
73
  export declare function getFirstElement(node: VNode.Node): VNode.Element | undefined;