@lace-cloud/proto 0.32.1 → 0.34.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.d.mts CHANGED
@@ -75,9 +75,10 @@ declare function collapsedGroupSize(pins: Pick<RenderGroup$1, 'inputs' | 'output
75
75
  * centred, from the card's top. */
76
76
  declare function groupPinY(row: number): number;
77
77
  /** Where on a group an input's wire lands, from its top: the centre of the
78
- * input's row on its collapsed card, or of its header while it is expanded
79
- * or the input is not one of its interface's. */
80
- declare function groupInputPinY(group: Pick<RenderGroup$1, 'collapsed' | 'inputs'>, name: string): number;
78
+ * input's row, which the group draws at the same height collapsed or
79
+ * expanded, or of its header when the input is not one of its interface's
80
+ * (a meta-argument). */
81
+ declare function groupInputPinY(group: Pick<RenderGroup$1, 'inputs'>, name: string): number;
81
82
  /** What a group draws: its card while collapsed; its `box` while expanded. */
82
83
  declare function groupFootprint(group: Pick<RenderGroup$1, 'collapsed' | 'inputs' | 'outputs'>, box: Size): Size;
83
84
  /** Everything a group can draw from one anchor, collapsed or expanded: the
@@ -113,6 +114,8 @@ type RenderGroup$1 = {
113
114
  position: XY;
114
115
  size: Size;
115
116
  origin: XY;
117
+ call_wired?: boolean;
118
+ meta_wired?: MetaArgument[];
116
119
  };
117
120
  type RenderNode$1 = {
118
121
  id: string;
@@ -127,7 +130,10 @@ type RenderNode$1 = {
127
130
  inputs: NodePin$1[];
128
131
  outputs: NodePin$1[];
129
132
  call_wired?: boolean;
133
+ meta_wired?: MetaArgument[];
130
134
  };
135
+ declare const META_ARGUMENTS: readonly ["count", "for_each"];
136
+ type MetaArgument = (typeof META_ARGUMENTS)[number];
131
137
  type NodePin$1 = {
132
138
  name: string;
133
139
  type: string;
@@ -1041,5 +1047,5 @@ declare class EngineProtocolMismatchError extends Error {
1041
1047
  */
1042
1048
  declare function checkEngineProtocol(engineVersion: string, engineProtocol: string): void;
1043
1049
 
1044
- export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineProtocolMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, 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 };
1045
- export type { BlockConfig, BridgeMethod, BridgeRequest, BridgeResponse, CanvasArrangement, CanvasView$1 as CanvasView, Conflict, DeepPartial$1 as DeepPartial, Diagnostic, EngineMethod, EngineStreamMethod, HostOnlyMethod, InstanceAddress, InstanceChild, KeepKey, LayoutEdge, LayoutItem, MessageBridge, NodeConfig, NodePin$1 as NodePin, ParsedModuleKey, ProjectionMeta, ProtoDiagnosticLike, Rect, RenderEdge$1 as RenderEdge, RenderGroup$1 as RenderGroup, RenderInput, RenderNode$1 as RenderNode, RenderOutput, ResourceConfig, ScopedInstance, SettingsConfig, Size, ViewportIntent, XY };
1050
+ export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineProtocolMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, META_ARGUMENTS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, 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 };
1051
+ export type { BlockConfig, BridgeMethod, BridgeRequest, BridgeResponse, CanvasArrangement, CanvasView$1 as CanvasView, Conflict, DeepPartial$1 as DeepPartial, Diagnostic, EngineMethod, EngineStreamMethod, HostOnlyMethod, InstanceAddress, InstanceChild, KeepKey, LayoutEdge, LayoutItem, MessageBridge, MetaArgument, NodeConfig, NodePin$1 as NodePin, ParsedModuleKey, ProjectionMeta, ProtoDiagnosticLike, Rect, RenderEdge$1 as RenderEdge, RenderGroup$1 as RenderGroup, RenderInput, RenderNode$1 as RenderNode, RenderOutput, ResourceConfig, ScopedInstance, SettingsConfig, Size, ViewportIntent, XY };
package/dist/index.d.ts CHANGED
@@ -75,9 +75,10 @@ declare function collapsedGroupSize(pins: Pick<RenderGroup$1, 'inputs' | 'output
75
75
  * centred, from the card's top. */
76
76
  declare function groupPinY(row: number): number;
77
77
  /** Where on a group an input's wire lands, from its top: the centre of the
78
- * input's row on its collapsed card, or of its header while it is expanded
79
- * or the input is not one of its interface's. */
80
- declare function groupInputPinY(group: Pick<RenderGroup$1, 'collapsed' | 'inputs'>, name: string): number;
78
+ * input's row, which the group draws at the same height collapsed or
79
+ * expanded, or of its header when the input is not one of its interface's
80
+ * (a meta-argument). */
81
+ declare function groupInputPinY(group: Pick<RenderGroup$1, 'inputs'>, name: string): number;
81
82
  /** What a group draws: its card while collapsed; its `box` while expanded. */
82
83
  declare function groupFootprint(group: Pick<RenderGroup$1, 'collapsed' | 'inputs' | 'outputs'>, box: Size): Size;
83
84
  /** Everything a group can draw from one anchor, collapsed or expanded: the
@@ -113,6 +114,8 @@ type RenderGroup$1 = {
113
114
  position: XY;
114
115
  size: Size;
115
116
  origin: XY;
117
+ call_wired?: boolean;
118
+ meta_wired?: MetaArgument[];
116
119
  };
117
120
  type RenderNode$1 = {
118
121
  id: string;
@@ -127,7 +130,10 @@ type RenderNode$1 = {
127
130
  inputs: NodePin$1[];
128
131
  outputs: NodePin$1[];
129
132
  call_wired?: boolean;
133
+ meta_wired?: MetaArgument[];
130
134
  };
135
+ declare const META_ARGUMENTS: readonly ["count", "for_each"];
136
+ type MetaArgument = (typeof META_ARGUMENTS)[number];
131
137
  type NodePin$1 = {
132
138
  name: string;
133
139
  type: string;
@@ -1041,5 +1047,5 @@ declare class EngineProtocolMismatchError extends Error {
1041
1047
  */
1042
1048
  declare function checkEngineProtocol(engineVersion: string, engineProtocol: string): void;
1043
1049
 
1044
- export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineProtocolMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, 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 };
1045
- export type { BlockConfig, BridgeMethod, BridgeRequest, BridgeResponse, CanvasArrangement, CanvasView$1 as CanvasView, Conflict, DeepPartial$1 as DeepPartial, Diagnostic, EngineMethod, EngineStreamMethod, HostOnlyMethod, InstanceAddress, InstanceChild, KeepKey, LayoutEdge, LayoutItem, MessageBridge, NodeConfig, NodePin$1 as NodePin, ParsedModuleKey, ProjectionMeta, ProtoDiagnosticLike, Rect, RenderEdge$1 as RenderEdge, RenderGroup$1 as RenderGroup, RenderInput, RenderNode$1 as RenderNode, RenderOutput, ResourceConfig, ScopedInstance, SettingsConfig, Size, ViewportIntent, XY };
1050
+ export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineProtocolMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, META_ARGUMENTS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, 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 };
1051
+ export type { BlockConfig, BridgeMethod, BridgeRequest, BridgeResponse, CanvasArrangement, CanvasView$1 as CanvasView, Conflict, DeepPartial$1 as DeepPartial, Diagnostic, EngineMethod, EngineStreamMethod, HostOnlyMethod, InstanceAddress, InstanceChild, KeepKey, LayoutEdge, LayoutItem, MessageBridge, MetaArgument, NodeConfig, NodePin$1 as NodePin, ParsedModuleKey, ProjectionMeta, ProtoDiagnosticLike, Rect, RenderEdge$1 as RenderEdge, RenderGroup$1 as RenderGroup, RenderInput, RenderNode$1 as RenderNode, RenderOutput, ResourceConfig, ScopedInstance, SettingsConfig, Size, ViewportIntent, XY };
package/dist/index.mjs CHANGED
@@ -3301,6 +3301,9 @@ function isSet2(value) {
3301
3301
  return value !== null && value !== void 0;
3302
3302
  }
3303
3303
 
3304
+ // src/render.ts
3305
+ var META_ARGUMENTS = ["count", "for_each"];
3306
+
3304
3307
  // src/projection/derive-edges.ts
3305
3308
  function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
3306
3309
  if (binding.out?.module && binding.out.name) {
@@ -3335,11 +3338,9 @@ function deriveEdges(uses) {
3335
3338
  for (const [inputName, binding] of Object.entries(inputs)) {
3336
3339
  emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
3337
3340
  }
3338
- if (target.count) {
3339
- emitEdgesFromBinding(target.count, target.id, "count", useIds, seen, edges);
3340
- }
3341
- if (target.for_each) {
3342
- emitEdgesFromBinding(target.for_each, target.id, "for_each", useIds, seen, edges);
3341
+ for (const meta of META_ARGUMENTS) {
3342
+ const binding = target[meta];
3343
+ if (binding) emitEdgesFromBinding(binding, target.id, meta, useIds, seen, edges);
3343
3344
  }
3344
3345
  }
3345
3346
  return edges;
@@ -3355,6 +3356,12 @@ function indexWires(edges) {
3355
3356
  }
3356
3357
  return { inputs, outputs };
3357
3358
  }
3359
+ function callWires(wiredIn, wiredOut) {
3360
+ return {
3361
+ call_wired: wiredOut.has(""),
3362
+ meta_wired: META_ARGUMENTS.filter((meta) => wiredIn.has(meta))
3363
+ };
3364
+ }
3358
3365
 
3359
3366
  // src/projection/resolve-schema.ts
3360
3367
  function resolveSchema(bundle, use, readOutputs) {
@@ -3791,7 +3798,7 @@ function groupPinY(row) {
3791
3798
  return GROUP_HEADER_HEIGHT + (row + 0.5) * NODE_ROW_HEIGHT;
3792
3799
  }
3793
3800
  function groupInputPinY(group, name) {
3794
- const row = group.collapsed ? (group.inputs ?? []).findIndex((pin) => pin.name === name) : -1;
3801
+ const row = (group.inputs ?? []).findIndex((pin) => pin.name === name);
3795
3802
  return row < 0 ? GROUP_HEADER_HEIGHT / 2 : groupPinY(row);
3796
3803
  }
3797
3804
  function groupFootprint(group, box) {
@@ -4035,7 +4042,7 @@ function columnByDepth(ids, edges) {
4035
4042
  }
4036
4043
 
4037
4044
  // src/projection/project-group.ts
4038
- function projectGroup(use, target, fullId, parentArrangement) {
4045
+ function projectGroup(use, target, fullId, parentArrangement, wiredIn, wiredOut) {
4039
4046
  const childIds = (target.modules ?? []).map((u) => joinPath(fullId, u.id));
4040
4047
  const parentGroup = parentArrangement?.groups?.[use.id];
4041
4048
  const collapsed = parentGroup ? parentGroup.collapsed : true;
@@ -4045,7 +4052,8 @@ function projectGroup(use, target, fullId, parentArrangement) {
4045
4052
  node_ids: childIds,
4046
4053
  collapsed,
4047
4054
  module_key: use.module,
4048
- ...groupPins(target)
4055
+ ...groupPins(target),
4056
+ ...callWires(wiredIn, wiredOut)
4049
4057
  };
4050
4058
  }
4051
4059
  function groupPins(target) {
@@ -4087,7 +4095,7 @@ function projectNode(bundle, use, fullId, wiredIn, wiredOut) {
4087
4095
  description: out.description,
4088
4096
  sensitive: out.sensitive
4089
4097
  })),
4090
- call_wired: wiredOut.has("")
4098
+ ...callWires(wiredIn, wiredOut)
4091
4099
  };
4092
4100
  }
4093
4101
 
@@ -4104,7 +4112,14 @@ function projectScope(bundle, mod, use, path, arrangement, children) {
4104
4112
  for (const child of uses) {
4105
4113
  const fullId = joinPath(path, child.id);
4106
4114
  if (isGroupUse(bundle, child)) {
4107
- const group = projectGroup(child, bundle.modules[child.module], fullId, scopeArrangement);
4115
+ const group = projectGroup(
4116
+ child,
4117
+ bundle.modules[child.module],
4118
+ fullId,
4119
+ scopeArrangement,
4120
+ wiredIn.get(child.id) ?? /* @__PURE__ */ new Set(),
4121
+ wiredOut.get(child.id) ?? /* @__PURE__ */ new Set()
4122
+ );
4108
4123
  const content = children.get(fullId);
4109
4124
  if (!content) throw new Error(`projectScope: no layout for group "${fullId}"`);
4110
4125
  groups.push(group);
@@ -5070,6 +5085,7 @@ export {
5070
5085
  GROUP_HEADER_HEIGHT,
5071
5086
  GROUP_PADDING,
5072
5087
  HOST_ONLY_METHODS,
5088
+ META_ARGUMENTS,
5073
5089
  NODE_HEADER_HEIGHT,
5074
5090
  NODE_ROW_HEIGHT,
5075
5091
  NODE_WIDTH,