@lace-cloud/canvas 0.31.2 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -105,6 +105,7 @@ __export(index_exports, {
105
105
  useCanvas: () => useCanvas,
106
106
  useCanvasSource: () => useCanvasSource,
107
107
  useCommandRead: () => useCommandRead,
108
+ useEditing: () => useEditing,
108
109
  usePanelScope: () => usePanelScope
109
110
  });
110
111
  module.exports = __toCommonJS(index_exports);
@@ -112,8 +113,8 @@ var import_proto17 = require("@lace-cloud/proto");
112
113
  var import_feedback = require("@lace-cloud/ui/feedback");
113
114
 
114
115
  // src/App.tsx
115
- var import_react40 = require("@xyflow/react");
116
- var import_react41 = require("react");
116
+ var import_react41 = require("@xyflow/react");
117
+ var import_react42 = require("react");
117
118
  var import_App = require("./App-IFIOMNV7.css");
118
119
 
119
120
  // src/Canvas.tsx
@@ -2036,6 +2037,165 @@ var import_proto8 = require("@lace-cloud/proto");
2036
2037
  // src/ports.ts
2037
2038
  var import_proto7 = require("@lace-cloud/proto");
2038
2039
 
2040
+ // src/generated/reason.ts
2041
+ var Reason = /* @__PURE__ */ ((Reason3) => {
2042
+ Reason3[Reason3["REASON_UNSPECIFIED"] = 0] = "REASON_UNSPECIFIED";
2043
+ Reason3[Reason3["REASON_NOT_LACE_FORM"] = 1] = "REASON_NOT_LACE_FORM";
2044
+ Reason3[Reason3["REASON_HASH_MISMATCH"] = 2] = "REASON_HASH_MISMATCH";
2045
+ Reason3[Reason3["REASON_REGISTRY_UNAVAILABLE"] = 3] = "REASON_REGISTRY_UNAVAILABLE";
2046
+ Reason3[Reason3["REASON_ROOT_LOCKED"] = 4] = "REASON_ROOT_LOCKED";
2047
+ Reason3[Reason3["REASON_UNSAVED"] = 5] = "REASON_UNSAVED";
2048
+ Reason3[Reason3["REASON_CONFLICT"] = 6] = "REASON_CONFLICT";
2049
+ Reason3[Reason3["REASON_SOURCE_REFUSED"] = 7] = "REASON_SOURCE_REFUSED";
2050
+ Reason3[Reason3["REASON_NOT_GIT_REPOSITORY"] = 8] = "REASON_NOT_GIT_REPOSITORY";
2051
+ Reason3[Reason3["REASON_GENERATE_IN_PROGRESS"] = 9] = "REASON_GENERATE_IN_PROGRESS";
2052
+ Reason3[Reason3["REASON_NO_ORGANIZATION"] = 10] = "REASON_NO_ORGANIZATION";
2053
+ Reason3[Reason3["REASON_NO_TEAM"] = 11] = "REASON_NO_TEAM";
2054
+ Reason3[Reason3["REASON_NO_CERTIFICATION"] = 12] = "REASON_NO_CERTIFICATION";
2055
+ Reason3[Reason3["REASON_STALE_CERTIFICATION"] = 13] = "REASON_STALE_CERTIFICATION";
2056
+ Reason3[Reason3["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
2057
+ Reason3[Reason3["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
2058
+ Reason3[Reason3["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
2059
+ Reason3[Reason3["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
2060
+ Reason3[Reason3["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
2061
+ Reason3[Reason3["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
2062
+ Reason3[Reason3["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
2063
+ Reason3[Reason3["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
2064
+ Reason3[Reason3["REASON_NO_LOCKFILE"] = 22] = "REASON_NO_LOCKFILE";
2065
+ Reason3[Reason3["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
2066
+ return Reason3;
2067
+ })(Reason || {});
2068
+ function reasonFromJSON(object) {
2069
+ switch (object) {
2070
+ case 0:
2071
+ case "REASON_UNSPECIFIED":
2072
+ return 0 /* REASON_UNSPECIFIED */;
2073
+ case 1:
2074
+ case "REASON_NOT_LACE_FORM":
2075
+ return 1 /* REASON_NOT_LACE_FORM */;
2076
+ case 2:
2077
+ case "REASON_HASH_MISMATCH":
2078
+ return 2 /* REASON_HASH_MISMATCH */;
2079
+ case 3:
2080
+ case "REASON_REGISTRY_UNAVAILABLE":
2081
+ return 3 /* REASON_REGISTRY_UNAVAILABLE */;
2082
+ case 4:
2083
+ case "REASON_ROOT_LOCKED":
2084
+ return 4 /* REASON_ROOT_LOCKED */;
2085
+ case 5:
2086
+ case "REASON_UNSAVED":
2087
+ return 5 /* REASON_UNSAVED */;
2088
+ case 6:
2089
+ case "REASON_CONFLICT":
2090
+ return 6 /* REASON_CONFLICT */;
2091
+ case 7:
2092
+ case "REASON_SOURCE_REFUSED":
2093
+ return 7 /* REASON_SOURCE_REFUSED */;
2094
+ case 8:
2095
+ case "REASON_NOT_GIT_REPOSITORY":
2096
+ return 8 /* REASON_NOT_GIT_REPOSITORY */;
2097
+ case 9:
2098
+ case "REASON_GENERATE_IN_PROGRESS":
2099
+ return 9 /* REASON_GENERATE_IN_PROGRESS */;
2100
+ case 10:
2101
+ case "REASON_NO_ORGANIZATION":
2102
+ return 10 /* REASON_NO_ORGANIZATION */;
2103
+ case 11:
2104
+ case "REASON_NO_TEAM":
2105
+ return 11 /* REASON_NO_TEAM */;
2106
+ case 12:
2107
+ case "REASON_NO_CERTIFICATION":
2108
+ return 12 /* REASON_NO_CERTIFICATION */;
2109
+ case 13:
2110
+ case "REASON_STALE_CERTIFICATION":
2111
+ return 13 /* REASON_STALE_CERTIFICATION */;
2112
+ case 14:
2113
+ case "REASON_TOOL_MISSING":
2114
+ return 14 /* REASON_TOOL_MISSING */;
2115
+ case 15:
2116
+ case "REASON_CROSS_SCOPE":
2117
+ return 15 /* REASON_CROSS_SCOPE */;
2118
+ case 16:
2119
+ case "REASON_UNAUTHENTICATED":
2120
+ return 16 /* REASON_UNAUTHENTICATED */;
2121
+ case 17:
2122
+ case "REASON_IMPORT_RESIDUAL":
2123
+ return 17 /* REASON_IMPORT_RESIDUAL */;
2124
+ case 18:
2125
+ case "REASON_STACK_HAS_STATE":
2126
+ return 18 /* REASON_STACK_HAS_STATE */;
2127
+ case 19:
2128
+ case "REASON_NO_ORIGIN_REMOTE":
2129
+ return 19 /* REASON_NO_ORIGIN_REMOTE */;
2130
+ case 20:
2131
+ case "REASON_IMPORT_UNDECLARED":
2132
+ return 20 /* REASON_IMPORT_UNDECLARED */;
2133
+ case 21:
2134
+ case "REASON_ALREADY_IMPORTED":
2135
+ return 21 /* REASON_ALREADY_IMPORTED */;
2136
+ case 22:
2137
+ case "REASON_NO_LOCKFILE":
2138
+ return 22 /* REASON_NO_LOCKFILE */;
2139
+ case -1:
2140
+ case "UNRECOGNIZED":
2141
+ default:
2142
+ return -1 /* UNRECOGNIZED */;
2143
+ }
2144
+ }
2145
+ function reasonToJSON(object) {
2146
+ switch (object) {
2147
+ case 0 /* REASON_UNSPECIFIED */:
2148
+ return "REASON_UNSPECIFIED";
2149
+ case 1 /* REASON_NOT_LACE_FORM */:
2150
+ return "REASON_NOT_LACE_FORM";
2151
+ case 2 /* REASON_HASH_MISMATCH */:
2152
+ return "REASON_HASH_MISMATCH";
2153
+ case 3 /* REASON_REGISTRY_UNAVAILABLE */:
2154
+ return "REASON_REGISTRY_UNAVAILABLE";
2155
+ case 4 /* REASON_ROOT_LOCKED */:
2156
+ return "REASON_ROOT_LOCKED";
2157
+ case 5 /* REASON_UNSAVED */:
2158
+ return "REASON_UNSAVED";
2159
+ case 6 /* REASON_CONFLICT */:
2160
+ return "REASON_CONFLICT";
2161
+ case 7 /* REASON_SOURCE_REFUSED */:
2162
+ return "REASON_SOURCE_REFUSED";
2163
+ case 8 /* REASON_NOT_GIT_REPOSITORY */:
2164
+ return "REASON_NOT_GIT_REPOSITORY";
2165
+ case 9 /* REASON_GENERATE_IN_PROGRESS */:
2166
+ return "REASON_GENERATE_IN_PROGRESS";
2167
+ case 10 /* REASON_NO_ORGANIZATION */:
2168
+ return "REASON_NO_ORGANIZATION";
2169
+ case 11 /* REASON_NO_TEAM */:
2170
+ return "REASON_NO_TEAM";
2171
+ case 12 /* REASON_NO_CERTIFICATION */:
2172
+ return "REASON_NO_CERTIFICATION";
2173
+ case 13 /* REASON_STALE_CERTIFICATION */:
2174
+ return "REASON_STALE_CERTIFICATION";
2175
+ case 14 /* REASON_TOOL_MISSING */:
2176
+ return "REASON_TOOL_MISSING";
2177
+ case 15 /* REASON_CROSS_SCOPE */:
2178
+ return "REASON_CROSS_SCOPE";
2179
+ case 16 /* REASON_UNAUTHENTICATED */:
2180
+ return "REASON_UNAUTHENTICATED";
2181
+ case 17 /* REASON_IMPORT_RESIDUAL */:
2182
+ return "REASON_IMPORT_RESIDUAL";
2183
+ case 18 /* REASON_STACK_HAS_STATE */:
2184
+ return "REASON_STACK_HAS_STATE";
2185
+ case 19 /* REASON_NO_ORIGIN_REMOTE */:
2186
+ return "REASON_NO_ORIGIN_REMOTE";
2187
+ case 20 /* REASON_IMPORT_UNDECLARED */:
2188
+ return "REASON_IMPORT_UNDECLARED";
2189
+ case 21 /* REASON_ALREADY_IMPORTED */:
2190
+ return "REASON_ALREADY_IMPORTED";
2191
+ case 22 /* REASON_NO_LOCKFILE */:
2192
+ return "REASON_NO_LOCKFILE";
2193
+ case -1 /* UNRECOGNIZED */:
2194
+ default:
2195
+ return "UNRECOGNIZED";
2196
+ }
2197
+ }
2198
+
2039
2199
  // src/generated/service.ts
2040
2200
  var import_wire4 = require("@bufbuild/protobuf/wire");
2041
2201
 
@@ -5389,163 +5549,6 @@ function diagnosticSeverityToJSON(object) {
5389
5549
  return "UNRECOGNIZED";
5390
5550
  }
5391
5551
  }
5392
- var Reason = /* @__PURE__ */ ((Reason2) => {
5393
- Reason2[Reason2["REASON_UNSPECIFIED"] = 0] = "REASON_UNSPECIFIED";
5394
- Reason2[Reason2["REASON_NOT_LACE_FORM"] = 1] = "REASON_NOT_LACE_FORM";
5395
- Reason2[Reason2["REASON_HASH_MISMATCH"] = 2] = "REASON_HASH_MISMATCH";
5396
- Reason2[Reason2["REASON_REGISTRY_UNAVAILABLE"] = 3] = "REASON_REGISTRY_UNAVAILABLE";
5397
- Reason2[Reason2["REASON_ROOT_LOCKED"] = 4] = "REASON_ROOT_LOCKED";
5398
- Reason2[Reason2["REASON_UNSAVED"] = 5] = "REASON_UNSAVED";
5399
- Reason2[Reason2["REASON_CONFLICT"] = 6] = "REASON_CONFLICT";
5400
- Reason2[Reason2["REASON_SOURCE_REFUSED"] = 7] = "REASON_SOURCE_REFUSED";
5401
- Reason2[Reason2["REASON_NOT_GIT_REPOSITORY"] = 8] = "REASON_NOT_GIT_REPOSITORY";
5402
- Reason2[Reason2["REASON_GENERATE_IN_PROGRESS"] = 9] = "REASON_GENERATE_IN_PROGRESS";
5403
- Reason2[Reason2["REASON_NO_ORGANIZATION"] = 10] = "REASON_NO_ORGANIZATION";
5404
- Reason2[Reason2["REASON_NO_TEAM"] = 11] = "REASON_NO_TEAM";
5405
- Reason2[Reason2["REASON_NO_CERTIFICATION"] = 12] = "REASON_NO_CERTIFICATION";
5406
- Reason2[Reason2["REASON_STALE_CERTIFICATION"] = 13] = "REASON_STALE_CERTIFICATION";
5407
- Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
5408
- Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
5409
- Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
5410
- Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
5411
- Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
5412
- Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
5413
- Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
5414
- Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
5415
- Reason2[Reason2["REASON_NO_LOCKFILE"] = 22] = "REASON_NO_LOCKFILE";
5416
- Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
5417
- return Reason2;
5418
- })(Reason || {});
5419
- function reasonFromJSON(object) {
5420
- switch (object) {
5421
- case 0:
5422
- case "REASON_UNSPECIFIED":
5423
- return 0 /* REASON_UNSPECIFIED */;
5424
- case 1:
5425
- case "REASON_NOT_LACE_FORM":
5426
- return 1 /* REASON_NOT_LACE_FORM */;
5427
- case 2:
5428
- case "REASON_HASH_MISMATCH":
5429
- return 2 /* REASON_HASH_MISMATCH */;
5430
- case 3:
5431
- case "REASON_REGISTRY_UNAVAILABLE":
5432
- return 3 /* REASON_REGISTRY_UNAVAILABLE */;
5433
- case 4:
5434
- case "REASON_ROOT_LOCKED":
5435
- return 4 /* REASON_ROOT_LOCKED */;
5436
- case 5:
5437
- case "REASON_UNSAVED":
5438
- return 5 /* REASON_UNSAVED */;
5439
- case 6:
5440
- case "REASON_CONFLICT":
5441
- return 6 /* REASON_CONFLICT */;
5442
- case 7:
5443
- case "REASON_SOURCE_REFUSED":
5444
- return 7 /* REASON_SOURCE_REFUSED */;
5445
- case 8:
5446
- case "REASON_NOT_GIT_REPOSITORY":
5447
- return 8 /* REASON_NOT_GIT_REPOSITORY */;
5448
- case 9:
5449
- case "REASON_GENERATE_IN_PROGRESS":
5450
- return 9 /* REASON_GENERATE_IN_PROGRESS */;
5451
- case 10:
5452
- case "REASON_NO_ORGANIZATION":
5453
- return 10 /* REASON_NO_ORGANIZATION */;
5454
- case 11:
5455
- case "REASON_NO_TEAM":
5456
- return 11 /* REASON_NO_TEAM */;
5457
- case 12:
5458
- case "REASON_NO_CERTIFICATION":
5459
- return 12 /* REASON_NO_CERTIFICATION */;
5460
- case 13:
5461
- case "REASON_STALE_CERTIFICATION":
5462
- return 13 /* REASON_STALE_CERTIFICATION */;
5463
- case 14:
5464
- case "REASON_TOOL_MISSING":
5465
- return 14 /* REASON_TOOL_MISSING */;
5466
- case 15:
5467
- case "REASON_CROSS_SCOPE":
5468
- return 15 /* REASON_CROSS_SCOPE */;
5469
- case 16:
5470
- case "REASON_UNAUTHENTICATED":
5471
- return 16 /* REASON_UNAUTHENTICATED */;
5472
- case 17:
5473
- case "REASON_IMPORT_RESIDUAL":
5474
- return 17 /* REASON_IMPORT_RESIDUAL */;
5475
- case 18:
5476
- case "REASON_STACK_HAS_STATE":
5477
- return 18 /* REASON_STACK_HAS_STATE */;
5478
- case 19:
5479
- case "REASON_NO_ORIGIN_REMOTE":
5480
- return 19 /* REASON_NO_ORIGIN_REMOTE */;
5481
- case 20:
5482
- case "REASON_IMPORT_UNDECLARED":
5483
- return 20 /* REASON_IMPORT_UNDECLARED */;
5484
- case 21:
5485
- case "REASON_ALREADY_IMPORTED":
5486
- return 21 /* REASON_ALREADY_IMPORTED */;
5487
- case 22:
5488
- case "REASON_NO_LOCKFILE":
5489
- return 22 /* REASON_NO_LOCKFILE */;
5490
- case -1:
5491
- case "UNRECOGNIZED":
5492
- default:
5493
- return -1 /* UNRECOGNIZED */;
5494
- }
5495
- }
5496
- function reasonToJSON(object) {
5497
- switch (object) {
5498
- case 0 /* REASON_UNSPECIFIED */:
5499
- return "REASON_UNSPECIFIED";
5500
- case 1 /* REASON_NOT_LACE_FORM */:
5501
- return "REASON_NOT_LACE_FORM";
5502
- case 2 /* REASON_HASH_MISMATCH */:
5503
- return "REASON_HASH_MISMATCH";
5504
- case 3 /* REASON_REGISTRY_UNAVAILABLE */:
5505
- return "REASON_REGISTRY_UNAVAILABLE";
5506
- case 4 /* REASON_ROOT_LOCKED */:
5507
- return "REASON_ROOT_LOCKED";
5508
- case 5 /* REASON_UNSAVED */:
5509
- return "REASON_UNSAVED";
5510
- case 6 /* REASON_CONFLICT */:
5511
- return "REASON_CONFLICT";
5512
- case 7 /* REASON_SOURCE_REFUSED */:
5513
- return "REASON_SOURCE_REFUSED";
5514
- case 8 /* REASON_NOT_GIT_REPOSITORY */:
5515
- return "REASON_NOT_GIT_REPOSITORY";
5516
- case 9 /* REASON_GENERATE_IN_PROGRESS */:
5517
- return "REASON_GENERATE_IN_PROGRESS";
5518
- case 10 /* REASON_NO_ORGANIZATION */:
5519
- return "REASON_NO_ORGANIZATION";
5520
- case 11 /* REASON_NO_TEAM */:
5521
- return "REASON_NO_TEAM";
5522
- case 12 /* REASON_NO_CERTIFICATION */:
5523
- return "REASON_NO_CERTIFICATION";
5524
- case 13 /* REASON_STALE_CERTIFICATION */:
5525
- return "REASON_STALE_CERTIFICATION";
5526
- case 14 /* REASON_TOOL_MISSING */:
5527
- return "REASON_TOOL_MISSING";
5528
- case 15 /* REASON_CROSS_SCOPE */:
5529
- return "REASON_CROSS_SCOPE";
5530
- case 16 /* REASON_UNAUTHENTICATED */:
5531
- return "REASON_UNAUTHENTICATED";
5532
- case 17 /* REASON_IMPORT_RESIDUAL */:
5533
- return "REASON_IMPORT_RESIDUAL";
5534
- case 18 /* REASON_STACK_HAS_STATE */:
5535
- return "REASON_STACK_HAS_STATE";
5536
- case 19 /* REASON_NO_ORIGIN_REMOTE */:
5537
- return "REASON_NO_ORIGIN_REMOTE";
5538
- case 20 /* REASON_IMPORT_UNDECLARED */:
5539
- return "REASON_IMPORT_UNDECLARED";
5540
- case 21 /* REASON_ALREADY_IMPORTED */:
5541
- return "REASON_ALREADY_IMPORTED";
5542
- case 22 /* REASON_NO_LOCKFILE */:
5543
- return "REASON_NO_LOCKFILE";
5544
- case -1 /* UNRECOGNIZED */:
5545
- default:
5546
- return "UNRECOGNIZED";
5547
- }
5548
- }
5549
5552
  function conflictChoiceFromJSON(object) {
5550
5553
  switch (object) {
5551
5554
  case 0:
@@ -13322,20 +13325,32 @@ function sightOf(pane) {
13322
13325
  function useViewport(pane, focusIds) {
13323
13326
  const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0, import_react19.useReactFlow)();
13324
13327
  const headingRef = (0, import_react20.useRef)(null);
13328
+ const keptRevealRef = (0, import_react20.useRef)(null);
13325
13329
  const heading = (0, import_react20.useCallback)(() => {
13326
13330
  const h = headingRef.current;
13327
13331
  return h && performance.now() < h.until ? h : null;
13328
13332
  }, []);
13329
13333
  const move = (0, import_react20.useCallback)(
13330
- (viewport, reveals, duration) => {
13331
- headingRef.current = { viewport, reveals, until: performance.now() + duration };
13334
+ (viewport, duration) => {
13335
+ headingRef.current = { viewport, until: performance.now() + duration };
13332
13336
  void setViewport(viewport, { duration });
13333
13337
  },
13334
13338
  [setViewport]
13335
13339
  );
13340
+ const moved = (0, import_react20.useCallback)(() => {
13341
+ headingRef.current = null;
13342
+ keptRevealRef.current = null;
13343
+ }, []);
13344
+ const onMoveStart = (0, import_react20.useCallback)(
13345
+ (event) => {
13346
+ if (event) moved();
13347
+ },
13348
+ [moved]
13349
+ );
13336
13350
  const fit = (0, import_react20.useCallback)(() => {
13337
13351
  if (!pane) return;
13338
13352
  headingRef.current = null;
13353
+ keptRevealRef.current = null;
13339
13354
  const { pane: size, visible } = sightOf(pane);
13340
13355
  void fitView({ ...FIT, padding: fitPadding(size, visible) });
13341
13356
  }, [pane, fitView]);
@@ -13344,9 +13359,10 @@ function useViewport(pane, focusIds) {
13344
13359
  if (!pane) return;
13345
13360
  const from = heading()?.viewport ?? getViewport();
13346
13361
  const room = withMargin(rect, REVEAL_MARGIN, from.zoom);
13362
+ keptRevealRef.current = room;
13347
13363
  const { dx, dy } = computeMinimalPanDelta(room, sightOf(pane).visible, from);
13348
13364
  if (dx === 0 && dy === 0) return;
13349
- move({ x: from.x + dx, y: from.y + dy, zoom: from.zoom }, room, PAN_MS);
13365
+ move({ x: from.x + dx, y: from.y + dy, zoom: from.zoom }, PAN_MS);
13350
13366
  },
13351
13367
  [pane, heading, getViewport, move]
13352
13368
  );
@@ -13354,13 +13370,13 @@ function useViewport(pane, focusIds) {
13354
13370
  });
13355
13371
  (0, import_react20.useLayoutEffect)(() => {
13356
13372
  resized.current = (was, after) => {
13357
- const pending = heading();
13358
- const from = pending?.viewport ?? getViewport();
13373
+ const from = heading()?.viewport ?? getViewport();
13359
13374
  const drawn = getNodes().filter((n) => !n.hidden);
13360
13375
  const selected = focusIds.filter((id) => getNode(id));
13376
+ const revealed = keptRevealRef.current;
13361
13377
  const kept = [
13362
13378
  ...selected.length > 0 ? [withMargin(getNodesBounds(selected), REVEAL_MARGIN, from.zoom)] : [],
13363
- ...pending?.reveals ? [pending.reveals] : []
13379
+ ...revealed ? [revealed] : []
13364
13380
  ];
13365
13381
  const outcome = viewportAfterResize(
13366
13382
  from,
@@ -13370,7 +13386,7 @@ function useViewport(pane, focusIds) {
13370
13386
  kept.length > 0 ? (0, import_proto9.extentOf)(kept) : null
13371
13387
  );
13372
13388
  if (outcome.kind === "fit") fit();
13373
- else if (outcome.kind === "move") move(outcome.viewport, pending?.reveals ?? null, RESIZE_MS);
13389
+ else if (outcome.kind === "move") move(outcome.viewport, RESIZE_MS);
13374
13390
  };
13375
13391
  });
13376
13392
  (0, import_react20.useEffect)(() => {
@@ -13381,8 +13397,13 @@ function useViewport(pane, focusIds) {
13381
13397
  let held;
13382
13398
  let pressed = false;
13383
13399
  let releasedAt = Number.NEGATIVE_INFINITY;
13384
- const press = () => {
13400
+ const onChrome = (event) => event.target instanceof Element && event.target.closest(CHROME);
13401
+ const press = (event) => {
13385
13402
  pressed = true;
13403
+ if (onChrome(event)) moved();
13404
+ };
13405
+ const wheel = (event) => {
13406
+ if (onChrome(event)) moved();
13386
13407
  };
13387
13408
  const release = () => {
13388
13409
  pressed = false;
@@ -13411,6 +13432,7 @@ function useViewport(pane, focusIds) {
13411
13432
  });
13412
13433
  observer.observe(pane);
13413
13434
  pane.addEventListener("pointerdown", press, true);
13435
+ pane.addEventListener("wheel", wheel, { capture: true, passive: true });
13414
13436
  window.addEventListener("pointerup", release, true);
13415
13437
  window.addEventListener("pointercancel", release, true);
13416
13438
  return () => {
@@ -13418,11 +13440,12 @@ function useViewport(pane, focusIds) {
13418
13440
  clearTimeout(held);
13419
13441
  observer.disconnect();
13420
13442
  pane.removeEventListener("pointerdown", press, true);
13443
+ pane.removeEventListener("wheel", wheel, true);
13421
13444
  window.removeEventListener("pointerup", release, true);
13422
13445
  window.removeEventListener("pointercancel", release, true);
13423
13446
  };
13424
- }, [pane]);
13425
- return (0, import_react20.useMemo)(() => ({ fit, panIntoView }), [fit, panIntoView]);
13447
+ }, [pane, moved]);
13448
+ return (0, import_react20.useMemo)(() => ({ fit, panIntoView, onMoveStart }), [fit, panIntoView, onMoveStart]);
13426
13449
  }
13427
13450
 
13428
13451
  // src/Canvas.tsx
@@ -13584,6 +13607,7 @@ function CompositeEditor({
13584
13607
  edgesReconnectable: editable,
13585
13608
  deleteKeyCode: null,
13586
13609
  fitView: false,
13610
+ onMoveStart: viewport.onMoveStart,
13587
13611
  proOptions: { hideAttribution: true },
13588
13612
  style: { background: "var(--lace-color-bg-canvas)" },
13589
13613
  children: [
@@ -14139,6 +14163,42 @@ var COMMANDS = {
14139
14163
  "hidden": false,
14140
14164
  "yes": false
14141
14165
  },
14166
+ "drift scan": {
14167
+ "path": "drift scan",
14168
+ "positionals": [],
14169
+ "flags": {
14170
+ "full": {
14171
+ "type": "bool"
14172
+ },
14173
+ "org": {
14174
+ "type": "string"
14175
+ },
14176
+ "output": {
14177
+ "type": "string",
14178
+ "values": [
14179
+ "table",
14180
+ "json"
14181
+ ],
14182
+ "short": "o"
14183
+ },
14184
+ "stack": {
14185
+ "type": "string",
14186
+ "required": true
14187
+ },
14188
+ "team": {
14189
+ "type": "string"
14190
+ },
14191
+ "wait": {
14192
+ "type": "bool"
14193
+ },
14194
+ "waitTimeout": {
14195
+ "type": "duration"
14196
+ }
14197
+ },
14198
+ "effect": "write",
14199
+ "hidden": false,
14200
+ "yes": false
14201
+ },
14142
14202
  "hooks install": {
14143
14203
  "path": "hooks install",
14144
14204
  "positionals": [],
@@ -14303,6 +14363,44 @@ var COMMANDS = {
14303
14363
  "hidden": false,
14304
14364
  "yes": false
14305
14365
  },
14366
+ "module import": {
14367
+ "path": "module import",
14368
+ "positionals": [],
14369
+ "flags": {
14370
+ "allowPartial": {
14371
+ "type": "bool"
14372
+ },
14373
+ "org": {
14374
+ "type": "string"
14375
+ },
14376
+ "output": {
14377
+ "type": "string",
14378
+ "values": [
14379
+ "table",
14380
+ "json"
14381
+ ],
14382
+ "short": "o"
14383
+ },
14384
+ "path": {
14385
+ "type": "string",
14386
+ "short": "p"
14387
+ },
14388
+ "stack": {
14389
+ "type": "string",
14390
+ "required": true
14391
+ },
14392
+ "state": {
14393
+ "type": "string",
14394
+ "required": true
14395
+ },
14396
+ "team": {
14397
+ "type": "string"
14398
+ }
14399
+ },
14400
+ "effect": "rewrite",
14401
+ "hidden": false,
14402
+ "yes": false
14403
+ },
14306
14404
  "module lock": {
14307
14405
  "path": "module lock",
14308
14406
  "positionals": [],
@@ -15086,45 +15184,6 @@ var COMMANDS = {
15086
15184
  "hidden": false,
15087
15185
  "yes": false
15088
15186
  },
15089
- "stack import": {
15090
- "path": "stack import",
15091
- "positionals": [
15092
- {
15093
- "name": "stack",
15094
- "kind": "required"
15095
- }
15096
- ],
15097
- "flags": {
15098
- "allowPartial": {
15099
- "type": "bool"
15100
- },
15101
- "org": {
15102
- "type": "string"
15103
- },
15104
- "output": {
15105
- "type": "string",
15106
- "values": [
15107
- "table",
15108
- "json"
15109
- ],
15110
- "short": "o"
15111
- },
15112
- "path": {
15113
- "type": "string",
15114
- "short": "p"
15115
- },
15116
- "state": {
15117
- "type": "string",
15118
- "required": true
15119
- },
15120
- "team": {
15121
- "type": "string"
15122
- }
15123
- },
15124
- "effect": "rewrite",
15125
- "hidden": false,
15126
- "yes": false
15127
- },
15128
15187
  "stack list": {
15129
15188
  "path": "stack list",
15130
15189
  "positionals": [],
@@ -15196,43 +15255,6 @@ var COMMANDS = {
15196
15255
  "hidden": false,
15197
15256
  "yes": false
15198
15257
  },
15199
- "stack scan": {
15200
- "path": "stack scan",
15201
- "positionals": [
15202
- {
15203
- "name": "stack",
15204
- "kind": "required"
15205
- }
15206
- ],
15207
- "flags": {
15208
- "full": {
15209
- "type": "bool"
15210
- },
15211
- "org": {
15212
- "type": "string"
15213
- },
15214
- "output": {
15215
- "type": "string",
15216
- "values": [
15217
- "table",
15218
- "json"
15219
- ],
15220
- "short": "o"
15221
- },
15222
- "team": {
15223
- "type": "string"
15224
- },
15225
- "wait": {
15226
- "type": "bool"
15227
- },
15228
- "waitTimeout": {
15229
- "type": "duration"
15230
- }
15231
- },
15232
- "effect": "write",
15233
- "hidden": false,
15234
- "yes": false
15235
- },
15236
15258
  "stack update": {
15237
15259
  "path": "stack update",
15238
15260
  "positionals": [
@@ -15779,7 +15801,7 @@ var runSchema = import_zod.z.object({
15779
15801
  createdAt: import_zod.z.string(),
15780
15802
  updatedAt: import_zod.z.string(),
15781
15803
  // The run's page in the portal. The CLI builds it on every Run it prints
15782
- // (apps/cli/internal/api/runs.go, from the configured base URL and the
15804
+ // (apps/cli/internal/kernel/api/runs.go, from the configured base URL and the
15783
15805
  // selected organization and team); the API's own record carries none, so
15784
15806
  // a portal mount reading the API body sees it absent — optional so both
15785
15807
  // bodies parse. A host opens this link and never composes a portal route.
@@ -15800,9 +15822,9 @@ var runSchema = import_zod.z.object({
15800
15822
  }).optional()
15801
15823
  })
15802
15824
  ).optional(),
15803
- // The CLI's own `api.Run` decode struct (apps/cli/internal/api/runs.go) has no
15825
+ // The CLI's own `api.Run` decode struct (apps/cli/internal/kernel/api/runs.go) has no
15804
15826
  // json tag for these, so every CLI JSON golden omits them; the API always sends
15805
- // them (apps/api/src/openapi/schemas/runs.ts) — optional so both bodies parse.
15827
+ // them (apps/api/src/verticals/runs/routes/schemas/runs.ts) — optional so both bodies parse.
15806
15828
  keepStack: import_zod.z.boolean().optional(),
15807
15829
  version: import_zod.z.number().optional(),
15808
15830
  lastHeartbeatAt: import_zod.z.string().nullable().optional(),
@@ -15937,7 +15959,7 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
15937
15959
  error: import_zod.z.string().nullable()
15938
15960
  })
15939
15961
  ]);
15940
- var stackScanSchema = import_zod.z.object({
15962
+ var driftScanSchema = import_zod.z.object({
15941
15963
  stack: stackIdentSchema,
15942
15964
  triggered: import_zod.z.boolean(),
15943
15965
  reason: import_zod.z.string().nullable(),
@@ -15951,7 +15973,7 @@ var stackScanSchema = import_zod.z.object({
15951
15973
  drift: driftSchema
15952
15974
  }).nullable()
15953
15975
  });
15954
- var stackImportSchema = moduleConvertResultSchema.extend({
15976
+ var moduleImportSchema = moduleConvertResultSchema.extend({
15955
15977
  stack: stackIdentSchema,
15956
15978
  importBlocks: import_zod.z.number(),
15957
15979
  importResiduals: import_zod.z.array(importResidualSchema)
@@ -16046,9 +16068,9 @@ var SCHEMAS = {
16046
16068
  "stack preview": stackPreviewSchema,
16047
16069
  "stack apply": runEventSchema,
16048
16070
  "stack destroy": runEventSchema,
16049
- "stack scan": stackScanSchema,
16071
+ "drift scan": driftScanSchema,
16050
16072
  "stack create": stackSchema,
16051
- "stack import": stackImportSchema,
16073
+ "module import": moduleImportSchema,
16052
16074
  "run get": runSchema,
16053
16075
  "run plan": runPlanSchema,
16054
16076
  "run cancel": runSchema,
@@ -16138,7 +16160,7 @@ function CommandArgsForm({ form }) {
16138
16160
  var REPORT_PATHS = ["module validate", "module convert", "module scan"];
16139
16161
  var FOLDS_AS = new Map([
16140
16162
  ...REPORT_PATHS.map((path) => [path, path]),
16141
- ["stack import", "module convert"]
16163
+ ["module import", "module convert"]
16142
16164
  ]);
16143
16165
  var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
16144
16166
  function readEntry(path, exitCode, data) {
@@ -16604,7 +16626,7 @@ function scanNotice(e) {
16604
16626
  }
16605
16627
  var scan = defineCommand({
16606
16628
  kind: "command",
16607
- path: "stack scan",
16629
+ path: "drift scan",
16608
16630
  args: (ctx) => ({ stack: ctx.stack?.id, wait: true }),
16609
16631
  invalidates: true,
16610
16632
  result: {
@@ -16657,14 +16679,14 @@ var importResult = {
16657
16679
  };
16658
16680
  var importStack = defineCommand({
16659
16681
  kind: "command",
16660
- path: "stack import",
16682
+ path: "module import",
16661
16683
  args: (ctx) => ({ stack: ctx.stack?.id }),
16662
16684
  invalidates: true,
16663
16685
  result: importResult
16664
16686
  });
16665
16687
  var importPartial = defineCommand({
16666
16688
  kind: "command",
16667
- path: "stack import",
16689
+ path: "module import",
16668
16690
  args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
16669
16691
  confirm: (ctx, _args, target) => ({
16670
16692
  text: `Import into ${ctx.stack?.slug} without adopting ${residualAddresses(target.failure?.importResiduals ?? [])}? Lace writes no import block for them, so the stack's apply creates them anew beside the live ones.`
@@ -16817,7 +16839,7 @@ var STACK_COMMAND_ACTIONS = [
16817
16839
  label: "Import existing resources",
16818
16840
  placement: "toolbar",
16819
16841
  requiredPorts: ["commands"],
16820
- // `stack import` writes the directory it runs in, the same way
16842
+ // `module import` writes the directory it runs in, the same way
16821
16843
  // Convert does.
16822
16844
  requiredContext: ["root", "stack"],
16823
16845
  binding: importStack
@@ -17365,11 +17387,6 @@ var import_proto15 = require("@lace-cloud/proto");
17365
17387
  var import_ui19 = require("@lace-cloud/ui");
17366
17388
  var import_react37 = require("react");
17367
17389
 
17368
- // src/exhaustive.ts
17369
- function assertNever(value) {
17370
- throw new Error(`Unhandled closed-enum branch: ${JSON.stringify(value)}`);
17371
- }
17372
-
17373
17390
  // src/hooks/useDraft.ts
17374
17391
  var import_react32 = require("react");
17375
17392
 
@@ -18982,7 +18999,7 @@ function toInputMode(mode) {
18982
18999
  case "expression":
18983
19000
  return 4 /* INPUT_MODE_EXPRESSION */;
18984
19001
  default:
18985
- return assertNever(mode);
19002
+ return (0, import_ui19.assertNever)(mode);
18986
19003
  }
18987
19004
  }
18988
19005
  function literalKind(type) {
@@ -19033,7 +19050,7 @@ function sentBinding(draft, type) {
19033
19050
  case "expression":
19034
19051
  return draft.expression.trim() ? sent("expression", { expression: draft.expression }) : sent("empty");
19035
19052
  default:
19036
- return assertNever(draft.mode);
19053
+ return (0, import_ui19.assertNever)(draft.mode);
19037
19054
  }
19038
19055
  }
19039
19056
  function callActions(config, address, fields) {
@@ -19847,6 +19864,17 @@ function createActionRunner(ports, store, options = {}) {
19847
19864
  };
19848
19865
  }
19849
19866
 
19867
+ // src/core/use-editing.ts
19868
+ var import_react40 = require("react");
19869
+ function useEditing(runner) {
19870
+ const [editing, setEditing] = (0, import_react40.useState)(() => runner.editing());
19871
+ (0, import_react40.useEffect)(() => {
19872
+ setEditing(runner.editing());
19873
+ return runner.onEditingChange(setEditing);
19874
+ }, [runner]);
19875
+ return editing;
19876
+ }
19877
+
19850
19878
  // src/App.tsx
19851
19879
  var import_jsx_runtime37 = require("react/jsx-runtime");
19852
19880
  var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
@@ -19857,8 +19885,8 @@ function OverlayRunner({
19857
19885
  tick,
19858
19886
  onDecorations
19859
19887
  }) {
19860
- const lastErrorRef = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
19861
- const onReadError = (0, import_react41.useCallback)(
19888
+ const lastErrorRef = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
19889
+ const onReadError = (0, import_react42.useCallback)(
19862
19890
  (path, error) => {
19863
19891
  const next = error?.message ?? null;
19864
19892
  if (lastErrorRef.current.get(path) === next) return;
@@ -19875,15 +19903,15 @@ function OverlayDecorations({
19875
19903
  onDecorations
19876
19904
  }) {
19877
19905
  const decorations = overlay.useDecorations(ctx);
19878
- (0, import_react41.useEffect)(() => {
19906
+ (0, import_react42.useEffect)(() => {
19879
19907
  onDecorations(overlay.id, decorations);
19880
19908
  }, [overlay.id, decorations, onDecorations]);
19881
- (0, import_react41.useEffect)(() => () => onDecorations(overlay.id, null), [overlay.id, onDecorations]);
19909
+ (0, import_react42.useEffect)(() => () => onDecorations(overlay.id, null), [overlay.id, onDecorations]);
19882
19910
  return null;
19883
19911
  }
19884
19912
  function PanelSlot({ panel, ctx, tick }) {
19885
- const [readErrors, setReadErrors] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
19886
- const onReadError = (0, import_react41.useCallback)((path, error) => {
19913
+ const [readErrors, setReadErrors] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
19914
+ const onReadError = (0, import_react42.useCallback)((path, error) => {
19887
19915
  setReadErrors((prev) => {
19888
19916
  if (error === null) {
19889
19917
  if (!prev.has(path)) return prev;
@@ -19920,7 +19948,7 @@ function BottomTabs({
19920
19948
  ctx,
19921
19949
  tick
19922
19950
  }) {
19923
- const [manualId, setManualId] = (0, import_react41.useState)(null);
19951
+ const [manualId, setManualId] = (0, import_react42.useState)(null);
19924
19952
  const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
19925
19953
  const active = manual ?? panels[0] ?? null;
19926
19954
  if (panels.length === 0) return null;
@@ -19949,8 +19977,8 @@ function App({
19949
19977
  height = "100vh",
19950
19978
  results: hostResults
19951
19979
  }) {
19952
- const results = (0, import_react41.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
19953
- const writeReport = (0, import_react41.useCallback)(
19980
+ const results = (0, import_react42.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
19981
+ const writeReport = (0, import_react42.useCallback)(
19954
19982
  (result, session2) => {
19955
19983
  try {
19956
19984
  results.write("report", session2, result, { stack: void 0 });
@@ -19961,42 +19989,42 @@ function App({
19961
19989
  },
19962
19990
  [results, ports.presenter]
19963
19991
  );
19964
- const dropReport = (0, import_react41.useCallback)((session2) => results.detach("report", session2), [results]);
19992
+ const dropReport = (0, import_react42.useCallback)((session2) => results.detach("report", session2), [results]);
19965
19993
  const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
19966
- const [arrangement, setArrangement] = (0, import_react41.useState)(() => ports.viewState.load());
19994
+ const [arrangement, setArrangement] = (0, import_react42.useState)(() => ports.viewState.load());
19967
19995
  const stack = ports.context.stack;
19968
- const [selection, setSelection] = (0, import_react41.useState)(NO_SELECTION);
19969
- const [settingsOpen, setSettingsOpen] = (0, import_react41.useState)(false);
19970
- const select = (0, import_react41.useCallback)((next) => {
19996
+ const [selection, setSelection] = (0, import_react42.useState)(NO_SELECTION);
19997
+ const [settingsOpen, setSettingsOpen] = (0, import_react42.useState)(false);
19998
+ const select = (0, import_react42.useCallback)((next) => {
19971
19999
  setSelection(next);
19972
20000
  if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
19973
20001
  }, []);
19974
- const [pendingForm, setPendingForm] = (0, import_react41.useState)(null);
19975
- const [overlayDecorations, setOverlayDecorations] = (0, import_react41.useState)({});
19976
- const layoutRef = (0, import_react41.useRef)({ panIntoView: () => {
20002
+ const [pendingForm, setPendingForm] = (0, import_react42.useState)(null);
20003
+ const [overlayDecorations, setOverlayDecorations] = (0, import_react42.useState)({});
20004
+ const layoutRef = (0, import_react42.useRef)({ panIntoView: () => {
19977
20005
  } });
19978
20006
  const { commands, presenter, editor } = ports;
19979
- const runner = (0, import_react41.useMemo)(
20007
+ const runner = (0, import_react42.useMemo)(
19980
20008
  () => createActionRunner({ commands, presenter, editor }, results, {
19981
20009
  onPendingFormChange: setPendingForm
19982
20010
  }),
19983
20011
  [commands, presenter, editor, results]
19984
20012
  );
19985
- (0, import_react41.useEffect)(() => {
20013
+ (0, import_react42.useEffect)(() => {
19986
20014
  return () => {
19987
20015
  runner.dispose();
19988
20016
  };
19989
20017
  }, [runner]);
19990
- const tick = (0, import_react41.useSyncExternalStore)(results.subscribe, results.getTick);
19991
- const editing = (0, import_react41.useSyncExternalStore)(runner.onEditingChange, runner.editing);
19992
- const updateArrangement = (0, import_react41.useCallback)(
20018
+ const tick = (0, import_react42.useSyncExternalStore)(results.subscribe, results.getTick);
20019
+ const editing = useEditing(runner);
20020
+ const updateArrangement = (0, import_react42.useCallback)(
19993
20021
  (next) => {
19994
20022
  setArrangement(next);
19995
20023
  ports.viewState.save(next);
19996
20024
  },
19997
20025
  [ports.viewState]
19998
20026
  );
19999
- const gcSeenBundle = (0, import_react41.useRef)(null);
20027
+ const gcSeenBundle = (0, import_react42.useRef)(null);
20000
20028
  if (source && gcSeenBundle.current !== source.bundle) {
20001
20029
  gcSeenBundle.current = source.bundle;
20002
20030
  const gced = gcArrangement(source.bundle, arrangement);
@@ -20007,18 +20035,18 @@ function App({
20007
20035
  });
20008
20036
  }
20009
20037
  }
20010
- const view = (0, import_react41.useMemo)(
20038
+ const view = (0, import_react42.useMemo)(
20011
20039
  () => source ? projectFrame(source, arrangement) : null,
20012
20040
  [source, arrangement]
20013
20041
  );
20014
- const reconciledFrame = (0, import_react41.useRef)(null);
20015
- (0, import_react41.useLayoutEffect)(() => {
20042
+ const reconciledFrame = (0, import_react42.useRef)(null);
20043
+ (0, import_react42.useLayoutEffect)(() => {
20016
20044
  if (!source || !view || reconciledFrame.current === source) return;
20017
20045
  reconciledFrame.current = source;
20018
20046
  setSelection((current) => reconcileSelection(view, current));
20019
20047
  }, [source, view]);
20020
20048
  const editable = ports.editor !== void 0 && !source?.sourceRefused;
20021
- const merged = (0, import_react41.useMemo)(
20049
+ const merged = (0, import_react42.useMemo)(
20022
20050
  () => ({
20023
20051
  overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
20024
20052
  panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
@@ -20026,17 +20054,17 @@ function App({
20026
20054
  }),
20027
20055
  [contributions]
20028
20056
  );
20029
- const resultSlots = (0, import_react41.useSyncExternalStore)(results.subscribe, results.getSnapshot);
20057
+ const resultSlots = (0, import_react42.useSyncExternalStore)(results.subscribe, results.getSnapshot);
20030
20058
  const stackId = stack?.id;
20031
- const live = (0, import_react41.useMemo)(
20059
+ const live = (0, import_react42.useMemo)(
20032
20060
  () => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
20033
20061
  [resultSlots, source, session, stackId]
20034
20062
  );
20035
- const diagnostics = (0, import_react41.useMemo)(
20063
+ const diagnostics = (0, import_react42.useMemo)(
20036
20064
  () => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
20037
20065
  [source, live]
20038
20066
  );
20039
- const ctx = (0, import_react41.useMemo)(() => {
20067
+ const ctx = (0, import_react42.useMemo)(() => {
20040
20068
  if (!source || !view) return null;
20041
20069
  return {
20042
20070
  ports,
@@ -20053,11 +20081,11 @@ function App({
20053
20081
  contributions: merged
20054
20082
  };
20055
20083
  }, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
20056
- const resolved = (0, import_react41.useMemo)(() => {
20084
+ const resolved = (0, import_react42.useMemo)(() => {
20057
20085
  if (!ctx) return EMPTY_CONTRIBUTIONS;
20058
20086
  return resolveContributions(merged, ports, ctx, NO_TARGET2);
20059
20087
  }, [merged, ports, ctx]);
20060
- const setOverlayDecoration = (0, import_react41.useCallback)((id, next) => {
20088
+ const setOverlayDecoration = (0, import_react42.useCallback)((id, next) => {
20061
20089
  setOverlayDecorations((prev) => {
20062
20090
  if (next === null) {
20063
20091
  if (!(id in prev)) return prev;
@@ -20067,11 +20095,11 @@ function App({
20067
20095
  return prev[id] === next ? prev : { ...prev, [id]: next };
20068
20096
  });
20069
20097
  }, []);
20070
- const decorations = (0, import_react41.useMemo)(() => {
20098
+ const decorations = (0, import_react42.useMemo)(() => {
20071
20099
  if (!view || !source) return { nodes: {} };
20072
20100
  return decorate(view, Object.values(overlayDecorations), diagnostics);
20073
20101
  }, [view, source, overlayDecorations, diagnostics]);
20074
- const envExtras = (0, import_react41.useMemo)(() => {
20102
+ const envExtras = (0, import_react42.useMemo)(() => {
20075
20103
  if (!source) return null;
20076
20104
  return {
20077
20105
  bundle: source.bundle,
@@ -20083,8 +20111,8 @@ function App({
20083
20111
  resolved.actions.filter((action) => action.placement === "toolbar"),
20084
20112
  resolved.panels.filter((panel) => panel.slot === "toolbar")
20085
20113
  );
20086
- const rootRef = (0, import_react41.useRef)(null);
20087
- (0, import_react41.useEffect)(() => {
20114
+ const rootRef = (0, import_react42.useRef)(null);
20115
+ (0, import_react42.useEffect)(() => {
20088
20116
  if (!ctx) return;
20089
20117
  registerKeyTarget(ctx, "app", rootRef.current);
20090
20118
  return () => registerKeyTarget(ctx, "app", null);
@@ -20126,7 +20154,7 @@ function App({
20126
20154
  )),
20127
20155
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
20128
20156
  (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "lace-app__toolbar", children: [
20129
- toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react41.Fragment, { children: [
20157
+ toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react42.Fragment, { children: [
20130
20158
  index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
20131
20159
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "lace-app__toolbar-section", children: [
20132
20160
  section.actions.map((action) => (
@@ -20151,7 +20179,7 @@ function App({
20151
20179
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) }),
20152
20180
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "lace-app__body", children: [
20153
20181
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "lace-app__main", children: [
20154
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react40.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Canvas, { height: "100%" }) }) }),
20182
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react41.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Canvas, { height: "100%" }) }) }),
20155
20183
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BottomTabs, { panels: bottomPanels, ctx, tick })
20156
20184
  ] }),
20157
20185
  drawerPanel && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
@@ -21020,6 +21048,7 @@ function convertCreatedRef(r) {
21020
21048
  useCanvas,
21021
21049
  useCanvasSource,
21022
21050
  useCommandRead,
21051
+ useEditing,
21023
21052
  usePanelScope
21024
21053
  });
21025
21054
  //# sourceMappingURL=index.cjs.map