x-block-lib 0.3.5 → 0.3.19
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/components/blockly/index.vue.d.ts +1 -0
- package/dist/core/locale/msg/en/index.d.ts +5 -5
- package/dist/core/locale/msg/en/logic.d.ts +13 -0
- package/dist/core/locale/msg/en/loop.d.ts +11 -0
- package/dist/core/locale/msg/zhHans/index.d.ts +5 -5
- package/dist/core/locale/msg/zhHans/logic.d.ts +13 -0
- package/dist/core/locale/msg/zhHans/loop.d.ts +11 -0
- package/dist/{zhHans-dmzotd2n.js → en-jrrs2wmb.js} +15 -7
- package/dist/index.js +124 -126
- package/dist/zhHans-jrrs2wmb.js +35 -0
- package/package.json +3 -2
- package/dist/en-c75t6n0y.js +0 -27
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
type: 'app';
|
|
3
3
|
version: 'v1';
|
|
4
|
+
active: boolean;
|
|
4
5
|
}
|
|
5
6
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
7
|
ready: (...args: any[]) => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
LOOP_DO: string;
|
|
3
2
|
LOOP_V1_FOR_TITLE: string;
|
|
4
3
|
LOOP_V1_FOR_EACH_TITLE: string;
|
|
5
4
|
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: string;
|
|
@@ -7,15 +6,16 @@ declare const _default: {
|
|
|
7
6
|
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: string;
|
|
8
7
|
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: string;
|
|
9
8
|
LOOP_V1_WHILE_UNTIL_HELPURL: string;
|
|
9
|
+
LOOP_DO: string;
|
|
10
|
+
LOGIC_V1_BOOLEAN_TOOPTIP: string;
|
|
11
|
+
LOGIC_V1_BOOLEAN_HELPURL: string;
|
|
12
|
+
LOGIC_V1_IF_TOOLTIP: string;
|
|
13
|
+
LOGIC_V1_IF_HELPURL: string;
|
|
10
14
|
LOGIC_BOOLEAN_FALSE: string;
|
|
11
15
|
LOGIC_BOOLEAN_TRUE: string;
|
|
12
16
|
LOGIC_DO: string;
|
|
13
17
|
LOGIC_ELSE: string;
|
|
14
18
|
LOGIC_ELSE_IF: string;
|
|
15
19
|
LOGIC_IF: string;
|
|
16
|
-
LOGIC_V1_BOOLEAN_TOOPTIP: string;
|
|
17
|
-
LOGIC_V1_BOOLEAN_HELPURL: string;
|
|
18
|
-
LOGIC_V1_IF_TOOLTIP: string;
|
|
19
|
-
LOGIC_V1_IF_HELPURL: string;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
LOGIC_V1_BOOLEAN_TOOPTIP: string;
|
|
3
|
+
LOGIC_V1_BOOLEAN_HELPURL: string;
|
|
4
|
+
LOGIC_V1_IF_TOOLTIP: string;
|
|
5
|
+
LOGIC_V1_IF_HELPURL: string;
|
|
6
|
+
LOGIC_BOOLEAN_FALSE: string;
|
|
7
|
+
LOGIC_BOOLEAN_TRUE: string;
|
|
8
|
+
LOGIC_DO: string;
|
|
9
|
+
LOGIC_ELSE: string;
|
|
10
|
+
LOGIC_ELSE_IF: string;
|
|
11
|
+
LOGIC_IF: string;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
LOOP_V1_FOR_TITLE: string;
|
|
3
|
+
LOOP_V1_FOR_EACH_TITLE: string;
|
|
4
|
+
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: string;
|
|
5
|
+
LOOP_V1_WHILE_UNTIL_OPERATOR_UNTIL: string;
|
|
6
|
+
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: string;
|
|
7
|
+
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: string;
|
|
8
|
+
LOOP_V1_WHILE_UNTIL_HELPURL: string;
|
|
9
|
+
LOOP_DO: string;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
LOOP_DO: string;
|
|
3
2
|
LOOP_V1_FOR_TITLE: string;
|
|
4
3
|
LOOP_V1_FOR_EACH_TITLE: string;
|
|
5
4
|
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: string;
|
|
@@ -7,15 +6,16 @@ declare const _default: {
|
|
|
7
6
|
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: string;
|
|
8
7
|
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: string;
|
|
9
8
|
LOOP_V1_WHILE_UNTIL_HELPURL: string;
|
|
9
|
+
LOOP_DO: string;
|
|
10
|
+
LOGIC_V1_BOOLEAN_TOOPTIP: string;
|
|
11
|
+
LOGIC_V1_BOOLEAN_HELPURL: string;
|
|
12
|
+
LOGIC_V1_IF_TOOLTIP: string;
|
|
13
|
+
LOGIC_V1_IF_HELPURL: string;
|
|
10
14
|
LOGIC_BOOLEAN_FALSE: string;
|
|
11
15
|
LOGIC_BOOLEAN_TRUE: string;
|
|
12
16
|
LOGIC_DO: string;
|
|
13
17
|
LOGIC_ELSE: string;
|
|
14
18
|
LOGIC_ELSE_IF: string;
|
|
15
19
|
LOGIC_IF: string;
|
|
16
|
-
LOGIC_V1_BOOLEAN_TOOPTIP: string;
|
|
17
|
-
LOGIC_V1_BOOLEAN_HELPURL: string;
|
|
18
|
-
LOGIC_V1_IF_TOOLTIP: string;
|
|
19
|
-
LOGIC_V1_IF_HELPURL: string;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
LOGIC_V1_BOOLEAN_TOOPTIP: string;
|
|
3
|
+
LOGIC_V1_BOOLEAN_HELPURL: string;
|
|
4
|
+
LOGIC_V1_IF_TOOLTIP: string;
|
|
5
|
+
LOGIC_V1_IF_HELPURL: string;
|
|
6
|
+
LOGIC_BOOLEAN_FALSE: string;
|
|
7
|
+
LOGIC_BOOLEAN_TRUE: string;
|
|
8
|
+
LOGIC_DO: string;
|
|
9
|
+
LOGIC_ELSE: string;
|
|
10
|
+
LOGIC_ELSE_IF: string;
|
|
11
|
+
LOGIC_IF: string;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
LOOP_V1_FOR_TITLE: string;
|
|
3
|
+
LOOP_V1_FOR_EACH_TITLE: string;
|
|
4
|
+
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: string;
|
|
5
|
+
LOOP_V1_WHILE_UNTIL_OPERATOR_UNTIL: string;
|
|
6
|
+
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: string;
|
|
7
|
+
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: string;
|
|
8
|
+
LOOP_V1_WHILE_UNTIL_HELPURL: string;
|
|
9
|
+
LOOP_DO: string;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -4,13 +4,18 @@ const _ = {
|
|
|
4
4
|
LOGIC_DO: "执行",
|
|
5
5
|
LOGIC_ELSE: "否则",
|
|
6
6
|
LOGIC_ELSE_IF: "否则如果",
|
|
7
|
-
LOGIC_IF: "如果"
|
|
7
|
+
LOGIC_IF: "如果"
|
|
8
|
+
}, L = {
|
|
8
9
|
LOGIC_V1_BOOLEAN_TOOPTIP: "LOGIC_V1_BOOLEAN_TOOPTIP",
|
|
9
10
|
LOGIC_V1_BOOLEAN_HELPURL: "LOGIC_V1_BOOLEAN_HELPURL",
|
|
10
11
|
LOGIC_V1_IF_TOOLTIP: "LOGIC_V1_IF_TOOLTIP",
|
|
11
12
|
LOGIC_V1_IF_HELPURL: "LOGIC_V1_IF_HELPURL"
|
|
12
|
-
},
|
|
13
|
-
|
|
13
|
+
}, O = {
|
|
14
|
+
..._,
|
|
15
|
+
...L
|
|
16
|
+
}, I = {
|
|
17
|
+
LOOP_DO: "执行"
|
|
18
|
+
}, E = {
|
|
14
19
|
LOOP_V1_FOR_TITLE: "变量%1从%2数到%3每次增加%4",
|
|
15
20
|
LOOP_V1_FOR_EACH_TITLE: "遍历列表%2中的每一项%1",
|
|
16
21
|
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: "当条件满足时重复",
|
|
@@ -18,10 +23,13 @@ const _ = {
|
|
|
18
23
|
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: "LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE",
|
|
19
24
|
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: "LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL",
|
|
20
25
|
LOOP_V1_WHILE_UNTIL_HELPURL: "LOOP_V1_WHILE_UNTIL_HELPURL"
|
|
21
|
-
},
|
|
22
|
-
...
|
|
23
|
-
...
|
|
26
|
+
}, T = {
|
|
27
|
+
...I,
|
|
28
|
+
...E
|
|
29
|
+
}, P = {
|
|
30
|
+
...O,
|
|
31
|
+
...T
|
|
24
32
|
};
|
|
25
33
|
export {
|
|
26
|
-
|
|
34
|
+
P as default
|
|
27
35
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.id="x-block-lib",e.appendChild(document.createTextNode(".blocklyToolboxDiv{overflow-x:hidden;width:56px}")),document.head.appendChild(e)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import {
|
|
4
|
-
import { openConfirmDlg as
|
|
5
|
-
import { d as
|
|
6
|
-
|
|
2
|
+
import { defineComponent as A, ref as N, onMounted as D, onBeforeUnmount as M, watch as C, resolveDirective as V, openBlock as U, createElementBlock as Y, withDirectives as G, createElementVNode as W } from "vue";
|
|
3
|
+
import { storeToRefs as H } from "pinia";
|
|
4
|
+
import { openConfirmDlg as z, openPromptDlg as X, useGlobalStore as J, useViewStack as j } from "x-essential-lib";
|
|
5
|
+
import { d as h, j as $, O as q, E as p, u as i, M as f, C as Q, a as d, b as R, s as Z, S as u, c as L, g as O, i as m, e as I, f as b, h as g, k as B, G as v, B as ee, T as k, l as x, m as te, n as oe, o as ne } from "./blockly-kru4jhu1.js";
|
|
6
|
+
h([
|
|
7
7
|
{
|
|
8
8
|
type: "boolean_v1",
|
|
9
9
|
message0: "%1",
|
|
@@ -32,7 +32,7 @@ const re = {
|
|
|
32
32
|
mutationToDom: function() {
|
|
33
33
|
if (this.elseIfCount_ <= 0 && !this.hasElse_)
|
|
34
34
|
return null;
|
|
35
|
-
const t =
|
|
35
|
+
const t = i.xml.createElement("mutation");
|
|
36
36
|
return this.elseIfCount_ > 0 && t.setAttribute("elseIf", String(this.elseIfCount_)), this.hasElse_ && t.setAttribute("else", "TRUE"), t;
|
|
37
37
|
},
|
|
38
38
|
domToMutation: function(t) {
|
|
@@ -154,7 +154,7 @@ p.registerMutator(
|
|
|
154
154
|
void 0,
|
|
155
155
|
["if_else_if_v1", "if_else_v1"]
|
|
156
156
|
);
|
|
157
|
-
|
|
157
|
+
h([
|
|
158
158
|
{
|
|
159
159
|
type: "if_v1",
|
|
160
160
|
message0: "%{BKY_LOGIC_IF} %1",
|
|
@@ -250,16 +250,16 @@ const ae = /* @__PURE__ */ new Set([
|
|
|
250
250
|
},
|
|
251
251
|
onchange: function(t) {
|
|
252
252
|
const e = this.workspace;
|
|
253
|
-
if (!e.isDragging || e.isDragging() || t.type !==
|
|
253
|
+
if (!e.isDragging || e.isDragging() || t.type !== d.BLOCK_MOVE && t.type !== d.BLOCK_CREATE)
|
|
254
254
|
return;
|
|
255
255
|
const n = this.getSurroundLoop();
|
|
256
256
|
if (console.log(t.type, n), this.setWarningText(
|
|
257
257
|
n ? null : f.LOOP_FLOW_CONTROL_WARNING
|
|
258
258
|
), !this.isInFlyout)
|
|
259
259
|
try {
|
|
260
|
-
|
|
260
|
+
d.setRecordUndo(!1), this.setDisabledReason(!n, "FLOW_CONTROL_NOT_IN_LOOP");
|
|
261
261
|
} finally {
|
|
262
|
-
|
|
262
|
+
d.setRecordUndo(!0);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
};
|
|
@@ -267,7 +267,7 @@ p.registerMixin(
|
|
|
267
267
|
"flow_control_in_loop_check_v1",
|
|
268
268
|
le
|
|
269
269
|
);
|
|
270
|
-
|
|
270
|
+
h([
|
|
271
271
|
{
|
|
272
272
|
type: "flow_control_v1",
|
|
273
273
|
message0: "%1",
|
|
@@ -295,7 +295,7 @@ p.register(
|
|
|
295
295
|
"VAR"
|
|
296
296
|
)
|
|
297
297
|
);
|
|
298
|
-
|
|
298
|
+
h([
|
|
299
299
|
{
|
|
300
300
|
type: "for_v1",
|
|
301
301
|
message0: "%{BKY_LOOP_V1_FOR_TITLE}",
|
|
@@ -346,7 +346,7 @@ p.register(
|
|
|
346
346
|
"VAR"
|
|
347
347
|
)
|
|
348
348
|
);
|
|
349
|
-
|
|
349
|
+
h([
|
|
350
350
|
{
|
|
351
351
|
type: "for_each_v1",
|
|
352
352
|
message0: "%{BKY_LOOP_V1_FOR_EACH_TITLE}",
|
|
@@ -383,7 +383,7 @@ p.register(
|
|
|
383
383
|
UNTIL: "%{BKY_LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL}"
|
|
384
384
|
})
|
|
385
385
|
);
|
|
386
|
-
|
|
386
|
+
h([
|
|
387
387
|
{
|
|
388
388
|
type: "while_until_v1",
|
|
389
389
|
message0: "%1 %2",
|
|
@@ -416,15 +416,15 @@ g([
|
|
|
416
416
|
extensions: ["while_until_tooltip_v1"]
|
|
417
417
|
}
|
|
418
418
|
]);
|
|
419
|
-
|
|
420
|
-
const n = await
|
|
419
|
+
R.setConfirm(async (t, e) => {
|
|
420
|
+
const n = await z({
|
|
421
421
|
title: "",
|
|
422
422
|
text: t
|
|
423
423
|
});
|
|
424
424
|
e(!!n);
|
|
425
425
|
});
|
|
426
|
-
|
|
427
|
-
const o = await
|
|
426
|
+
R.setPrompt(async (t, e, n) => {
|
|
427
|
+
const o = await X({
|
|
428
428
|
title: "",
|
|
429
429
|
value: e
|
|
430
430
|
});
|
|
@@ -443,8 +443,8 @@ const ie = (t, e, n) => {
|
|
|
443
443
|
);
|
|
444
444
|
});
|
|
445
445
|
};
|
|
446
|
-
async function
|
|
447
|
-
const e = await ie(/* @__PURE__ */ Object.assign({ "./msg/en/index.ts": () => import("./en-
|
|
446
|
+
async function P(t) {
|
|
447
|
+
const e = await ie(/* @__PURE__ */ Object.assign({ "./msg/en/index.ts": () => import("./en-jrrs2wmb.js"), "./msg/zhHans/index.ts": () => import("./zhHans-jrrs2wmb.js") }), `./msg/${t}/index.ts`, 4);
|
|
448
448
|
Z(e.default);
|
|
449
449
|
}
|
|
450
450
|
class ce {
|
|
@@ -453,11 +453,11 @@ class ce {
|
|
|
453
453
|
shortcut: !0
|
|
454
454
|
}) {
|
|
455
455
|
e && (this.blockCopyToStorageContextMenu(), this.blockPasteFromStorageContextMenu()), n && (u.registry.unregister(
|
|
456
|
-
|
|
456
|
+
L.names.COPY
|
|
457
457
|
), u.registry.unregister(
|
|
458
|
-
|
|
458
|
+
L.names.CUT
|
|
459
459
|
), u.registry.unregister(
|
|
460
|
-
|
|
460
|
+
L.names.PASTE
|
|
461
461
|
), this.blockCopyToStorageShortcut(), this.blockCutToStorageShortcut(), this.blockPasteFromStorageShortcut());
|
|
462
462
|
}
|
|
463
463
|
blockCopyToStorageContextMenu() {
|
|
@@ -466,8 +466,8 @@ class ce {
|
|
|
466
466
|
return f.CROSS_TAB_COPY ? f.CROSS_TAB_COPY : "Copy";
|
|
467
467
|
},
|
|
468
468
|
preconditionFn: function() {
|
|
469
|
-
const n =
|
|
470
|
-
return !n || !
|
|
469
|
+
const n = O();
|
|
470
|
+
return !n || !m(n) || !n.isDeletable() || !I(n) || !n.isMovable() || !b(n) ? "disabled" : "enabled";
|
|
471
471
|
},
|
|
472
472
|
callback: function(n) {
|
|
473
473
|
var o;
|
|
@@ -476,11 +476,11 @@ class ce {
|
|
|
476
476
|
JSON.stringify((o = n.block) == null ? void 0 : o.toCopyData())
|
|
477
477
|
);
|
|
478
478
|
},
|
|
479
|
-
scopeType:
|
|
479
|
+
scopeType: g.ScopeType.BLOCK,
|
|
480
480
|
id: "blockCopyToStorage",
|
|
481
481
|
weight: 0
|
|
482
482
|
};
|
|
483
|
-
|
|
483
|
+
g.registry.register(e);
|
|
484
484
|
}
|
|
485
485
|
blockPasteFromStorageContextMenu() {
|
|
486
486
|
const e = {
|
|
@@ -500,39 +500,39 @@ class ce {
|
|
|
500
500
|
if (!o)
|
|
501
501
|
return;
|
|
502
502
|
const r = JSON.parse(o);
|
|
503
|
-
r && n.workspace &&
|
|
503
|
+
r && n.workspace && B.paste(r, n.workspace);
|
|
504
504
|
},
|
|
505
|
-
scopeType:
|
|
505
|
+
scopeType: g.ScopeType.WORKSPACE,
|
|
506
506
|
id: "blockPasteFromStorage",
|
|
507
507
|
weight: 0
|
|
508
508
|
};
|
|
509
|
-
|
|
509
|
+
g.registry.register(e);
|
|
510
510
|
}
|
|
511
511
|
blockCopyToStorageShortcut() {
|
|
512
512
|
const e = u.registry.createSerializedKey(
|
|
513
|
-
|
|
514
|
-
[
|
|
513
|
+
i.KeyCodes.C,
|
|
514
|
+
[i.KeyCodes.CTRL]
|
|
515
515
|
), n = u.registry.createSerializedKey(
|
|
516
|
-
|
|
517
|
-
[
|
|
516
|
+
i.KeyCodes.C,
|
|
517
|
+
[i.KeyCodes.ALT]
|
|
518
518
|
), o = u.registry.createSerializedKey(
|
|
519
|
-
|
|
520
|
-
[
|
|
519
|
+
i.KeyCodes.C,
|
|
520
|
+
[i.KeyCodes.META]
|
|
521
521
|
), r = {
|
|
522
522
|
name: "copy",
|
|
523
523
|
preconditionFn: function(s) {
|
|
524
|
-
if (s.options.readOnly ||
|
|
524
|
+
if (s.options.readOnly || v.inProgress())
|
|
525
525
|
return !1;
|
|
526
|
-
const
|
|
527
|
-
return !(!
|
|
526
|
+
const a = O();
|
|
527
|
+
return !(!a || !m(a) || !a.isDeletable() || !I(a) || !a.isMovable() || !b(a));
|
|
528
528
|
},
|
|
529
|
-
callback: function(s,
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
if (!
|
|
529
|
+
callback: function(s, a) {
|
|
530
|
+
a.preventDefault();
|
|
531
|
+
const l = O();
|
|
532
|
+
if (!l || !b(l))
|
|
533
533
|
return !1;
|
|
534
|
-
const
|
|
535
|
-
return
|
|
534
|
+
const c = l.toCopyData();
|
|
535
|
+
return c ? (s.hideChaff(), localStorage.setItem("blocklyStash", JSON.stringify(c)), !0) : !1;
|
|
536
536
|
},
|
|
537
537
|
keyCodes: [e, n, o]
|
|
538
538
|
};
|
|
@@ -540,29 +540,29 @@ class ce {
|
|
|
540
540
|
}
|
|
541
541
|
blockCutToStorageShortcut() {
|
|
542
542
|
const e = u.registry.createSerializedKey(
|
|
543
|
-
|
|
544
|
-
[
|
|
543
|
+
i.KeyCodes.X,
|
|
544
|
+
[i.KeyCodes.CTRL]
|
|
545
545
|
), n = u.registry.createSerializedKey(
|
|
546
|
-
|
|
547
|
-
[
|
|
546
|
+
i.KeyCodes.X,
|
|
547
|
+
[i.KeyCodes.ALT]
|
|
548
548
|
), o = u.registry.createSerializedKey(
|
|
549
|
-
|
|
550
|
-
[
|
|
549
|
+
i.KeyCodes.X,
|
|
550
|
+
[i.KeyCodes.META]
|
|
551
551
|
), r = {
|
|
552
552
|
name: "cut",
|
|
553
553
|
preconditionFn: function(s) {
|
|
554
|
-
if (s.options.readOnly ||
|
|
554
|
+
if (s.options.readOnly || v.inProgress())
|
|
555
555
|
return !1;
|
|
556
|
-
const
|
|
557
|
-
return !(!
|
|
556
|
+
const a = O();
|
|
557
|
+
return !(!a || !m(a) || !a.isDeletable() || !I(a) || !a.isMovable() || !b(a) || a.workspace.isFlyout);
|
|
558
558
|
},
|
|
559
|
-
callback: function(s,
|
|
560
|
-
|
|
561
|
-
const
|
|
562
|
-
if (!
|
|
559
|
+
callback: function(s, a) {
|
|
560
|
+
a.preventDefault();
|
|
561
|
+
const l = O();
|
|
562
|
+
if (!l || !m(l) || !l.isDeletable() || !b(l))
|
|
563
563
|
return !1;
|
|
564
|
-
const
|
|
565
|
-
return
|
|
564
|
+
const c = l.toCopyData();
|
|
565
|
+
return c ? (localStorage.setItem("blocklyStash", JSON.stringify(c)), l instanceof ee ? l.checkAndDelete() : l.dispose(), !0) : !1;
|
|
566
566
|
},
|
|
567
567
|
keyCodes: [e, n, o]
|
|
568
568
|
};
|
|
@@ -570,32 +570,32 @@ class ce {
|
|
|
570
570
|
}
|
|
571
571
|
blockPasteFromStorageShortcut() {
|
|
572
572
|
const e = u.registry.createSerializedKey(
|
|
573
|
-
|
|
574
|
-
[
|
|
573
|
+
i.KeyCodes.V,
|
|
574
|
+
[i.KeyCodes.CTRL]
|
|
575
575
|
), n = u.registry.createSerializedKey(
|
|
576
|
-
|
|
577
|
-
[
|
|
576
|
+
i.KeyCodes.V,
|
|
577
|
+
[i.KeyCodes.ALT]
|
|
578
578
|
), o = u.registry.createSerializedKey(
|
|
579
|
-
|
|
580
|
-
[
|
|
579
|
+
i.KeyCodes.V,
|
|
580
|
+
[i.KeyCodes.META]
|
|
581
581
|
), r = {
|
|
582
582
|
name: "paste",
|
|
583
583
|
preconditionFn: function(s) {
|
|
584
|
-
if (s.options.readOnly ||
|
|
584
|
+
if (s.options.readOnly || v.inProgress())
|
|
585
585
|
return !1;
|
|
586
|
-
const l = localStorage.getItem("blocklyStash");
|
|
587
|
-
if (!l)
|
|
588
|
-
return !1;
|
|
589
|
-
const a = JSON.parse(l);
|
|
590
|
-
return !(!a || !s.isCapacityAvailable(a.typeCounts));
|
|
591
|
-
},
|
|
592
|
-
callback: function(s, l) {
|
|
593
|
-
l.preventDefault();
|
|
594
586
|
const a = localStorage.getItem("blocklyStash");
|
|
595
587
|
if (!a)
|
|
596
588
|
return !1;
|
|
597
|
-
const
|
|
598
|
-
return
|
|
589
|
+
const l = JSON.parse(a);
|
|
590
|
+
return !(!l || !s.isCapacityAvailable(l.typeCounts));
|
|
591
|
+
},
|
|
592
|
+
callback: function(s, a) {
|
|
593
|
+
a.preventDefault();
|
|
594
|
+
const l = localStorage.getItem("blocklyStash");
|
|
595
|
+
if (!l)
|
|
596
|
+
return !1;
|
|
597
|
+
const c = JSON.parse(l);
|
|
598
|
+
return c ? (B.paste(c, s), !0) : !1;
|
|
599
599
|
},
|
|
600
600
|
keyCodes: [e, n, o]
|
|
601
601
|
};
|
|
@@ -604,34 +604,34 @@ class ce {
|
|
|
604
604
|
}
|
|
605
605
|
class ue {
|
|
606
606
|
init() {
|
|
607
|
-
const e =
|
|
607
|
+
const e = g.registry.getItem("cleanWorkspace");
|
|
608
608
|
e && (e.callback = function(n) {
|
|
609
609
|
const o = n.workspace;
|
|
610
610
|
if (!o)
|
|
611
611
|
return;
|
|
612
|
-
o.setResizesEnabled(!1),
|
|
612
|
+
o.setResizesEnabled(!1), d.setGroup(!0);
|
|
613
613
|
const r = o.getTopBlocks(!0);
|
|
614
614
|
let s = 0;
|
|
615
|
-
for (let
|
|
616
|
-
if (!
|
|
615
|
+
for (let a = 0, l; l = r[a]; a++) {
|
|
616
|
+
if (!l.isMovable())
|
|
617
617
|
continue;
|
|
618
|
-
const
|
|
619
|
-
|
|
618
|
+
const c = l.getRelativeToSurfaceXY();
|
|
619
|
+
l.moveBy(-c.x, s - c.y, ["cleanup"]), l.snapToGrid(), s = l.getRelativeToSurfaceXY().y + l.getHeightWidth().height + 100;
|
|
620
620
|
}
|
|
621
|
-
|
|
621
|
+
d.setGroup(!1), o.setResizesEnabled(!0);
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function K(t) {
|
|
626
626
|
const e = t.getParent();
|
|
627
|
-
return e &&
|
|
627
|
+
return e && K(e) ? !0 : !e && !!(t.outputConnection || t.previousConnection);
|
|
628
628
|
}
|
|
629
629
|
class _e {
|
|
630
630
|
init() {
|
|
631
|
-
const e =
|
|
631
|
+
const e = g.registry.getItem("blockDisable");
|
|
632
632
|
e && (e.preconditionFn = function(n) {
|
|
633
633
|
const o = n.block;
|
|
634
|
-
return o && !o.isInFlyout && o.workspace.options.disable && o.isEditable() ? o.getInheritedDisabled() ||
|
|
634
|
+
return o && !o.isInFlyout && o.workspace.options.disable && o.isEditable() ? o.getInheritedDisabled() || K(o) ? "disabled" : "enabled" : "hidden";
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
}
|
|
@@ -641,7 +641,7 @@ const fe = new ue();
|
|
|
641
641
|
fe.init();
|
|
642
642
|
const ye = new _e();
|
|
643
643
|
ye.init();
|
|
644
|
-
|
|
644
|
+
k.Classic.blockStyles = {
|
|
645
645
|
color_blocks: {
|
|
646
646
|
colourPrimary: "#a5745b",
|
|
647
647
|
colourSecondary: "#ede3de",
|
|
@@ -715,7 +715,7 @@ C.Classic.blockStyles = {
|
|
|
715
715
|
hat: ""
|
|
716
716
|
}
|
|
717
717
|
};
|
|
718
|
-
|
|
718
|
+
k.Classic.categoryStyles = {
|
|
719
719
|
calc_category: {
|
|
720
720
|
colour: "#757575"
|
|
721
721
|
},
|
|
@@ -765,9 +765,9 @@ C.Classic.categoryStyles = {
|
|
|
765
765
|
colour: "#a55b80"
|
|
766
766
|
}
|
|
767
767
|
};
|
|
768
|
-
const de =
|
|
768
|
+
const de = x.defineTheme("light", {
|
|
769
769
|
name: "light",
|
|
770
|
-
base:
|
|
770
|
+
base: k.Classic,
|
|
771
771
|
componentStyles: {
|
|
772
772
|
workspaceBackgroundColour: "#ffffff",
|
|
773
773
|
toolboxBackgroundColour: "#eeeeee",
|
|
@@ -781,9 +781,9 @@ const de = P.defineTheme("light", {
|
|
|
781
781
|
scrollbarOpacity: 0.4,
|
|
782
782
|
cursorColour: ""
|
|
783
783
|
}
|
|
784
|
-
}), ge =
|
|
784
|
+
}), ge = x.defineTheme("dark", {
|
|
785
785
|
name: "dark",
|
|
786
|
-
base:
|
|
786
|
+
base: k.Classic,
|
|
787
787
|
componentStyles: {
|
|
788
788
|
workspaceBackgroundColour: "#1e1e1e",
|
|
789
789
|
toolboxBackgroundColour: "#272727",
|
|
@@ -852,17 +852,18 @@ const Oe = {
|
|
|
852
852
|
}, Ce = {
|
|
853
853
|
kind: "categoryToolbox",
|
|
854
854
|
contents: [Oe, be]
|
|
855
|
-
}, me = { class: "position-relative w-100 h-100" }, ke = /* @__PURE__ */
|
|
855
|
+
}, me = { class: "position-relative w-100 h-100" }, ke = /* @__PURE__ */ A({
|
|
856
856
|
__name: "index",
|
|
857
857
|
props: {
|
|
858
858
|
type: {},
|
|
859
|
-
version: {}
|
|
859
|
+
version: {},
|
|
860
|
+
active: { type: Boolean }
|
|
860
861
|
},
|
|
861
862
|
emits: ["ready", "change"],
|
|
862
863
|
setup(t, { emit: e }) {
|
|
863
|
-
const n =
|
|
864
|
-
let
|
|
865
|
-
const
|
|
864
|
+
const n = J(), { locale: o, dark: r } = H(n), { open: s } = j("blocklyEditorFlyout"), a = t, l = e, c = N();
|
|
865
|
+
let y;
|
|
866
|
+
const E = {
|
|
866
867
|
grid: {
|
|
867
868
|
length: 2,
|
|
868
869
|
snap: !0,
|
|
@@ -875,7 +876,7 @@ const Oe = {
|
|
|
875
876
|
wheel: !0
|
|
876
877
|
},
|
|
877
878
|
readOnly: !1,
|
|
878
|
-
theme:
|
|
879
|
+
theme: r.value ? "dark" : "light",
|
|
879
880
|
trashcan: !1,
|
|
880
881
|
zoom: {
|
|
881
882
|
maxScale: 1,
|
|
@@ -885,44 +886,41 @@ const Oe = {
|
|
|
885
886
|
wheel: !0
|
|
886
887
|
}
|
|
887
888
|
};
|
|
888
|
-
|
|
889
|
-
if (!
|
|
889
|
+
D(async () => {
|
|
890
|
+
if (!c.value)
|
|
890
891
|
return;
|
|
891
|
-
await
|
|
892
|
+
await P(o.value);
|
|
892
893
|
let _;
|
|
893
|
-
|
|
894
|
+
a.type === "app" && a.version === "v1" && (_ = Ce), E.toolbox = _, y = oe(c.value, E), y.addChangeListener(d.disableOrphans), y.addChangeListener(F), setTimeout(() => {
|
|
895
|
+
S(), l("ready", y);
|
|
896
|
+
}, 1);
|
|
897
|
+
}), M(() => {
|
|
898
|
+
s.value = !1;
|
|
894
899
|
});
|
|
895
|
-
function
|
|
896
|
-
|
|
900
|
+
function S() {
|
|
901
|
+
y && ne(y);
|
|
897
902
|
}
|
|
898
|
-
function
|
|
903
|
+
function F(_) {
|
|
899
904
|
l("change", _);
|
|
900
905
|
}
|
|
901
|
-
return
|
|
902
|
-
|
|
903
|
-
}),
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
()
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
), k(
|
|
912
|
-
() => o.current.value.dark,
|
|
913
|
-
(_) => {
|
|
914
|
-
he(_ ? "dark" : "light");
|
|
915
|
-
}
|
|
916
|
-
), (_, m) => {
|
|
906
|
+
return C(o, (_) => {
|
|
907
|
+
P(_);
|
|
908
|
+
}), C(r, (_) => {
|
|
909
|
+
he(_ ? "dark" : "light");
|
|
910
|
+
}), C(s, (_) => {
|
|
911
|
+
var T;
|
|
912
|
+
_ || (T = y.getToolbox()) == null || T.clearSelection();
|
|
913
|
+
}), C(() => a.active, (_) => {
|
|
914
|
+
_ && setTimeout(() => S(), 0);
|
|
915
|
+
}), (_, T) => {
|
|
917
916
|
const w = V("resize");
|
|
918
917
|
return U(), Y("div", me, [
|
|
919
918
|
G(W("div", {
|
|
920
919
|
class: "w-100 h-100",
|
|
921
920
|
ref_key: "blocklyDiv",
|
|
922
|
-
ref:
|
|
923
|
-
id: "blocklyEditor"
|
|
921
|
+
ref: c
|
|
924
922
|
}, null, 512), [
|
|
925
|
-
[w,
|
|
923
|
+
[w, S]
|
|
926
924
|
])
|
|
927
925
|
]);
|
|
928
926
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const _ = {
|
|
2
|
+
LOGIC_BOOLEAN_FALSE: "假",
|
|
3
|
+
LOGIC_BOOLEAN_TRUE: "真",
|
|
4
|
+
LOGIC_DO: "执行",
|
|
5
|
+
LOGIC_ELSE: "否则",
|
|
6
|
+
LOGIC_ELSE_IF: "否则如果",
|
|
7
|
+
LOGIC_IF: "如果"
|
|
8
|
+
}, L = {
|
|
9
|
+
LOGIC_V1_BOOLEAN_TOOPTIP: "LOGIC_V1_BOOLEAN_TOOPTIP",
|
|
10
|
+
LOGIC_V1_BOOLEAN_HELPURL: "LOGIC_V1_BOOLEAN_HELPURL",
|
|
11
|
+
LOGIC_V1_IF_TOOLTIP: "LOGIC_V1_IF_TOOLTIP",
|
|
12
|
+
LOGIC_V1_IF_HELPURL: "LOGIC_V1_IF_HELPURL"
|
|
13
|
+
}, O = {
|
|
14
|
+
..._,
|
|
15
|
+
...L
|
|
16
|
+
}, I = {
|
|
17
|
+
LOOP_DO: "执行"
|
|
18
|
+
}, E = {
|
|
19
|
+
LOOP_V1_FOR_TITLE: "变量%1从%2数到%3每次增加%4",
|
|
20
|
+
LOOP_V1_FOR_EACH_TITLE: "遍历列表%2中的每一项%1",
|
|
21
|
+
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: "当条件满足时重复",
|
|
22
|
+
LOOP_V1_WHILE_UNTIL_OPERATOR_UNTIL: "重复直到条件满足",
|
|
23
|
+
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: "LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE",
|
|
24
|
+
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: "LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL",
|
|
25
|
+
LOOP_V1_WHILE_UNTIL_HELPURL: "LOOP_V1_WHILE_UNTIL_HELPURL"
|
|
26
|
+
}, T = {
|
|
27
|
+
...I,
|
|
28
|
+
...E
|
|
29
|
+
}, P = {
|
|
30
|
+
...O,
|
|
31
|
+
...T
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
P as default
|
|
35
|
+
};
|
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.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"*": "prettier --write ."
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
+
"axios": "^1.7.2",
|
|
25
26
|
"blockly": "^11.1.1",
|
|
26
27
|
"vue": "^3.4.31",
|
|
27
28
|
"vuetify": "^3.6.12",
|
|
28
|
-
"x-essential-lib": "^0.6.
|
|
29
|
+
"x-essential-lib": "^0.6.2"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@rushstack/eslint-patch": "^1.10.3",
|
package/dist/en-c75t6n0y.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const _ = {
|
|
2
|
-
LOGIC_BOOLEAN_FALSE: "false",
|
|
3
|
-
LOGIC_BOOLEAN_TRUE: "true",
|
|
4
|
-
LOGIC_DO: "do",
|
|
5
|
-
LOGIC_ELSE: "else",
|
|
6
|
-
LOGIC_ELSE_IF: "else if",
|
|
7
|
-
LOGIC_IF: "if",
|
|
8
|
-
LOGIC_V1_BOOLEAN_TOOPTIP: "LOGIC_V1_BOOLEAN_TOOPTIP",
|
|
9
|
-
LOGIC_V1_BOOLEAN_HELPURL: "LOGIC_V1_BOOLEAN_HELPURL",
|
|
10
|
-
LOGIC_V1_IF_TOOLTIP: "LOGIC_V1_IF_TOOLTIP",
|
|
11
|
-
LOGIC_V1_IF_HELPURL: "LOGIC_V1_IF_HELPURL"
|
|
12
|
-
}, L = {
|
|
13
|
-
LOOP_DO: "do",
|
|
14
|
-
LOOP_V1_FOR_TITLE: "count with %1 from %2 to %3 by %4",
|
|
15
|
-
LOOP_V1_FOR_EACH_TITLE: "for each item %1 in list %2",
|
|
16
|
-
LOOP_V1_WHILE_UNTIL_OPERATOR_WHILE: "repeat while",
|
|
17
|
-
LOOP_V1_WHILE_UNTIL_OPERATOR_UNTIL: "repeat until",
|
|
18
|
-
LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE: "LOOP_V1_WHILE_UNTIL_TOOLTIP_WHILE",
|
|
19
|
-
LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL: "LOOP_V1_WHILE_UNTIL_TOOLTIP_UNTIL",
|
|
20
|
-
LOOP_V1_WHILE_UNTIL_HELPURL: "LOOP_V1_WHILE_UNTIL_HELPURL"
|
|
21
|
-
}, O = {
|
|
22
|
-
..._,
|
|
23
|
-
...L
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
O as default
|
|
27
|
-
};
|