@kubohiroya/turbowarp-plus-editor-code-views 0.22.0 → 0.22.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 +13 -1
- package/README.md +10 -0
- package/dist/code-popout.js +1 -0
- package/dist/horizontal-block-palette.js +18 -0
- package/dist/script-arrows.js +9 -41
- package/dist/script-layout-view.d.ts +3 -1
- package/dist/script-layout-view.js +19 -4
- package/dist/semantic-layout-dialog.d.ts +12 -0
- package/dist/semantic-layout-dialog.js +251 -0
- package/dist/semantic-layout-workspace.d.ts +57 -0
- package/dist/semantic-layout-workspace.js +87 -0
- package/dist/semantic-script-layout.d.ts +34 -0
- package/dist/semantic-script-layout.js +271 -0
- package/package.json +4 -2
- package/src/code-popout.tsx +2 -0
- package/src/horizontal-block-palette.ts +15 -0
- package/src/script-arrows.ts +10 -43
- package/src/script-layout-view.ts +19 -4
- package/src/semantic-layout-dialog.ts +222 -0
- package/src/semantic-layout-workspace.ts +109 -0
- package/src/semantic-script-layout.ts +254 -0
- package/src/styles.css +5 -19
package/README.ja.md
CHANGED
|
@@ -16,6 +16,18 @@ Z/N配置内の矢印は、スクリプト群の右外側へ96px以上張り
|
|
|
16
16
|
|
|
17
17
|
これらの変更の切り戻しは、本変更を revert して再ビルドする。ホストのパッケージ固定を以前の版へ戻す場合は、機能移管で追加された API との互換性も確認する。自由配置へ切り替えるだけでも元の配置を表示できる。折りたたみは既存の作品内フラグを使用するため、「折りたたみをすべて解除」で解除できる。
|
|
18
18
|
|
|
19
|
+
## 関係に基づく再配置(Editor #727)
|
|
20
|
+
|
|
21
|
+
自由配置の背景を右クリックし「スクリプトを意味に応じて再配置する」を選ぶと、現在のスプライト/ステージの再配置をプレビューする。「再配置する」で確定し、取消では作品を変更しない。Undo/Redo各1回で座標と付属コメントを戻せる。別窓では編集権を持つ画面だけで実行でき、他スプライトの座標は動かさない。
|
|
22
|
+
|
|
23
|
+
既存の静的関係解析を再利用し、再帰・循環を強連結成分へまとめたDAGの最長経路で列を割り当て、重心法による4回の走査で列内の交差を減らす。関係のない群は別の帯に置く。今回必要な列・循環・群の制約を小さな純粋計算として検証できるため、ELKの追加導入は行わない。名前付き関数を含む関数呼び出し、通常の送信と送って待つを扱い、動的・未解決の名前には接続先を推測しない。外部接続と未解決の関係はプレビューで区別する。静的関係は実行順序を保証しない。
|
|
24
|
+
|
|
25
|
+
Matter.js 0.20.0(MIT)で、重力と回転を無効にしたコメント込みの矩形を目標位置へ引き寄せる。固定ステップとID順を使い、120ステップまたは速度の収束で終了する。8ステップごとにイベントループへ処理を戻し、取消や画面破棄で中止する。その後、列と順序を保つ決定的な間隔調整を行い、独立コメントとの衝突とスクリプト同士の重なりを検査する。上限は1000スクリプト・10000関係・1000独立コメント。上限超過や測定失敗では適用せず、元の配置を保つ。プレビュー中の対象・内容・座標・コメントの変更は確定を拒否し、「再計算する」で作り直せる。
|
|
26
|
+
|
|
27
|
+
メニュー・プレビュー・移動処理は本パッケージが所有する。ホストは従来の `attachDockedScriptLayout` の接続を使用し、新しいGUI差分や起動フラグは不要。独自の編集可能ワークスペースで `attachScriptView` を使う場合は、`semanticLayout: {events, canArrange}` と `relations` を渡す。読み取り専用画面では渡さない。
|
|
28
|
+
|
|
29
|
+
限定検証: `npm run build`、`node --test test/semantic-script-layout.test.ts test/script-relations.test.ts`、`node --test test/semantic-layout.browser.ts`。ブラウザー検証はヘッドレスで行う。配布を切り戻す場合は本変更とホストの依存固定を導入前へ戻す。保存形式・専用メタデータの追加はなく、保存済みの座標は通常の作品データとして残る。
|
|
30
|
+
|
|
19
31
|
## 入口
|
|
20
32
|
|
|
21
33
|
| import | 内容 |
|
|
@@ -57,7 +69,7 @@ Editor は GUI の React 16 にこれらを描画するので、React 16.14 以
|
|
|
57
69
|
|
|
58
70
|
## スクリプト間の矢印
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
コードの背面に、関数呼び出しを紫系の実線、メッセージ送信を橙系の破線で表示する。「送って待つ」は線7・間隔5の破線、「送る」はその半分の線3.5・間隔2.5の細かい破線で区別し、砂時計アイコンは表示しない。通常配置、Z/N 配置、折り畳み、プレビュー、別窓で同じ表現を使う。関数の再帰はスクリプトの外へ回る線で示す。選択・ホバーによる強調は太さと不透明度で行い、関係種別の色・線種は変えない。
|
|
61
73
|
|
|
62
74
|
関数呼び出しとメッセージ送受信は、常に呼び出し元・送信元の右から出て、呼び出し先・受信先の左へ入る。左右の配置が逆でも接続する側を入れ替えない。自己呼び出しもスクリプトの外を回って左側へ戻る。
|
|
63
75
|
|
package/README.md
CHANGED
|
@@ -10,6 +10,16 @@ Opening a function or hat adjusts the zoom to its rendered script and places the
|
|
|
10
10
|
|
|
11
11
|
Hosts with a separate workspace can call `fitScriptInWorkspace(workspace, scriptId, ScratchBlocks)` from the root or `./sprite-code-windows` export. It returns `false` if the viewport or block is not ready, so the host can retry after layout.
|
|
12
12
|
|
|
13
|
+
## Rearranging scripts by relationships (Editor #727)
|
|
14
|
+
|
|
15
|
+
Right-click a free-layout background and choose **Rearrange scripts by relationships**. Preview the current sprite or stage, then confirm or cancel. One Undo/Redo restores the positions and attached comments. Other targets stay fixed. Editable popouts use their existing edit lease; read-only and serial views cannot run this operation.
|
|
16
|
+
|
|
17
|
+
The existing static relationship extractor supplies function calls, named functions and messages. An iterative SCC pass groups cycles; longest-path ranks and four barycentric sweeps arrange the resulting DAG. Disconnected components occupy separate bands. These bounded, testable rank constraints do not require an additional ELK dependency. Matter.js 0.20.0 (MIT) relaxes comment-inclusive rectangles with gravity and rotation disabled. Fixed steps and canonical ID order make repeated layouts stable. Simulation yields every eight steps and stops on convergence or after 120 steps. Deterministic packing and final collision checks preserve ranks and avoid loose comments. Limits are 1000 scripts, 10000 relations and 1000 loose comments; unsupported input leaves the project unchanged.
|
|
18
|
+
|
|
19
|
+
External and unresolved links are identified in the preview. Dynamic names do not acquire invented destinations; static relationships do not guarantee execution order. Program, target or geometry changes invalidate the preview. Recalculate before applying. Native block moves own attached-comment undo; comment notifications still reach the VM and popout protocol. Failed queued moves are rolled back before dispatch.
|
|
20
|
+
|
|
21
|
+
Existing `attachDockedScriptLayout` integration enables the menu without GUI changes. Custom editable `attachScriptView` hosts pass `semanticLayout: {events, canArrange}` alongside `relations`; read-only hosts omit it. Run `npm run build`, the semantic-layout and relationship unit tests, and `node --test test/semantic-layout.browser.ts` for focused headless verification. Roll back the package and host dependency pin together. No project-format migration or new metadata is needed.
|
|
22
|
+
|
|
13
23
|
## Entry points
|
|
14
24
|
|
|
15
25
|
| Import | Contents |
|
package/dist/code-popout.js
CHANGED
|
@@ -66,6 +66,7 @@ export function startCodePopout({ ScratchBlocks, PopupLayout, attachWorkspaceNav
|
|
|
66
66
|
let edits = [];
|
|
67
67
|
const scriptView = attachScriptView({ workspace, ScratchBlocks, getLocale: () => locale,
|
|
68
68
|
mount: workspaceArea, canShowBlock: () => editable && !blockedSnapshot,
|
|
69
|
+
semanticLayout: { events: ScratchBlocks.Events, canArrange: () => editable && !blockedSnapshot && document.hasFocus() && !mount.inert && !workspace.isDragging() },
|
|
69
70
|
hasWorkspaceMenu: () => !mount.inert,
|
|
70
71
|
relations: {
|
|
71
72
|
getTarget: () => targetId ? { id: targetId, blocks: { _blocks: history.blocks } } : undefined,
|
|
@@ -164,6 +164,7 @@ export function createHorizontalBlockPalette({ getScratchBlocks, openExtensionLi
|
|
|
164
164
|
const capture = { capture: true, signal: events.signal };
|
|
165
165
|
const original = {
|
|
166
166
|
dispose: toolbox.dispose,
|
|
167
|
+
setVisible: workspace.setVisible,
|
|
167
168
|
getClientRect: toolbox.getClientRect,
|
|
168
169
|
getHeight: toolbox.getHeight,
|
|
169
170
|
getWidth: toolbox.getWidth,
|
|
@@ -183,6 +184,20 @@ export function createHorizontalBlockPalette({ getScratchBlocks, openExtensionLi
|
|
|
183
184
|
let scrollBeforeSearch = 0;
|
|
184
185
|
const scrollPositions = new Map();
|
|
185
186
|
const verticalPosition = workspace.toolboxPosition;
|
|
187
|
+
// Scratch Blocks shows a workspace by setting its toolbox to display:block, overriding the
|
|
188
|
+
// horizontal palette's flex layout. Let the stylesheet lay it out, then refresh its metrics.
|
|
189
|
+
const restoreHorizontalDisplay = () => {
|
|
190
|
+
if (!horizontal || menu.style.display !== 'block')
|
|
191
|
+
return false;
|
|
192
|
+
menu.style.removeProperty('display');
|
|
193
|
+
return true;
|
|
194
|
+
};
|
|
195
|
+
const setVisible = workspace.setVisible = function (...args) {
|
|
196
|
+
const result = original.setVisible.apply(this, args);
|
|
197
|
+
if (restoreHorizontalDisplay())
|
|
198
|
+
workspace.resize();
|
|
199
|
+
return result;
|
|
200
|
+
};
|
|
186
201
|
const categoryById = id => toolbox.categoryMenu_.categories_.find(category => category.id_ === id);
|
|
187
202
|
const getLocale = () => ScratchBlocks.ScratchMsgs.currentLocale_ || doc.documentElement.lang;
|
|
188
203
|
// A category nested in another opens from its group's child palette.
|
|
@@ -581,6 +596,7 @@ export function createHorizontalBlockPalette({ getScratchBlocks, openExtensionLi
|
|
|
581
596
|
workspace.toolboxPosition = horizontal ? ScratchBlocks.TOOLBOX_AT_TOP : verticalPosition;
|
|
582
597
|
menu.classList.toggle(styles.horizontal, horizontal);
|
|
583
598
|
menu.toggleAttribute('data-horizontal-block-palette', horizontal);
|
|
599
|
+
restoreHorizontalDisplay();
|
|
584
600
|
panel.classList.toggle(styles.panel, horizontal);
|
|
585
601
|
scrollbar.classList.toggle(styles.scrollbar, horizontal);
|
|
586
602
|
if (horizontal)
|
|
@@ -723,6 +739,8 @@ export function createHorizontalBlockPalette({ getScratchBlocks, openExtensionLi
|
|
|
723
739
|
}
|
|
724
740
|
});
|
|
725
741
|
toolbox.dispose = () => {
|
|
742
|
+
if (workspace.setVisible === setVisible)
|
|
743
|
+
workspace.setVisible = original.setVisible;
|
|
726
744
|
paletteRefreshers.delete(redraw);
|
|
727
745
|
newSpritePrompts.splice(newSpritePrompts.indexOf(askNewSprite) >>> 0, 1);
|
|
728
746
|
paletteMenu.dispose();
|
package/dist/script-arrows.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isFoldedDefinition } from "./procedure-edits.js";
|
|
2
2
|
import { readScriptRelations } from "./script-relations.js";
|
|
3
|
-
function roundedRoute(points,
|
|
3
|
+
function roundedRoute(points, radii) {
|
|
4
4
|
let path = `M ${points[0].x} ${points[0].y}`;
|
|
5
5
|
for (let index = 1; index < points.length - 1; index++) {
|
|
6
6
|
const before = points[index - 1], corner = points[index], after = points[index + 1];
|
|
7
7
|
const entering = Math.hypot(corner.x - before.x, corner.y - before.y);
|
|
8
8
|
const leaving = Math.hypot(after.x - corner.x, after.y - corner.y);
|
|
9
|
-
const size = Math.min(
|
|
9
|
+
const size = Math.min(radii[index - 1], entering / 2, leaving / 2);
|
|
10
10
|
if (!size) {
|
|
11
11
|
path += ` L ${corner.x} ${corner.y}`;
|
|
12
12
|
continue;
|
|
@@ -21,22 +21,6 @@ function roundedRoute(points, radius) {
|
|
|
21
21
|
return `${path} L ${end.x} ${end.y}`;
|
|
22
22
|
}
|
|
23
23
|
const ns = 'http://www.w3.org/2000/svg';
|
|
24
|
-
// Keep the same sixteen-unit hourglass as the call graph's relation badge.
|
|
25
|
-
const relationWaitGlyph = 'M1 1h14M1 15h14M2 1v3l12 8v3M14 1v3l-12 8v3M2 4h12M2 12h12';
|
|
26
|
-
/** Keep the badge beside the receiving end of the path, leaving its stroke visible. */
|
|
27
|
-
function waitBadgePoint(path, offset) {
|
|
28
|
-
const values = path.match(/-?(?:\d*\.?\d+)(?:e[+-]?\d+)?/gi).map(Number);
|
|
29
|
-
const [sx, sy] = values;
|
|
30
|
-
const [bx, by, tx, ty] = values.slice(-4);
|
|
31
|
-
const endX = tx - bx;
|
|
32
|
-
const endY = ty - by;
|
|
33
|
-
const dx = endX || endY ? endX : tx - sx;
|
|
34
|
-
const dy = endX || endY ? endY : ty - sy;
|
|
35
|
-
const length = Math.hypot(dx, dy) || 1;
|
|
36
|
-
const side = -dy < 0 || dy === 0 && dx > 0 ? -1 : 1;
|
|
37
|
-
return { x: tx - dx / length * offset * .75 - dy / length * offset * side,
|
|
38
|
-
y: ty - dy / length * offset * .75 + dx / length * offset * side };
|
|
39
|
-
}
|
|
40
24
|
const outlines = new Map();
|
|
41
25
|
/** Intersect the actual outline, including a hat's overhang, rather than Blockly's layout padding. */
|
|
42
26
|
function outlinePoint(shape, bounds, side, fraction) {
|
|
@@ -286,25 +270,19 @@ export function attachScriptArrows({ workspace, vm, getTarget, getRelations, get
|
|
|
286
270
|
badgePoint = { x: middle, y: top - 6 };
|
|
287
271
|
}
|
|
288
272
|
if (serialRoute && source && destination) {
|
|
289
|
-
const { right, top, clearance } = serialRoute;
|
|
273
|
+
const { right, top, clearance, radius } = serialRoute;
|
|
290
274
|
// Leave room beside every script before turning vertically, then return through the gap above the hat.
|
|
291
275
|
const approach = end.x - clearance;
|
|
292
276
|
path = roundedRoute([start, { x: right, y: start.y }, { x: right, y: top },
|
|
293
|
-
{ x: approach, y: top }, { x: approach, y: end.y }, end], clearance);
|
|
277
|
+
{ x: approach, y: top }, { x: approach, y: end.y }, end], [radius, radius, clearance, clearance]);
|
|
294
278
|
badgePoint = { x: right, y: (start.y + top) / 2 };
|
|
295
279
|
}
|
|
296
280
|
const head = `M ${end.x - 9} ${end.y - 5} L ${end.x} ${end.y} L ${end.x - 9} ${end.y + 5}`;
|
|
297
|
-
|
|
298
|
-
if (relation.kind === 'message' && relation.wait) {
|
|
299
|
-
const point = waitBadgePoint(path, 24);
|
|
300
|
-
badgePoint = { x: point.x + 16, y: point.y + 4 };
|
|
301
|
-
waitTransform = `translate(${point.x} ${point.y})`;
|
|
302
|
-
}
|
|
303
|
-
return { path, head, recursive, badgePoint, waitTransform };
|
|
281
|
+
return { path, head, recursive, badgePoint };
|
|
304
282
|
}
|
|
305
283
|
function drawArrow(drawing, matrix, inverse, area, highlighted) {
|
|
306
284
|
const { relation, source, destination, count } = drawing;
|
|
307
|
-
const { path, head, recursive, badgePoint
|
|
285
|
+
const { path, head, recursive, badgePoint } = arrowGeometry(drawing, matrix, inverse, area, highlighted);
|
|
308
286
|
const strings = text();
|
|
309
287
|
const group = element('g', {
|
|
310
288
|
'data-script-relation': relation.kind,
|
|
@@ -327,17 +305,9 @@ export function attachScriptArrows({ workspace, vm, getTarget, getRelations, get
|
|
|
327
305
|
class: 'tw-script-relation-head',
|
|
328
306
|
d: head
|
|
329
307
|
}));
|
|
330
|
-
if (waiting) {
|
|
331
|
-
const badge = element('g', { class: 'tw-script-relation-wait', 'aria-label': strings.wait,
|
|
332
|
-
transform: waitTransform });
|
|
333
|
-
const title = element('title');
|
|
334
|
-
title.textContent = strings.wait;
|
|
335
|
-
badge.append(title, element('rect', { x: '-10', y: '-10', width: '20', height: '20', rx: '4' }), element('path', { class: 'tw-script-relation-wait-glyph', d: relationWaitGlyph, transform: 'translate(-8 -8)' }));
|
|
336
|
-
group.append(badge);
|
|
337
|
-
}
|
|
338
308
|
if (count > 1) {
|
|
339
309
|
const badge = element('text', { x: String(badgePoint.x), y: String(badgePoint.y),
|
|
340
|
-
class: 'tw-script-relation-badge', 'text-anchor':
|
|
310
|
+
class: 'tw-script-relation-badge', 'text-anchor': 'middle' });
|
|
341
311
|
badge.textContent = `×${count}`;
|
|
342
312
|
group.append(badge);
|
|
343
313
|
}
|
|
@@ -403,8 +373,6 @@ export function attachScriptArrows({ workspace, vm, getTarget, getRelations, get
|
|
|
403
373
|
};
|
|
404
374
|
set(group.querySelector('.tw-script-relation-line'), 'd', shape.path);
|
|
405
375
|
set(group.querySelector('.tw-script-relation-head'), 'd', shape.head);
|
|
406
|
-
if (shape.waitTransform)
|
|
407
|
-
set(group.querySelector('.tw-script-relation-wait'), 'transform', shape.waitTransform);
|
|
408
376
|
const count = group.querySelector('.tw-script-relation-badge');
|
|
409
377
|
set(count, 'x', shape.badgePoint.x);
|
|
410
378
|
set(count, 'y', shape.badgePoint.y);
|
|
@@ -484,7 +452,7 @@ export function attachScriptArrows({ workspace, vm, getTarget, getRelations, get
|
|
|
484
452
|
if (!destination)
|
|
485
453
|
continue;
|
|
486
454
|
drawing.serialRoute = { right: rightEdge + (96 + lane * 16) * unit,
|
|
487
|
-
top: destination.y - (14 + lane % 4 * 6) * unit, clearance: 8 * unit };
|
|
455
|
+
top: destination.y - (14 + lane % 4 * 6) * unit, clearance: 8 * unit, radius: 48 * unit };
|
|
488
456
|
lane++;
|
|
489
457
|
}
|
|
490
458
|
// Reserve actual scrollable SVG width for the right-hand routes while preserving the block scale.
|
|
@@ -541,7 +509,7 @@ export function attachScriptArrows({ workspace, vm, getTarget, getRelations, get
|
|
|
541
509
|
vm?.runtime?.targets?.find(item => item.id === endpoint.targetId)?.getName?.());
|
|
542
510
|
const reason = relation.unresolved && strings[relation.unresolved];
|
|
543
511
|
external.textContent = `${name ? `${name} · ` : ''}` +
|
|
544
|
-
`${relation.label}${reason ? ` · ${reason}` : ''}${
|
|
512
|
+
`${relation.label}${reason ? ` · ${reason}` : ''}${count > 1 ? ` ×${count}` : ''}`;
|
|
545
513
|
external.disabled = !endpoint;
|
|
546
514
|
external.setAttribute('aria-label', `${strings[relation.kind]}: ${external.textContent}`);
|
|
547
515
|
external.toggleAttribute('data-highlighted', Boolean(highlighted));
|
|
@@ -3,6 +3,7 @@ import { type RearrangementContext } from './script-layout-dialog.ts';
|
|
|
3
3
|
import { type ScriptViewMenuBlocks, type ScriptViewMenuWorkspace } from './script-view-menu.ts';
|
|
4
4
|
import type { PresentationElements } from './preview-chrome.ts';
|
|
5
5
|
import { type ScriptRelationContext, type ScriptRelationVisibility } from './script-arrows.ts';
|
|
6
|
+
import { type SemanticLayoutContext } from './semantic-layout-dialog.ts';
|
|
6
7
|
export type ScriptView = 'free' | 'z' | 'n';
|
|
7
8
|
interface ViewOptions {
|
|
8
9
|
workspace: LayoutWorkspace & ScriptViewMenuWorkspace;
|
|
@@ -14,8 +15,9 @@ interface ViewOptions {
|
|
|
14
15
|
onChange?(view: ScriptView): void;
|
|
15
16
|
hasWorkspaceMenu?(): boolean;
|
|
16
17
|
relations?: ScriptRelationContext;
|
|
18
|
+
semanticLayout?: Pick<SemanticLayoutContext, 'events' | 'canArrange'>;
|
|
17
19
|
}
|
|
18
|
-
export declare function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, initialView, canShowBlock, onChange, hasWorkspaceMenu, relations: relationContext }: ViewOptions): {
|
|
20
|
+
export declare function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, initialView, canShowBlock, onChange, hasWorkspaceMenu, relations: relationContext, semanticLayout }: ViewOptions): {
|
|
19
21
|
update: () => void;
|
|
20
22
|
relations: {
|
|
21
23
|
update: () => void;
|
|
@@ -6,13 +6,14 @@ import { attachScriptArrows } from "./script-arrows.js";
|
|
|
6
6
|
import { attachCodeZoomRange } from "./code-zoom.js";
|
|
7
7
|
import { setScriptProjection } from "./script-projection.js";
|
|
8
8
|
import { openSerialScriptEditor } from "./serial-script-editor.js";
|
|
9
|
+
import { openSemanticLayout } from "./semantic-layout-dialog.js";
|
|
9
10
|
import { isFoldedDefinition, setFoldedDefinition } from "./procedure-edits.js";
|
|
10
11
|
const choices = [
|
|
11
12
|
{ view: 'free', label: 'Normal layout view', jaLabel: '通常配置の見え方' },
|
|
12
13
|
{ view: 'z', label: 'Z layout view', jaLabel: 'Z配置の見え方' },
|
|
13
14
|
{ view: 'n', label: 'N layout view', jaLabel: 'N配置の見え方' }
|
|
14
15
|
];
|
|
15
|
-
export function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, initialView = 'free', canShowBlock, onChange, hasWorkspaceMenu = () => true, relations: relationContext }) {
|
|
16
|
+
export function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, initialView = 'free', canShowBlock, onChange, hasWorkspaceMenu = () => true, relations: relationContext, semanticLayout }) {
|
|
16
17
|
const injection = workspace.getInjectionDiv();
|
|
17
18
|
const restoreZoomRange = attachCodeZoomRange(workspace);
|
|
18
19
|
const host = mount ?? injection;
|
|
@@ -31,6 +32,7 @@ export function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, i
|
|
|
31
32
|
const foldButtons = new Map();
|
|
32
33
|
let view = initialView;
|
|
33
34
|
let editor;
|
|
35
|
+
let semanticDialog;
|
|
34
36
|
let frame;
|
|
35
37
|
const svg = workspace.getParentSvg();
|
|
36
38
|
const observer = new window.MutationObserver(records => {
|
|
@@ -115,7 +117,17 @@ export function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, i
|
|
|
115
117
|
const ja = japanese();
|
|
116
118
|
return {
|
|
117
119
|
label: ja ? 'コードの並びの見え方を変更する' : 'Change code layout view',
|
|
118
|
-
options: foldOptions(),
|
|
120
|
+
options: [...foldOptions(), ...(view === 'free' && semanticLayout && relationContext ? [{
|
|
121
|
+
text: ja ? 'スクリプトを意味に応じて再配置する' : 'Rearrange scripts by relationships',
|
|
122
|
+
enabled: semanticLayout.canArrange(),
|
|
123
|
+
callback() {
|
|
124
|
+
if (view !== 'free' || !semanticLayout.canArrange())
|
|
125
|
+
return;
|
|
126
|
+
semanticDialog?.close();
|
|
127
|
+
semanticDialog = openSemanticLayout({ workspace, relations: relationContext, ...semanticLayout,
|
|
128
|
+
canArrange: () => view === 'free' && semanticLayout.canArrange() }, getLocale());
|
|
129
|
+
}
|
|
130
|
+
}] : [])],
|
|
119
131
|
choices: choices.map(choice => ({
|
|
120
132
|
text: ja ? choice.jaLabel : choice.label,
|
|
121
133
|
enabled: true,
|
|
@@ -146,7 +158,8 @@ export function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, i
|
|
|
146
158
|
width: box.width, height: box.height };
|
|
147
159
|
});
|
|
148
160
|
const placements = arrangeScripts(scripts, view, 'vertical', Math.max(64, 48 / scale))
|
|
149
|
-
|
|
161
|
+
// Leave room for incoming arrowheads and return paths beside the fixed fold gutter.
|
|
162
|
+
.map(placement => ({ ...placement, x: placement.x + 40 / scale }));
|
|
150
163
|
paintScripts(contents, placements, scale);
|
|
151
164
|
paintFoldButtons(placements, scale);
|
|
152
165
|
const projection = contents.querySelector('svg');
|
|
@@ -229,6 +242,7 @@ export function attachScriptView({ workspace, ScratchBlocks, getLocale, mount, i
|
|
|
229
242
|
get view() { return view; },
|
|
230
243
|
setView,
|
|
231
244
|
dispose() {
|
|
245
|
+
semanticDialog?.close();
|
|
232
246
|
editor?.dispose();
|
|
233
247
|
setScriptProjection(workspace);
|
|
234
248
|
restoreZoomRange();
|
|
@@ -274,7 +288,8 @@ export function attachDockedScriptLayout({ vm, workspace, ScratchBlocks, canUse,
|
|
|
274
288
|
(!group || group.classList.contains('dv-active-group')));
|
|
275
289
|
};
|
|
276
290
|
const view = attachScriptView({ workspace, ScratchBlocks, getLocale: () => injection.ownerDocument.documentElement.lang || locale,
|
|
277
|
-
canShowBlock: canArrange,
|
|
291
|
+
canShowBlock: canArrange, semanticLayout: { events: ScratchBlocks.Events, canArrange },
|
|
292
|
+
relations: { vm: vm,
|
|
278
293
|
getTarget: () => vm.editingTarget,
|
|
279
294
|
initialVisibility: getDockedRelationVisibility(vm) } });
|
|
280
295
|
host.setAttribute('data-code-hover-surface', '');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type LayoutEvents } from './script-layout-workspace.ts';
|
|
2
|
+
import type { ScriptRelationContext } from './script-arrows.ts';
|
|
3
|
+
import { type SemanticWorkspace } from './semantic-layout-workspace.ts';
|
|
4
|
+
export interface SemanticLayoutContext {
|
|
5
|
+
workspace: SemanticWorkspace;
|
|
6
|
+
events: LayoutEvents;
|
|
7
|
+
relations: ScriptRelationContext;
|
|
8
|
+
canArrange(): boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function openSemanticLayout(context: SemanticLayoutContext, locale: string): {
|
|
11
|
+
close: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { paintScripts } from "./script-layout-workspace.js";
|
|
2
|
+
import { readScriptRelations } from "./script-relations.js";
|
|
3
|
+
import { arrangeSemanticScripts } from "./semantic-script-layout.js";
|
|
4
|
+
import { applySemanticLayout, readSemanticWorkspace } from "./semantic-layout-workspace.js";
|
|
5
|
+
const ns = 'http://www.w3.org/2000/svg';
|
|
6
|
+
export function openSemanticLayout(context, locale) {
|
|
7
|
+
const { workspace, events, relations, canArrange } = context;
|
|
8
|
+
const document = workspace.getInjectionDiv().ownerDocument;
|
|
9
|
+
const window = document.defaultView;
|
|
10
|
+
const ja = /^ja(?:-|$)/i.test(locale);
|
|
11
|
+
const t = (en, japanese) => ja ? japanese : en;
|
|
12
|
+
const dialog = document.createElement('dialog');
|
|
13
|
+
dialog.className = 'tw-script-layout-dialog';
|
|
14
|
+
dialog.setAttribute('aria-label', t('Rearrange scripts by relationships', 'スクリプトを意味に応じて再配置する'));
|
|
15
|
+
const title = document.createElement('h2');
|
|
16
|
+
title.textContent = dialog.getAttribute('aria-label');
|
|
17
|
+
const explanation = document.createElement('p');
|
|
18
|
+
explanation.textContent = t('Read static calls and messages from left to right. This does not guarantee execution order.', '関数の呼び出しとメッセージ送受信を左から右にたどる配置です。実行順序を保証するものではありません。');
|
|
19
|
+
const preview = document.createElement('div');
|
|
20
|
+
preview.className = 'tw-script-layout-preview';
|
|
21
|
+
preview.tabIndex = 0;
|
|
22
|
+
preview.setAttribute('aria-label', t('Layout preview', '再配置のプレビュー'));
|
|
23
|
+
const footer = document.createElement('footer');
|
|
24
|
+
footer.className = 'tw-plus-dialog-actions';
|
|
25
|
+
const status = document.createElement('p');
|
|
26
|
+
status.setAttribute('role', 'status');
|
|
27
|
+
const cancel = document.createElement('button');
|
|
28
|
+
cancel.textContent = t('Cancel', 'キャンセル');
|
|
29
|
+
cancel.dataset.dialogAction = 'cancel';
|
|
30
|
+
const apply = document.createElement('button');
|
|
31
|
+
apply.textContent = t('Rearrange', '再配置する');
|
|
32
|
+
apply.dataset.dialogAction = 'confirm';
|
|
33
|
+
apply.disabled = true;
|
|
34
|
+
const recalculate = document.createElement('button');
|
|
35
|
+
recalculate.textContent = t('Recalculate', '再計算する');
|
|
36
|
+
footer.append(status, recalculate, cancel, apply);
|
|
37
|
+
dialog.append(title, explanation, preview, footer);
|
|
38
|
+
document.body.append(dialog);
|
|
39
|
+
let closed = false;
|
|
40
|
+
let run;
|
|
41
|
+
let snapshot;
|
|
42
|
+
let placements = [];
|
|
43
|
+
let signature = '';
|
|
44
|
+
let originalTarget;
|
|
45
|
+
function graph() {
|
|
46
|
+
return relations.getRelations?.() ?? readScriptRelations(relations.vm?.runtime?.targets ??
|
|
47
|
+
(relations.getTarget() ? [relations.getTarget()] : []));
|
|
48
|
+
}
|
|
49
|
+
function revision() {
|
|
50
|
+
// Include program contents and external targets: unchanged bounds do not imply unchanged calls.
|
|
51
|
+
const targets = relations.vm?.runtime?.targets ?? [relations.getTarget()];
|
|
52
|
+
const geometry = readSemanticWorkspace(workspace);
|
|
53
|
+
return JSON.stringify({ targets: targets.filter(t => t && t.isOriginal !== false).map(t => [t.id, t.blocks._blocks]),
|
|
54
|
+
graph: relations.getRelations?.(), scripts: geometry.scripts.map(s => [s.id, s.x, s.y, s.width, s.height]),
|
|
55
|
+
comments: geometry.comments.map(c => [c.id, c.rootId, c.x, c.y, c.width, c.height, c.origin, c.text]) });
|
|
56
|
+
}
|
|
57
|
+
function stale() {
|
|
58
|
+
try {
|
|
59
|
+
const current = readSemanticWorkspace(workspace).scripts;
|
|
60
|
+
return !canArrange() || relations.getTarget()?.id !== originalTarget?.id || revision() !== signature ||
|
|
61
|
+
current.length !== snapshot.scripts.length || current.some(s => snapshot.scripts.find(original => original.id === s.id)?.block !== s.block);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function close() {
|
|
68
|
+
if (closed)
|
|
69
|
+
return;
|
|
70
|
+
closed = true;
|
|
71
|
+
run?.abort();
|
|
72
|
+
for (const [emitter, name] of subscriptions)
|
|
73
|
+
emitter?.removeListener?.(name, invalidate);
|
|
74
|
+
if (dialog.open)
|
|
75
|
+
dialog.close();
|
|
76
|
+
dialog.remove();
|
|
77
|
+
}
|
|
78
|
+
function invalidate() {
|
|
79
|
+
if (closed || !snapshot || !stale())
|
|
80
|
+
return;
|
|
81
|
+
run?.abort();
|
|
82
|
+
apply.disabled = true;
|
|
83
|
+
recalculate.disabled = false;
|
|
84
|
+
status.textContent = t('The code changed. Recalculate the preview.', 'コードが変わりました。プレビューを再計算してください。');
|
|
85
|
+
}
|
|
86
|
+
const subscriptions = [
|
|
87
|
+
[relations.vm, 'workspaceUpdate'], [relations.vm, 'targetsUpdate'], [relations.vm?.runtime, 'PROJECT_CHANGED']
|
|
88
|
+
];
|
|
89
|
+
for (const [emitter, name] of subscriptions)
|
|
90
|
+
emitter?.on?.(name, invalidate);
|
|
91
|
+
async function calculate() {
|
|
92
|
+
run?.abort();
|
|
93
|
+
const task = new window.AbortController();
|
|
94
|
+
run = task;
|
|
95
|
+
apply.disabled = true;
|
|
96
|
+
recalculate.disabled = true;
|
|
97
|
+
preview.replaceChildren();
|
|
98
|
+
status.textContent = t('Calculating layout…', '配置を計算しています…');
|
|
99
|
+
try {
|
|
100
|
+
events.fireNow_();
|
|
101
|
+
if (!canArrange())
|
|
102
|
+
throw new Error('Workspace is unavailable');
|
|
103
|
+
originalTarget = relations.getTarget();
|
|
104
|
+
if (!originalTarget)
|
|
105
|
+
throw new Error('No target');
|
|
106
|
+
snapshot = readSemanticWorkspace(workspace);
|
|
107
|
+
signature = revision();
|
|
108
|
+
const edges = graph();
|
|
109
|
+
const started = window.performance.now();
|
|
110
|
+
const result = await arrangeSemanticScripts(snapshot.scripts, edges, originalTarget.id, {
|
|
111
|
+
signal: task.signal, obstacles: snapshot.obstacles,
|
|
112
|
+
yieldControl: () => new Promise(resolve => window.setTimeout(resolve, 0))
|
|
113
|
+
});
|
|
114
|
+
if (closed || run !== task || task.signal.aborted)
|
|
115
|
+
return;
|
|
116
|
+
if (stale()) {
|
|
117
|
+
invalidate();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
placements = result.placements;
|
|
121
|
+
paintPreview(edges);
|
|
122
|
+
const external = edges.filter(e => e.destination && e.source.targetId !== e.destination.targetId &&
|
|
123
|
+
[e.source.targetId, e.destination.targetId].includes(originalTarget.id)).length;
|
|
124
|
+
const unresolved = edges.filter(e => e.source.targetId === originalTarget.id && e.unresolved).length;
|
|
125
|
+
status.textContent = t(`${placements.length} scripts · ${result.metrics.edges} links · ${external} external · ${unresolved} unresolved`, `${placements.length}スクリプト・${result.metrics.edges}接続・外部${external}・未解決${unresolved}`);
|
|
126
|
+
preview.dataset.layoutMetrics = JSON.stringify({ ...result.metrics, milliseconds: window.performance.now() - started,
|
|
127
|
+
overlaps: 0, external, unresolved });
|
|
128
|
+
apply.disabled = !placements.some(p => p.x !== p.script.x || p.y !== p.script.y);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (closed || run !== task || task.signal.aborted)
|
|
132
|
+
return;
|
|
133
|
+
status.textContent = t('Unable to calculate a safe layout. The project has not changed.', '安全な配置を計算できませんでした。作品は変更されていません。');
|
|
134
|
+
status.title = String(error);
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
if (!closed && run === task)
|
|
138
|
+
recalculate.disabled = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function paintPreview(edges) {
|
|
142
|
+
paintScripts(preview, placements, .6);
|
|
143
|
+
const svg = preview.querySelector('svg');
|
|
144
|
+
const local = new Map(placements.map(p => [p.script.id, p]));
|
|
145
|
+
// Include loose comments and the complete cluster extents, even beyond the visible folded body.
|
|
146
|
+
for (const c of snapshot.comments) {
|
|
147
|
+
const p = local.get(c.rootId);
|
|
148
|
+
const x = c.x + (p ? p.x - p.script.x : 0), y = c.y + (p ? p.y - p.script.y : 0);
|
|
149
|
+
const rect = document.createElementNS(ns, 'rect');
|
|
150
|
+
for (const [key, value] of Object.entries({ x, y, width: c.width, height: c.height, fill: '#fff2ae', stroke: '#9b8524' })) {
|
|
151
|
+
rect.setAttribute(key, String(value));
|
|
152
|
+
}
|
|
153
|
+
const text = document.createElementNS(ns, 'title');
|
|
154
|
+
text.textContent = t('Comment', 'コメント');
|
|
155
|
+
rect.append(text);
|
|
156
|
+
svg.append(rect);
|
|
157
|
+
const content = document.createElementNS(ns, 'foreignObject');
|
|
158
|
+
for (const [key, value] of Object.entries({ x: x + 8, y: y + 8,
|
|
159
|
+
width: Math.max(0, c.width - 16), height: Math.max(0, c.height - 16) }))
|
|
160
|
+
content.setAttribute(key, String(value));
|
|
161
|
+
const prose = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');
|
|
162
|
+
prose.style.cssText = 'height:100%;overflow:hidden;white-space:pre-wrap;color:#332f20;font:14px sans-serif';
|
|
163
|
+
prose.textContent = c.text;
|
|
164
|
+
content.append(prose);
|
|
165
|
+
svg.append(content);
|
|
166
|
+
}
|
|
167
|
+
const layer = document.createElementNS(ns, 'g');
|
|
168
|
+
layer.setAttribute('data-semantic-relations', '');
|
|
169
|
+
for (const edge of edges) {
|
|
170
|
+
const source = edge.source.targetId === originalTarget.id ? local.get(edge.source.scriptId) : undefined;
|
|
171
|
+
const destination = edge.destination?.targetId === originalTarget.id ? local.get(edge.destination.scriptId) : undefined;
|
|
172
|
+
if (!source && !destination)
|
|
173
|
+
continue;
|
|
174
|
+
const p = source ?? destination;
|
|
175
|
+
const end = destination ?? source;
|
|
176
|
+
const from = { x: p.x + (source ? p.script.width : -40), y: p.y + p.script.height / 2 };
|
|
177
|
+
const to = { x: destination ? end.x : end.x + end.script.width + 40, y: end.y + end.script.height / 2 };
|
|
178
|
+
const group = document.createElementNS(ns, 'g');
|
|
179
|
+
group.dataset.semanticRelation = edge.kind;
|
|
180
|
+
group.dataset.wait = String(edge.wait);
|
|
181
|
+
if (edge.unresolved)
|
|
182
|
+
group.dataset.unresolved = edge.unresolved;
|
|
183
|
+
else if (!source || !destination)
|
|
184
|
+
group.dataset.external = 'true';
|
|
185
|
+
const line = document.createElementNS(ns, 'path');
|
|
186
|
+
const middle = Math.max(from.x + 32, (from.x + to.x) / 2);
|
|
187
|
+
line.setAttribute('d', `M ${from.x} ${from.y} C ${middle} ${from.y} ${middle} ${to.y} ${to.x} ${to.y}`);
|
|
188
|
+
line.setAttribute('fill', 'none');
|
|
189
|
+
line.setAttribute('stroke', edge.kind === 'function' ? '#b65be6' : '#ba8a00');
|
|
190
|
+
line.setAttribute('stroke-width', '2');
|
|
191
|
+
if (edge.kind === 'message')
|
|
192
|
+
line.setAttribute('stroke-dasharray', edge.wait ? '7 5' : '3.5 2.5');
|
|
193
|
+
const head = document.createElementNS(ns, 'path');
|
|
194
|
+
head.setAttribute('d', `M ${to.x - 7} ${to.y - 4} L ${to.x} ${to.y} L ${to.x - 7} ${to.y + 4}`);
|
|
195
|
+
head.setAttribute('fill', 'none');
|
|
196
|
+
head.setAttribute('stroke', line.getAttribute('stroke'));
|
|
197
|
+
const label = document.createElementNS(ns, 'title');
|
|
198
|
+
label.textContent = `${edge.label} ${edge.unresolved ? t('(unresolved)', '(未解決)') :
|
|
199
|
+
!source || !destination ? t('(external)', '(外部)') : ''}`;
|
|
200
|
+
group.append(line, head, label);
|
|
201
|
+
layer.append(group);
|
|
202
|
+
if (edge.unresolved || !source || !destination) {
|
|
203
|
+
const text = document.createElementNS(ns, 'text');
|
|
204
|
+
text.setAttribute('x', String(to.x + 8));
|
|
205
|
+
text.setAttribute('y', String(to.y));
|
|
206
|
+
text.setAttribute('fill', 'currentColor');
|
|
207
|
+
text.setAttribute('font-size', '14');
|
|
208
|
+
const externalId = source ? edge.destination?.targetId : edge.source.targetId;
|
|
209
|
+
text.textContent = edge.unresolved ? `${edge.label || '?'} ${t('(unresolved)', '(未解決)')}` :
|
|
210
|
+
`${edge.label} ↗ ${relations.getTargetName?.(externalId) ??
|
|
211
|
+
relations.vm?.runtime?.targets?.find(target => target.id === externalId)?.getName?.() ?? t('external', '外部')}`;
|
|
212
|
+
group.append(text);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
svg.prepend(layer);
|
|
216
|
+
const box = svg.getBBox();
|
|
217
|
+
const left = Math.min(0, box.x) - 16, top = Math.min(0, box.y) - 16;
|
|
218
|
+
const width = box.x + box.width - left + 32, height = box.y + box.height - top + 32;
|
|
219
|
+
svg.setAttribute('viewBox', `${left} ${top} ${width} ${height}`);
|
|
220
|
+
svg.setAttribute('width', String(width * .6));
|
|
221
|
+
svg.setAttribute('height', String(height * .6));
|
|
222
|
+
}
|
|
223
|
+
cancel.addEventListener('click', close);
|
|
224
|
+
dialog.addEventListener('close', close, { once: true });
|
|
225
|
+
dialog.addEventListener('cancel', close, { once: true });
|
|
226
|
+
dialog.addEventListener('keydown', e => e.stopPropagation());
|
|
227
|
+
recalculate.addEventListener('click', () => void calculate());
|
|
228
|
+
apply.addEventListener('click', () => {
|
|
229
|
+
events.fireNow_();
|
|
230
|
+
if (stale()) {
|
|
231
|
+
invalidate();
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
try {
|
|
235
|
+
applySemanticLayout(workspace, events, placements, snapshot.comments);
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
apply.disabled = true;
|
|
239
|
+
status.textContent = t('Unable to apply the layout. Original positions were restored.', '配置を適用できませんでした。元の位置に戻しました。');
|
|
240
|
+
status.title = String(error);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
close();
|
|
244
|
+
if (placements.length)
|
|
245
|
+
workspace.centerOnBlock(placements[0].script.id);
|
|
246
|
+
});
|
|
247
|
+
dialog.showModal();
|
|
248
|
+
cancel.focus();
|
|
249
|
+
void calculate();
|
|
250
|
+
return { close };
|
|
251
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type LayoutBlock, type LayoutEvents, type LayoutWorkspace, type RenderedScript } from './script-layout-workspace.ts';
|
|
2
|
+
import type { ScriptBounds } from './script-layout.ts';
|
|
3
|
+
import type { SemanticPlacement } from './semantic-script-layout.ts';
|
|
4
|
+
type Point = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
export interface LayoutComment {
|
|
9
|
+
id: string;
|
|
10
|
+
block_?: LayoutBlock & {
|
|
11
|
+
getRootBlock(): LayoutBlock;
|
|
12
|
+
};
|
|
13
|
+
getXY?(): Point;
|
|
14
|
+
getRelativeToSurfaceXY?(): Point;
|
|
15
|
+
getBoundingRectangle(): {
|
|
16
|
+
topLeft: Point;
|
|
17
|
+
bottomRight: Point;
|
|
18
|
+
};
|
|
19
|
+
moveTo?(x: number, y: number): void;
|
|
20
|
+
getText?(): string;
|
|
21
|
+
getSvgRoot?(): SVGElement;
|
|
22
|
+
bubble_?: {
|
|
23
|
+
bubbleGroup_?: SVGElement;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type SemanticWorkspace = LayoutWorkspace & {
|
|
27
|
+
getTopComments?(ordered: boolean): LayoutComment[];
|
|
28
|
+
};
|
|
29
|
+
export type SemanticEvents = LayoutEvents & {
|
|
30
|
+
FIRE_QUEUE_?: {
|
|
31
|
+
type?: string;
|
|
32
|
+
commentId?: string;
|
|
33
|
+
recordUndo?: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
disable?(): void;
|
|
36
|
+
enable?(): void;
|
|
37
|
+
};
|
|
38
|
+
export interface CommentSnapshot extends ScriptBounds {
|
|
39
|
+
comment: LayoutComment;
|
|
40
|
+
rootId?: string;
|
|
41
|
+
origin: Point;
|
|
42
|
+
text: string;
|
|
43
|
+
svg?: SVGElement;
|
|
44
|
+
}
|
|
45
|
+
export interface SemanticScript extends RenderedScript {
|
|
46
|
+
/** Full script rectangle before attached comments are included. */
|
|
47
|
+
bounds: ScriptBounds;
|
|
48
|
+
}
|
|
49
|
+
/** Read expanded bounds without changing the user's folding or moving any comments. */
|
|
50
|
+
export declare function readSemanticWorkspace(workspace: SemanticWorkspace): {
|
|
51
|
+
scripts: SemanticScript[];
|
|
52
|
+
comments: CommentSnapshot[];
|
|
53
|
+
obstacles: CommentSnapshot[];
|
|
54
|
+
};
|
|
55
|
+
/** Roll back queued native moves before any of them reach the VM or the undo stacks. */
|
|
56
|
+
export declare function applySemanticLayout(workspace: SemanticWorkspace, events: SemanticEvents, placements: SemanticPlacement<SemanticScript>[], comments: CommentSnapshot[]): void;
|
|
57
|
+
export {};
|