x-block-lib 0.3.22 → 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.
|
@@ -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,
|
package/dist/core/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
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
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
var
|
|
7
|
-
|
|
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([
|
|
8
8
|
{
|
|
9
9
|
type: "boolean_v1",
|
|
10
10
|
message0: "%1",
|
|
@@ -24,16 +24,16 @@ C([
|
|
|
24
24
|
helpUrl: "%{BKY_LOGIC_V1_BOOLEAN_HELPURL}"
|
|
25
25
|
}
|
|
26
26
|
]);
|
|
27
|
-
|
|
28
|
-
return [t.getFieldValue("BOOL") === "TRUE" ? "true" : "false",
|
|
27
|
+
be.forBlock.boolean_v1 = function(t) {
|
|
28
|
+
return [t.getFieldValue("BOOL") === "TRUE" ? "true" : "false", ke.ATOMIC];
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const Ve = {
|
|
31
31
|
elseIfCount_: 0,
|
|
32
32
|
hasElse_: !1,
|
|
33
33
|
mutationToDom: function() {
|
|
34
34
|
if (this.elseIfCount_ <= 0 && !this.hasElse_)
|
|
35
35
|
return null;
|
|
36
|
-
const t =
|
|
36
|
+
const t = c.xml.createElement("mutation");
|
|
37
37
|
return this.elseIfCount_ > 0 && t.setAttribute("elseIf", String(this.elseIfCount_)), this.hasElse_ && t.setAttribute("else", "TRUE"), t;
|
|
38
38
|
},
|
|
39
39
|
domToMutation: function(t) {
|
|
@@ -51,23 +51,23 @@ const Ie = {
|
|
|
51
51
|
decompose: function(t) {
|
|
52
52
|
const e = t.newBlock("if_if_v1");
|
|
53
53
|
e.initSvg();
|
|
54
|
-
let
|
|
55
|
-
for (let
|
|
54
|
+
let o = e.nextConnection;
|
|
55
|
+
for (let n = 0; n < this.elseIfCount_; n++) {
|
|
56
56
|
const r = t.newBlock(
|
|
57
57
|
"if_else_if_v1"
|
|
58
58
|
);
|
|
59
|
-
r.initSvg(),
|
|
59
|
+
r.initSvg(), o.connect(r.previousConnection), o = r.nextConnection;
|
|
60
60
|
}
|
|
61
61
|
if (this.hasElse_) {
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const n = t.newBlock("if_else_v1");
|
|
63
|
+
n.initSvg(), o.connect(n.previousConnection);
|
|
64
64
|
}
|
|
65
65
|
return e;
|
|
66
66
|
},
|
|
67
67
|
compose: function(t) {
|
|
68
68
|
let e = t.nextConnection.targetBlock();
|
|
69
69
|
this.elseIfCount_ = 0, this.hasElse_ = !1;
|
|
70
|
-
const
|
|
70
|
+
const o = [null], n = [null];
|
|
71
71
|
let r = null;
|
|
72
72
|
for (; e; ) {
|
|
73
73
|
if (e.isInsertionMarker()) {
|
|
@@ -76,9 +76,9 @@ const Ie = {
|
|
|
76
76
|
}
|
|
77
77
|
switch (e.type) {
|
|
78
78
|
case "if_else_if_v1":
|
|
79
|
-
this.elseIfCount_++,
|
|
79
|
+
this.elseIfCount_++, o.push(
|
|
80
80
|
e.valueConnection_
|
|
81
|
-
),
|
|
81
|
+
), n.push(
|
|
82
82
|
e.statementConnection_
|
|
83
83
|
);
|
|
84
84
|
break;
|
|
@@ -91,13 +91,13 @@ const Ie = {
|
|
|
91
91
|
e = e.getNextBlock();
|
|
92
92
|
}
|
|
93
93
|
this.updateShape_(), this.reconnectChildBlocks_(
|
|
94
|
-
n,
|
|
95
94
|
o,
|
|
95
|
+
n,
|
|
96
96
|
r
|
|
97
97
|
);
|
|
98
98
|
},
|
|
99
99
|
saveConnections: function(t) {
|
|
100
|
-
let e = t.nextConnection.targetBlock(),
|
|
100
|
+
let e = t.nextConnection.targetBlock(), o = 1;
|
|
101
101
|
for (; e; ) {
|
|
102
102
|
if (e.isInsertionMarker()) {
|
|
103
103
|
e = e.getNextBlock();
|
|
@@ -105,13 +105,13 @@ const Ie = {
|
|
|
105
105
|
}
|
|
106
106
|
switch (e.type) {
|
|
107
107
|
case "if_else_if_v1": {
|
|
108
|
-
const
|
|
109
|
-
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++;
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
case "if_else_v1": {
|
|
113
|
-
const
|
|
114
|
-
e.statementConnection_ =
|
|
113
|
+
const n = this.getInput("ELSE");
|
|
114
|
+
e.statementConnection_ = n && n.connection.targetConnection;
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
default:
|
|
@@ -122,16 +122,16 @@ const Ie = {
|
|
|
122
122
|
},
|
|
123
123
|
rebuildShape_: function() {
|
|
124
124
|
const t = [null], e = [null];
|
|
125
|
-
let
|
|
126
|
-
this.getInput("ELSE") && (
|
|
127
|
-
for (let
|
|
128
|
-
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);
|
|
129
129
|
t.push(r.connection.targetConnection), e.push(s.connection.targetConnection);
|
|
130
130
|
}
|
|
131
131
|
this.updateShape_(), this.reconnectChildBlocks_(
|
|
132
132
|
t,
|
|
133
133
|
e,
|
|
134
|
-
|
|
134
|
+
o
|
|
135
135
|
);
|
|
136
136
|
},
|
|
137
137
|
updateShape_: function() {
|
|
@@ -139,23 +139,23 @@ const Ie = {
|
|
|
139
139
|
for (let t = 1; this.getInput("IF" + t); t++)
|
|
140
140
|
this.removeInput("IF" + t), this.removeInput("DO" + t);
|
|
141
141
|
for (let t = 1; t <= this.elseIfCount_; t++)
|
|
142
|
-
this.appendValueInput("IF" + t).setCheck("Boolean").appendField(
|
|
143
|
-
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);
|
|
144
144
|
},
|
|
145
|
-
reconnectChildBlocks_: function(t, e,
|
|
146
|
-
var
|
|
145
|
+
reconnectChildBlocks_: function(t, e, o) {
|
|
146
|
+
var n, r;
|
|
147
147
|
for (let s = 1; s <= this.elseIfCount_; s++)
|
|
148
|
-
(
|
|
149
|
-
|
|
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");
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
|
|
152
|
+
y.registerMutator(
|
|
153
153
|
"if_v1_mutator",
|
|
154
|
-
|
|
154
|
+
Ve,
|
|
155
155
|
void 0,
|
|
156
156
|
["if_else_if_v1", "if_else_v1"]
|
|
157
157
|
);
|
|
158
|
-
|
|
158
|
+
I([
|
|
159
159
|
{
|
|
160
160
|
type: "if_v1",
|
|
161
161
|
message0: "%{BKY_LOGIC_IF} %1",
|
|
@@ -203,12 +203,12 @@ C([
|
|
|
203
203
|
style: "logic_blocks"
|
|
204
204
|
}
|
|
205
205
|
]);
|
|
206
|
-
const
|
|
206
|
+
const Me = {
|
|
207
207
|
customContextMenu: function(t) {
|
|
208
208
|
if (this.isInFlyout)
|
|
209
209
|
return;
|
|
210
|
-
const e = this.getField("VAR"),
|
|
211
|
-
if (!this.isCollapsed() &&
|
|
210
|
+
const e = this.getField("VAR"), o = e.getVariable(), n = o == null ? void 0 : o.name;
|
|
211
|
+
if (!this.isCollapsed() && n) {
|
|
212
212
|
const r = {
|
|
213
213
|
type: "variables_get",
|
|
214
214
|
fields: {
|
|
@@ -217,33 +217,33 @@ const Ee = {
|
|
|
217
217
|
};
|
|
218
218
|
t.push({
|
|
219
219
|
enabled: !0,
|
|
220
|
-
text:
|
|
221
|
-
callback:
|
|
220
|
+
text: g.VARIABLES_SET_CREATE_GET.replace("%1", n),
|
|
221
|
+
callback: Ce.callbackFactory(this, r)
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
y.registerMixin(
|
|
227
227
|
"contextMenu_newGetVariableBlock_v1",
|
|
228
|
-
|
|
228
|
+
Me
|
|
229
229
|
);
|
|
230
|
-
|
|
230
|
+
y.register(
|
|
231
231
|
"flow_control_tooltip_v1",
|
|
232
|
-
|
|
232
|
+
y.buildTooltipForDropdown("MODE", {
|
|
233
233
|
BREAK: "%{BKY_LOOP_V1_FLOW_CONTROL_TOOLTIP_BREAK}",
|
|
234
234
|
CONTINUE: "%{BKY_LOOP_V1_FLOW_CONTROL_TOOLTIP_CONTINUE}"
|
|
235
235
|
})
|
|
236
236
|
);
|
|
237
|
-
const
|
|
237
|
+
const Fe = /* @__PURE__ */ new Set([
|
|
238
238
|
"repeat_v1",
|
|
239
239
|
"for_each_v1",
|
|
240
240
|
"for_v1",
|
|
241
241
|
"while_until_v1"
|
|
242
|
-
]),
|
|
242
|
+
]), Ne = {
|
|
243
243
|
getSurroundLoop: function() {
|
|
244
244
|
let t = this;
|
|
245
245
|
do {
|
|
246
|
-
if (
|
|
246
|
+
if (Fe.has(t.type))
|
|
247
247
|
return !0;
|
|
248
248
|
t = t == null ? void 0 : t.getSurroundParent();
|
|
249
249
|
} while (t);
|
|
@@ -251,24 +251,24 @@ const Be = /* @__PURE__ */ new Set([
|
|
|
251
251
|
},
|
|
252
252
|
onchange: function(t) {
|
|
253
253
|
const e = this.workspace;
|
|
254
|
-
if (!e.isDragging || e.isDragging() || t.type !==
|
|
254
|
+
if (!e.isDragging || e.isDragging() || t.type !== h.BLOCK_MOVE && t.type !== h.BLOCK_CREATE)
|
|
255
255
|
return;
|
|
256
|
-
const
|
|
257
|
-
if (console.log(t.type,
|
|
258
|
-
|
|
256
|
+
const o = this.getSurroundLoop();
|
|
257
|
+
if (console.log(t.type, o), this.setWarningText(
|
|
258
|
+
o ? null : g.LOOP_FLOW_CONTROL_WARNING
|
|
259
259
|
), !this.isInFlyout)
|
|
260
260
|
try {
|
|
261
|
-
|
|
261
|
+
h.setRecordUndo(!1), this.setDisabledReason(!o, "FLOW_CONTROL_NOT_IN_LOOP");
|
|
262
262
|
} finally {
|
|
263
|
-
|
|
263
|
+
h.setRecordUndo(!0);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
|
|
267
|
+
y.registerMixin(
|
|
268
268
|
"flow_control_in_loop_check_v1",
|
|
269
|
-
|
|
269
|
+
Ne
|
|
270
270
|
);
|
|
271
|
-
|
|
271
|
+
I([
|
|
272
272
|
{
|
|
273
273
|
type: "flow_control_v1",
|
|
274
274
|
message0: "%1",
|
|
@@ -289,14 +289,14 @@ C([
|
|
|
289
289
|
extensions: ["flow_control_tooltip_v1", "flow_control_in_loop_check_v1"]
|
|
290
290
|
}
|
|
291
291
|
]);
|
|
292
|
-
|
|
292
|
+
y.register(
|
|
293
293
|
"for_tooltip_v1",
|
|
294
|
-
|
|
294
|
+
y.buildTooltipWithFieldText(
|
|
295
295
|
"%{BKY_LOOP_V1_FOR_TOOLTIP}",
|
|
296
296
|
"VAR"
|
|
297
297
|
)
|
|
298
298
|
);
|
|
299
|
-
|
|
299
|
+
I([
|
|
300
300
|
{
|
|
301
301
|
type: "for_v1",
|
|
302
302
|
message0: "%{BKY_LOOP_V1_FOR_TITLE}",
|
|
@@ -340,14 +340,14 @@ C([
|
|
|
340
340
|
extensions: ["contextMenu_newGetVariableBlock_v1", "for_tooltip_v1"]
|
|
341
341
|
}
|
|
342
342
|
]);
|
|
343
|
-
|
|
343
|
+
y.register(
|
|
344
344
|
"for_each_tooltip_v1",
|
|
345
|
-
|
|
345
|
+
y.buildTooltipWithFieldText(
|
|
346
346
|
"%{BKY_LOOP_V1_FOR_EACH_TOOLTIP}",
|
|
347
347
|
"VAR"
|
|
348
348
|
)
|
|
349
349
|
);
|
|
350
|
-
|
|
350
|
+
I([
|
|
351
351
|
{
|
|
352
352
|
type: "for_each_v1",
|
|
353
353
|
message0: "%{BKY_LOOP_V1_FOR_EACH_TITLE}",
|
|
@@ -377,14 +377,14 @@ C([
|
|
|
377
377
|
extensions: ["contextMenu_newGetVariableBlock_v1", "for_each_tooltip_v1"]
|
|
378
378
|
}
|
|
379
379
|
]);
|
|
380
|
-
|
|
380
|
+
y.register(
|
|
381
381
|
"while_until_tooltip_v1",
|
|
382
|
-
|
|
382
|
+
y.buildTooltipForDropdown("MODE", {
|
|
383
383
|
WHILE: "%{BKY_LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE}",
|
|
384
384
|
UNTIL: "%{BKY_LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL}"
|
|
385
385
|
})
|
|
386
386
|
);
|
|
387
|
-
|
|
387
|
+
I([
|
|
388
388
|
{
|
|
389
389
|
type: "while_until_v1",
|
|
390
390
|
message0: "%1 %2",
|
|
@@ -417,172 +417,193 @@ C([
|
|
|
417
417
|
extensions: ["while_until_tooltip_v1"]
|
|
418
418
|
}
|
|
419
419
|
]);
|
|
420
|
-
|
|
421
|
-
const
|
|
420
|
+
q.setConfirm(async (t, e) => {
|
|
421
|
+
const o = await Ie({
|
|
422
422
|
title: "",
|
|
423
423
|
text: t
|
|
424
424
|
});
|
|
425
|
-
e(!!
|
|
425
|
+
e(!!o);
|
|
426
426
|
});
|
|
427
|
-
|
|
428
|
-
const
|
|
427
|
+
q.setPrompt(async (t, e, o) => {
|
|
428
|
+
const n = await Ee({
|
|
429
429
|
title: "",
|
|
430
430
|
value: e
|
|
431
431
|
});
|
|
432
|
-
n
|
|
432
|
+
o(n);
|
|
433
433
|
});
|
|
434
|
-
const
|
|
435
|
-
const
|
|
436
|
-
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) => {
|
|
437
437
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
438
438
|
s.bind(
|
|
439
439
|
null,
|
|
440
440
|
new Error(
|
|
441
|
-
"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." : "")
|
|
442
442
|
)
|
|
443
443
|
)
|
|
444
444
|
);
|
|
445
445
|
});
|
|
446
446
|
};
|
|
447
|
-
async function
|
|
448
|
-
const e = await
|
|
449
|
-
|
|
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);
|
|
450
463
|
}
|
|
451
|
-
|
|
452
|
-
|
|
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 } = {
|
|
453
474
|
contextMenu: !0,
|
|
454
475
|
shortcut: !0
|
|
455
476
|
}) {
|
|
456
|
-
e && (this.blockCopyToStorageContextMenu(), this.blockPasteFromStorageContextMenu()),
|
|
457
|
-
|
|
458
|
-
),
|
|
459
|
-
|
|
460
|
-
),
|
|
461
|
-
|
|
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
|
|
462
483
|
), this.blockCopyToStorageShortcut(), this.blockCutToStorageShortcut(), this.blockPasteFromStorageShortcut());
|
|
463
484
|
}
|
|
464
485
|
blockCopyToStorageContextMenu() {
|
|
465
486
|
const e = {
|
|
466
487
|
displayText: function() {
|
|
467
|
-
return
|
|
488
|
+
return g.CROSS_TAB_COPY ? g.CROSS_TAB_COPY : "Copy";
|
|
468
489
|
},
|
|
469
490
|
preconditionFn: function() {
|
|
470
|
-
const
|
|
471
|
-
return !
|
|
491
|
+
const o = v();
|
|
492
|
+
return !o || !P(o) || !o.isDeletable() || !Y(o) || !o.isMovable() || !x(o) ? "disabled" : "enabled";
|
|
472
493
|
},
|
|
473
|
-
callback: function(
|
|
474
|
-
var
|
|
494
|
+
callback: function(o) {
|
|
495
|
+
var n;
|
|
475
496
|
localStorage.setItem(
|
|
476
497
|
"blocklyStash",
|
|
477
|
-
JSON.stringify((
|
|
498
|
+
JSON.stringify((n = o.block) == null ? void 0 : n.toCopyData())
|
|
478
499
|
);
|
|
479
500
|
},
|
|
480
|
-
scopeType:
|
|
501
|
+
scopeType: C.ScopeType.BLOCK,
|
|
481
502
|
id: "blockCopyToStorage",
|
|
482
503
|
weight: 0
|
|
483
504
|
};
|
|
484
|
-
|
|
505
|
+
C.registry.register(e);
|
|
485
506
|
}
|
|
486
507
|
blockPasteFromStorageContextMenu() {
|
|
487
508
|
const e = {
|
|
488
509
|
displayText: function() {
|
|
489
|
-
return
|
|
510
|
+
return g.CROSS_TAB_PASTE ? g.CROSS_TAB_PASTE : "Paste";
|
|
490
511
|
},
|
|
491
|
-
preconditionFn: function(
|
|
512
|
+
preconditionFn: function(o) {
|
|
492
513
|
var s;
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
514
|
+
const n = localStorage.getItem("blocklyStash");
|
|
515
|
+
if (!n)
|
|
495
516
|
return "disabled";
|
|
496
|
-
const r = JSON.parse(
|
|
497
|
-
return !r || !((s =
|
|
517
|
+
const r = JSON.parse(n);
|
|
518
|
+
return !r || !((s = o.workspace) != null && s.isCapacityAvailable(r.typeCounts)) ? "disabled" : "enabled";
|
|
498
519
|
},
|
|
499
|
-
callback: function(
|
|
500
|
-
const
|
|
501
|
-
if (!
|
|
520
|
+
callback: function(o) {
|
|
521
|
+
const n = localStorage.getItem("blocklyStash");
|
|
522
|
+
if (!n)
|
|
502
523
|
return;
|
|
503
|
-
const r = JSON.parse(
|
|
504
|
-
r &&
|
|
524
|
+
const r = JSON.parse(n);
|
|
525
|
+
r && o.workspace && j.paste(r, o.workspace);
|
|
505
526
|
},
|
|
506
|
-
scopeType:
|
|
527
|
+
scopeType: C.ScopeType.WORKSPACE,
|
|
507
528
|
id: "blockPasteFromStorage",
|
|
508
529
|
weight: 0
|
|
509
530
|
};
|
|
510
|
-
|
|
531
|
+
C.registry.register(e);
|
|
511
532
|
}
|
|
512
533
|
blockCopyToStorageShortcut() {
|
|
513
|
-
const e =
|
|
514
|
-
|
|
515
|
-
[
|
|
516
|
-
),
|
|
517
|
-
|
|
518
|
-
[
|
|
519
|
-
),
|
|
520
|
-
|
|
521
|
-
[
|
|
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]
|
|
522
543
|
), r = {
|
|
523
544
|
name: "copy",
|
|
524
545
|
preconditionFn: function(s) {
|
|
525
|
-
if (s.options.readOnly ||
|
|
546
|
+
if (s.options.readOnly || H.inProgress())
|
|
526
547
|
return !1;
|
|
527
|
-
const l =
|
|
528
|
-
return !(!l || !
|
|
548
|
+
const l = v();
|
|
549
|
+
return !(!l || !P(l) || !l.isDeletable() || !Y(l) || !l.isMovable() || !x(l));
|
|
529
550
|
},
|
|
530
551
|
callback: function(s, l) {
|
|
531
552
|
l.preventDefault();
|
|
532
|
-
const a =
|
|
533
|
-
if (!a || !
|
|
553
|
+
const a = v();
|
|
554
|
+
if (!a || !x(a))
|
|
534
555
|
return !1;
|
|
535
|
-
const
|
|
536
|
-
return
|
|
556
|
+
const u = a.toCopyData();
|
|
557
|
+
return u ? (s.hideChaff(), localStorage.setItem("blocklyStash", JSON.stringify(u)), !0) : !1;
|
|
537
558
|
},
|
|
538
|
-
keyCodes: [e,
|
|
559
|
+
keyCodes: [e, o, n]
|
|
539
560
|
};
|
|
540
|
-
|
|
561
|
+
p.registry.register(r);
|
|
541
562
|
}
|
|
542
563
|
blockCutToStorageShortcut() {
|
|
543
|
-
const e =
|
|
544
|
-
|
|
545
|
-
[
|
|
546
|
-
),
|
|
547
|
-
|
|
548
|
-
[
|
|
549
|
-
),
|
|
550
|
-
|
|
551
|
-
[
|
|
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]
|
|
552
573
|
), r = {
|
|
553
574
|
name: "cut",
|
|
554
575
|
preconditionFn: function(s) {
|
|
555
|
-
if (s.options.readOnly ||
|
|
576
|
+
if (s.options.readOnly || H.inProgress())
|
|
556
577
|
return !1;
|
|
557
|
-
const l =
|
|
558
|
-
return !(!l || !
|
|
578
|
+
const l = v();
|
|
579
|
+
return !(!l || !P(l) || !l.isDeletable() || !Y(l) || !l.isMovable() || !x(l) || l.workspace.isFlyout);
|
|
559
580
|
},
|
|
560
581
|
callback: function(s, l) {
|
|
561
582
|
l.preventDefault();
|
|
562
|
-
const a =
|
|
563
|
-
if (!a || !
|
|
583
|
+
const a = v();
|
|
584
|
+
if (!a || !P(a) || !a.isDeletable() || !x(a))
|
|
564
585
|
return !1;
|
|
565
|
-
const
|
|
566
|
-
return
|
|
586
|
+
const u = a.toCopyData();
|
|
587
|
+
return u ? (localStorage.setItem("blocklyStash", JSON.stringify(u)), a instanceof ve ? a.checkAndDelete() : a.dispose(), !0) : !1;
|
|
567
588
|
},
|
|
568
|
-
keyCodes: [e,
|
|
589
|
+
keyCodes: [e, o, n]
|
|
569
590
|
};
|
|
570
|
-
|
|
591
|
+
p.registry.register(r);
|
|
571
592
|
}
|
|
572
593
|
blockPasteFromStorageShortcut() {
|
|
573
|
-
const e =
|
|
574
|
-
|
|
575
|
-
[
|
|
576
|
-
),
|
|
577
|
-
|
|
578
|
-
[
|
|
579
|
-
),
|
|
580
|
-
|
|
581
|
-
[
|
|
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]
|
|
582
603
|
), r = {
|
|
583
604
|
name: "paste",
|
|
584
605
|
preconditionFn: function(s) {
|
|
585
|
-
if (s.options.readOnly ||
|
|
606
|
+
if (s.options.readOnly || H.inProgress())
|
|
586
607
|
return !1;
|
|
587
608
|
const l = localStorage.getItem("blocklyStash");
|
|
588
609
|
if (!l)
|
|
@@ -595,54 +616,54 @@ class Pe {
|
|
|
595
616
|
const a = localStorage.getItem("blocklyStash");
|
|
596
617
|
if (!a)
|
|
597
618
|
return !1;
|
|
598
|
-
const
|
|
599
|
-
return
|
|
619
|
+
const u = JSON.parse(a);
|
|
620
|
+
return u ? (j.paste(u, s), !0) : !1;
|
|
600
621
|
},
|
|
601
|
-
keyCodes: [e,
|
|
622
|
+
keyCodes: [e, o, n]
|
|
602
623
|
};
|
|
603
|
-
|
|
624
|
+
p.registry.register(r);
|
|
604
625
|
}
|
|
605
626
|
}
|
|
606
|
-
class
|
|
627
|
+
class He {
|
|
607
628
|
init() {
|
|
608
|
-
const e =
|
|
609
|
-
e && (e.callback = function(
|
|
610
|
-
const
|
|
611
|
-
if (!
|
|
629
|
+
const e = C.registry.getItem("cleanWorkspace");
|
|
630
|
+
e && (e.callback = function(o) {
|
|
631
|
+
const n = o.workspace;
|
|
632
|
+
if (!n)
|
|
612
633
|
return;
|
|
613
|
-
|
|
614
|
-
const r =
|
|
634
|
+
n.setResizesEnabled(!1), h.setGroup(!0);
|
|
635
|
+
const r = n.getTopBlocks(!0);
|
|
615
636
|
let s = 0;
|
|
616
637
|
for (let l = 0, a; a = r[l]; l++) {
|
|
617
638
|
if (!a.isMovable())
|
|
618
639
|
continue;
|
|
619
|
-
const
|
|
620
|
-
a.moveBy(-
|
|
640
|
+
const u = a.getRelativeToSurfaceXY();
|
|
641
|
+
a.moveBy(-u.x, s - u.y, ["cleanup"]), a.snapToGrid(), s = a.getRelativeToSurfaceXY().y + a.getHeightWidth().height + 100;
|
|
621
642
|
}
|
|
622
|
-
|
|
643
|
+
h.setGroup(!1), n.setResizesEnabled(!0);
|
|
623
644
|
});
|
|
624
645
|
}
|
|
625
646
|
}
|
|
626
|
-
function
|
|
647
|
+
function te(t) {
|
|
627
648
|
const e = t.getParent();
|
|
628
|
-
return e &&
|
|
649
|
+
return e && te(e) ? !0 : !e && !!(t.outputConnection || t.previousConnection);
|
|
629
650
|
}
|
|
630
|
-
class
|
|
651
|
+
class Ge {
|
|
631
652
|
init() {
|
|
632
|
-
const e =
|
|
633
|
-
e && (e.preconditionFn = function(
|
|
634
|
-
const
|
|
635
|
-
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";
|
|
636
657
|
});
|
|
637
658
|
}
|
|
638
659
|
}
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
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 = {
|
|
646
667
|
color_blocks: {
|
|
647
668
|
colourPrimary: "#a5745b",
|
|
648
669
|
colourSecondary: "#ede3de",
|
|
@@ -716,7 +737,7 @@ x.Classic.blockStyles = {
|
|
|
716
737
|
hat: ""
|
|
717
738
|
}
|
|
718
739
|
};
|
|
719
|
-
|
|
740
|
+
F.Classic.categoryStyles = {
|
|
720
741
|
calc_category: {
|
|
721
742
|
colour: "#757575"
|
|
722
743
|
},
|
|
@@ -766,9 +787,9 @@ x.Classic.categoryStyles = {
|
|
|
766
787
|
colour: "#a55b80"
|
|
767
788
|
}
|
|
768
789
|
};
|
|
769
|
-
const
|
|
790
|
+
const je = Q.defineTheme("light", {
|
|
770
791
|
name: "light",
|
|
771
|
-
base:
|
|
792
|
+
base: F.Classic,
|
|
772
793
|
componentStyles: {
|
|
773
794
|
workspaceBackgroundColour: "#ffffff",
|
|
774
795
|
toolboxBackgroundColour: "#eeeeee",
|
|
@@ -782,9 +803,9 @@ const Fe = J.defineTheme("light", {
|
|
|
782
803
|
scrollbarOpacity: 0.4,
|
|
783
804
|
cursorColour: ""
|
|
784
805
|
}
|
|
785
|
-
}),
|
|
806
|
+
}), Je = Q.defineTheme("dark", {
|
|
786
807
|
name: "dark",
|
|
787
|
-
base:
|
|
808
|
+
base: F.Classic,
|
|
788
809
|
componentStyles: {
|
|
789
810
|
workspaceBackgroundColour: "#1e1e1e",
|
|
790
811
|
toolboxBackgroundColour: "#272727",
|
|
@@ -799,18 +820,18 @@ const Fe = J.defineTheme("light", {
|
|
|
799
820
|
cursorColour: ""
|
|
800
821
|
}
|
|
801
822
|
});
|
|
802
|
-
function
|
|
803
|
-
const e =
|
|
823
|
+
function $e(t) {
|
|
824
|
+
const e = T();
|
|
804
825
|
switch (console.log(e), t) {
|
|
805
826
|
case "light":
|
|
806
|
-
e.setTheme(
|
|
827
|
+
e.setTheme(je);
|
|
807
828
|
break;
|
|
808
829
|
case "dark":
|
|
809
|
-
e.setTheme(
|
|
830
|
+
e.setTheme(Je);
|
|
810
831
|
break;
|
|
811
832
|
}
|
|
812
833
|
}
|
|
813
|
-
const
|
|
834
|
+
const Ze = {
|
|
814
835
|
kind: "category",
|
|
815
836
|
name: "%{BKY_CATEGORY_LOGIC}",
|
|
816
837
|
categorystyle: "logic_category",
|
|
@@ -828,7 +849,7 @@ const Ue = {
|
|
|
828
849
|
type: "if_v1"
|
|
829
850
|
}
|
|
830
851
|
]
|
|
831
|
-
},
|
|
852
|
+
}, qe = {
|
|
832
853
|
kind: "category",
|
|
833
854
|
name: "%{BKY_CATEGORY_LOOP}",
|
|
834
855
|
categorystyle: "loop_category",
|
|
@@ -850,31 +871,31 @@ const Ue = {
|
|
|
850
871
|
type: "for_each_v1"
|
|
851
872
|
}
|
|
852
873
|
]
|
|
853
|
-
},
|
|
874
|
+
}, Qe = {
|
|
854
875
|
kind: "categoryToolbox",
|
|
855
|
-
contents: [
|
|
856
|
-
},
|
|
876
|
+
contents: [Ze, qe]
|
|
877
|
+
}, et = /* @__PURE__ */ M({
|
|
857
878
|
__name: "cleanup",
|
|
858
879
|
setup(t) {
|
|
859
880
|
const e = () => {
|
|
860
|
-
const
|
|
861
|
-
if (!
|
|
881
|
+
const o = T();
|
|
882
|
+
if (!o)
|
|
862
883
|
return;
|
|
863
|
-
const
|
|
864
|
-
|
|
884
|
+
const n = C.registry.getItem("cleanWorkspace");
|
|
885
|
+
n && n.callback({ workspace: o }, new PointerEvent("dummy"));
|
|
865
886
|
};
|
|
866
|
-
return (
|
|
867
|
-
const r =
|
|
868
|
-
return
|
|
887
|
+
return (o, n) => {
|
|
888
|
+
const r = m("v-btn");
|
|
889
|
+
return d(), L(r, {
|
|
869
890
|
onClick: e,
|
|
870
891
|
class: "mr-3",
|
|
871
892
|
variant: "outlined",
|
|
872
893
|
density: "comfortable",
|
|
873
|
-
icon:
|
|
894
|
+
icon: R(Ae)
|
|
874
895
|
}, null, 8, ["icon"]);
|
|
875
896
|
};
|
|
876
897
|
}
|
|
877
|
-
}),
|
|
898
|
+
}), tt = /* @__PURE__ */ M({
|
|
878
899
|
__name: "lock",
|
|
879
900
|
props: {
|
|
880
901
|
modelValue: { type: Boolean, required: !0 },
|
|
@@ -882,63 +903,122 @@ const Ue = {
|
|
|
882
903
|
},
|
|
883
904
|
emits: ["update:modelValue"],
|
|
884
905
|
setup(t) {
|
|
885
|
-
const e =
|
|
886
|
-
return (
|
|
887
|
-
const r =
|
|
888
|
-
return
|
|
889
|
-
onClick:
|
|
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),
|
|
890
911
|
class: "mr-3",
|
|
891
912
|
variant: "outlined",
|
|
892
913
|
density: "comfortable",
|
|
893
|
-
icon: e.value ?
|
|
914
|
+
icon: e.value ? R(Pe) : R(we)
|
|
894
915
|
}, null, 8, ["icon"]);
|
|
895
916
|
};
|
|
896
917
|
}
|
|
897
|
-
}),
|
|
918
|
+
}), ot = {
|
|
919
|
+
key: 1,
|
|
920
|
+
class: "text-caption text-grey"
|
|
921
|
+
}, nt = /* @__PURE__ */ M({
|
|
898
922
|
__name: "navigator",
|
|
899
923
|
setup(t) {
|
|
900
|
-
const e =
|
|
924
|
+
const e = w(() => ({
|
|
901
925
|
maxHeight: "calc(100vh - 200px)"
|
|
902
|
-
}))
|
|
903
|
-
|
|
904
|
-
const
|
|
905
|
-
|
|
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(_, {
|
|
906
965
|
"close-on-content-click": !1,
|
|
907
966
|
transition: "slide-y-transition",
|
|
908
967
|
"offset-y": ""
|
|
909
968
|
}, {
|
|
910
|
-
activator:
|
|
911
|
-
|
|
969
|
+
activator: E(({ props: f }) => [
|
|
970
|
+
S(a, _e(f, {
|
|
912
971
|
variant: "outlined",
|
|
913
972
|
density: "comfortable",
|
|
914
|
-
icon:
|
|
973
|
+
icon: R(Ke)
|
|
915
974
|
}), null, 16, ["icon"])
|
|
916
975
|
]),
|
|
917
|
-
default:
|
|
918
|
-
|
|
976
|
+
default: E(() => [
|
|
977
|
+
G("div", {
|
|
919
978
|
class: "overflow-auto",
|
|
920
|
-
style:
|
|
979
|
+
style: V(e.value)
|
|
921
980
|
}, [
|
|
922
|
-
|
|
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"))
|
|
923
1002
|
], 4)
|
|
924
1003
|
]),
|
|
925
1004
|
_: 1
|
|
926
1005
|
});
|
|
927
1006
|
};
|
|
928
1007
|
}
|
|
929
|
-
}),
|
|
1008
|
+
}), rt = { class: "position-relative w-100 h-100" }, st = /* @__PURE__ */ M({
|
|
930
1009
|
__name: "index",
|
|
931
|
-
props: /* @__PURE__ */
|
|
1010
|
+
props: /* @__PURE__ */ X({
|
|
932
1011
|
type: {},
|
|
933
1012
|
version: {},
|
|
934
|
-
active: { type: Boolean }
|
|
1013
|
+
active: { type: Boolean },
|
|
1014
|
+
scale: {}
|
|
935
1015
|
}, {
|
|
936
1016
|
lock: { type: Boolean, required: !0 },
|
|
937
1017
|
lockModifiers: {}
|
|
938
1018
|
}),
|
|
939
|
-
emits: /* @__PURE__ */
|
|
1019
|
+
emits: /* @__PURE__ */ X(["ready", "change"], ["update:lock"]),
|
|
940
1020
|
setup(t, { emit: e }) {
|
|
941
|
-
const
|
|
1021
|
+
const o = Be(), { locale: n, dark: r } = Te(o), { open: s } = xe("blocklyEditorFlyout"), l = t, a = $(t, "lock"), u = e, b = K(), O = {
|
|
942
1022
|
grid: {
|
|
943
1023
|
length: 2,
|
|
944
1024
|
snap: !0,
|
|
@@ -961,8 +1041,8 @@ const Ue = {
|
|
|
961
1041
|
wheel: !0
|
|
962
1042
|
}
|
|
963
1043
|
};
|
|
964
|
-
let
|
|
965
|
-
const
|
|
1044
|
+
let _;
|
|
1045
|
+
const f = K(!0), N = K(!1), oe = w(() => ({
|
|
966
1046
|
position: "absolute",
|
|
967
1047
|
background: r.value ? "#0000007f" : "#ffffff7f",
|
|
968
1048
|
top: "1px",
|
|
@@ -971,7 +1051,7 @@ const Ue = {
|
|
|
971
1051
|
height: "100%",
|
|
972
1052
|
pointerEvents: "none",
|
|
973
1053
|
zIndex: 999
|
|
974
|
-
})),
|
|
1054
|
+
})), ne = w(() => ({
|
|
975
1055
|
position: "absolute",
|
|
976
1056
|
background: r.value ? "#0000007f" : "#ffffff7f",
|
|
977
1057
|
top: "0px",
|
|
@@ -979,81 +1059,94 @@ const Ue = {
|
|
|
979
1059
|
width: "100%",
|
|
980
1060
|
height: "100%",
|
|
981
1061
|
pointerEvents: "none"
|
|
982
|
-
})),
|
|
1062
|
+
})), re = w(() => ({
|
|
983
1063
|
position: "absolute",
|
|
984
1064
|
top: "0px",
|
|
985
1065
|
right: "0px",
|
|
986
1066
|
zIndex: 20
|
|
987
1067
|
}));
|
|
988
|
-
|
|
989
|
-
if (!
|
|
1068
|
+
Z(async () => {
|
|
1069
|
+
if (!b.value)
|
|
990
1070
|
return;
|
|
991
|
-
await
|
|
992
|
-
let
|
|
993
|
-
l.type === "app" && l.version === "v1" && (
|
|
994
|
-
}),
|
|
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(() => {
|
|
995
1075
|
s.value = !1;
|
|
996
1076
|
});
|
|
997
|
-
function
|
|
998
|
-
|
|
1077
|
+
function z() {
|
|
1078
|
+
_ && Le(_);
|
|
999
1079
|
}
|
|
1000
|
-
function
|
|
1001
|
-
|
|
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));
|
|
1002
1086
|
}
|
|
1003
|
-
return
|
|
1004
|
-
|
|
1005
|
-
}),
|
|
1006
|
-
|
|
1007
|
-
}),
|
|
1008
|
-
var
|
|
1009
|
-
|
|
1010
|
-
}),
|
|
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(
|
|
1011
1095
|
() => l.active,
|
|
1012
|
-
(
|
|
1013
|
-
|
|
1096
|
+
(i) => {
|
|
1097
|
+
i && setTimeout(() => z(), 1);
|
|
1098
|
+
}
|
|
1099
|
+
), B(
|
|
1100
|
+
() => l.scale,
|
|
1101
|
+
(i) => {
|
|
1102
|
+
_.setScale(i);
|
|
1014
1103
|
}
|
|
1015
|
-
), (
|
|
1016
|
-
const
|
|
1017
|
-
return
|
|
1018
|
-
|
|
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", {
|
|
1019
1108
|
class: "w-100 h-100",
|
|
1020
1109
|
ref_key: "blocklyDiv",
|
|
1021
|
-
ref:
|
|
1110
|
+
ref: b,
|
|
1022
1111
|
id: "blocklyEditor"
|
|
1023
1112
|
}, null, 512), [
|
|
1024
|
-
[
|
|
1113
|
+
[ie, z]
|
|
1025
1114
|
]),
|
|
1026
|
-
|
|
1115
|
+
N.value ? (d(), A("div", {
|
|
1027
1116
|
key: 0,
|
|
1028
1117
|
class: "d-flex flex-column align-center justify-center",
|
|
1029
|
-
style:
|
|
1118
|
+
style: V(oe.value)
|
|
1030
1119
|
}, [
|
|
1031
|
-
|
|
1032
|
-
icon:
|
|
1120
|
+
S(le, {
|
|
1121
|
+
icon: R(Re),
|
|
1033
1122
|
size: "x-large"
|
|
1034
1123
|
}, null, 8, ["icon"])
|
|
1035
|
-
], 4)) :
|
|
1036
|
-
a.value ? (
|
|
1124
|
+
], 4)) : D("", !0),
|
|
1125
|
+
a.value ? (d(), A("div", {
|
|
1037
1126
|
key: 1,
|
|
1038
|
-
style:
|
|
1039
|
-
}, null, 4)) :
|
|
1040
|
-
|
|
1127
|
+
style: V(ne.value)
|
|
1128
|
+
}, null, 4)) : D("", !0),
|
|
1129
|
+
G("div", {
|
|
1041
1130
|
class: "d-flex align-end pt-3 pr-3",
|
|
1042
|
-
style:
|
|
1131
|
+
style: V(re.value)
|
|
1043
1132
|
}, [
|
|
1044
|
-
|
|
1045
|
-
|
|
1133
|
+
S(et),
|
|
1134
|
+
S(tt, {
|
|
1046
1135
|
modelValue: a.value,
|
|
1047
|
-
"onUpdate:modelValue":
|
|
1136
|
+
"onUpdate:modelValue": k[0] || (k[0] = (ce) => a.value = ce)
|
|
1048
1137
|
}, null, 8, ["modelValue"]),
|
|
1049
|
-
|
|
1050
|
-
], 4)
|
|
1138
|
+
S(nt)
|
|
1139
|
+
], 4),
|
|
1140
|
+
f.value ? (d(), L(ae, {
|
|
1141
|
+
key: 2,
|
|
1142
|
+
zIndex: 99
|
|
1143
|
+
})) : D("", !0)
|
|
1051
1144
|
]);
|
|
1052
1145
|
};
|
|
1053
1146
|
}
|
|
1054
|
-
}),
|
|
1055
|
-
t.component("x-blockly",
|
|
1056
|
-
},
|
|
1147
|
+
}), lt = (t) => {
|
|
1148
|
+
t.component("x-blockly", st);
|
|
1149
|
+
}, _t = { install: lt };
|
|
1057
1150
|
export {
|
|
1058
|
-
|
|
1151
|
+
_t as default
|
|
1059
1152
|
};
|