x-block-lib 0.1.5 → 0.2.1
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 +15 -2
- package/dist/core/blocks/index.d.ts +1 -0
- package/dist/core/blocks/logic/index.d.ts +1 -0
- package/dist/{blockly → core}/index.d.ts +3 -1
- package/dist/core/locale/index.d.ts +1 -0
- package/dist/core/locale/msg/en.d.ts +7 -0
- package/dist/core/locale/msg/zhHans.d.ts +7 -0
- package/dist/core/plugins/crossTabCopyPaste/index.d.ts +11 -0
- package/dist/core/plugins/customCleanUp/index.d.ts +3 -0
- package/dist/core/plugins/disableTopBlocks/index.d.ts +3 -0
- package/dist/core/plugins/index.d.ts +1 -0
- package/dist/core/plugins/readOnlyFlyout/index.d.ts +9 -0
- package/dist/core/toolbox/app/v1/index.d.ts +18 -0
- package/dist/core/toolbox/common/logic/v1/index.d.ts +15 -0
- package/dist/core/toolbox/index.d.ts +2 -0
- package/dist/en-CCqtrcN-.js +11 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +373 -383
- package/dist/zhHans---jf3OTZ.js +11 -0
- package/package.json +3 -4
- package/dist/blockly/locale/index.d.ts +0 -1
- package/dist/blockly/locale/msg/en.d.ts +0 -2
- package/dist/blockly/locale/msg/zhHans.d.ts +0 -2
- package/dist/blockly-ByC0ID0H.js +0 -15828
- package/dist/en-DYxpcVy9.js +0 -4
- package/dist/zhHans-DjWw6Iqb.js +0 -4
- /package/dist/{blockly/blocks/downloadAsset → core/blocks/logic/boolean}/v1/index.d.ts +0 -0
- /package/dist/{blockly → core}/dialog/index.d.ts +0 -0
- /package/dist/{blockly → core}/theme/index.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,173 +1,299 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
MarkerManager: Ye,
|
|
53
|
-
Menu: qe,
|
|
54
|
-
MenuItem: Je,
|
|
55
|
-
MetricsManager: Ze,
|
|
56
|
-
Msg: Ke,
|
|
57
|
-
NEXT_STATEMENT: Qe,
|
|
58
|
-
Names: eo,
|
|
59
|
-
OPPOSITE_TYPE: oo,
|
|
60
|
-
OUTPUT_VALUE: ro,
|
|
61
|
-
Options: to,
|
|
62
|
-
PREVIOUS_STATEMENT: ao,
|
|
63
|
-
PROCEDURE_CATEGORY_NAME: co,
|
|
64
|
-
Procedures: no,
|
|
65
|
-
RENAME_VARIABLE_ID: lo,
|
|
66
|
-
RenderedConnection: io,
|
|
67
|
-
Scrollbar: so,
|
|
68
|
-
ScrollbarPair: uo,
|
|
69
|
-
ShortcutItems: yo,
|
|
70
|
-
ShortcutRegistry: mo,
|
|
71
|
-
TOOLBOX_AT_BOTTOM: bo,
|
|
72
|
-
TOOLBOX_AT_LEFT: go,
|
|
73
|
-
TOOLBOX_AT_RIGHT: _o,
|
|
74
|
-
TOOLBOX_AT_TOP: fo,
|
|
75
|
-
TabNavigateCursor: po,
|
|
76
|
-
Theme: b,
|
|
77
|
-
ThemeManager: ho,
|
|
78
|
-
Themes: i,
|
|
79
|
-
Toolbox: ko,
|
|
80
|
-
ToolboxCategory: To,
|
|
81
|
-
ToolboxItem: Co,
|
|
82
|
-
ToolboxSeparator: Eo,
|
|
83
|
-
Tooltip: So,
|
|
84
|
-
Touch: vo,
|
|
85
|
-
Trashcan: Mo,
|
|
86
|
-
UnattachedFieldError: Oo,
|
|
87
|
-
VARIABLE_CATEGORY_NAME: Ao,
|
|
88
|
-
VARIABLE_DYNAMIC_CATEGORY_NAME: Po,
|
|
89
|
-
VERSION: wo,
|
|
90
|
-
VariableMap: Bo,
|
|
91
|
-
VariableModel: Ro,
|
|
92
|
-
Variables: Lo,
|
|
93
|
-
VariablesDynamic: Io,
|
|
94
|
-
VerticalFlyout: xo,
|
|
95
|
-
WidgetDiv: Do,
|
|
96
|
-
Workspace: Fo,
|
|
97
|
-
WorkspaceAudio: Vo,
|
|
98
|
-
WorkspaceDragger: zo,
|
|
99
|
-
WorkspaceSvg: No,
|
|
100
|
-
Xml: Uo,
|
|
101
|
-
ZoomControls: jo,
|
|
102
|
-
blockAnimations: $o,
|
|
103
|
-
blockRendering: Go,
|
|
104
|
-
browserEvents: Wo,
|
|
105
|
-
bubbles: Xo,
|
|
106
|
-
bumpObjects: Ho,
|
|
107
|
-
clipboard: Yo,
|
|
108
|
-
comments: qo,
|
|
109
|
-
common: Jo,
|
|
110
|
-
config: Zo,
|
|
111
|
-
constants: Ko,
|
|
112
|
-
defineBlocksWithJsonArray: Qo,
|
|
113
|
-
dialog: g,
|
|
114
|
-
dragging: er,
|
|
115
|
-
fieldRegistry: or,
|
|
116
|
-
geras: rr,
|
|
117
|
-
getMainWorkspace: I,
|
|
118
|
-
getSelected: tr,
|
|
119
|
-
hasBubble: ar,
|
|
120
|
-
hideChaff: cr,
|
|
121
|
-
icons: nr,
|
|
122
|
-
inject: x,
|
|
123
|
-
inputs: lr,
|
|
124
|
-
isCopyable: ir,
|
|
125
|
-
isDeletable: sr,
|
|
126
|
-
isDraggable: ur,
|
|
127
|
-
isIcon: dr,
|
|
128
|
-
isObservable: yr,
|
|
129
|
-
isPaster: mr,
|
|
130
|
-
isRenderedElement: br,
|
|
131
|
-
isSelectable: gr,
|
|
132
|
-
isSerializable: _r,
|
|
133
|
-
isVariableBackedParameterModel: fr,
|
|
134
|
-
procedures: pr,
|
|
135
|
-
registry: hr,
|
|
136
|
-
renderManagement: kr,
|
|
137
|
-
serialization: Tr,
|
|
138
|
-
setLocale: D,
|
|
139
|
-
setParentContainer: Cr,
|
|
140
|
-
svgResize: F,
|
|
141
|
-
thrasos: Er,
|
|
142
|
-
uiPosition: Sr,
|
|
143
|
-
utils: vr,
|
|
144
|
-
zelos: Mr
|
|
145
|
-
} = h;
|
|
146
|
-
g.setConfirm(async (e, o) => {
|
|
147
|
-
const r = await k({
|
|
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 { getCurrentInstance as C, inject as p, defineComponent as h, ref as k, onMounted as _, nextTick as T, onBeforeUnmount as O, watch as d, openBlock as v, createElementBlock as R, withDirectives as B, createElementVNode as L } from "vue";
|
|
3
|
+
import { openConfirmDlg as w, openPromptDlg as E, useViewStack as x } from "x-essential-lib";
|
|
4
|
+
import * as e from "blockly/core";
|
|
5
|
+
import { javascriptGenerator as M, Order as P } from "blockly/javascript";
|
|
6
|
+
function D(s, t) {
|
|
7
|
+
const o = C();
|
|
8
|
+
if (!o)
|
|
9
|
+
throw new Error(`[Vuetify] ${s} must be called from inside a setup function`);
|
|
10
|
+
return o;
|
|
11
|
+
}
|
|
12
|
+
const K = Symbol.for("vuetify:locale");
|
|
13
|
+
function A() {
|
|
14
|
+
const s = p(K);
|
|
15
|
+
if (!s)
|
|
16
|
+
throw new Error("[Vuetify] Could not find injected locale instance");
|
|
17
|
+
return s;
|
|
18
|
+
}
|
|
19
|
+
const F = Symbol.for("vuetify:theme");
|
|
20
|
+
function I() {
|
|
21
|
+
D("useTheme");
|
|
22
|
+
const s = p(F, null);
|
|
23
|
+
if (!s)
|
|
24
|
+
throw new Error("Could not find Vuetify theme injection");
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
e.defineBlocksWithJsonArray([
|
|
28
|
+
{
|
|
29
|
+
type: "boolean_v1",
|
|
30
|
+
message0: "%1",
|
|
31
|
+
args0: [
|
|
32
|
+
{
|
|
33
|
+
type: "field_dropdown",
|
|
34
|
+
name: "BOOL",
|
|
35
|
+
options: [
|
|
36
|
+
["%{BKY_LOGIC_BOOLEAN_FALSE}", "FALSE"],
|
|
37
|
+
["%{BKY_LOGIC_BOOLEAN_TRUE}", "TRUE"]
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
output: "Boolean",
|
|
42
|
+
style: "logic_blocks",
|
|
43
|
+
tooltip: "%{BKY_LOGIC_V1_BOOLEAN_TOOLTIP}",
|
|
44
|
+
helpUrl: "%{BKY_LOGIC_V1_BOOLEAN_HELPURL}"
|
|
45
|
+
}
|
|
46
|
+
]);
|
|
47
|
+
M.forBlock.boolean_v1 = function(s) {
|
|
48
|
+
return [s.getFieldValue("BOOL") === "TRUE" ? "true" : "false", P.ATOMIC];
|
|
49
|
+
};
|
|
50
|
+
e.dialog.setConfirm(async (s, t) => {
|
|
51
|
+
const o = await w({
|
|
148
52
|
title: "",
|
|
149
|
-
text:
|
|
53
|
+
text: s
|
|
150
54
|
});
|
|
151
|
-
|
|
55
|
+
t(!!o);
|
|
152
56
|
});
|
|
153
|
-
|
|
154
|
-
const
|
|
57
|
+
e.dialog.setPrompt(async (s, t, o) => {
|
|
58
|
+
const r = await E({
|
|
155
59
|
title: "",
|
|
156
|
-
value:
|
|
60
|
+
value: t
|
|
157
61
|
});
|
|
158
|
-
r
|
|
62
|
+
o(r);
|
|
159
63
|
});
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
64
|
+
const z = (s, t) => {
|
|
65
|
+
const o = s[t];
|
|
66
|
+
return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((r, i) => {
|
|
67
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(i.bind(null, new Error("Unknown variable dynamic import: " + t)));
|
|
164
68
|
});
|
|
165
69
|
};
|
|
166
|
-
async function
|
|
167
|
-
const
|
|
168
|
-
|
|
70
|
+
async function g(s) {
|
|
71
|
+
const t = await z(/* @__PURE__ */ Object.assign({ "./msg/en.ts": () => import("./en-CCqtrcN-.js"), "./msg/zhHans.ts": () => import("./zhHans---jf3OTZ.js") }), `./msg/${s}.ts`);
|
|
72
|
+
e.setLocale(t.default);
|
|
73
|
+
}
|
|
74
|
+
class V {
|
|
75
|
+
init({ contextMenu: t = !0, shortcut: o = !0 } = {
|
|
76
|
+
contextMenu: !0,
|
|
77
|
+
shortcut: !0
|
|
78
|
+
}) {
|
|
79
|
+
t && (this.blockCopyToStorageContextMenu(), this.blockPasteFromStorageContextMenu()), o && (e.ShortcutRegistry.registry.unregister(
|
|
80
|
+
e.ShortcutItems.names.COPY
|
|
81
|
+
), e.ShortcutRegistry.registry.unregister(
|
|
82
|
+
e.ShortcutItems.names.CUT
|
|
83
|
+
), e.ShortcutRegistry.registry.unregister(
|
|
84
|
+
e.ShortcutItems.names.PASTE
|
|
85
|
+
), this.blockCopyToStorageShortcut(), this.blockCutToStorageShortcut(), this.blockPasteFromStorageShortcut());
|
|
86
|
+
}
|
|
87
|
+
blockCopyToStorageContextMenu() {
|
|
88
|
+
const t = {
|
|
89
|
+
displayText: function() {
|
|
90
|
+
return e.Msg.CROSS_TAB_COPY ? e.Msg.CROSS_TAB_COPY : "Copy";
|
|
91
|
+
},
|
|
92
|
+
preconditionFn: function() {
|
|
93
|
+
const o = e.getSelected();
|
|
94
|
+
return !o || !e.isDeletable(o) || !o.isDeletable() || !e.isDraggable(o) || !o.isMovable() || !e.isCopyable(o) ? "disabled" : "enabled";
|
|
95
|
+
},
|
|
96
|
+
callback: function(o) {
|
|
97
|
+
var r;
|
|
98
|
+
localStorage.setItem(
|
|
99
|
+
"blocklyStash",
|
|
100
|
+
JSON.stringify((r = o.block) == null ? void 0 : r.toCopyData())
|
|
101
|
+
);
|
|
102
|
+
},
|
|
103
|
+
scopeType: e.ContextMenuRegistry.ScopeType.BLOCK,
|
|
104
|
+
id: "blockCopyToStorage",
|
|
105
|
+
weight: 0
|
|
106
|
+
};
|
|
107
|
+
e.ContextMenuRegistry.registry.register(t);
|
|
108
|
+
}
|
|
109
|
+
blockPasteFromStorageContextMenu() {
|
|
110
|
+
const t = {
|
|
111
|
+
displayText: function() {
|
|
112
|
+
return e.Msg.CROSS_TAB_PASTE ? e.Msg.CROSS_TAB_PASTE : "Paste";
|
|
113
|
+
},
|
|
114
|
+
preconditionFn: function(o) {
|
|
115
|
+
var l;
|
|
116
|
+
const r = localStorage.getItem("blocklyStash");
|
|
117
|
+
if (!r)
|
|
118
|
+
return "disabled";
|
|
119
|
+
const i = JSON.parse(r);
|
|
120
|
+
return !i || !((l = o.workspace) != null && l.isCapacityAvailable(i.typeCounts)) ? "disabled" : "enabled";
|
|
121
|
+
},
|
|
122
|
+
callback: function(o) {
|
|
123
|
+
const r = localStorage.getItem("blocklyStash");
|
|
124
|
+
if (!r)
|
|
125
|
+
return;
|
|
126
|
+
const i = JSON.parse(r);
|
|
127
|
+
i && o.workspace && e.clipboard.paste(i, o.workspace);
|
|
128
|
+
},
|
|
129
|
+
scopeType: e.ContextMenuRegistry.ScopeType.WORKSPACE,
|
|
130
|
+
id: "blockPasteFromStorage",
|
|
131
|
+
weight: 0
|
|
132
|
+
};
|
|
133
|
+
e.ContextMenuRegistry.registry.register(t);
|
|
134
|
+
}
|
|
135
|
+
blockCopyToStorageShortcut() {
|
|
136
|
+
const t = e.ShortcutRegistry.registry.createSerializedKey(
|
|
137
|
+
e.utils.KeyCodes.C,
|
|
138
|
+
[e.utils.KeyCodes.CTRL]
|
|
139
|
+
), o = e.ShortcutRegistry.registry.createSerializedKey(
|
|
140
|
+
e.utils.KeyCodes.C,
|
|
141
|
+
[e.utils.KeyCodes.ALT]
|
|
142
|
+
), r = e.ShortcutRegistry.registry.createSerializedKey(
|
|
143
|
+
e.utils.KeyCodes.C,
|
|
144
|
+
[e.utils.KeyCodes.META]
|
|
145
|
+
), i = {
|
|
146
|
+
name: "copy",
|
|
147
|
+
preconditionFn: function(l) {
|
|
148
|
+
if (l.options.readOnly || e.Gesture.inProgress())
|
|
149
|
+
return !1;
|
|
150
|
+
const n = e.getSelected();
|
|
151
|
+
return !(!n || !e.isDeletable(n) || !n.isDeletable() || !e.isDraggable(n) || !n.isMovable() || !e.isCopyable(n));
|
|
152
|
+
},
|
|
153
|
+
callback: function(l, n) {
|
|
154
|
+
n.preventDefault();
|
|
155
|
+
const a = e.getSelected();
|
|
156
|
+
if (!a || !e.isCopyable(a))
|
|
157
|
+
return !1;
|
|
158
|
+
const c = a.toCopyData();
|
|
159
|
+
return c ? (l.hideChaff(), localStorage.setItem("blocklyStash", JSON.stringify(c)), !0) : !1;
|
|
160
|
+
},
|
|
161
|
+
keyCodes: [t, o, r]
|
|
162
|
+
};
|
|
163
|
+
e.ShortcutRegistry.registry.register(i);
|
|
164
|
+
}
|
|
165
|
+
blockCutToStorageShortcut() {
|
|
166
|
+
const t = e.ShortcutRegistry.registry.createSerializedKey(
|
|
167
|
+
e.utils.KeyCodes.X,
|
|
168
|
+
[e.utils.KeyCodes.CTRL]
|
|
169
|
+
), o = e.ShortcutRegistry.registry.createSerializedKey(
|
|
170
|
+
e.utils.KeyCodes.X,
|
|
171
|
+
[e.utils.KeyCodes.ALT]
|
|
172
|
+
), r = e.ShortcutRegistry.registry.createSerializedKey(
|
|
173
|
+
e.utils.KeyCodes.X,
|
|
174
|
+
[e.utils.KeyCodes.META]
|
|
175
|
+
), i = {
|
|
176
|
+
name: "cut",
|
|
177
|
+
preconditionFn: function(l) {
|
|
178
|
+
if (l.options.readOnly || e.Gesture.inProgress())
|
|
179
|
+
return !1;
|
|
180
|
+
const n = e.getSelected();
|
|
181
|
+
return !(!n || !e.isDeletable(n) || !n.isDeletable() || !e.isDraggable(n) || !n.isMovable() || !e.isCopyable(n) || n.workspace.isFlyout);
|
|
182
|
+
},
|
|
183
|
+
callback: function(l, n) {
|
|
184
|
+
n.preventDefault();
|
|
185
|
+
const a = e.getSelected();
|
|
186
|
+
if (!a || !e.isDeletable(a) || !a.isDeletable() || !e.isCopyable(a))
|
|
187
|
+
return !1;
|
|
188
|
+
const c = a.toCopyData();
|
|
189
|
+
return c ? (localStorage.setItem("blocklyStash", JSON.stringify(c)), a instanceof e.BlockSvg ? a.checkAndDelete() : a.dispose(), !0) : !1;
|
|
190
|
+
},
|
|
191
|
+
keyCodes: [t, o, r]
|
|
192
|
+
};
|
|
193
|
+
e.ShortcutRegistry.registry.register(i);
|
|
194
|
+
}
|
|
195
|
+
blockPasteFromStorageShortcut() {
|
|
196
|
+
const t = e.ShortcutRegistry.registry.createSerializedKey(
|
|
197
|
+
e.utils.KeyCodes.V,
|
|
198
|
+
[e.utils.KeyCodes.CTRL]
|
|
199
|
+
), o = e.ShortcutRegistry.registry.createSerializedKey(
|
|
200
|
+
e.utils.KeyCodes.V,
|
|
201
|
+
[e.utils.KeyCodes.ALT]
|
|
202
|
+
), r = e.ShortcutRegistry.registry.createSerializedKey(
|
|
203
|
+
e.utils.KeyCodes.V,
|
|
204
|
+
[e.utils.KeyCodes.META]
|
|
205
|
+
), i = {
|
|
206
|
+
name: "paste",
|
|
207
|
+
preconditionFn: function(l) {
|
|
208
|
+
if (l.options.readOnly || e.Gesture.inProgress())
|
|
209
|
+
return !1;
|
|
210
|
+
const n = localStorage.getItem("blocklyStash");
|
|
211
|
+
if (!n)
|
|
212
|
+
return !1;
|
|
213
|
+
const a = JSON.parse(n);
|
|
214
|
+
return !(!a || !l.isCapacityAvailable(a.typeCounts));
|
|
215
|
+
},
|
|
216
|
+
callback: function(l, n) {
|
|
217
|
+
n.preventDefault();
|
|
218
|
+
const a = localStorage.getItem("blocklyStash");
|
|
219
|
+
if (!a)
|
|
220
|
+
return !1;
|
|
221
|
+
const c = JSON.parse(a);
|
|
222
|
+
return c ? (e.clipboard.paste(c, l), !0) : !1;
|
|
223
|
+
},
|
|
224
|
+
keyCodes: [t, o, r]
|
|
225
|
+
};
|
|
226
|
+
e.ShortcutRegistry.registry.register(i);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
class U {
|
|
230
|
+
init() {
|
|
231
|
+
const t = e.ContextMenuRegistry.registry.getItem("cleanWorkspace");
|
|
232
|
+
t && (t.callback = function(o) {
|
|
233
|
+
const r = o.workspace;
|
|
234
|
+
if (!r)
|
|
235
|
+
return;
|
|
236
|
+
r.setResizesEnabled(!1), e.Events.setGroup(!0);
|
|
237
|
+
const i = r.getTopBlocks(!0);
|
|
238
|
+
let l = 0;
|
|
239
|
+
for (let n = 0, a; a = i[n]; n++) {
|
|
240
|
+
if (!a.isMovable())
|
|
241
|
+
continue;
|
|
242
|
+
const c = a.getRelativeToSurfaceXY();
|
|
243
|
+
a.moveBy(-c.x, l - c.y, ["cleanup"]), a.snapToGrid(), l = a.getRelativeToSurfaceXY().y + a.getHeightWidth().height + 100;
|
|
244
|
+
}
|
|
245
|
+
e.Events.setGroup(!1), r.setResizesEnabled(!0);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function b(s) {
|
|
250
|
+
const t = s.getParent();
|
|
251
|
+
return t && b(t) ? !0 : !t && !!(s.outputConnection || s.previousConnection);
|
|
252
|
+
}
|
|
253
|
+
class Y {
|
|
254
|
+
init() {
|
|
255
|
+
const t = e.ContextMenuRegistry.registry.getItem("blockDisable");
|
|
256
|
+
t && (t.preconditionFn = function(o) {
|
|
257
|
+
const r = o.block;
|
|
258
|
+
return r && !r.isInFlyout && r.workspace.options.disable && r.isEditable() ? r.getInheritedDisabled() || b(r) ? "disabled" : "enabled" : "hidden";
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
class N extends e.HorizontalFlyout {
|
|
263
|
+
addBlockListeners_(t, o, r) {
|
|
264
|
+
e.getMainWorkspace().options.readOnly || super.addBlockListeners_(t, o, r);
|
|
265
|
+
}
|
|
266
|
+
isBlockCreatable(t) {
|
|
267
|
+
return e.getMainWorkspace().options.readOnly ? !1 : super.isBlockCreatable(t);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
class G extends e.VerticalFlyout {
|
|
271
|
+
addBlockListeners_(t, o, r) {
|
|
272
|
+
e.getMainWorkspace().options.readOnly || super.addBlockListeners_(t, o, r);
|
|
273
|
+
}
|
|
274
|
+
isBlockCreatable(t) {
|
|
275
|
+
return e.getMainWorkspace().options.readOnly ? !1 : super.isBlockCreatable(t);
|
|
276
|
+
}
|
|
169
277
|
}
|
|
170
|
-
|
|
278
|
+
const X = new V();
|
|
279
|
+
X.init({ contextMenu: !0, shortcut: !0 });
|
|
280
|
+
const j = new U();
|
|
281
|
+
j.init();
|
|
282
|
+
const W = new Y();
|
|
283
|
+
W.init();
|
|
284
|
+
e.registry.register(
|
|
285
|
+
e.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,
|
|
286
|
+
e.registry.DEFAULT,
|
|
287
|
+
N,
|
|
288
|
+
!0
|
|
289
|
+
);
|
|
290
|
+
e.registry.register(
|
|
291
|
+
e.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,
|
|
292
|
+
e.registry.DEFAULT,
|
|
293
|
+
G,
|
|
294
|
+
!0
|
|
295
|
+
);
|
|
296
|
+
e.Themes.Classic.blockStyles = {
|
|
171
297
|
color_blocks: {
|
|
172
298
|
colourPrimary: "#a5745b",
|
|
173
299
|
colourSecondary: "#ede3de",
|
|
@@ -241,7 +367,7 @@ i.Classic.blockStyles = {
|
|
|
241
367
|
hat: ""
|
|
242
368
|
}
|
|
243
369
|
};
|
|
244
|
-
|
|
370
|
+
e.Themes.Classic.categoryStyles = {
|
|
245
371
|
calc_category: {
|
|
246
372
|
colour: "#757575"
|
|
247
373
|
},
|
|
@@ -291,9 +417,9 @@ i.Classic.categoryStyles = {
|
|
|
291
417
|
colour: "#a55b80"
|
|
292
418
|
}
|
|
293
419
|
};
|
|
294
|
-
const
|
|
420
|
+
const $ = e.Theme.defineTheme("light", {
|
|
295
421
|
name: "light",
|
|
296
|
-
base:
|
|
422
|
+
base: e.Themes.Classic,
|
|
297
423
|
componentStyles: {
|
|
298
424
|
workspaceBackgroundColour: "#ffffff",
|
|
299
425
|
toolboxBackgroundColour: "#eeeeee",
|
|
@@ -307,9 +433,9 @@ const z = b.defineTheme("light", {
|
|
|
307
433
|
scrollbarOpacity: 0.4,
|
|
308
434
|
cursorColour: ""
|
|
309
435
|
}
|
|
310
|
-
}),
|
|
436
|
+
}), J = e.Theme.defineTheme("dark", {
|
|
311
437
|
name: "dark",
|
|
312
|
-
base:
|
|
438
|
+
base: e.Themes.Classic,
|
|
313
439
|
componentStyles: {
|
|
314
440
|
workspaceBackgroundColour: "#1e1e1e",
|
|
315
441
|
toolboxBackgroundColour: "#272727",
|
|
@@ -324,68 +450,69 @@ const z = b.defineTheme("light", {
|
|
|
324
450
|
cursorColour: ""
|
|
325
451
|
}
|
|
326
452
|
});
|
|
327
|
-
function
|
|
328
|
-
const
|
|
329
|
-
switch (console.log(
|
|
453
|
+
function H(s) {
|
|
454
|
+
const t = e.getMainWorkspace();
|
|
455
|
+
switch (console.log(t), s) {
|
|
330
456
|
case "light":
|
|
331
|
-
|
|
457
|
+
t.setTheme($);
|
|
332
458
|
break;
|
|
333
459
|
case "dark":
|
|
334
|
-
|
|
460
|
+
t.setTheme(J);
|
|
335
461
|
break;
|
|
336
462
|
}
|
|
337
463
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
var a, l;
|
|
361
|
-
const r = o.value, t = {
|
|
362
|
-
passive: !((a = o.modifiers) != null && a.active)
|
|
464
|
+
const q = {
|
|
465
|
+
kind: "category",
|
|
466
|
+
name: "%{BKY_CATEGORY_LOGIC}",
|
|
467
|
+
categorystyle: "logic_category",
|
|
468
|
+
contents: [
|
|
469
|
+
{
|
|
470
|
+
kind: "label",
|
|
471
|
+
text: "%{BKY_LABEL_BOOLEAN}"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
kind: "block",
|
|
475
|
+
type: "boolean_v1"
|
|
476
|
+
}
|
|
477
|
+
]
|
|
478
|
+
}, Z = {
|
|
479
|
+
kind: "categoryToolbox",
|
|
480
|
+
contents: [q]
|
|
481
|
+
};
|
|
482
|
+
function Q(s, t) {
|
|
483
|
+
var i, l;
|
|
484
|
+
const o = t.value, r = {
|
|
485
|
+
passive: !((i = t.modifiers) != null && i.active)
|
|
363
486
|
};
|
|
364
|
-
window.addEventListener("resize",
|
|
365
|
-
handler:
|
|
366
|
-
options:
|
|
367
|
-
}, (l =
|
|
487
|
+
window.addEventListener("resize", o, r), s._onResize = Object(s._onResize), s._onResize[t.instance.$.uid] = {
|
|
488
|
+
handler: o,
|
|
489
|
+
options: r
|
|
490
|
+
}, (l = t.modifiers) != null && l.quiet || o();
|
|
368
491
|
}
|
|
369
|
-
function
|
|
370
|
-
var
|
|
371
|
-
if (!((
|
|
492
|
+
function ee(s, t) {
|
|
493
|
+
var i;
|
|
494
|
+
if (!((i = s._onResize) != null && i[t.instance.$.uid]))
|
|
372
495
|
return;
|
|
373
496
|
const {
|
|
374
|
-
handler:
|
|
375
|
-
options:
|
|
376
|
-
} =
|
|
377
|
-
window.removeEventListener("resize",
|
|
497
|
+
handler: o,
|
|
498
|
+
options: r
|
|
499
|
+
} = s._onResize[t.instance.$.uid];
|
|
500
|
+
window.removeEventListener("resize", o, r), delete s._onResize[t.instance.$.uid];
|
|
378
501
|
}
|
|
379
|
-
const
|
|
380
|
-
mounted:
|
|
381
|
-
unmounted:
|
|
382
|
-
},
|
|
502
|
+
const te = {
|
|
503
|
+
mounted: Q,
|
|
504
|
+
unmounted: ee
|
|
505
|
+
}, oe = { class: "position-relative w-100 h-100" }, re = /* @__PURE__ */ h({
|
|
383
506
|
__name: "index",
|
|
507
|
+
props: {
|
|
508
|
+
type: {},
|
|
509
|
+
version: {}
|
|
510
|
+
},
|
|
384
511
|
emits: ["ready", "change"],
|
|
385
|
-
setup(
|
|
386
|
-
const
|
|
387
|
-
let
|
|
388
|
-
const
|
|
512
|
+
setup(s, { emit: t }) {
|
|
513
|
+
const o = A(), r = I(), { open: i } = x("blocklyEditorFlyout"), l = s, n = t, a = k(null);
|
|
514
|
+
let c;
|
|
515
|
+
const f = {
|
|
389
516
|
grid: {
|
|
390
517
|
length: 2,
|
|
391
518
|
snap: !0,
|
|
@@ -397,7 +524,8 @@ const q = {
|
|
|
397
524
|
scrollbars: !0,
|
|
398
525
|
wheel: !0
|
|
399
526
|
},
|
|
400
|
-
|
|
527
|
+
readOnly: !1,
|
|
528
|
+
theme: r.current.value.dark ? "dark" : "light",
|
|
401
529
|
trashcan: !1,
|
|
402
530
|
zoom: {
|
|
403
531
|
maxScale: 1,
|
|
@@ -407,186 +535,48 @@ const q = {
|
|
|
407
535
|
wheel: !0
|
|
408
536
|
}
|
|
409
537
|
};
|
|
410
|
-
|
|
411
|
-
|
|
538
|
+
_(async () => {
|
|
539
|
+
if (!a.value)
|
|
540
|
+
return;
|
|
541
|
+
await g(o.current.value);
|
|
542
|
+
let u;
|
|
543
|
+
l.type === "app" && l.version === "v1" && (u = Z), f.toolbox = u, c = e.inject(a.value, f), c.addChangeListener(e.Events.disableOrphans), c.addChangeListener(S), await T(), n("ready", c);
|
|
412
544
|
});
|
|
413
|
-
function
|
|
414
|
-
|
|
545
|
+
function m() {
|
|
546
|
+
c && e.svgResize(c);
|
|
415
547
|
}
|
|
416
|
-
function
|
|
417
|
-
|
|
548
|
+
function S(u) {
|
|
549
|
+
n("change", u);
|
|
418
550
|
}
|
|
419
|
-
return
|
|
420
|
-
|
|
421
|
-
}), d(
|
|
422
|
-
var
|
|
423
|
-
|
|
551
|
+
return O(() => {
|
|
552
|
+
i.value = !1;
|
|
553
|
+
}), d(i, (u) => {
|
|
554
|
+
var y;
|
|
555
|
+
u || (y = c.getToolbox()) == null || y.clearSelection();
|
|
424
556
|
}), d(
|
|
425
|
-
() =>
|
|
426
|
-
(
|
|
427
|
-
|
|
557
|
+
() => o.current.value,
|
|
558
|
+
(u) => {
|
|
559
|
+
g(u);
|
|
428
560
|
}
|
|
429
561
|
), d(
|
|
430
|
-
() =>
|
|
431
|
-
(
|
|
432
|
-
|
|
562
|
+
() => r.current.value.dark,
|
|
563
|
+
(u) => {
|
|
564
|
+
H(u ? "dark" : "light");
|
|
433
565
|
}
|
|
434
|
-
), (
|
|
435
|
-
B(
|
|
566
|
+
), (u, y) => (v(), R("div", oe, [
|
|
567
|
+
B(L("div", {
|
|
436
568
|
class: "w-100 h-100",
|
|
437
569
|
ref_key: "blocklyDiv",
|
|
438
|
-
ref:
|
|
570
|
+
ref: a,
|
|
439
571
|
id: "blocklyEditor"
|
|
440
572
|
}, null, 512), [
|
|
441
|
-
[
|
|
573
|
+
[te, m]
|
|
442
574
|
])
|
|
443
575
|
]));
|
|
444
576
|
}
|
|
445
|
-
}),
|
|
446
|
-
|
|
447
|
-
},
|
|
577
|
+
}), se = (s) => {
|
|
578
|
+
s.component("x-blockly", re);
|
|
579
|
+
}, le = { install: se };
|
|
448
580
|
export {
|
|
449
|
-
|
|
450
|
-
te as BasicCursor,
|
|
451
|
-
ae as Block,
|
|
452
|
-
ce as BlockSvg,
|
|
453
|
-
ne as Blocks,
|
|
454
|
-
le as COLLAPSED_FIELD_NAME,
|
|
455
|
-
ie as COLLAPSED_INPUT_NAME,
|
|
456
|
-
se as COLLAPSE_CHARS,
|
|
457
|
-
ue as CodeGenerator,
|
|
458
|
-
de as CollapsibleToolboxCategory,
|
|
459
|
-
ye as ComponentManager,
|
|
460
|
-
me as Connection,
|
|
461
|
-
be as ConnectionChecker,
|
|
462
|
-
ge as ConnectionDB,
|
|
463
|
-
_e as ConnectionType,
|
|
464
|
-
fe as ContextMenu,
|
|
465
|
-
pe as ContextMenuItems,
|
|
466
|
-
he as ContextMenuRegistry,
|
|
467
|
-
ke as Css,
|
|
468
|
-
Te as Cursor,
|
|
469
|
-
Ce as DELETE_VARIABLE_ID,
|
|
470
|
-
Ee as DeleteArea,
|
|
471
|
-
Se as DragTarget,
|
|
472
|
-
ve as DropDownDiv,
|
|
473
|
-
L as Events,
|
|
474
|
-
Me as Extensions,
|
|
475
|
-
Oe as Field,
|
|
476
|
-
Ae as FieldCheckbox,
|
|
477
|
-
Pe as FieldDropdown,
|
|
478
|
-
we as FieldImage,
|
|
479
|
-
Be as FieldLabel,
|
|
480
|
-
Re as FieldLabelSerializable,
|
|
481
|
-
Le as FieldNumber,
|
|
482
|
-
Ie as FieldTextInput,
|
|
483
|
-
xe as FieldVariable,
|
|
484
|
-
De as Flyout,
|
|
485
|
-
Fe as FlyoutButton,
|
|
486
|
-
Ve as FlyoutMetricsManager,
|
|
487
|
-
ze as Generator,
|
|
488
|
-
Ne as Gesture,
|
|
489
|
-
Ue as Grid,
|
|
490
|
-
je as HorizontalFlyout,
|
|
491
|
-
$e as INPUT_VALUE,
|
|
492
|
-
Ge as Input,
|
|
493
|
-
We as InsertionMarkerManager,
|
|
494
|
-
Xe as InsertionMarkerPreviewer,
|
|
495
|
-
He as Marker,
|
|
496
|
-
Ye as MarkerManager,
|
|
497
|
-
qe as Menu,
|
|
498
|
-
Je as MenuItem,
|
|
499
|
-
Ze as MetricsManager,
|
|
500
|
-
Ke as Msg,
|
|
501
|
-
Qe as NEXT_STATEMENT,
|
|
502
|
-
eo as Names,
|
|
503
|
-
oo as OPPOSITE_TYPE,
|
|
504
|
-
ro as OUTPUT_VALUE,
|
|
505
|
-
to as Options,
|
|
506
|
-
ao as PREVIOUS_STATEMENT,
|
|
507
|
-
co as PROCEDURE_CATEGORY_NAME,
|
|
508
|
-
no as Procedures,
|
|
509
|
-
lo as RENAME_VARIABLE_ID,
|
|
510
|
-
io as RenderedConnection,
|
|
511
|
-
so as Scrollbar,
|
|
512
|
-
uo as ScrollbarPair,
|
|
513
|
-
yo as ShortcutItems,
|
|
514
|
-
mo as ShortcutRegistry,
|
|
515
|
-
bo as TOOLBOX_AT_BOTTOM,
|
|
516
|
-
go as TOOLBOX_AT_LEFT,
|
|
517
|
-
_o as TOOLBOX_AT_RIGHT,
|
|
518
|
-
fo as TOOLBOX_AT_TOP,
|
|
519
|
-
po as TabNavigateCursor,
|
|
520
|
-
b as Theme,
|
|
521
|
-
ho as ThemeManager,
|
|
522
|
-
i as Themes,
|
|
523
|
-
ko as Toolbox,
|
|
524
|
-
To as ToolboxCategory,
|
|
525
|
-
Co as ToolboxItem,
|
|
526
|
-
Eo as ToolboxSeparator,
|
|
527
|
-
So as Tooltip,
|
|
528
|
-
vo as Touch,
|
|
529
|
-
Mo as Trashcan,
|
|
530
|
-
Oo as UnattachedFieldError,
|
|
531
|
-
Ao as VARIABLE_CATEGORY_NAME,
|
|
532
|
-
Po as VARIABLE_DYNAMIC_CATEGORY_NAME,
|
|
533
|
-
wo as VERSION,
|
|
534
|
-
Bo as VariableMap,
|
|
535
|
-
Ro as VariableModel,
|
|
536
|
-
Lo as Variables,
|
|
537
|
-
Io as VariablesDynamic,
|
|
538
|
-
xo as VerticalFlyout,
|
|
539
|
-
Do as WidgetDiv,
|
|
540
|
-
Fo as Workspace,
|
|
541
|
-
Vo as WorkspaceAudio,
|
|
542
|
-
zo as WorkspaceDragger,
|
|
543
|
-
No as WorkspaceSvg,
|
|
544
|
-
Uo as Xml,
|
|
545
|
-
jo as ZoomControls,
|
|
546
|
-
$o as blockAnimations,
|
|
547
|
-
Go as blockRendering,
|
|
548
|
-
Wo as browserEvents,
|
|
549
|
-
Xo as bubbles,
|
|
550
|
-
Ho as bumpObjects,
|
|
551
|
-
Yo as clipboard,
|
|
552
|
-
qo as comments,
|
|
553
|
-
Jo as common,
|
|
554
|
-
Zo as config,
|
|
555
|
-
Ko as constants,
|
|
556
|
-
Or as default,
|
|
557
|
-
Qo as defineBlocksWithJsonArray,
|
|
558
|
-
g as dialog,
|
|
559
|
-
er as dragging,
|
|
560
|
-
or as fieldRegistry,
|
|
561
|
-
rr as geras,
|
|
562
|
-
I as getMainWorkspace,
|
|
563
|
-
tr as getSelected,
|
|
564
|
-
ar as hasBubble,
|
|
565
|
-
cr as hideChaff,
|
|
566
|
-
nr as icons,
|
|
567
|
-
x as inject,
|
|
568
|
-
lr as inputs,
|
|
569
|
-
ir as isCopyable,
|
|
570
|
-
sr as isDeletable,
|
|
571
|
-
ur as isDraggable,
|
|
572
|
-
dr as isIcon,
|
|
573
|
-
yr as isObservable,
|
|
574
|
-
mr as isPaster,
|
|
575
|
-
br as isRenderedElement,
|
|
576
|
-
gr as isSelectable,
|
|
577
|
-
_r as isSerializable,
|
|
578
|
-
fr as isVariableBackedParameterModel,
|
|
579
|
-
pr as procedures,
|
|
580
|
-
hr as registry,
|
|
581
|
-
kr as renderManagement,
|
|
582
|
-
Tr as serialization,
|
|
583
|
-
D as setLocale,
|
|
584
|
-
y as setLocaleAsync,
|
|
585
|
-
Cr as setParentContainer,
|
|
586
|
-
U as setTheme,
|
|
587
|
-
F as svgResize,
|
|
588
|
-
Er as thrasos,
|
|
589
|
-
Sr as uiPosition,
|
|
590
|
-
vr as utils,
|
|
591
|
-
Mr as zelos
|
|
581
|
+
le as default
|
|
592
582
|
};
|