x-block-lib 0.9.33 → 0.9.34

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 +93 -75
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1006,55 +1006,67 @@ function getOnEventInfo(e) {
1006
1006
  }
1007
1007
  }
1008
1008
  } else if (w === "customSlotEvent") {
1009
- if (isSlotNode(O.key) && y.type === "comp" && x.meta.slots) {
1010
- let { slotId: y, eventId: b } = unwrapEventKeyOfCustomSlot(E), S = x.meta.slots.find((e) => e.id === y);
1011
- if (S && S.events) {
1012
- let y = S.events.find((e) => e.id === b);
1013
- if (y) return {
1014
- id: e,
1015
- kind: w,
1016
- names: [S.name, y.name],
1017
- params: convertParams(y.params)
1018
- };
1009
+ if (isSlotNode(O.key) && D.slot && y.type === "comp" && x.meta.slots) {
1010
+ let { compId: y, slotId: b, eventId: S } = unwrapEventKeyOfCustomSlot(E);
1011
+ if (x.id === y && D.slot === b) {
1012
+ let y = x.meta.slots.find((e) => e.id === b);
1013
+ if (y && y.events) {
1014
+ let b = y.events.find((e) => e.id === S);
1015
+ if (b) return {
1016
+ id: e,
1017
+ kind: w,
1018
+ names: [y.name, b.name],
1019
+ params: convertParams(b.params)
1020
+ };
1021
+ }
1019
1022
  }
1020
1023
  }
1021
1024
  } else if (w === "customSlotPropertyChangeEvent") {
1022
- if (isSlotNode(O.key) && y.type === "comp" && x.meta.slots) {
1023
- let { slotId: y, eventId: b } = unwrapEventKeyOfCustomSlot(E), S = x.meta.slots.find((e) => e.id === y);
1024
- if (S && S.properties) {
1025
- let y = S.properties.find((e) => e.id === b);
1026
- if (y) return {
1027
- id: e,
1028
- kind: w,
1029
- names: [S.name, y.name],
1030
- params: makeChangeParams(y.type)
1031
- };
1025
+ if (isSlotNode(O.key) && D.slot && y.type === "comp" && x.meta.slots) {
1026
+ let { compId: y, slotId: b, eventId: S } = unwrapEventKeyOfCustomSlot(E);
1027
+ if (x.id === y && D.slot === b) {
1028
+ let y = x.meta.slots.find((e) => e.id === b);
1029
+ if (y && y.properties) {
1030
+ let b = y.properties.find((e) => e.id === S);
1031
+ if (b) return {
1032
+ id: e,
1033
+ kind: w,
1034
+ names: [y.name, b.name],
1035
+ params: makeChangeParams(b.type)
1036
+ };
1037
+ }
1032
1038
  }
1033
1039
  }
1034
- } else if (w === "multipleSlotEvent") {
1035
- if (isMultipleSlotNode(O.key) && y.type === "comp" && x.meta.slots) {
1036
- let { slotId: y, eventId: b } = unwrapEventKeyOfCustomSlot(E), S = x.meta.slots.find((e) => e.id === y);
1037
- if (S && S.events) {
1038
- let y = S.events.find((e) => e.id === b);
1039
- if (y) return {
1040
- id: e,
1041
- kind: w,
1042
- names: [S.name, y.name],
1043
- params: convertParams(y.params)
1044
- };
1040
+ } else if (w === "multipleCustomSlotEvent") {
1041
+ if (isMultipleSlotNode(O.key) && D.slot && y.type === "comp" && x.meta.slots) {
1042
+ let { compId: y, slotId: b, eventId: S } = unwrapEventKeyOfCustomSlot(E);
1043
+ if (x.id === y && D.slot && b) {
1044
+ let y = x.meta.slots.find((e) => e.id === b);
1045
+ if (y && y.events) {
1046
+ let b = y.events.find((e) => e.id === S);
1047
+ if (b) return {
1048
+ id: e,
1049
+ kind: w,
1050
+ names: [y.name, b.name],
1051
+ params: convertParams(b.params)
1052
+ };
1053
+ }
1045
1054
  }
1046
1055
  }
1047
- } else if (w === "multipleSlotPropertyChangeEvent") {
1048
- if (isMultipleSlotNode(O.key) && y.type === "comp" && x.meta.slots) {
1049
- let { slotId: y, eventId: b } = unwrapEventKeyOfCustomSlot(E), S = x.meta.slots.find((e) => e.id === y);
1050
- if (S && S.properties) {
1051
- let y = S.properties.find((e) => e.id === b);
1052
- if (y) return {
1053
- id: e,
1054
- kind: w,
1055
- names: [S.name, y.name],
1056
- params: makeChangeParams(y.type)
1057
- };
1056
+ } else if (w === "multipleCustomSlotPropertyChangeEvent") {
1057
+ if (isMultipleSlotNode(O.key) && D.slot && y.type === "comp" && x.meta.slots) {
1058
+ let { compId: y, slotId: b, eventId: S } = unwrapEventKeyOfCustomSlot(E);
1059
+ if (x.id === y && D.slot === b) {
1060
+ let y = x.meta.slots.find((e) => e.id === b);
1061
+ if (y && y.properties) {
1062
+ let b = y.properties.find((e) => e.id === S);
1063
+ if (b) return {
1064
+ id: e,
1065
+ kind: w,
1066
+ names: [y.name, b.name],
1067
+ params: makeChangeParams(b.type)
1068
+ };
1069
+ }
1058
1070
  }
1059
1071
  }
1060
1072
  } else if (w === "customEvent") {
@@ -1201,27 +1213,27 @@ function getAllTriggerEventInfos(e) {
1201
1213
  if (!C) return console.assert(!1, "invalid element", S.key), x;
1202
1214
  if (isSlotNode(C.key) && S.slot && y.type === "comp" && b.meta.slots) {
1203
1215
  let y = b.meta.slots.find((e) => e.id === S.slot);
1204
- if (y && y.events) for (let { id: S, name: C, params: w } of y.events) x.push({
1205
- id: makeEventId("customSlotEvent", e, makeEventKeyOfCustomSlot(b.id, y.id, S)),
1216
+ if (y && y.events) for (let S of y.events) x.push({
1217
+ id: makeEventId("customSlotEvent", e, makeEventKeyOfCustomSlot(b.id, y.id, S.id)),
1206
1218
  kind: "customSlotEvent",
1207
- names: [C],
1208
- params: convertParams(w)
1219
+ names: [y.name, S.name],
1220
+ params: convertParams(S.params)
1209
1221
  });
1210
1222
  }
1211
1223
  if (isMultipleSlotNode(C.key) && S.slot && y.type === "comp" && b.meta.slots) {
1212
1224
  let y = b.meta.slots.find((e) => e.id === S.slot);
1213
- if (y && y.events) for (let { id: S, name: C, params: w } of y.events) x.push({
1214
- id: makeEventId("multipleCustomSlotEvent", e, makeEventKeyOfCustomSlot(b.id, y.id, S)),
1225
+ if (y && y.events) for (let S of y.events) x.push({
1226
+ id: makeEventId("multipleCustomSlotEvent", e, makeEventKeyOfCustomSlot(b.id, y.id, S.id)),
1215
1227
  kind: "multipleCustomSlotEvent",
1216
- names: [C],
1217
- params: convertParams(w)
1228
+ names: [y.name, S.name],
1229
+ params: convertParams(S.params)
1218
1230
  });
1219
1231
  }
1220
- if (isGlobalityNode(C.key) && y.type === "comp" && b.meta.events) for (let { id: e, name: y, params: S } of b.meta.events) x.push({
1221
- id: makeEventId("customEvent", "globality", e),
1232
+ if (isGlobalityNode(C.key) && y.type === "comp" && b.meta.events) for (let e of b.meta.events) x.push({
1233
+ id: makeEventId("customEvent", "globality", e.id),
1222
1234
  kind: "customEvent",
1223
- names: [y],
1224
- params: convertParams(S)
1235
+ names: [e.name],
1236
+ params: convertParams(e.params)
1225
1237
  });
1226
1238
  return x;
1227
1239
  }
@@ -1235,29 +1247,35 @@ function getTriggerEventInfo(e) {
1235
1247
  return;
1236
1248
  }
1237
1249
  if (x === "customSlotEvent") {
1238
- if (isSlotNode(T.key) && y.type === "comp" && b.meta.slots) {
1239
- let { slotId: y, eventId: S } = unwrapEventKeyOfCustomSlot(C), w = b.meta.slots.find((e) => e.id === y);
1240
- if (w && w.events) {
1241
- let y = w.events.find((e) => e.id === S);
1242
- if (y) return {
1243
- id: e,
1244
- kind: x,
1245
- names: [y.name],
1246
- params: convertParams(y.params)
1247
- };
1250
+ if (isSlotNode(T.key) && w.slot && y.type === "comp" && b.meta.slots) {
1251
+ let { compId: y, slotId: S, eventId: T } = unwrapEventKeyOfCustomSlot(C);
1252
+ if (b.id === y && w.slot === S) {
1253
+ let y = b.meta.slots.find((e) => e.id === S);
1254
+ if (y && y.events) {
1255
+ let b = y.events.find((e) => e.id === T);
1256
+ if (b) return {
1257
+ id: e,
1258
+ kind: x,
1259
+ names: [y.name, b.name],
1260
+ params: convertParams(b.params)
1261
+ };
1262
+ }
1248
1263
  }
1249
1264
  }
1250
- } else if (x === "multipleSlotEvent") {
1251
- if (isMultipleSlotNode(T.key) && y.type === "comp" && b.meta.slots) {
1252
- let { slotId: y, eventId: S } = unwrapEventKeyOfCustomSlot(C), w = b.meta.slots.find((e) => e.id === y);
1253
- if (w && w.events) {
1254
- let y = w.events.find((e) => e.id === S);
1255
- if (y) return {
1256
- id: e,
1257
- kind: x,
1258
- names: [y.name],
1259
- params: convertParams(y.params)
1260
- };
1265
+ } else if (x === "multipleCustomSlotEvent") {
1266
+ if (isMultipleSlotNode(T.key) && w.slot && y.type === "comp" && b.meta.slots) {
1267
+ let { compId: y, slotId: S, eventId: T } = unwrapEventKeyOfCustomSlot(C);
1268
+ if (b.id === y && w.slot && S) {
1269
+ let y = b.meta.slots.find((e) => e.id === S);
1270
+ if (y && y.events) {
1271
+ let b = y.events.find((e) => e.id === T);
1272
+ if (b) return {
1273
+ id: e,
1274
+ kind: x,
1275
+ names: [y.name, b.name],
1276
+ params: convertParams(b.params)
1277
+ };
1278
+ }
1261
1279
  }
1262
1280
  }
1263
1281
  } else if (x === "customEvent" && isGlobalityNode(T.key) && y.type === "comp" && b.meta.events) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-block-lib",
3
3
  "private": false,
4
- "version": "0.9.33",
4
+ "version": "0.9.34",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",