@lace-cloud/proto 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +396 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +194 -24
- package/dist/index.d.ts +194 -24
- package/dist/index.mjs +365 -141
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -248,6 +248,80 @@ interface MessageFns$1<T> {
|
|
|
248
248
|
fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
type XY = {
|
|
252
|
+
x: number;
|
|
253
|
+
y: number;
|
|
254
|
+
};
|
|
255
|
+
type CanvasArrangement = {
|
|
256
|
+
[scopeKey: string]: {
|
|
257
|
+
nodes?: {
|
|
258
|
+
[childId: string]: XY;
|
|
259
|
+
};
|
|
260
|
+
groups?: {
|
|
261
|
+
[useId: string]: {
|
|
262
|
+
collapsed: boolean;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
/** A box's extent in flow units. */
|
|
269
|
+
type Size = {
|
|
270
|
+
width: number;
|
|
271
|
+
height: number;
|
|
272
|
+
};
|
|
273
|
+
/** A box in flow units: its top-left and its extent. */
|
|
274
|
+
type Rect = XY & Size;
|
|
275
|
+
declare const NODE_WIDTH = 200;
|
|
276
|
+
declare const NODE_HEADER_HEIGHT = 28;
|
|
277
|
+
declare const NODE_ROW_HEIGHT = 22;
|
|
278
|
+
/** A group's chrome around its members: the header chip above, a margin on
|
|
279
|
+
* the other three sides. */
|
|
280
|
+
declare const GROUP_PADDING: {
|
|
281
|
+
readonly x: 40;
|
|
282
|
+
readonly top: 60;
|
|
283
|
+
readonly bottom: 20;
|
|
284
|
+
};
|
|
285
|
+
declare const GROUP_HEADER_HEIGHT = 32;
|
|
286
|
+
declare const COLLAPSED_GROUP_WIDTH = 220;
|
|
287
|
+
/** The inputs a folded card draws: those it needs (required) and those a
|
|
288
|
+
* wire feeds; the rest fold behind "+N more". */
|
|
289
|
+
declare function visibleInputs(inputs: readonly NodePin$1[]): NodePin$1[];
|
|
290
|
+
/** How many pin rows a folded card draws: its visible inputs, plus one for
|
|
291
|
+
* "+N more" when some fold, against its outputs. */
|
|
292
|
+
declare function nodeRows(node: Pick<RenderNode$1, 'inputs' | 'outputs'>): number;
|
|
293
|
+
/** A module card's extent as ModuleNode draws it, folded. */
|
|
294
|
+
declare function nodeSize(node: Pick<RenderNode$1, 'inputs' | 'outputs'>): Size;
|
|
295
|
+
/** Where on a folded card an input's wire lands, from the card's top: the
|
|
296
|
+
* centre of its row, or of the header when the input is folded away. */
|
|
297
|
+
declare function inputPinY(node: Pick<RenderNode$1, 'inputs'>, name: string): number;
|
|
298
|
+
/** The extent of a set of boxes: the least box that holds them all; an
|
|
299
|
+
* empty one at the origin when there are none. A group's box is its
|
|
300
|
+
* content's extent with its padding (`groupBoxSize`). */
|
|
301
|
+
declare function extentOf(rects: readonly Rect[]): Rect;
|
|
302
|
+
/** A group's box around content of `content` extent: the header chip above,
|
|
303
|
+
* the padding beside and below. */
|
|
304
|
+
declare function groupBoxSize(content: Size): Size;
|
|
305
|
+
/** A collapsed group's card: its header, then its interface's pins
|
|
306
|
+
* (`groupPins`), inputs on the left rail and outputs on the right, a row
|
|
307
|
+
* per pin of the longer rail. */
|
|
308
|
+
declare function collapsedGroupSize(pins: Pick<RenderGroup$1, 'inputs' | 'outputs'>): Size;
|
|
309
|
+
/** Where on a collapsed group's card the pin of row `row` of either rail is
|
|
310
|
+
* centred, from the card's top. */
|
|
311
|
+
declare function groupPinY(row: number): number;
|
|
312
|
+
/** Where on a group an input's wire lands, from its top: the centre of the
|
|
313
|
+
* input's row on its collapsed card, or of its header while it is expanded
|
|
314
|
+
* or the input is not one of its interface's. */
|
|
315
|
+
declare function groupInputPinY(group: Pick<RenderGroup$1, 'collapsed' | 'inputs'>, name: string): number;
|
|
316
|
+
/** What a group draws: its card while collapsed; its `box` while expanded. */
|
|
317
|
+
declare function groupFootprint(group: Pick<RenderGroup$1, 'collapsed' | 'inputs' | 'outputs'>, box: Size): Size;
|
|
318
|
+
/** Everything a group can draw from one anchor, collapsed or expanded: the
|
|
319
|
+
* larger, in width and in height, of its card (from its interface's pins)
|
|
320
|
+
* and its `box`. A paste keeps a pasted group's reach clear of everything
|
|
321
|
+
* its scope draws; Group steps a fresh group's reach past what the layout
|
|
322
|
+
* keeps before it, and the layout steps what comes after it down past it. */
|
|
323
|
+
declare function groupReach(pins: Pick<RenderGroup$1, 'inputs' | 'outputs'>, box: Size): Size;
|
|
324
|
+
|
|
251
325
|
type CanvasView$1 = {
|
|
252
326
|
module_name: string;
|
|
253
327
|
nodes: RenderNode$1[];
|
|
@@ -271,6 +345,9 @@ type RenderGroup$1 = {
|
|
|
271
345
|
module_key?: string;
|
|
272
346
|
inputs?: NodePin$1[];
|
|
273
347
|
outputs?: NodePin$1[];
|
|
348
|
+
position: XY;
|
|
349
|
+
size: Size;
|
|
350
|
+
origin: XY;
|
|
274
351
|
};
|
|
275
352
|
type RenderNode$1 = {
|
|
276
353
|
id: string;
|
|
@@ -410,11 +487,11 @@ type ViewportIntent = {
|
|
|
410
487
|
|
|
411
488
|
declare function convertDiagnostic(d: ProtoDiagnosticLike): Diagnostic;
|
|
412
489
|
|
|
413
|
-
declare const ENGINE_METHODS: readonly ["Initialize", "
|
|
490
|
+
declare const ENGINE_METHODS: readonly ["Initialize", "SessionOpen", "TestSessionOpen", "SessionSave", "SessionClose", "SessionGenerate", "SessionResolveConflict", "ApplyAction", "ReadWiringCandidates", "CancelInvoke"];
|
|
414
491
|
declare const ENGINE_STREAM_METHODS: readonly ["Subscribe", "Invoke"];
|
|
415
492
|
type EngineMethod = (typeof ENGINE_METHODS)[number];
|
|
416
493
|
type EngineStreamMethod = (typeof ENGINE_STREAM_METHODS)[number];
|
|
417
|
-
declare const HOST_ONLY_METHODS: readonly ["TestSessionOpen"
|
|
494
|
+
declare const HOST_ONLY_METHODS: readonly ["TestSessionOpen"];
|
|
418
495
|
type HostOnlyMethod = (typeof HOST_ONLY_METHODS)[number];
|
|
419
496
|
type BridgeMethod = Exclude<EngineMethod, HostOnlyMethod>;
|
|
420
497
|
declare const BRIDGE_METHODS: BridgeMethod[];
|
|
@@ -464,24 +541,6 @@ declare function nodeIdForAddress(view: Pick<CanvasView$1, 'nodes' | 'groups'>,
|
|
|
464
541
|
|
|
465
542
|
declare function nodeIdForDiagnostic(view: Pick<CanvasView$1, 'nodes' | 'groups'>, diagnostic: Diagnostic): string | null;
|
|
466
543
|
|
|
467
|
-
type XY = {
|
|
468
|
-
x: number;
|
|
469
|
-
y: number;
|
|
470
|
-
};
|
|
471
|
-
type CanvasArrangement = {
|
|
472
|
-
[scopeKey: string]: {
|
|
473
|
-
nodes?: {
|
|
474
|
-
[childId: string]: XY;
|
|
475
|
-
};
|
|
476
|
-
groups?: {
|
|
477
|
-
[useId: string]: {
|
|
478
|
-
collapsed: boolean;
|
|
479
|
-
label?: string;
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
|
|
485
544
|
type ProjectionMeta = {
|
|
486
545
|
moduleName?: string;
|
|
487
546
|
canUndo: boolean;
|
|
@@ -493,14 +552,123 @@ type ProjectionMeta = {
|
|
|
493
552
|
declare const EMPTY_BUNDLE: Bundle;
|
|
494
553
|
declare function projectCanvasView(bundle: Bundle, arrangement: CanvasArrangement | undefined, meta: ProjectionMeta): CanvasView$1;
|
|
495
554
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
555
|
+
/**
|
|
556
|
+
* stepDown moves a box of `size` at `at` down its column, just past whatever
|
|
557
|
+
* of `taken` it would overlap, until it overlaps none: the x stays, the y
|
|
558
|
+
* moves to the lowest bottom of what is in the way. The layout steps a laid
|
|
559
|
+
* out item, and a stored one that would overlap what was kept before it,
|
|
560
|
+
* clear by it; a paste finds its free place by it; and Group steps a fresh
|
|
561
|
+
* group past what the layout keeps before it by it. Pure over its arguments.
|
|
562
|
+
*/
|
|
563
|
+
declare function stepDown(at: XY, size: Size, taken: readonly Rect[]): XY;
|
|
564
|
+
/** Where an item stands in its scope's keep order: where it is drawn — a
|
|
565
|
+
* card's top-left, a group's box's — and its place among the scope's
|
|
566
|
+
* declarations. */
|
|
567
|
+
type KeepKey = XY & {
|
|
568
|
+
declared: number;
|
|
569
|
+
};
|
|
570
|
+
/**
|
|
571
|
+
* keepOrder is the one order a scope's stored items are kept in: top to
|
|
572
|
+
* bottom by where each is drawn, then left to right, then as declared.
|
|
573
|
+
* Negative when `a` is kept before `b`. `layoutByDepth` keeps stored items in
|
|
574
|
+
* it, and Group reads what is kept before a fresh group by it.
|
|
575
|
+
*/
|
|
576
|
+
declare function keepOrder(a: KeepKey, b: KeepKey): number;
|
|
577
|
+
/**
|
|
578
|
+
* freeSlot finds where content of `extent` — a paste, as one cluster — can
|
|
579
|
+
* go in a scope that draws `occupied` (in the scope's own frame): the top of
|
|
580
|
+
* the scope's first column, stepped down (`stepDown`) until the extent's
|
|
581
|
+
* slot overlaps no occupied item's slot, so the layout's gap stays clear
|
|
582
|
+
* around it. Returns its top-left. Pure over its arguments.
|
|
583
|
+
*/
|
|
584
|
+
declare function freeSlot(extent: Size, occupied: readonly Rect[]): XY;
|
|
585
|
+
/** One dependency arrow, as `deriveEdges` emits it; `to_input` is the input
|
|
586
|
+
* the arrow lands on. */
|
|
499
587
|
type LayoutEdge = {
|
|
500
588
|
source_instance: string;
|
|
501
589
|
target_instance: string;
|
|
590
|
+
to_input?: string;
|
|
502
591
|
};
|
|
592
|
+
/** One thing the layout places: a card or a group's box, by its drawn
|
|
593
|
+
* extent, and where on it a wire lands for each of its inputs. */
|
|
594
|
+
type LayoutItem = {
|
|
595
|
+
id: string;
|
|
596
|
+
size: Size;
|
|
597
|
+
/** The y, from the item's top, a wire into `input` lands at. */
|
|
598
|
+
pinY?: (input: string) => number;
|
|
599
|
+
};
|
|
600
|
+
declare function resolveScopePositionsByDepth(ids: string[], arrangementNodes: CanvasArrangement[string]['nodes'], edges: readonly LayoutEdge[]): Map<string, XY>;
|
|
601
|
+
/**
|
|
602
|
+
* layoutByDepth places a scope's items — cards and group boxes, each by its
|
|
603
|
+
* drawn extent — and returns every item's top-left in the scope's frame.
|
|
604
|
+
*
|
|
605
|
+
* STORED POSITIONS, in one order. `stored` holds the positions the reader
|
|
606
|
+
* placed — a card's top-left, a group's box's — and they are honoured top to
|
|
607
|
+
* bottom by where each is drawn, then left to right, then in declaration
|
|
608
|
+
* order, groups and cards alike. One whose footprint overlaps none kept
|
|
609
|
+
* before it is kept where it is stored; one whose footprint would overlap one
|
|
610
|
+
* kept before it is placed at its stored position stepped down its column
|
|
611
|
+
* (`stepDown`), its slot just past the slots of what is in the way, so it
|
|
612
|
+
* keeps the layout's gap. Either way it counts as kept for every item after
|
|
613
|
+
* it, so a displacement cascades down in order: an item steps down only
|
|
614
|
+
* past what is kept before it — drawn above it, or level and to its left —
|
|
615
|
+
* never past what is drawn below it; nothing moves up, and nothing the
|
|
616
|
+
* reader placed is handed to the depth layout.
|
|
617
|
+
*
|
|
618
|
+
* EVERYTHING ELSE — the items with no stored position — by depth
|
|
619
|
+
* (`columnByDepth`): an item's column is its depth
|
|
620
|
+
* in the scope's dependency graph, so every edge points forward; a column is
|
|
621
|
+
* as wide as its widest item's slot (footprint plus a gap, at least
|
|
622
|
+
* SPACING_X × SPACING_Y), so a scope of ordinary cards lands on a 260 × 180
|
|
623
|
+
* grid. Columns are placed left to right. An item something feeds is centred
|
|
624
|
+
* on where what feeds it was placed; an item nothing feeds is ordered in its
|
|
625
|
+
* column by what it feeds — the mean height of the input pins its wires land
|
|
626
|
+
* on, after a provisional placement — so wires from one column into the next
|
|
627
|
+
* do not cross where they need not. Column-mates are stacked about their
|
|
628
|
+
* mean, and an item whose slot would overlap one already placed steps down
|
|
629
|
+
* its column. Pure over its arguments.
|
|
630
|
+
*/
|
|
631
|
+
declare function layoutByDepth(items: readonly LayoutItem[], stored: ReadonlyMap<string, XY>, edges: readonly LayoutEdge[]): Map<string, XY>;
|
|
503
632
|
|
|
633
|
+
type Frames = Pick<CanvasView$1, 'groups'>;
|
|
634
|
+
/** Where a group's box is drawn, from its members' origin and how far its
|
|
635
|
+
* members reach up and left of that origin (`min`, never above 0): the
|
|
636
|
+
* group's padding up and left of their top-left. With no reach it is the
|
|
637
|
+
* group's anchor. The one relation of a group's box, anchor and members'
|
|
638
|
+
* origin; `originAt` is its inverse. */
|
|
639
|
+
declare function boxAt(origin: XY, min?: XY): XY;
|
|
640
|
+
/** Where a group's members' frame starts, from where its box is drawn and
|
|
641
|
+
* how far its members reach up and left of their origin: `boxAt`'s
|
|
642
|
+
* inverse. From the group's anchor (no reach), its members' origin. */
|
|
643
|
+
declare function originAt(box: XY, min?: XY): XY;
|
|
644
|
+
/** Where the instance at `canvasPath` is drawn, in canvas coordinates: its
|
|
645
|
+
* card's top-left, or its group's box's; undefined when the view draws no
|
|
646
|
+
* such instance. */
|
|
647
|
+
declare function drawnAt(view: Pick<CanvasView$1, 'nodes' | 'groups'>, canvasPath: string): XY | undefined;
|
|
648
|
+
/** What the instance at `canvasPath` draws, in canvas coordinates: its
|
|
649
|
+
* card, or its group's card while collapsed and box while expanded
|
|
650
|
+
* (`groupFootprint`); undefined when the view draws no such instance. */
|
|
651
|
+
declare function drawnRect(view: Pick<CanvasView$1, 'nodes' | 'groups'>, canvasPath: string): Rect | undefined;
|
|
652
|
+
/** Everything the instance at `canvasPath` can draw from where it is drawn,
|
|
653
|
+
* in canvas coordinates: a card's rect, or a group's rect by its reach,
|
|
654
|
+
* collapsed or expanded alike (`groupReach`); undefined when the view draws
|
|
655
|
+
* no such instance. */
|
|
656
|
+
declare function reachRect(view: Pick<CanvasView$1, 'nodes' | 'groups'>, canvasPath: string): Rect | undefined;
|
|
657
|
+
/** Where the frame starts that the instance at `canvasPath` is stored in:
|
|
658
|
+
* its group's members' origin, or the canvas's (0,0) in the entry scope. */
|
|
659
|
+
declare function frameOf(view: Frames, canvasPath: string): XY;
|
|
660
|
+
/**
|
|
661
|
+
* The position to store for the instance at `canvasPath` drawn at `drawn` —
|
|
662
|
+
* its card's top-left, or its group box's, in canvas coordinates — measured
|
|
663
|
+
* from `frame`: by default the frame it is stored in now (`frameOf`); a
|
|
664
|
+
* Group or Ungroup passes the frame it moves into. A group's box reaches
|
|
665
|
+
* past its anchor by as much wherever it is drawn, so its anchor is `drawn`
|
|
666
|
+
* less that reach. The inverse of the projection's placement, so storing
|
|
667
|
+
* what is drawn draws it there again. Pure over its arguments.
|
|
668
|
+
*/
|
|
669
|
+
declare function localIn(view: Frames, canvasPath: string, drawn: XY, frame?: XY): XY;
|
|
670
|
+
|
|
671
|
+
declare function joinPath(prefix: string, localId: string): string;
|
|
504
672
|
declare function splitPath(canvasPath: string): {
|
|
505
673
|
parentPath: string;
|
|
506
674
|
localId: string;
|
|
@@ -513,6 +681,8 @@ type ParsedModuleKey = {
|
|
|
513
681
|
};
|
|
514
682
|
declare function parseModuleKey(key: string): ParsedModuleKey;
|
|
515
683
|
|
|
684
|
+
declare function groupPins(target: Module): Required<Pick<RenderGroup$1, 'inputs' | 'outputs'>>;
|
|
685
|
+
|
|
516
686
|
type InstanceChild = {
|
|
517
687
|
id: string;
|
|
518
688
|
use?: Use;
|
|
@@ -685,4 +855,4 @@ declare class EngineProtocolMismatchError extends Error {
|
|
|
685
855
|
*/
|
|
686
856
|
declare function checkEngineProtocol(engineVersion: string, engineProtocol: string): void;
|
|
687
857
|
|
|
688
|
-
export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, CONNECT_CODE_NAMES, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, type EngineMethod, EngineProtocolMismatchError, type EngineStreamMethod, type GeneratePhase, HOST_ONLY_METHODS, type HostOnlyMethod, type InstanceAddress, type InstanceChild, type MessageBridge, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type ScopedInstance, type SettingsConfig, type ViewportIntent, type XY, callText, checkEngineProtocol, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, instanceAddress, nodeIdForAddress, nodeIdForDiagnostic, parseModuleKey, projectCanvasView, resolveInstance, resolveScopePath,
|
|
858
|
+
export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, type EngineMethod, EngineProtocolMismatchError, type EngineStreamMethod, GROUP_HEADER_HEIGHT, GROUP_PADDING, type GeneratePhase, HOST_ONLY_METHODS, type HostOnlyMethod, type InstanceAddress, type InstanceChild, type KeepKey, type LayoutEdge, type LayoutItem, type MessageBridge, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type Rect, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type ScopedInstance, type SettingsConfig, type Size, type ViewportIntent, type XY, boxAt, callText, checkEngineProtocol, collapsedGroupSize, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, drawnAt, drawnRect, extentOf, frameOf, freeSlot, groupBoxSize, groupFootprint, groupInputPinY, groupPinY, groupPins, groupReach, inputPinY, instanceAddress, joinPath, keepOrder, layoutByDepth, localIn, nodeIdForAddress, nodeIdForDiagnostic, nodeRows, nodeSize, originAt, parseModuleKey, projectCanvasView, reachRect, resolveInstance, resolveScopePath, resolveScopePositionsByDepth, splitPath, stepDown, visibleInputs };
|
package/dist/index.d.ts
CHANGED
|
@@ -248,6 +248,80 @@ interface MessageFns$1<T> {
|
|
|
248
248
|
fromPartial<I extends Exact$1<DeepPartial$1<T>, I>>(object: I): T;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
type XY = {
|
|
252
|
+
x: number;
|
|
253
|
+
y: number;
|
|
254
|
+
};
|
|
255
|
+
type CanvasArrangement = {
|
|
256
|
+
[scopeKey: string]: {
|
|
257
|
+
nodes?: {
|
|
258
|
+
[childId: string]: XY;
|
|
259
|
+
};
|
|
260
|
+
groups?: {
|
|
261
|
+
[useId: string]: {
|
|
262
|
+
collapsed: boolean;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
/** A box's extent in flow units. */
|
|
269
|
+
type Size = {
|
|
270
|
+
width: number;
|
|
271
|
+
height: number;
|
|
272
|
+
};
|
|
273
|
+
/** A box in flow units: its top-left and its extent. */
|
|
274
|
+
type Rect = XY & Size;
|
|
275
|
+
declare const NODE_WIDTH = 200;
|
|
276
|
+
declare const NODE_HEADER_HEIGHT = 28;
|
|
277
|
+
declare const NODE_ROW_HEIGHT = 22;
|
|
278
|
+
/** A group's chrome around its members: the header chip above, a margin on
|
|
279
|
+
* the other three sides. */
|
|
280
|
+
declare const GROUP_PADDING: {
|
|
281
|
+
readonly x: 40;
|
|
282
|
+
readonly top: 60;
|
|
283
|
+
readonly bottom: 20;
|
|
284
|
+
};
|
|
285
|
+
declare const GROUP_HEADER_HEIGHT = 32;
|
|
286
|
+
declare const COLLAPSED_GROUP_WIDTH = 220;
|
|
287
|
+
/** The inputs a folded card draws: those it needs (required) and those a
|
|
288
|
+
* wire feeds; the rest fold behind "+N more". */
|
|
289
|
+
declare function visibleInputs(inputs: readonly NodePin$1[]): NodePin$1[];
|
|
290
|
+
/** How many pin rows a folded card draws: its visible inputs, plus one for
|
|
291
|
+
* "+N more" when some fold, against its outputs. */
|
|
292
|
+
declare function nodeRows(node: Pick<RenderNode$1, 'inputs' | 'outputs'>): number;
|
|
293
|
+
/** A module card's extent as ModuleNode draws it, folded. */
|
|
294
|
+
declare function nodeSize(node: Pick<RenderNode$1, 'inputs' | 'outputs'>): Size;
|
|
295
|
+
/** Where on a folded card an input's wire lands, from the card's top: the
|
|
296
|
+
* centre of its row, or of the header when the input is folded away. */
|
|
297
|
+
declare function inputPinY(node: Pick<RenderNode$1, 'inputs'>, name: string): number;
|
|
298
|
+
/** The extent of a set of boxes: the least box that holds them all; an
|
|
299
|
+
* empty one at the origin when there are none. A group's box is its
|
|
300
|
+
* content's extent with its padding (`groupBoxSize`). */
|
|
301
|
+
declare function extentOf(rects: readonly Rect[]): Rect;
|
|
302
|
+
/** A group's box around content of `content` extent: the header chip above,
|
|
303
|
+
* the padding beside and below. */
|
|
304
|
+
declare function groupBoxSize(content: Size): Size;
|
|
305
|
+
/** A collapsed group's card: its header, then its interface's pins
|
|
306
|
+
* (`groupPins`), inputs on the left rail and outputs on the right, a row
|
|
307
|
+
* per pin of the longer rail. */
|
|
308
|
+
declare function collapsedGroupSize(pins: Pick<RenderGroup$1, 'inputs' | 'outputs'>): Size;
|
|
309
|
+
/** Where on a collapsed group's card the pin of row `row` of either rail is
|
|
310
|
+
* centred, from the card's top. */
|
|
311
|
+
declare function groupPinY(row: number): number;
|
|
312
|
+
/** Where on a group an input's wire lands, from its top: the centre of the
|
|
313
|
+
* input's row on its collapsed card, or of its header while it is expanded
|
|
314
|
+
* or the input is not one of its interface's. */
|
|
315
|
+
declare function groupInputPinY(group: Pick<RenderGroup$1, 'collapsed' | 'inputs'>, name: string): number;
|
|
316
|
+
/** What a group draws: its card while collapsed; its `box` while expanded. */
|
|
317
|
+
declare function groupFootprint(group: Pick<RenderGroup$1, 'collapsed' | 'inputs' | 'outputs'>, box: Size): Size;
|
|
318
|
+
/** Everything a group can draw from one anchor, collapsed or expanded: the
|
|
319
|
+
* larger, in width and in height, of its card (from its interface's pins)
|
|
320
|
+
* and its `box`. A paste keeps a pasted group's reach clear of everything
|
|
321
|
+
* its scope draws; Group steps a fresh group's reach past what the layout
|
|
322
|
+
* keeps before it, and the layout steps what comes after it down past it. */
|
|
323
|
+
declare function groupReach(pins: Pick<RenderGroup$1, 'inputs' | 'outputs'>, box: Size): Size;
|
|
324
|
+
|
|
251
325
|
type CanvasView$1 = {
|
|
252
326
|
module_name: string;
|
|
253
327
|
nodes: RenderNode$1[];
|
|
@@ -271,6 +345,9 @@ type RenderGroup$1 = {
|
|
|
271
345
|
module_key?: string;
|
|
272
346
|
inputs?: NodePin$1[];
|
|
273
347
|
outputs?: NodePin$1[];
|
|
348
|
+
position: XY;
|
|
349
|
+
size: Size;
|
|
350
|
+
origin: XY;
|
|
274
351
|
};
|
|
275
352
|
type RenderNode$1 = {
|
|
276
353
|
id: string;
|
|
@@ -410,11 +487,11 @@ type ViewportIntent = {
|
|
|
410
487
|
|
|
411
488
|
declare function convertDiagnostic(d: ProtoDiagnosticLike): Diagnostic;
|
|
412
489
|
|
|
413
|
-
declare const ENGINE_METHODS: readonly ["Initialize", "
|
|
490
|
+
declare const ENGINE_METHODS: readonly ["Initialize", "SessionOpen", "TestSessionOpen", "SessionSave", "SessionClose", "SessionGenerate", "SessionResolveConflict", "ApplyAction", "ReadWiringCandidates", "CancelInvoke"];
|
|
414
491
|
declare const ENGINE_STREAM_METHODS: readonly ["Subscribe", "Invoke"];
|
|
415
492
|
type EngineMethod = (typeof ENGINE_METHODS)[number];
|
|
416
493
|
type EngineStreamMethod = (typeof ENGINE_STREAM_METHODS)[number];
|
|
417
|
-
declare const HOST_ONLY_METHODS: readonly ["TestSessionOpen"
|
|
494
|
+
declare const HOST_ONLY_METHODS: readonly ["TestSessionOpen"];
|
|
418
495
|
type HostOnlyMethod = (typeof HOST_ONLY_METHODS)[number];
|
|
419
496
|
type BridgeMethod = Exclude<EngineMethod, HostOnlyMethod>;
|
|
420
497
|
declare const BRIDGE_METHODS: BridgeMethod[];
|
|
@@ -464,24 +541,6 @@ declare function nodeIdForAddress(view: Pick<CanvasView$1, 'nodes' | 'groups'>,
|
|
|
464
541
|
|
|
465
542
|
declare function nodeIdForDiagnostic(view: Pick<CanvasView$1, 'nodes' | 'groups'>, diagnostic: Diagnostic): string | null;
|
|
466
543
|
|
|
467
|
-
type XY = {
|
|
468
|
-
x: number;
|
|
469
|
-
y: number;
|
|
470
|
-
};
|
|
471
|
-
type CanvasArrangement = {
|
|
472
|
-
[scopeKey: string]: {
|
|
473
|
-
nodes?: {
|
|
474
|
-
[childId: string]: XY;
|
|
475
|
-
};
|
|
476
|
-
groups?: {
|
|
477
|
-
[useId: string]: {
|
|
478
|
-
collapsed: boolean;
|
|
479
|
-
label?: string;
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
|
|
485
544
|
type ProjectionMeta = {
|
|
486
545
|
moduleName?: string;
|
|
487
546
|
canUndo: boolean;
|
|
@@ -493,14 +552,123 @@ type ProjectionMeta = {
|
|
|
493
552
|
declare const EMPTY_BUNDLE: Bundle;
|
|
494
553
|
declare function projectCanvasView(bundle: Bundle, arrangement: CanvasArrangement | undefined, meta: ProjectionMeta): CanvasView$1;
|
|
495
554
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
555
|
+
/**
|
|
556
|
+
* stepDown moves a box of `size` at `at` down its column, just past whatever
|
|
557
|
+
* of `taken` it would overlap, until it overlaps none: the x stays, the y
|
|
558
|
+
* moves to the lowest bottom of what is in the way. The layout steps a laid
|
|
559
|
+
* out item, and a stored one that would overlap what was kept before it,
|
|
560
|
+
* clear by it; a paste finds its free place by it; and Group steps a fresh
|
|
561
|
+
* group past what the layout keeps before it by it. Pure over its arguments.
|
|
562
|
+
*/
|
|
563
|
+
declare function stepDown(at: XY, size: Size, taken: readonly Rect[]): XY;
|
|
564
|
+
/** Where an item stands in its scope's keep order: where it is drawn — a
|
|
565
|
+
* card's top-left, a group's box's — and its place among the scope's
|
|
566
|
+
* declarations. */
|
|
567
|
+
type KeepKey = XY & {
|
|
568
|
+
declared: number;
|
|
569
|
+
};
|
|
570
|
+
/**
|
|
571
|
+
* keepOrder is the one order a scope's stored items are kept in: top to
|
|
572
|
+
* bottom by where each is drawn, then left to right, then as declared.
|
|
573
|
+
* Negative when `a` is kept before `b`. `layoutByDepth` keeps stored items in
|
|
574
|
+
* it, and Group reads what is kept before a fresh group by it.
|
|
575
|
+
*/
|
|
576
|
+
declare function keepOrder(a: KeepKey, b: KeepKey): number;
|
|
577
|
+
/**
|
|
578
|
+
* freeSlot finds where content of `extent` — a paste, as one cluster — can
|
|
579
|
+
* go in a scope that draws `occupied` (in the scope's own frame): the top of
|
|
580
|
+
* the scope's first column, stepped down (`stepDown`) until the extent's
|
|
581
|
+
* slot overlaps no occupied item's slot, so the layout's gap stays clear
|
|
582
|
+
* around it. Returns its top-left. Pure over its arguments.
|
|
583
|
+
*/
|
|
584
|
+
declare function freeSlot(extent: Size, occupied: readonly Rect[]): XY;
|
|
585
|
+
/** One dependency arrow, as `deriveEdges` emits it; `to_input` is the input
|
|
586
|
+
* the arrow lands on. */
|
|
499
587
|
type LayoutEdge = {
|
|
500
588
|
source_instance: string;
|
|
501
589
|
target_instance: string;
|
|
590
|
+
to_input?: string;
|
|
502
591
|
};
|
|
592
|
+
/** One thing the layout places: a card or a group's box, by its drawn
|
|
593
|
+
* extent, and where on it a wire lands for each of its inputs. */
|
|
594
|
+
type LayoutItem = {
|
|
595
|
+
id: string;
|
|
596
|
+
size: Size;
|
|
597
|
+
/** The y, from the item's top, a wire into `input` lands at. */
|
|
598
|
+
pinY?: (input: string) => number;
|
|
599
|
+
};
|
|
600
|
+
declare function resolveScopePositionsByDepth(ids: string[], arrangementNodes: CanvasArrangement[string]['nodes'], edges: readonly LayoutEdge[]): Map<string, XY>;
|
|
601
|
+
/**
|
|
602
|
+
* layoutByDepth places a scope's items — cards and group boxes, each by its
|
|
603
|
+
* drawn extent — and returns every item's top-left in the scope's frame.
|
|
604
|
+
*
|
|
605
|
+
* STORED POSITIONS, in one order. `stored` holds the positions the reader
|
|
606
|
+
* placed — a card's top-left, a group's box's — and they are honoured top to
|
|
607
|
+
* bottom by where each is drawn, then left to right, then in declaration
|
|
608
|
+
* order, groups and cards alike. One whose footprint overlaps none kept
|
|
609
|
+
* before it is kept where it is stored; one whose footprint would overlap one
|
|
610
|
+
* kept before it is placed at its stored position stepped down its column
|
|
611
|
+
* (`stepDown`), its slot just past the slots of what is in the way, so it
|
|
612
|
+
* keeps the layout's gap. Either way it counts as kept for every item after
|
|
613
|
+
* it, so a displacement cascades down in order: an item steps down only
|
|
614
|
+
* past what is kept before it — drawn above it, or level and to its left —
|
|
615
|
+
* never past what is drawn below it; nothing moves up, and nothing the
|
|
616
|
+
* reader placed is handed to the depth layout.
|
|
617
|
+
*
|
|
618
|
+
* EVERYTHING ELSE — the items with no stored position — by depth
|
|
619
|
+
* (`columnByDepth`): an item's column is its depth
|
|
620
|
+
* in the scope's dependency graph, so every edge points forward; a column is
|
|
621
|
+
* as wide as its widest item's slot (footprint plus a gap, at least
|
|
622
|
+
* SPACING_X × SPACING_Y), so a scope of ordinary cards lands on a 260 × 180
|
|
623
|
+
* grid. Columns are placed left to right. An item something feeds is centred
|
|
624
|
+
* on where what feeds it was placed; an item nothing feeds is ordered in its
|
|
625
|
+
* column by what it feeds — the mean height of the input pins its wires land
|
|
626
|
+
* on, after a provisional placement — so wires from one column into the next
|
|
627
|
+
* do not cross where they need not. Column-mates are stacked about their
|
|
628
|
+
* mean, and an item whose slot would overlap one already placed steps down
|
|
629
|
+
* its column. Pure over its arguments.
|
|
630
|
+
*/
|
|
631
|
+
declare function layoutByDepth(items: readonly LayoutItem[], stored: ReadonlyMap<string, XY>, edges: readonly LayoutEdge[]): Map<string, XY>;
|
|
503
632
|
|
|
633
|
+
type Frames = Pick<CanvasView$1, 'groups'>;
|
|
634
|
+
/** Where a group's box is drawn, from its members' origin and how far its
|
|
635
|
+
* members reach up and left of that origin (`min`, never above 0): the
|
|
636
|
+
* group's padding up and left of their top-left. With no reach it is the
|
|
637
|
+
* group's anchor. The one relation of a group's box, anchor and members'
|
|
638
|
+
* origin; `originAt` is its inverse. */
|
|
639
|
+
declare function boxAt(origin: XY, min?: XY): XY;
|
|
640
|
+
/** Where a group's members' frame starts, from where its box is drawn and
|
|
641
|
+
* how far its members reach up and left of their origin: `boxAt`'s
|
|
642
|
+
* inverse. From the group's anchor (no reach), its members' origin. */
|
|
643
|
+
declare function originAt(box: XY, min?: XY): XY;
|
|
644
|
+
/** Where the instance at `canvasPath` is drawn, in canvas coordinates: its
|
|
645
|
+
* card's top-left, or its group's box's; undefined when the view draws no
|
|
646
|
+
* such instance. */
|
|
647
|
+
declare function drawnAt(view: Pick<CanvasView$1, 'nodes' | 'groups'>, canvasPath: string): XY | undefined;
|
|
648
|
+
/** What the instance at `canvasPath` draws, in canvas coordinates: its
|
|
649
|
+
* card, or its group's card while collapsed and box while expanded
|
|
650
|
+
* (`groupFootprint`); undefined when the view draws no such instance. */
|
|
651
|
+
declare function drawnRect(view: Pick<CanvasView$1, 'nodes' | 'groups'>, canvasPath: string): Rect | undefined;
|
|
652
|
+
/** Everything the instance at `canvasPath` can draw from where it is drawn,
|
|
653
|
+
* in canvas coordinates: a card's rect, or a group's rect by its reach,
|
|
654
|
+
* collapsed or expanded alike (`groupReach`); undefined when the view draws
|
|
655
|
+
* no such instance. */
|
|
656
|
+
declare function reachRect(view: Pick<CanvasView$1, 'nodes' | 'groups'>, canvasPath: string): Rect | undefined;
|
|
657
|
+
/** Where the frame starts that the instance at `canvasPath` is stored in:
|
|
658
|
+
* its group's members' origin, or the canvas's (0,0) in the entry scope. */
|
|
659
|
+
declare function frameOf(view: Frames, canvasPath: string): XY;
|
|
660
|
+
/**
|
|
661
|
+
* The position to store for the instance at `canvasPath` drawn at `drawn` —
|
|
662
|
+
* its card's top-left, or its group box's, in canvas coordinates — measured
|
|
663
|
+
* from `frame`: by default the frame it is stored in now (`frameOf`); a
|
|
664
|
+
* Group or Ungroup passes the frame it moves into. A group's box reaches
|
|
665
|
+
* past its anchor by as much wherever it is drawn, so its anchor is `drawn`
|
|
666
|
+
* less that reach. The inverse of the projection's placement, so storing
|
|
667
|
+
* what is drawn draws it there again. Pure over its arguments.
|
|
668
|
+
*/
|
|
669
|
+
declare function localIn(view: Frames, canvasPath: string, drawn: XY, frame?: XY): XY;
|
|
670
|
+
|
|
671
|
+
declare function joinPath(prefix: string, localId: string): string;
|
|
504
672
|
declare function splitPath(canvasPath: string): {
|
|
505
673
|
parentPath: string;
|
|
506
674
|
localId: string;
|
|
@@ -513,6 +681,8 @@ type ParsedModuleKey = {
|
|
|
513
681
|
};
|
|
514
682
|
declare function parseModuleKey(key: string): ParsedModuleKey;
|
|
515
683
|
|
|
684
|
+
declare function groupPins(target: Module): Required<Pick<RenderGroup$1, 'inputs' | 'outputs'>>;
|
|
685
|
+
|
|
516
686
|
type InstanceChild = {
|
|
517
687
|
id: string;
|
|
518
688
|
use?: Use;
|
|
@@ -685,4 +855,4 @@ declare class EngineProtocolMismatchError extends Error {
|
|
|
685
855
|
*/
|
|
686
856
|
declare function checkEngineProtocol(engineVersion: string, engineProtocol: string): void;
|
|
687
857
|
|
|
688
|
-
export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, CONNECT_CODE_NAMES, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, type EngineMethod, EngineProtocolMismatchError, type EngineStreamMethod, type GeneratePhase, HOST_ONLY_METHODS, type HostOnlyMethod, type InstanceAddress, type InstanceChild, type MessageBridge, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type ScopedInstance, type SettingsConfig, type ViewportIntent, type XY, callText, checkEngineProtocol, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, instanceAddress, nodeIdForAddress, nodeIdForDiagnostic, parseModuleKey, projectCanvasView, resolveInstance, resolveScopePath,
|
|
858
|
+
export { BRIDGE_METHODS, type BridgeMethod, type BridgeRequest, type BridgeResponse, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, type CanvasArrangement, type CanvasView$1 as CanvasView, CanvasViewProto, type Conflict, type DeepPartial$1 as DeepPartial, type Diagnostic, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, type EngineMethod, EngineProtocolMismatchError, type EngineStreamMethod, GROUP_HEADER_HEIGHT, GROUP_PADDING, type GeneratePhase, HOST_ONLY_METHODS, type HostOnlyMethod, type InstanceAddress, type InstanceChild, type KeepKey, type LayoutEdge, type LayoutItem, type MessageBridge, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, type NodeConfig, type NodePin$1 as NodePin, type ParsedModuleKey, type ProjectionMeta, type ProtoDiagnosticLike, type Rect, type RenderEdge$1 as RenderEdge, type RenderGroup$1 as RenderGroup, type RenderInput, type RenderNode$1 as RenderNode, type RenderOutput, type ScopedInstance, type SettingsConfig, type Size, type ViewportIntent, type XY, boxAt, callText, checkEngineProtocol, collapsedGroupSize, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, drawnAt, drawnRect, extentOf, frameOf, freeSlot, groupBoxSize, groupFootprint, groupInputPinY, groupPinY, groupPins, groupReach, inputPinY, instanceAddress, joinPath, keepOrder, layoutByDepth, localIn, nodeIdForAddress, nodeIdForDiagnostic, nodeRows, nodeSize, originAt, parseModuleKey, projectCanvasView, reachRect, resolveInstance, resolveScopePath, resolveScopePositionsByDepth, splitPath, stepDown, visibleInputs };
|