x-block-lib 0.9.30 → 0.9.32
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/core/utils/common/misc.d.ts +2 -0
- package/dist/index.js +56 -47
- package/package.json +2 -2
|
@@ -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);
|
|
@@ -1071,18 +1079,18 @@ function getOnEventInfo(e) {
|
|
|
1071
1079
|
}
|
|
1072
1080
|
} else if (w === "elementAdaptSlotEvent") {
|
|
1073
1081
|
if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
|
|
1074
|
-
let { elementKey: y, slotKey: b, eventKey: x } = unwrapEventKeyOfElementSlot(E)
|
|
1075
|
-
if ((
|
|
1076
|
-
let
|
|
1077
|
-
if (
|
|
1078
|
-
let y =
|
|
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);
|
|
1079
1087
|
if (y && y.events) {
|
|
1080
1088
|
let b = y.events.find((e) => e.key === x);
|
|
1081
1089
|
if (b) return {
|
|
1082
1090
|
id: e,
|
|
1083
|
-
kind:
|
|
1091
|
+
kind: w,
|
|
1084
1092
|
names: [
|
|
1085
|
-
|
|
1093
|
+
S.name,
|
|
1086
1094
|
y.name,
|
|
1087
1095
|
b.name
|
|
1088
1096
|
],
|
|
@@ -1094,18 +1102,18 @@ function getOnEventInfo(e) {
|
|
|
1094
1102
|
}
|
|
1095
1103
|
} else if (w === "elementAdaptSlotPropertyChangeEvent") {
|
|
1096
1104
|
if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
|
|
1097
|
-
let { elementKey: y, slotKey: b, propertyKey: x } = unwrapPropertyKeyOfElementSlot(E)
|
|
1098
|
-
if ((
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1101
|
-
let y =
|
|
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);
|
|
1102
1110
|
if (y && y.properties) {
|
|
1103
1111
|
let b = y.properties.find((e) => e.key === x);
|
|
1104
1112
|
if (b) return {
|
|
1105
1113
|
id: e,
|
|
1106
|
-
kind:
|
|
1114
|
+
kind: w,
|
|
1107
1115
|
names: [
|
|
1108
|
-
|
|
1116
|
+
S.name,
|
|
1109
1117
|
y.name,
|
|
1110
1118
|
b.name
|
|
1111
1119
|
],
|
|
@@ -1117,18 +1125,18 @@ function getOnEventInfo(e) {
|
|
|
1117
1125
|
}
|
|
1118
1126
|
} else if (w === "customAdaptSlotEvent") {
|
|
1119
1127
|
if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
|
|
1120
|
-
let { compId: y, slotId: b, eventId: x } = unwrapEventKeyOfCustomSlot(E)
|
|
1121
|
-
if ((
|
|
1122
|
-
let
|
|
1123
|
-
if (
|
|
1124
|
-
let y =
|
|
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);
|
|
1125
1133
|
if (y && y.events) {
|
|
1126
1134
|
let b = y.events.find((e) => e.id === x);
|
|
1127
1135
|
if (b) return {
|
|
1128
1136
|
id: e,
|
|
1129
|
-
kind:
|
|
1137
|
+
kind: w,
|
|
1130
1138
|
names: [
|
|
1131
|
-
|
|
1139
|
+
C.name,
|
|
1132
1140
|
y.name,
|
|
1133
1141
|
b.name
|
|
1134
1142
|
],
|
|
@@ -1140,18 +1148,18 @@ function getOnEventInfo(e) {
|
|
|
1140
1148
|
}
|
|
1141
1149
|
} else if (w === "customAdaptSlotPropertyChangeEvent") {
|
|
1142
1150
|
if (isGlobalityNode(O.key) && y.type === "comp" && D.adaptSlot) {
|
|
1143
|
-
let { compId: y, slotId: b, propertyId: x } = unwrapPropertyKeyOfCustomSlot(E)
|
|
1144
|
-
if ((
|
|
1145
|
-
let
|
|
1146
|
-
if (
|
|
1147
|
-
let y =
|
|
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);
|
|
1148
1156
|
if (y && y.properties) {
|
|
1149
1157
|
let b = y.properties.find((e) => e.id === x);
|
|
1150
1158
|
if (b) return {
|
|
1151
1159
|
id: e,
|
|
1152
|
-
kind:
|
|
1160
|
+
kind: w,
|
|
1153
1161
|
names: [
|
|
1154
|
-
|
|
1162
|
+
C.name,
|
|
1155
1163
|
y.name,
|
|
1156
1164
|
b.name
|
|
1157
1165
|
],
|
|
@@ -1463,8 +1471,8 @@ function getCallMethodInfo(e) {
|
|
|
1463
1471
|
}
|
|
1464
1472
|
} else if (S === "elementAdaptSlotMethod") {
|
|
1465
1473
|
if (isGlobalityNode(E.key) && y.type === "comp" && T.adaptSlot) {
|
|
1466
|
-
let { elementKey: y, slotKey: b, methodKey: x } = unwrapMethodKeyOfElementSlot(w)
|
|
1467
|
-
if ((
|
|
1474
|
+
let { elementKey: y, slotKey: b, methodKey: x } = unwrapMethodKeyOfElementSlot(w);
|
|
1475
|
+
if (isEqualOfElementSlot(T.adaptSlot, y, b)) {
|
|
1468
1476
|
let C = getElement(y);
|
|
1469
1477
|
if (C && C.slots) {
|
|
1470
1478
|
let y = C.slots.find((e) => e.key === b);
|
|
@@ -1486,16 +1494,16 @@ function getCallMethodInfo(e) {
|
|
|
1486
1494
|
}
|
|
1487
1495
|
}
|
|
1488
1496
|
} else if (S === "customAdaptSlotMethod" && isGlobalityNode(E.key) && y.type === "comp" && T.adaptSlot) {
|
|
1489
|
-
let { compId: y, slotId: b, methodId:
|
|
1490
|
-
if ((
|
|
1497
|
+
let { compId: y, slotId: b, methodId: C } = unwrapMethodKeyOfCustomSlot(w);
|
|
1498
|
+
if (isEqualOfCustomSlot(T.adaptSlot, y, b)) {
|
|
1491
1499
|
let w = x[y];
|
|
1492
1500
|
if (w && w.meta.slots) {
|
|
1493
1501
|
let y = w.meta.slots.find((e) => e.id === b);
|
|
1494
1502
|
if (y && y.methods) {
|
|
1495
|
-
let b = y.methods.find((e) => e.id ===
|
|
1503
|
+
let b = y.methods.find((e) => e.id === C);
|
|
1496
1504
|
if (b) return {
|
|
1497
1505
|
id: e,
|
|
1498
|
-
kind:
|
|
1506
|
+
kind: S,
|
|
1499
1507
|
names: [
|
|
1500
1508
|
w.name,
|
|
1501
1509
|
y.name,
|
|
@@ -1854,18 +1862,18 @@ function getPropertyInfo(e) {
|
|
|
1854
1862
|
}
|
|
1855
1863
|
} else if (C === "elementAdaptSlotProperty") {
|
|
1856
1864
|
if (isGlobalityNode(D.key) && y.type === "comp" && E.adaptSlot) {
|
|
1857
|
-
let { elementKey: y, slotKey: b, propertyKey: x } = unwrapPropertyKeyOfElementSlot(T)
|
|
1858
|
-
if ((
|
|
1859
|
-
let
|
|
1860
|
-
if (
|
|
1861
|
-
let y =
|
|
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);
|
|
1862
1870
|
if (y && y.properties) {
|
|
1863
1871
|
let b = y.properties.find((e) => e.key === x);
|
|
1864
1872
|
if (b) return {
|
|
1865
1873
|
id: e,
|
|
1866
|
-
kind:
|
|
1874
|
+
kind: C,
|
|
1867
1875
|
names: [
|
|
1868
|
-
|
|
1876
|
+
S.name,
|
|
1869
1877
|
y.name,
|
|
1870
1878
|
b.name
|
|
1871
1879
|
],
|
|
@@ -1876,8 +1884,8 @@ function getPropertyInfo(e) {
|
|
|
1876
1884
|
}
|
|
1877
1885
|
}
|
|
1878
1886
|
} else if (C === "customAdaptSlotProperty" && isGlobalityNode(D.key) && y.type === "comp" && E.adaptSlot) {
|
|
1879
|
-
let { compId: y, slotId: b, propertyId: S } = unwrapPropertyKeyOfCustomSlot(T)
|
|
1880
|
-
if ((
|
|
1887
|
+
let { compId: y, slotId: b, propertyId: S } = unwrapPropertyKeyOfCustomSlot(T);
|
|
1888
|
+
if (isEqualOfCustomSlot(E.adaptSlot, y, b)) {
|
|
1881
1889
|
let w = x[y];
|
|
1882
1890
|
if (w && w.meta.slots) {
|
|
1883
1891
|
let y = w.meta.slots.find((e) => e.id === b);
|
|
@@ -1985,12 +1993,13 @@ Blocks.app_bind_container_v1 = { init: function() {
|
|
|
1985
1993
|
b.push(y.valueConnection_), y = y.getNextBlock();
|
|
1986
1994
|
}
|
|
1987
1995
|
for (let e = 0; e < this.itemCount_; e++) {
|
|
1996
|
+
this.getInput("ADD" + e).setShadowDom(null);
|
|
1988
1997
|
let y = this.getInput("ADD" + e).connection.targetConnection;
|
|
1989
1998
|
y && !b.includes(y) && y.disconnect();
|
|
1990
1999
|
}
|
|
1991
|
-
this.itemCount_ = b.length, this.updateShape_()
|
|
2000
|
+
this.itemCount_ = b.length, this.updateShape_();
|
|
1992
2001
|
for (let e = 0; e < this.itemCount_; e++) b[e]?.reconnect(this, "ADD" + e);
|
|
1993
|
-
setTimeout(() => {
|
|
2002
|
+
this.updateShadow_(), setTimeout(() => {
|
|
1994
2003
|
this.checkWarning_();
|
|
1995
2004
|
}, 0);
|
|
1996
2005
|
},
|
|
@@ -2014,7 +2023,7 @@ Blocks.app_bind_container_v1 = { init: function() {
|
|
|
2014
2023
|
for (let e = this.itemCount_; this.getInput("ADD" + e); e++) this.removeInput("ADD" + e);
|
|
2015
2024
|
},
|
|
2016
2025
|
updateShadow_: function() {
|
|
2017
|
-
if (!this.isInsertionMarker()) for (let e = 0; e < this.itemCount_; e++) this.getInput("ADD" + e).
|
|
2026
|
+
if (!this.isInsertionMarker()) for (let e = 0; e < this.itemCount_; e++) this.getInput("ADD" + e).setShadowDom(shadowOfAppBindEntryV1());
|
|
2018
2027
|
},
|
|
2019
2028
|
checkWarning_: function() {
|
|
2020
2029
|
let e;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-block-lib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.32",
|
|
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.
|
|
44
|
+
"x-runtime-lib": "^0.8.207",
|
|
45
45
|
"x-state-lib": "^0.3.38"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|