@kubohiroya/turbowarp-extension-data-editor 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.ja.md +7 -1
- package/README.md +7 -1
- package/dist/build-info.json +3 -3
- package/dist/turbowarp/appearance.d.ts +7 -6
- package/dist/turbowarp/bridge.d.ts +14 -19
- package/dist/turbowarp/bridge.js +21 -16
- package/dist/turbowarp/error-session.d.ts +3 -17
- package/dist/turbowarp/error-session.js +2 -2
- package/dist/turbowarp/fixed-fields.d.ts +62 -77
- package/dist/turbowarp/fixed-fields.js +6 -6
- package/dist/turbowarp/fixed-transaction.d.ts +23 -18
- package/dist/turbowarp/fixed-transaction.js +13 -13
- package/dist/turbowarp/host.d.ts +2 -18
- package/dist/turbowarp/host.js +9 -6
- package/dist/turbowarp/icon.d.ts +1 -8
- package/dist/turbowarp/icon.js +6 -6
- package/dist/turbowarp/native-types.d.ts +136 -0
- package/dist/turbowarp/native-types.js +1 -0
- package/dist/turbowarp/subtree.d.ts +12 -9
- package/dist/turbowarp/subtree.js +3 -2
- package/dist/webpack4/THIRD_PARTY_LICENSES.md +1229 -0
- package/dist/webpack4/metafile.json +14 -14
- package/dist/webpack4/turbowarp.js +36 -29
- package/dist/webpack4/turbowarp.js.map +2 -2
- package/docs/ci-success-gate.md +2 -2
- package/docs/common-layout.ja.md +4 -4
- package/docs/descendants.md +2 -2
- package/docs/dialog-window.md +2 -2
- package/docs/schema-stage1.ja.md +3 -3
- package/docs/template-fixture-separation.ja.md +5 -5
- package/package.json +7 -5
- package/webpack4.cjs +19 -20
|
@@ -14222,7 +14222,7 @@
|
|
|
14222
14222
|
"format": "esm"
|
|
14223
14223
|
},
|
|
14224
14224
|
"dist/turbowarp/subtree.js": {
|
|
14225
|
-
"bytes":
|
|
14225
|
+
"bytes": 2694,
|
|
14226
14226
|
"imports": [
|
|
14227
14227
|
{
|
|
14228
14228
|
"path": "dist/index.js",
|
|
@@ -14233,12 +14233,12 @@
|
|
|
14233
14233
|
"format": "esm"
|
|
14234
14234
|
},
|
|
14235
14235
|
"dist/turbowarp/fixed-fields.js": {
|
|
14236
|
-
"bytes":
|
|
14236
|
+
"bytes": 15540,
|
|
14237
14237
|
"imports": [],
|
|
14238
14238
|
"format": "esm"
|
|
14239
14239
|
},
|
|
14240
14240
|
"dist/turbowarp/fixed-transaction.js": {
|
|
14241
|
-
"bytes":
|
|
14241
|
+
"bytes": 23569,
|
|
14242
14242
|
"imports": [
|
|
14243
14243
|
{
|
|
14244
14244
|
"path": "dist/index.js",
|
|
@@ -14269,7 +14269,7 @@
|
|
|
14269
14269
|
"format": "esm"
|
|
14270
14270
|
},
|
|
14271
14271
|
"dist/turbowarp/host.js": {
|
|
14272
|
-
"bytes":
|
|
14272
|
+
"bytes": 16420,
|
|
14273
14273
|
"imports": [
|
|
14274
14274
|
{
|
|
14275
14275
|
"path": "dist/index.js",
|
|
@@ -14290,7 +14290,7 @@
|
|
|
14290
14290
|
"format": "esm"
|
|
14291
14291
|
},
|
|
14292
14292
|
"dist/turbowarp/icon.js": {
|
|
14293
|
-
"bytes":
|
|
14293
|
+
"bytes": 3227,
|
|
14294
14294
|
"imports": [],
|
|
14295
14295
|
"format": "esm"
|
|
14296
14296
|
},
|
|
@@ -14300,12 +14300,12 @@
|
|
|
14300
14300
|
"format": "esm"
|
|
14301
14301
|
},
|
|
14302
14302
|
"dist/turbowarp/error-session.js": {
|
|
14303
|
-
"bytes":
|
|
14303
|
+
"bytes": 992,
|
|
14304
14304
|
"imports": [],
|
|
14305
14305
|
"format": "esm"
|
|
14306
14306
|
},
|
|
14307
14307
|
"dist/turbowarp/bridge.js": {
|
|
14308
|
-
"bytes":
|
|
14308
|
+
"bytes": 11447,
|
|
14309
14309
|
"imports": [
|
|
14310
14310
|
{
|
|
14311
14311
|
"path": "dist/turbowarp/host.js",
|
|
@@ -16875,7 +16875,7 @@
|
|
|
16875
16875
|
"imports": [],
|
|
16876
16876
|
"exports": [],
|
|
16877
16877
|
"inputs": {},
|
|
16878
|
-
"bytes":
|
|
16878
|
+
"bytes": 123816
|
|
16879
16879
|
},
|
|
16880
16880
|
"dist/webpack4/turbowarp.js": {
|
|
16881
16881
|
"imports": [
|
|
@@ -16914,16 +16914,16 @@
|
|
|
16914
16914
|
"bytesInOutput": 2252
|
|
16915
16915
|
},
|
|
16916
16916
|
"dist/turbowarp/fixed-fields.js": {
|
|
16917
|
-
"bytesInOutput":
|
|
16917
|
+
"bytesInOutput": 13608
|
|
16918
16918
|
},
|
|
16919
16919
|
"dist/turbowarp/fixed-transaction.js": {
|
|
16920
|
-
"bytesInOutput":
|
|
16920
|
+
"bytesInOutput": 19918
|
|
16921
16921
|
},
|
|
16922
16922
|
"dist/turbowarp/host.js": {
|
|
16923
|
-
"bytesInOutput":
|
|
16923
|
+
"bytesInOutput": 13530
|
|
16924
16924
|
},
|
|
16925
16925
|
"dist/turbowarp/icon.js": {
|
|
16926
|
-
"bytesInOutput":
|
|
16926
|
+
"bytesInOutput": 2916
|
|
16927
16927
|
},
|
|
16928
16928
|
"dist/turbowarp/appearance.js": {
|
|
16929
16929
|
"bytesInOutput": 1884
|
|
@@ -16932,13 +16932,13 @@
|
|
|
16932
16932
|
"bytesInOutput": 835
|
|
16933
16933
|
},
|
|
16934
16934
|
"dist/turbowarp/bridge.js": {
|
|
16935
|
-
"bytesInOutput":
|
|
16935
|
+
"bytesInOutput": 8994
|
|
16936
16936
|
},
|
|
16937
16937
|
"dist/turbowarp.js": {
|
|
16938
16938
|
"bytesInOutput": 1134
|
|
16939
16939
|
}
|
|
16940
16940
|
},
|
|
16941
|
-
"bytes":
|
|
16941
|
+
"bytes": 66196
|
|
16942
16942
|
},
|
|
16943
16943
|
"dist/webpack4/shared-FYUILHED.js.map": {
|
|
16944
16944
|
"imports": [],
|
|
@@ -24,9 +24,10 @@ var collectBlockEditorSubtree = ({ ScratchBlocks, reference, inspect, generation
|
|
|
24
24
|
const nodes = [];
|
|
25
25
|
const records = /* @__PURE__ */ new Map();
|
|
26
26
|
const pending = {};
|
|
27
|
-
|
|
27
|
+
function invalid(message) {
|
|
28
28
|
throw new BlockEditorStructureError(message, "invalid-structure");
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
|
+
;
|
|
30
31
|
const visit = (id, depth) => {
|
|
31
32
|
if (records.has(id)) {
|
|
32
33
|
throw new BlockEditorStructureError("A statement block is connected more than once.", "cycle");
|
|
@@ -133,7 +134,7 @@ var safeField = (field, Class) => {
|
|
|
133
134
|
if (currentPrototype !== entry.prototype)
|
|
134
135
|
return false;
|
|
135
136
|
for (const [name, expected] of entry.own) {
|
|
136
|
-
const actual = Object.getOwnPropertyDescriptor(
|
|
137
|
+
const actual = Object.getOwnPropertyDescriptor(entry.prototype, name);
|
|
137
138
|
if (Boolean(actual) !== Boolean(expected) || actual && (!("value" in actual) || !expected || !("value" in expected) || actual.value !== expected.value))
|
|
138
139
|
return false;
|
|
139
140
|
}
|
|
@@ -248,7 +249,7 @@ function inspectFixedArgument({ ScratchBlocks, block, vmBlock, target, argument,
|
|
|
248
249
|
signatureParts: sourceIdentity
|
|
249
250
|
};
|
|
250
251
|
}
|
|
251
|
-
|
|
252
|
+
const owner = direct ? block : connected;
|
|
252
253
|
if (!owner) {
|
|
253
254
|
if (vmBlock.fields && owns(vmBlock.fields, argument))
|
|
254
255
|
return null;
|
|
@@ -292,7 +293,7 @@ function inspectFixedArgument({ ScratchBlocks, block, vmBlock, target, argument,
|
|
|
292
293
|
}
|
|
293
294
|
if (names.length !== 1)
|
|
294
295
|
return unavailable("unsupported", "The menu shadow does not have one standard field.");
|
|
295
|
-
|
|
296
|
+
name = names[0];
|
|
296
297
|
} else
|
|
297
298
|
return unavailable("unsupported", "The shadow field family is unsupported.");
|
|
298
299
|
const field = direct || owner.getField(name);
|
|
@@ -412,7 +413,7 @@ function restoreFixedField(binding) {
|
|
|
412
413
|
|
|
413
414
|
// dist/turbowarp/fixed-transaction.js
|
|
414
415
|
var own2 = (object, name) => {
|
|
415
|
-
const descriptor = object
|
|
416
|
+
const descriptor = object ? Object.getOwnPropertyDescriptor(object, name) : void 0;
|
|
416
417
|
if (!descriptor || !Object.prototype.hasOwnProperty.call(descriptor, "value")) {
|
|
417
418
|
throw new TypeError("Expected an own data property.");
|
|
418
419
|
}
|
|
@@ -430,7 +431,8 @@ var inheritedData = (object, key) => {
|
|
|
430
431
|
return void 0;
|
|
431
432
|
};
|
|
432
433
|
var ensureNativeHistory = (stack) => {
|
|
433
|
-
|
|
434
|
+
var _a;
|
|
435
|
+
if (!Array.isArray(stack) || !Object.isExtensible(stack) || Object.getOwnPropertySymbols(stack).length || !((_a = Object.getOwnPropertyDescriptor(stack, "length")) === null || _a === void 0 ? void 0 : _a.writable)) {
|
|
434
436
|
throw new TypeError("Unsupported undo history.");
|
|
435
437
|
}
|
|
436
438
|
if (Object.getOwnPropertyNames(stack).length !== stack.length + 1)
|
|
@@ -453,13 +455,13 @@ var replaceHistory = (stack, values) => {
|
|
|
453
455
|
for (const value of values)
|
|
454
456
|
Array.prototype.push.call(stack, value);
|
|
455
457
|
};
|
|
456
|
-
|
|
458
|
+
function conflict() {
|
|
457
459
|
throw new BlockEditorConflictError();
|
|
458
|
-
}
|
|
460
|
+
}
|
|
459
461
|
var aborted = Object.getOwnPropertyDescriptor(AbortSignal.prototype, "aborted").get;
|
|
460
462
|
var isAborted = (signal) => aborted.call(signal);
|
|
461
463
|
var optionalOwn = (object, name) => {
|
|
462
|
-
const descriptor = object
|
|
464
|
+
const descriptor = object ? Object.getOwnPropertyDescriptor(object, name) : void 0;
|
|
463
465
|
if (descriptor && !Object.prototype.hasOwnProperty.call(descriptor, "value")) {
|
|
464
466
|
throw new TypeError("VM state must contain data properties.");
|
|
465
467
|
}
|
|
@@ -656,7 +658,7 @@ function createFixedInputPort({ ScratchBlocks, workspace, vm, registry, identify
|
|
|
656
658
|
ensureNativeHistory(redoStack);
|
|
657
659
|
const configuredMaxUndo = inheritedData(workspace, "MAX_UNDO");
|
|
658
660
|
const maxUndo = configuredMaxUndo === void 0 ? Infinity : configuredMaxUndo;
|
|
659
|
-
if (maxUndo !== Infinity && (!Number.isSafeInteger(maxUndo) || maxUndo < 0)) {
|
|
661
|
+
if (typeof maxUndo !== "number" || maxUndo !== Infinity && (!Number.isSafeInteger(maxUndo) || maxUndo < 0)) {
|
|
660
662
|
throw new TypeError("Unsupported undo configuration.");
|
|
661
663
|
}
|
|
662
664
|
const undo = copyHistory(undoStack);
|
|
@@ -711,7 +713,6 @@ function createFixedInputPort({ ScratchBlocks, workspace, vm, registry, identify
|
|
|
711
713
|
const field = fields && fields[edited.fieldName];
|
|
712
714
|
externalWrites.set(edited.field, {
|
|
713
715
|
binding: captureFixedFieldState(edited),
|
|
714
|
-
fields,
|
|
715
716
|
field,
|
|
716
717
|
descriptors: field && Object.getOwnPropertyDescriptors(field)
|
|
717
718
|
});
|
|
@@ -875,7 +876,10 @@ function createFixedInputPort({ ScratchBlocks, workspace, vm, registry, identify
|
|
|
875
876
|
|
|
876
877
|
// dist/turbowarp/host.js
|
|
877
878
|
var owns2 = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
|
|
878
|
-
var createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableDescendants = false, enableFixedInputs = false, onError = console.error }) => {
|
|
879
|
+
var createBlockEditorHost = ({ ScratchBlocks: nativeBlocks, workspace: nativeWorkspace, vm: nativeVM, registry, enableDescendants = false, enableFixedInputs = false, onError = console.error }) => {
|
|
880
|
+
const ScratchBlocks = nativeBlocks;
|
|
881
|
+
const workspace = nativeWorkspace;
|
|
882
|
+
const vm = nativeVM;
|
|
879
883
|
let disposed = false;
|
|
880
884
|
let committing = false;
|
|
881
885
|
let revision = 0;
|
|
@@ -1039,7 +1043,7 @@ var createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableDes
|
|
|
1039
1043
|
let matches = false;
|
|
1040
1044
|
try {
|
|
1041
1045
|
const current = collect(item.reference);
|
|
1042
|
-
matches = current && JSON.stringify(current.snapshot) === JSON.stringify(item.snapshot);
|
|
1046
|
+
matches = current !== null && JSON.stringify(current.snapshot) === JSON.stringify(item.snapshot);
|
|
1043
1047
|
} catch (error) {
|
|
1044
1048
|
}
|
|
1045
1049
|
if (!matches)
|
|
@@ -1066,7 +1070,7 @@ var createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableDes
|
|
|
1066
1070
|
Events.disable();
|
|
1067
1071
|
committing = true;
|
|
1068
1072
|
try {
|
|
1069
|
-
if (signal && signal.aborted)
|
|
1073
|
+
if (!target || signal && signal.aborted)
|
|
1070
1074
|
throw new BlockEditorConflictError();
|
|
1071
1075
|
for (const item of prepared) {
|
|
1072
1076
|
item.field.setValue(item.next);
|
|
@@ -1308,7 +1312,7 @@ var bindBlockEditorIcon = ({ element, label, canOpen, onOpen, onHover = () => {
|
|
|
1308
1312
|
for (const [type, listener] of listeners)
|
|
1309
1313
|
element.removeEventListener(type, listener);
|
|
1310
1314
|
attributes.forEach((name, index) => {
|
|
1311
|
-
if (previous[index]
|
|
1315
|
+
if (previous[index] == null)
|
|
1312
1316
|
element.removeAttribute(name);
|
|
1313
1317
|
else
|
|
1314
1318
|
element.setAttribute(name, previous[index]);
|
|
@@ -1409,7 +1413,10 @@ var openBlockEditorSession = ({ registry, reference, host, descendants }) => {
|
|
|
1409
1413
|
return registry.open(reference, host);
|
|
1410
1414
|
return descendants && supportsDescendantEditing(host) ? registry.openDescendants(reference, host) : registry.open(reference, host);
|
|
1411
1415
|
};
|
|
1412
|
-
var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, canOpen, onOpen, onError, descendants = false, fixedInputs = false }) => {
|
|
1416
|
+
var createBlockEditorBridge = ({ ScratchBlocks: nativeBlocks, workspace: nativeWorkspace, vm: nativeVM, service, label, canOpen, onOpen, onError, descendants = false, fixedInputs = false }) => {
|
|
1417
|
+
const ScratchBlocks = nativeBlocks;
|
|
1418
|
+
const workspace = nativeWorkspace;
|
|
1419
|
+
const vm = nativeVM;
|
|
1413
1420
|
const host = host_default({
|
|
1414
1421
|
ScratchBlocks,
|
|
1415
1422
|
workspace,
|
|
@@ -1433,7 +1440,7 @@ var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, c
|
|
|
1433
1440
|
}
|
|
1434
1441
|
};
|
|
1435
1442
|
let disposed = false;
|
|
1436
|
-
let timer
|
|
1443
|
+
let timer;
|
|
1437
1444
|
let activeSession = null;
|
|
1438
1445
|
let openingSnapshot = null;
|
|
1439
1446
|
let openingFixedDeclaration = null;
|
|
@@ -1442,7 +1449,7 @@ var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, c
|
|
|
1442
1449
|
const session = activeSession;
|
|
1443
1450
|
if (!session)
|
|
1444
1451
|
return;
|
|
1445
|
-
if (typeof session.invalidate === "function") {
|
|
1452
|
+
if ("invalidate" in session && typeof session.invalidate === "function") {
|
|
1446
1453
|
session.invalidate();
|
|
1447
1454
|
return;
|
|
1448
1455
|
}
|
|
@@ -1452,21 +1459,21 @@ var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, c
|
|
|
1452
1459
|
stopWaiting = session.subscribe(() => {
|
|
1453
1460
|
if (session.getState().status === "saving")
|
|
1454
1461
|
return;
|
|
1455
|
-
stopWaiting();
|
|
1462
|
+
stopWaiting === null || stopWaiting === void 0 ? void 0 : stopWaiting();
|
|
1456
1463
|
stopWaiting = null;
|
|
1457
1464
|
session.dispose();
|
|
1458
1465
|
});
|
|
1459
1466
|
}
|
|
1460
1467
|
};
|
|
1461
1468
|
const checkSession = () => {
|
|
1462
|
-
var _a;
|
|
1469
|
+
var _a, _b;
|
|
1463
1470
|
if (host.isCommitting())
|
|
1464
1471
|
return;
|
|
1465
1472
|
if (!activeSession || !openingSnapshot || !["editing", "saving"].includes(activeSession.getState().status))
|
|
1466
1473
|
return;
|
|
1467
|
-
const current =
|
|
1474
|
+
const current = "getNodes" in activeSession ? host.descendants.readSubtree(activeSession.reference) : host.readBlock(activeSession.reference);
|
|
1468
1475
|
if (openingFixedDeclaration) {
|
|
1469
|
-
if (!current || ((_a = current.fixedContext) === null || _a === void 0 ? void 0 : _a.generation) !== openingSnapshot.fixedContext.generation || fixedDeclaration(service.registry, current) !== openingFixedDeclaration)
|
|
1476
|
+
if (!current || (!("fixedContext" in current) || !("fixedContext" in openingSnapshot) || ((_a = current.fixedContext) === null || _a === void 0 ? void 0 : _a.generation) !== ((_b = openingSnapshot.fixedContext) === null || _b === void 0 ? void 0 : _b.generation)) || fixedDeclaration(service.registry, "opcode" in current ? current : null) !== openingFixedDeclaration)
|
|
1470
1477
|
endSession();
|
|
1471
1478
|
return;
|
|
1472
1479
|
}
|
|
@@ -1479,7 +1486,7 @@ var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, c
|
|
|
1479
1486
|
const snapshot = host.readBlock({ targetId: vm.editingTarget.id, blockId: block.id });
|
|
1480
1487
|
if (fixedDeclaration(service.registry, snapshot))
|
|
1481
1488
|
return supportsFixedInputEditing(host);
|
|
1482
|
-
return snapshot && Object.values(snapshot.arguments).every((slot) => slot.kind === "literal");
|
|
1489
|
+
return snapshot !== null && Object.values(snapshot.arguments).every((slot) => slot.kind === "literal");
|
|
1483
1490
|
};
|
|
1484
1491
|
const open = (block) => {
|
|
1485
1492
|
var _a, _b;
|
|
@@ -1494,14 +1501,14 @@ var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, c
|
|
|
1494
1501
|
if (session) {
|
|
1495
1502
|
ScratchBlocks.hideChaff();
|
|
1496
1503
|
activeSession = session;
|
|
1497
|
-
openingSnapshot =
|
|
1498
|
-
openingFixedDeclaration = fixedDeclaration(service.registry, openingSnapshot) || null;
|
|
1504
|
+
openingSnapshot = "getNodes" in session ? host.descendants.readSubtree(session.reference) : host.readBlock(session.reference);
|
|
1505
|
+
openingFixedDeclaration = fixedDeclaration(service.registry, openingSnapshot && "opcode" in openingSnapshot ? openingSnapshot : null) || null;
|
|
1499
1506
|
const labels = {};
|
|
1500
1507
|
const appearances = /* @__PURE__ */ Object.create(null);
|
|
1501
1508
|
const rootAppearance = appearance_default(block, ScratchBlocks, (_a = service.registry.resolve(block.type)) === null || _a === void 0 ? void 0 : _a.editableArguments);
|
|
1502
1509
|
appearances[reference.blockId] = rootAppearance;
|
|
1503
1510
|
labels[reference.blockId] = rootAppearance.name || block.type;
|
|
1504
|
-
if (
|
|
1511
|
+
if ("getNodes" in session) {
|
|
1505
1512
|
for (const node of session.getNodes()) {
|
|
1506
1513
|
const source = workspace.getBlockById(node.reference.blockId);
|
|
1507
1514
|
const appearance = appearance_default(source, ScratchBlocks, (_b = service.registry.resolve(node.opcode)) === null || _b === void 0 ? void 0 : _b.editableArguments);
|
|
@@ -1586,11 +1593,11 @@ var createBlockEditorBridge = ({ ScratchBlocks, workspace, vm, service, label, c
|
|
|
1586
1593
|
};
|
|
1587
1594
|
const unregister = service.subscribe(() => {
|
|
1588
1595
|
if (openingFixedDeclaration && activeSession) {
|
|
1589
|
-
if (service.registry.resolveFixed(openingSnapshot.opcode) !== openingFixedDeclaration) {
|
|
1596
|
+
if (openingSnapshot && "opcode" in openingSnapshot && service.registry.resolveFixed(openingSnapshot.opcode) !== openingFixedDeclaration) {
|
|
1590
1597
|
host.invalidate();
|
|
1591
1598
|
endSession();
|
|
1592
1599
|
}
|
|
1593
|
-
} else if (!activeSession ||
|
|
1600
|
+
} else if (!activeSession || !("getNodes" in activeSession)) {
|
|
1594
1601
|
host.invalidate();
|
|
1595
1602
|
endSession();
|
|
1596
1603
|
}
|