x-block-lib 0.2.3 → 0.3.0
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/index.js +120 -131
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");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 {
|
|
3
|
-
import { openConfirmDlg as B, openPromptDlg as R, useViewStack as x } from "x-essential-lib";
|
|
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 { openConfirmDlg as b, openPromptDlg as m, useViewStack as C } from "x-essential-lib";
|
|
4
3
|
import * as e from "blockly/core";
|
|
5
|
-
import { javascriptGenerator as
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { javascriptGenerator as k, Order as S } from "blockly/javascript";
|
|
5
|
+
const T = Vue.getCurrentInstance;
|
|
6
|
+
function L(o, t) {
|
|
7
|
+
const n = T();
|
|
8
8
|
if (!n)
|
|
9
9
|
throw new Error(`[Vuetify] ${o} must be called from inside a setup function`);
|
|
10
10
|
return n;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Vue.computed;
|
|
13
|
+
const E = Vue.inject;
|
|
14
|
+
Vue.provide;
|
|
15
|
+
Vue.ref;
|
|
16
|
+
const v = Symbol.for("vuetify:locale");
|
|
17
|
+
function I() {
|
|
18
|
+
const o = E(v);
|
|
15
19
|
if (!o)
|
|
16
20
|
throw new Error("[Vuetify] Could not find injected locale instance");
|
|
17
21
|
return o;
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
Vue.computed;
|
|
24
|
+
const B = Vue.inject;
|
|
25
|
+
Vue.provide;
|
|
26
|
+
Vue.ref;
|
|
27
|
+
Vue.watch;
|
|
28
|
+
Vue.watchEffect;
|
|
29
|
+
const R = Symbol.for("vuetify:theme");
|
|
30
|
+
function x() {
|
|
31
|
+
L("useTheme");
|
|
32
|
+
const o = B(R, null);
|
|
23
33
|
if (!o)
|
|
24
34
|
throw new Error("Could not find Vuetify theme injection");
|
|
25
35
|
return o;
|
|
@@ -44,10 +54,10 @@ e.defineBlocksWithJsonArray([
|
|
|
44
54
|
helpUrl: "%{BKY_LOGIC_V1_BOOLEAN_HELPURL}"
|
|
45
55
|
}
|
|
46
56
|
]);
|
|
47
|
-
|
|
48
|
-
return [o.getFieldValue("BOOL") === "TRUE" ? "true" : "false",
|
|
57
|
+
k.forBlock.boolean_v1 = function(o) {
|
|
58
|
+
return [o.getFieldValue("BOOL") === "TRUE" ? "true" : "false", S.ATOMIC];
|
|
49
59
|
};
|
|
50
|
-
const
|
|
60
|
+
const P = {
|
|
51
61
|
elseIfCount_: 0,
|
|
52
62
|
hasElse_: !1,
|
|
53
63
|
mutationToDom: function() {
|
|
@@ -145,8 +155,8 @@ const N = {
|
|
|
145
155
|
let n = null;
|
|
146
156
|
this.getInput("ELSE") && (n = this.getInput("ELSE").connection.targetConnection);
|
|
147
157
|
for (let r = 1; this.getInput("IF" + r); r++) {
|
|
148
|
-
const s = this.getInput("IF" + r),
|
|
149
|
-
o.push(s.connection.targetConnection), t.push(
|
|
158
|
+
const s = this.getInput("IF" + r), l = this.getInput("DO" + r);
|
|
159
|
+
o.push(s.connection.targetConnection), t.push(l.connection.targetConnection);
|
|
150
160
|
}
|
|
151
161
|
this.updateShape_(), this.reconnectChildBlocks_(
|
|
152
162
|
o,
|
|
@@ -164,14 +174,14 @@ const N = {
|
|
|
164
174
|
},
|
|
165
175
|
reconnectChildBlocks_: function(o, t, n) {
|
|
166
176
|
var r, s;
|
|
167
|
-
for (let
|
|
168
|
-
(r = o[
|
|
177
|
+
for (let l = 1; l <= this.elseIfCount_; l++)
|
|
178
|
+
(r = o[l]) == null || r.reconnect(this, "IF" + l), (s = t[l]) == null || s.reconnect(this, "DO" + l);
|
|
169
179
|
n == null || n.reconnect(this, "ELSE");
|
|
170
180
|
}
|
|
171
181
|
};
|
|
172
182
|
e.Extensions.registerMutator(
|
|
173
183
|
"if_v1_mutator",
|
|
174
|
-
|
|
184
|
+
P,
|
|
175
185
|
void 0,
|
|
176
186
|
["if_else_if_v1", "if_else_v1"]
|
|
177
187
|
);
|
|
@@ -223,7 +233,7 @@ e.defineBlocksWithJsonArray([
|
|
|
223
233
|
style: "logic_blocks"
|
|
224
234
|
}
|
|
225
235
|
]);
|
|
226
|
-
const
|
|
236
|
+
const w = {
|
|
227
237
|
customContextMenu: function(o) {
|
|
228
238
|
if (this.isInFlyout)
|
|
229
239
|
return;
|
|
@@ -245,7 +255,7 @@ const V = {
|
|
|
245
255
|
};
|
|
246
256
|
e.Extensions.registerMixin(
|
|
247
257
|
"contextMenu_newGetVariableBlock_v1",
|
|
248
|
-
|
|
258
|
+
w
|
|
249
259
|
);
|
|
250
260
|
e.Extensions.register(
|
|
251
261
|
"flow_control_tooltip_v1",
|
|
@@ -254,16 +264,16 @@ e.Extensions.register(
|
|
|
254
264
|
CONTINUE: "%{BKY_LOOP_V1_FLOW_CONTROL_TOOLTIP_CONTINUE}"
|
|
255
265
|
})
|
|
256
266
|
);
|
|
257
|
-
const
|
|
267
|
+
const V = /* @__PURE__ */ new Set([
|
|
258
268
|
"repeat_v1",
|
|
259
269
|
"for_each_v1",
|
|
260
270
|
"for_v1",
|
|
261
271
|
"while_until_v1"
|
|
262
|
-
]),
|
|
272
|
+
]), F = {
|
|
263
273
|
getSurroundLoop: function() {
|
|
264
274
|
let o = this;
|
|
265
275
|
do {
|
|
266
|
-
if (
|
|
276
|
+
if (V.has(o.type))
|
|
267
277
|
return !0;
|
|
268
278
|
o = o == null ? void 0 : o.getSurroundParent();
|
|
269
279
|
} while (o);
|
|
@@ -286,7 +296,7 @@ const U = /* @__PURE__ */ new Set([
|
|
|
286
296
|
};
|
|
287
297
|
e.Extensions.registerMixin(
|
|
288
298
|
"flow_control_in_loop_check_v1",
|
|
289
|
-
|
|
299
|
+
F
|
|
290
300
|
);
|
|
291
301
|
e.defineBlocksWithJsonArray([
|
|
292
302
|
{
|
|
@@ -438,30 +448,30 @@ e.defineBlocksWithJsonArray([
|
|
|
438
448
|
}
|
|
439
449
|
]);
|
|
440
450
|
e.dialog.setConfirm(async (o, t) => {
|
|
441
|
-
const n = await
|
|
451
|
+
const n = await b({
|
|
442
452
|
title: "",
|
|
443
453
|
text: o
|
|
444
454
|
});
|
|
445
455
|
t(!!n);
|
|
446
456
|
});
|
|
447
457
|
e.dialog.setPrompt(async (o, t, n) => {
|
|
448
|
-
const r = await
|
|
458
|
+
const r = await m({
|
|
449
459
|
title: "",
|
|
450
460
|
value: t
|
|
451
461
|
});
|
|
452
462
|
n(r);
|
|
453
463
|
});
|
|
454
|
-
const
|
|
464
|
+
const M = (o, t) => {
|
|
455
465
|
const n = o[t];
|
|
456
466
|
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((r, s) => {
|
|
457
467
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(s.bind(null, new Error("Unknown variable dynamic import: " + t)));
|
|
458
468
|
});
|
|
459
469
|
};
|
|
460
470
|
async function f(o) {
|
|
461
|
-
const t = await
|
|
471
|
+
const t = await M(/* @__PURE__ */ Object.assign({ "./msg/en.ts": () => import("./en-Djut8W3R.js"), "./msg/zhHans.ts": () => import("./zhHans-D_qcn_1f.js") }), `./msg/${o}.ts`);
|
|
462
472
|
e.setLocale(t.default);
|
|
463
473
|
}
|
|
464
|
-
class
|
|
474
|
+
class K {
|
|
465
475
|
init({ contextMenu: t = !0, shortcut: n = !0 } = {
|
|
466
476
|
contextMenu: !0,
|
|
467
477
|
shortcut: !0
|
|
@@ -502,12 +512,12 @@ class G {
|
|
|
502
512
|
return e.Msg.CROSS_TAB_PASTE ? e.Msg.CROSS_TAB_PASTE : "Paste";
|
|
503
513
|
},
|
|
504
514
|
preconditionFn: function(n) {
|
|
505
|
-
var
|
|
515
|
+
var l;
|
|
506
516
|
const r = localStorage.getItem("blocklyStash");
|
|
507
517
|
if (!r)
|
|
508
518
|
return "disabled";
|
|
509
519
|
const s = JSON.parse(r);
|
|
510
|
-
return !s || !((
|
|
520
|
+
return !s || !((l = n.workspace) != null && l.isCapacityAvailable(s.typeCounts)) ? "disabled" : "enabled";
|
|
511
521
|
},
|
|
512
522
|
callback: function(n) {
|
|
513
523
|
const r = localStorage.getItem("blocklyStash");
|
|
@@ -534,19 +544,19 @@ class G {
|
|
|
534
544
|
[e.utils.KeyCodes.META]
|
|
535
545
|
), s = {
|
|
536
546
|
name: "copy",
|
|
537
|
-
preconditionFn: function(
|
|
538
|
-
if (
|
|
547
|
+
preconditionFn: function(l) {
|
|
548
|
+
if (l.options.readOnly || e.Gesture.inProgress())
|
|
539
549
|
return !1;
|
|
540
550
|
const a = e.getSelected();
|
|
541
551
|
return !(!a || !e.isDeletable(a) || !a.isDeletable() || !e.isDraggable(a) || !a.isMovable() || !e.isCopyable(a));
|
|
542
552
|
},
|
|
543
|
-
callback: function(
|
|
553
|
+
callback: function(l, a) {
|
|
544
554
|
a.preventDefault();
|
|
545
|
-
const
|
|
546
|
-
if (!
|
|
555
|
+
const i = e.getSelected();
|
|
556
|
+
if (!i || !e.isCopyable(i))
|
|
547
557
|
return !1;
|
|
548
|
-
const c =
|
|
549
|
-
return c ? (
|
|
558
|
+
const c = i.toCopyData();
|
|
559
|
+
return c ? (l.hideChaff(), localStorage.setItem("blocklyStash", JSON.stringify(c)), !0) : !1;
|
|
550
560
|
},
|
|
551
561
|
keyCodes: [t, n, r]
|
|
552
562
|
};
|
|
@@ -564,19 +574,19 @@ class G {
|
|
|
564
574
|
[e.utils.KeyCodes.META]
|
|
565
575
|
), s = {
|
|
566
576
|
name: "cut",
|
|
567
|
-
preconditionFn: function(
|
|
568
|
-
if (
|
|
577
|
+
preconditionFn: function(l) {
|
|
578
|
+
if (l.options.readOnly || e.Gesture.inProgress())
|
|
569
579
|
return !1;
|
|
570
580
|
const a = e.getSelected();
|
|
571
581
|
return !(!a || !e.isDeletable(a) || !a.isDeletable() || !e.isDraggable(a) || !a.isMovable() || !e.isCopyable(a) || a.workspace.isFlyout);
|
|
572
582
|
},
|
|
573
|
-
callback: function(
|
|
583
|
+
callback: function(l, a) {
|
|
574
584
|
a.preventDefault();
|
|
575
|
-
const
|
|
576
|
-
if (!
|
|
585
|
+
const i = e.getSelected();
|
|
586
|
+
if (!i || !e.isDeletable(i) || !i.isDeletable() || !e.isCopyable(i))
|
|
577
587
|
return !1;
|
|
578
|
-
const c =
|
|
579
|
-
return c ? (localStorage.setItem("blocklyStash", JSON.stringify(c)),
|
|
588
|
+
const c = i.toCopyData();
|
|
589
|
+
return c ? (localStorage.setItem("blocklyStash", JSON.stringify(c)), i instanceof e.BlockSvg ? i.checkAndDelete() : i.dispose(), !0) : !1;
|
|
580
590
|
},
|
|
581
591
|
keyCodes: [t, n, r]
|
|
582
592
|
};
|
|
@@ -594,29 +604,29 @@ class G {
|
|
|
594
604
|
[e.utils.KeyCodes.META]
|
|
595
605
|
), s = {
|
|
596
606
|
name: "paste",
|
|
597
|
-
preconditionFn: function(
|
|
598
|
-
if (
|
|
607
|
+
preconditionFn: function(l) {
|
|
608
|
+
if (l.options.readOnly || e.Gesture.inProgress())
|
|
599
609
|
return !1;
|
|
600
610
|
const a = localStorage.getItem("blocklyStash");
|
|
601
611
|
if (!a)
|
|
602
612
|
return !1;
|
|
603
|
-
const
|
|
604
|
-
return !(!
|
|
613
|
+
const i = JSON.parse(a);
|
|
614
|
+
return !(!i || !l.isCapacityAvailable(i.typeCounts));
|
|
605
615
|
},
|
|
606
|
-
callback: function(
|
|
616
|
+
callback: function(l, a) {
|
|
607
617
|
a.preventDefault();
|
|
608
|
-
const
|
|
609
|
-
if (!
|
|
618
|
+
const i = localStorage.getItem("blocklyStash");
|
|
619
|
+
if (!i)
|
|
610
620
|
return !1;
|
|
611
|
-
const c = JSON.parse(
|
|
612
|
-
return c ? (e.clipboard.paste(c,
|
|
621
|
+
const c = JSON.parse(i);
|
|
622
|
+
return c ? (e.clipboard.paste(c, l), !0) : !1;
|
|
613
623
|
},
|
|
614
624
|
keyCodes: [t, n, r]
|
|
615
625
|
};
|
|
616
626
|
e.ShortcutRegistry.registry.register(s);
|
|
617
627
|
}
|
|
618
628
|
}
|
|
619
|
-
class
|
|
629
|
+
class A {
|
|
620
630
|
init() {
|
|
621
631
|
const t = e.ContextMenuRegistry.registry.getItem("cleanWorkspace");
|
|
622
632
|
t && (t.callback = function(n) {
|
|
@@ -625,31 +635,31 @@ class H {
|
|
|
625
635
|
return;
|
|
626
636
|
r.setResizesEnabled(!1), e.Events.setGroup(!0);
|
|
627
637
|
const s = r.getTopBlocks(!0);
|
|
628
|
-
let
|
|
629
|
-
for (let a = 0,
|
|
630
|
-
if (!
|
|
638
|
+
let l = 0;
|
|
639
|
+
for (let a = 0, i; i = s[a]; a++) {
|
|
640
|
+
if (!i.isMovable())
|
|
631
641
|
continue;
|
|
632
|
-
const c =
|
|
633
|
-
|
|
642
|
+
const c = i.getRelativeToSurfaceXY();
|
|
643
|
+
i.moveBy(-c.x, l - c.y, ["cleanup"]), i.snapToGrid(), l = i.getRelativeToSurfaceXY().y + i.getHeightWidth().height + 100;
|
|
634
644
|
}
|
|
635
645
|
e.Events.setGroup(!1), r.setResizesEnabled(!0);
|
|
636
646
|
});
|
|
637
647
|
}
|
|
638
648
|
}
|
|
639
|
-
function
|
|
649
|
+
function d(o) {
|
|
640
650
|
const t = o.getParent();
|
|
641
|
-
return t &&
|
|
651
|
+
return t && d(t) ? !0 : !t && !!(o.outputConnection || o.previousConnection);
|
|
642
652
|
}
|
|
643
|
-
class
|
|
653
|
+
class D {
|
|
644
654
|
init() {
|
|
645
655
|
const t = e.ContextMenuRegistry.registry.getItem("blockDisable");
|
|
646
656
|
t && (t.preconditionFn = function(n) {
|
|
647
657
|
const r = n.block;
|
|
648
|
-
return r && !r.isInFlyout && r.workspace.options.disable && r.isEditable() ? r.getInheritedDisabled() ||
|
|
658
|
+
return r && !r.isInFlyout && r.workspace.options.disable && r.isEditable() ? r.getInheritedDisabled() || d(r) ? "disabled" : "enabled" : "hidden";
|
|
649
659
|
});
|
|
650
660
|
}
|
|
651
661
|
}
|
|
652
|
-
class
|
|
662
|
+
class N extends e.HorizontalFlyout {
|
|
653
663
|
addBlockListeners_(t, n, r) {
|
|
654
664
|
e.getMainWorkspace().options.readOnly || super.addBlockListeners_(t, n, r);
|
|
655
665
|
}
|
|
@@ -657,7 +667,7 @@ class X extends e.HorizontalFlyout {
|
|
|
657
667
|
return e.getMainWorkspace().options.readOnly ? !1 : super.isBlockCreatable(t);
|
|
658
668
|
}
|
|
659
669
|
}
|
|
660
|
-
class
|
|
670
|
+
class U extends e.VerticalFlyout {
|
|
661
671
|
addBlockListeners_(t, n, r) {
|
|
662
672
|
e.getMainWorkspace().options.readOnly || super.addBlockListeners_(t, n, r);
|
|
663
673
|
}
|
|
@@ -665,22 +675,22 @@ class J extends e.VerticalFlyout {
|
|
|
665
675
|
return e.getMainWorkspace().options.readOnly ? !1 : super.isBlockCreatable(t);
|
|
666
676
|
}
|
|
667
677
|
}
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
|
|
678
|
+
const Y = new K();
|
|
679
|
+
Y.init({ contextMenu: !0, shortcut: !0 });
|
|
680
|
+
const W = new A();
|
|
681
|
+
W.init();
|
|
682
|
+
const G = new D();
|
|
683
|
+
G.init();
|
|
674
684
|
e.registry.register(
|
|
675
685
|
e.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,
|
|
676
686
|
e.registry.DEFAULT,
|
|
677
|
-
|
|
687
|
+
N,
|
|
678
688
|
!0
|
|
679
689
|
);
|
|
680
690
|
e.registry.register(
|
|
681
691
|
e.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,
|
|
682
692
|
e.registry.DEFAULT,
|
|
683
|
-
|
|
693
|
+
U,
|
|
684
694
|
!0
|
|
685
695
|
);
|
|
686
696
|
e.Themes.Classic.blockStyles = {
|
|
@@ -807,7 +817,7 @@ e.Themes.Classic.categoryStyles = {
|
|
|
807
817
|
colour: "#a55b80"
|
|
808
818
|
}
|
|
809
819
|
};
|
|
810
|
-
const
|
|
820
|
+
const H = e.Theme.defineTheme("light", {
|
|
811
821
|
name: "light",
|
|
812
822
|
base: e.Themes.Classic,
|
|
813
823
|
componentStyles: {
|
|
@@ -823,7 +833,7 @@ const Z = e.Theme.defineTheme("light", {
|
|
|
823
833
|
scrollbarOpacity: 0.4,
|
|
824
834
|
cursorColour: ""
|
|
825
835
|
}
|
|
826
|
-
}),
|
|
836
|
+
}), z = e.Theme.defineTheme("dark", {
|
|
827
837
|
name: "dark",
|
|
828
838
|
base: e.Themes.Classic,
|
|
829
839
|
componentStyles: {
|
|
@@ -840,18 +850,18 @@ const Z = e.Theme.defineTheme("light", {
|
|
|
840
850
|
cursorColour: ""
|
|
841
851
|
}
|
|
842
852
|
});
|
|
843
|
-
function
|
|
853
|
+
function X(o) {
|
|
844
854
|
const t = e.getMainWorkspace();
|
|
845
855
|
switch (console.log(t), o) {
|
|
846
856
|
case "light":
|
|
847
|
-
t.setTheme(
|
|
857
|
+
t.setTheme(H);
|
|
848
858
|
break;
|
|
849
859
|
case "dark":
|
|
850
|
-
t.setTheme(
|
|
860
|
+
t.setTheme(z);
|
|
851
861
|
break;
|
|
852
862
|
}
|
|
853
863
|
}
|
|
854
|
-
const
|
|
864
|
+
const J = {
|
|
855
865
|
kind: "category",
|
|
856
866
|
name: "%{BKY_CATEGORY_LOGIC}",
|
|
857
867
|
categorystyle: "logic_category",
|
|
@@ -869,7 +879,7 @@ const te = {
|
|
|
869
879
|
type: "if_v1"
|
|
870
880
|
}
|
|
871
881
|
]
|
|
872
|
-
},
|
|
882
|
+
}, j = {
|
|
873
883
|
kind: "category",
|
|
874
884
|
name: "%{BKY_CATEGORY_LOOP}",
|
|
875
885
|
categorystyle: "loop_category",
|
|
@@ -891,34 +901,10 @@ const te = {
|
|
|
891
901
|
type: "for_each_v1"
|
|
892
902
|
}
|
|
893
903
|
]
|
|
894
|
-
},
|
|
904
|
+
}, $ = {
|
|
895
905
|
kind: "categoryToolbox",
|
|
896
|
-
contents: [
|
|
897
|
-
}
|
|
898
|
-
function re(o, t) {
|
|
899
|
-
var s, i;
|
|
900
|
-
const n = t.value, r = {
|
|
901
|
-
passive: !((s = t.modifiers) != null && s.active)
|
|
902
|
-
};
|
|
903
|
-
window.addEventListener("resize", n, r), o._onResize = Object(o._onResize), o._onResize[t.instance.$.uid] = {
|
|
904
|
-
handler: n,
|
|
905
|
-
options: r
|
|
906
|
-
}, (i = t.modifiers) != null && i.quiet || n();
|
|
907
|
-
}
|
|
908
|
-
function se(o, t) {
|
|
909
|
-
var s;
|
|
910
|
-
if (!((s = o._onResize) != null && s[t.instance.$.uid]))
|
|
911
|
-
return;
|
|
912
|
-
const {
|
|
913
|
-
handler: n,
|
|
914
|
-
options: r
|
|
915
|
-
} = o._onResize[t.instance.$.uid];
|
|
916
|
-
window.removeEventListener("resize", n, r), delete o._onResize[t.instance.$.uid];
|
|
917
|
-
}
|
|
918
|
-
const ie = {
|
|
919
|
-
mounted: re,
|
|
920
|
-
unmounted: se
|
|
921
|
-
}, le = { class: "position-relative w-100 h-100" }, ae = /* @__PURE__ */ m({
|
|
906
|
+
contents: [J, j]
|
|
907
|
+
}, q = Vue.defineComponent, Z = Vue.resolveDirective, Q = Vue.createElementVNode, ee = Vue.withDirectives, te = Vue.openBlock, oe = Vue.createElementBlock, ne = { class: "position-relative w-100 h-100" }, re = Vue.nextTick, se = Vue.onBeforeUnmount, ie = Vue.onMounted, le = Vue.ref, y = Vue.watch, ae = /* @__PURE__ */ q({
|
|
922
908
|
__name: "index",
|
|
923
909
|
props: {
|
|
924
910
|
type: {},
|
|
@@ -926,7 +912,7 @@ const ie = {
|
|
|
926
912
|
},
|
|
927
913
|
emits: ["ready", "change"],
|
|
928
914
|
setup(o, { emit: t }) {
|
|
929
|
-
const n =
|
|
915
|
+
const n = I(), r = x(), { open: s } = C("blocklyEditorFlyout"), l = o, a = t, i = le(null);
|
|
930
916
|
let c;
|
|
931
917
|
const p = {
|
|
932
918
|
grid: {
|
|
@@ -951,20 +937,20 @@ const ie = {
|
|
|
951
937
|
wheel: !0
|
|
952
938
|
}
|
|
953
939
|
};
|
|
954
|
-
|
|
955
|
-
if (!
|
|
940
|
+
ie(async () => {
|
|
941
|
+
if (!i.value)
|
|
956
942
|
return;
|
|
957
943
|
await f(n.current.value);
|
|
958
944
|
let u;
|
|
959
|
-
|
|
945
|
+
l.type === "app" && l.version === "v1" && (u = $), p.toolbox = u, c = e.inject(i.value, p), c.addChangeListener(e.Events.disableOrphans), c.addChangeListener(h), await re(), a("ready", c);
|
|
960
946
|
});
|
|
961
|
-
function
|
|
947
|
+
function g() {
|
|
962
948
|
c && e.svgResize(c);
|
|
963
949
|
}
|
|
964
|
-
function
|
|
950
|
+
function h(u) {
|
|
965
951
|
a("change", u);
|
|
966
952
|
}
|
|
967
|
-
return
|
|
953
|
+
return se(() => {
|
|
968
954
|
s.value = !1;
|
|
969
955
|
}), y(s, (u) => {
|
|
970
956
|
var _;
|
|
@@ -977,22 +963,25 @@ const ie = {
|
|
|
977
963
|
), y(
|
|
978
964
|
() => r.current.value.dark,
|
|
979
965
|
(u) => {
|
|
980
|
-
|
|
966
|
+
X(u ? "dark" : "light");
|
|
981
967
|
}
|
|
982
|
-
), (u, _) =>
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
968
|
+
), (u, _) => {
|
|
969
|
+
const O = Z("resize");
|
|
970
|
+
return te(), oe("div", ne, [
|
|
971
|
+
ee(Q("div", {
|
|
972
|
+
class: "w-100 h-100",
|
|
973
|
+
ref_key: "blocklyDiv",
|
|
974
|
+
ref: i,
|
|
975
|
+
id: "blocklyEditor"
|
|
976
|
+
}, null, 512), [
|
|
977
|
+
[O, g]
|
|
978
|
+
])
|
|
979
|
+
]);
|
|
980
|
+
};
|
|
992
981
|
}
|
|
993
982
|
}), ce = (o) => {
|
|
994
983
|
o.component("x-blockly", ae);
|
|
995
|
-
},
|
|
984
|
+
}, ye = { install: ce };
|
|
996
985
|
export {
|
|
997
|
-
|
|
986
|
+
ye as default
|
|
998
987
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-block-lib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"blockly": "^11.1.0",
|
|
26
26
|
"vue": "^3.4.27",
|
|
27
27
|
"vuetify": "^3.6.8",
|
|
28
|
-
"x-essential-lib": "^0.
|
|
28
|
+
"x-essential-lib": "^0.4.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"typescript": "^5.2.2",
|
|
46
46
|
"vite": "^5.2.0",
|
|
47
47
|
"vite-plugin-css-injected-by-js": "^3.5.0",
|
|
48
|
+
"vite-plugin-externals": "^0.6.2",
|
|
48
49
|
"vite-plugin-vuetify": "^2.0.3",
|
|
49
50
|
"vue-i18n": "^9.13.1",
|
|
50
51
|
"vue-tsc": "^2.0.6"
|