@kubohiroya/turbowarp-extension-data-editor 0.8.0 → 0.8.2
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.ja.md +2 -1
- package/README.md +2 -1
- package/dist/build-info.json +3 -3
- package/dist/form-presentation.d.ts +1 -1
- package/dist/form-presentation.js +2 -0
- package/dist/react.js +3 -0
- 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/metafile.json +22 -22
- package/dist/webpack4/react.js +1 -0
- package/dist/webpack4/react.js.map +2 -2
- package/dist/webpack4/rjsf.js +2 -0
- package/dist/webpack4/rjsf.js.map +2 -2
- 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
|
@@ -4,7 +4,7 @@ import { initializeFixedFields, inspectFixedArgument, prepareFixedChange, restor
|
|
|
4
4
|
import { snapshotJson } from '../schema-json.js';
|
|
5
5
|
import { validateFixedBranchChanges } from '../fixed-input-branches.js';
|
|
6
6
|
const own = (object, name) => {
|
|
7
|
-
const descriptor = object
|
|
7
|
+
const descriptor = object ? Object.getOwnPropertyDescriptor(object, name) : undefined;
|
|
8
8
|
if (!descriptor || !Object.prototype.hasOwnProperty.call(descriptor, 'value')) {
|
|
9
9
|
throw new TypeError('Expected an own data property.');
|
|
10
10
|
}
|
|
@@ -21,9 +21,10 @@ const inheritedData = (object, key) => {
|
|
|
21
21
|
}
|
|
22
22
|
return undefined;
|
|
23
23
|
};
|
|
24
|
-
const ensureNativeHistory = stack => {
|
|
24
|
+
const ensureNativeHistory = (stack) => {
|
|
25
|
+
var _a;
|
|
25
26
|
if (!Array.isArray(stack) || !Object.isExtensible(stack) ||
|
|
26
|
-
Object.getOwnPropertySymbols(stack).length || !Object.getOwnPropertyDescriptor(stack, 'length').writable) {
|
|
27
|
+
Object.getOwnPropertySymbols(stack).length || !((_a = Object.getOwnPropertyDescriptor(stack, 'length')) === null || _a === void 0 ? void 0 : _a.writable)) {
|
|
27
28
|
throw new TypeError('Unsupported undo history.');
|
|
28
29
|
}
|
|
29
30
|
if (Object.getOwnPropertyNames(stack).length !== stack.length + 1)
|
|
@@ -35,7 +36,7 @@ const ensureNativeHistory = stack => {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
const copyHistory = stack => {
|
|
39
|
+
const copyHistory = (stack) => {
|
|
39
40
|
const copy = [];
|
|
40
41
|
for (let index = 0; index < stack.length; index++)
|
|
41
42
|
copy.push(own(stack, String(index)));
|
|
@@ -46,11 +47,11 @@ const replaceHistory = (stack, values) => {
|
|
|
46
47
|
for (const value of values)
|
|
47
48
|
Array.prototype.push.call(stack, value);
|
|
48
49
|
};
|
|
49
|
-
|
|
50
|
+
function conflict() { throw new BlockEditorConflictError(); }
|
|
50
51
|
const aborted = Object.getOwnPropertyDescriptor(AbortSignal.prototype, 'aborted').get;
|
|
51
|
-
const isAborted = signal => aborted.call(signal);
|
|
52
|
+
const isAborted = (signal) => aborted.call(signal);
|
|
52
53
|
const optionalOwn = (object, name) => {
|
|
53
|
-
const descriptor = object
|
|
54
|
+
const descriptor = object ? Object.getOwnPropertyDescriptor(object, name) : undefined;
|
|
54
55
|
if (descriptor && !Object.prototype.hasOwnProperty.call(descriptor, 'value')) {
|
|
55
56
|
throw new TypeError('VM state must contain data properties.');
|
|
56
57
|
}
|
|
@@ -79,7 +80,7 @@ const untouchedState = (block, vmBlock, target, bindings, identify) => {
|
|
|
79
80
|
}
|
|
80
81
|
const seen = new Set();
|
|
81
82
|
const records = [];
|
|
82
|
-
const capture = item => {
|
|
83
|
+
const capture = (item) => {
|
|
83
84
|
if (!item || seen.has(item))
|
|
84
85
|
return;
|
|
85
86
|
seen.add(item);
|
|
@@ -112,8 +113,7 @@ const untouchedState = (block, vmBlock, target, bindings, identify) => {
|
|
|
112
113
|
});
|
|
113
114
|
return JSON.stringify([records, connections, statementConnections]);
|
|
114
115
|
};
|
|
115
|
-
const sameDeclaration = (left, right) => JSON.stringify(captureFixedInputDeclaration(left)) ===
|
|
116
|
-
JSON.stringify(captureFixedInputDeclaration(right));
|
|
116
|
+
const sameDeclaration = (left, right) => JSON.stringify(captureFixedInputDeclaration(left)) === JSON.stringify(captureFixedInputDeclaration(right));
|
|
117
117
|
// Fixed inputs deliberately use a separate transaction from the legacy TEXT adapter.
|
|
118
118
|
export default function createFixedInputPort({ ScratchBlocks, workspace, vm, registry, identify, getState, begin, markEvent, finish, onError, subscribeScope }) {
|
|
119
119
|
initializeFixedFields(ScratchBlocks);
|
|
@@ -162,7 +162,7 @@ export default function createFixedInputPort({ ScratchBlocks, workspace, vm, reg
|
|
|
162
162
|
} }, reference, declaration);
|
|
163
163
|
return { snapshot, bindings, declaration, target, block, vmBlock, state, untouched, runtime: vm.runtime };
|
|
164
164
|
};
|
|
165
|
-
const commit = request => {
|
|
165
|
+
const commit = (request) => {
|
|
166
166
|
var _a;
|
|
167
167
|
const expectedInput = own(request, 'expected');
|
|
168
168
|
const changesInput = own(request, 'changes');
|
|
@@ -238,7 +238,7 @@ export default function createFixedInputPort({ ScratchBlocks, workspace, vm, reg
|
|
|
238
238
|
ensureNativeHistory(redoStack);
|
|
239
239
|
const configuredMaxUndo = inheritedData(workspace, 'MAX_UNDO');
|
|
240
240
|
const maxUndo = configuredMaxUndo === undefined ? Infinity : configuredMaxUndo;
|
|
241
|
-
if (maxUndo !== Infinity && (!Number.isSafeInteger(maxUndo) || maxUndo < 0)) {
|
|
241
|
+
if (typeof maxUndo !== 'number' || (maxUndo !== Infinity && (!Number.isSafeInteger(maxUndo) || maxUndo < 0))) {
|
|
242
242
|
throw new TypeError('Unsupported undo configuration.');
|
|
243
243
|
}
|
|
244
244
|
const undo = copyHistory(undoStack);
|
|
@@ -290,7 +290,7 @@ export default function createFixedInputPort({ ScratchBlocks, workspace, vm, reg
|
|
|
290
290
|
const fields = edited.vmBlock.fields;
|
|
291
291
|
const field = fields && fields[edited.fieldName];
|
|
292
292
|
externalWrites.set(edited.field, { binding: captureFixedFieldState(edited),
|
|
293
|
-
|
|
293
|
+
field, descriptors: field && Object.getOwnPropertyDescriptors(field) });
|
|
294
294
|
}
|
|
295
295
|
activeEvent = previous;
|
|
296
296
|
}
|
package/dist/turbowarp/host.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
+
import type { TurboWarpHostOptions, TurboWarpBlockEditorHost } from '../turbowarp.js';
|
|
2
|
+
declare const createBlockEditorHost: ({ ScratchBlocks: nativeBlocks, workspace: nativeWorkspace, vm: nativeVM, registry, enableDescendants, enableFixedInputs, onError }: TurboWarpHostOptions) => TurboWarpBlockEditorHost;
|
|
1
3
|
export default createBlockEditorHost;
|
|
2
|
-
declare function createBlockEditorHost({ ScratchBlocks, workspace, vm, registry, enableDescendants, enableFixedInputs, onError }: {
|
|
3
|
-
ScratchBlocks: any;
|
|
4
|
-
workspace: any;
|
|
5
|
-
vm: any;
|
|
6
|
-
registry: any;
|
|
7
|
-
enableDescendants?: boolean | undefined;
|
|
8
|
-
enableFixedInputs?: boolean | undefined;
|
|
9
|
-
onError?: ((...data: any[]) => void) | undefined;
|
|
10
|
-
}): {
|
|
11
|
-
isCommitting: () => boolean;
|
|
12
|
-
readBlock: (reference: any) => any;
|
|
13
|
-
commit: ({ expected, changes }: {
|
|
14
|
-
expected: any;
|
|
15
|
-
changes: any;
|
|
16
|
-
}) => void;
|
|
17
|
-
invalidate: () => void;
|
|
18
|
-
dispose: () => void;
|
|
19
|
-
};
|
package/dist/turbowarp/host.js
CHANGED
|
@@ -3,7 +3,10 @@ import collectBlockEditorSubtree from './subtree.js';
|
|
|
3
3
|
import createFixedInputPort from './fixed-transaction.js';
|
|
4
4
|
const owns = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
|
|
5
5
|
// Adapt only standard, unvalidated text shadows; never evaluate connected reporters.
|
|
6
|
-
const createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableDescendants = false, enableFixedInputs = false, onError = console.error }) => {
|
|
6
|
+
const createBlockEditorHost = ({ ScratchBlocks: nativeBlocks, workspace: nativeWorkspace, vm: nativeVM, registry, enableDescendants = false, enableFixedInputs = false, onError = console.error }) => {
|
|
7
|
+
const ScratchBlocks = nativeBlocks;
|
|
8
|
+
const workspace = nativeWorkspace;
|
|
9
|
+
const vm = nativeVM;
|
|
7
10
|
let disposed = false;
|
|
8
11
|
let committing = false;
|
|
9
12
|
let revision = 0;
|
|
@@ -30,12 +33,12 @@ const createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableD
|
|
|
30
33
|
};
|
|
31
34
|
let notifyInvalidations = () => { };
|
|
32
35
|
const identities = new WeakMap();
|
|
33
|
-
const identify = object => {
|
|
36
|
+
const identify = (object) => {
|
|
34
37
|
if (!identities.has(object))
|
|
35
38
|
identities.set(object, ++identity);
|
|
36
39
|
return identities.get(object);
|
|
37
40
|
};
|
|
38
|
-
const invalidate = event => {
|
|
41
|
+
const invalidate = (event) => {
|
|
39
42
|
if (event && event.isUiEvent)
|
|
40
43
|
return;
|
|
41
44
|
revision++;
|
|
@@ -163,7 +166,7 @@ const createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableD
|
|
|
163
166
|
vmBlock
|
|
164
167
|
};
|
|
165
168
|
};
|
|
166
|
-
const collect = reference => collectBlockEditorSubtree({ ScratchBlocks, reference, inspect, generation });
|
|
169
|
+
const collect = (reference) => collectBlockEditorSubtree({ ScratchBlocks, reference, inspect, generation });
|
|
167
170
|
notifyInvalidations = () => {
|
|
168
171
|
if (committing)
|
|
169
172
|
return;
|
|
@@ -171,7 +174,7 @@ const createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableD
|
|
|
171
174
|
let matches = false;
|
|
172
175
|
try {
|
|
173
176
|
const current = collect(item.reference);
|
|
174
|
-
matches = current && JSON.stringify(current.snapshot) === JSON.stringify(item.snapshot);
|
|
177
|
+
matches = current !== null && JSON.stringify(current.snapshot) === JSON.stringify(item.snapshot);
|
|
175
178
|
}
|
|
176
179
|
catch (error) {
|
|
177
180
|
// A malformed replacement graph invalidates an already open session too.
|
|
@@ -201,7 +204,7 @@ const createBlockEditorHost = ({ ScratchBlocks, workspace, vm, registry, enableD
|
|
|
201
204
|
Events.disable();
|
|
202
205
|
committing = true;
|
|
203
206
|
try {
|
|
204
|
-
if (signal && signal.aborted)
|
|
207
|
+
if (!target || (signal && signal.aborted))
|
|
205
208
|
throw new BlockEditorConflictError();
|
|
206
209
|
for (const item of prepared) {
|
|
207
210
|
item.field.setValue(item.next);
|
package/dist/turbowarp/icon.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
+
declare const bindBlockEditorIcon: ({ element, label, canOpen, onOpen, onHover, onLeave }: Parameters<typeof import("../turbowarp.js").bindBlockEditorIcon>[0]) => () => void;
|
|
1
2
|
export default bindBlockEditorIcon;
|
|
2
|
-
declare function bindBlockEditorIcon({ element, label, canOpen, onOpen, onHover, onLeave }: {
|
|
3
|
-
element: any;
|
|
4
|
-
label: any;
|
|
5
|
-
canOpen: any;
|
|
6
|
-
onOpen: any;
|
|
7
|
-
onHover?: (() => void) | undefined;
|
|
8
|
-
onLeave?: (() => void) | undefined;
|
|
9
|
-
}): () => void;
|
package/dist/turbowarp/icon.js
CHANGED
|
@@ -4,13 +4,13 @@ const bindBlockEditorIcon = ({ element, label, canOpen, onOpen, onHover = () =>
|
|
|
4
4
|
const previous = attributes.map(name => element.getAttribute(name));
|
|
5
5
|
const oldCursor = element.style.cursor;
|
|
6
6
|
let press = null;
|
|
7
|
-
const stop = event => {
|
|
7
|
+
const stop = (event) => {
|
|
8
8
|
if (!canOpen())
|
|
9
9
|
return;
|
|
10
10
|
event.stopPropagation();
|
|
11
11
|
event.preventDefault();
|
|
12
12
|
};
|
|
13
|
-
const down = event => {
|
|
13
|
+
const down = (event) => {
|
|
14
14
|
if (!canOpen() || event.button !== 0 || event.isPrimary === false)
|
|
15
15
|
return;
|
|
16
16
|
stop(event);
|
|
@@ -19,14 +19,14 @@ const bindBlockEditorIcon = ({ element, label, canOpen, onOpen, onHover = () =>
|
|
|
19
19
|
if (element.setPointerCapture)
|
|
20
20
|
element.setPointerCapture(event.pointerId);
|
|
21
21
|
};
|
|
22
|
-
const move = event => {
|
|
22
|
+
const move = (event) => {
|
|
23
23
|
if (!press || press.id !== event.pointerId)
|
|
24
24
|
return;
|
|
25
25
|
stop(event);
|
|
26
26
|
if (Math.hypot(event.clientX - press.x, event.clientY - press.y) > 4)
|
|
27
27
|
press.moved = true;
|
|
28
28
|
};
|
|
29
|
-
const up = event => {
|
|
29
|
+
const up = (event) => {
|
|
30
30
|
if (!press || press.id !== event.pointerId)
|
|
31
31
|
return;
|
|
32
32
|
move(event);
|
|
@@ -41,7 +41,7 @@ const bindBlockEditorIcon = ({ element, label, canOpen, onOpen, onHover = () =>
|
|
|
41
41
|
const cancel = () => {
|
|
42
42
|
press = null;
|
|
43
43
|
};
|
|
44
|
-
const key = event => {
|
|
44
|
+
const key = (event) => {
|
|
45
45
|
if ((event.key === 'Enter' || event.key === ' ') && canOpen()) {
|
|
46
46
|
stop(event);
|
|
47
47
|
if (!event.repeat)
|
|
@@ -68,7 +68,7 @@ const bindBlockEditorIcon = ({ element, label, canOpen, onOpen, onHover = () =>
|
|
|
68
68
|
for (const [type, listener] of listeners)
|
|
69
69
|
element.removeEventListener(type, listener);
|
|
70
70
|
attributes.forEach((name, index) => {
|
|
71
|
-
if (previous[index]
|
|
71
|
+
if (previous[index] == null)
|
|
72
72
|
element.removeAttribute(name);
|
|
73
73
|
else
|
|
74
74
|
element.setAttribute(name, previous[index]);
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { BlockSnapshot } from '../types.js';
|
|
2
|
+
export interface NativeField {
|
|
3
|
+
name?: string;
|
|
4
|
+
getValue(): unknown;
|
|
5
|
+
getText(): string;
|
|
6
|
+
setValue(value: string): void;
|
|
7
|
+
getValidator(): unknown;
|
|
8
|
+
}
|
|
9
|
+
interface ImageField extends NativeField {
|
|
10
|
+
fieldGroup_: SVGElement;
|
|
11
|
+
imageElement_: {
|
|
12
|
+
tooltip: unknown;
|
|
13
|
+
};
|
|
14
|
+
setTooltip(label: string): void;
|
|
15
|
+
}
|
|
16
|
+
export interface NativeFieldClass {
|
|
17
|
+
new (...args: never[]): NativeField;
|
|
18
|
+
prototype: NativeField;
|
|
19
|
+
}
|
|
20
|
+
interface Connection {
|
|
21
|
+
targetConnection: Connection | null;
|
|
22
|
+
targetBlock(): NativeBlock | null;
|
|
23
|
+
}
|
|
24
|
+
export interface NativeBlock {
|
|
25
|
+
id: string;
|
|
26
|
+
type: string;
|
|
27
|
+
isInFlyout?: boolean;
|
|
28
|
+
inputList: Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
type: number;
|
|
31
|
+
fieldRow: NativeField[];
|
|
32
|
+
connection: Connection | null;
|
|
33
|
+
}>;
|
|
34
|
+
previousConnection: Connection | null;
|
|
35
|
+
nextConnection: Connection | null;
|
|
36
|
+
outputConnection: Connection | null;
|
|
37
|
+
isShadow(): boolean;
|
|
38
|
+
isEditable(): boolean;
|
|
39
|
+
getInput(name: string): NativeBlock['inputList'][number] | null;
|
|
40
|
+
getField(name: string): NativeField | null;
|
|
41
|
+
getParent(): NativeBlock | null;
|
|
42
|
+
getNextBlock(): NativeBlock | null;
|
|
43
|
+
getColour(): unknown;
|
|
44
|
+
getColourSecondary(): unknown;
|
|
45
|
+
getColourTertiary(): unknown;
|
|
46
|
+
getColourQuaternary(): unknown;
|
|
47
|
+
setColour(...colors: string[]): void;
|
|
48
|
+
}
|
|
49
|
+
export interface NativeChange {
|
|
50
|
+
type: string;
|
|
51
|
+
element?: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
blockId?: string;
|
|
54
|
+
ids?: string[];
|
|
55
|
+
isUiEvent?: boolean;
|
|
56
|
+
oldValue?: unknown;
|
|
57
|
+
recordUndo: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface NativeScratchBlocks {
|
|
60
|
+
INPUT_VALUE: number;
|
|
61
|
+
NEXT_STATEMENT: number;
|
|
62
|
+
FieldImage: new (...args: never[]) => ImageField;
|
|
63
|
+
FieldTextInput: NativeFieldClass;
|
|
64
|
+
FieldNumber: NativeFieldClass;
|
|
65
|
+
FieldDropdown: NativeFieldClass;
|
|
66
|
+
FieldColourSlider: NativeFieldClass;
|
|
67
|
+
hideChaff(): void;
|
|
68
|
+
Events: {
|
|
69
|
+
Change: new (block: NativeBlock, element: string, name: string, before: string, after: string) => NativeChange;
|
|
70
|
+
recordUndo: boolean;
|
|
71
|
+
isEnabled(): boolean;
|
|
72
|
+
getGroup(): string | boolean;
|
|
73
|
+
setGroup(group: string | boolean): void;
|
|
74
|
+
disable(): void;
|
|
75
|
+
enable(): void;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface NativeWorkspace {
|
|
79
|
+
isFlyout?: boolean;
|
|
80
|
+
options: {
|
|
81
|
+
readOnly?: boolean;
|
|
82
|
+
};
|
|
83
|
+
isDragging?(): boolean;
|
|
84
|
+
getBlockById(id: string): NativeBlock | null;
|
|
85
|
+
getAllBlocks(ordered: boolean): NativeBlock[];
|
|
86
|
+
addChangeListener(listener: (event: NativeChange) => void): void;
|
|
87
|
+
removeChangeListener(listener: (event: NativeChange) => void): void;
|
|
88
|
+
undoStack_: NativeChange[];
|
|
89
|
+
redoStack_: NativeChange[];
|
|
90
|
+
fireChangeListener(event: NativeChange): void;
|
|
91
|
+
}
|
|
92
|
+
export interface VMField {
|
|
93
|
+
[name: string]: unknown;
|
|
94
|
+
id?: string;
|
|
95
|
+
value: unknown;
|
|
96
|
+
}
|
|
97
|
+
export interface VMBlock {
|
|
98
|
+
opcode: string;
|
|
99
|
+
parent?: string | null;
|
|
100
|
+
next?: string | null;
|
|
101
|
+
fields: Record<string, VMField>;
|
|
102
|
+
inputs: Record<string, {
|
|
103
|
+
block?: string;
|
|
104
|
+
shadow?: string;
|
|
105
|
+
}>;
|
|
106
|
+
mutation?: unknown;
|
|
107
|
+
}
|
|
108
|
+
export interface NativeTarget {
|
|
109
|
+
id: string;
|
|
110
|
+
blocks: {
|
|
111
|
+
getBlock(id: string): VMBlock | null;
|
|
112
|
+
blocklyListen(event: NativeChange): void;
|
|
113
|
+
resetCache?(): void;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export interface NativeVM {
|
|
117
|
+
editingTarget: NativeTarget | null;
|
|
118
|
+
runtime: {
|
|
119
|
+
emitProjectChanged(): void;
|
|
120
|
+
};
|
|
121
|
+
on(name: string, listener: () => void): void;
|
|
122
|
+
removeListener(name: string, listener: () => void): void;
|
|
123
|
+
}
|
|
124
|
+
export interface TextBinding {
|
|
125
|
+
shadow: NativeBlock;
|
|
126
|
+
field: NativeField;
|
|
127
|
+
value: string;
|
|
128
|
+
}
|
|
129
|
+
export interface BlockRecord {
|
|
130
|
+
block: NativeBlock;
|
|
131
|
+
vmBlock: VMBlock;
|
|
132
|
+
fields: Map<string, TextBinding>;
|
|
133
|
+
snapshot: BlockSnapshot;
|
|
134
|
+
}
|
|
135
|
+
export type Identify = (value: object) => number;
|
|
136
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { SubtreeSnapshot } from '../descendant-types.js';
|
|
2
|
+
import type { BlockReference } from '../types.js';
|
|
3
|
+
import type { BlockRecord, NativeScratchBlocks } from './native-types.js';
|
|
4
|
+
declare const collectBlockEditorSubtree: ({ ScratchBlocks, reference, inspect, generation }: {
|
|
5
|
+
ScratchBlocks: NativeScratchBlocks;
|
|
6
|
+
reference: BlockReference;
|
|
7
|
+
inspect(reference: BlockReference, structural: boolean): BlockRecord | null;
|
|
8
|
+
generation: number;
|
|
9
|
+
}) => {
|
|
10
|
+
snapshot: SubtreeSnapshot;
|
|
11
|
+
records: Map<string, BlockRecord>;
|
|
10
12
|
} | null;
|
|
13
|
+
export default collectBlockEditorSubtree;
|
|
@@ -4,9 +4,10 @@ const collectBlockEditorSubtree = ({ ScratchBlocks, reference, inspect, generati
|
|
|
4
4
|
const nodes = [];
|
|
5
5
|
const records = new Map();
|
|
6
6
|
const pending = {};
|
|
7
|
-
|
|
7
|
+
function invalid(message) {
|
|
8
8
|
throw new BlockEditorStructureError(message, 'invalid-structure');
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
;
|
|
10
11
|
const visit = (id, depth) => {
|
|
11
12
|
if (records.has(id)) {
|
|
12
13
|
throw new BlockEditorStructureError('A statement block is connected more than once.', 'cycle');
|
|
@@ -2098,7 +2098,7 @@
|
|
|
2098
2098
|
"format": "esm"
|
|
2099
2099
|
},
|
|
2100
2100
|
"dist/form-presentation.js": {
|
|
2101
|
-
"bytes":
|
|
2101
|
+
"bytes": 8114,
|
|
2102
2102
|
"imports": [
|
|
2103
2103
|
{
|
|
2104
2104
|
"path": "react",
|
|
@@ -14186,7 +14186,7 @@
|
|
|
14186
14186
|
"format": "esm"
|
|
14187
14187
|
},
|
|
14188
14188
|
"dist/react.js": {
|
|
14189
|
-
"bytes":
|
|
14189
|
+
"bytes": 15083,
|
|
14190
14190
|
"imports": [
|
|
14191
14191
|
{
|
|
14192
14192
|
"path": "dist/field-errors.js",
|
|
@@ -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",
|
|
@@ -14425,7 +14425,7 @@
|
|
|
14425
14425
|
"imports": [],
|
|
14426
14426
|
"exports": [],
|
|
14427
14427
|
"inputs": {},
|
|
14428
|
-
"bytes":
|
|
14428
|
+
"bytes": 1929924
|
|
14429
14429
|
},
|
|
14430
14430
|
"dist/webpack4/rjsf.js": {
|
|
14431
14431
|
"imports": [
|
|
@@ -15512,7 +15512,7 @@
|
|
|
15512
15512
|
"bytesInOutput": 7705
|
|
15513
15513
|
},
|
|
15514
15514
|
"dist/form-presentation.js": {
|
|
15515
|
-
"bytesInOutput":
|
|
15515
|
+
"bytesInOutput": 7889
|
|
15516
15516
|
},
|
|
15517
15517
|
"dist/layout.js": {
|
|
15518
15518
|
"bytesInOutput": 2839
|
|
@@ -16829,13 +16829,13 @@
|
|
|
16829
16829
|
"bytesInOutput": 11025
|
|
16830
16830
|
}
|
|
16831
16831
|
},
|
|
16832
|
-
"bytes":
|
|
16832
|
+
"bytes": 897850
|
|
16833
16833
|
},
|
|
16834
16834
|
"dist/webpack4/react.js.map": {
|
|
16835
16835
|
"imports": [],
|
|
16836
16836
|
"exports": [],
|
|
16837
16837
|
"inputs": {},
|
|
16838
|
-
"bytes":
|
|
16838
|
+
"bytes": 44147
|
|
16839
16839
|
},
|
|
16840
16840
|
"dist/webpack4/react.js": {
|
|
16841
16841
|
"imports": [
|
|
@@ -16866,16 +16866,16 @@
|
|
|
16866
16866
|
"bytesInOutput": 6802
|
|
16867
16867
|
},
|
|
16868
16868
|
"dist/react.js": {
|
|
16869
|
-
"bytesInOutput":
|
|
16869
|
+
"bytesInOutput": 13448
|
|
16870
16870
|
}
|
|
16871
16871
|
},
|
|
16872
|
-
"bytes":
|
|
16872
|
+
"bytes": 24335
|
|
16873
16873
|
},
|
|
16874
16874
|
"dist/webpack4/turbowarp.js.map": {
|
|
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": [],
|
package/dist/webpack4/react.js
CHANGED
|
@@ -472,6 +472,7 @@ var BlockEditorDialog = class extends React.Component {
|
|
|
472
472
|
this.stopFieldErrors = field_errors_default(this.body);
|
|
473
473
|
if (typeof this.props.session.getNodes !== "function")
|
|
474
474
|
this.unmountBody = this.props.session.mount(this.body);
|
|
475
|
+
this.setState(this.props.session.getState());
|
|
475
476
|
this.focusFrame = requestAnimationFrame(() => {
|
|
476
477
|
if (!this.mounted)
|
|
477
478
|
return;
|