x-block-lib 0.4.12 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.id="x-block-lib",o.appendChild(document.createTextNode(".blocklyToolboxDiv{overflow-x:hidden;width:56px}.blocklyMainBackground{stroke-width:0}.blocklyToolboxCategory{margin-bottom:10px}.blocklyTreeRow{height:28px;display:flex;align-items:center;border-left-width:6px!important;border-right-width:6px!important}.blocklyTreeIcon{display:none!important}.blocklyFlyout{z-index:21}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
var ot = Object.defineProperty;
|
|
3
3
|
var nt = (e, o, t) => o in e ? ot(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
4
|
-
var
|
|
5
|
-
import { defineComponent as X, resolveComponent as C, openBlock as L, createBlock as P, unref as
|
|
6
|
-
import { d as _, j as s, O as l, u, X as dt, B as y, E, M as m, i as ie, a as U, b as f, C as Ue, F as fe, c as ft, P as Te, N as Ee, V as oe, e as Et, f as Ve, s as ht, g as H, S as g, h as ae, k as D, l as J, m as re, n as G, o as V, p as
|
|
4
|
+
var v = (e, o, t) => nt(e, typeof o != "symbol" ? o + "" : o, t);
|
|
5
|
+
import { defineComponent as X, resolveComponent as C, openBlock as L, createBlock as P, unref as A, useModel as ue, ref as ee, onMounted as Me, onUnmounted as it, withCtx as Y, createElementBlock as j, Fragment as st, renderList as lt, createVNode as B, createTextVNode as at, toDisplayString as pe, computed as K, isRef as rt, withKeys as ct, withModifiers as le, mergeProps as _t, createElementVNode as M, normalizeStyle as F, createCommentVNode as te, mergeModels as Ce, onBeforeUnmount as ut, watch as W, resolveDirective as pt, withDirectives as Tt } from "vue";
|
|
6
|
+
import { d as _, j as s, O as l, u, X as dt, B as y, E, M as m, i as ie, a as U, b as f, C as Ue, F as fe, c as ft, P as Te, N as Ee, V as oe, e as Et, f as Ve, s as ht, g as H, S as g, h as ae, k as D, l as J, m as re, n as G, o as V, p as ve, G as ce, q as mt, r as Ot, t as _e, U as z, D as Q, v as x, w as gt, T as se, x as Pe, y as It, z as Ae, A as Lt } from "./blockly-d7r2qvsx.js";
|
|
7
7
|
import { storeToRefs as yt } from "pinia";
|
|
8
|
-
import { openConfirmDlg as Ct, openPromptDlg as
|
|
8
|
+
import { openConfirmDlg as Ct, openPromptDlg as vt, eventBus as be, useSystem as At, useColor as bt, useViewStack as xe, useGlobalStore as kt } from "x-essential-lib";
|
|
9
9
|
import { useDisplay as Nt } from "vuetify";
|
|
10
10
|
import { useI18n as De } from "vue-i18n";
|
|
11
11
|
var Bt = "M19.36,2.72L20.78,4.14L15.06,9.85C16.13,11.39 16.28,13.24 15.38,14.44L9.06,8.12C10.26,7.22 12.11,7.37 13.65,8.44L19.36,2.72M5.93,17.57C3.92,15.56 2.69,13.16 2.35,10.92L7.23,8.83L14.67,16.27L12.58,21.15C10.34,20.81 7.94,19.58 5.93,17.57Z", Rt = "M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z", St = "M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z", Mt = "M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z", Ut = "M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,0 14,15A2,2 0 0,0 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17Z", Vt = "M21 3L3 10.53V11.5L9.84 14.16L12.5 21H13.46L21 3Z";
|
|
@@ -3260,7 +3260,7 @@ Ve.setConfirm(async (e, o) => {
|
|
|
3260
3260
|
o(!!t);
|
|
3261
3261
|
});
|
|
3262
3262
|
Ve.setPrompt(async (e, o, t) => {
|
|
3263
|
-
const n = await
|
|
3263
|
+
const n = await vt({
|
|
3264
3264
|
title: "",
|
|
3265
3265
|
value: o
|
|
3266
3266
|
});
|
|
@@ -3357,7 +3357,7 @@ class Co {
|
|
|
3357
3357
|
if (!n)
|
|
3358
3358
|
return;
|
|
3359
3359
|
const i = JSON.parse(n);
|
|
3360
|
-
i && t.workspace &&
|
|
3360
|
+
i && t.workspace && ve.paste(i, t.workspace);
|
|
3361
3361
|
},
|
|
3362
3362
|
scopeType: V.ScopeType.WORKSPACE,
|
|
3363
3363
|
id: "blockPasteFromStorage",
|
|
@@ -3452,14 +3452,14 @@ class Co {
|
|
|
3452
3452
|
if (!c)
|
|
3453
3453
|
return !1;
|
|
3454
3454
|
const p = JSON.parse(c);
|
|
3455
|
-
return p ? (
|
|
3455
|
+
return p ? (ve.paste(p, a), !0) : !1;
|
|
3456
3456
|
},
|
|
3457
3457
|
keyCodes: [o, t, n]
|
|
3458
3458
|
};
|
|
3459
3459
|
g.registry.register(i);
|
|
3460
3460
|
}
|
|
3461
3461
|
}
|
|
3462
|
-
class
|
|
3462
|
+
class vo {
|
|
3463
3463
|
init() {
|
|
3464
3464
|
const o = V.registry.getItem("cleanWorkspace");
|
|
3465
3465
|
o && (o.callback = function(t) {
|
|
@@ -3483,7 +3483,7 @@ function He(e) {
|
|
|
3483
3483
|
const o = e.getParent();
|
|
3484
3484
|
return o && He(o) ? !0 : !o && !!(e.outputConnection || e.previousConnection);
|
|
3485
3485
|
}
|
|
3486
|
-
class
|
|
3486
|
+
class Ao {
|
|
3487
3487
|
init() {
|
|
3488
3488
|
const o = V.registry.getItem("blockDisable");
|
|
3489
3489
|
o && (o.preconditionFn = function(t) {
|
|
@@ -3496,33 +3496,33 @@ class we extends _e {
|
|
|
3496
3496
|
constructor(t, n, i) {
|
|
3497
3497
|
super(_e.SKIP_SETUP);
|
|
3498
3498
|
/** The field's colour picker element. */
|
|
3499
|
-
|
|
3499
|
+
v(this, "picker", null);
|
|
3500
3500
|
/** Index of the currently highlighted element. */
|
|
3501
|
-
|
|
3501
|
+
v(this, "highlightedIndex", null);
|
|
3502
3502
|
/**
|
|
3503
3503
|
* Array holding info needed to unbind events.
|
|
3504
3504
|
* Used for disposing.
|
|
3505
3505
|
* Ex: [[node, name, func], [node, name, func]].
|
|
3506
3506
|
*/
|
|
3507
|
-
|
|
3507
|
+
v(this, "boundEvents", []);
|
|
3508
3508
|
/**
|
|
3509
3509
|
* Serializable fields are saved by the serializer, non-serializable fields
|
|
3510
3510
|
* are not. Editable fields should also be serializable.
|
|
3511
3511
|
*/
|
|
3512
|
-
|
|
3512
|
+
v(this, "SERIALIZABLE", !0);
|
|
3513
3513
|
/** Mouse cursor style when over the hotspot that initiates the editor. */
|
|
3514
|
-
|
|
3514
|
+
v(this, "CURSOR", "default");
|
|
3515
3515
|
/**
|
|
3516
3516
|
* Used to tell if the field needs to be rendered the next time the block is
|
|
3517
3517
|
* rendered. Colour fields are statically sized, and only need to be
|
|
3518
3518
|
* rendered at initialization.
|
|
3519
3519
|
*/
|
|
3520
|
-
|
|
3520
|
+
v(this, "isDirty_", !1);
|
|
3521
3521
|
/**
|
|
3522
3522
|
* An array of colour strings for the palette.
|
|
3523
3523
|
* Copied from goog.ui.ColorPicker.SIMPLE_GRID_COLORS
|
|
3524
3524
|
*/
|
|
3525
|
-
|
|
3525
|
+
v(this, "colours", [
|
|
3526
3526
|
// red
|
|
3527
3527
|
"#F44336",
|
|
3528
3528
|
// base
|
|
@@ -4084,11 +4084,11 @@ class we extends _e {
|
|
|
4084
4084
|
* An array of tooltip strings for the palette. If not the same length as
|
|
4085
4085
|
* COLOURS, the colour's hex code will be used for any missing titles.
|
|
4086
4086
|
*/
|
|
4087
|
-
|
|
4087
|
+
v(this, "titles", ["%{BKY_COLOR_RED}"]);
|
|
4088
4088
|
/**
|
|
4089
4089
|
* Number of columns in the palette.
|
|
4090
4090
|
*/
|
|
4091
|
-
|
|
4091
|
+
v(this, "columns", 14);
|
|
4092
4092
|
t !== _e.SKIP_SETUP && (i && this.configure_(i), this.setValue(t), n && this.setValidator(n));
|
|
4093
4093
|
}
|
|
4094
4094
|
configure_(t) {
|
|
@@ -4342,9 +4342,9 @@ function bo() {
|
|
|
4342
4342
|
}
|
|
4343
4343
|
const ko = new Co();
|
|
4344
4344
|
ko.init({ contextMenu: !0, shortcut: !0 });
|
|
4345
|
-
const No = new
|
|
4345
|
+
const No = new vo();
|
|
4346
4346
|
No.init();
|
|
4347
|
-
const Bo = new
|
|
4347
|
+
const Bo = new Ao();
|
|
4348
4348
|
Bo.init();
|
|
4349
4349
|
bo();
|
|
4350
4350
|
se.Classic.blockStyles = {
|
|
@@ -5276,7 +5276,7 @@ const he = {
|
|
|
5276
5276
|
class: "mr-3",
|
|
5277
5277
|
variant: "outlined",
|
|
5278
5278
|
density: "comfortable",
|
|
5279
|
-
icon:
|
|
5279
|
+
icon: A(Bt),
|
|
5280
5280
|
onClick: o
|
|
5281
5281
|
}, null, 8, ["icon"]);
|
|
5282
5282
|
};
|
|
@@ -5296,7 +5296,7 @@ const he = {
|
|
|
5296
5296
|
class: "mr-3",
|
|
5297
5297
|
variant: "outlined",
|
|
5298
5298
|
density: "comfortable",
|
|
5299
|
-
icon: o.value ?
|
|
5299
|
+
icon: o.value ? A(Mt) : A(Ut),
|
|
5300
5300
|
onClick: n[0] || (n[0] = (a) => o.value = !o.value)
|
|
5301
5301
|
}, null, 8, ["icon"]);
|
|
5302
5302
|
};
|
|
@@ -5367,13 +5367,13 @@ const he = {
|
|
|
5367
5367
|
}, 1032, ["active", "onClick"]))), 128))
|
|
5368
5368
|
]),
|
|
5369
5369
|
_: 1
|
|
5370
|
-
})) : (L(), j("span", Ko, pe(
|
|
5370
|
+
})) : (L(), j("span", Ko, pe(A(o)("x-block-lib.noOption")), 1));
|
|
5371
5371
|
};
|
|
5372
5372
|
}
|
|
5373
5373
|
}), Ho = { class: "text-subtitle-1 ml-3" }, wo = /* @__PURE__ */ X({
|
|
5374
5374
|
__name: "index",
|
|
5375
5375
|
setup(e) {
|
|
5376
|
-
const { t: o } = De(), t = Nt(), { sysBarAvail: n } =
|
|
5376
|
+
const { t: o } = De(), t = Nt(), { sysBarAvail: n } = At(), { backgroundColor1: i } = bt(), a = K(() => {
|
|
5377
5377
|
let O = "100%";
|
|
5378
5378
|
return t.mdAndUp.value && (O = "400px"), {
|
|
5379
5379
|
background: i.value,
|
|
@@ -5393,7 +5393,7 @@ const he = {
|
|
|
5393
5393
|
return (O, T) => {
|
|
5394
5394
|
const I = C("v-btn"), d = C("v-sheet"), S = C("v-icon"), w = C("v-dialog");
|
|
5395
5395
|
return L(), P(w, {
|
|
5396
|
-
modelValue:
|
|
5396
|
+
modelValue: A(p),
|
|
5397
5397
|
"onUpdate:modelValue": T[3] || (T[3] = (b) => rt(p) ? p.value = b : null),
|
|
5398
5398
|
transition: "scroll-x-reverse-transition",
|
|
5399
5399
|
persistent: "",
|
|
@@ -5405,7 +5405,7 @@ const he = {
|
|
|
5405
5405
|
B(I, _t(b, {
|
|
5406
5406
|
variant: "outlined",
|
|
5407
5407
|
density: "comfortable",
|
|
5408
|
-
icon:
|
|
5408
|
+
icon: A(Vt)
|
|
5409
5409
|
}), null, 16, ["icon"])
|
|
5410
5410
|
]),
|
|
5411
5411
|
default: Y(() => [
|
|
@@ -5418,7 +5418,7 @@ const he = {
|
|
|
5418
5418
|
class: "elevation-2",
|
|
5419
5419
|
style: F(a.value)
|
|
5420
5420
|
}, [
|
|
5421
|
-
|
|
5421
|
+
A(n) ? (L(), P(d, {
|
|
5422
5422
|
key: 0,
|
|
5423
5423
|
color: "transparent",
|
|
5424
5424
|
height: 24
|
|
@@ -5430,10 +5430,10 @@ const he = {
|
|
|
5430
5430
|
}, {
|
|
5431
5431
|
default: Y(() => [
|
|
5432
5432
|
B(S, {
|
|
5433
|
-
icon:
|
|
5433
|
+
icon: A(Rt),
|
|
5434
5434
|
onClick: T[0] || (T[0] = (b) => p.value = !1)
|
|
5435
5435
|
}, null, 8, ["icon"]),
|
|
5436
|
-
M("span", Ho, pe(
|
|
5436
|
+
M("span", Ho, pe(A(o)("x-block-lib.navigator")), 1)
|
|
5437
5437
|
]),
|
|
5438
5438
|
_: 1
|
|
5439
5439
|
}),
|
|
@@ -5541,10 +5541,10 @@ const $o = { class: "position-relative w-100 h-100" }, jo = /* @__PURE__ */ X({
|
|
|
5541
5541
|
right: "0px",
|
|
5542
5542
|
zIndex: 20
|
|
5543
5543
|
})), je = () => {
|
|
5544
|
-
d == null || d.resize();
|
|
5544
|
+
console.log("blockly resize"), d == null || d.resize();
|
|
5545
5545
|
}, Xe = (h) => {
|
|
5546
|
-
S.value = !0,
|
|
5547
|
-
}, We = () =>
|
|
5546
|
+
console.log("blockly load"), S.value = !0, Ae.workspaces.load(h, d);
|
|
5547
|
+
}, We = () => (console.log("blockly save"), Ae.workspaces.save(d)), Je = () => (console.log("blockly generateCode"), s.workspaceToCode(d));
|
|
5548
5548
|
Me(async () => {
|
|
5549
5549
|
if (!I.value) {
|
|
5550
5550
|
console.assert(!1);
|
|
@@ -5596,7 +5596,7 @@ const $o = { class: "position-relative w-100 h-100" }, jo = /* @__PURE__ */ X({
|
|
|
5596
5596
|
style: F(b.value)
|
|
5597
5597
|
}, [
|
|
5598
5598
|
B(qe, {
|
|
5599
|
-
icon:
|
|
5599
|
+
icon: A(St),
|
|
5600
5600
|
size: "x-large"
|
|
5601
5601
|
}, null, 8, ["icon"])
|
|
5602
5602
|
], 4)) : te("", !0),
|