x-block-lib 0.9.29 → 0.9.31

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.
@@ -14,3 +14,5 @@ export declare function isRefNode(key: string): boolean;
14
14
  export declare function isMultipleRefNode(key: string): boolean;
15
15
  export declare function isSlotNode(key: string): boolean;
16
16
  export declare function isMultipleSlotNode(key: string): boolean;
17
+ export declare function isEqualOfElementSlot(target: string, elementKey: string, slotKey: string): boolean;
18
+ export declare function isEqualOfCustomSlot(target: string, compId: string, slotId: string): boolean;
package/dist/index.js CHANGED
@@ -10,8 +10,8 @@
10
10
  pre code.hljs{padding:1em;display:block;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#444;background:#f3f3f3}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.ghost[data-v-14e53948]{opacity:.4;pointer-events:none}.blocklyToolbox{width:56px;overflow-x:hidden}.blocklyMainBackground{stroke-width:0}.blocklyToolboxCategory{margin-bottom:12px!important}.blocklyToolboxCategoryIcon{display:none!important}.blocklyTreeRowContentContainer{place-items:center;height:28px;display:flex;overflow:hidden}.blocklyFlyout{z-index:21}
11
11
  /*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();import { A as Names, B as defineBlocksWithJsonArray, C as FieldCheckbox, D as FieldNumber, E as FieldLabel, F as Themes, G as inject$1, H as getMainWorkspace, I as Variables, J as serialization, K as inputs, L as WorkspaceSvg, M as ShortcutItems, N as ShortcutRegistry, O as FieldTextInput, P as Theme, Q as utils, R as Xml, S as Extensions, T as FieldImage, U as getSelected, V as dialog, W as icons, X as setParentContainer, Y as setLocale$1, Z as svgResize, _ as javascriptGenerator, a as lo, b as ContextMenuRegistry, c as require_dist, d as snakeCase_default, f as parseInt_default, g as Order, h as cloneDeep_default, i as require_dist$2, j as Procedures, k as Msg, l as encodeString, m as debounce_default, n as javascript, o as useResizeObserver, p as isEqual_default, q as registry, r as core_default, s as require_dist$1, t as highlightjs_vue_esm_min_default, u as upperCase_default, v as Blocks, w as FieldDropdown, x as Events, y as ContextMenu, z as common } from "./vendor.leasz44h.js";
12
12
  import { globalState } from "x-state-lib";
13
- import { eventBus, globalObjects, messageWarning, openConfirmDlg, openPromptDlg, useColor, useSystem, useViewStack } from "x-essential-lib";
14
13
  import { addIndent, finalProperties, getElement, getImplementMethodName, getTag, makeEventId, makeEventKeyOfCustomSlot, makeEventKeyOfElementSlot, makeMethodId, makeMethodKeyOfCustomSlot, makeMethodKeyOfElementSlot, makePropertyId, makePropertyKeyOfCustomSlot, makePropertyKeyOfElementSlot, makeTriggerId, parsePercentStr, parsePixelStr, pkgs, toEventName, toMethodName, toPropertyName, unwrapEventId, unwrapEventKeyOfCustomSlot, unwrapEventKeyOfElementSlot, unwrapMethodId, unwrapMethodKeyOfCustomSlot, unwrapMethodKeyOfElementSlot, unwrapPropertyId, unwrapPropertyKeyOfCustomSlot, unwrapPropertyKeyOfElementSlot, unwrapSlotId } from "x-runtime-lib";
14
+ import { eventBus, globalObjects, messageWarning, openConfirmDlg, openPromptDlg, useColor, useSystem, useViewStack } from "x-essential-lib";
15
15
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, isRef, mergeModels, mergeProps, nextTick, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, resolveComponent, resolveDirective, toDisplayString, unref, useId, useModel, useTemplateRef, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
16
16
  import { useDisplay } from "vuetify";
17
17
  import { useI18n } from "vue-i18n";
@@ -77,6 +77,14 @@ function isSlotNode(e) {
77
77
  function isMultipleSlotNode(e) {
78
78
  return e.startsWith("multiple_slot_v");
79
79
  }
80
+ function isEqualOfElementSlot(e, y, b) {
81
+ let { kind: x, mainKey: S, slotKey: C } = unwrapSlotId(e);
82
+ return !(x !== "elementSlot" && x !== "multipleElementSlot" || y !== S || b !== C);
83
+ }
84
+ function isEqualOfCustomSlot(e, y, b) {
85
+ let { kind: x, mainKey: S, slotKey: C } = unwrapSlotId(e);
86
+ return !(x !== "customSlot" && x !== "multipleCustomSlot" || y !== S || b !== C);
87
+ }
80
88
  function blockOfTextV1(e) {
81
89
  let y = `<block type="text_v1"><field name="TEXT">${e}</field></block>`;
82
90
  return utils.xml.textToDom(y);
@@ -496,7 +504,6 @@ function isFiltedImplementMethodOutput(e, y) {
496
504
  }
497
505
  if (isGlobalityNode(e.key) && b.type === "comp" && x.meta.methods) {
498
506
  for (let { outputs: e } of x.meta.methods) if (e && e.length > 0) return !1;
499
- return !1;
500
507
  }
501
508
  return !0;
502
509
  }
@@ -850,7 +857,7 @@ function getAllOnEventInfos(e) {
850
857
  });
851
858
  if (isGlobalityNode(E.key) && y.type === "comp" && T.adaptSlot) {
852
859
  let { kind: y, mainKey: b, slotKey: x } = unwrapSlotId(T.adaptSlot);
853
- if (y === "elementSlot") {
860
+ if (y === "elementSlot" || y === "multipleElementSlot") {
854
861
  let y = getElement(b);
855
862
  if (y && y.slots) {
856
863
  let S = y.slots.find((e) => e.key === x);
@@ -875,7 +882,7 @@ function getAllOnEventInfos(e) {
875
882
  params: makeChangeParams(b.type)
876
883
  });
877
884
  }
878
- } else if (y === "customSlot") {
885
+ } else if (y === "customSlot" || y === "multipleCustomSlot") {
879
886
  let y = S[b];
880
887
  if (y && y.meta.slots) {
881
888
  let S = y.meta.slots.find((e) => e.id === x);
@@ -1071,81 +1078,95 @@ function getOnEventInfo(e) {
1071
1078
  };
1072
1079
  }
1073
1080
  } else if (w === "elementAdaptSlotEvent") {
1074
- if (isGlobalityNode(O.key) && y.type === "comp") {
1075
- let { elementKey: y, slotKey: b, eventKey: x } = unwrapEventKeyOfElementSlot(E), S = getElement(y);
1076
- if (S && S.slots) {
1077
- let y = S.slots.find((e) => e.key === b);
1078
- if (y && y.events) {
1079
- let b = y.events.find((e) => e.key === x);
1080
- if (b) return {
1081
- id: e,
1082
- kind: w,
1083
- names: [
1084
- S.name,
1085
- y.name,
1086
- b.name
1087
- ],
1088
- params: b.params
1089
- };
1081
+ if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
1082
+ let { elementKey: y, slotKey: b, eventKey: x } = unwrapEventKeyOfElementSlot(E);
1083
+ if (isEqualOfElementSlot(D.adaptSlot, y, b)) {
1084
+ let S = getElement(y);
1085
+ if (S && S.slots) {
1086
+ let y = S.slots.find((e) => e.key === b);
1087
+ if (y && y.events) {
1088
+ let b = y.events.find((e) => e.key === x);
1089
+ if (b) return {
1090
+ id: e,
1091
+ kind: w,
1092
+ names: [
1093
+ S.name,
1094
+ y.name,
1095
+ b.name
1096
+ ],
1097
+ params: b.params
1098
+ };
1099
+ }
1090
1100
  }
1091
1101
  }
1092
1102
  }
1093
1103
  } else if (w === "elementAdaptSlotPropertyChangeEvent") {
1094
- if (isGlobalityNode(O.key) && y.type === "comp") {
1095
- let { elementKey: y, slotKey: b, propertyKey: x } = unwrapPropertyKeyOfElementSlot(E), S = getElement(y);
1096
- if (S && S.slots) {
1097
- let y = S.slots.find((e) => e.key === b);
1098
- if (y && y.properties) {
1099
- let b = y.properties.find((e) => e.key === x);
1100
- if (b) return {
1101
- id: e,
1102
- kind: w,
1103
- names: [
1104
- S.name,
1105
- y.name,
1106
- b.name
1107
- ],
1108
- params: makeChangeParams(b.type)
1109
- };
1104
+ if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
1105
+ let { elementKey: y, slotKey: b, propertyKey: x } = unwrapPropertyKeyOfElementSlot(E);
1106
+ if (isEqualOfElementSlot(D.adaptSlot, y, b)) {
1107
+ let S = getElement(y);
1108
+ if (S && S.slots) {
1109
+ let y = S.slots.find((e) => e.key === b);
1110
+ if (y && y.properties) {
1111
+ let b = y.properties.find((e) => e.key === x);
1112
+ if (b) return {
1113
+ id: e,
1114
+ kind: w,
1115
+ names: [
1116
+ S.name,
1117
+ y.name,
1118
+ b.name
1119
+ ],
1120
+ params: makeChangeParams(b.type)
1121
+ };
1122
+ }
1110
1123
  }
1111
1124
  }
1112
1125
  }
1113
1126
  } else if (w === "customAdaptSlotEvent") {
1114
- if (isGlobalityNode(O.key) && y.type === "comp") {
1115
- let { compId: y, slotId: b, eventId: x } = unwrapEventKeyOfCustomSlot(E), C = S[y];
1116
- if (C && C.meta.slots) {
1117
- let y = C.meta.slots.find((e) => e.id === b);
1118
- if (y && y.events) {
1119
- let b = y.events.find((e) => e.id === x);
1120
- if (b) return {
1121
- id: e,
1122
- kind: w,
1123
- names: [
1124
- C.name,
1125
- y.name,
1126
- b.name
1127
- ],
1128
- params: convertParams(b.params)
1129
- };
1127
+ if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
1128
+ let { compId: y, slotId: b, eventId: x } = unwrapEventKeyOfCustomSlot(E);
1129
+ if (isEqualOfCustomSlot(D.adaptSlot, y, b)) {
1130
+ let C = S[y];
1131
+ if (C && C.meta.slots) {
1132
+ let y = C.meta.slots.find((e) => e.id === b);
1133
+ if (y && y.events) {
1134
+ let b = y.events.find((e) => e.id === x);
1135
+ if (b) return {
1136
+ id: e,
1137
+ kind: w,
1138
+ names: [
1139
+ C.name,
1140
+ y.name,
1141
+ b.name
1142
+ ],
1143
+ params: convertParams(b.params)
1144
+ };
1145
+ }
1130
1146
  }
1131
1147
  }
1132
1148
  }
1133
1149
  } else if (w === "customAdaptSlotPropertyChangeEvent") {
1134
- let { compId: y, slotId: b, propertyId: x } = unwrapPropertyKeyOfCustomSlot(E), C = S[y];
1135
- if (C && C.meta.slots) {
1136
- let y = C.meta.slots.find((e) => e.id === b);
1137
- if (y && y.properties) {
1138
- let b = y.properties.find((e) => e.id === x);
1139
- if (b) return {
1140
- id: e,
1141
- kind: w,
1142
- names: [
1143
- C.name,
1144
- y.name,
1145
- b.name
1146
- ],
1147
- params: makeChangeParams(b.type)
1148
- };
1150
+ if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
1151
+ let { compId: y, slotId: b, propertyId: x } = unwrapPropertyKeyOfCustomSlot(E);
1152
+ if (isEqualOfCustomSlot(D.adaptSlot, y, b)) {
1153
+ let C = S[y];
1154
+ if (C && C.meta.slots) {
1155
+ let y = C.meta.slots.find((e) => e.id === b);
1156
+ if (y && y.properties) {
1157
+ let b = y.properties.find((e) => e.id === x);
1158
+ if (b) return {
1159
+ id: e,
1160
+ kind: w,
1161
+ names: [
1162
+ C.name,
1163
+ y.name,
1164
+ b.name
1165
+ ],
1166
+ params: makeChangeParams(b.type)
1167
+ };
1168
+ }
1169
+ }
1149
1170
  }
1150
1171
  }
1151
1172
  } else if (w === "stateChangeEvent" && isGlobalityNode(O.key)) {
@@ -1341,7 +1362,7 @@ function getAllCallMethodInfos(e) {
1341
1362
  });
1342
1363
  if (isGlobalityNode(w.key) && y.type === "comp" && C.adaptSlot) {
1343
1364
  let { kind: y, mainKey: b, slotKey: w } = unwrapSlotId(C.adaptSlot);
1344
- if (y === "elementSlot") {
1365
+ if (y === "elementSlot" || y === "multipleElementSlot") {
1345
1366
  let y = getElement(b);
1346
1367
  if (y && y.slots) {
1347
1368
  let b = y.slots.find((e) => e.key === w);
@@ -1357,7 +1378,7 @@ function getAllCallMethodInfos(e) {
1357
1378
  outputs: x.outputs
1358
1379
  });
1359
1380
  }
1360
- } else if (y === "customSlot") {
1381
+ } else if (y === "customSlot" || y === "multipleCustomSlot") {
1361
1382
  let y = x[b];
1362
1383
  if (y && y.meta.slots) {
1363
1384
  let x = y.meta.slots.find((e) => e.id === w);
@@ -1449,45 +1470,51 @@ function getCallMethodInfo(e) {
1449
1470
  }
1450
1471
  }
1451
1472
  } else if (S === "elementAdaptSlotMethod") {
1452
- if (isGlobalityNode(E.key) && y.type === "comp") {
1453
- let { elementKey: y, slotKey: b, methodKey: x } = unwrapMethodKeyOfElementSlot(w), C = getElement(y);
1454
- if (C && C.slots) {
1455
- let y = C.slots.find((e) => e.key === b);
1473
+ if (isGlobalityNode(E.key) && y.type === "comp" && T.adaptSlot) {
1474
+ let { elementKey: y, slotKey: b, methodKey: x } = unwrapMethodKeyOfElementSlot(w);
1475
+ if (isEqualOfElementSlot(T.adaptSlot, y, b)) {
1476
+ let C = getElement(y);
1477
+ if (C && C.slots) {
1478
+ let y = C.slots.find((e) => e.key === b);
1479
+ if (y && y.methods) {
1480
+ let b = y.methods.find((e) => e.key === x);
1481
+ if (b) return {
1482
+ id: e,
1483
+ kind: S,
1484
+ names: [
1485
+ C.name,
1486
+ y.name,
1487
+ b.name
1488
+ ],
1489
+ inputs: b.inputs,
1490
+ outputs: b.outputs
1491
+ };
1492
+ }
1493
+ }
1494
+ }
1495
+ }
1496
+ } else if (S === "customAdaptSlotMethod" && isGlobalityNode(E.key) && y.type === "comp" && T.adaptSlot) {
1497
+ let { compId: y, slotId: b, methodId: C } = unwrapMethodKeyOfCustomSlot(w);
1498
+ if (isEqualOfCustomSlot(T.adaptSlot, y, b)) {
1499
+ let w = x[y];
1500
+ if (w && w.meta.slots) {
1501
+ let y = w.meta.slots.find((e) => e.id === b);
1456
1502
  if (y && y.methods) {
1457
- let b = y.methods.find((e) => e.key === x);
1503
+ let b = y.methods.find((e) => e.id === C);
1458
1504
  if (b) return {
1459
1505
  id: e,
1460
1506
  kind: S,
1461
1507
  names: [
1462
- C.name,
1508
+ w.name,
1463
1509
  y.name,
1464
1510
  b.name
1465
1511
  ],
1466
- inputs: b.inputs,
1467
- outputs: b.outputs
1512
+ inputs: convertInputs(b.inputs),
1513
+ outputs: convertOutputs(b.outputs)
1468
1514
  };
1469
1515
  }
1470
1516
  }
1471
1517
  }
1472
- } else if (S === "customAdaptSlotMethod" && isGlobalityNode(E.key) && y.type === "comp") {
1473
- let { compId: y, slotId: b, methodId: C } = unwrapMethodKeyOfCustomSlot(w), T = x[y];
1474
- if (T && T.meta.slots) {
1475
- let y = T.meta.slots.find((e) => e.id === b);
1476
- if (y && y.methods) {
1477
- let b = y.methods.find((e) => e.id === C);
1478
- if (b) return {
1479
- id: e,
1480
- kind: S,
1481
- names: [
1482
- T.name,
1483
- y.name,
1484
- b.name
1485
- ],
1486
- inputs: convertInputs(b.inputs),
1487
- outputs: convertOutputs(b.outputs)
1488
- };
1489
- }
1490
- }
1491
1518
  }
1492
1519
  }
1493
1520
  function genCallMethodOpts(e) {
@@ -1709,7 +1736,7 @@ function getAllPropertyInfos(e, y) {
1709
1736
  });
1710
1737
  if (isGlobalityNode(E.key) && b.type === "comp" && T.adaptSlot) {
1711
1738
  let { kind: b, mainKey: x, slotKey: w } = unwrapSlotId(T.adaptSlot);
1712
- if (b === "elementSlot") {
1739
+ if (b === "elementSlot" || b === "multipleElementSlot") {
1713
1740
  let b = getElement(x);
1714
1741
  if (b && b.slots) {
1715
1742
  let x = b.slots.find((e) => e.key === w);
@@ -1724,7 +1751,7 @@ function getAllPropertyInfos(e, y) {
1724
1751
  meta: { raw: { type: S.type } }
1725
1752
  });
1726
1753
  }
1727
- } else if (b === "customSlot") {
1754
+ } else if (b === "customSlot" || b === "multipleCustomSlot") {
1728
1755
  let y = S[x];
1729
1756
  if (y && y.meta.slots) {
1730
1757
  let b = y.meta.slots.find((e) => e.id === w);
@@ -1834,17 +1861,41 @@ function getPropertyInfo(e) {
1834
1861
  };
1835
1862
  }
1836
1863
  } else if (C === "elementAdaptSlotProperty") {
1837
- if (isGlobalityNode(D.key) && y.type === "comp") {
1838
- let { elementKey: y, slotKey: b, propertyKey: x } = unwrapPropertyKeyOfElementSlot(T), S = getElement(y);
1839
- if (S && S.slots) {
1840
- let y = S.slots.find((e) => e.key === b);
1864
+ if (isGlobalityNode(D.key) && y.type === "comp" && E.adaptSlot) {
1865
+ let { elementKey: y, slotKey: b, propertyKey: x } = unwrapPropertyKeyOfElementSlot(T);
1866
+ if (isEqualOfElementSlot(E.adaptSlot, y, b)) {
1867
+ let S = getElement(y);
1868
+ if (S && S.slots) {
1869
+ let y = S.slots.find((e) => e.key === b);
1870
+ if (y && y.properties) {
1871
+ let b = y.properties.find((e) => e.key === x);
1872
+ if (b) return {
1873
+ id: e,
1874
+ kind: C,
1875
+ names: [
1876
+ S.name,
1877
+ y.name,
1878
+ b.name
1879
+ ],
1880
+ meta: { raw: { type: b.type } }
1881
+ };
1882
+ }
1883
+ }
1884
+ }
1885
+ }
1886
+ } else if (C === "customAdaptSlotProperty" && isGlobalityNode(D.key) && y.type === "comp" && E.adaptSlot) {
1887
+ let { compId: y, slotId: b, propertyId: S } = unwrapPropertyKeyOfCustomSlot(T);
1888
+ if (isEqualOfCustomSlot(E.adaptSlot, y, b)) {
1889
+ let w = x[y];
1890
+ if (w && w.meta.slots) {
1891
+ let y = w.meta.slots.find((e) => e.id === b);
1841
1892
  if (y && y.properties) {
1842
- let b = y.properties.find((e) => e.key === x);
1893
+ let b = y.properties.find((e) => e.id === S);
1843
1894
  if (b) return {
1844
1895
  id: e,
1845
1896
  kind: C,
1846
1897
  names: [
1847
- S.name,
1898
+ w.name,
1848
1899
  y.name,
1849
1900
  b.name
1850
1901
  ],
@@ -1853,24 +1904,6 @@ function getPropertyInfo(e) {
1853
1904
  }
1854
1905
  }
1855
1906
  }
1856
- } else if (C === "customAdaptSlotProperty" && isGlobalityNode(D.key) && y.type === "comp") {
1857
- let { compId: y, slotId: b, propertyId: S } = unwrapPropertyKeyOfCustomSlot(T), w = x[y];
1858
- if (w && w.meta.slots) {
1859
- let y = w.meta.slots.find((e) => e.id === b);
1860
- if (y && y.properties) {
1861
- let b = y.properties.find((e) => e.id === S);
1862
- if (b) return {
1863
- id: e,
1864
- kind: C,
1865
- names: [
1866
- w.name,
1867
- y.name,
1868
- b.name
1869
- ],
1870
- meta: { raw: { type: b.type } }
1871
- };
1872
- }
1873
- }
1874
1907
  }
1875
1908
  }
1876
1909
  function genPropertyOpts(e, y) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-block-lib",
3
3
  "private": false,
4
- "version": "0.9.29",
4
+ "version": "0.9.31",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "x-essential-lib": "^0.9.24",
44
- "x-runtime-lib": "^0.8.203",
44
+ "x-runtime-lib": "^0.8.205",
45
45
  "x-state-lib": "^0.3.38"
46
46
  },
47
47
  "devDependencies": {