@tvolden/block-code-editor 0.2.0 → 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/README.md +11 -0
- package/dist/block-editor.cjs +4 -4
- package/dist/block-editor.js +1157 -1029
- package/dist/blocks.json +47 -2
- package/dist/components/BlockRenderer.d.ts +2 -0
- package/dist/components/Canvas.d.ts +2 -0
- package/dist/components/OptionalChip.d.ts +12 -0
- package/dist/types.d.ts +6 -0
- package/dist/utils/blockLayout.d.ts +29 -0
- package/package.json +1 -1
package/dist/block-editor.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { jsxs as y, jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
function
|
|
1
|
+
import { jsxs as y, jsx as l, Fragment as Rt } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as yo, useContext as mo, useState as E, useMemo as Ve, forwardRef as xo, useRef as re, useEffect as G, useCallback as D } from "react";
|
|
3
|
+
function ko(e, t, n) {
|
|
4
4
|
"dependencies" in e ? n(e.dependencies(t)) : e.onClick();
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function Z(e) {
|
|
7
7
|
return `${e.publisher}/${e.name}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return `${
|
|
9
|
+
function Ue(e) {
|
|
10
|
+
return `${ft}${Z(e)}@${e.version}`;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function
|
|
12
|
+
const ft = "dep:";
|
|
13
|
+
function bo(e, t) {
|
|
14
14
|
const n = e.split(/[.-]/), r = t.split(/[.-]/);
|
|
15
15
|
for (let o = 0; o < Math.max(n.length, r.length); o++) {
|
|
16
|
-
const i = n[o] ?? "0", s = r[o] ?? "0", c = Number(i),
|
|
17
|
-
if (
|
|
16
|
+
const i = n[o] ?? "0", s = r[o] ?? "0", c = Number(i), p = Number(s), m = !isNaN(c) && !isNaN(p) ? c - p : i.localeCompare(s);
|
|
17
|
+
if (m !== 0) return m;
|
|
18
18
|
}
|
|
19
19
|
return 0;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
class
|
|
21
|
+
const qr = 1;
|
|
22
|
+
class N extends Error {
|
|
23
23
|
code;
|
|
24
24
|
constructor(t, n) {
|
|
25
25
|
super(n), this.name = "CommandRejected", this.code = t;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function je(e, t) {
|
|
29
29
|
switch (t.type) {
|
|
30
30
|
case "InsertBlocks":
|
|
31
|
-
return
|
|
31
|
+
return $o(e, t);
|
|
32
32
|
case "RemoveBlocks":
|
|
33
|
-
return
|
|
33
|
+
return So(e, t);
|
|
34
34
|
case "MoveBlock":
|
|
35
|
-
return
|
|
35
|
+
return Bo(e, t);
|
|
36
36
|
case "Attach":
|
|
37
|
-
return
|
|
37
|
+
return wo(e, t);
|
|
38
38
|
case "Detach":
|
|
39
|
-
return
|
|
39
|
+
return Co(e, t);
|
|
40
40
|
case "SetText":
|
|
41
|
-
return
|
|
41
|
+
return Po(e, t);
|
|
42
42
|
case "SetDependencies":
|
|
43
|
-
return
|
|
43
|
+
return Eo(e, t);
|
|
44
44
|
case "Batch":
|
|
45
|
-
return
|
|
45
|
+
return Do(e, t);
|
|
46
46
|
default:
|
|
47
|
-
throw new
|
|
47
|
+
throw new N("INVALID_COMMAND", `Unknown command type '${t.type}'.`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ht(e) {
|
|
51
51
|
return {
|
|
52
52
|
textValue: e?.textValue ?? null,
|
|
53
53
|
queryBlockId: e?.queryBlockId ?? null,
|
|
@@ -55,46 +55,46 @@ function ut(e) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function Te(e) {
|
|
58
|
-
const t =
|
|
59
|
-
return { ...e, ...t, paramSlots: e.paramSlots.map(
|
|
58
|
+
const t = Ht(e) ? { x: e.x, y: e.y } : { x: 0, y: 0 };
|
|
59
|
+
return { ...e, ...t, paramSlots: e.paramSlots.map(ht) };
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function _e(e) {
|
|
62
62
|
return e == null || e === "" ? null : e;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function Ne(e, t) {
|
|
65
65
|
const n = e.blocks.get(t);
|
|
66
|
-
if (!n) throw new
|
|
66
|
+
if (!n) throw new N("BLOCK_NOT_FOUND", `Block '${t}' doesn't exist.`);
|
|
67
67
|
return n;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function Ht(e) {
|
|
70
70
|
return !e.parentBlockId && !e.embeddedInBlockId;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function xn(e) {
|
|
73
73
|
const t = [];
|
|
74
74
|
e.nextBlockId && t.push(e.nextBlockId);
|
|
75
75
|
for (const n of e.paramSlots)
|
|
76
76
|
n.queryBlockId && t.push(n.queryBlockId), n.commandBlockId && t.push(n.commandBlockId);
|
|
77
77
|
return t;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function pt(e, t) {
|
|
80
80
|
const n = [], r = /* @__PURE__ */ new Set(), o = [t];
|
|
81
81
|
for (; o.length > 0; ) {
|
|
82
82
|
const i = o.shift();
|
|
83
83
|
if (r.has(i)) continue;
|
|
84
84
|
const s = e.get(i);
|
|
85
|
-
s && (r.add(i), n.push(i), o.push(...
|
|
85
|
+
s && (r.add(i), n.push(i), o.push(...xn(s)));
|
|
86
86
|
}
|
|
87
87
|
return n;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const t = (o) => new
|
|
91
|
-
if (e.length === 0) throw new
|
|
89
|
+
function kn(e) {
|
|
90
|
+
const t = (o) => new N("NOT_A_FRAGMENT", `The blocks aren't one fragment: ${o}.`);
|
|
91
|
+
if (e.length === 0) throw new N("INVALID_COMMAND", "The command has no blocks.");
|
|
92
92
|
const n = /* @__PURE__ */ new Map();
|
|
93
93
|
for (const o of e) {
|
|
94
94
|
if (n.has(o.instanceId)) throw t(`'${o.instanceId}' is given twice`);
|
|
95
95
|
n.set(o.instanceId, o);
|
|
96
96
|
}
|
|
97
|
-
const r = e.filter(
|
|
97
|
+
const r = e.filter(Ht);
|
|
98
98
|
if (r.length !== 1) throw t(`it has ${r.length} roots`);
|
|
99
99
|
for (const o of e) {
|
|
100
100
|
if (o.nextBlockId) {
|
|
@@ -105,8 +105,8 @@ function hn(e) {
|
|
|
105
105
|
if (o.paramSlots.forEach((i, s) => {
|
|
106
106
|
for (const c of [i.queryBlockId, i.commandBlockId]) {
|
|
107
107
|
if (!c) continue;
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
108
|
+
const p = n.get(c);
|
|
109
|
+
if (!p || p.embeddedInBlockId !== o.instanceId || p.embeddedSlotIndex !== s || p.parentBlockId)
|
|
110
110
|
throw t(`slot ${s} of '${o.instanceId}' doesn't match`);
|
|
111
111
|
}
|
|
112
112
|
}), o.parentBlockId) {
|
|
@@ -120,104 +120,104 @@ function hn(e) {
|
|
|
120
120
|
throw t(`the block holding '${o.instanceId}' doesn't match`);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
if (
|
|
123
|
+
if (pt(n, r[0].instanceId).length !== e.length) throw t("not every block hangs off the root");
|
|
124
124
|
return r[0];
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function Io(e, t) {
|
|
127
127
|
return JSON.stringify(Te(e)) === JSON.stringify(Te(t));
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
const r = e.paramSlots.map(
|
|
129
|
+
function ct(e, t, n) {
|
|
130
|
+
const r = e.paramSlots.map(ht);
|
|
131
131
|
return r[t] = { ...r[t], ...n }, { ...e, paramSlots: r };
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function bn(e, t) {
|
|
134
134
|
if (!Number.isInteger(t) || t < 0 || t >= e.paramSlots.length)
|
|
135
|
-
throw new
|
|
136
|
-
return
|
|
135
|
+
throw new N("NO_SUCH_SLOT", `Block '${e.instanceId}' has no slot ${t}.`);
|
|
136
|
+
return ht(e.paramSlots[t]);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function In(e, t) {
|
|
139
139
|
if (e.x !== t.x || e.y !== t.y)
|
|
140
|
-
throw new
|
|
140
|
+
throw new N("POSITION_CHANGED", `Block '${e.instanceId}' isn't at (${t.x}, ${t.y}).`);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
if (!
|
|
142
|
+
function vn(e) {
|
|
143
|
+
if (!Ht(e)) throw new N("NOT_A_ROOT", `Block '${e.instanceId}' is linked, not a root.`);
|
|
144
144
|
}
|
|
145
|
-
const
|
|
146
|
-
function
|
|
147
|
-
const n = new Set(e.map(
|
|
148
|
-
return e.length === t.length && n.size === new Set(t.map(
|
|
145
|
+
const Tt = (e) => `${e.publisher}/${e.name}@${e.version}`;
|
|
146
|
+
function vo(e, t) {
|
|
147
|
+
const n = new Set(e.map(Tt));
|
|
148
|
+
return e.length === t.length && n.size === new Set(t.map(Tt)).size && t.every((r) => n.has(Tt(r)));
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
150
|
+
function $o(e, t) {
|
|
151
|
+
kn(t.blocks);
|
|
152
152
|
for (const r of t.blocks)
|
|
153
153
|
if (e.blocks.has(r.instanceId))
|
|
154
|
-
throw new
|
|
154
|
+
throw new N("ID_EXISTS", `Block '${r.instanceId}' already exists.`);
|
|
155
155
|
const n = new Map(e.blocks);
|
|
156
156
|
for (const r of t.blocks) n.set(r.instanceId, Te(r));
|
|
157
157
|
return { ...e, blocks: n };
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
|
|
159
|
+
function So(e, t) {
|
|
160
|
+
kn(t.blocks);
|
|
161
161
|
const n = /* @__PURE__ */ new Set();
|
|
162
162
|
for (const o of t.blocks) {
|
|
163
|
-
const i =
|
|
164
|
-
if (!
|
|
163
|
+
const i = Ne(e, o.instanceId);
|
|
164
|
+
if (!Io(i, o)) throw new N("BLOCK_CHANGED", `Block '${o.instanceId}' has changed.`);
|
|
165
165
|
n.add(o.instanceId);
|
|
166
166
|
}
|
|
167
167
|
for (const o of e.blocks.values())
|
|
168
|
-
if (!n.has(o.instanceId) &&
|
|
169
|
-
throw new
|
|
168
|
+
if (!n.has(o.instanceId) && xn(o).some((i) => n.has(i)))
|
|
169
|
+
throw new N("LINKED_FROM_OUTSIDE", `Block '${o.instanceId}' links into the blocks to remove.`);
|
|
170
170
|
const r = new Map(e.blocks);
|
|
171
171
|
return n.forEach((o) => r.delete(o)), { ...e, blocks: r };
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
const n =
|
|
175
|
-
|
|
173
|
+
function Bo(e, t) {
|
|
174
|
+
const n = Ne(e, t.id);
|
|
175
|
+
vn(n), In(n, t.from);
|
|
176
176
|
const r = new Map(e.blocks);
|
|
177
177
|
return r.set(n.instanceId, { ...n, x: t.to.x, y: t.to.y }), { ...e, blocks: r };
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
const n =
|
|
181
|
-
|
|
182
|
-
const r = t.to, o = "next" in r ? r.next : "mouth" in r ? r.mouth : r.socket, i =
|
|
183
|
-
if (
|
|
184
|
-
throw new
|
|
179
|
+
function wo(e, t) {
|
|
180
|
+
const n = Ne(e, t.id);
|
|
181
|
+
vn(n), In(n, t.from);
|
|
182
|
+
const r = t.to, o = "next" in r ? r.next : "mouth" in r ? r.mouth : r.socket, i = Ne(e, o);
|
|
183
|
+
if (pt(e.blocks, n.instanceId).includes(o))
|
|
184
|
+
throw new N("CYCLE", `Block '${o}' is inside the fragment of '${n.instanceId}'.`);
|
|
185
185
|
const s = new Map(e.blocks);
|
|
186
186
|
if ("next" in r) {
|
|
187
|
-
if (i.nextBlockId) throw new
|
|
187
|
+
if (i.nextBlockId) throw new N("PLACE_OCCUPIED", `Block '${o}' already has a block under it.`);
|
|
188
188
|
return s.set(o, { ...i, nextBlockId: n.instanceId }), s.set(n.instanceId, { ...n, x: 0, y: 0, parentBlockId: o }), { ...e, blocks: s };
|
|
189
189
|
}
|
|
190
|
-
const c =
|
|
190
|
+
const c = bn(i, r.slot);
|
|
191
191
|
if ("mouth" in r) {
|
|
192
192
|
if (c.commandBlockId || c.queryBlockId)
|
|
193
|
-
throw new
|
|
194
|
-
s.set(o,
|
|
193
|
+
throw new N("PLACE_OCCUPIED", `Mouth ${r.slot} of '${o}' isn't empty.`);
|
|
194
|
+
s.set(o, ct(i, r.slot, { commandBlockId: n.instanceId }));
|
|
195
195
|
} else {
|
|
196
196
|
if (c.queryBlockId || c.commandBlockId || c.textValue !== null)
|
|
197
|
-
throw new
|
|
198
|
-
s.set(o,
|
|
197
|
+
throw new N("PLACE_OCCUPIED", `Socket ${r.slot} of '${o}' isn't empty.`);
|
|
198
|
+
s.set(o, ct(i, r.slot, { queryBlockId: n.instanceId }));
|
|
199
199
|
}
|
|
200
200
|
return s.set(n.instanceId, { ...n, x: 0, y: 0, embeddedInBlockId: o, embeddedSlotIndex: r.slot }), { ...e, blocks: s };
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function To(e, t, n) {
|
|
203
203
|
if ("next" in n)
|
|
204
204
|
return t.parentBlockId === n.next && e.blocks.get(n.next)?.nextBlockId === t.instanceId;
|
|
205
205
|
const r = "mouth" in n ? n.mouth : n.socket;
|
|
206
206
|
if (t.embeddedInBlockId !== r || t.embeddedSlotIndex !== n.slot) return !1;
|
|
207
|
-
const o =
|
|
207
|
+
const o = ht(e.blocks.get(r)?.paramSlots[n.slot]);
|
|
208
208
|
return ("mouth" in n ? o.commandBlockId : o.queryBlockId) === t.instanceId;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
const n =
|
|
212
|
-
if (!
|
|
213
|
-
throw new
|
|
210
|
+
function Co(e, t) {
|
|
211
|
+
const n = Ne(e, t.id);
|
|
212
|
+
if (!To(e, n, t.from))
|
|
213
|
+
throw new N("NOT_AT_PLACE", `Block '${n.instanceId}' isn't linked at the given place.`);
|
|
214
214
|
const r = new Map(e.blocks), o = t.from;
|
|
215
215
|
if ("next" in o) {
|
|
216
216
|
const i = r.get(o.next);
|
|
217
217
|
r.set(o.next, { ...i, nextBlockId: null });
|
|
218
218
|
} else {
|
|
219
219
|
const i = "mouth" in o ? o.mouth : o.socket, s = "mouth" in o ? { commandBlockId: null } : { queryBlockId: null };
|
|
220
|
-
r.set(i,
|
|
220
|
+
r.set(i, ct(r.get(i), o.slot, s));
|
|
221
221
|
}
|
|
222
222
|
return r.set(n.instanceId, {
|
|
223
223
|
...n,
|
|
@@ -228,25 +228,25 @@ function yo(e, t) {
|
|
|
228
228
|
embeddedSlotIndex: -1
|
|
229
229
|
}), { ...e, blocks: r };
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
const n =
|
|
231
|
+
function Po(e, t) {
|
|
232
|
+
const n = Ne(e, t.blockId), r = bn(n, t.slot);
|
|
233
233
|
if (r.queryBlockId)
|
|
234
|
-
throw new
|
|
235
|
-
if (
|
|
236
|
-
throw new
|
|
234
|
+
throw new N("SLOT_HAS_QUERY", `Slot ${t.slot} of '${n.instanceId}' holds a query.`);
|
|
235
|
+
if (_e(r.textValue) !== _e(t.from))
|
|
236
|
+
throw new N("TEXT_CHANGED", `Slot ${t.slot} of '${n.instanceId}' has changed.`);
|
|
237
237
|
const o = new Map(e.blocks);
|
|
238
|
-
return o.set(n.instanceId,
|
|
238
|
+
return o.set(n.instanceId, ct(n, t.slot, { textValue: _e(t.to) })), { ...e, blocks: o };
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
if (!
|
|
242
|
-
throw new
|
|
240
|
+
function Eo(e, t) {
|
|
241
|
+
if (!vo(e.dependencies, t.from))
|
|
242
|
+
throw new N("DEPENDENCIES_CHANGED", "The dependencies have changed.");
|
|
243
243
|
return { ...e, dependencies: t.to.map((n) => ({ publisher: n.publisher, name: n.name, version: n.version })) };
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
return t.commands.reduce(
|
|
245
|
+
function Do(e, t) {
|
|
246
|
+
return t.commands.reduce(je, e);
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
class
|
|
248
|
+
const Le = { x: 0, y: 0 };
|
|
249
|
+
class gt {
|
|
250
250
|
state;
|
|
251
251
|
commands = [];
|
|
252
252
|
constructor(t) {
|
|
@@ -256,26 +256,26 @@ class pt {
|
|
|
256
256
|
return this.state;
|
|
257
257
|
}
|
|
258
258
|
add(t) {
|
|
259
|
-
this.state =
|
|
259
|
+
this.state = je(this.state, t), this.commands.push(t);
|
|
260
260
|
}
|
|
261
261
|
/** The user action: nothing, one command, or a batch. */
|
|
262
262
|
build() {
|
|
263
263
|
return this.commands.length === 0 ? null : this.commands.length === 1 ? this.commands[0] : { type: "Batch", commands: this.commands };
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function $n(e) {
|
|
267
267
|
return { x: Math.round(e.x), y: Math.round(e.y) };
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function zt(e, t) {
|
|
270
270
|
return t.parentBlockId ? { next: t.parentBlockId } : t.embeddedInBlockId ? e.blocks.get(t.embeddedInBlockId)?.paramSlots[t.embeddedSlotIndex]?.commandBlockId === t.instanceId ? { mouth: t.embeddedInBlockId, slot: t.embeddedSlotIndex } : { socket: t.embeddedInBlockId, slot: t.embeddedSlotIndex } : null;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Mo(e, t) {
|
|
273
273
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
275
|
+
function Sn(e, t) {
|
|
276
|
+
return pt(e.blocks, t).map((n) => Te(e.blocks.get(n)));
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function Ao(e, t) {
|
|
279
279
|
let n = t;
|
|
280
280
|
for (; ; ) {
|
|
281
281
|
const r = e.blocks.get(n)?.nextBlockId;
|
|
@@ -283,57 +283,57 @@ function Io(e, t) {
|
|
|
283
283
|
n = r;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function Bn(e, t, n) {
|
|
287
287
|
const r = e.current.blocks.get(t), o = { x: r.x, y: r.y };
|
|
288
288
|
if ("socket" in n) {
|
|
289
|
-
const i =
|
|
289
|
+
const i = _e(e.current.blocks.get(n.socket)?.paramSlots[n.slot]?.textValue);
|
|
290
290
|
i !== null && e.add({ type: "SetText", blockId: n.socket, slot: n.slot, from: i, to: null }), e.add({ type: "Attach", id: t, to: n, from: o });
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
293
|
if ("mouth" in n) {
|
|
294
294
|
const i = e.current.blocks.get(n.mouth)?.paramSlots[n.slot]?.commandBlockId ?? null;
|
|
295
295
|
if (i) {
|
|
296
|
-
e.add({ type: "Detach", id: i, from: n, to:
|
|
296
|
+
e.add({ type: "Detach", id: i, from: n, to: Le }), e.add({ type: "Attach", id: t, to: n, from: o }), e.add({ type: "Attach", id: i, to: { next: Ao(e.current, t) }, from: Le });
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
e.add({ type: "Attach", id: t, to: n, from: o });
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
const o = new
|
|
304
|
-
return o.add({ type: "InsertBlocks", blocks: [Te({ ...t, ...i })] }), r &&
|
|
302
|
+
function _o(e, t, n, r) {
|
|
303
|
+
const o = new gt(e), i = $n(n);
|
|
304
|
+
return o.add({ type: "InsertBlocks", blocks: [Te({ ...t, ...i })] }), r && Bn(o, t.instanceId, r), o.build();
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function un(e, t, n, r) {
|
|
307
307
|
const o = e.blocks.get(t);
|
|
308
308
|
if (!o) return null;
|
|
309
|
-
const i = new
|
|
310
|
-
return r && c &&
|
|
309
|
+
const i = new gt(e), s = $n(n), c = zt(e, o);
|
|
310
|
+
return r && c && Mo(r, c) ? null : (c ? i.add({ type: "Detach", id: t, from: c, to: s }) : !r && (o.x !== s.x || o.y !== s.y) && i.add({ type: "MoveBlock", id: t, from: { x: o.x, y: o.y }, to: s }), r && Bn(i, t, r), i.build());
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function Lo(e, t) {
|
|
313
313
|
const n = e.blocks.get(t);
|
|
314
314
|
if (!n) return null;
|
|
315
|
-
const r = new
|
|
316
|
-
return o && r.add({ type: "Detach", id: t, from: o, to:
|
|
315
|
+
const r = new gt(e), o = zt(e, n);
|
|
316
|
+
return o && r.add({ type: "Detach", id: t, from: o, to: Le }), r.add({ type: "RemoveBlocks", blocks: Sn(r.current, t) }), r.build();
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
const o =
|
|
318
|
+
function fn(e, t, n, r) {
|
|
319
|
+
const o = _e(n), i = _e(r);
|
|
320
320
|
return o === i ? null : { type: "SetText", blockId: e, slot: t, from: o, to: i };
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
const r = new
|
|
322
|
+
function No(e, t, n) {
|
|
323
|
+
const r = new gt(e);
|
|
324
324
|
for (const o of n) {
|
|
325
325
|
const i = r.current.blocks.get(o);
|
|
326
326
|
if (!i) continue;
|
|
327
|
-
const s =
|
|
327
|
+
const s = zt(r.current, i), c = i.nextBlockId;
|
|
328
328
|
if (c) {
|
|
329
|
-
const
|
|
330
|
-
r.add({ type: "Detach", id: c, from: { next: o }, to:
|
|
329
|
+
const p = s ? Le : { x: i.x, y: i.y };
|
|
330
|
+
r.add({ type: "Detach", id: c, from: { next: o }, to: p });
|
|
331
331
|
}
|
|
332
|
-
s && r.add({ type: "Detach", id: o, from: s, to:
|
|
332
|
+
s && r.add({ type: "Detach", id: o, from: s, to: Le }), r.add({ type: "RemoveBlocks", blocks: Sn(r.current, o) }), c && s && r.add({ type: "Attach", id: c, to: s, from: Le });
|
|
333
333
|
}
|
|
334
334
|
return r.add({ type: "SetDependencies", from: r.current.dependencies, to: t }), r.build();
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function wn(e) {
|
|
337
337
|
switch (e.type) {
|
|
338
338
|
case "InsertBlocks":
|
|
339
339
|
return { type: "RemoveBlocks", blocks: e.blocks };
|
|
@@ -350,37 +350,37 @@ function In(e) {
|
|
|
350
350
|
case "SetDependencies":
|
|
351
351
|
return { type: "SetDependencies", from: e.to, to: e.from };
|
|
352
352
|
case "Batch":
|
|
353
|
-
return { type: "Batch", commands: e.commands.map(
|
|
353
|
+
return { type: "Batch", commands: e.commands.map(wn).reverse() };
|
|
354
354
|
default:
|
|
355
|
-
throw new
|
|
355
|
+
throw new N("INVALID_COMMAND", `Unknown command type '${e.type}'.`);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function Tn(e, t = 0) {
|
|
359
359
|
return { confirmed: e, version: t, pending: [], undo: [], redo: [] };
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function Oo(e, t, n) {
|
|
362
362
|
return { ...e, pending: [...e.pending, { id: t, command: n, kind: "do", original: n }] };
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Ro(e, t) {
|
|
365
365
|
const n = e.undo[e.undo.length - 1];
|
|
366
|
-
if (!n || !
|
|
367
|
-
const r =
|
|
366
|
+
if (!n || !lt(e)) return null;
|
|
367
|
+
const r = wn(n);
|
|
368
368
|
return { sync: { ...e, pending: [...e.pending, { id: t, command: r, kind: "undo", original: n }] }, command: r };
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Ho(e, t) {
|
|
371
371
|
const n = e.redo[e.redo.length - 1];
|
|
372
|
-
return !n || !
|
|
372
|
+
return !n || !lt(e) ? null : { sync: { ...e, pending: [...e.pending, { id: t, command: n, kind: "redo", original: n }] }, command: n };
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function lt(e) {
|
|
375
375
|
return e.pending.length === 0;
|
|
376
376
|
}
|
|
377
|
-
function
|
|
378
|
-
return { sync:
|
|
377
|
+
function zo(e, t, n) {
|
|
378
|
+
return { sync: Tn(e, t), dropped: n.pending.length };
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function hn(e, t, n) {
|
|
381
381
|
let r;
|
|
382
382
|
try {
|
|
383
|
-
r =
|
|
383
|
+
r = je(e.confirmed, t.command);
|
|
384
384
|
} catch {
|
|
385
385
|
return { sync: e, outOfSync: !0 };
|
|
386
386
|
}
|
|
@@ -395,17 +395,17 @@ function ln(e, t, n) {
|
|
|
395
395
|
return { sync: { ...i, undo: [...i.undo, o.original], redo: i.redo.slice(0, -1) }, outOfSync: !1 };
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function pn(e, t) {
|
|
399
399
|
const n = e.pending.find((o) => o.id === t) ?? null;
|
|
400
400
|
if (!n) return { sync: e, action: null };
|
|
401
401
|
const r = { ...e, pending: e.pending.filter((o) => o.id !== t) };
|
|
402
402
|
return n.kind === "undo" ? { sync: { ...r, undo: r.undo.slice(0, -1) }, action: n } : n.kind === "redo" ? { sync: { ...r, redo: r.redo.slice(0, -1) }, action: n } : { sync: r, action: n };
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function gn(e) {
|
|
405
405
|
let t = e.confirmed;
|
|
406
406
|
for (const r of e.pending)
|
|
407
407
|
try {
|
|
408
|
-
t =
|
|
408
|
+
t = je(t, r.command);
|
|
409
409
|
} catch {
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
@@ -414,15 +414,15 @@ function dn(e) {
|
|
|
414
414
|
e.confirmed.blocks.get(o) !== r && n.add(o);
|
|
415
415
|
}), { state: t, provisionalIds: n };
|
|
416
416
|
}
|
|
417
|
-
const
|
|
418
|
-
class
|
|
419
|
-
presence =
|
|
417
|
+
const Cn = 66, Wo = { cursor: null, drag: null, typing: null };
|
|
418
|
+
class qo {
|
|
419
|
+
presence = Wo;
|
|
420
420
|
lastSent = Number.NEGATIVE_INFINITY;
|
|
421
421
|
timer = null;
|
|
422
422
|
send;
|
|
423
423
|
intervalMs;
|
|
424
424
|
now;
|
|
425
|
-
constructor(t, n =
|
|
425
|
+
constructor(t, n = Cn, r = Date.now) {
|
|
426
426
|
this.send = t, this.intervalMs = n, this.now = r;
|
|
427
427
|
}
|
|
428
428
|
get current() {
|
|
@@ -446,127 +446,149 @@ class Mo {
|
|
|
446
446
|
this.dispose(), this.lastSent = this.now(), this.send(this.presence);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
async function
|
|
451
|
-
const t =
|
|
449
|
+
const Pt = "command", ge = /* @__PURE__ */ new Map(), Ke = /* @__PURE__ */ new Map(), Ie = /* @__PURE__ */ new Map();
|
|
450
|
+
async function Wt(e) {
|
|
451
|
+
const t = Ie.get(e.id);
|
|
452
452
|
if (t && t.info.url === e.url) return t;
|
|
453
|
-
t &&
|
|
453
|
+
t && qt(e.id);
|
|
454
454
|
const n = await fetch(e.url);
|
|
455
455
|
if (!n.ok) throw new Error(`HTTP ${n.status} fetching ${e.url}`);
|
|
456
456
|
const r = await n.json(), o = [], i = [];
|
|
457
457
|
for (const c of r)
|
|
458
|
-
|
|
458
|
+
ge.has(c.id) ? i.push(c.id) : (ge.set(c.id, c), Ke.set(c.id, e.id), o.push(c.id));
|
|
459
459
|
const s = { info: e, blockIds: o, conflictIds: i };
|
|
460
|
-
return
|
|
460
|
+
return Ie.set(e.id, s), s;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
const t =
|
|
462
|
+
function qt(e) {
|
|
463
|
+
const t = Ie.get(e);
|
|
464
464
|
if (t) {
|
|
465
465
|
for (const n of t.blockIds)
|
|
466
|
-
|
|
467
|
-
|
|
466
|
+
ge.delete(n), Ke.delete(n);
|
|
467
|
+
Ie.delete(e);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
return Array.from(
|
|
470
|
+
function Ye() {
|
|
471
|
+
return Array.from(Ie.values());
|
|
472
472
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
473
|
+
function Pn(e) {
|
|
474
|
+
return Ke.get(e);
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
const t =
|
|
476
|
+
function at(e) {
|
|
477
|
+
const t = ge.get(e);
|
|
478
478
|
if (!t) throw new Error(`Block definition not found: "${e}"`);
|
|
479
479
|
return t;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
return
|
|
481
|
+
function H(e) {
|
|
482
|
+
return ge.get(e);
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
return [...
|
|
484
|
+
function En() {
|
|
485
|
+
return [...ge.values()];
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
return [...new Set(
|
|
487
|
+
function Uo() {
|
|
488
|
+
return [...new Set(En().map((e) => e.category))];
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function Vo(e, t) {
|
|
491
491
|
const n = [], r = [];
|
|
492
492
|
for (const i of t)
|
|
493
|
-
|
|
493
|
+
ge.has(i.id) ? r.push(i.id) : (ge.set(i.id, i), Ke.set(i.id, e.id), n.push(i.id));
|
|
494
494
|
const o = { info: e, blockIds: n, conflictIds: r };
|
|
495
|
-
return
|
|
495
|
+
return Ie.set(e.id, o), o;
|
|
496
496
|
}
|
|
497
|
-
async function
|
|
498
|
-
|
|
497
|
+
async function Yo(e) {
|
|
498
|
+
Ie.get(yn)?.info.url !== e && (ge.clear(), Ke.clear(), Ie.clear(), await Wt({ id: yn, name: "Core", description: "Built-in blocks", url: e, builtIn: !0 }));
|
|
499
499
|
}
|
|
500
|
-
const
|
|
501
|
-
function
|
|
500
|
+
const yn = "__core__", Dn = 36, Ce = 50, be = 24, Fe = 24, Ut = 16, Xo = 24, Et = 24, Fo = 16, Mn = 20, jo = 26, Ko = 8, Qo = 6, Dt = 12, Ct = 12, An = 8, Mt = 6;
|
|
501
|
+
function _n(e) {
|
|
502
502
|
return e.blockType === "query" && e.returnType ? `${e.name} [${e.returnType}]` : e.name;
|
|
503
503
|
}
|
|
504
|
-
const
|
|
505
|
-
number: { w: 44, h:
|
|
506
|
-
string: { w: 60, h:
|
|
507
|
-
boolean: { w: 52, h:
|
|
508
|
-
},
|
|
509
|
-
function
|
|
510
|
-
return
|
|
504
|
+
const Go = {
|
|
505
|
+
number: { w: 44, h: be },
|
|
506
|
+
string: { w: 60, h: be },
|
|
507
|
+
boolean: { w: 52, h: be }
|
|
508
|
+
}, Zo = { w: 75, h: be };
|
|
509
|
+
function dt(e) {
|
|
510
|
+
return Go[e] ?? Zo;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return e.blockType === "command" && t.type ===
|
|
512
|
+
function Oe(e, t) {
|
|
513
|
+
return e.blockType === "command" && t.type === Pt;
|
|
514
|
+
}
|
|
515
|
+
const Jo = 18;
|
|
516
|
+
function Ln(e, t) {
|
|
517
|
+
return !!e.optional && !t?.queryBlockId && !t?.textValue;
|
|
518
|
+
}
|
|
519
|
+
function Nn(e) {
|
|
520
|
+
return `+ ${e}`;
|
|
514
521
|
}
|
|
515
|
-
function
|
|
522
|
+
function er(e) {
|
|
523
|
+
return Nn(e).length * Rn + 12;
|
|
524
|
+
}
|
|
525
|
+
function On(e, t, n) {
|
|
526
|
+
if (Ln(e, t)) return er(e.name);
|
|
516
527
|
if (t?.queryBlockId && n) {
|
|
517
528
|
const r = n.get(t.queryBlockId);
|
|
518
529
|
if (r) {
|
|
519
|
-
const o =
|
|
530
|
+
const o = H(r.definitionId);
|
|
520
531
|
if (o) return ue(o, r.paramSlots, n);
|
|
521
532
|
}
|
|
522
533
|
}
|
|
523
|
-
return
|
|
534
|
+
return dt(e.type).w;
|
|
524
535
|
}
|
|
525
|
-
const
|
|
526
|
-
function
|
|
527
|
-
const o = t === "number" || t === "boolean" ? n -
|
|
536
|
+
const Rn = 5;
|
|
537
|
+
function tr(e, t, n) {
|
|
538
|
+
const o = t === "number" || t === "boolean" ? n - be : n - 10, i = Math.floor(o / Rn);
|
|
528
539
|
return e.length <= i ? e : i <= 1 ? "…" : `${e.slice(0, i - 1)}…`;
|
|
529
540
|
}
|
|
530
|
-
function
|
|
541
|
+
function At(e, t) {
|
|
531
542
|
return `${e}: ${t}`;
|
|
532
543
|
}
|
|
533
|
-
function
|
|
544
|
+
function Hn(e) {
|
|
545
|
+
const t = At(e.name, e.type);
|
|
546
|
+
return e.optional ? `${t} (optional)` : t;
|
|
547
|
+
}
|
|
548
|
+
function nr(e) {
|
|
534
549
|
return Math.max(72, e.length * 6 + 22);
|
|
535
550
|
}
|
|
551
|
+
function Vt(e) {
|
|
552
|
+
let t = Ko;
|
|
553
|
+
return (e.blockType === "start" ? e.provides ?? [] : []).map((n) => {
|
|
554
|
+
const r = { id: n.id, name: n.name, x: t, y: Ce + 6, w: nr(n.name) };
|
|
555
|
+
return t += r.w + Qo, r;
|
|
556
|
+
});
|
|
557
|
+
}
|
|
536
558
|
function ue(e, t, n) {
|
|
537
|
-
let r =
|
|
538
|
-
for (let
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
559
|
+
let r = Dt + Ct + _n(e).length * Mt;
|
|
560
|
+
for (let s = 0; s < e.params.length; s++)
|
|
561
|
+
Oe(e, e.params[s]) || (r += An + On(e.params[s], t?.[s], n));
|
|
562
|
+
const o = Vt(e);
|
|
563
|
+
if (o.length > 0) {
|
|
564
|
+
const s = o[o.length - 1];
|
|
565
|
+
r = Math.max(r, s.x + s.w + Ct);
|
|
566
|
+
}
|
|
567
|
+
e.params.forEach((s) => {
|
|
568
|
+
Oe(e, s) && (r = Math.max(r, Ut + Dt + s.name.length * Mt + Ct));
|
|
545
569
|
});
|
|
546
|
-
const
|
|
547
|
-
return Math.max(
|
|
570
|
+
const i = e.blockType === "start" ? 140 : 110;
|
|
571
|
+
return Math.max(i, r);
|
|
548
572
|
}
|
|
549
|
-
function
|
|
550
|
-
return e.blockType === "start" ?
|
|
573
|
+
function Qe(e) {
|
|
574
|
+
return e.blockType === "start" ? Ce : e.blockType === "command" ? Dn : be;
|
|
551
575
|
}
|
|
552
|
-
function
|
|
553
|
-
if (e.blockType === "start")
|
|
554
|
-
|
|
555
|
-
return me + (r > 0 ? 8 + r * Ht : 0);
|
|
556
|
-
}
|
|
576
|
+
function ve(e, t, n) {
|
|
577
|
+
if (e.blockType === "start")
|
|
578
|
+
return Ce + (e.provides && e.provides.length > 0 ? 8 + jo : 0);
|
|
557
579
|
if (e.blockType === "command") {
|
|
558
580
|
const r = Ee(e, t, n);
|
|
559
|
-
if (r.length === 0) return
|
|
581
|
+
if (r.length === 0) return Dn;
|
|
560
582
|
const o = r[r.length - 1];
|
|
561
|
-
return o.y + o.h +
|
|
583
|
+
return o.y + o.h + Fo;
|
|
562
584
|
}
|
|
563
|
-
return
|
|
585
|
+
return be;
|
|
564
586
|
}
|
|
565
|
-
function
|
|
566
|
-
const n =
|
|
567
|
-
return n ?
|
|
587
|
+
function Yt(e, t) {
|
|
588
|
+
const n = H(e.definitionId);
|
|
589
|
+
return n ? ve(n, e.paramSlots, t) : Fe;
|
|
568
590
|
}
|
|
569
|
-
function
|
|
591
|
+
function zn(e, t) {
|
|
570
592
|
let n = 0;
|
|
571
593
|
const r = /* @__PURE__ */ new Set();
|
|
572
594
|
let o = e;
|
|
@@ -574,86 +596,86 @@ function Dn(e, t) {
|
|
|
574
596
|
r.add(o);
|
|
575
597
|
const i = t.get(o);
|
|
576
598
|
if (!i) break;
|
|
577
|
-
n +=
|
|
599
|
+
n += Yt(i, t), o = i.nextBlockId;
|
|
578
600
|
}
|
|
579
601
|
return n;
|
|
580
602
|
}
|
|
581
603
|
function Ee(e, t, n) {
|
|
582
604
|
const r = [];
|
|
583
|
-
let o =
|
|
605
|
+
let o = Qe(e);
|
|
584
606
|
return e.params.forEach((i, s) => {
|
|
585
|
-
if (!
|
|
607
|
+
if (!Oe(e, i)) return;
|
|
586
608
|
let c = null;
|
|
587
|
-
r.length > 0 && (c = o, o +=
|
|
588
|
-
const
|
|
589
|
-
r.push({ index: s, name: i.name, x:
|
|
609
|
+
r.length > 0 && (c = o, o += Et);
|
|
610
|
+
const p = t?.[s]?.commandBlockId, m = p && n ? zn(p, n) : 0, g = Math.max(Xo, m);
|
|
611
|
+
r.push({ index: s, name: i.name, x: Ut, y: o, h: g, dividerY: c }), o += g;
|
|
590
612
|
}), r;
|
|
591
613
|
}
|
|
592
|
-
function
|
|
593
|
-
const r =
|
|
594
|
-
let i =
|
|
614
|
+
function Ge(e, t, n) {
|
|
615
|
+
const r = Qe(e), o = [];
|
|
616
|
+
let i = Dt + _n(e).length * Mt;
|
|
595
617
|
for (let s = 0; s < e.params.length; s++) {
|
|
596
618
|
const c = e.params[s];
|
|
597
|
-
if (
|
|
598
|
-
const
|
|
599
|
-
i +=
|
|
619
|
+
if (Oe(e, c)) continue;
|
|
620
|
+
const p = Ln(c, t?.[s]), m = On(c, t?.[s], n), g = p ? Jo : dt(c.type).h;
|
|
621
|
+
i += An, o.push({ x: i, y: (r - g) / 2, w: m, h: g, type: c.type, index: s, collapsed: p }), i += m;
|
|
600
622
|
}
|
|
601
623
|
return o;
|
|
602
624
|
}
|
|
603
|
-
function
|
|
625
|
+
function or(e) {
|
|
604
626
|
const t = /* @__PURE__ */ new Map();
|
|
605
627
|
function n(r, o, i) {
|
|
606
628
|
const s = e.get(r);
|
|
607
629
|
if (!s || t.has(r)) return;
|
|
608
630
|
t.set(r, { x: o, y: i });
|
|
609
|
-
const c =
|
|
631
|
+
const c = H(s.definitionId);
|
|
610
632
|
if (c) {
|
|
611
|
-
for (const
|
|
612
|
-
const
|
|
613
|
-
|
|
633
|
+
for (const p of Ge(c, s.paramSlots, e)) {
|
|
634
|
+
const m = s.paramSlots[p.index]?.queryBlockId;
|
|
635
|
+
m && n(m, o + p.x, i + p.y);
|
|
614
636
|
}
|
|
615
|
-
for (const
|
|
616
|
-
const
|
|
617
|
-
|
|
637
|
+
for (const p of Ee(c, s.paramSlots, e)) {
|
|
638
|
+
const m = s.paramSlots[p.index]?.commandBlockId;
|
|
639
|
+
m && n(m, o + p.x, i + p.y);
|
|
618
640
|
}
|
|
619
641
|
}
|
|
620
|
-
s.nextBlockId && n(s.nextBlockId, o, i +
|
|
642
|
+
s.nextBlockId && n(s.nextBlockId, o, i + Yt(s, e));
|
|
621
643
|
}
|
|
622
644
|
return e.forEach((r) => {
|
|
623
645
|
!r.parentBlockId && !r.embeddedInBlockId && n(r.instanceId, r.x, r.y);
|
|
624
646
|
}), t;
|
|
625
647
|
}
|
|
626
|
-
function
|
|
648
|
+
function rr(e, t) {
|
|
627
649
|
const n = /* @__PURE__ */ new Set();
|
|
628
650
|
function r(s) {
|
|
629
651
|
const c = [];
|
|
630
|
-
let
|
|
631
|
-
for (;
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
634
|
-
c.push(o(
|
|
652
|
+
let p = s ?? null;
|
|
653
|
+
for (; p && !n.has(p); ) {
|
|
654
|
+
const m = e.blocks.get(p);
|
|
655
|
+
if (!m) break;
|
|
656
|
+
c.push(o(m)), p = m.nextBlockId;
|
|
635
657
|
}
|
|
636
658
|
return c;
|
|
637
659
|
}
|
|
638
660
|
function o(s) {
|
|
639
661
|
n.add(s.instanceId);
|
|
640
|
-
const c = t(s.definitionId),
|
|
641
|
-
const B = c?.params[
|
|
662
|
+
const c = t(s.definitionId), p = s.paramSlots.map((m, g) => {
|
|
663
|
+
const B = c?.params[g] ?? { name: `param${g}`, type: "string" }, z = m.queryBlockId ? e.blocks.get(m.queryBlockId) : void 0;
|
|
642
664
|
let w;
|
|
643
|
-
return c &&
|
|
665
|
+
return c && Oe(c, B) ? w = { kind: "body", body: r(m.commandBlockId) } : z ? w = { kind: "query", node: o(z) } : m.textValue !== null && m.textValue !== void 0 && m.textValue !== "" ? w = { kind: "text", text: m.textValue } : w = { kind: "empty" }, { name: B.name, type: B.type, value: w };
|
|
644
666
|
});
|
|
645
667
|
return {
|
|
646
668
|
definitionId: s.definitionId,
|
|
647
669
|
name: c?.name ?? s.definitionId,
|
|
648
670
|
blockType: c?.blockType ?? "missing",
|
|
649
|
-
args:
|
|
671
|
+
args: p
|
|
650
672
|
};
|
|
651
673
|
}
|
|
652
674
|
return {
|
|
653
675
|
roots: [...e.blocks.values()].filter((s) => !s.parentBlockId && !s.embeddedInBlockId).sort((s, c) => s.y - c.y || s.x - c.x || (s.instanceId < c.instanceId ? -1 : s.instanceId > c.instanceId ? 1 : 0)).map((s) => ({ position: { x: s.x, y: s.y }, body: r(s.instanceId) }))
|
|
654
676
|
};
|
|
655
677
|
}
|
|
656
|
-
const
|
|
678
|
+
const Xe = {
|
|
657
679
|
id: "dark",
|
|
658
680
|
label: "Dark",
|
|
659
681
|
// Surfaces — stepped hierarchy so each layer reads as distinct
|
|
@@ -708,7 +730,7 @@ const qe = {
|
|
|
708
730
|
switcherText: "#5a6888",
|
|
709
731
|
switcherActiveText: "#c9a43a",
|
|
710
732
|
switcherBorder: "#252d42"
|
|
711
|
-
},
|
|
733
|
+
}, ir = {
|
|
712
734
|
id: "light",
|
|
713
735
|
label: "Light",
|
|
714
736
|
appBg: "#f0f2f6",
|
|
@@ -751,64 +773,64 @@ const qe = {
|
|
|
751
773
|
switcherText: "#9090a0",
|
|
752
774
|
switcherActiveText: "#1a2030",
|
|
753
775
|
switcherBorder: "#dde2ec"
|
|
754
|
-
},
|
|
755
|
-
function
|
|
756
|
-
return
|
|
776
|
+
}, ot = [Xe, ir], rt = yo(Xe);
|
|
777
|
+
function K() {
|
|
778
|
+
return mo(rt);
|
|
757
779
|
}
|
|
758
|
-
const
|
|
759
|
-
function
|
|
780
|
+
const j = 16, ke = 14, Be = j + ke / 2, we = 5, A = 4;
|
|
781
|
+
function sr(e, t) {
|
|
760
782
|
return [
|
|
761
|
-
`M ${
|
|
783
|
+
`M ${A} 0`,
|
|
762
784
|
// Top edge with inlet (triangle dips into the block)
|
|
763
|
-
`H ${
|
|
764
|
-
`H ${e -
|
|
765
|
-
`V ${t -
|
|
785
|
+
`H ${j} L ${Be} ${we} L ${j + ke} 0`,
|
|
786
|
+
`H ${e - A} Q ${e} 0 ${e} ${A}`,
|
|
787
|
+
`V ${t - A} Q ${e} ${t} ${e - A} ${t}`,
|
|
766
788
|
// Bottom edge with outlet (triangle protrudes below)
|
|
767
|
-
`H ${
|
|
768
|
-
`H ${
|
|
769
|
-
`V ${
|
|
789
|
+
`H ${j + ke} L ${Be} ${t + we} L ${j} ${t}`,
|
|
790
|
+
`H ${A} Q 0 ${t} 0 ${t - A}`,
|
|
791
|
+
`V ${A} Q 0 0 ${A} 0 Z`
|
|
770
792
|
].join(" ");
|
|
771
793
|
}
|
|
772
|
-
function
|
|
794
|
+
function cr(e, t, n, r) {
|
|
773
795
|
const o = [
|
|
774
|
-
`M ${
|
|
796
|
+
`M ${A} 0`,
|
|
775
797
|
// Top edge with inlet
|
|
776
|
-
`H ${
|
|
777
|
-
`H ${e -
|
|
798
|
+
`H ${j} L ${Be} ${we} L ${j + ke} 0`,
|
|
799
|
+
`H ${e - A} Q ${e} 0 ${e} ${A}`
|
|
778
800
|
];
|
|
779
801
|
for (const i of r) {
|
|
780
802
|
const s = i.y, c = i.y + i.h;
|
|
781
803
|
o.push(
|
|
782
804
|
// Right edge down to the mouth, then its roof leftwards with an outlet tab into the mouth
|
|
783
805
|
`V ${s}`,
|
|
784
|
-
`H ${n +
|
|
806
|
+
`H ${n + j + ke} L ${n + Be} ${s + we} L ${n + j} ${s}`,
|
|
785
807
|
`H ${n}`,
|
|
786
808
|
// Inner wall, then the floor rightwards with an inlet for the chain's last tab
|
|
787
809
|
`V ${c}`,
|
|
788
|
-
`H ${n +
|
|
810
|
+
`H ${n + j} L ${n + Be} ${c + we} L ${n + j + ke} ${c}`,
|
|
789
811
|
`H ${e}`
|
|
790
812
|
);
|
|
791
813
|
}
|
|
792
814
|
return o.push(
|
|
793
|
-
`V ${t -
|
|
815
|
+
`V ${t - A} Q ${e} ${t} ${e - A} ${t}`,
|
|
794
816
|
// Bottom edge with outlet
|
|
795
|
-
`H ${
|
|
796
|
-
`H ${
|
|
797
|
-
`V ${
|
|
817
|
+
`H ${j + ke} L ${Be} ${t + we} L ${j} ${t}`,
|
|
818
|
+
`H ${A} Q 0 ${t} 0 ${t - A}`,
|
|
819
|
+
`V ${A} Q 0 0 ${A} 0 Z`
|
|
798
820
|
), o.join(" ");
|
|
799
821
|
}
|
|
800
|
-
function
|
|
822
|
+
function lr(e, t) {
|
|
801
823
|
return [
|
|
802
824
|
"M 0 10 Q 0 0 10 0",
|
|
803
825
|
`H ${e - 10} Q ${e} 0 ${e} 10`,
|
|
804
|
-
`V ${t -
|
|
826
|
+
`V ${t - A} Q ${e} ${t} ${e - A} ${t}`,
|
|
805
827
|
// Bottom outlet only — start blocks have no inlet
|
|
806
|
-
`H ${
|
|
807
|
-
`H ${
|
|
828
|
+
`H ${j + ke} L ${Be} ${t + we} L ${j} ${t}`,
|
|
829
|
+
`H ${A} Q 0 ${t} 0 ${t - A}`,
|
|
808
830
|
"V 10 Z"
|
|
809
831
|
].join(" ");
|
|
810
832
|
}
|
|
811
|
-
function
|
|
833
|
+
function ar(e, t) {
|
|
812
834
|
const n = t / 2;
|
|
813
835
|
return [
|
|
814
836
|
`M ${n} 0 H ${e - n}`,
|
|
@@ -816,7 +838,7 @@ function Fo(e, t) {
|
|
|
816
838
|
`H ${n} A ${n} ${n} 0 0 1 ${n} 0 Z`
|
|
817
839
|
].join(" ");
|
|
818
840
|
}
|
|
819
|
-
function
|
|
841
|
+
function dr(e, t) {
|
|
820
842
|
const n = t / 2;
|
|
821
843
|
return [
|
|
822
844
|
`M ${n} 0 H ${e - n}`,
|
|
@@ -824,7 +846,7 @@ function Qo(e, t) {
|
|
|
824
846
|
`H ${n} L 0 ${t / 2} Z`
|
|
825
847
|
].join(" ");
|
|
826
848
|
}
|
|
827
|
-
function
|
|
849
|
+
function Wn(e, t, n) {
|
|
828
850
|
return [
|
|
829
851
|
`M ${n} 0 H ${e - n} Q ${e} 0 ${e} ${n}`,
|
|
830
852
|
`V ${t - n} Q ${e} ${t} ${e - n} ${t}`,
|
|
@@ -832,49 +854,49 @@ function Mn(e, t, n) {
|
|
|
832
854
|
`V ${n} Q 0 0 ${n} 0 Z`
|
|
833
855
|
].join(" ");
|
|
834
856
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
857
|
+
function ur(e, t) {
|
|
858
|
+
return Wn(e, t, 5);
|
|
837
859
|
}
|
|
838
|
-
function
|
|
839
|
-
return
|
|
860
|
+
function fr(e, t) {
|
|
861
|
+
return Wn(e, t, 9);
|
|
840
862
|
}
|
|
841
|
-
function
|
|
863
|
+
function Xt(e, t, n) {
|
|
842
864
|
switch (e) {
|
|
843
865
|
case "number":
|
|
844
|
-
return
|
|
866
|
+
return ar(t, n);
|
|
845
867
|
case "boolean":
|
|
846
|
-
return
|
|
868
|
+
return dr(t, n);
|
|
847
869
|
case "string":
|
|
848
|
-
return
|
|
870
|
+
return ur(t, n);
|
|
849
871
|
default:
|
|
850
|
-
return
|
|
872
|
+
return fr(t, n);
|
|
851
873
|
}
|
|
852
874
|
}
|
|
853
|
-
function
|
|
854
|
-
return
|
|
875
|
+
function Ft(e, t, n) {
|
|
876
|
+
return Xt(e, t, n);
|
|
855
877
|
}
|
|
856
|
-
function
|
|
857
|
-
const r = ue(e, t, n), o =
|
|
858
|
-
if (e.blockType === "start") return
|
|
859
|
-
if (e.blockType === "query") return
|
|
878
|
+
function jt(e, t, n) {
|
|
879
|
+
const r = ue(e, t, n), o = ve(e, t, n);
|
|
880
|
+
if (e.blockType === "start") return lr(r, o);
|
|
881
|
+
if (e.blockType === "query") return Xt(e.returnType, r, o);
|
|
860
882
|
const i = Ee(e, t, n);
|
|
861
|
-
return i.length > 0 ?
|
|
862
|
-
}
|
|
863
|
-
function
|
|
864
|
-
const s =
|
|
865
|
-
function
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
868
|
-
const
|
|
869
|
-
n([...t, { publisher:
|
|
883
|
+
return i.length > 0 ? cr(r, o, Ut, i) : sr(r, o);
|
|
884
|
+
}
|
|
885
|
+
function hr({ available: e, dependencies: t, onChange: n, actions: r, blockCounts: o, conflictCounts: i }) {
|
|
886
|
+
const s = K(), [c, p] = E(""), [m, g] = E(""), [B, z] = E(!1), [w, W] = E(null), q = new Map(e.map((k) => [Z(k), k])), $ = new Set(t.map(Z)), v = e.filter((k) => !$.has(Z(k)));
|
|
887
|
+
function J() {
|
|
888
|
+
const k = q.get(c);
|
|
889
|
+
if (!k) return;
|
|
890
|
+
const O = B && m.trim() ? m.trim() : k.version;
|
|
891
|
+
n([...t, { publisher: k.publisher, name: k.name, version: O }]), p(""), g("");
|
|
870
892
|
}
|
|
871
|
-
function k
|
|
872
|
-
n(t.filter((
|
|
893
|
+
function x(k) {
|
|
894
|
+
n(t.filter((O) => Z(O) !== k)), W(null);
|
|
873
895
|
}
|
|
874
|
-
function
|
|
875
|
-
n(t.map((
|
|
896
|
+
function Q(k, O) {
|
|
897
|
+
n(t.map((X) => Z(X) === k ? { ...X, version: O } : X));
|
|
876
898
|
}
|
|
877
|
-
const
|
|
899
|
+
const ee = {
|
|
878
900
|
background: s.inputBg,
|
|
879
901
|
color: s.textPrimary,
|
|
880
902
|
border: `1px solid ${s.inputBorder}`,
|
|
@@ -883,7 +905,7 @@ function Zo({ available: e, dependencies: t, onChange: n, actions: r, blockCount
|
|
|
883
905
|
padding: "4px 6px",
|
|
884
906
|
outline: "none",
|
|
885
907
|
minWidth: 0
|
|
886
|
-
},
|
|
908
|
+
}, ae = {
|
|
887
909
|
background: "none",
|
|
888
910
|
color: s.textSecondary,
|
|
889
911
|
border: `1px solid ${s.border}`,
|
|
@@ -891,9 +913,9 @@ function Zo({ available: e, dependencies: t, onChange: n, actions: r, blockCount
|
|
|
891
913
|
fontSize: 11,
|
|
892
914
|
padding: "4px 8px",
|
|
893
915
|
cursor: "pointer"
|
|
894
|
-
},
|
|
916
|
+
}, te = w ? o.get(w) ?? 0 : 0;
|
|
895
917
|
return /* @__PURE__ */ y("div", { style: { flex: 1, overflowY: "auto", padding: 10, display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
896
|
-
t.length === 0 && /* @__PURE__ */
|
|
918
|
+
t.length === 0 && /* @__PURE__ */ l("div", { style: { color: s.textMuted, fontSize: 11, fontStyle: "italic" }, children: "No packages yet — add one to get blocks." }),
|
|
897
919
|
w && /* @__PURE__ */ y("div", { style: {
|
|
898
920
|
border: `1px solid ${s.deleteActiveBorder}`,
|
|
899
921
|
background: s.deleteActiveBg,
|
|
@@ -903,123 +925,123 @@ function Zo({ available: e, dependencies: t, onChange: n, actions: r, blockCount
|
|
|
903
925
|
color: s.textPrimary
|
|
904
926
|
}, children: [
|
|
905
927
|
"Remove ",
|
|
906
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ l("b", { children: w }),
|
|
907
929
|
"?",
|
|
908
930
|
" ",
|
|
909
|
-
|
|
931
|
+
te > 0 ? `Its ${te} block${te === 1 ? "" : "s"} on the canvas ${te === 1 ? "is" : "are"} deleted.` : "None of its blocks are on the canvas.",
|
|
910
932
|
/* @__PURE__ */ y("div", { style: { display: "flex", gap: 6, marginTop: 6 }, children: [
|
|
911
|
-
/* @__PURE__ */
|
|
933
|
+
/* @__PURE__ */ l(
|
|
912
934
|
"button",
|
|
913
935
|
{
|
|
914
936
|
type: "button",
|
|
915
|
-
onClick: () =>
|
|
916
|
-
style: { ...
|
|
937
|
+
onClick: () => x(w),
|
|
938
|
+
style: { ...ae, background: s.deleteActiveBorder, color: "white", borderColor: s.deleteActiveBorder },
|
|
917
939
|
children: "Remove"
|
|
918
940
|
}
|
|
919
941
|
),
|
|
920
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ l("button", { type: "button", onClick: () => W(null), style: ae, children: "Cancel" })
|
|
921
943
|
] })
|
|
922
944
|
] }),
|
|
923
|
-
t.map((
|
|
924
|
-
const
|
|
945
|
+
t.map((k) => {
|
|
946
|
+
const O = Z(k), X = q.get(O), U = X && bo(X.version, k.version) > 0 ? X.version : null, ie = i.get(O) ?? 0;
|
|
925
947
|
return /* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11 }, children: [
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
948
|
+
/* @__PURE__ */ l("span", { "aria-hidden": !0, style: { width: 9, height: 9, flexShrink: 0, background: X?.color ?? s.border } }),
|
|
949
|
+
/* @__PURE__ */ l("span", { title: X?.description, style: {
|
|
928
950
|
color: s.textPrimary,
|
|
929
951
|
overflow: "hidden",
|
|
930
952
|
textOverflow: "ellipsis",
|
|
931
953
|
whiteSpace: "nowrap"
|
|
932
|
-
}, children:
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
|
|
954
|
+
}, children: O }),
|
|
955
|
+
/* @__PURE__ */ l("span", { style: { color: s.textMuted, fontVariantNumeric: "tabular-nums" }, children: k.version }),
|
|
956
|
+
ie > 0 && /* @__PURE__ */ y(
|
|
935
957
|
"span",
|
|
936
958
|
{
|
|
937
|
-
title: `${
|
|
959
|
+
title: `${ie} block ID(s) skipped: another package already defines them`,
|
|
938
960
|
style: { fontSize: 9, color: s.accent, border: `1px solid ${s.accent}`, borderRadius: 3, padding: "0 3px" },
|
|
939
961
|
children: [
|
|
940
962
|
"⚠ ",
|
|
941
|
-
|
|
963
|
+
ie
|
|
942
964
|
]
|
|
943
965
|
}
|
|
944
966
|
),
|
|
945
|
-
|
|
967
|
+
U && /* @__PURE__ */ y(
|
|
946
968
|
"button",
|
|
947
969
|
{
|
|
948
970
|
type: "button",
|
|
949
|
-
onClick: () =>
|
|
950
|
-
title: `Version ${
|
|
951
|
-
style: { ...
|
|
971
|
+
onClick: () => Q(O, U),
|
|
972
|
+
title: `Version ${U} is available. Click to update.`,
|
|
973
|
+
style: { ...ae, padding: "0 5px", fontSize: 10, color: s.accent, borderColor: s.accent },
|
|
952
974
|
children: [
|
|
953
|
-
|
|
975
|
+
U,
|
|
954
976
|
" available"
|
|
955
977
|
]
|
|
956
978
|
}
|
|
957
979
|
),
|
|
958
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ l(
|
|
959
981
|
"button",
|
|
960
982
|
{
|
|
961
983
|
type: "button",
|
|
962
|
-
onClick: () =>
|
|
984
|
+
onClick: () => W(O),
|
|
963
985
|
title: "Remove package",
|
|
964
986
|
style: { marginLeft: "auto", background: "none", border: "none", color: s.textMuted, fontSize: 15, lineHeight: 1, cursor: "pointer" },
|
|
965
987
|
children: "×"
|
|
966
988
|
}
|
|
967
989
|
)
|
|
968
|
-
] },
|
|
990
|
+
] }, O);
|
|
969
991
|
}),
|
|
970
992
|
/* @__PURE__ */ y("div", { style: { display: "flex", gap: 6, marginTop: 4 }, children: [
|
|
971
|
-
/* @__PURE__ */ y("select", { value: c, onChange: (
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
|
|
974
|
-
|
|
993
|
+
/* @__PURE__ */ y("select", { value: c, onChange: (k) => p(k.target.value), style: { ...ee, flex: 1 }, children: [
|
|
994
|
+
/* @__PURE__ */ l("option", { value: "", children: v.length ? "Add package…" : "No more packages" }),
|
|
995
|
+
v.map((k) => /* @__PURE__ */ y("option", { value: Z(k), children: [
|
|
996
|
+
Z(k),
|
|
975
997
|
" ",
|
|
976
|
-
|
|
977
|
-
] },
|
|
998
|
+
k.version
|
|
999
|
+
] }, Z(k)))
|
|
978
1000
|
] }),
|
|
979
|
-
B && /* @__PURE__ */
|
|
1001
|
+
B && /* @__PURE__ */ l(
|
|
980
1002
|
"input",
|
|
981
1003
|
{
|
|
982
|
-
value:
|
|
983
|
-
onChange: (
|
|
984
|
-
placeholder:
|
|
985
|
-
style: { ...
|
|
1004
|
+
value: m,
|
|
1005
|
+
onChange: (k) => g(k.target.value),
|
|
1006
|
+
placeholder: q.get(c)?.version ?? "version",
|
|
1007
|
+
style: { ...ee, width: 64 }
|
|
986
1008
|
}
|
|
987
1009
|
),
|
|
988
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ l(
|
|
989
1011
|
"button",
|
|
990
1012
|
{
|
|
991
1013
|
type: "button",
|
|
992
|
-
onClick:
|
|
1014
|
+
onClick: J,
|
|
993
1015
|
disabled: !c,
|
|
994
|
-
style: { ...
|
|
1016
|
+
style: { ...ae, opacity: c ? 1 : 0.4, cursor: c ? "pointer" : "default" },
|
|
995
1017
|
children: "Add"
|
|
996
1018
|
}
|
|
997
1019
|
)
|
|
998
1020
|
] }),
|
|
999
|
-
r && r.length > 0 && /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1021
|
+
r && r.length > 0 && /* @__PURE__ */ l("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: r.map((k) => /* @__PURE__ */ l("button", { type: "button", onClick: () => ko(k, t, n), title: k.title, style: ae, children: k.label }, k.label)) }),
|
|
1022
|
+
/* @__PURE__ */ l(
|
|
1001
1023
|
"button",
|
|
1002
1024
|
{
|
|
1003
1025
|
type: "button",
|
|
1004
|
-
onClick: () =>
|
|
1026
|
+
onClick: () => z((k) => !k),
|
|
1005
1027
|
style: { alignSelf: "flex-start", background: "none", border: "none", padding: 0, color: s.textMuted, fontSize: 10, cursor: "pointer" },
|
|
1006
1028
|
children: B ? "Hide version choice" : "Choose a specific version…"
|
|
1007
1029
|
}
|
|
1008
1030
|
)
|
|
1009
1031
|
] });
|
|
1010
1032
|
}
|
|
1011
|
-
const
|
|
1012
|
-
function
|
|
1013
|
-
const r =
|
|
1014
|
-
return /* @__PURE__ */
|
|
1033
|
+
const pr = "#c08820";
|
|
1034
|
+
function Kt({ mouths: e, w: t, isEmpty: n }) {
|
|
1035
|
+
const r = K();
|
|
1036
|
+
return /* @__PURE__ */ l("g", { style: { pointerEvents: "none" }, children: e.map((o) => /* @__PURE__ */ y("g", { children: [
|
|
1015
1037
|
o.dividerY !== null && /* @__PURE__ */ y("g", { style: { pointerEvents: "all" }, children: [
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1038
|
+
/* @__PURE__ */ l("title", { children: At(o.name, Pt) }),
|
|
1039
|
+
/* @__PURE__ */ l("rect", { x: 0, y: o.dividerY, width: t, height: Et, fill: "transparent" }),
|
|
1040
|
+
/* @__PURE__ */ l(
|
|
1019
1041
|
"text",
|
|
1020
1042
|
{
|
|
1021
1043
|
x: 11,
|
|
1022
|
-
y: o.dividerY +
|
|
1044
|
+
y: o.dividerY + Et / 2 + 4,
|
|
1023
1045
|
fill: r.blockText,
|
|
1024
1046
|
fontSize: 10,
|
|
1025
1047
|
fontWeight: "bold",
|
|
@@ -1030,8 +1052,8 @@ function Ut({ mouths: e, w: t, isEmpty: n }) {
|
|
|
1030
1052
|
)
|
|
1031
1053
|
] }),
|
|
1032
1054
|
n(o.index) && /* @__PURE__ */ y("g", { style: { pointerEvents: "all" }, children: [
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ l("title", { children: At(o.name, Pt) }),
|
|
1056
|
+
/* @__PURE__ */ l(
|
|
1035
1057
|
"rect",
|
|
1036
1058
|
{
|
|
1037
1059
|
x: o.x + 3,
|
|
@@ -1040,12 +1062,12 @@ function Ut({ mouths: e, w: t, isEmpty: n }) {
|
|
|
1040
1062
|
height: o.h - 6,
|
|
1041
1063
|
rx: 3,
|
|
1042
1064
|
fill: "transparent",
|
|
1043
|
-
stroke:
|
|
1065
|
+
stroke: pr,
|
|
1044
1066
|
strokeWidth: 1,
|
|
1045
1067
|
strokeDasharray: "4,3"
|
|
1046
1068
|
}
|
|
1047
1069
|
),
|
|
1048
|
-
/* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ l(
|
|
1049
1071
|
"text",
|
|
1050
1072
|
{
|
|
1051
1073
|
x: o.x + 10,
|
|
@@ -1061,9 +1083,9 @@ function Ut({ mouths: e, w: t, isEmpty: n }) {
|
|
|
1061
1083
|
] })
|
|
1062
1084
|
] }, o.index)) });
|
|
1063
1085
|
}
|
|
1064
|
-
function
|
|
1065
|
-
const o =
|
|
1066
|
-
return /* @__PURE__ */
|
|
1086
|
+
function qn({ name: e, type: t, w: n, h: r }) {
|
|
1087
|
+
const o = K();
|
|
1088
|
+
return /* @__PURE__ */ l(
|
|
1067
1089
|
"text",
|
|
1068
1090
|
{
|
|
1069
1091
|
x: n / 2,
|
|
@@ -1074,23 +1096,75 @@ function An({ name: e, type: t, w: n, h: r }) {
|
|
|
1074
1096
|
fontFamily: "sans-serif",
|
|
1075
1097
|
fontStyle: "italic",
|
|
1076
1098
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1077
|
-
children:
|
|
1099
|
+
children: tr(e, t, n)
|
|
1100
|
+
}
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
function Un({ name: e, w: t, h: n }) {
|
|
1104
|
+
const r = K();
|
|
1105
|
+
return /* @__PURE__ */ y(Rt, { children: [
|
|
1106
|
+
/* @__PURE__ */ l(
|
|
1107
|
+
"rect",
|
|
1108
|
+
{
|
|
1109
|
+
x: 0.5,
|
|
1110
|
+
y: 0.5,
|
|
1111
|
+
width: t - 1,
|
|
1112
|
+
height: n - 1,
|
|
1113
|
+
rx: (n - 1) / 2,
|
|
1114
|
+
fill: "transparent",
|
|
1115
|
+
stroke: r.textMuted,
|
|
1116
|
+
strokeWidth: 1,
|
|
1117
|
+
strokeDasharray: "3,2"
|
|
1118
|
+
}
|
|
1119
|
+
),
|
|
1120
|
+
/* @__PURE__ */ l(
|
|
1121
|
+
"text",
|
|
1122
|
+
{
|
|
1123
|
+
x: t / 2,
|
|
1124
|
+
y: n / 2 + 3,
|
|
1125
|
+
textAnchor: "middle",
|
|
1126
|
+
fill: r.textMuted,
|
|
1127
|
+
fontSize: 9,
|
|
1128
|
+
fontFamily: "sans-serif",
|
|
1129
|
+
style: { userSelect: "none", pointerEvents: "none" },
|
|
1130
|
+
children: Nn(e)
|
|
1131
|
+
}
|
|
1132
|
+
)
|
|
1133
|
+
] });
|
|
1134
|
+
}
|
|
1135
|
+
const gr = 5;
|
|
1136
|
+
function yr({ w: e, title: t, onRemove: n }) {
|
|
1137
|
+
const r = K();
|
|
1138
|
+
return /* @__PURE__ */ y(
|
|
1139
|
+
"g",
|
|
1140
|
+
{
|
|
1141
|
+
transform: `translate(${e - 2},-1)`,
|
|
1142
|
+
onPointerDown: (o) => o.stopPropagation(),
|
|
1143
|
+
onClick: (o) => {
|
|
1144
|
+
o.stopPropagation(), n();
|
|
1145
|
+
},
|
|
1146
|
+
style: { cursor: "pointer" },
|
|
1147
|
+
children: [
|
|
1148
|
+
/* @__PURE__ */ l("title", { children: t }),
|
|
1149
|
+
/* @__PURE__ */ l("circle", { r: gr, fill: r.blockBody, stroke: r.textMuted, strokeWidth: 1 }),
|
|
1150
|
+
/* @__PURE__ */ l("path", { d: "M -2 -2 L 2 2 M 2 -2 L -2 2", stroke: r.blockText, strokeWidth: 1.2, strokeLinecap: "round" })
|
|
1151
|
+
]
|
|
1078
1152
|
}
|
|
1079
1153
|
);
|
|
1080
1154
|
}
|
|
1081
|
-
function
|
|
1082
|
-
const r =
|
|
1083
|
-
return /* @__PURE__ */
|
|
1155
|
+
function Vn({ def: e, onPointerDown: t, isPlaced: n }) {
|
|
1156
|
+
const r = K(), o = ue(e), i = ve(e), s = Ge(e), c = Ee(e), p = `pal-${e.id}`, m = jt(e);
|
|
1157
|
+
return /* @__PURE__ */ l(
|
|
1084
1158
|
"div",
|
|
1085
1159
|
{
|
|
1086
1160
|
style: { marginBottom: 6, userSelect: "none", position: "relative", opacity: n ? 0.4 : 1 },
|
|
1087
|
-
onPointerDown: n ? void 0 : (
|
|
1161
|
+
onPointerDown: n ? void 0 : (g) => t(g, e.id),
|
|
1088
1162
|
title: n ? "Already on canvas — only one instance allowed" : void 0,
|
|
1089
1163
|
children: /* @__PURE__ */ y("svg", { width: o + 2, height: i + 8, style: { display: "block", cursor: n ? "not-allowed" : "grab", overflow: "visible" }, children: [
|
|
1090
|
-
/* @__PURE__ */
|
|
1164
|
+
/* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", { id: p, children: /* @__PURE__ */ l("path", { d: m }) }) }),
|
|
1091
1165
|
/* @__PURE__ */ y("g", { transform: "translate(1, 1)", children: [
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
/* @__PURE__ */
|
|
1166
|
+
/* @__PURE__ */ l("path", { d: m, fill: r.blockBody, stroke: r.blockBorder, strokeWidth: 1.5 }),
|
|
1167
|
+
/* @__PURE__ */ l(
|
|
1094
1168
|
"rect",
|
|
1095
1169
|
{
|
|
1096
1170
|
x: 0,
|
|
@@ -1098,15 +1172,15 @@ function _n({ def: e, onPointerDown: t, isPlaced: n }) {
|
|
|
1098
1172
|
width: 4,
|
|
1099
1173
|
height: i + 20,
|
|
1100
1174
|
fill: e.color,
|
|
1101
|
-
clipPath: `url(#${
|
|
1175
|
+
clipPath: `url(#${p})`
|
|
1102
1176
|
}
|
|
1103
1177
|
),
|
|
1104
|
-
c.length > 0 && /* @__PURE__ */
|
|
1178
|
+
c.length > 0 && /* @__PURE__ */ l(Kt, { mouths: c, w: o, isEmpty: () => !0 }),
|
|
1105
1179
|
/* @__PURE__ */ y(
|
|
1106
1180
|
"text",
|
|
1107
1181
|
{
|
|
1108
1182
|
x: 11,
|
|
1109
|
-
y:
|
|
1183
|
+
y: Qe(e) / 2 + 4,
|
|
1110
1184
|
fill: r.blockText,
|
|
1111
1185
|
fontSize: 11,
|
|
1112
1186
|
fontWeight: "bold",
|
|
@@ -1114,11 +1188,11 @@ function _n({ def: e, onPointerDown: t, isPlaced: n }) {
|
|
|
1114
1188
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1115
1189
|
children: [
|
|
1116
1190
|
e.name,
|
|
1117
|
-
e.blockType === "query" && e.returnType && /* @__PURE__ */
|
|
1191
|
+
e.blockType === "query" && e.returnType && /* @__PURE__ */ l("tspan", { fill: r.textMuted, fontSize: 9, fontWeight: "normal", children: ` [${e.returnType}]` })
|
|
1118
1192
|
]
|
|
1119
1193
|
}
|
|
1120
1194
|
),
|
|
1121
|
-
n && /* @__PURE__ */
|
|
1195
|
+
n && /* @__PURE__ */ l(
|
|
1122
1196
|
"text",
|
|
1123
1197
|
{
|
|
1124
1198
|
x: o / 2,
|
|
@@ -1131,66 +1205,68 @@ function _n({ def: e, onPointerDown: t, isPlaced: n }) {
|
|
|
1131
1205
|
children: "✓ on canvas"
|
|
1132
1206
|
}
|
|
1133
1207
|
),
|
|
1134
|
-
s.map((
|
|
1135
|
-
const B = e.params[
|
|
1136
|
-
return /* @__PURE__ */ y("g", { transform: `translate(${
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1208
|
+
s.map((g) => {
|
|
1209
|
+
const B = e.params[g.index];
|
|
1210
|
+
return /* @__PURE__ */ y("g", { transform: `translate(${g.x},${g.y})`, children: [
|
|
1211
|
+
/* @__PURE__ */ l("title", { children: Hn(B) }),
|
|
1212
|
+
g.collapsed ? /* @__PURE__ */ l(Un, { name: B.name, w: g.w, h: g.h }) : /* @__PURE__ */ y(Rt, { children: [
|
|
1213
|
+
/* @__PURE__ */ l(
|
|
1214
|
+
"path",
|
|
1215
|
+
{
|
|
1216
|
+
d: Ft(g.type, g.w, g.h),
|
|
1217
|
+
fill: r.socketBody,
|
|
1218
|
+
stroke: r.blockBorder,
|
|
1219
|
+
strokeWidth: 1
|
|
1220
|
+
}
|
|
1221
|
+
),
|
|
1222
|
+
/* @__PURE__ */ l(qn, { name: B.name, type: g.type, w: g.w, h: g.h })
|
|
1223
|
+
] })
|
|
1224
|
+
] }, g.index);
|
|
1149
1225
|
}),
|
|
1150
1226
|
e.blockType === "start" && e.provides && e.provides.length > 0 && /* @__PURE__ */ y("g", { children: [
|
|
1151
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ l(
|
|
1152
1228
|
"line",
|
|
1153
1229
|
{
|
|
1154
1230
|
x1: 8,
|
|
1155
|
-
y1:
|
|
1231
|
+
y1: Ce,
|
|
1156
1232
|
x2: o - 8,
|
|
1157
|
-
y2:
|
|
1233
|
+
y2: Ce,
|
|
1158
1234
|
stroke: "rgba(255,255,255,0.15)",
|
|
1159
1235
|
strokeWidth: 1
|
|
1160
1236
|
}
|
|
1161
1237
|
),
|
|
1162
|
-
e.
|
|
1163
|
-
const
|
|
1164
|
-
return /* @__PURE__ */ y("g", { transform: `translate(
|
|
1165
|
-
/* @__PURE__ */
|
|
1238
|
+
Vt(e).map((g) => {
|
|
1239
|
+
const z = H(g.id)?.color ?? e.color, w = g.w, W = Mn;
|
|
1240
|
+
return /* @__PURE__ */ y("g", { transform: `translate(${g.x}, ${g.y})`, children: [
|
|
1241
|
+
/* @__PURE__ */ l(
|
|
1166
1242
|
"rect",
|
|
1167
1243
|
{
|
|
1168
1244
|
x: 0,
|
|
1169
1245
|
y: 0,
|
|
1170
|
-
width:
|
|
1171
|
-
height:
|
|
1246
|
+
width: w,
|
|
1247
|
+
height: W,
|
|
1172
1248
|
rx: 10,
|
|
1173
|
-
fill:
|
|
1249
|
+
fill: z,
|
|
1174
1250
|
opacity: 0.82,
|
|
1175
1251
|
stroke: "rgba(255,255,255,0.25)",
|
|
1176
1252
|
strokeWidth: 1
|
|
1177
1253
|
}
|
|
1178
1254
|
),
|
|
1179
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ l(
|
|
1180
1256
|
"text",
|
|
1181
1257
|
{
|
|
1182
|
-
x:
|
|
1183
|
-
y:
|
|
1258
|
+
x: w / 2,
|
|
1259
|
+
y: W / 2 + 3.5,
|
|
1184
1260
|
textAnchor: "middle",
|
|
1185
1261
|
fill: "white",
|
|
1186
1262
|
fontSize: 9.5,
|
|
1187
1263
|
fontFamily: "sans-serif",
|
|
1188
1264
|
fontWeight: "bold",
|
|
1189
1265
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1190
|
-
children:
|
|
1266
|
+
children: g.name
|
|
1191
1267
|
}
|
|
1192
1268
|
)
|
|
1193
|
-
] },
|
|
1269
|
+
] }, g.id);
|
|
1194
1270
|
})
|
|
1195
1271
|
] })
|
|
1196
1272
|
] })
|
|
@@ -1198,8 +1274,8 @@ function _n({ def: e, onPointerDown: t, isPlaced: n }) {
|
|
|
1198
1274
|
}
|
|
1199
1275
|
);
|
|
1200
1276
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const s =
|
|
1277
|
+
function mr({ cat: e, defs: t, collapsed: n, onToggle: r, onPointerDown: o, placedStartIds: i }) {
|
|
1278
|
+
const s = K();
|
|
1203
1279
|
return /* @__PURE__ */ y("div", { style: { marginBottom: 2 }, children: [
|
|
1204
1280
|
/* @__PURE__ */ y(
|
|
1205
1281
|
"button",
|
|
@@ -1219,14 +1295,14 @@ function er({ cat: e, defs: t, collapsed: n, onToggle: r, onPointerDown: o, plac
|
|
|
1219
1295
|
marginBottom: n ? 0 : 6
|
|
1220
1296
|
},
|
|
1221
1297
|
children: [
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
n && /* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ l("span", { style: { color: s.accent, fontSize: 8, lineHeight: 1, opacity: 0.6 }, children: n ? "▶" : "▼" }),
|
|
1299
|
+
/* @__PURE__ */ l("span", { style: { color: s.accent, fontSize: 10, fontWeight: "bold", textTransform: "uppercase", letterSpacing: 1, opacity: 0.85 }, children: e }),
|
|
1300
|
+
n && /* @__PURE__ */ l("span", { style: { color: s.textMuted, fontSize: 9, marginLeft: "auto" }, children: t.length })
|
|
1225
1301
|
]
|
|
1226
1302
|
}
|
|
1227
1303
|
),
|
|
1228
|
-
!n && /* @__PURE__ */
|
|
1229
|
-
|
|
1304
|
+
!n && /* @__PURE__ */ l("div", { style: { paddingBottom: 4 }, children: t.map((c) => /* @__PURE__ */ l(
|
|
1305
|
+
Vn,
|
|
1230
1306
|
{
|
|
1231
1307
|
def: c,
|
|
1232
1308
|
onPointerDown: o,
|
|
@@ -1236,26 +1312,26 @@ function er({ cat: e, defs: t, collapsed: n, onToggle: r, onPointerDown: o, plac
|
|
|
1236
1312
|
)) })
|
|
1237
1313
|
] });
|
|
1238
1314
|
}
|
|
1239
|
-
function
|
|
1315
|
+
function xr({
|
|
1240
1316
|
onPointerDown: e,
|
|
1241
1317
|
isDropTarget: t,
|
|
1242
1318
|
registryVersion: n,
|
|
1243
1319
|
packages: r,
|
|
1244
1320
|
placedStartIds: o
|
|
1245
1321
|
}) {
|
|
1246
|
-
const i =
|
|
1247
|
-
function
|
|
1248
|
-
B((
|
|
1249
|
-
const
|
|
1250
|
-
return
|
|
1322
|
+
const i = K(), [s, c] = E("blocks"), [p, m] = E(""), [g, B] = E(/* @__PURE__ */ new Set()), z = Ve(() => En().filter((x) => !x.category.startsWith("$")), [n]), w = Ve(() => Uo().filter((x) => !x.startsWith("$")), [n]), W = p.trim().toLowerCase(), q = W ? z.filter((x) => x.name.toLowerCase().includes(W)) : null;
|
|
1323
|
+
function $(x) {
|
|
1324
|
+
B((Q) => {
|
|
1325
|
+
const ee = new Set(Q);
|
|
1326
|
+
return ee.has(x) ? ee.delete(x) : ee.add(x), ee;
|
|
1251
1327
|
});
|
|
1252
1328
|
}
|
|
1253
|
-
const
|
|
1329
|
+
const v = r?.dependencies.length ?? 0, J = (x) => ({
|
|
1254
1330
|
flex: 1,
|
|
1255
1331
|
background: "none",
|
|
1256
1332
|
border: "none",
|
|
1257
|
-
borderBottom: `2px solid ${s ===
|
|
1258
|
-
color: s ===
|
|
1333
|
+
borderBottom: `2px solid ${s === x ? i.accent : "transparent"}`,
|
|
1334
|
+
color: s === x ? i.accent : i.textMuted,
|
|
1259
1335
|
fontSize: 10,
|
|
1260
1336
|
fontWeight: "bold",
|
|
1261
1337
|
textTransform: "uppercase",
|
|
@@ -1275,20 +1351,20 @@ function tr({
|
|
|
1275
1351
|
overflow: "hidden"
|
|
1276
1352
|
}, children: [
|
|
1277
1353
|
r && /* @__PURE__ */ y("div", { style: { display: "flex", borderBottom: `1px solid ${i.border}`, flexShrink: 0, background: i.paletteHeaderBg }, children: [
|
|
1278
|
-
/* @__PURE__ */
|
|
1279
|
-
/* @__PURE__ */ y("button", { style:
|
|
1354
|
+
/* @__PURE__ */ l("button", { style: J("blocks"), onClick: () => c("blocks"), children: "Blocks" }),
|
|
1355
|
+
/* @__PURE__ */ y("button", { style: J("packages"), onClick: () => c("packages"), children: [
|
|
1280
1356
|
"Packages",
|
|
1281
|
-
|
|
1357
|
+
v > 0 ? ` · ${v}` : ""
|
|
1282
1358
|
] })
|
|
1283
1359
|
] }),
|
|
1284
|
-
s === "blocks" && /* @__PURE__ */ y(
|
|
1285
|
-
/* @__PURE__ */
|
|
1360
|
+
s === "blocks" && /* @__PURE__ */ y(Rt, { children: [
|
|
1361
|
+
/* @__PURE__ */ l("div", { style: { padding: "8px 10px 6px", flexShrink: 0 }, children: /* @__PURE__ */ l(
|
|
1286
1362
|
"input",
|
|
1287
1363
|
{
|
|
1288
1364
|
type: "search",
|
|
1289
1365
|
placeholder: "Search blocks…",
|
|
1290
|
-
value:
|
|
1291
|
-
onChange: (
|
|
1366
|
+
value: p,
|
|
1367
|
+
onChange: (x) => m(x.target.value),
|
|
1292
1368
|
style: {
|
|
1293
1369
|
width: "100%",
|
|
1294
1370
|
boxSizing: "border-box",
|
|
@@ -1302,27 +1378,27 @@ function tr({
|
|
|
1302
1378
|
}
|
|
1303
1379
|
}
|
|
1304
1380
|
) }),
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
|
|
1381
|
+
/* @__PURE__ */ l("div", { style: { flex: 1, overflowY: "auto", padding: "4px 10px 0" }, children: q ? q.length > 0 ? q.map((x) => /* @__PURE__ */ l(
|
|
1382
|
+
Vn,
|
|
1307
1383
|
{
|
|
1308
|
-
def:
|
|
1384
|
+
def: x,
|
|
1309
1385
|
onPointerDown: e,
|
|
1310
|
-
isPlaced:
|
|
1386
|
+
isPlaced: x.blockType === "start" && o.has(x.id)
|
|
1311
1387
|
},
|
|
1312
|
-
|
|
1313
|
-
)) : /* @__PURE__ */
|
|
1314
|
-
|
|
1388
|
+
x.id
|
|
1389
|
+
)) : /* @__PURE__ */ l("div", { style: { color: i.textMuted, fontSize: 11, padding: "12px 0", textAlign: "center" }, children: "No blocks match" }) : w.map((x) => /* @__PURE__ */ l(
|
|
1390
|
+
mr,
|
|
1315
1391
|
{
|
|
1316
|
-
cat:
|
|
1317
|
-
defs:
|
|
1318
|
-
collapsed:
|
|
1319
|
-
onToggle:
|
|
1392
|
+
cat: x,
|
|
1393
|
+
defs: z.filter((Q) => Q.category === x),
|
|
1394
|
+
collapsed: g.has(x),
|
|
1395
|
+
onToggle: $,
|
|
1320
1396
|
onPointerDown: e,
|
|
1321
1397
|
placedStartIds: o
|
|
1322
1398
|
},
|
|
1323
|
-
|
|
1399
|
+
x
|
|
1324
1400
|
)) }),
|
|
1325
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ l("div", { style: {
|
|
1326
1402
|
flexShrink: 0,
|
|
1327
1403
|
margin: "8px 10px 10px",
|
|
1328
1404
|
padding: "7px 10px",
|
|
@@ -1340,10 +1416,10 @@ function tr({
|
|
|
1340
1416
|
userSelect: "none"
|
|
1341
1417
|
}, children: t ? "Release to delete" : "Drag here to delete" })
|
|
1342
1418
|
] }),
|
|
1343
|
-
s === "packages" && r && /* @__PURE__ */
|
|
1419
|
+
s === "packages" && r && /* @__PURE__ */ l(hr, { ...r })
|
|
1344
1420
|
] });
|
|
1345
1421
|
}
|
|
1346
|
-
function
|
|
1422
|
+
function kr(e, t, n) {
|
|
1347
1423
|
let r = e;
|
|
1348
1424
|
for (; ; )
|
|
1349
1425
|
if (r.embeddedInBlockId) {
|
|
@@ -1355,9 +1431,9 @@ function nr(e, t, n) {
|
|
|
1355
1431
|
if (!o) return !1;
|
|
1356
1432
|
r = o;
|
|
1357
1433
|
} else
|
|
1358
|
-
return
|
|
1434
|
+
return H(r.definitionId)?.provides?.some((i) => i.id === t) ?? !1;
|
|
1359
1435
|
}
|
|
1360
|
-
function
|
|
1436
|
+
function yt(e) {
|
|
1361
1437
|
const {
|
|
1362
1438
|
block: t,
|
|
1363
1439
|
allBlocks: n,
|
|
@@ -1366,55 +1442,57 @@ function ht(e) {
|
|
|
1366
1442
|
onSocketClick: i,
|
|
1367
1443
|
editingSocket: s,
|
|
1368
1444
|
onSocketCommit: c,
|
|
1369
|
-
onSocketCancelEdit:
|
|
1370
|
-
onOutputDrag:
|
|
1371
|
-
isGhost:
|
|
1445
|
+
onSocketCancelEdit: p,
|
|
1446
|
+
onOutputDrag: m,
|
|
1447
|
+
isGhost: g,
|
|
1372
1448
|
draggingIds: B,
|
|
1373
|
-
provisionalIds:
|
|
1449
|
+
provisionalIds: z,
|
|
1374
1450
|
onSocketInput: w,
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1451
|
+
onParamRemove: W,
|
|
1452
|
+
embedded: q
|
|
1453
|
+
} = e, $ = K(), v = H(t.definitionId), J = B?.has(t.instanceId) ?? !1, x = z?.has(t.instanceId) ?? !1, Q = (f, oe, b, M) => {
|
|
1454
|
+
const V = f ? n.get(f) : void 0;
|
|
1455
|
+
return V ? /* @__PURE__ */ l("g", { transform: `translate(${oe},${b})`, children: /* @__PURE__ */ l(
|
|
1456
|
+
yt,
|
|
1380
1457
|
{
|
|
1381
|
-
block:
|
|
1458
|
+
block: V,
|
|
1382
1459
|
allBlocks: n,
|
|
1383
1460
|
onPointerDown: r,
|
|
1384
1461
|
onBlockClick: o,
|
|
1385
1462
|
onSocketClick: i,
|
|
1386
1463
|
editingSocket: s,
|
|
1387
1464
|
onSocketCommit: c,
|
|
1388
|
-
onSocketCancelEdit:
|
|
1389
|
-
onOutputDrag:
|
|
1390
|
-
isGhost:
|
|
1465
|
+
onSocketCancelEdit: p,
|
|
1466
|
+
onOutputDrag: m,
|
|
1467
|
+
isGhost: g,
|
|
1391
1468
|
draggingIds: B,
|
|
1392
|
-
provisionalIds:
|
|
1469
|
+
provisionalIds: z,
|
|
1393
1470
|
onSocketInput: w,
|
|
1471
|
+
onParamRemove: W,
|
|
1394
1472
|
embedded: !0
|
|
1395
1473
|
}
|
|
1396
|
-
) },
|
|
1474
|
+
) }, M) : null;
|
|
1397
1475
|
};
|
|
1398
1476
|
if (!v) {
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
} : void 0,
|
|
1402
|
-
|
|
1403
|
-
} : void 0,
|
|
1477
|
+
const f = r ? (M) => {
|
|
1478
|
+
M.stopPropagation(), r(M, t.instanceId);
|
|
1479
|
+
} : void 0, oe = o ? (M) => {
|
|
1480
|
+
M.stopPropagation(), o(t.instanceId);
|
|
1481
|
+
} : void 0, b = t.definitionId.replace(/^__coll__/, "").slice(0, 16);
|
|
1404
1482
|
return /* @__PURE__ */ y(
|
|
1405
1483
|
"g",
|
|
1406
1484
|
{
|
|
1407
|
-
transform:
|
|
1408
|
-
opacity:
|
|
1485
|
+
transform: g || q ? void 0 : `translate(${t.x},${t.y})`,
|
|
1486
|
+
opacity: J ? 0.35 : 0.85,
|
|
1409
1487
|
children: [
|
|
1410
|
-
/* @__PURE__ */ y("g", { onPointerDown:
|
|
1411
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ y("g", { onPointerDown: f, onClick: oe, style: { cursor: "grab" }, children: [
|
|
1489
|
+
/* @__PURE__ */ l(
|
|
1412
1490
|
"rect",
|
|
1413
1491
|
{
|
|
1414
1492
|
x: 0,
|
|
1415
1493
|
y: 0,
|
|
1416
1494
|
width: 160,
|
|
1417
|
-
height:
|
|
1495
|
+
height: Fe,
|
|
1418
1496
|
rx: 3,
|
|
1419
1497
|
fill: "rgba(160,40,40,0.18)",
|
|
1420
1498
|
stroke: "#c05050",
|
|
@@ -1434,37 +1512,37 @@ function ht(e) {
|
|
|
1434
1512
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1435
1513
|
children: [
|
|
1436
1514
|
"⚠ ",
|
|
1437
|
-
|
|
1515
|
+
b,
|
|
1438
1516
|
" (missing)"
|
|
1439
1517
|
]
|
|
1440
1518
|
}
|
|
1441
1519
|
)
|
|
1442
1520
|
] }),
|
|
1443
|
-
|
|
1521
|
+
Q(t.nextBlockId, 0, Fe, "next")
|
|
1444
1522
|
]
|
|
1445
1523
|
}
|
|
1446
1524
|
);
|
|
1447
1525
|
}
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
} : void 0,
|
|
1451
|
-
|
|
1526
|
+
const ee = ue(v, t.paramSlots, n), ae = ve(v, t.paramSlots, n), te = Qe(v), k = Ge(v, t.paramSlots, n), O = Ee(v, t.paramSlots, n), X = J ? 0.35 : x ? 0.6 : g && !q ? 0.75 : 1, U = `clip-${g ? "g" : "c"}-${t.instanceId}`, ie = jt(v, t.paramSlots, n), ne = r ? (f) => {
|
|
1527
|
+
f.stopPropagation(), r(f, t.instanceId);
|
|
1528
|
+
} : void 0, Re = o ? (f) => {
|
|
1529
|
+
f.stopPropagation(), o(t.instanceId);
|
|
1452
1530
|
} : void 0;
|
|
1453
|
-
if (v.category.startsWith("$") && !
|
|
1454
|
-
const
|
|
1531
|
+
if (v.category.startsWith("$") && !g && !kr(t, v.id, n)) {
|
|
1532
|
+
const f = ue(v), oe = be, b = Xt(v.returnType ?? "string", f, oe);
|
|
1455
1533
|
return /* @__PURE__ */ y(
|
|
1456
1534
|
"g",
|
|
1457
1535
|
{
|
|
1458
|
-
transform:
|
|
1459
|
-
opacity:
|
|
1460
|
-
onPointerDown:
|
|
1461
|
-
onClick:
|
|
1536
|
+
transform: g || q ? void 0 : `translate(${t.x},${t.y})`,
|
|
1537
|
+
opacity: J ? 0.35 : 0.85,
|
|
1538
|
+
onPointerDown: ne,
|
|
1539
|
+
onClick: Re,
|
|
1462
1540
|
style: { cursor: "grab" },
|
|
1463
1541
|
children: [
|
|
1464
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ l(
|
|
1465
1543
|
"path",
|
|
1466
1544
|
{
|
|
1467
|
-
d:
|
|
1545
|
+
d: b,
|
|
1468
1546
|
fill: "rgba(180,100,0,0.15)",
|
|
1469
1547
|
stroke: "#c08820",
|
|
1470
1548
|
strokeWidth: 1.5,
|
|
@@ -1474,8 +1552,8 @@ function ht(e) {
|
|
|
1474
1552
|
/* @__PURE__ */ y(
|
|
1475
1553
|
"text",
|
|
1476
1554
|
{
|
|
1477
|
-
x:
|
|
1478
|
-
y:
|
|
1555
|
+
x: f / 2,
|
|
1556
|
+
y: oe / 2 + 3.5,
|
|
1479
1557
|
textAnchor: "middle",
|
|
1480
1558
|
fill: "#c08820",
|
|
1481
1559
|
fontSize: 9,
|
|
@@ -1495,188 +1573,215 @@ function ht(e) {
|
|
|
1495
1573
|
return /* @__PURE__ */ y(
|
|
1496
1574
|
"g",
|
|
1497
1575
|
{
|
|
1498
|
-
transform:
|
|
1499
|
-
opacity:
|
|
1500
|
-
onPointerDown:
|
|
1501
|
-
onClick:
|
|
1502
|
-
style: { cursor:
|
|
1576
|
+
transform: g || q ? void 0 : `translate(${t.x},${t.y})`,
|
|
1577
|
+
opacity: X,
|
|
1578
|
+
onPointerDown: ne,
|
|
1579
|
+
onClick: Re,
|
|
1580
|
+
style: { cursor: g ? "grabbing" : "grab" },
|
|
1503
1581
|
children: [
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1582
|
+
/* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", { id: U, children: /* @__PURE__ */ l("path", { d: ie }) }) }),
|
|
1583
|
+
/* @__PURE__ */ l(
|
|
1506
1584
|
"path",
|
|
1507
1585
|
{
|
|
1508
|
-
d:
|
|
1509
|
-
fill:
|
|
1510
|
-
stroke:
|
|
1586
|
+
d: ie,
|
|
1587
|
+
fill: $.blockBody,
|
|
1588
|
+
stroke: x ? $.accent : $.blockBorder,
|
|
1511
1589
|
strokeWidth: 1.5,
|
|
1512
|
-
strokeDasharray:
|
|
1590
|
+
strokeDasharray: x ? "4,3" : void 0
|
|
1513
1591
|
}
|
|
1514
1592
|
),
|
|
1515
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ l(
|
|
1516
1594
|
"rect",
|
|
1517
1595
|
{
|
|
1518
1596
|
x: 0,
|
|
1519
1597
|
y: 0,
|
|
1520
1598
|
width: 4,
|
|
1521
|
-
height:
|
|
1599
|
+
height: ae + 20,
|
|
1522
1600
|
fill: v.color,
|
|
1523
|
-
clipPath: `url(#${
|
|
1601
|
+
clipPath: `url(#${U})`
|
|
1524
1602
|
}
|
|
1525
1603
|
),
|
|
1526
1604
|
/* @__PURE__ */ y(
|
|
1527
1605
|
"text",
|
|
1528
1606
|
{
|
|
1529
1607
|
x: 11,
|
|
1530
|
-
y:
|
|
1531
|
-
fill:
|
|
1608
|
+
y: te / 2 + 4,
|
|
1609
|
+
fill: $.blockText,
|
|
1532
1610
|
fontSize: 11,
|
|
1533
1611
|
fontWeight: "bold",
|
|
1534
1612
|
fontFamily: "sans-serif",
|
|
1535
1613
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1536
1614
|
children: [
|
|
1537
1615
|
v.name,
|
|
1538
|
-
v.blockType === "query" && v.returnType && /* @__PURE__ */
|
|
1616
|
+
v.blockType === "query" && v.returnType && /* @__PURE__ */ l("tspan", { fill: $.textMuted, fontSize: 9, fontWeight: "normal", children: ` [${v.returnType}]` })
|
|
1539
1617
|
]
|
|
1540
1618
|
}
|
|
1541
1619
|
),
|
|
1542
1620
|
v.blockType === "start" && v.provides && v.provides.length > 0 && /* @__PURE__ */ y("g", { children: [
|
|
1543
|
-
/* @__PURE__ */
|
|
1621
|
+
/* @__PURE__ */ l(
|
|
1544
1622
|
"line",
|
|
1545
1623
|
{
|
|
1546
1624
|
x1: 8,
|
|
1547
|
-
y1:
|
|
1548
|
-
x2:
|
|
1549
|
-
y2:
|
|
1625
|
+
y1: Ce,
|
|
1626
|
+
x2: ee - 8,
|
|
1627
|
+
y2: Ce,
|
|
1550
1628
|
stroke: "rgba(255,255,255,0.15)",
|
|
1551
1629
|
strokeWidth: 1
|
|
1552
1630
|
}
|
|
1553
1631
|
),
|
|
1554
|
-
v.
|
|
1555
|
-
const
|
|
1632
|
+
Vt(v).map((f) => {
|
|
1633
|
+
const b = H(f.id)?.color ?? v.color, M = f.w, V = Mn, se = !g && !q;
|
|
1556
1634
|
return /* @__PURE__ */ y(
|
|
1557
1635
|
"g",
|
|
1558
1636
|
{
|
|
1559
|
-
transform: `translate(${
|
|
1560
|
-
onPointerDown:
|
|
1561
|
-
|
|
1637
|
+
transform: `translate(${f.x}, ${f.y})`,
|
|
1638
|
+
onPointerDown: se ? (ye) => {
|
|
1639
|
+
ye.stopPropagation(), m?.(ye, f.id);
|
|
1562
1640
|
} : void 0,
|
|
1563
|
-
style: { cursor:
|
|
1641
|
+
style: { cursor: se ? "grab" : "default" },
|
|
1564
1642
|
children: [
|
|
1565
|
-
/* @__PURE__ */
|
|
1643
|
+
/* @__PURE__ */ l(
|
|
1566
1644
|
"rect",
|
|
1567
1645
|
{
|
|
1568
1646
|
x: 0,
|
|
1569
1647
|
y: 0,
|
|
1570
|
-
width:
|
|
1571
|
-
height:
|
|
1648
|
+
width: M,
|
|
1649
|
+
height: V,
|
|
1572
1650
|
rx: 10,
|
|
1573
|
-
fill:
|
|
1651
|
+
fill: b,
|
|
1574
1652
|
opacity: 0.82,
|
|
1575
1653
|
stroke: "rgba(255,255,255,0.25)",
|
|
1576
1654
|
strokeWidth: 1
|
|
1577
1655
|
}
|
|
1578
1656
|
),
|
|
1579
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ l(
|
|
1580
1658
|
"text",
|
|
1581
1659
|
{
|
|
1582
|
-
x:
|
|
1583
|
-
y:
|
|
1660
|
+
x: M / 2,
|
|
1661
|
+
y: V / 2 + 3.5,
|
|
1584
1662
|
textAnchor: "middle",
|
|
1585
1663
|
fill: "white",
|
|
1586
1664
|
fontSize: 9.5,
|
|
1587
1665
|
fontFamily: "sans-serif",
|
|
1588
1666
|
fontWeight: "bold",
|
|
1589
1667
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1590
|
-
children:
|
|
1668
|
+
children: f.name
|
|
1591
1669
|
}
|
|
1592
1670
|
)
|
|
1593
1671
|
]
|
|
1594
1672
|
},
|
|
1595
|
-
|
|
1673
|
+
f.id
|
|
1596
1674
|
);
|
|
1597
1675
|
})
|
|
1598
1676
|
] }),
|
|
1599
|
-
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1677
|
+
k.map((f) => {
|
|
1678
|
+
const oe = t.paramSlots[f.index], b = oe?.queryBlockId, M = b ? n.get(b) : null, V = v.params[f.index], se = V.name, ye = Hn(V), He = V.optional && W && !g ? /* @__PURE__ */ l(
|
|
1679
|
+
yr,
|
|
1680
|
+
{
|
|
1681
|
+
w: f.w,
|
|
1682
|
+
title: `Leave out ${se}`,
|
|
1683
|
+
onRemove: () => W(t.instanceId, f.index)
|
|
1684
|
+
}
|
|
1685
|
+
) : null;
|
|
1686
|
+
if (M)
|
|
1602
1687
|
return /* @__PURE__ */ y("g", { children: [
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1688
|
+
/* @__PURE__ */ l("title", { children: ye }),
|
|
1689
|
+
Q(b, f.x, f.y, "query"),
|
|
1690
|
+
He && /* @__PURE__ */ l("g", { transform: `translate(${f.x},${f.y})`, children: He })
|
|
1691
|
+
] }, f.index);
|
|
1692
|
+
const De = oe?.textValue, $e = s?.blockId === t.instanceId && s?.slotIndex === f.index;
|
|
1693
|
+
if (f.collapsed && !$e)
|
|
1694
|
+
return /* @__PURE__ */ y(
|
|
1695
|
+
"g",
|
|
1696
|
+
{
|
|
1697
|
+
transform: `translate(${f.x},${f.y})`,
|
|
1698
|
+
onPointerDown: (T) => T.stopPropagation(),
|
|
1699
|
+
onClick: (T) => {
|
|
1700
|
+
T.stopPropagation(), i?.(t.instanceId, f.index);
|
|
1701
|
+
},
|
|
1702
|
+
style: { cursor: "pointer" },
|
|
1703
|
+
children: [
|
|
1704
|
+
/* @__PURE__ */ l("title", { children: `${ye}: click to type a value, or drop a ${f.type} query here` }),
|
|
1705
|
+
/* @__PURE__ */ l(Un, { name: se, w: f.w, h: f.h })
|
|
1706
|
+
]
|
|
1707
|
+
},
|
|
1708
|
+
f.index
|
|
1709
|
+
);
|
|
1710
|
+
const ze = f.collapsed ? Math.max(f.w, dt(f.type).w) : f.w, fe = f.collapsed ? dt(f.type).h : f.h;
|
|
1607
1711
|
return /* @__PURE__ */ y(
|
|
1608
1712
|
"g",
|
|
1609
1713
|
{
|
|
1610
|
-
transform: `translate(${
|
|
1611
|
-
onPointerDown: (
|
|
1612
|
-
onClick: (
|
|
1613
|
-
|
|
1714
|
+
transform: `translate(${f.x},${f.y + (f.h - fe) / 2})`,
|
|
1715
|
+
onPointerDown: (T) => T.stopPropagation(),
|
|
1716
|
+
onClick: (T) => {
|
|
1717
|
+
T.stopPropagation(), i?.(t.instanceId, f.index);
|
|
1614
1718
|
},
|
|
1615
1719
|
style: { cursor: "text" },
|
|
1616
1720
|
children: [
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1721
|
+
/* @__PURE__ */ l("title", { children: ye }),
|
|
1722
|
+
/* @__PURE__ */ l(
|
|
1619
1723
|
"path",
|
|
1620
1724
|
{
|
|
1621
|
-
d:
|
|
1622
|
-
fill:
|
|
1623
|
-
stroke:
|
|
1624
|
-
strokeWidth:
|
|
1725
|
+
d: Ft(f.type, ze, fe),
|
|
1726
|
+
fill: $e ? $.blockBorder : $.socketBody,
|
|
1727
|
+
stroke: $.blockBorder,
|
|
1728
|
+
strokeWidth: $e ? 1.5 : 1
|
|
1625
1729
|
}
|
|
1626
1730
|
),
|
|
1627
|
-
|
|
1731
|
+
$e ? /* @__PURE__ */ l("foreignObject", { x: 0, y: 0, width: ze, height: fe, children: /* @__PURE__ */ l(
|
|
1628
1732
|
"input",
|
|
1629
1733
|
{
|
|
1630
1734
|
autoFocus: !0,
|
|
1631
|
-
defaultValue:
|
|
1632
|
-
onChange: (
|
|
1633
|
-
onKeyDown: (
|
|
1634
|
-
|
|
1735
|
+
defaultValue: De ?? "",
|
|
1736
|
+
onChange: (T) => w?.(t.instanceId, f.index, T.target.value),
|
|
1737
|
+
onKeyDown: (T) => {
|
|
1738
|
+
T.stopPropagation(), T.key === "Enter" && c?.(t.instanceId, f.index, T.target.value), T.key === "Escape" && p?.();
|
|
1635
1739
|
},
|
|
1636
|
-
onBlur: (
|
|
1637
|
-
onPointerDown: (
|
|
1740
|
+
onBlur: (T) => c?.(t.instanceId, f.index, T.target.value),
|
|
1741
|
+
onPointerDown: (T) => T.stopPropagation(),
|
|
1638
1742
|
style: {
|
|
1639
1743
|
width: "100%",
|
|
1640
1744
|
height: "100%",
|
|
1641
1745
|
background: "transparent",
|
|
1642
1746
|
border: "none",
|
|
1643
1747
|
outline: "none",
|
|
1644
|
-
color:
|
|
1748
|
+
color: $.blockText,
|
|
1645
1749
|
fontSize: 10,
|
|
1646
1750
|
fontFamily: "sans-serif",
|
|
1647
1751
|
textAlign: "center",
|
|
1648
1752
|
padding: "0 4px",
|
|
1649
1753
|
boxSizing: "border-box",
|
|
1650
|
-
caretColor:
|
|
1754
|
+
caretColor: $.blockText
|
|
1651
1755
|
}
|
|
1652
1756
|
}
|
|
1653
|
-
) }) :
|
|
1757
|
+
) }) : De ? /* @__PURE__ */ l(
|
|
1654
1758
|
"text",
|
|
1655
1759
|
{
|
|
1656
|
-
x:
|
|
1657
|
-
y:
|
|
1760
|
+
x: f.w / 2,
|
|
1761
|
+
y: f.h / 2 + 4,
|
|
1658
1762
|
textAnchor: "middle",
|
|
1659
|
-
fill:
|
|
1763
|
+
fill: $.blockText,
|
|
1660
1764
|
fontSize: 10,
|
|
1661
1765
|
fontFamily: "sans-serif",
|
|
1662
|
-
fontStyle:
|
|
1766
|
+
fontStyle: x ? "italic" : void 0,
|
|
1663
1767
|
style: { userSelect: "none", pointerEvents: "none" },
|
|
1664
|
-
children:
|
|
1768
|
+
children: De
|
|
1665
1769
|
}
|
|
1666
|
-
) : /* @__PURE__ */
|
|
1770
|
+
) : /* @__PURE__ */ l(qn, { name: se, type: f.type, w: f.w, h: f.h }),
|
|
1771
|
+
!$e && He
|
|
1667
1772
|
]
|
|
1668
1773
|
},
|
|
1669
|
-
|
|
1774
|
+
f.index
|
|
1670
1775
|
);
|
|
1671
1776
|
}),
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1777
|
+
O.length > 0 && /* @__PURE__ */ l(Kt, { mouths: O, w: ee, isEmpty: (f) => !t.paramSlots[f]?.commandBlockId }),
|
|
1778
|
+
O.map((f) => Q(t.paramSlots[f.index]?.commandBlockId, f.x, f.y, `mouth-${f.index}`)),
|
|
1779
|
+
Q(t.nextBlockId, 0, ae, "next")
|
|
1675
1780
|
]
|
|
1676
1781
|
}
|
|
1677
1782
|
);
|
|
1678
1783
|
}
|
|
1679
|
-
const
|
|
1784
|
+
const Yn = xo(
|
|
1680
1785
|
({
|
|
1681
1786
|
blocks: e,
|
|
1682
1787
|
draggingIds: t,
|
|
@@ -1686,27 +1791,28 @@ const Nn = io(
|
|
|
1686
1791
|
onSocketClick: i,
|
|
1687
1792
|
editingSocket: s,
|
|
1688
1793
|
onSocketInput: c,
|
|
1689
|
-
onSocketCommit:
|
|
1690
|
-
onSocketCancelEdit:
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1794
|
+
onSocketCommit: p,
|
|
1795
|
+
onSocketCancelEdit: m,
|
|
1796
|
+
onParamRemove: g,
|
|
1797
|
+
onOutputDrag: B,
|
|
1798
|
+
overlay: z
|
|
1799
|
+
}, w) => {
|
|
1800
|
+
const W = K(), q = [...e.values()].filter(($) => !$.embeddedInBlockId && !$.parentBlockId);
|
|
1695
1801
|
return /* @__PURE__ */ y(
|
|
1696
1802
|
"svg",
|
|
1697
1803
|
{
|
|
1698
|
-
ref:
|
|
1699
|
-
style: { flex: 1, background:
|
|
1700
|
-
onPointerDown: (
|
|
1701
|
-
|
|
1804
|
+
ref: w,
|
|
1805
|
+
style: { flex: 1, background: W.canvasBg, display: "block" },
|
|
1806
|
+
onPointerDown: ($) => {
|
|
1807
|
+
$.target === $.currentTarget && $.preventDefault();
|
|
1702
1808
|
},
|
|
1703
1809
|
children: [
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
|
|
1707
|
-
|
|
1810
|
+
/* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("pattern", { id: "grid", width: "28", height: "28", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ l("circle", { cx: "14", cy: "14", r: "0.7", fill: W.gridDot }) }) }),
|
|
1811
|
+
/* @__PURE__ */ l("rect", { width: "100%", height: "100%", fill: "url(#grid)" }),
|
|
1812
|
+
q.map(($) => /* @__PURE__ */ l(
|
|
1813
|
+
yt,
|
|
1708
1814
|
{
|
|
1709
|
-
block:
|
|
1815
|
+
block: $,
|
|
1710
1816
|
allBlocks: e,
|
|
1711
1817
|
onPointerDown: r,
|
|
1712
1818
|
onBlockClick: o,
|
|
@@ -1715,22 +1821,23 @@ const Nn = io(
|
|
|
1715
1821
|
provisionalIds: n,
|
|
1716
1822
|
editingSocket: s,
|
|
1717
1823
|
onSocketInput: c,
|
|
1718
|
-
onSocketCommit:
|
|
1719
|
-
onSocketCancelEdit:
|
|
1720
|
-
|
|
1824
|
+
onSocketCommit: p,
|
|
1825
|
+
onSocketCancelEdit: m,
|
|
1826
|
+
onParamRemove: g,
|
|
1827
|
+
onOutputDrag: B
|
|
1721
1828
|
},
|
|
1722
|
-
|
|
1829
|
+
$.instanceId
|
|
1723
1830
|
)),
|
|
1724
|
-
|
|
1831
|
+
z
|
|
1725
1832
|
]
|
|
1726
1833
|
}
|
|
1727
1834
|
);
|
|
1728
1835
|
}
|
|
1729
1836
|
);
|
|
1730
|
-
|
|
1731
|
-
function
|
|
1732
|
-
const t =
|
|
1733
|
-
return /* @__PURE__ */
|
|
1837
|
+
Yn.displayName = "Canvas";
|
|
1838
|
+
function br({ onSelect: e }) {
|
|
1839
|
+
const t = K();
|
|
1840
|
+
return /* @__PURE__ */ l("div", { style: { display: "flex", gap: 4 }, children: ot.map((n) => /* @__PURE__ */ l("button", { onClick: () => e(n), style: {
|
|
1734
1841
|
background: t.id === n.id ? t.switcherActiveBg : t.switcherBg,
|
|
1735
1842
|
border: `1px solid ${t.switcherBorder}`,
|
|
1736
1843
|
borderRadius: 4,
|
|
@@ -1743,22 +1850,22 @@ function or({ onSelect: e }) {
|
|
|
1743
1850
|
transition: "color 0.1s, background 0.1s"
|
|
1744
1851
|
}, children: n.label }, n.id)) });
|
|
1745
1852
|
}
|
|
1746
|
-
function
|
|
1747
|
-
const s =
|
|
1853
|
+
function Ir({ canUndo: e, canRedo: t, onUndo: n, onRedo: r, notice: o, extra: i }) {
|
|
1854
|
+
const s = K(), c = (p) => ({
|
|
1748
1855
|
width: 28,
|
|
1749
1856
|
height: 24,
|
|
1750
1857
|
padding: 0,
|
|
1751
1858
|
background: s.paletteBg,
|
|
1752
|
-
color:
|
|
1859
|
+
color: p ? s.textPrimary : s.textMuted,
|
|
1753
1860
|
border: `1px solid ${s.border}`,
|
|
1754
1861
|
borderRadius: 4,
|
|
1755
1862
|
fontSize: 14,
|
|
1756
1863
|
lineHeight: 1,
|
|
1757
|
-
cursor:
|
|
1758
|
-
opacity:
|
|
1864
|
+
cursor: p ? "pointer" : "default",
|
|
1865
|
+
opacity: p ? 1 : 0.5
|
|
1759
1866
|
});
|
|
1760
1867
|
return /* @__PURE__ */ y("div", { style: { position: "absolute", top: 8, right: 8, display: "flex", alignItems: "center", gap: 6, pointerEvents: "none" }, children: [
|
|
1761
|
-
o && /* @__PURE__ */
|
|
1868
|
+
o && /* @__PURE__ */ l("span", { style: {
|
|
1762
1869
|
fontSize: 11,
|
|
1763
1870
|
color: s.textPrimary,
|
|
1764
1871
|
background: s.paletteBg,
|
|
@@ -1766,8 +1873,8 @@ function rr({ canUndo: e, canRedo: t, onUndo: n, onRedo: r, notice: o, extra: i
|
|
|
1766
1873
|
borderRadius: 4,
|
|
1767
1874
|
padding: "3px 8px"
|
|
1768
1875
|
}, children: o }),
|
|
1769
|
-
i && /* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1876
|
+
i && /* @__PURE__ */ l("div", { style: { pointerEvents: "auto" }, children: i }),
|
|
1877
|
+
/* @__PURE__ */ l(
|
|
1771
1878
|
"button",
|
|
1772
1879
|
{
|
|
1773
1880
|
type: "button",
|
|
@@ -1779,7 +1886,7 @@ function rr({ canUndo: e, canRedo: t, onUndo: n, onRedo: r, notice: o, extra: i
|
|
|
1779
1886
|
children: "↶"
|
|
1780
1887
|
}
|
|
1781
1888
|
),
|
|
1782
|
-
/* @__PURE__ */
|
|
1889
|
+
/* @__PURE__ */ l(
|
|
1783
1890
|
"button",
|
|
1784
1891
|
{
|
|
1785
1892
|
type: "button",
|
|
@@ -1793,36 +1900,36 @@ function rr({ canUndo: e, canRedo: t, onUndo: n, onRedo: r, notice: o, extra: i
|
|
|
1793
1900
|
)
|
|
1794
1901
|
] });
|
|
1795
1902
|
}
|
|
1796
|
-
function
|
|
1903
|
+
function vr(e) {
|
|
1797
1904
|
try {
|
|
1798
1905
|
return localStorage.getItem(e);
|
|
1799
1906
|
} catch {
|
|
1800
1907
|
return null;
|
|
1801
1908
|
}
|
|
1802
1909
|
}
|
|
1803
|
-
function
|
|
1910
|
+
function $r(e, t) {
|
|
1804
1911
|
try {
|
|
1805
1912
|
localStorage.setItem(e, t);
|
|
1806
1913
|
} catch {
|
|
1807
1914
|
}
|
|
1808
1915
|
}
|
|
1809
|
-
let
|
|
1810
|
-
function
|
|
1811
|
-
|
|
1916
|
+
let Pe = null;
|
|
1917
|
+
function Sr(e) {
|
|
1918
|
+
Pe === null && (Pe = e);
|
|
1812
1919
|
}
|
|
1813
|
-
function
|
|
1814
|
-
|
|
1920
|
+
function Br(e) {
|
|
1921
|
+
Pe === e && (Pe = null);
|
|
1815
1922
|
}
|
|
1816
|
-
function
|
|
1817
|
-
|
|
1923
|
+
function wr(e) {
|
|
1924
|
+
Pe = e;
|
|
1818
1925
|
}
|
|
1819
|
-
function
|
|
1820
|
-
return
|
|
1926
|
+
function Tr(e) {
|
|
1927
|
+
return Pe === null || Pe === e;
|
|
1821
1928
|
}
|
|
1822
|
-
function
|
|
1823
|
-
const n =
|
|
1929
|
+
function Cr({ writers: e, onExport: t }) {
|
|
1930
|
+
const n = K(), [r, o] = E(!1);
|
|
1824
1931
|
return /* @__PURE__ */ y("div", { style: { position: "relative" }, children: [
|
|
1825
|
-
/* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ l(
|
|
1826
1933
|
"button",
|
|
1827
1934
|
{
|
|
1828
1935
|
type: "button",
|
|
@@ -1841,7 +1948,7 @@ function ur({ writers: e, onExport: t }) {
|
|
|
1841
1948
|
children: "Export ▾"
|
|
1842
1949
|
}
|
|
1843
1950
|
),
|
|
1844
|
-
r && /* @__PURE__ */
|
|
1951
|
+
r && /* @__PURE__ */ l("div", { role: "menu", style: {
|
|
1845
1952
|
position: "absolute",
|
|
1846
1953
|
top: 28,
|
|
1847
1954
|
right: 0,
|
|
@@ -1883,22 +1990,22 @@ function ur({ writers: e, onExport: t }) {
|
|
|
1883
1990
|
)) })
|
|
1884
1991
|
] });
|
|
1885
1992
|
}
|
|
1886
|
-
function
|
|
1887
|
-
const n =
|
|
1888
|
-
if (!n) return { w: 160, h:
|
|
1889
|
-
const r = n.blockType === "query" ?
|
|
1993
|
+
function Pr(e, t) {
|
|
1994
|
+
const n = H(e.definitionId);
|
|
1995
|
+
if (!n) return { w: 160, h: Fe };
|
|
1996
|
+
const r = n.blockType === "query" ? Yt(e, t) : zn(e.instanceId, t);
|
|
1890
1997
|
return { w: ue(n, e.paramSlots, t), h: r };
|
|
1891
1998
|
}
|
|
1892
|
-
function
|
|
1893
|
-
const r =
|
|
1894
|
-
return /* @__PURE__ */
|
|
1999
|
+
function Er({ peers: e, blocks: t, layout: n }) {
|
|
2000
|
+
const r = K();
|
|
2001
|
+
return /* @__PURE__ */ l("g", { style: { pointerEvents: "none" }, children: e.map((o) => {
|
|
1895
2002
|
const { color: i } = o, s = [];
|
|
1896
2003
|
if (o.typing) {
|
|
1897
|
-
const c = t.get(o.typing.blockId),
|
|
1898
|
-
|
|
1899
|
-
/* @__PURE__ */ y("g", { transform: `translate(${
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */ y("text", { x:
|
|
2004
|
+
const c = t.get(o.typing.blockId), p = n.get(o.typing.blockId), m = c && H(c.definitionId), g = m && c && Ge(m, c.paramSlots, t).find((B) => B.index === o.typing.slot);
|
|
2005
|
+
p && g && s.push(
|
|
2006
|
+
/* @__PURE__ */ y("g", { transform: `translate(${p.x + g.x},${p.y + g.y})`, children: [
|
|
2007
|
+
/* @__PURE__ */ l("path", { d: Ft(g.type, g.w, g.h), fill: r.socketBody, stroke: i, strokeWidth: 2 }),
|
|
2008
|
+
/* @__PURE__ */ y("text", { x: g.w / 2, y: g.h / 2 + 4, textAnchor: "middle", fill: i, fontSize: 10, fontFamily: "sans-serif", children: [
|
|
1902
2009
|
o.typing.text,
|
|
1903
2010
|
"|"
|
|
1904
2011
|
] })
|
|
@@ -1906,17 +2013,17 @@ function pr({ peers: e, blocks: t, layout: n }) {
|
|
|
1906
2013
|
);
|
|
1907
2014
|
}
|
|
1908
2015
|
if (o.drag && "leadId" in o.drag) {
|
|
1909
|
-
const c = t.get(o.drag.leadId),
|
|
1910
|
-
if (c &&
|
|
1911
|
-
const { w:
|
|
2016
|
+
const c = t.get(o.drag.leadId), p = n.get(o.drag.leadId);
|
|
2017
|
+
if (c && p) {
|
|
2018
|
+
const { w: m, h: g } = Pr(c, t);
|
|
1912
2019
|
s.push(
|
|
1913
|
-
/* @__PURE__ */
|
|
2020
|
+
/* @__PURE__ */ l(
|
|
1914
2021
|
"rect",
|
|
1915
2022
|
{
|
|
1916
|
-
x:
|
|
1917
|
-
y:
|
|
1918
|
-
width:
|
|
1919
|
-
height:
|
|
2023
|
+
x: p.x - 3,
|
|
2024
|
+
y: p.y - 3,
|
|
2025
|
+
width: m + 6,
|
|
2026
|
+
height: g + 6,
|
|
1920
2027
|
rx: 5,
|
|
1921
2028
|
fill: "none",
|
|
1922
2029
|
stroke: i,
|
|
@@ -1926,18 +2033,18 @@ function pr({ peers: e, blocks: t, layout: n }) {
|
|
|
1926
2033
|
"origin"
|
|
1927
2034
|
),
|
|
1928
2035
|
/* @__PURE__ */ y("g", { transform: `translate(${o.drag.at.x},${o.drag.at.y})`, opacity: 0.5, children: [
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
2036
|
+
/* @__PURE__ */ l(yt, { block: c, allBlocks: t, isGhost: !0 }),
|
|
2037
|
+
/* @__PURE__ */ l("rect", { x: -3, y: -3, width: m + 6, height: g + 6, rx: 5, fill: "none", stroke: i, strokeWidth: 1.5 })
|
|
1931
2038
|
] }, "ghost")
|
|
1932
2039
|
);
|
|
1933
2040
|
}
|
|
1934
2041
|
}
|
|
1935
2042
|
if (o.drag && "definitionId" in o.drag) {
|
|
1936
|
-
const c =
|
|
2043
|
+
const c = H(o.drag.definitionId), p = c ? ue(c) : 120, m = c ? ve(c) : Fe;
|
|
1937
2044
|
s.push(
|
|
1938
2045
|
/* @__PURE__ */ y("g", { transform: `translate(${o.drag.at.x},${o.drag.at.y})`, children: [
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
2046
|
+
/* @__PURE__ */ l("rect", { width: p, height: m, rx: 4, fill: i, fillOpacity: 0.12, stroke: i, strokeWidth: 1.5, strokeDasharray: "5,3" }),
|
|
2047
|
+
/* @__PURE__ */ l("text", { x: 8, y: m / 2 + 4, fill: i, fontSize: 11, fontWeight: "bold", fontFamily: "sans-serif", children: c?.name ?? o.drag.definitionId })
|
|
1941
2048
|
] }, "new")
|
|
1942
2049
|
);
|
|
1943
2050
|
}
|
|
@@ -1945,17 +2052,17 @@ function pr({ peers: e, blocks: t, layout: n }) {
|
|
|
1945
2052
|
const c = o.name.length * 6.5 + 10;
|
|
1946
2053
|
s.push(
|
|
1947
2054
|
/* @__PURE__ */ y("g", { transform: `translate(${o.cursor.x},${o.cursor.y})`, children: [
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ l("path", { d: "M 0 0 L 0 14 L 4 10.5 L 7 17 L 9.5 16 L 6.5 9.5 L 11 9.5 Z", fill: i, stroke: "white", strokeWidth: 1 }),
|
|
2056
|
+
/* @__PURE__ */ l("rect", { x: 12, y: 14, width: c, height: 16, rx: 3, fill: i }),
|
|
2057
|
+
/* @__PURE__ */ l("text", { x: 17, y: 26, fill: "white", fontSize: 10, fontFamily: "sans-serif", children: o.name })
|
|
1951
2058
|
] }, "cursor")
|
|
1952
2059
|
);
|
|
1953
2060
|
}
|
|
1954
|
-
return /* @__PURE__ */
|
|
2061
|
+
return /* @__PURE__ */ l("g", { children: s }, o.clientId);
|
|
1955
2062
|
}) });
|
|
1956
2063
|
}
|
|
1957
|
-
const
|
|
1958
|
-
function
|
|
2064
|
+
const Dr = "local";
|
|
2065
|
+
function Mr(e, t, n) {
|
|
1959
2066
|
const r = e === "undo" ? "Couldn't undo" : e === "redo" ? "Couldn't redo" : "Your change was undone";
|
|
1960
2067
|
return t === "HOST_REJECTED" ? `${r}: ${n}` : `${r}: ${{
|
|
1961
2068
|
TEXT_CHANGED: "someone else changed that parameter",
|
|
@@ -1968,40 +2075,40 @@ function gr(e, t, n) {
|
|
|
1968
2075
|
DEPENDENCIES_CHANGED: "someone else changed the packages"
|
|
1969
2076
|
}[t] ?? "the canvas has changed"}.`;
|
|
1970
2077
|
}
|
|
1971
|
-
function
|
|
2078
|
+
function it() {
|
|
1972
2079
|
if (typeof crypto.randomUUID == "function") return crypto.randomUUID();
|
|
1973
2080
|
const e = crypto.getRandomValues(new Uint8Array(16));
|
|
1974
2081
|
e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
1975
2082
|
const t = [...e].map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
1976
2083
|
return `${t.slice(0, 8)}-${t.slice(8, 12)}-${t.slice(12, 16)}-${t.slice(16, 20)}-${t.slice(20)}`;
|
|
1977
2084
|
}
|
|
1978
|
-
function
|
|
2085
|
+
function Ar(e, t) {
|
|
1979
2086
|
return e.embeddedInBlockId ? t.get(e.embeddedInBlockId)?.paramSlots[e.embeddedSlotIndex]?.commandBlockId === e.instanceId : !1;
|
|
1980
2087
|
}
|
|
1981
|
-
function
|
|
2088
|
+
function _r(e) {
|
|
1982
2089
|
return e.kind === "next" ? { next: e.blockId } : { mouth: e.blockId, slot: e.slotIndex };
|
|
1983
2090
|
}
|
|
1984
|
-
async function
|
|
2091
|
+
async function mn(e, t) {
|
|
1985
2092
|
if (!e || !t) return !1;
|
|
1986
|
-
const n = new Map(e.map((s) => [
|
|
1987
|
-
o.forEach(
|
|
2093
|
+
const n = new Map(e.map((s) => [Ue(s), s])), r = new Set(Ye().map((s) => s.info.id).filter((s) => s.startsWith(ft))), o = [...r].filter((s) => !n.has(s)), i = [...n].filter(([s]) => !r.has(s));
|
|
2094
|
+
o.forEach(qt);
|
|
1988
2095
|
for (const [s, c] of i)
|
|
1989
|
-
await
|
|
2096
|
+
await Wt({ id: s, name: Z(c), description: "", url: t(c), builtIn: !1 });
|
|
1990
2097
|
return o.length > 0 || i.length > 0;
|
|
1991
2098
|
}
|
|
1992
|
-
function
|
|
1993
|
-
const t = new Map(
|
|
2099
|
+
function Lr(e) {
|
|
2100
|
+
const t = new Map(Ye().map((r) => [r.info.id, r.info.name])), n = /* @__PURE__ */ new Map();
|
|
1994
2101
|
return e.forEach((r) => {
|
|
1995
|
-
const o =
|
|
1996
|
-
if (!o?.startsWith(
|
|
2102
|
+
const o = Pn(r.definitionId);
|
|
2103
|
+
if (!o?.startsWith(ft)) return;
|
|
1997
2104
|
const i = t.get(o);
|
|
1998
2105
|
n.set(i, (n.get(i) ?? 0) + 1);
|
|
1999
2106
|
}), n;
|
|
2000
2107
|
}
|
|
2001
|
-
function
|
|
2002
|
-
const r =
|
|
2108
|
+
function Nr(e, t, n) {
|
|
2109
|
+
const r = at(e);
|
|
2003
2110
|
return {
|
|
2004
|
-
instanceId:
|
|
2111
|
+
instanceId: it(),
|
|
2005
2112
|
definitionId: e,
|
|
2006
2113
|
x: t,
|
|
2007
2114
|
y: n,
|
|
@@ -2012,70 +2119,69 @@ function xr(e, t, n) {
|
|
|
2012
2119
|
paramSlots: r.params.map(() => ({ textValue: null, queryBlockId: null, commandBlockId: null }))
|
|
2013
2120
|
};
|
|
2014
2121
|
}
|
|
2015
|
-
function
|
|
2122
|
+
function _t(e, t) {
|
|
2016
2123
|
const n = [];
|
|
2017
2124
|
let r = e;
|
|
2018
2125
|
for (; r; )
|
|
2019
2126
|
n.push(r), r = t.get(r)?.nextBlockId ?? null;
|
|
2020
2127
|
return n;
|
|
2021
2128
|
}
|
|
2022
|
-
function
|
|
2129
|
+
function Lt(e, t) {
|
|
2023
2130
|
const n = t.get(e);
|
|
2024
|
-
return n?.parentBlockId ?
|
|
2131
|
+
return n?.parentBlockId ? Lt(n.parentBlockId, t) : n && Ar(n, t) ? Lt(n.embeddedInBlockId, t) : e;
|
|
2025
2132
|
}
|
|
2026
|
-
function
|
|
2027
|
-
const n =
|
|
2133
|
+
function Nt(e, t) {
|
|
2134
|
+
const n = H(e.definitionId);
|
|
2028
2135
|
if (!n) return `[missing:${e.definitionId}]`;
|
|
2029
2136
|
const r = e.paramSlots.map((o, i) => {
|
|
2030
2137
|
const s = n.params[i];
|
|
2031
|
-
if (s &&
|
|
2032
|
-
const
|
|
2033
|
-
return
|
|
2138
|
+
if (s && Oe(n, s)) {
|
|
2139
|
+
const p = (o.commandBlockId ? _t(o.commandBlockId, t) : []).map((m) => t.get(m)).filter(Boolean).map((m) => Nt(m, t));
|
|
2140
|
+
return p.length > 0 ? `{ ${p.join("; ")} }` : "{ }";
|
|
2034
2141
|
}
|
|
2035
2142
|
if (o.queryBlockId) {
|
|
2036
2143
|
const c = t.get(o.queryBlockId);
|
|
2037
|
-
if (c) return
|
|
2144
|
+
if (c) return Nt(c, t);
|
|
2038
2145
|
}
|
|
2039
2146
|
return o.textValue !== null && o.textValue !== void 0 ? n.params[i]?.type === "string" ? `"${o.textValue}"` : o.textValue : "_";
|
|
2040
2147
|
});
|
|
2041
2148
|
return `${n.id}(${r.join(", ")})`;
|
|
2042
2149
|
}
|
|
2043
|
-
function
|
|
2044
|
-
const
|
|
2150
|
+
function Or({ ghostPos: e, blocks: t }) {
|
|
2151
|
+
const n = K();
|
|
2045
2152
|
if (!e) return null;
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
return /* @__PURE__ */ a("svg", { style: { position: "fixed", top: 0, left: 0, width: "100%", height: "100%", pointerEvents: "none", zIndex: 9999 }, children: /* @__PURE__ */ a("g", { transform: `translate(${e.x},${e.y})`, opacity: 0.8, children: /* @__PURE__ */ a(ht, { block: h, allBlocks: n, isGhost: !0 }) }) });
|
|
2153
|
+
if (e.instanceId) {
|
|
2154
|
+
const p = t.get(e.instanceId);
|
|
2155
|
+
if (p)
|
|
2156
|
+
return /* @__PURE__ */ l("svg", { style: { position: "fixed", top: 0, left: 0, width: "100%", height: "100%", pointerEvents: "none", zIndex: 9999 }, children: /* @__PURE__ */ l("g", { transform: `translate(${e.x},${e.y})`, opacity: 0.8, children: /* @__PURE__ */ l(yt, { block: p, allBlocks: t, isGhost: !0 }) }) });
|
|
2051
2157
|
}
|
|
2052
|
-
const
|
|
2158
|
+
const r = at(e.defId), o = ve(r), i = r.blockType === "command", s = jt(r), c = Ee(r);
|
|
2053
2159
|
return /* @__PURE__ */ y("svg", { style: { position: "fixed", top: 0, left: 0, width: "100%", height: "100%", pointerEvents: "none", zIndex: 9999 }, children: [
|
|
2054
|
-
|
|
2160
|
+
i && /* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", { id: "ghost-pal-clip", children: /* @__PURE__ */ l("path", { d: s }) }) }),
|
|
2055
2161
|
/* @__PURE__ */ y("g", { transform: `translate(${e.x},${e.y})`, opacity: 0.8, children: [
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ l("path", { d: s, fill: i ? n.blockBody : r.color, stroke: i ? n.blockBorder : "rgba(0,0,0,0.4)", strokeWidth: 1.5 }),
|
|
2163
|
+
i && /* @__PURE__ */ l("rect", { x: 0, y: 0, width: 4, height: o + 20, fill: r.color, clipPath: "url(#ghost-pal-clip)" }),
|
|
2164
|
+
c.length > 0 && /* @__PURE__ */ l(Kt, { mouths: c, w: ue(r), isEmpty: () => !0 }),
|
|
2165
|
+
/* @__PURE__ */ l(
|
|
2060
2166
|
"text",
|
|
2061
2167
|
{
|
|
2062
2168
|
x: 11,
|
|
2063
|
-
y:
|
|
2064
|
-
fill:
|
|
2169
|
+
y: Qe(r) / 2 + 4,
|
|
2170
|
+
fill: i ? n.blockText : "white",
|
|
2065
2171
|
fontSize: 11,
|
|
2066
2172
|
fontWeight: "bold",
|
|
2067
2173
|
fontFamily: "sans-serif",
|
|
2068
2174
|
style: { userSelect: "none" },
|
|
2069
|
-
children:
|
|
2175
|
+
children: r.name
|
|
2070
2176
|
}
|
|
2071
2177
|
)
|
|
2072
2178
|
] })
|
|
2073
2179
|
] });
|
|
2074
2180
|
}
|
|
2075
|
-
function
|
|
2181
|
+
function Rr(e, t) {
|
|
2076
2182
|
return e.returnType === t || (e.usableAs?.includes(t) ?? !1);
|
|
2077
2183
|
}
|
|
2078
|
-
function
|
|
2184
|
+
function Ur({
|
|
2079
2185
|
blocksUrl: e = "/blocks.json",
|
|
2080
2186
|
blocksUrls: t,
|
|
2081
2187
|
onRun: n,
|
|
@@ -2084,317 +2190,338 @@ function wr({
|
|
|
2084
2190
|
initialState: i,
|
|
2085
2191
|
onSave: s,
|
|
2086
2192
|
themeId: c,
|
|
2087
|
-
hideTitleBar:
|
|
2088
|
-
getStateRef:
|
|
2089
|
-
additionalBlocks:
|
|
2193
|
+
hideTitleBar: p,
|
|
2194
|
+
getStateRef: m,
|
|
2195
|
+
additionalBlocks: g,
|
|
2090
2196
|
dependencies: B,
|
|
2091
|
-
onDependenciesChange:
|
|
2197
|
+
onDependenciesChange: z,
|
|
2092
2198
|
packageBlocksUrl: w,
|
|
2093
|
-
availablePackages:
|
|
2094
|
-
packageActions:
|
|
2095
|
-
collaboration:
|
|
2096
|
-
scriptWriters:
|
|
2097
|
-
onExport:
|
|
2199
|
+
availablePackages: W,
|
|
2200
|
+
packageActions: q,
|
|
2201
|
+
collaboration: $,
|
|
2202
|
+
scriptWriters: v,
|
|
2203
|
+
onExport: J
|
|
2098
2204
|
}) {
|
|
2099
|
-
const [
|
|
2100
|
-
if (c) return
|
|
2101
|
-
const
|
|
2102
|
-
return
|
|
2103
|
-
});
|
|
2104
|
-
Q(() =>
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
ne(l);
|
|
2108
|
-
}, [c]);
|
|
2109
|
-
const [X, re] = P(!1), [le, x] = P(null), T = v?.commands, q = v?.clientId ?? hr, [Y, ae] = P(() => vn({
|
|
2110
|
-
blocks: new Map((i?.blocks ?? []).map(([l, d]) => [l, Te(d)])),
|
|
2205
|
+
const [x, Q] = E(() => {
|
|
2206
|
+
if (c) return ot.find((d) => d.id === c) ?? Xe;
|
|
2207
|
+
const a = vr("cardcq-theme");
|
|
2208
|
+
return ot.find((d) => d.id === a) ?? Xe;
|
|
2209
|
+
}), [ee, ae] = E(c);
|
|
2210
|
+
c !== ee && (ae(c), c && Q(ot.find((a) => a.id === c) ?? Xe));
|
|
2211
|
+
const [te, k] = E(!1), [O, X] = E(null), U = $?.commands, ie = $?.clientId ?? Dr, [ne, Re] = E(() => Tn({
|
|
2212
|
+
blocks: new Map((i?.blocks ?? []).map(([a, d]) => [a, Te(d)])),
|
|
2111
2213
|
dependencies: B ?? []
|
|
2112
|
-
})), { state:
|
|
2113
|
-
|
|
2114
|
-
M.current =
|
|
2214
|
+
})), { state: f, provisionalIds: oe } = Ve(() => gn(ne), [ne]), b = f.blocks, M = re(ne), V = re(f);
|
|
2215
|
+
G(() => {
|
|
2216
|
+
M.current = ne, V.current = f;
|
|
2115
2217
|
});
|
|
2116
|
-
const
|
|
2117
|
-
|
|
2118
|
-
const
|
|
2119
|
-
|
|
2120
|
-
|
|
2218
|
+
const se = (B ?? []).map(Ue).join("|"), [ye, He] = E(se);
|
|
2219
|
+
se !== ye && (He(se), !U && se !== ne.confirmed.dependencies.map(Ue).join("|") && Re((a) => ({ ...a, confirmed: { ...a.confirmed, dependencies: B ?? [] } })));
|
|
2220
|
+
const De = re(z);
|
|
2221
|
+
G(() => {
|
|
2222
|
+
De.current = z;
|
|
2121
2223
|
});
|
|
2122
|
-
const [
|
|
2123
|
-
|
|
2224
|
+
const [$e, ze] = E(null), fe = re(null), T = D((a) => {
|
|
2225
|
+
ze(a), fe.current && clearTimeout(fe.current), fe.current = setTimeout(() => ze(null), 5e3);
|
|
2124
2226
|
}, []);
|
|
2125
|
-
|
|
2126
|
-
|
|
2227
|
+
G(() => () => {
|
|
2228
|
+
fe.current && clearTimeout(fe.current);
|
|
2127
2229
|
}, []);
|
|
2128
|
-
const
|
|
2230
|
+
const me = D((a) => {
|
|
2129
2231
|
const d = M.current;
|
|
2130
|
-
M.current =
|
|
2131
|
-
}, []),
|
|
2132
|
-
const
|
|
2133
|
-
if (
|
|
2134
|
-
|
|
2232
|
+
M.current = a, V.current = gn(a).state, Re(a), a.confirmed.dependencies !== d.confirmed.dependencies && De.current?.(a.confirmed.dependencies);
|
|
2233
|
+
}, []), Me = D((a, d, u) => {
|
|
2234
|
+
const h = { id: d, clientId: ie, baseVersion: M.current.version, command: u };
|
|
2235
|
+
if (U) {
|
|
2236
|
+
me(a), U.submit(h);
|
|
2135
2237
|
return;
|
|
2136
2238
|
}
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2139
|
-
}, [
|
|
2140
|
-
if (!
|
|
2141
|
-
const d =
|
|
2142
|
-
|
|
2143
|
-
}, [
|
|
2144
|
-
const
|
|
2145
|
-
d &&
|
|
2146
|
-
}, [
|
|
2147
|
-
const
|
|
2148
|
-
d &&
|
|
2149
|
-
}, [
|
|
2150
|
-
|
|
2151
|
-
if (!
|
|
2152
|
-
const
|
|
2153
|
-
|
|
2154
|
-
const d =
|
|
2239
|
+
const I = hn(a, h, a.version + 1);
|
|
2240
|
+
I.outOfSync ? (me(pn(a, d).sync), T("That change couldn't be made: the canvas has changed.")) : me(I.sync);
|
|
2241
|
+
}, [ie, U, me, T]), ce = D((a) => {
|
|
2242
|
+
if (!a) return;
|
|
2243
|
+
const d = it();
|
|
2244
|
+
Me(Oo(M.current, d, a), d, a);
|
|
2245
|
+
}, [Me]), mt = D(() => {
|
|
2246
|
+
const a = it(), d = Ro(M.current, a);
|
|
2247
|
+
d && Me(d.sync, a, d.command);
|
|
2248
|
+
}, [Me]), xt = D(() => {
|
|
2249
|
+
const a = it(), d = Ho(M.current, a);
|
|
2250
|
+
d && Me(d.sync, a, d.command);
|
|
2251
|
+
}, [Me]), Ze = $?.presence, Gt = $?.presenceIntervalMs ?? Cn, le = re(null), [Zt, Jt] = E([]);
|
|
2252
|
+
G(() => {
|
|
2253
|
+
if (!Ze) return;
|
|
2254
|
+
const a = new qo((u) => Ze.publish(u), Gt);
|
|
2255
|
+
le.current = a;
|
|
2256
|
+
const d = Ze.subscribe((u) => Jt(u.filter((h) => h.clientId !== ie)));
|
|
2155
2257
|
return () => {
|
|
2156
|
-
|
|
2258
|
+
a.updateNow({ cursor: null, drag: null, typing: null }), a.dispose(), le.current = null, d(), Jt([]);
|
|
2157
2259
|
};
|
|
2158
|
-
}, [
|
|
2159
|
-
if (
|
|
2160
|
-
return
|
|
2161
|
-
if (
|
|
2260
|
+
}, [Ze, Gt, ie]), G(() => {
|
|
2261
|
+
if (U)
|
|
2262
|
+
return U.subscribe((a) => {
|
|
2263
|
+
if (a.type === "snapshot") {
|
|
2162
2264
|
const d = {
|
|
2163
|
-
blocks: new Map(
|
|
2164
|
-
dependencies:
|
|
2165
|
-
}, u =
|
|
2166
|
-
|
|
2167
|
-
} else if (
|
|
2168
|
-
const d =
|
|
2169
|
-
d.outOfSync ? (
|
|
2265
|
+
blocks: new Map(a.state.blocks.map(([h, I]) => [h, Te(I)])),
|
|
2266
|
+
dependencies: a.state.dependencies
|
|
2267
|
+
}, u = zo(d, a.version, M.current);
|
|
2268
|
+
me(u.sync), u.dropped > 0 && T("Reloaded from the server: your unconfirmed changes were discarded.");
|
|
2269
|
+
} else if (a.type === "applied") {
|
|
2270
|
+
const d = hn(M.current, a.envelope, a.version);
|
|
2271
|
+
d.outOfSync ? (T("Out of sync with the server: reloading…"), U.resync?.()) : me(d.sync);
|
|
2170
2272
|
} else {
|
|
2171
|
-
const d =
|
|
2172
|
-
|
|
2273
|
+
const d = pn(M.current, a.id);
|
|
2274
|
+
me(d.sync), d.action && T(Mr(d.action.kind, a.code, a.message));
|
|
2173
2275
|
}
|
|
2174
2276
|
});
|
|
2175
|
-
}, [
|
|
2176
|
-
const [Se] =
|
|
2177
|
-
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
function
|
|
2181
|
-
if (!
|
|
2277
|
+
}, [U, me, T]);
|
|
2278
|
+
const [Se] = E(() => /* @__PURE__ */ Symbol("BlockEditor"));
|
|
2279
|
+
G(() => (Sr(Se), () => Br(Se)), [Se]);
|
|
2280
|
+
const en = D(() => wr(Se), [Se]);
|
|
2281
|
+
G(() => {
|
|
2282
|
+
function a(d) {
|
|
2283
|
+
if (!Tr(Se)) return;
|
|
2182
2284
|
const u = d.target;
|
|
2183
2285
|
if (u && (u.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(u.tagName)) || !(d.ctrlKey || d.metaKey)) return;
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2286
|
+
const h = d.key.toLowerCase();
|
|
2287
|
+
h === "z" && !d.shiftKey ? (d.preventDefault(), mt()) : (h === "z" && d.shiftKey || h === "y" && !d.metaKey) && (d.preventDefault(), xt());
|
|
2186
2288
|
}
|
|
2187
|
-
return window.addEventListener("keydown",
|
|
2188
|
-
}, [
|
|
2189
|
-
const
|
|
2190
|
-
const
|
|
2289
|
+
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
2290
|
+
}, [mt, xt, Se]);
|
|
2291
|
+
const Fn = Ve(() => {
|
|
2292
|
+
const a = /* @__PURE__ */ new Set();
|
|
2191
2293
|
for (const d of b.values())
|
|
2192
|
-
|
|
2193
|
-
return
|
|
2194
|
-
}, [b]), [
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
}, [b,
|
|
2198
|
-
const
|
|
2199
|
-
|
|
2200
|
-
|
|
2294
|
+
H(d.definitionId)?.blockType === "start" && a.add(d.definitionId);
|
|
2295
|
+
return a;
|
|
2296
|
+
}, [b]), [jn, Je] = E(null), [Kn, tn] = E(/* @__PURE__ */ new Set()), [Qn, nn] = E(!1), [on, kt] = E(0), [Gn, bt] = E([]), he = Ve(() => or(b), [b, on]);
|
|
2297
|
+
G(() => {
|
|
2298
|
+
m && (m.current = () => ({ blocks: [...b.entries()] }));
|
|
2299
|
+
}, [b, m]);
|
|
2300
|
+
const pe = re(null), It = re(!1), et = re(null), We = (t ?? [e]).join("|"), vt = B !== void 0 || $?.commands !== void 0 && w !== void 0, $t = re(vt ? f.dependencies : void 0), St = re(w);
|
|
2301
|
+
G(() => {
|
|
2302
|
+
$t.current = vt ? f.dependencies : void 0, St.current = w;
|
|
2201
2303
|
});
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2204
|
-
let
|
|
2205
|
-
const d =
|
|
2206
|
-
return
|
|
2207
|
-
if (!
|
|
2304
|
+
const Zn = f.dependencies.map(Ue).join("|"), Ae = re(Promise.resolve()), [Jn, eo] = E(We);
|
|
2305
|
+
We !== Jn && (eo(We), k(!1), X(null)), G(() => {
|
|
2306
|
+
let a = !1;
|
|
2307
|
+
const d = We.split("|");
|
|
2308
|
+
return Ae.current = Ae.current.then(async () => {
|
|
2309
|
+
if (!a)
|
|
2208
2310
|
try {
|
|
2209
|
-
await
|
|
2210
|
-
for (let u = 1; u < d.length && !
|
|
2211
|
-
await
|
|
2311
|
+
await Yo(d[0]);
|
|
2312
|
+
for (let u = 1; u < d.length && !a; u++)
|
|
2313
|
+
await Wt({
|
|
2212
2314
|
id: `__extra_${u}__`,
|
|
2213
2315
|
name: `Extra ${u}`,
|
|
2214
2316
|
description: "",
|
|
2215
2317
|
url: d[u],
|
|
2216
2318
|
builtIn: !0
|
|
2217
2319
|
});
|
|
2218
|
-
if (
|
|
2219
|
-
|
|
2320
|
+
if (a || (await mn($t.current, St.current), a)) return;
|
|
2321
|
+
bt(Ye()), kt((u) => u + 1), k(!0);
|
|
2220
2322
|
} catch (u) {
|
|
2221
|
-
|
|
2323
|
+
a || X(String(u));
|
|
2222
2324
|
}
|
|
2223
2325
|
}), () => {
|
|
2224
|
-
|
|
2326
|
+
a = !0;
|
|
2225
2327
|
};
|
|
2226
|
-
}, [
|
|
2227
|
-
if (!
|
|
2228
|
-
let
|
|
2229
|
-
return
|
|
2230
|
-
if (!
|
|
2328
|
+
}, [We]), G(() => {
|
|
2329
|
+
if (!te) return;
|
|
2330
|
+
let a = !1;
|
|
2331
|
+
return Ae.current = Ae.current.then(async () => {
|
|
2332
|
+
if (!a)
|
|
2231
2333
|
try {
|
|
2232
|
-
if (!await
|
|
2233
|
-
|
|
2334
|
+
if (!await mn($t.current, St.current)) return;
|
|
2335
|
+
bt(Ye()), kt((u) => u + 1);
|
|
2234
2336
|
} catch (d) {
|
|
2235
|
-
|
|
2337
|
+
X(String(d));
|
|
2236
2338
|
}
|
|
2237
2339
|
}), () => {
|
|
2238
|
-
|
|
2340
|
+
a = !0;
|
|
2239
2341
|
};
|
|
2240
|
-
}, [
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2342
|
+
}, [te, Zn]), G(() => {
|
|
2343
|
+
if (!te) return;
|
|
2344
|
+
let a = !1;
|
|
2345
|
+
return Ae.current = Ae.current.then(() => {
|
|
2346
|
+
if (!a)
|
|
2347
|
+
try {
|
|
2348
|
+
qt("__inline__"), g && g.length > 0 && Vo(
|
|
2349
|
+
{ id: "__inline__", name: "Inline", description: "", url: "", builtIn: !0 },
|
|
2350
|
+
g
|
|
2351
|
+
), bt(Ye()), kt((d) => d + 1);
|
|
2352
|
+
} catch (d) {
|
|
2353
|
+
X(String(d));
|
|
2354
|
+
}
|
|
2355
|
+
}), () => {
|
|
2356
|
+
a = !0;
|
|
2357
|
+
};
|
|
2358
|
+
}, [g, te]);
|
|
2359
|
+
const xe = D((a, d) => {
|
|
2360
|
+
const u = et.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
|
|
2361
|
+
return { x: a - u.left, y: d - u.top };
|
|
2362
|
+
}, []), rn = D((a, d, u, h, I) => {
|
|
2363
|
+
if (H(u)?.blockType !== "command") return null;
|
|
2364
|
+
let _ = null;
|
|
2365
|
+
const L = (P) => {
|
|
2366
|
+
(!_ || P.dist < _.dist) && (_ = P);
|
|
2367
|
+
}, R = (P, Y) => {
|
|
2368
|
+
const F = Math.abs(a - P), S = Math.abs(d - Y);
|
|
2369
|
+
return F < 40 && S < 24 ? Math.hypot(F, S) : null;
|
|
2257
2370
|
};
|
|
2258
|
-
return b.forEach((
|
|
2259
|
-
if (
|
|
2260
|
-
const
|
|
2261
|
-
if (!(!
|
|
2262
|
-
if (!
|
|
2263
|
-
const
|
|
2264
|
-
|
|
2371
|
+
return b.forEach((P) => {
|
|
2372
|
+
if (I.has(P.instanceId)) return;
|
|
2373
|
+
const Y = H(P.definitionId), F = he.get(P.instanceId);
|
|
2374
|
+
if (!(!Y || Y.blockType === "query" || !F)) {
|
|
2375
|
+
if (!P.nextBlockId || P.nextBlockId === h) {
|
|
2376
|
+
const S = F.y + ve(Y, P.paramSlots, b), de = R(F.x, S);
|
|
2377
|
+
de !== null && L({ kind: "next", blockId: P.instanceId, snapX: F.x, snapY: S, dist: de });
|
|
2265
2378
|
}
|
|
2266
|
-
for (const
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2379
|
+
for (const S of Ee(Y, P.paramSlots, b)) {
|
|
2380
|
+
const de = F.x + S.x, tt = F.y + S.y, nt = R(de, tt);
|
|
2381
|
+
nt !== null && L({ kind: "mouth", blockId: P.instanceId, slotIndex: S.index, snapX: de, snapY: tt, dist: nt });
|
|
2269
2382
|
}
|
|
2270
2383
|
}
|
|
2271
|
-
}),
|
|
2272
|
-
}, [b,
|
|
2273
|
-
const
|
|
2274
|
-
if (!
|
|
2275
|
-
const
|
|
2384
|
+
}), _;
|
|
2385
|
+
}, [b, he]), sn = D((a, d, u, h, I) => {
|
|
2386
|
+
const C = H(u);
|
|
2387
|
+
if (!C || C.blockType !== "query") return null;
|
|
2388
|
+
const _ = 20;
|
|
2276
2389
|
let L = null;
|
|
2277
2390
|
return b.forEach((R) => {
|
|
2278
|
-
if (
|
|
2279
|
-
const
|
|
2280
|
-
if (!
|
|
2281
|
-
|
|
2282
|
-
if (!
|
|
2283
|
-
const
|
|
2284
|
-
if (
|
|
2285
|
-
const
|
|
2286
|
-
if (
|
|
2287
|
-
const
|
|
2288
|
-
(!L ||
|
|
2391
|
+
if (I.has(R.instanceId)) return;
|
|
2392
|
+
const P = H(R.definitionId), Y = he.get(R.instanceId);
|
|
2393
|
+
if (!P || !Y) return;
|
|
2394
|
+
Ge(P, R.paramSlots, b).forEach((S) => {
|
|
2395
|
+
if (!Rr(C, S.type)) return;
|
|
2396
|
+
const de = R.paramSlots[S.index]?.queryBlockId;
|
|
2397
|
+
if (de && de !== h) return;
|
|
2398
|
+
const tt = Y.x + S.x + S.w / 2, nt = Y.y + S.y + S.h / 2, ln = Math.abs(a + S.w / 2 - tt), an = Math.abs(d + S.h / 2 - nt);
|
|
2399
|
+
if (ln < S.w / 2 + _ && an < S.h / 2 + _) {
|
|
2400
|
+
const dn = Math.hypot(ln, an);
|
|
2401
|
+
(!L || dn < L.dist) && (L = { blockId: R.instanceId, slotIndex: S.index, snapX: Y.x + S.x, snapY: Y.y + S.y, dist: dn });
|
|
2289
2402
|
}
|
|
2290
2403
|
});
|
|
2291
2404
|
}), L;
|
|
2292
|
-
}, [b,
|
|
2293
|
-
if (
|
|
2294
|
-
const d =
|
|
2295
|
-
n?.(
|
|
2296
|
-
}, [b, n]), [
|
|
2297
|
-
if (
|
|
2298
|
-
const u = V.current.blocks.get(
|
|
2299
|
-
|
|
2300
|
-
}, []),
|
|
2301
|
-
|
|
2302
|
-
}, []),
|
|
2303
|
-
const
|
|
2304
|
-
|
|
2305
|
-
}, [
|
|
2306
|
-
|
|
2307
|
-
}, []),
|
|
2308
|
-
const
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
const
|
|
2315
|
-
|
|
2405
|
+
}, [b, he]), to = D((a) => {
|
|
2406
|
+
if (pe.current?.moved) return;
|
|
2407
|
+
const d = Lt(a, b), h = _t(d, b).map((I) => b.get(I)).filter(Boolean).map((I) => Nt(I, b));
|
|
2408
|
+
n?.(h);
|
|
2409
|
+
}, [b, n]), [no, Bt] = E(null), qe = re(null), oo = D((a, d) => {
|
|
2410
|
+
if (pe.current?.moved) return;
|
|
2411
|
+
const u = V.current.blocks.get(a)?.paramSlots[d]?.textValue ?? null;
|
|
2412
|
+
qe.current = { blockId: a, slotIndex: d, startText: u }, Bt(qe.current), le.current?.updateNow({ typing: { blockId: a, slot: d, text: u ?? "" } });
|
|
2413
|
+
}, []), ro = D((a, d, u) => {
|
|
2414
|
+
le.current?.update({ typing: { blockId: a, slot: d, text: u } });
|
|
2415
|
+
}, []), io = D((a, d, u) => {
|
|
2416
|
+
const h = qe.current;
|
|
2417
|
+
qe.current = null, Bt(null), !(!h || h.blockId !== a || h.slotIndex !== d) && (le.current?.updateNow({ typing: null }), ce(fn(a, d, h.startText, u)));
|
|
2418
|
+
}, [ce]), so = D(() => {
|
|
2419
|
+
qe.current = null, Bt(null), le.current?.updateNow({ typing: null });
|
|
2420
|
+
}, []), co = D((a, d) => {
|
|
2421
|
+
const u = V.current, h = u.blocks.get(a), I = h?.paramSlots[d];
|
|
2422
|
+
if (!h || !I) return;
|
|
2423
|
+
if (!I.queryBlockId) {
|
|
2424
|
+
ce(fn(a, d, I.textValue, null));
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
const C = H(h.definitionId), _ = he.get(a) ?? h, L = _.x + (C ? ue(C, h.paramSlots, u.blocks) : 0) + 24;
|
|
2428
|
+
ce(un(u, I.queryBlockId, { x: L, y: _.y }, null));
|
|
2429
|
+
}, [he, ce]), lo = D((a) => {
|
|
2430
|
+
const d = V.current, u = new Set(a.map(Z)), h = new Set(d.dependencies.filter((C) => !u.has(Z(C))).map(Ue)), I = [...d.blocks.values()].filter((C) => h.has(Pn(C.definitionId) ?? "")).map((C) => C.instanceId);
|
|
2431
|
+
ce(No(d, a, I));
|
|
2432
|
+
}, [ce]), ao = D((a) => {
|
|
2433
|
+
Q(a), c || $r("cardcq-theme", a.id), r?.(a);
|
|
2434
|
+
}, [r, c]), cn = D((a, d) => {
|
|
2435
|
+
a.preventDefault();
|
|
2436
|
+
const u = at(d), h = ue(u), I = ve(u);
|
|
2437
|
+
pe.current = {
|
|
2316
2438
|
type: "palette",
|
|
2317
2439
|
defId: d,
|
|
2318
|
-
offsetX:
|
|
2319
|
-
offsetY:
|
|
2320
|
-
startClientX:
|
|
2321
|
-
startClientY:
|
|
2440
|
+
offsetX: h / 2,
|
|
2441
|
+
offsetY: I / 2,
|
|
2442
|
+
startClientX: a.clientX,
|
|
2443
|
+
startClientY: a.clientY,
|
|
2322
2444
|
moved: !1
|
|
2323
|
-
},
|
|
2324
|
-
}, []),
|
|
2325
|
-
|
|
2445
|
+
}, Je({ x: a.clientX - h / 2, y: a.clientY - I / 2, defId: d }), a.target.setPointerCapture(a.pointerId);
|
|
2446
|
+
}, []), uo = D((a, d) => {
|
|
2447
|
+
a.preventDefault();
|
|
2326
2448
|
const u = b.get(d);
|
|
2327
2449
|
if (!u) return;
|
|
2328
|
-
const { x:
|
|
2329
|
-
|
|
2450
|
+
const { x: h, y: I } = xe(a.clientX, a.clientY), { x: C, y: _ } = he.get(d) ?? u, L = h - C, R = I - _, Y = H(u.definitionId)?.blockType === "query" ? [d] : _t(d, b);
|
|
2451
|
+
pe.current = {
|
|
2330
2452
|
type: "canvas",
|
|
2331
2453
|
defId: u.definitionId,
|
|
2332
2454
|
instanceId: d,
|
|
2333
|
-
carriedIds:
|
|
2455
|
+
carriedIds: Y,
|
|
2334
2456
|
offsetX: L,
|
|
2335
2457
|
offsetY: R,
|
|
2336
|
-
startClientX:
|
|
2337
|
-
startClientY:
|
|
2458
|
+
startClientX: a.clientX,
|
|
2459
|
+
startClientY: a.clientY,
|
|
2338
2460
|
moved: !1
|
|
2339
|
-
},
|
|
2340
|
-
}, [b,
|
|
2341
|
-
|
|
2342
|
-
function
|
|
2343
|
-
const
|
|
2344
|
-
if (!
|
|
2345
|
-
let
|
|
2346
|
-
if (!
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2461
|
+
}, tn(/* @__PURE__ */ new Set([d])), Je({ x: a.clientX - L, y: a.clientY - R, defId: u.definitionId, instanceId: d }), a.target.setPointerCapture(a.pointerId);
|
|
2462
|
+
}, [b, he, xe]);
|
|
2463
|
+
G(() => {
|
|
2464
|
+
function a(u) {
|
|
2465
|
+
const h = pe.current;
|
|
2466
|
+
if (!h) return;
|
|
2467
|
+
let I = !1;
|
|
2468
|
+
if (!h.moved && (Math.abs(u.clientX - h.startClientX) > 4 || Math.abs(u.clientY - h.startClientY) > 4) && (h.moved = !0, I = !0), !h.moved) return;
|
|
2469
|
+
Je({
|
|
2470
|
+
x: u.clientX - h.offsetX,
|
|
2471
|
+
y: u.clientY - h.offsetY,
|
|
2472
|
+
defId: h.defId,
|
|
2473
|
+
instanceId: h.instanceId
|
|
2474
|
+
});
|
|
2475
|
+
const C = xe(u.clientX - h.offsetX, u.clientY - h.offsetY), _ = h.type === "canvas" ? { drag: { leadId: h.instanceId, at: C }, cursor: xe(u.clientX, u.clientY) } : { drag: { definitionId: h.defId, at: C }, cursor: xe(u.clientX, u.clientY) };
|
|
2476
|
+
if (I ? le.current?.updateNow(_) : le.current?.update(_), h.type === "canvas") {
|
|
2477
|
+
const L = et.current?.getBoundingClientRect(), R = !!L && u.clientX < L.left;
|
|
2478
|
+
R !== It.current && (It.current = R, nn(R));
|
|
2352
2479
|
}
|
|
2353
2480
|
}
|
|
2354
2481
|
function d(u) {
|
|
2355
|
-
const
|
|
2356
|
-
if (!
|
|
2357
|
-
|
|
2358
|
-
const
|
|
2359
|
-
if (!
|
|
2360
|
-
const
|
|
2361
|
-
if (
|
|
2362
|
-
|
|
2482
|
+
const h = pe.current;
|
|
2483
|
+
if (!h || (pe.current = null, Je(null), tn(/* @__PURE__ */ new Set()), It.current = !1, nn(!1), !h.moved)) return;
|
|
2484
|
+
le.current?.updateNow({ drag: null });
|
|
2485
|
+
const I = et.current?.getBoundingClientRect();
|
|
2486
|
+
if (!I) return;
|
|
2487
|
+
const C = V.current;
|
|
2488
|
+
if (h.type === "canvas" && u.clientX < I.left) {
|
|
2489
|
+
ce(Lo(C, h.instanceId));
|
|
2363
2490
|
return;
|
|
2364
2491
|
}
|
|
2365
|
-
const
|
|
2366
|
-
let
|
|
2492
|
+
const _ = u.clientX - h.offsetX - I.left, L = u.clientY - h.offsetY - I.top, R = at(h.defId), P = h.type === "canvas" ? h.instanceId : null, Y = new Set(P ? pt(C.blocks, P) : []);
|
|
2493
|
+
let F = null;
|
|
2367
2494
|
if (R.blockType === "query") {
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2495
|
+
const S = sn(_, L, h.defId, P, Y);
|
|
2496
|
+
S && (F = { socket: S.blockId, slot: S.slotIndex });
|
|
2370
2497
|
} else {
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2498
|
+
const S = rn(_, L, h.defId, P, Y);
|
|
2499
|
+
S && (F = _r(S));
|
|
2373
2500
|
}
|
|
2374
|
-
if (
|
|
2375
|
-
if (u.clientX <
|
|
2501
|
+
if (h.type === "palette") {
|
|
2502
|
+
if (u.clientX < I.left || u.clientX > I.right || u.clientY < I.top || u.clientY > I.bottom || R.blockType === "start" && [...C.blocks.values()].some((de) => de.definitionId === h.defId))
|
|
2376
2503
|
return;
|
|
2377
|
-
|
|
2504
|
+
ce(_o(C, Nr(h.defId, _, L), { x: _, y: L }, F));
|
|
2378
2505
|
} else
|
|
2379
|
-
|
|
2506
|
+
ce(un(C, P, { x: _, y: L }, F));
|
|
2380
2507
|
}
|
|
2381
|
-
return document.addEventListener("pointermove",
|
|
2382
|
-
document.removeEventListener("pointermove",
|
|
2508
|
+
return document.addEventListener("pointermove", a), document.addEventListener("pointerup", d), () => {
|
|
2509
|
+
document.removeEventListener("pointermove", a), document.removeEventListener("pointerup", d);
|
|
2383
2510
|
};
|
|
2384
|
-
}, [
|
|
2385
|
-
const
|
|
2386
|
-
|
|
2387
|
-
}, [
|
|
2388
|
-
|
|
2389
|
-
}, []),
|
|
2390
|
-
const d =
|
|
2391
|
-
if (
|
|
2392
|
-
|
|
2511
|
+
}, [rn, sn, ce, xe]);
|
|
2512
|
+
const fo = D((a) => {
|
|
2513
|
+
pe.current?.moved || le.current?.update({ cursor: xe(a.clientX, a.clientY) });
|
|
2514
|
+
}, [xe]), ho = D(() => {
|
|
2515
|
+
pe.current?.moved || le.current?.updateNow({ cursor: null });
|
|
2516
|
+
}, []), po = D((a) => {
|
|
2517
|
+
const d = a.write(rr(V.current, H));
|
|
2518
|
+
if (J) {
|
|
2519
|
+
J(d, a);
|
|
2393
2520
|
return;
|
|
2394
2521
|
}
|
|
2395
|
-
const u = URL.createObjectURL(new Blob([d], { type: "text/plain" })),
|
|
2396
|
-
|
|
2397
|
-
}, [
|
|
2522
|
+
const u = URL.createObjectURL(new Blob([d], { type: "text/plain" })), h = document.createElement("a");
|
|
2523
|
+
h.href = u, h.download = `behavior.${a.fileExtension}`, h.click(), URL.revokeObjectURL(u);
|
|
2524
|
+
}, [J]), wt = {
|
|
2398
2525
|
display: "flex",
|
|
2399
2526
|
flexDirection: "column",
|
|
2400
2527
|
flex: 1,
|
|
@@ -2402,35 +2529,35 @@ function wr({
|
|
|
2402
2529
|
width: "100%",
|
|
2403
2530
|
height: "100%",
|
|
2404
2531
|
overflow: "hidden",
|
|
2405
|
-
background:
|
|
2406
|
-
color:
|
|
2532
|
+
background: x.appBg,
|
|
2533
|
+
color: x.textPrimary,
|
|
2407
2534
|
fontFamily: "system-ui, sans-serif",
|
|
2408
2535
|
boxSizing: "border-box"
|
|
2409
|
-
},
|
|
2536
|
+
}, go = {
|
|
2410
2537
|
display: "flex",
|
|
2411
2538
|
flex: 1,
|
|
2412
2539
|
minHeight: 0,
|
|
2413
2540
|
overflow: "hidden"
|
|
2414
2541
|
};
|
|
2415
|
-
return
|
|
2542
|
+
return O ? /* @__PURE__ */ l(rt.Provider, { value: x, children: /* @__PURE__ */ y("div", { style: { ...wt, alignItems: "center", justifyContent: "center", color: "#c06060", fontFamily: "monospace" }, children: [
|
|
2416
2543
|
"Failed to load blocks: ",
|
|
2417
|
-
|
|
2418
|
-
] }) }) :
|
|
2419
|
-
!
|
|
2544
|
+
O
|
|
2545
|
+
] }) }) : te ? /* @__PURE__ */ l(rt.Provider, { value: x, children: /* @__PURE__ */ y("div", { style: wt, onPointerDownCapture: en, onFocusCapture: en, children: [
|
|
2546
|
+
!p && /* @__PURE__ */ y("div", { style: {
|
|
2420
2547
|
flexShrink: 0,
|
|
2421
2548
|
display: "flex",
|
|
2422
2549
|
alignItems: "center",
|
|
2423
2550
|
gap: 10,
|
|
2424
2551
|
padding: "0 14px",
|
|
2425
2552
|
height: 38,
|
|
2426
|
-
background:
|
|
2427
|
-
borderBottom: `1px solid ${
|
|
2553
|
+
background: x.titleBg,
|
|
2554
|
+
borderBottom: `1px solid ${x.border}`
|
|
2428
2555
|
}, children: [
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2556
|
+
/* @__PURE__ */ l("span", { style: { color: x.titlePrimaryText, fontWeight: "bold", fontSize: 13, letterSpacing: 1, textTransform: "uppercase" }, children: "CardCQ" }),
|
|
2557
|
+
/* @__PURE__ */ l("span", { style: { color: x.titleSecondaryText, fontSize: 11, letterSpacing: 0.5 }, children: "Behavior Editor" }),
|
|
2431
2558
|
o,
|
|
2432
2559
|
/* @__PURE__ */ y("div", { style: { marginLeft: "auto", display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
2433
|
-
s && /* @__PURE__ */
|
|
2560
|
+
s && /* @__PURE__ */ l(
|
|
2434
2561
|
"button",
|
|
2435
2562
|
{
|
|
2436
2563
|
onClick: () => s({ blocks: [...b.entries()] }),
|
|
@@ -2438,9 +2565,9 @@ function wr({
|
|
|
2438
2565
|
padding: "3px 10px",
|
|
2439
2566
|
fontSize: 11,
|
|
2440
2567
|
fontWeight: "bold",
|
|
2441
|
-
background:
|
|
2442
|
-
color:
|
|
2443
|
-
border: `1px solid ${
|
|
2568
|
+
background: x.titleBg,
|
|
2569
|
+
color: x.titlePrimaryText,
|
|
2570
|
+
border: `1px solid ${x.border}`,
|
|
2444
2571
|
borderRadius: 4,
|
|
2445
2572
|
cursor: "pointer",
|
|
2446
2573
|
letterSpacing: 0.5
|
|
@@ -2448,83 +2575,84 @@ function wr({
|
|
|
2448
2575
|
children: "Save"
|
|
2449
2576
|
}
|
|
2450
2577
|
),
|
|
2451
|
-
!c && /* @__PURE__ */
|
|
2578
|
+
!c && /* @__PURE__ */ l(br, { onSelect: ao })
|
|
2452
2579
|
] })
|
|
2453
2580
|
] }),
|
|
2454
|
-
/* @__PURE__ */ y("div", { style:
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
|
|
2581
|
+
/* @__PURE__ */ y("div", { style: go, children: [
|
|
2582
|
+
/* @__PURE__ */ l(
|
|
2583
|
+
xr,
|
|
2457
2584
|
{
|
|
2458
|
-
onPointerDown:
|
|
2459
|
-
isDropTarget:
|
|
2460
|
-
registryVersion:
|
|
2461
|
-
packages:
|
|
2462
|
-
available:
|
|
2463
|
-
dependencies:
|
|
2464
|
-
onChange:
|
|
2465
|
-
actions:
|
|
2466
|
-
blockCounts:
|
|
2467
|
-
conflictCounts: new Map(
|
|
2585
|
+
onPointerDown: cn,
|
|
2586
|
+
isDropTarget: Qn,
|
|
2587
|
+
registryVersion: on,
|
|
2588
|
+
packages: vt && (z || U) ? {
|
|
2589
|
+
available: W ?? [],
|
|
2590
|
+
dependencies: f.dependencies,
|
|
2591
|
+
onChange: lo,
|
|
2592
|
+
actions: q,
|
|
2593
|
+
blockCounts: Lr(b),
|
|
2594
|
+
conflictCounts: new Map(Gn.filter((a) => a.info.id.startsWith(ft)).map((a) => [a.info.name, a.conflictIds.length]))
|
|
2468
2595
|
} : void 0,
|
|
2469
|
-
placedStartIds:
|
|
2596
|
+
placedStartIds: Fn
|
|
2470
2597
|
}
|
|
2471
2598
|
),
|
|
2472
2599
|
/* @__PURE__ */ y(
|
|
2473
2600
|
"div",
|
|
2474
2601
|
{
|
|
2475
2602
|
style: { flex: 1, minWidth: 0, display: "flex", position: "relative" },
|
|
2476
|
-
onPointerMove:
|
|
2477
|
-
onPointerLeave:
|
|
2603
|
+
onPointerMove: fo,
|
|
2604
|
+
onPointerLeave: ho,
|
|
2478
2605
|
children: [
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
|
|
2606
|
+
/* @__PURE__ */ l(
|
|
2607
|
+
Yn,
|
|
2481
2608
|
{
|
|
2482
|
-
ref:
|
|
2609
|
+
ref: et,
|
|
2483
2610
|
blocks: b,
|
|
2484
|
-
draggingIds:
|
|
2485
|
-
provisionalIds:
|
|
2486
|
-
onBlockPointerDown:
|
|
2487
|
-
onBlockClick:
|
|
2488
|
-
onSocketClick:
|
|
2489
|
-
editingSocket:
|
|
2490
|
-
onSocketInput:
|
|
2491
|
-
onSocketCommit:
|
|
2492
|
-
onSocketCancelEdit:
|
|
2493
|
-
|
|
2494
|
-
|
|
2611
|
+
draggingIds: Kn,
|
|
2612
|
+
provisionalIds: oe,
|
|
2613
|
+
onBlockPointerDown: uo,
|
|
2614
|
+
onBlockClick: to,
|
|
2615
|
+
onSocketClick: oo,
|
|
2616
|
+
editingSocket: no,
|
|
2617
|
+
onSocketInput: ro,
|
|
2618
|
+
onSocketCommit: io,
|
|
2619
|
+
onSocketCancelEdit: so,
|
|
2620
|
+
onParamRemove: co,
|
|
2621
|
+
onOutputDrag: cn,
|
|
2622
|
+
overlay: Zt.length > 0 ? /* @__PURE__ */ l(Er, { peers: Zt, blocks: b, layout: he }) : null
|
|
2495
2623
|
}
|
|
2496
2624
|
),
|
|
2497
|
-
/* @__PURE__ */
|
|
2498
|
-
|
|
2625
|
+
/* @__PURE__ */ l(
|
|
2626
|
+
Ir,
|
|
2499
2627
|
{
|
|
2500
|
-
canUndo:
|
|
2501
|
-
canRedo:
|
|
2502
|
-
onUndo:
|
|
2503
|
-
onRedo:
|
|
2504
|
-
notice:
|
|
2505
|
-
extra:
|
|
2628
|
+
canUndo: lt(ne) && ne.undo.length > 0,
|
|
2629
|
+
canRedo: lt(ne) && ne.redo.length > 0,
|
|
2630
|
+
onUndo: mt,
|
|
2631
|
+
onRedo: xt,
|
|
2632
|
+
notice: $e,
|
|
2633
|
+
extra: v && v.length > 0 ? /* @__PURE__ */ l(Cr, { writers: v, onExport: po }) : null
|
|
2506
2634
|
}
|
|
2507
2635
|
)
|
|
2508
2636
|
]
|
|
2509
2637
|
}
|
|
2510
2638
|
)
|
|
2511
2639
|
] }),
|
|
2512
|
-
/* @__PURE__ */
|
|
2513
|
-
] }) }) : /* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ l(Or, { ghostPos: jn, blocks: b })
|
|
2641
|
+
] }) }) : /* @__PURE__ */ l(rt.Provider, { value: x, children: /* @__PURE__ */ l("div", { style: { ...wt, alignItems: "center", justifyContent: "center", color: x.textMuted }, children: "Loading…" }) });
|
|
2514
2642
|
}
|
|
2515
|
-
function
|
|
2643
|
+
function Qt(e) {
|
|
2516
2644
|
const t = e.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
2517
2645
|
return /^[0-9]/.test(t) ? `_${t}` : t || "_";
|
|
2518
2646
|
}
|
|
2519
|
-
function
|
|
2647
|
+
function Ot(e) {
|
|
2520
2648
|
return JSON.stringify(e);
|
|
2521
2649
|
}
|
|
2522
|
-
function
|
|
2650
|
+
function Xn(e, t) {
|
|
2523
2651
|
switch (e.kind) {
|
|
2524
2652
|
case "text":
|
|
2525
|
-
return t === "string" ?
|
|
2653
|
+
return t === "string" ? Ot(e.text) : t === "boolean" ? e.text.toLowerCase() === "true" ? "True" : "False" : /^-?\d+(\.\d+)?$/.test(e.text) ? e.text : Ot(e.text);
|
|
2526
2654
|
case "query":
|
|
2527
|
-
return
|
|
2655
|
+
return st(e.node);
|
|
2528
2656
|
case "body":
|
|
2529
2657
|
return "None";
|
|
2530
2658
|
// mouths are written as blocks, not arguments
|
|
@@ -2532,29 +2660,29 @@ function On(e, t) {
|
|
|
2532
2660
|
return "None";
|
|
2533
2661
|
}
|
|
2534
2662
|
}
|
|
2535
|
-
function
|
|
2536
|
-
const t = e.args.filter((n) => n.value.kind !== "body").map((n) =>
|
|
2537
|
-
return `${
|
|
2663
|
+
function st(e) {
|
|
2664
|
+
const t = e.args.filter((n) => n.value.kind !== "body").map((n) => Xn(n.value, n.type));
|
|
2665
|
+
return `${Qt(e.name)}(${t.join(", ")})`;
|
|
2538
2666
|
}
|
|
2539
|
-
function
|
|
2667
|
+
function ut(e, t) {
|
|
2540
2668
|
return e.length === 0 ? [`${t}pass`] : e.flatMap((n) => {
|
|
2541
2669
|
const r = n.args.filter((i) => i.value.kind === "body");
|
|
2542
|
-
if (r.length === 0) return [`${t}${
|
|
2670
|
+
if (r.length === 0) return [`${t}${st(n)}`];
|
|
2543
2671
|
const o = `${t} `;
|
|
2544
2672
|
if (r.length === 1) {
|
|
2545
2673
|
const i = r[0].value;
|
|
2546
|
-
return [`${t}with ${
|
|
2674
|
+
return [`${t}with ${st(n)}:`, ...ut(i.body, o)];
|
|
2547
2675
|
}
|
|
2548
2676
|
return [
|
|
2549
|
-
`${t}with ${
|
|
2677
|
+
`${t}with ${st(n)}:`,
|
|
2550
2678
|
...r.flatMap((i) => [
|
|
2551
|
-
`${o}with ${
|
|
2552
|
-
...
|
|
2679
|
+
`${o}with ${Qt(i.name)}:`,
|
|
2680
|
+
...ut(i.value.body, `${o} `)
|
|
2553
2681
|
])
|
|
2554
2682
|
];
|
|
2555
2683
|
});
|
|
2556
2684
|
}
|
|
2557
|
-
const
|
|
2685
|
+
const Vr = {
|
|
2558
2686
|
id: "python",
|
|
2559
2687
|
label: "Python",
|
|
2560
2688
|
fileExtension: "py",
|
|
@@ -2564,15 +2692,15 @@ const Tr = {
|
|
|
2564
2692
|
${e.roots.map((n, r) => {
|
|
2565
2693
|
const [o, ...i] = n.body;
|
|
2566
2694
|
if (o?.blockType === "start") {
|
|
2567
|
-
const s = o.args.filter((c) => c.value.kind !== "body").map((c) =>
|
|
2695
|
+
const s = o.args.filter((c) => c.value.kind !== "body").map((c) => Xn(c.value, c.type));
|
|
2568
2696
|
return [
|
|
2569
|
-
`@on(${[
|
|
2570
|
-
`def ${
|
|
2571
|
-
...
|
|
2697
|
+
`@on(${[Ot(o.name), ...s].join(", ")})`,
|
|
2698
|
+
`def ${Qt(o.name)}():`,
|
|
2699
|
+
...ut(i, " ")
|
|
2572
2700
|
].join(`
|
|
2573
2701
|
`);
|
|
2574
2702
|
}
|
|
2575
|
-
return [`def chain_${r + 1}():`, ...
|
|
2703
|
+
return [`def chain_${r + 1}():`, ...ut(n.body, " ")].join(`
|
|
2576
2704
|
`);
|
|
2577
2705
|
}).join(`
|
|
2578
2706
|
|
|
@@ -2581,7 +2709,7 @@ ${e.roots.map((n, r) => {
|
|
|
2581
2709
|
`;
|
|
2582
2710
|
}
|
|
2583
2711
|
};
|
|
2584
|
-
class
|
|
2712
|
+
class Yr {
|
|
2585
2713
|
state;
|
|
2586
2714
|
version = 0;
|
|
2587
2715
|
clients = /* @__PURE__ */ new Map();
|
|
@@ -2636,9 +2764,9 @@ class Cr {
|
|
|
2636
2764
|
}
|
|
2637
2765
|
receive(t) {
|
|
2638
2766
|
try {
|
|
2639
|
-
this.state =
|
|
2767
|
+
this.state = je(this.state, t.command);
|
|
2640
2768
|
} catch (r) {
|
|
2641
|
-
if (!(r instanceof
|
|
2769
|
+
if (!(r instanceof N)) throw r;
|
|
2642
2770
|
const o = { type: "rejected", id: t.id, code: r.code, message: r.message };
|
|
2643
2771
|
this.clients.get(t.clientId)?.commandListeners.forEach((i) => i(o));
|
|
2644
2772
|
return;
|
|
@@ -2655,33 +2783,33 @@ class Cr {
|
|
|
2655
2783
|
}
|
|
2656
2784
|
}
|
|
2657
2785
|
export {
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2786
|
+
Ur as BlockEditor,
|
|
2787
|
+
qr as COMMANDS_VERSION,
|
|
2788
|
+
Pt as COMMAND_PARAM_TYPE,
|
|
2789
|
+
N as CommandRejected,
|
|
2790
|
+
Yr as LocalServer,
|
|
2791
|
+
ot as THEMES,
|
|
2792
|
+
rt as ThemeContext,
|
|
2793
|
+
br as ThemeSwitcher,
|
|
2794
|
+
je as applyCommand,
|
|
2795
|
+
No as changeDependencies,
|
|
2796
|
+
bo as compareVersions,
|
|
2797
|
+
Xe as darkTheme,
|
|
2798
|
+
Ur as default,
|
|
2799
|
+
Lo as deleteChain,
|
|
2800
|
+
pt as fragmentOf,
|
|
2801
|
+
wn as invertCommand,
|
|
2802
|
+
un as moveChain,
|
|
2675
2803
|
Te as normalizeBlock,
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2804
|
+
ht as normalizeSlot,
|
|
2805
|
+
_e as normalizeText,
|
|
2806
|
+
Z as packageKey,
|
|
2807
|
+
_o as placeNewBlock,
|
|
2808
|
+
zt as placeOf,
|
|
2809
|
+
Vr as pythonWriter,
|
|
2810
|
+
$n as roundPosition,
|
|
2811
|
+
Mo as samePlace,
|
|
2812
|
+
fn as setSocketText,
|
|
2813
|
+
rr as toProgram,
|
|
2814
|
+
K as useTheme
|
|
2687
2815
|
};
|