x-block-lib 0.3.19 → 0.3.23
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/{blockly-kru4jhu1.js → blockly-ijxiuski.js} +7 -7
- package/dist/components/blockly/cleanup.vue.d.ts +2 -0
- package/dist/components/blockly/index.vue.d.ts +10 -3
- package/dist/components/blockly/lock.vue.d.ts +18 -0
- package/dist/components/blockly/navigator.vue.d.ts +2 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/misc/index.d.ts +3 -0
- package/dist/index.js +470 -251
- package/package.json +4 -1
|
@@ -15856,15 +15856,15 @@ export {
|
|
|
15856
15856
|
_b as b,
|
|
15857
15857
|
I_ as c,
|
|
15858
15858
|
mb as d,
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15859
|
+
vb as e,
|
|
15860
|
+
Db as f,
|
|
15861
|
+
Tb as g,
|
|
15862
|
+
Sb as h,
|
|
15863
15863
|
Rb as i,
|
|
15864
15864
|
Zb as j,
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15865
|
+
xm as k,
|
|
15866
|
+
ab as l,
|
|
15867
|
+
x_ as m,
|
|
15868
15868
|
yb as n,
|
|
15869
15869
|
Wb as o,
|
|
15870
15870
|
Gb as s,
|
|
@@ -2,13 +2,20 @@ interface Props {
|
|
|
2
2
|
type: 'app';
|
|
3
3
|
version: 'v1';
|
|
4
4
|
active: boolean;
|
|
5
|
+
scale: number;
|
|
5
6
|
}
|
|
6
|
-
declare
|
|
7
|
+
declare let __VLS_typeProps: Props;
|
|
8
|
+
type __VLS_PublicProps = {
|
|
9
|
+
'lock': boolean;
|
|
10
|
+
} & typeof __VLS_typeProps;
|
|
11
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_PublicProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:lock": (lock: boolean) => void;
|
|
7
13
|
ready: (...args: any[]) => void;
|
|
8
14
|
change: (...args: any[]) => void;
|
|
9
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<
|
|
10
|
-
onReady?: ((...args: any[]) => any) | undefined;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
|
|
11
16
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
"onUpdate:lock"?: ((lock: boolean) => any) | undefined;
|
|
12
19
|
}, {}, {}>;
|
|
13
20
|
export default _default;
|
|
14
21
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_PublicProps = {
|
|
2
|
+
modelValue: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_PublicProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
"update:modelValue": (modelValue: boolean) => void;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
|
|
7
|
+
"onUpdate:modelValue"?: ((modelValue: boolean) => any) | undefined;
|
|
8
|
+
}, {}, {}>;
|
|
9
|
+
export default _default;
|
|
10
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
11
|
+
type __VLS_TypePropsToOption<T> = {
|
|
12
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
13
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
14
|
+
} : {
|
|
15
|
+
type: import('vue').PropType<T[K]>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
};
|
package/dist/core/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.id="x-block-lib",o.appendChild(document.createTextNode(".blocklyToolboxDiv{overflow-x:hidden;width:56px}.blocklyMainBackground{stroke-width:0}.blocklyToolboxCategory{margin-bottom:10px}.blocklyTreeRow{height:28px;display:flex;align-items:center;border-left-width:6px!important;border-right-width:6px!important}.blocklyTreeIcon{display:none!important}.blocklyFlyout{z-index:21}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { defineComponent as M, resolveComponent as m, openBlock as d, createBlock as L, unref as R, useModel as $, computed as w, ref as K, onMounted as Z, onUnmounted as ue, withCtx as E, createVNode as S, mergeProps as _e, createElementVNode as G, normalizeStyle as V, createElementBlock as A, Fragment as pe, renderList as fe, createTextVNode as de, toDisplayString as ye, mergeModels as X, onBeforeUnmount as ge, watch as B, resolveDirective as me, withDirectives as he, createCommentVNode as D } from "vue";
|
|
3
|
+
import { d as I, j as be, O as ke, E as y, u as c, M as g, C as Ce, a as h, b as q, s as Oe, g as T, S as p, c as U, e as v, i as P, f as Y, h as x, k as C, l as j, G as H, B as ve, T as F, m as Q, n as Se, o as Le } from "./blockly-ijxiuski.js";
|
|
4
|
+
import { storeToRefs as Te } from "pinia";
|
|
5
|
+
import { openConfirmDlg as Ie, openPromptDlg as Ee, eventBus as W, useGlobalStore as Be, useViewStack as xe } from "x-essential-lib";
|
|
6
|
+
var Ae = "M19.36,2.72L20.78,4.14L15.06,9.85C16.13,11.39 16.28,13.24 15.38,14.44L9.06,8.12C10.26,7.22 12.11,7.37 13.65,8.44L19.36,2.72M5.93,17.57C3.92,15.56 2.69,13.16 2.35,10.92L7.23,8.83L14.67,16.27L12.58,21.15C10.34,20.81 7.94,19.58 5.93,17.57Z", Re = "M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z", Pe = "M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z", we = "M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,0 14,15A2,2 0 0,0 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17Z", Ke = "M21 3L3 10.53V11.5L9.84 14.16L12.5 21H13.46L21 3Z";
|
|
7
|
+
I([
|
|
7
8
|
{
|
|
8
9
|
type: "boolean_v1",
|
|
9
10
|
message0: "%1",
|
|
@@ -23,16 +24,16 @@ h([
|
|
|
23
24
|
helpUrl: "%{BKY_LOGIC_V1_BOOLEAN_HELPURL}"
|
|
24
25
|
}
|
|
25
26
|
]);
|
|
26
|
-
|
|
27
|
-
return [t.getFieldValue("BOOL") === "TRUE" ? "true" : "false",
|
|
27
|
+
be.forBlock.boolean_v1 = function(t) {
|
|
28
|
+
return [t.getFieldValue("BOOL") === "TRUE" ? "true" : "false", ke.ATOMIC];
|
|
28
29
|
};
|
|
29
|
-
const
|
|
30
|
+
const Ve = {
|
|
30
31
|
elseIfCount_: 0,
|
|
31
32
|
hasElse_: !1,
|
|
32
33
|
mutationToDom: function() {
|
|
33
34
|
if (this.elseIfCount_ <= 0 && !this.hasElse_)
|
|
34
35
|
return null;
|
|
35
|
-
const t =
|
|
36
|
+
const t = c.xml.createElement("mutation");
|
|
36
37
|
return this.elseIfCount_ > 0 && t.setAttribute("elseIf", String(this.elseIfCount_)), this.hasElse_ && t.setAttribute("else", "TRUE"), t;
|
|
37
38
|
},
|
|
38
39
|
domToMutation: function(t) {
|
|
@@ -50,23 +51,23 @@ const re = {
|
|
|
50
51
|
decompose: function(t) {
|
|
51
52
|
const e = t.newBlock("if_if_v1");
|
|
52
53
|
e.initSvg();
|
|
53
|
-
let
|
|
54
|
-
for (let
|
|
54
|
+
let o = e.nextConnection;
|
|
55
|
+
for (let n = 0; n < this.elseIfCount_; n++) {
|
|
55
56
|
const r = t.newBlock(
|
|
56
57
|
"if_else_if_v1"
|
|
57
58
|
);
|
|
58
|
-
r.initSvg(),
|
|
59
|
+
r.initSvg(), o.connect(r.previousConnection), o = r.nextConnection;
|
|
59
60
|
}
|
|
60
61
|
if (this.hasElse_) {
|
|
61
|
-
const
|
|
62
|
-
|
|
62
|
+
const n = t.newBlock("if_else_v1");
|
|
63
|
+
n.initSvg(), o.connect(n.previousConnection);
|
|
63
64
|
}
|
|
64
65
|
return e;
|
|
65
66
|
},
|
|
66
67
|
compose: function(t) {
|
|
67
68
|
let e = t.nextConnection.targetBlock();
|
|
68
69
|
this.elseIfCount_ = 0, this.hasElse_ = !1;
|
|
69
|
-
const
|
|
70
|
+
const o = [null], n = [null];
|
|
70
71
|
let r = null;
|
|
71
72
|
for (; e; ) {
|
|
72
73
|
if (e.isInsertionMarker()) {
|
|
@@ -75,9 +76,9 @@ const re = {
|
|
|
75
76
|
}
|
|
76
77
|
switch (e.type) {
|
|
77
78
|
case "if_else_if_v1":
|
|
78
|
-
this.elseIfCount_++,
|
|
79
|
+
this.elseIfCount_++, o.push(
|
|
79
80
|
e.valueConnection_
|
|
80
|
-
),
|
|
81
|
+
), n.push(
|
|
81
82
|
e.statementConnection_
|
|
82
83
|
);
|
|
83
84
|
break;
|
|
@@ -90,13 +91,13 @@ const re = {
|
|
|
90
91
|
e = e.getNextBlock();
|
|
91
92
|
}
|
|
92
93
|
this.updateShape_(), this.reconnectChildBlocks_(
|
|
93
|
-
n,
|
|
94
94
|
o,
|
|
95
|
+
n,
|
|
95
96
|
r
|
|
96
97
|
);
|
|
97
98
|
},
|
|
98
99
|
saveConnections: function(t) {
|
|
99
|
-
let e = t.nextConnection.targetBlock(),
|
|
100
|
+
let e = t.nextConnection.targetBlock(), o = 1;
|
|
100
101
|
for (; e; ) {
|
|
101
102
|
if (e.isInsertionMarker()) {
|
|
102
103
|
e = e.getNextBlock();
|
|
@@ -104,13 +105,13 @@ const re = {
|
|
|
104
105
|
}
|
|
105
106
|
switch (e.type) {
|
|
106
107
|
case "if_else_if_v1": {
|
|
107
|
-
const
|
|
108
|
-
e.valueConnection_ =
|
|
108
|
+
const n = this.getInput("IF" + o), r = this.getInput("DO" + o);
|
|
109
|
+
e.valueConnection_ = n && n.connection.targetConnection, e.statementConnection_ = r && r.connection.targetConnection, o++;
|
|
109
110
|
break;
|
|
110
111
|
}
|
|
111
112
|
case "if_else_v1": {
|
|
112
|
-
const
|
|
113
|
-
e.statementConnection_ =
|
|
113
|
+
const n = this.getInput("ELSE");
|
|
114
|
+
e.statementConnection_ = n && n.connection.targetConnection;
|
|
114
115
|
break;
|
|
115
116
|
}
|
|
116
117
|
default:
|
|
@@ -121,16 +122,16 @@ const re = {
|
|
|
121
122
|
},
|
|
122
123
|
rebuildShape_: function() {
|
|
123
124
|
const t = [null], e = [null];
|
|
124
|
-
let
|
|
125
|
-
this.getInput("ELSE") && (
|
|
126
|
-
for (let
|
|
127
|
-
const r = this.getInput("IF" +
|
|
125
|
+
let o = null;
|
|
126
|
+
this.getInput("ELSE") && (o = this.getInput("ELSE").connection.targetConnection);
|
|
127
|
+
for (let n = 1; this.getInput("IF" + n); n++) {
|
|
128
|
+
const r = this.getInput("IF" + n), s = this.getInput("DO" + n);
|
|
128
129
|
t.push(r.connection.targetConnection), e.push(s.connection.targetConnection);
|
|
129
130
|
}
|
|
130
131
|
this.updateShape_(), this.reconnectChildBlocks_(
|
|
131
132
|
t,
|
|
132
133
|
e,
|
|
133
|
-
|
|
134
|
+
o
|
|
134
135
|
);
|
|
135
136
|
},
|
|
136
137
|
updateShape_: function() {
|
|
@@ -138,23 +139,23 @@ const re = {
|
|
|
138
139
|
for (let t = 1; this.getInput("IF" + t); t++)
|
|
139
140
|
this.removeInput("IF" + t), this.removeInput("DO" + t);
|
|
140
141
|
for (let t = 1; t <= this.elseIfCount_; t++)
|
|
141
|
-
this.appendValueInput("IF" + t).setCheck("Boolean").appendField(
|
|
142
|
-
this.hasElse_ && this.appendStatementInput("ELSE").appendField(
|
|
142
|
+
this.appendValueInput("IF" + t).setCheck("Boolean").appendField(g.LOGIC_ELSE_IF), this.appendStatementInput("DO" + t).appendField(g.LOGIC_DO);
|
|
143
|
+
this.hasElse_ && this.appendStatementInput("ELSE").appendField(g.LOGIC_ELSE);
|
|
143
144
|
},
|
|
144
|
-
reconnectChildBlocks_: function(t, e,
|
|
145
|
-
var
|
|
145
|
+
reconnectChildBlocks_: function(t, e, o) {
|
|
146
|
+
var n, r;
|
|
146
147
|
for (let s = 1; s <= this.elseIfCount_; s++)
|
|
147
|
-
(
|
|
148
|
-
|
|
148
|
+
(n = t[s]) == null || n.reconnect(this, "IF" + s), (r = e[s]) == null || r.reconnect(this, "DO" + s);
|
|
149
|
+
o == null || o.reconnect(this, "ELSE");
|
|
149
150
|
}
|
|
150
151
|
};
|
|
151
|
-
|
|
152
|
+
y.registerMutator(
|
|
152
153
|
"if_v1_mutator",
|
|
153
|
-
|
|
154
|
+
Ve,
|
|
154
155
|
void 0,
|
|
155
156
|
["if_else_if_v1", "if_else_v1"]
|
|
156
157
|
);
|
|
157
|
-
|
|
158
|
+
I([
|
|
158
159
|
{
|
|
159
160
|
type: "if_v1",
|
|
160
161
|
message0: "%{BKY_LOGIC_IF} %1",
|
|
@@ -202,12 +203,12 @@ h([
|
|
|
202
203
|
style: "logic_blocks"
|
|
203
204
|
}
|
|
204
205
|
]);
|
|
205
|
-
const
|
|
206
|
+
const Me = {
|
|
206
207
|
customContextMenu: function(t) {
|
|
207
208
|
if (this.isInFlyout)
|
|
208
209
|
return;
|
|
209
|
-
const e = this.getField("VAR"),
|
|
210
|
-
if (!this.isCollapsed() &&
|
|
210
|
+
const e = this.getField("VAR"), o = e.getVariable(), n = o == null ? void 0 : o.name;
|
|
211
|
+
if (!this.isCollapsed() && n) {
|
|
211
212
|
const r = {
|
|
212
213
|
type: "variables_get",
|
|
213
214
|
fields: {
|
|
@@ -216,33 +217,33 @@ const se = {
|
|
|
216
217
|
};
|
|
217
218
|
t.push({
|
|
218
219
|
enabled: !0,
|
|
219
|
-
text:
|
|
220
|
-
callback:
|
|
220
|
+
text: g.VARIABLES_SET_CREATE_GET.replace("%1", n),
|
|
221
|
+
callback: Ce.callbackFactory(this, r)
|
|
221
222
|
});
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
225
|
};
|
|
225
|
-
|
|
226
|
+
y.registerMixin(
|
|
226
227
|
"contextMenu_newGetVariableBlock_v1",
|
|
227
|
-
|
|
228
|
+
Me
|
|
228
229
|
);
|
|
229
|
-
|
|
230
|
+
y.register(
|
|
230
231
|
"flow_control_tooltip_v1",
|
|
231
|
-
|
|
232
|
+
y.buildTooltipForDropdown("MODE", {
|
|
232
233
|
BREAK: "%{BKY_LOOP_V1_FLOW_CONTROL_TOOLTIP_BREAK}",
|
|
233
234
|
CONTINUE: "%{BKY_LOOP_V1_FLOW_CONTROL_TOOLTIP_CONTINUE}"
|
|
234
235
|
})
|
|
235
236
|
);
|
|
236
|
-
const
|
|
237
|
+
const Fe = /* @__PURE__ */ new Set([
|
|
237
238
|
"repeat_v1",
|
|
238
239
|
"for_each_v1",
|
|
239
240
|
"for_v1",
|
|
240
241
|
"while_until_v1"
|
|
241
|
-
]),
|
|
242
|
+
]), Ne = {
|
|
242
243
|
getSurroundLoop: function() {
|
|
243
244
|
let t = this;
|
|
244
245
|
do {
|
|
245
|
-
if (
|
|
246
|
+
if (Fe.has(t.type))
|
|
246
247
|
return !0;
|
|
247
248
|
t = t == null ? void 0 : t.getSurroundParent();
|
|
248
249
|
} while (t);
|
|
@@ -250,24 +251,24 @@ const ae = /* @__PURE__ */ new Set([
|
|
|
250
251
|
},
|
|
251
252
|
onchange: function(t) {
|
|
252
253
|
const e = this.workspace;
|
|
253
|
-
if (!e.isDragging || e.isDragging() || t.type !==
|
|
254
|
+
if (!e.isDragging || e.isDragging() || t.type !== h.BLOCK_MOVE && t.type !== h.BLOCK_CREATE)
|
|
254
255
|
return;
|
|
255
|
-
const
|
|
256
|
-
if (console.log(t.type,
|
|
257
|
-
|
|
256
|
+
const o = this.getSurroundLoop();
|
|
257
|
+
if (console.log(t.type, o), this.setWarningText(
|
|
258
|
+
o ? null : g.LOOP_FLOW_CONTROL_WARNING
|
|
258
259
|
), !this.isInFlyout)
|
|
259
260
|
try {
|
|
260
|
-
|
|
261
|
+
h.setRecordUndo(!1), this.setDisabledReason(!o, "FLOW_CONTROL_NOT_IN_LOOP");
|
|
261
262
|
} finally {
|
|
262
|
-
|
|
263
|
+
h.setRecordUndo(!0);
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
};
|
|
266
|
-
|
|
267
|
+
y.registerMixin(
|
|
267
268
|
"flow_control_in_loop_check_v1",
|
|
268
|
-
|
|
269
|
+
Ne
|
|
269
270
|
);
|
|
270
|
-
|
|
271
|
+
I([
|
|
271
272
|
{
|
|
272
273
|
type: "flow_control_v1",
|
|
273
274
|
message0: "%1",
|
|
@@ -288,14 +289,14 @@ h([
|
|
|
288
289
|
extensions: ["flow_control_tooltip_v1", "flow_control_in_loop_check_v1"]
|
|
289
290
|
}
|
|
290
291
|
]);
|
|
291
|
-
|
|
292
|
+
y.register(
|
|
292
293
|
"for_tooltip_v1",
|
|
293
|
-
|
|
294
|
+
y.buildTooltipWithFieldText(
|
|
294
295
|
"%{BKY_LOOP_V1_FOR_TOOLTIP}",
|
|
295
296
|
"VAR"
|
|
296
297
|
)
|
|
297
298
|
);
|
|
298
|
-
|
|
299
|
+
I([
|
|
299
300
|
{
|
|
300
301
|
type: "for_v1",
|
|
301
302
|
message0: "%{BKY_LOOP_V1_FOR_TITLE}",
|
|
@@ -339,14 +340,14 @@ h([
|
|
|
339
340
|
extensions: ["contextMenu_newGetVariableBlock_v1", "for_tooltip_v1"]
|
|
340
341
|
}
|
|
341
342
|
]);
|
|
342
|
-
|
|
343
|
+
y.register(
|
|
343
344
|
"for_each_tooltip_v1",
|
|
344
|
-
|
|
345
|
+
y.buildTooltipWithFieldText(
|
|
345
346
|
"%{BKY_LOOP_V1_FOR_EACH_TOOLTIP}",
|
|
346
347
|
"VAR"
|
|
347
348
|
)
|
|
348
349
|
);
|
|
349
|
-
|
|
350
|
+
I([
|
|
350
351
|
{
|
|
351
352
|
type: "for_each_v1",
|
|
352
353
|
message0: "%{BKY_LOOP_V1_FOR_EACH_TITLE}",
|
|
@@ -376,14 +377,14 @@ h([
|
|
|
376
377
|
extensions: ["contextMenu_newGetVariableBlock_v1", "for_each_tooltip_v1"]
|
|
377
378
|
}
|
|
378
379
|
]);
|
|
379
|
-
|
|
380
|
+
y.register(
|
|
380
381
|
"while_until_tooltip_v1",
|
|
381
|
-
|
|
382
|
+
y.buildTooltipForDropdown("MODE", {
|
|
382
383
|
WHILE: "%{BKY_LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE}",
|
|
383
384
|
UNTIL: "%{BKY_LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL}"
|
|
384
385
|
})
|
|
385
386
|
);
|
|
386
|
-
|
|
387
|
+
I([
|
|
387
388
|
{
|
|
388
389
|
type: "while_until_v1",
|
|
389
390
|
message0: "%1 %2",
|
|
@@ -416,232 +417,253 @@ h([
|
|
|
416
417
|
extensions: ["while_until_tooltip_v1"]
|
|
417
418
|
}
|
|
418
419
|
]);
|
|
419
|
-
|
|
420
|
-
const
|
|
420
|
+
q.setConfirm(async (t, e) => {
|
|
421
|
+
const o = await Ie({
|
|
421
422
|
title: "",
|
|
422
423
|
text: t
|
|
423
424
|
});
|
|
424
|
-
e(!!
|
|
425
|
+
e(!!o);
|
|
425
426
|
});
|
|
426
|
-
|
|
427
|
-
const
|
|
427
|
+
q.setPrompt(async (t, e, o) => {
|
|
428
|
+
const n = await Ee({
|
|
428
429
|
title: "",
|
|
429
430
|
value: e
|
|
430
431
|
});
|
|
431
|
-
n
|
|
432
|
+
o(n);
|
|
432
433
|
});
|
|
433
|
-
const
|
|
434
|
-
const
|
|
435
|
-
return
|
|
434
|
+
const De = (t, e, o) => {
|
|
435
|
+
const n = t[e];
|
|
436
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((r, s) => {
|
|
436
437
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
437
438
|
s.bind(
|
|
438
439
|
null,
|
|
439
440
|
new Error(
|
|
440
|
-
"Unknown variable dynamic import: " + e + (e.split("/").length !==
|
|
441
|
+
"Unknown variable dynamic import: " + e + (e.split("/").length !== o ? ". Note that variables only represent file names one level deep." : "")
|
|
441
442
|
)
|
|
442
443
|
)
|
|
443
444
|
);
|
|
444
445
|
});
|
|
445
446
|
};
|
|
446
|
-
async function
|
|
447
|
-
const e = await
|
|
448
|
-
|
|
447
|
+
async function J(t) {
|
|
448
|
+
const e = await De(/* @__PURE__ */ Object.assign({ "./msg/en/index.ts": () => import("./en-jrrs2wmb.js"), "./msg/zhHans/index.ts": () => import("./zhHans-jrrs2wmb.js") }), `./msg/${t}/index.ts`, 4);
|
|
449
|
+
Oe(e.default);
|
|
450
|
+
}
|
|
451
|
+
function ee(t) {
|
|
452
|
+
const e = T();
|
|
453
|
+
if (!e)
|
|
454
|
+
return;
|
|
455
|
+
const o = e.getBlockById(t);
|
|
456
|
+
if (!o)
|
|
457
|
+
return;
|
|
458
|
+
const n = o.getRootBlock();
|
|
459
|
+
if (!n)
|
|
460
|
+
return;
|
|
461
|
+
const r = n.getRelativeToSurfaceXY(), s = r.x * e.scale, l = r.y * e.scale;
|
|
462
|
+
e.scroll(-s, -l);
|
|
449
463
|
}
|
|
450
|
-
|
|
451
|
-
|
|
464
|
+
function Ue() {
|
|
465
|
+
var o;
|
|
466
|
+
const t = T();
|
|
467
|
+
if (!t)
|
|
468
|
+
return;
|
|
469
|
+
const e = (o = t.getTopBlocks(!0)) == null ? void 0 : o[0];
|
|
470
|
+
e && ee(e.id);
|
|
471
|
+
}
|
|
472
|
+
class Ye {
|
|
473
|
+
init({ contextMenu: e = !0, shortcut: o = !0 } = {
|
|
452
474
|
contextMenu: !0,
|
|
453
475
|
shortcut: !0
|
|
454
476
|
}) {
|
|
455
|
-
e && (this.blockCopyToStorageContextMenu(), this.blockPasteFromStorageContextMenu()),
|
|
456
|
-
|
|
457
|
-
),
|
|
458
|
-
|
|
459
|
-
),
|
|
460
|
-
|
|
477
|
+
e && (this.blockCopyToStorageContextMenu(), this.blockPasteFromStorageContextMenu()), o && (p.registry.unregister(
|
|
478
|
+
U.names.COPY
|
|
479
|
+
), p.registry.unregister(
|
|
480
|
+
U.names.CUT
|
|
481
|
+
), p.registry.unregister(
|
|
482
|
+
U.names.PASTE
|
|
461
483
|
), this.blockCopyToStorageShortcut(), this.blockCutToStorageShortcut(), this.blockPasteFromStorageShortcut());
|
|
462
484
|
}
|
|
463
485
|
blockCopyToStorageContextMenu() {
|
|
464
486
|
const e = {
|
|
465
487
|
displayText: function() {
|
|
466
|
-
return
|
|
488
|
+
return g.CROSS_TAB_COPY ? g.CROSS_TAB_COPY : "Copy";
|
|
467
489
|
},
|
|
468
490
|
preconditionFn: function() {
|
|
469
|
-
const
|
|
470
|
-
return !
|
|
491
|
+
const o = v();
|
|
492
|
+
return !o || !P(o) || !o.isDeletable() || !Y(o) || !o.isMovable() || !x(o) ? "disabled" : "enabled";
|
|
471
493
|
},
|
|
472
|
-
callback: function(
|
|
473
|
-
var
|
|
494
|
+
callback: function(o) {
|
|
495
|
+
var n;
|
|
474
496
|
localStorage.setItem(
|
|
475
497
|
"blocklyStash",
|
|
476
|
-
JSON.stringify((
|
|
498
|
+
JSON.stringify((n = o.block) == null ? void 0 : n.toCopyData())
|
|
477
499
|
);
|
|
478
500
|
},
|
|
479
|
-
scopeType:
|
|
501
|
+
scopeType: C.ScopeType.BLOCK,
|
|
480
502
|
id: "blockCopyToStorage",
|
|
481
503
|
weight: 0
|
|
482
504
|
};
|
|
483
|
-
|
|
505
|
+
C.registry.register(e);
|
|
484
506
|
}
|
|
485
507
|
blockPasteFromStorageContextMenu() {
|
|
486
508
|
const e = {
|
|
487
509
|
displayText: function() {
|
|
488
|
-
return
|
|
510
|
+
return g.CROSS_TAB_PASTE ? g.CROSS_TAB_PASTE : "Paste";
|
|
489
511
|
},
|
|
490
|
-
preconditionFn: function(
|
|
512
|
+
preconditionFn: function(o) {
|
|
491
513
|
var s;
|
|
492
|
-
const
|
|
493
|
-
if (!
|
|
514
|
+
const n = localStorage.getItem("blocklyStash");
|
|
515
|
+
if (!n)
|
|
494
516
|
return "disabled";
|
|
495
|
-
const r = JSON.parse(
|
|
496
|
-
return !r || !((s =
|
|
517
|
+
const r = JSON.parse(n);
|
|
518
|
+
return !r || !((s = o.workspace) != null && s.isCapacityAvailable(r.typeCounts)) ? "disabled" : "enabled";
|
|
497
519
|
},
|
|
498
|
-
callback: function(
|
|
499
|
-
const
|
|
500
|
-
if (!
|
|
520
|
+
callback: function(o) {
|
|
521
|
+
const n = localStorage.getItem("blocklyStash");
|
|
522
|
+
if (!n)
|
|
501
523
|
return;
|
|
502
|
-
const r = JSON.parse(
|
|
503
|
-
r &&
|
|
524
|
+
const r = JSON.parse(n);
|
|
525
|
+
r && o.workspace && j.paste(r, o.workspace);
|
|
504
526
|
},
|
|
505
|
-
scopeType:
|
|
527
|
+
scopeType: C.ScopeType.WORKSPACE,
|
|
506
528
|
id: "blockPasteFromStorage",
|
|
507
529
|
weight: 0
|
|
508
530
|
};
|
|
509
|
-
|
|
531
|
+
C.registry.register(e);
|
|
510
532
|
}
|
|
511
533
|
blockCopyToStorageShortcut() {
|
|
512
|
-
const e =
|
|
513
|
-
|
|
514
|
-
[
|
|
515
|
-
),
|
|
516
|
-
|
|
517
|
-
[
|
|
518
|
-
),
|
|
519
|
-
|
|
520
|
-
[
|
|
534
|
+
const e = p.registry.createSerializedKey(
|
|
535
|
+
c.KeyCodes.C,
|
|
536
|
+
[c.KeyCodes.CTRL]
|
|
537
|
+
), o = p.registry.createSerializedKey(
|
|
538
|
+
c.KeyCodes.C,
|
|
539
|
+
[c.KeyCodes.ALT]
|
|
540
|
+
), n = p.registry.createSerializedKey(
|
|
541
|
+
c.KeyCodes.C,
|
|
542
|
+
[c.KeyCodes.META]
|
|
521
543
|
), r = {
|
|
522
544
|
name: "copy",
|
|
523
545
|
preconditionFn: function(s) {
|
|
524
|
-
if (s.options.readOnly ||
|
|
546
|
+
if (s.options.readOnly || H.inProgress())
|
|
525
547
|
return !1;
|
|
526
|
-
const
|
|
527
|
-
return !(!
|
|
548
|
+
const l = v();
|
|
549
|
+
return !(!l || !P(l) || !l.isDeletable() || !Y(l) || !l.isMovable() || !x(l));
|
|
528
550
|
},
|
|
529
|
-
callback: function(s,
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
if (!
|
|
551
|
+
callback: function(s, l) {
|
|
552
|
+
l.preventDefault();
|
|
553
|
+
const a = v();
|
|
554
|
+
if (!a || !x(a))
|
|
533
555
|
return !1;
|
|
534
|
-
const
|
|
535
|
-
return
|
|
556
|
+
const u = a.toCopyData();
|
|
557
|
+
return u ? (s.hideChaff(), localStorage.setItem("blocklyStash", JSON.stringify(u)), !0) : !1;
|
|
536
558
|
},
|
|
537
|
-
keyCodes: [e,
|
|
559
|
+
keyCodes: [e, o, n]
|
|
538
560
|
};
|
|
539
|
-
|
|
561
|
+
p.registry.register(r);
|
|
540
562
|
}
|
|
541
563
|
blockCutToStorageShortcut() {
|
|
542
|
-
const e =
|
|
543
|
-
|
|
544
|
-
[
|
|
545
|
-
),
|
|
546
|
-
|
|
547
|
-
[
|
|
548
|
-
),
|
|
549
|
-
|
|
550
|
-
[
|
|
564
|
+
const e = p.registry.createSerializedKey(
|
|
565
|
+
c.KeyCodes.X,
|
|
566
|
+
[c.KeyCodes.CTRL]
|
|
567
|
+
), o = p.registry.createSerializedKey(
|
|
568
|
+
c.KeyCodes.X,
|
|
569
|
+
[c.KeyCodes.ALT]
|
|
570
|
+
), n = p.registry.createSerializedKey(
|
|
571
|
+
c.KeyCodes.X,
|
|
572
|
+
[c.KeyCodes.META]
|
|
551
573
|
), r = {
|
|
552
574
|
name: "cut",
|
|
553
575
|
preconditionFn: function(s) {
|
|
554
|
-
if (s.options.readOnly ||
|
|
576
|
+
if (s.options.readOnly || H.inProgress())
|
|
555
577
|
return !1;
|
|
556
|
-
const
|
|
557
|
-
return !(!
|
|
578
|
+
const l = v();
|
|
579
|
+
return !(!l || !P(l) || !l.isDeletable() || !Y(l) || !l.isMovable() || !x(l) || l.workspace.isFlyout);
|
|
558
580
|
},
|
|
559
|
-
callback: function(s,
|
|
560
|
-
|
|
561
|
-
const
|
|
562
|
-
if (!
|
|
581
|
+
callback: function(s, l) {
|
|
582
|
+
l.preventDefault();
|
|
583
|
+
const a = v();
|
|
584
|
+
if (!a || !P(a) || !a.isDeletable() || !x(a))
|
|
563
585
|
return !1;
|
|
564
|
-
const
|
|
565
|
-
return
|
|
586
|
+
const u = a.toCopyData();
|
|
587
|
+
return u ? (localStorage.setItem("blocklyStash", JSON.stringify(u)), a instanceof ve ? a.checkAndDelete() : a.dispose(), !0) : !1;
|
|
566
588
|
},
|
|
567
|
-
keyCodes: [e,
|
|
589
|
+
keyCodes: [e, o, n]
|
|
568
590
|
};
|
|
569
|
-
|
|
591
|
+
p.registry.register(r);
|
|
570
592
|
}
|
|
571
593
|
blockPasteFromStorageShortcut() {
|
|
572
|
-
const e =
|
|
573
|
-
|
|
574
|
-
[
|
|
575
|
-
),
|
|
576
|
-
|
|
577
|
-
[
|
|
578
|
-
),
|
|
579
|
-
|
|
580
|
-
[
|
|
594
|
+
const e = p.registry.createSerializedKey(
|
|
595
|
+
c.KeyCodes.V,
|
|
596
|
+
[c.KeyCodes.CTRL]
|
|
597
|
+
), o = p.registry.createSerializedKey(
|
|
598
|
+
c.KeyCodes.V,
|
|
599
|
+
[c.KeyCodes.ALT]
|
|
600
|
+
), n = p.registry.createSerializedKey(
|
|
601
|
+
c.KeyCodes.V,
|
|
602
|
+
[c.KeyCodes.META]
|
|
581
603
|
), r = {
|
|
582
604
|
name: "paste",
|
|
583
605
|
preconditionFn: function(s) {
|
|
584
|
-
if (s.options.readOnly ||
|
|
606
|
+
if (s.options.readOnly || H.inProgress())
|
|
585
607
|
return !1;
|
|
586
|
-
const a = localStorage.getItem("blocklyStash");
|
|
587
|
-
if (!a)
|
|
588
|
-
return !1;
|
|
589
|
-
const l = JSON.parse(a);
|
|
590
|
-
return !(!l || !s.isCapacityAvailable(l.typeCounts));
|
|
591
|
-
},
|
|
592
|
-
callback: function(s, a) {
|
|
593
|
-
a.preventDefault();
|
|
594
608
|
const l = localStorage.getItem("blocklyStash");
|
|
595
609
|
if (!l)
|
|
596
610
|
return !1;
|
|
597
|
-
const
|
|
598
|
-
return
|
|
611
|
+
const a = JSON.parse(l);
|
|
612
|
+
return !(!a || !s.isCapacityAvailable(a.typeCounts));
|
|
613
|
+
},
|
|
614
|
+
callback: function(s, l) {
|
|
615
|
+
l.preventDefault();
|
|
616
|
+
const a = localStorage.getItem("blocklyStash");
|
|
617
|
+
if (!a)
|
|
618
|
+
return !1;
|
|
619
|
+
const u = JSON.parse(a);
|
|
620
|
+
return u ? (j.paste(u, s), !0) : !1;
|
|
599
621
|
},
|
|
600
|
-
keyCodes: [e,
|
|
622
|
+
keyCodes: [e, o, n]
|
|
601
623
|
};
|
|
602
|
-
|
|
624
|
+
p.registry.register(r);
|
|
603
625
|
}
|
|
604
626
|
}
|
|
605
|
-
class
|
|
627
|
+
class He {
|
|
606
628
|
init() {
|
|
607
|
-
const e =
|
|
608
|
-
e && (e.callback = function(
|
|
609
|
-
const
|
|
610
|
-
if (!
|
|
629
|
+
const e = C.registry.getItem("cleanWorkspace");
|
|
630
|
+
e && (e.callback = function(o) {
|
|
631
|
+
const n = o.workspace;
|
|
632
|
+
if (!n)
|
|
611
633
|
return;
|
|
612
|
-
|
|
613
|
-
const r =
|
|
634
|
+
n.setResizesEnabled(!1), h.setGroup(!0);
|
|
635
|
+
const r = n.getTopBlocks(!0);
|
|
614
636
|
let s = 0;
|
|
615
|
-
for (let
|
|
616
|
-
if (!
|
|
637
|
+
for (let l = 0, a; a = r[l]; l++) {
|
|
638
|
+
if (!a.isMovable())
|
|
617
639
|
continue;
|
|
618
|
-
const
|
|
619
|
-
|
|
640
|
+
const u = a.getRelativeToSurfaceXY();
|
|
641
|
+
a.moveBy(-u.x, s - u.y, ["cleanup"]), a.snapToGrid(), s = a.getRelativeToSurfaceXY().y + a.getHeightWidth().height + 100;
|
|
620
642
|
}
|
|
621
|
-
|
|
643
|
+
h.setGroup(!1), n.setResizesEnabled(!0);
|
|
622
644
|
});
|
|
623
645
|
}
|
|
624
646
|
}
|
|
625
|
-
function
|
|
647
|
+
function te(t) {
|
|
626
648
|
const e = t.getParent();
|
|
627
|
-
return e &&
|
|
649
|
+
return e && te(e) ? !0 : !e && !!(t.outputConnection || t.previousConnection);
|
|
628
650
|
}
|
|
629
|
-
class
|
|
651
|
+
class Ge {
|
|
630
652
|
init() {
|
|
631
|
-
const e =
|
|
632
|
-
e && (e.preconditionFn = function(
|
|
633
|
-
const
|
|
634
|
-
return
|
|
653
|
+
const e = C.registry.getItem("blockDisable");
|
|
654
|
+
e && (e.preconditionFn = function(o) {
|
|
655
|
+
const n = o.block;
|
|
656
|
+
return n && !n.isInFlyout && n.workspace.options.disable && n.isEditable() ? n.getInheritedDisabled() || te(n) ? "disabled" : "enabled" : "hidden";
|
|
635
657
|
});
|
|
636
658
|
}
|
|
637
659
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
660
|
+
const We = new Ye();
|
|
661
|
+
We.init({ contextMenu: !0, shortcut: !0 });
|
|
662
|
+
const ze = new He();
|
|
663
|
+
ze.init();
|
|
664
|
+
const Xe = new Ge();
|
|
665
|
+
Xe.init();
|
|
666
|
+
F.Classic.blockStyles = {
|
|
645
667
|
color_blocks: {
|
|
646
668
|
colourPrimary: "#a5745b",
|
|
647
669
|
colourSecondary: "#ede3de",
|
|
@@ -715,7 +737,7 @@ k.Classic.blockStyles = {
|
|
|
715
737
|
hat: ""
|
|
716
738
|
}
|
|
717
739
|
};
|
|
718
|
-
|
|
740
|
+
F.Classic.categoryStyles = {
|
|
719
741
|
calc_category: {
|
|
720
742
|
colour: "#757575"
|
|
721
743
|
},
|
|
@@ -765,9 +787,9 @@ k.Classic.categoryStyles = {
|
|
|
765
787
|
colour: "#a55b80"
|
|
766
788
|
}
|
|
767
789
|
};
|
|
768
|
-
const
|
|
790
|
+
const je = Q.defineTheme("light", {
|
|
769
791
|
name: "light",
|
|
770
|
-
base:
|
|
792
|
+
base: F.Classic,
|
|
771
793
|
componentStyles: {
|
|
772
794
|
workspaceBackgroundColour: "#ffffff",
|
|
773
795
|
toolboxBackgroundColour: "#eeeeee",
|
|
@@ -781,9 +803,9 @@ const de = x.defineTheme("light", {
|
|
|
781
803
|
scrollbarOpacity: 0.4,
|
|
782
804
|
cursorColour: ""
|
|
783
805
|
}
|
|
784
|
-
}),
|
|
806
|
+
}), Je = Q.defineTheme("dark", {
|
|
785
807
|
name: "dark",
|
|
786
|
-
base:
|
|
808
|
+
base: F.Classic,
|
|
787
809
|
componentStyles: {
|
|
788
810
|
workspaceBackgroundColour: "#1e1e1e",
|
|
789
811
|
toolboxBackgroundColour: "#272727",
|
|
@@ -798,18 +820,18 @@ const de = x.defineTheme("light", {
|
|
|
798
820
|
cursorColour: ""
|
|
799
821
|
}
|
|
800
822
|
});
|
|
801
|
-
function
|
|
802
|
-
const e =
|
|
823
|
+
function $e(t) {
|
|
824
|
+
const e = T();
|
|
803
825
|
switch (console.log(e), t) {
|
|
804
826
|
case "light":
|
|
805
|
-
e.setTheme(
|
|
827
|
+
e.setTheme(je);
|
|
806
828
|
break;
|
|
807
829
|
case "dark":
|
|
808
|
-
e.setTheme(
|
|
830
|
+
e.setTheme(Je);
|
|
809
831
|
break;
|
|
810
832
|
}
|
|
811
833
|
}
|
|
812
|
-
const
|
|
834
|
+
const Ze = {
|
|
813
835
|
kind: "category",
|
|
814
836
|
name: "%{BKY_CATEGORY_LOGIC}",
|
|
815
837
|
categorystyle: "logic_category",
|
|
@@ -827,7 +849,7 @@ const Oe = {
|
|
|
827
849
|
type: "if_v1"
|
|
828
850
|
}
|
|
829
851
|
]
|
|
830
|
-
},
|
|
852
|
+
}, qe = {
|
|
831
853
|
kind: "category",
|
|
832
854
|
name: "%{BKY_CATEGORY_LOOP}",
|
|
833
855
|
categorystyle: "loop_category",
|
|
@@ -849,21 +871,154 @@ const Oe = {
|
|
|
849
871
|
type: "for_each_v1"
|
|
850
872
|
}
|
|
851
873
|
]
|
|
852
|
-
},
|
|
874
|
+
}, Qe = {
|
|
853
875
|
kind: "categoryToolbox",
|
|
854
|
-
contents: [
|
|
855
|
-
},
|
|
856
|
-
__name: "
|
|
876
|
+
contents: [Ze, qe]
|
|
877
|
+
}, et = /* @__PURE__ */ M({
|
|
878
|
+
__name: "cleanup",
|
|
879
|
+
setup(t) {
|
|
880
|
+
const e = () => {
|
|
881
|
+
const o = T();
|
|
882
|
+
if (!o)
|
|
883
|
+
return;
|
|
884
|
+
const n = C.registry.getItem("cleanWorkspace");
|
|
885
|
+
n && n.callback({ workspace: o }, new PointerEvent("dummy"));
|
|
886
|
+
};
|
|
887
|
+
return (o, n) => {
|
|
888
|
+
const r = m("v-btn");
|
|
889
|
+
return d(), L(r, {
|
|
890
|
+
onClick: e,
|
|
891
|
+
class: "mr-3",
|
|
892
|
+
variant: "outlined",
|
|
893
|
+
density: "comfortable",
|
|
894
|
+
icon: R(Ae)
|
|
895
|
+
}, null, 8, ["icon"]);
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
}), tt = /* @__PURE__ */ M({
|
|
899
|
+
__name: "lock",
|
|
857
900
|
props: {
|
|
901
|
+
modelValue: { type: Boolean, required: !0 },
|
|
902
|
+
modelModifiers: {}
|
|
903
|
+
},
|
|
904
|
+
emits: ["update:modelValue"],
|
|
905
|
+
setup(t) {
|
|
906
|
+
const e = $(t, "modelValue");
|
|
907
|
+
return (o, n) => {
|
|
908
|
+
const r = m("v-btn");
|
|
909
|
+
return d(), L(r, {
|
|
910
|
+
onClick: n[0] || (n[0] = (s) => e.value = !e.value),
|
|
911
|
+
class: "mr-3",
|
|
912
|
+
variant: "outlined",
|
|
913
|
+
density: "comfortable",
|
|
914
|
+
icon: e.value ? R(Pe) : R(we)
|
|
915
|
+
}, null, 8, ["icon"]);
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
}), ot = {
|
|
919
|
+
key: 1,
|
|
920
|
+
class: "text-caption text-grey"
|
|
921
|
+
}, nt = /* @__PURE__ */ M({
|
|
922
|
+
__name: "navigator",
|
|
923
|
+
setup(t) {
|
|
924
|
+
const e = w(() => ({
|
|
925
|
+
maxHeight: "calc(100vh - 200px)"
|
|
926
|
+
})), o = K([]), n = () => {
|
|
927
|
+
var b;
|
|
928
|
+
const s = T();
|
|
929
|
+
if (!s) {
|
|
930
|
+
o.value = [];
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
const l = [], a = s.getTopBlocks(!0), u = ((b = v()) == null ? void 0 : b.id) ?? "";
|
|
934
|
+
a.forEach((O) => {
|
|
935
|
+
const _ = O;
|
|
936
|
+
if (_.type.startsWith("on_node_event_v"))
|
|
937
|
+
console.log("1");
|
|
938
|
+
else if (_.type.startsWith("procedure_def_v"))
|
|
939
|
+
console.log("2");
|
|
940
|
+
else {
|
|
941
|
+
const f = _.getRelativeToSurfaceXY();
|
|
942
|
+
l.push({
|
|
943
|
+
id: _.id,
|
|
944
|
+
name: g.fffff,
|
|
945
|
+
x: f.x,
|
|
946
|
+
y: f.y,
|
|
947
|
+
active: _.id === u
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
}), o.value = l;
|
|
951
|
+
}, r = (s) => {
|
|
952
|
+
const l = T();
|
|
953
|
+
if (!l)
|
|
954
|
+
return;
|
|
955
|
+
const a = l.getBlockById(s.id);
|
|
956
|
+
a && (ee(s.id), a.select());
|
|
957
|
+
};
|
|
958
|
+
return Z(() => {
|
|
959
|
+
W.on("codeUpdate", n);
|
|
960
|
+
}), ue(() => {
|
|
961
|
+
W.off("codeUpdate", n);
|
|
962
|
+
}), (s, l) => {
|
|
963
|
+
const a = m("v-btn"), u = m("v-list-item-title"), b = m("v-list-item"), O = m("v-list"), _ = m("v-menu");
|
|
964
|
+
return d(), L(_, {
|
|
965
|
+
"close-on-content-click": !1,
|
|
966
|
+
transition: "slide-y-transition",
|
|
967
|
+
"offset-y": ""
|
|
968
|
+
}, {
|
|
969
|
+
activator: E(({ props: f }) => [
|
|
970
|
+
S(a, _e(f, {
|
|
971
|
+
variant: "outlined",
|
|
972
|
+
density: "comfortable",
|
|
973
|
+
icon: R(Ke)
|
|
974
|
+
}), null, 16, ["icon"])
|
|
975
|
+
]),
|
|
976
|
+
default: E(() => [
|
|
977
|
+
G("div", {
|
|
978
|
+
class: "overflow-auto",
|
|
979
|
+
style: V(e.value)
|
|
980
|
+
}, [
|
|
981
|
+
o.value.length > 0 ? (d(), L(O, { key: 0 }, {
|
|
982
|
+
default: E(() => [
|
|
983
|
+
(d(!0), A(pe, null, fe(o.value, (f) => (d(), L(b, {
|
|
984
|
+
key: f.id,
|
|
985
|
+
onClick: r,
|
|
986
|
+
class: "d-flex justify-start",
|
|
987
|
+
active: f.active
|
|
988
|
+
}, {
|
|
989
|
+
default: E(() => [
|
|
990
|
+
S(u, null, {
|
|
991
|
+
default: E(() => [
|
|
992
|
+
de(ye(f.name), 1)
|
|
993
|
+
]),
|
|
994
|
+
_: 2
|
|
995
|
+
}, 1024)
|
|
996
|
+
]),
|
|
997
|
+
_: 2
|
|
998
|
+
}, 1032, ["active"]))), 128))
|
|
999
|
+
]),
|
|
1000
|
+
_: 1
|
|
1001
|
+
})) : (d(), A("span", ot, "xxxxxxxxxx"))
|
|
1002
|
+
], 4)
|
|
1003
|
+
]),
|
|
1004
|
+
_: 1
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
}), rt = { class: "position-relative w-100 h-100" }, st = /* @__PURE__ */ M({
|
|
1009
|
+
__name: "index",
|
|
1010
|
+
props: /* @__PURE__ */ X({
|
|
858
1011
|
type: {},
|
|
859
1012
|
version: {},
|
|
860
|
-
active: { type: Boolean }
|
|
861
|
-
|
|
862
|
-
|
|
1013
|
+
active: { type: Boolean },
|
|
1014
|
+
scale: {}
|
|
1015
|
+
}, {
|
|
1016
|
+
lock: { type: Boolean, required: !0 },
|
|
1017
|
+
lockModifiers: {}
|
|
1018
|
+
}),
|
|
1019
|
+
emits: /* @__PURE__ */ X(["ready", "change"], ["update:lock"]),
|
|
863
1020
|
setup(t, { emit: e }) {
|
|
864
|
-
const
|
|
865
|
-
let y;
|
|
866
|
-
const E = {
|
|
1021
|
+
const o = Be(), { locale: n, dark: r } = Te(o), { open: s } = xe("blocklyEditorFlyout"), l = t, a = $(t, "lock"), u = e, b = K(), O = {
|
|
867
1022
|
grid: {
|
|
868
1023
|
length: 2,
|
|
869
1024
|
snap: !0,
|
|
@@ -886,48 +1041,112 @@ const Oe = {
|
|
|
886
1041
|
wheel: !0
|
|
887
1042
|
}
|
|
888
1043
|
};
|
|
889
|
-
|
|
890
|
-
|
|
1044
|
+
let _;
|
|
1045
|
+
const f = K(!0), N = K(!1), oe = w(() => ({
|
|
1046
|
+
position: "absolute",
|
|
1047
|
+
background: r.value ? "#0000007f" : "#ffffff7f",
|
|
1048
|
+
top: "1px",
|
|
1049
|
+
left: "0px",
|
|
1050
|
+
width: "56px",
|
|
1051
|
+
height: "100%",
|
|
1052
|
+
pointerEvents: "none",
|
|
1053
|
+
zIndex: 999
|
|
1054
|
+
})), ne = w(() => ({
|
|
1055
|
+
position: "absolute",
|
|
1056
|
+
background: r.value ? "#0000007f" : "#ffffff7f",
|
|
1057
|
+
top: "0px",
|
|
1058
|
+
left: "0px",
|
|
1059
|
+
width: "100%",
|
|
1060
|
+
height: "100%",
|
|
1061
|
+
pointerEvents: "none"
|
|
1062
|
+
})), re = w(() => ({
|
|
1063
|
+
position: "absolute",
|
|
1064
|
+
top: "0px",
|
|
1065
|
+
right: "0px",
|
|
1066
|
+
zIndex: 20
|
|
1067
|
+
}));
|
|
1068
|
+
Z(async () => {
|
|
1069
|
+
if (!b.value)
|
|
891
1070
|
return;
|
|
892
|
-
await
|
|
893
|
-
let
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}, 1);
|
|
897
|
-
}), M(() => {
|
|
1071
|
+
await J(n.value);
|
|
1072
|
+
let i;
|
|
1073
|
+
l.type === "app" && l.version === "v1" && (i = Qe), O.toolbox = i, _ = Se(b.value, O), _.addChangeListener(h.disableOrphans), _.addChangeListener(se), u("ready", _);
|
|
1074
|
+
}), ge(() => {
|
|
898
1075
|
s.value = !1;
|
|
899
1076
|
});
|
|
900
|
-
function
|
|
901
|
-
|
|
1077
|
+
function z() {
|
|
1078
|
+
_ && Le(_);
|
|
902
1079
|
}
|
|
903
|
-
function
|
|
904
|
-
|
|
1080
|
+
function se(i) {
|
|
1081
|
+
if (i.type === h.FINISHED_LOADING) {
|
|
1082
|
+
Ue(), W.emit("codeUpdate"), f.value = !1;
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
f.value || (i.type === h.BLOCK_DRAG && (i.isStart ? N.value = !0 : N.value = !1), u("change", i));
|
|
905
1086
|
}
|
|
906
|
-
return
|
|
907
|
-
|
|
908
|
-
}),
|
|
909
|
-
|
|
910
|
-
}),
|
|
911
|
-
var
|
|
912
|
-
|
|
913
|
-
}),
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1087
|
+
return B(n, (i) => {
|
|
1088
|
+
J(i);
|
|
1089
|
+
}), B(r, (i) => {
|
|
1090
|
+
$e(i ? "dark" : "light");
|
|
1091
|
+
}), B(s, (i) => {
|
|
1092
|
+
var k;
|
|
1093
|
+
i || (k = _.getToolbox()) == null || k.clearSelection();
|
|
1094
|
+
}), B(
|
|
1095
|
+
() => l.active,
|
|
1096
|
+
(i) => {
|
|
1097
|
+
i && setTimeout(() => z(), 1);
|
|
1098
|
+
}
|
|
1099
|
+
), B(
|
|
1100
|
+
() => l.scale,
|
|
1101
|
+
(i) => {
|
|
1102
|
+
_.setScale(i);
|
|
1103
|
+
}
|
|
1104
|
+
), (i, k) => {
|
|
1105
|
+
const le = m("v-icon"), ae = m("x-loading"), ie = me("resize");
|
|
1106
|
+
return d(), A("div", rt, [
|
|
1107
|
+
he(G("div", {
|
|
919
1108
|
class: "w-100 h-100",
|
|
920
1109
|
ref_key: "blocklyDiv",
|
|
921
|
-
ref:
|
|
1110
|
+
ref: b,
|
|
1111
|
+
id: "blocklyEditor"
|
|
922
1112
|
}, null, 512), [
|
|
923
|
-
[
|
|
924
|
-
])
|
|
1113
|
+
[ie, z]
|
|
1114
|
+
]),
|
|
1115
|
+
N.value ? (d(), A("div", {
|
|
1116
|
+
key: 0,
|
|
1117
|
+
class: "d-flex flex-column align-center justify-center",
|
|
1118
|
+
style: V(oe.value)
|
|
1119
|
+
}, [
|
|
1120
|
+
S(le, {
|
|
1121
|
+
icon: R(Re),
|
|
1122
|
+
size: "x-large"
|
|
1123
|
+
}, null, 8, ["icon"])
|
|
1124
|
+
], 4)) : D("", !0),
|
|
1125
|
+
a.value ? (d(), A("div", {
|
|
1126
|
+
key: 1,
|
|
1127
|
+
style: V(ne.value)
|
|
1128
|
+
}, null, 4)) : D("", !0),
|
|
1129
|
+
G("div", {
|
|
1130
|
+
class: "d-flex align-end pt-3 pr-3",
|
|
1131
|
+
style: V(re.value)
|
|
1132
|
+
}, [
|
|
1133
|
+
S(et),
|
|
1134
|
+
S(tt, {
|
|
1135
|
+
modelValue: a.value,
|
|
1136
|
+
"onUpdate:modelValue": k[0] || (k[0] = (ce) => a.value = ce)
|
|
1137
|
+
}, null, 8, ["modelValue"]),
|
|
1138
|
+
S(nt)
|
|
1139
|
+
], 4),
|
|
1140
|
+
f.value ? (d(), L(ae, {
|
|
1141
|
+
key: 2,
|
|
1142
|
+
zIndex: 99
|
|
1143
|
+
})) : D("", !0)
|
|
925
1144
|
]);
|
|
926
1145
|
};
|
|
927
1146
|
}
|
|
928
|
-
}),
|
|
929
|
-
t.component("x-blockly",
|
|
930
|
-
},
|
|
1147
|
+
}), lt = (t) => {
|
|
1148
|
+
t.component("x-blockly", st);
|
|
1149
|
+
}, _t = { install: lt };
|
|
931
1150
|
export {
|
|
932
|
-
|
|
1151
|
+
_t as default
|
|
933
1152
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-block-lib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.23",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -49,5 +49,8 @@
|
|
|
49
49
|
"vue-i18n": "^9.13.1",
|
|
50
50
|
"vue-router": "4.4.0",
|
|
51
51
|
"vue-tsc": "^2.0.26"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@mdi/js": "^7.4.47"
|
|
52
55
|
}
|
|
53
56
|
}
|