@lace-cloud/canvas 0.29.0 → 0.30.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.
@@ -17,15 +17,22 @@
17
17
  }
18
18
 
19
19
  /* A section head reads like a VS Code view section's: small capitals,
20
- * letter-spaced, muted until hovered, a chevron that turns as it opens. */
20
+ * letter-spaced, muted until hovered, a chevron that turns as it opens.
21
+ * It sticks to the top of the panel that scrolls it while its section is
22
+ * in view, so the controls on screen are always under their section's
23
+ * name, and paints the panel's surface so what scrolls under it is
24
+ * hidden. */
21
25
  .lace-accordion__header {
26
+ position: sticky;
27
+ top: 0;
28
+ z-index: 1;
22
29
  display: flex;
23
30
  align-items: center;
24
31
  gap: var(--lace-space-1);
25
32
  width: 100%;
26
33
  min-height: 32px;
27
34
  padding: var(--lace-space-1) var(--lace-space-4) var(--lace-space-1) var(--lace-space-3);
28
- background: transparent;
35
+ background: var(--lace-bg-surface);
29
36
  border: none;
30
37
  color: var(--lace-color-text-description);
31
38
  font-family: inherit;
@@ -0,0 +1,23 @@
1
+ /* A card's badge row (BadgeRow.tsx), standing on the card's top edge. A row
2
+ * wider than its card cuts its last chip's text with an ellipsis; each chip
3
+ * names its badge in full as its tooltip. */
4
+ .lace-badge-row {
5
+ position: absolute;
6
+ bottom: calc(100% + var(--lace-space-1));
7
+ left: 0;
8
+ display: flex;
9
+ gap: var(--lace-space-1);
10
+ max-width: 100%;
11
+ overflow: hidden;
12
+ }
13
+
14
+ .lace-badge-row__chip {
15
+ flex: 0 1 auto;
16
+ min-width: 0;
17
+ }
18
+
19
+ .lace-badge-row__text {
20
+ min-width: 0;
21
+ overflow: hidden;
22
+ text-overflow: ellipsis;
23
+ }
@@ -54,6 +54,17 @@
54
54
  background: var(--lace-color-danger-bg-soft);
55
55
  }
56
56
 
57
+ /* An item that cannot run yet keeps its place and its focus, so its
58
+ * tooltip can say why; it does not answer the pointer like one that can. */
59
+ .lace-ctx-menu__item[aria-disabled="true"] {
60
+ color: var(--lace-color-text-muted);
61
+ cursor: not-allowed;
62
+ }
63
+
64
+ .lace-ctx-menu__item[aria-disabled="true"]:hover {
65
+ background: transparent;
66
+ }
67
+
57
68
  .lace-ctx-menu__separator {
58
69
  height: 1px;
59
70
  margin: var(--lace-space-1) var(--lace-space-1);
@@ -8,7 +8,8 @@
8
8
  }
9
9
 
10
10
  /* A row: the severity's glyph in its tone, then the finding in the text
11
- * colour, where it is and the rule it breaks — identifiers, muted. The glyph
11
+ * colour, the file and line it is at, where it is in the graph and the rule
12
+ * it breaks — identifiers, muted. The glyph
12
13
  * holds its own column, so a row that wraps hangs under the message, never
13
14
  * under the glyph. */
14
15
  .lace-diagnostics-panel__row {
@@ -39,6 +40,7 @@
39
40
  color: var(--lace-color-text-primary);
40
41
  }
41
42
 
43
+ .lace-diagnostics-panel__file,
42
44
  .lace-diagnostics-panel__where,
43
45
  .lace-diagnostics-panel__code {
44
46
  color: var(--lace-color-text-muted);
@@ -157,41 +157,3 @@
157
157
  font-family: var(--lace-font-mono);
158
158
  font-size: var(--lace-font-size-xs);
159
159
  }
160
-
161
- /* Same chip shape ModuleNode's own badge row uses (ModuleNode.css) — a
162
- diagnostic addressed to this group's own scope, not any member's. */
163
- .lace-group-node__badges {
164
- position: absolute;
165
- top: -20px;
166
- left: 0;
167
- display: flex;
168
- gap: 4px;
169
- max-width: 100%;
170
- overflow: hidden;
171
- }
172
-
173
- .lace-group-node__badge {
174
- overflow: hidden;
175
- padding: 1px 6px;
176
- border-radius: var(--lace-radius-pill);
177
- white-space: nowrap;
178
- text-overflow: ellipsis;
179
- font-size: 9px;
180
- font-weight: var(--lace-font-weight-medium);
181
- line-height: 1.4;
182
- }
183
-
184
- .lace-group-node__badge--neutral {
185
- background: var(--lace-color-neutral-400);
186
- color: var(--lace-color-neutral-900);
187
- }
188
-
189
- .lace-group-node__badge--warn {
190
- background: var(--lace-color-amber-400);
191
- color: var(--lace-color-neutral-900);
192
- }
193
-
194
- .lace-group-node__badge--error {
195
- background: var(--lace-color-red-alpha-30);
196
- color: var(--lace-color-text-danger);
197
- }
@@ -25,6 +25,12 @@
25
25
  font-size: var(--lace-font-size-sm);
26
26
  }
27
27
 
28
+ /* The source the call reads, after the module's key: where the module's
29
+ * directory or address is, which the key alone does not say. */
30
+ .lace-mcp__module-source {
31
+ color: var(--lace-color-text-muted);
32
+ }
33
+
28
34
  .lace-mcp__title-eyebrow {
29
35
  color: var(--lace-color-text-muted);
30
36
  font-size: var(--lace-font-size-xs);
@@ -86,7 +86,7 @@
86
86
  }
87
87
 
88
88
  .lace-module-node__collapse-btn .lace-canvas-icon,
89
- .lace-module-node__delete-btn .lace-canvas-icon {
89
+ .lace-module-node__action .lace-canvas-icon {
90
90
  stroke-width: 2;
91
91
  }
92
92
 
@@ -129,7 +129,9 @@
129
129
  font-weight: var(--lace-font-weight-medium);
130
130
  }
131
131
 
132
- .lace-module-node__delete-btn {
132
+ /* A card's own control, drawn while the card is hovered: an action placed
133
+ * on the card (`card`), its glyph alone. */
134
+ .lace-module-node__action {
133
135
  display: flex;
134
136
  align-items: center;
135
137
  justify-content: center;
@@ -146,45 +148,21 @@
146
148
  line-height: 1;
147
149
  }
148
150
 
149
- .lace-module-node__delete-btn:hover {
150
- background: var(--lace-color-danger-bg-soft);
151
- color: var(--lace-color-danger-fg);
152
- }
153
-
154
- .lace-module-node__badges {
155
- position: absolute;
156
- top: -20px;
157
- left: 0;
158
- display: flex;
159
- gap: 4px;
160
- max-width: 100%;
161
- overflow: hidden;
162
- }
163
-
164
- .lace-module-node__badge {
165
- overflow: hidden;
166
- padding: 1px 6px;
167
- border-radius: var(--lace-radius-pill);
168
- white-space: nowrap;
169
- text-overflow: ellipsis;
170
- font-size: 9px;
171
- font-weight: var(--lace-font-weight-medium);
172
- line-height: 1.4;
173
- }
174
-
175
- .lace-module-node__badge--neutral {
176
- background: var(--lace-color-neutral-400);
177
- color: var(--lace-color-neutral-900);
151
+ .lace-module-node__action:hover:not([aria-disabled="true"]) {
152
+ background: var(--lace-icon-btn-hover);
153
+ color: var(--lace-color-text-primary);
178
154
  }
179
155
 
180
- .lace-module-node__badge--warn {
181
- background: var(--lace-color-amber-400);
182
- color: var(--lace-color-neutral-900);
156
+ .lace-module-node__action--danger:hover:not([aria-disabled="true"]) {
157
+ background: var(--lace-color-danger-bg-soft);
158
+ color: var(--lace-color-danger-fg);
183
159
  }
184
160
 
185
- .lace-module-node__badge--error {
186
- background: var(--lace-color-red-alpha-30);
187
- color: var(--lace-color-text-danger);
161
+ /* A control that cannot run, or is running: inert, keeping its focus so its
162
+ * tooltip says why. */
163
+ .lace-module-node__action[aria-disabled="true"] {
164
+ cursor: not-allowed;
165
+ opacity: 0.4;
188
166
  }
189
167
 
190
168
  .lace-module-node__body {
@@ -4426,13 +4426,19 @@ var SessionGenerateRequest = {
4426
4426
  }
4427
4427
  };
4428
4428
  function createBaseSessionGenerateResponse() {
4429
- return { files_written: [], validate_json: "", revision: 0 };
4429
+ return { files_written: [], files_changed: [], files_removed: [], validate_json: "", revision: 0 };
4430
4430
  }
4431
4431
  var SessionGenerateResponse = {
4432
4432
  encode(message, writer = new BinaryWriter4()) {
4433
4433
  for (const v of message.files_written) {
4434
4434
  writer.uint32(10).string(v);
4435
4435
  }
4436
+ for (const v of message.files_changed) {
4437
+ writer.uint32(50).string(v);
4438
+ }
4439
+ for (const v of message.files_removed) {
4440
+ writer.uint32(58).string(v);
4441
+ }
4436
4442
  if (message.validate_json !== "") {
4437
4443
  writer.uint32(34).string(message.validate_json);
4438
4444
  }
@@ -4455,6 +4461,20 @@ var SessionGenerateResponse = {
4455
4461
  message.files_written.push(reader.string());
4456
4462
  continue;
4457
4463
  }
4464
+ case 6: {
4465
+ if (tag !== 50) {
4466
+ break;
4467
+ }
4468
+ message.files_changed.push(reader.string());
4469
+ continue;
4470
+ }
4471
+ case 7: {
4472
+ if (tag !== 58) {
4473
+ break;
4474
+ }
4475
+ message.files_removed.push(reader.string());
4476
+ continue;
4477
+ }
4458
4478
  case 4: {
4459
4479
  if (tag !== 34) {
4460
4480
  break;
@@ -4480,6 +4500,8 @@ var SessionGenerateResponse = {
4480
4500
  fromJSON(object) {
4481
4501
  return {
4482
4502
  files_written: globalThis.Array.isArray(object?.filesWritten) ? object.filesWritten.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_written) ? object.files_written.map((e) => globalThis.String(e)) : [],
4503
+ files_changed: globalThis.Array.isArray(object?.filesChanged) ? object.filesChanged.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_changed) ? object.files_changed.map((e) => globalThis.String(e)) : [],
4504
+ files_removed: globalThis.Array.isArray(object?.filesRemoved) ? object.filesRemoved.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_removed) ? object.files_removed.map((e) => globalThis.String(e)) : [],
4483
4505
  validate_json: isSet3(object.validateJson) ? globalThis.String(object.validateJson) : isSet3(object.validate_json) ? globalThis.String(object.validate_json) : "",
4484
4506
  revision: isSet3(object.revision) ? globalThis.Number(object.revision) : 0
4485
4507
  };
@@ -4489,6 +4511,12 @@ var SessionGenerateResponse = {
4489
4511
  if (message.files_written?.length) {
4490
4512
  obj.filesWritten = message.files_written;
4491
4513
  }
4514
+ if (message.files_changed?.length) {
4515
+ obj.filesChanged = message.files_changed;
4516
+ }
4517
+ if (message.files_removed?.length) {
4518
+ obj.filesRemoved = message.files_removed;
4519
+ }
4492
4520
  if (message.validate_json !== "") {
4493
4521
  obj.validateJson = message.validate_json;
4494
4522
  }
@@ -4503,6 +4531,8 @@ var SessionGenerateResponse = {
4503
4531
  fromPartial(object) {
4504
4532
  const message = createBaseSessionGenerateResponse();
4505
4533
  message.files_written = object.files_written?.map((e) => e) || [];
4534
+ message.files_changed = object.files_changed?.map((e) => e) || [];
4535
+ message.files_removed = object.files_removed?.map((e) => e) || [];
4506
4536
  message.validate_json = object.validate_json ?? "";
4507
4537
  message.revision = object.revision ?? 0;
4508
4538
  return message;
@@ -8423,13 +8453,19 @@ var GenerateProgress = {
8423
8453
  }
8424
8454
  };
8425
8455
  function createBaseGenerateSuccess() {
8426
- return { files_written: [], validate_json: "", generate_id: "" };
8456
+ return { files_written: [], files_changed: [], files_removed: [], validate_json: "", generate_id: "" };
8427
8457
  }
8428
8458
  var GenerateSuccess = {
8429
8459
  encode(message, writer = new BinaryWriter4()) {
8430
8460
  for (const v of message.files_written) {
8431
8461
  writer.uint32(10).string(v);
8432
8462
  }
8463
+ for (const v of message.files_changed) {
8464
+ writer.uint32(42).string(v);
8465
+ }
8466
+ for (const v of message.files_removed) {
8467
+ writer.uint32(50).string(v);
8468
+ }
8433
8469
  if (message.validate_json !== "") {
8434
8470
  writer.uint32(26).string(message.validate_json);
8435
8471
  }
@@ -8452,6 +8488,20 @@ var GenerateSuccess = {
8452
8488
  message.files_written.push(reader.string());
8453
8489
  continue;
8454
8490
  }
8491
+ case 5: {
8492
+ if (tag !== 42) {
8493
+ break;
8494
+ }
8495
+ message.files_changed.push(reader.string());
8496
+ continue;
8497
+ }
8498
+ case 6: {
8499
+ if (tag !== 50) {
8500
+ break;
8501
+ }
8502
+ message.files_removed.push(reader.string());
8503
+ continue;
8504
+ }
8455
8505
  case 3: {
8456
8506
  if (tag !== 26) {
8457
8507
  break;
@@ -8477,6 +8527,8 @@ var GenerateSuccess = {
8477
8527
  fromJSON(object) {
8478
8528
  return {
8479
8529
  files_written: globalThis.Array.isArray(object?.filesWritten) ? object.filesWritten.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_written) ? object.files_written.map((e) => globalThis.String(e)) : [],
8530
+ files_changed: globalThis.Array.isArray(object?.filesChanged) ? object.filesChanged.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_changed) ? object.files_changed.map((e) => globalThis.String(e)) : [],
8531
+ files_removed: globalThis.Array.isArray(object?.filesRemoved) ? object.filesRemoved.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_removed) ? object.files_removed.map((e) => globalThis.String(e)) : [],
8480
8532
  validate_json: isSet3(object.validateJson) ? globalThis.String(object.validateJson) : isSet3(object.validate_json) ? globalThis.String(object.validate_json) : "",
8481
8533
  generate_id: isSet3(object.generateId) ? globalThis.String(object.generateId) : isSet3(object.generate_id) ? globalThis.String(object.generate_id) : ""
8482
8534
  };
@@ -8486,6 +8538,12 @@ var GenerateSuccess = {
8486
8538
  if (message.files_written?.length) {
8487
8539
  obj.filesWritten = message.files_written;
8488
8540
  }
8541
+ if (message.files_changed?.length) {
8542
+ obj.filesChanged = message.files_changed;
8543
+ }
8544
+ if (message.files_removed?.length) {
8545
+ obj.filesRemoved = message.files_removed;
8546
+ }
8489
8547
  if (message.validate_json !== "") {
8490
8548
  obj.validateJson = message.validate_json;
8491
8549
  }
@@ -8500,6 +8558,8 @@ var GenerateSuccess = {
8500
8558
  fromPartial(object) {
8501
8559
  const message = createBaseGenerateSuccess();
8502
8560
  message.files_written = object.files_written?.map((e) => e) || [];
8561
+ message.files_changed = object.files_changed?.map((e) => e) || [];
8562
+ message.files_removed = object.files_removed?.map((e) => e) || [];
8503
8563
  message.validate_json = object.validate_json ?? "";
8504
8564
  message.generate_id = object.generate_id ?? "";
8505
8565
  return message;
@@ -10466,6 +10526,22 @@ function currentFrame(source) {
10466
10526
  if (settled) unsubscribe();
10467
10527
  });
10468
10528
  }
10529
+ var GENERATE_STAGES = ["generating", "validating"];
10530
+ function isGenerateStage(stage) {
10531
+ return GENERATE_STAGES.some((known) => known === stage);
10532
+ }
10533
+ function generatedTree({
10534
+ written,
10535
+ changed,
10536
+ removed
10537
+ }) {
10538
+ return {
10539
+ changed,
10540
+ removed,
10541
+ unchanged: written.length - changed.length,
10542
+ treeChanged: changed.length > 0 || removed.length > 0
10543
+ };
10544
+ }
10469
10545
  var ApplyUnobservedError = class extends Error {
10470
10546
  constructor(end) {
10471
10547
  super(`unobserved: the source stopped (${end.kind}) before the frame that carries the write`);
@@ -12940,6 +13016,7 @@ async function openEngineSession(caller, target, options = {}) {
12940
13016
  const progressListeners = /* @__PURE__ */ new Set();
12941
13017
  const ownGenerates = /* @__PURE__ */ new Set();
12942
13018
  let sessionGenerating = initialState.generating;
13019
+ let stage = "generating";
12943
13020
  let currentSource = null;
12944
13021
  let ended = null;
12945
13022
  let deliveredRevision = initialState.revision;
@@ -12949,6 +13026,7 @@ async function openEngineSession(caller, target, options = {}) {
12949
13026
  const published = state.bundle ?? EMPTY_BUNDLE;
12950
13027
  const bundle = currentSource && deepEqual(currentSource.bundle, published) ? currentSource.bundle : published;
12951
13028
  sessionGenerating = state.generating;
13029
+ if (!running()) stage = "generating";
12952
13030
  currentSource = {
12953
13031
  bundle,
12954
13032
  canUndo: state.can_undo,
@@ -12970,16 +13048,27 @@ async function openEngineSession(caller, target, options = {}) {
12970
13048
  }
12971
13049
  }
12972
13050
  adopt(initialState);
12973
- function generating() {
13051
+ function running() {
12974
13052
  return sessionGenerating || ownGenerates.size > 0;
12975
13053
  }
13054
+ function generating() {
13055
+ return running() && stage;
13056
+ }
13057
+ function republishGenerating() {
13058
+ if (!currentSource || currentSource.generating === generating()) return;
13059
+ currentSource = { ...currentSource, generating: generating() };
13060
+ for (const listener of sourceListeners) deliver(listener, currentSource);
13061
+ }
12976
13062
  function track(id, on) {
12977
- const was = generating();
12978
13063
  if (on) ownGenerates.add(id);
12979
13064
  else ownGenerates.delete(id);
12980
- if (!currentSource || generating() === was) return;
12981
- currentSource = { ...currentSource, generating: generating() };
12982
- for (const listener of sourceListeners) deliver(listener, currentSource);
13065
+ if (!running()) stage = "generating";
13066
+ republishGenerating();
13067
+ }
13068
+ function reached(next) {
13069
+ if (!running() || !isGenerateStage(next)) return;
13070
+ stage = next;
13071
+ republishGenerating();
12983
13072
  }
12984
13073
  function observed(revision) {
12985
13074
  if (deliveredRevision >= revision) return Promise.resolve();
@@ -13025,6 +13114,7 @@ async function openEngineSession(caller, target, options = {}) {
13025
13114
  continue;
13026
13115
  }
13027
13116
  if (event.generate_progress) {
13117
+ reached(event.generate_progress.stage);
13028
13118
  for (const listener of progressListeners) listener(event.generate_progress);
13029
13119
  }
13030
13120
  }
@@ -13093,9 +13183,8 @@ async function openEngineSession(caller, target, options = {}) {
13093
13183
  track(generateId, true);
13094
13184
  const onProgress = (progress) => {
13095
13185
  if (progress.generate_id !== generateId) return;
13096
- const stage = progress.stage;
13097
- if (stage === "generating" || stage === "validating") {
13098
- queue.push({ type: "progress", stage });
13186
+ if (isGenerateStage(progress.stage)) {
13187
+ queue.push({ type: "progress", stage: progress.stage });
13099
13188
  }
13100
13189
  };
13101
13190
  progressListeners.add(onProgress);
@@ -13214,6 +13303,8 @@ function generated(response) {
13214
13303
  return {
13215
13304
  type: "success",
13216
13305
  written: response.files_written,
13306
+ changed: response.files_changed,
13307
+ removed: response.files_removed,
13217
13308
  validate: parseBound("module validate", JSON.parse(response.validate_json))
13218
13309
  };
13219
13310
  }
@@ -13663,6 +13754,10 @@ function didNotValidate(v) {
13663
13754
  const why = whyNotValid(v);
13664
13755
  return why === void 0 ? "The tree did not validate: fix it before you commit it." : `The tree did not validate: ${why}. Fix it before you commit it.`;
13665
13756
  }
13757
+ function lockFailed(e) {
13758
+ return e.changed && e.lock === null;
13759
+ }
13760
+ var DID_NOT_LOCK = "The tree's providers did not lock: run `lace module lock` once the cause is fixed, before you commit it.";
13666
13761
  function beside(v) {
13667
13762
  return v.failure ? [v.failure] : [];
13668
13763
  }
@@ -13758,11 +13853,15 @@ function importNotice(e) {
13758
13853
  if (e.validate.exitClass !== "ok") {
13759
13854
  return ["warn", `${imported} ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13760
13855
  }
13761
- const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13762
- if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
13856
+ if (lockFailed(e)) return ["warn", `${imported} ${DID_NOT_LOCK}`];
13857
+ const adopts = e.importBlocks > 0;
13858
+ const next = adopts ? `, commit it, then apply ${slug} to adopt them` : " and commit it";
13859
+ const review = e.changed ? ` Review the change in git${next}.` : "";
13860
+ if (e.importResiduals.length === 0) return ["info", `${imported}${review}`];
13861
+ const unadopted = adopts ? "Not adopted" : "No resource was adopted";
13763
13862
  return [
13764
13863
  "warn",
13765
- `${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13864
+ `${imported}${review} ${unadopted}: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13766
13865
  ];
13767
13866
  }
13768
13867
  var importResult = {
@@ -13794,8 +13893,11 @@ function validateNotice(v) {
13794
13893
  }
13795
13894
  function convertNotice(e) {
13796
13895
  const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written` : "Already lace-style \u2014 nothing to write";
13797
- if (e.validate.exitClass === "ok") return ["info", converted];
13798
- return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13896
+ if (e.validate.exitClass !== "ok") {
13897
+ return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13898
+ }
13899
+ if (lockFailed(e)) return ["warn", `${converted}. ${DID_NOT_LOCK}`];
13900
+ return ["info", converted];
13799
13901
  }
13800
13902
  var validate = defineCommand({
13801
13903
  kind: "command",
@@ -13964,6 +14066,16 @@ var CORE_COMMAND_ACTIONS = [
13964
14066
  ...MODULE_COMMAND_ACTIONS
13965
14067
  ];
13966
14068
 
14069
+ // src/core/entry-scope.ts
14070
+ function entryScopeIds(view) {
14071
+ const nested = new Set(view.groups.flatMap((g) => g.node_ids));
14072
+ return [...view.nodes, ...view.groups].map((n) => n.id).filter((id) => !nested.has(id));
14073
+ }
14074
+ function inEntryScope(view, ids) {
14075
+ const entry = new Set(entryScopeIds(view));
14076
+ return ids.filter((id) => entry.has(id));
14077
+ }
14078
+
13967
14079
  // src/registry.ts
13968
14080
  var CONTEXT_NEEDS = {
13969
14081
  root: "an authoring root",
@@ -13977,7 +14089,10 @@ var CONTEXT_NEEDS = {
13977
14089
  sourceRefused: "the source-refused lock",
13978
14090
  needsConversion: "a tree out of lace shape",
13979
14091
  "selection.node": "a selected node",
13980
- "selection.edge": "a selected connection",
14092
+ "selection.several": "two selected nodes or more",
14093
+ "selection.entryScope": "a selected top-level node or group",
14094
+ "selection.edge": "one selected connection",
14095
+ "selection.edges": "selected connections",
13981
14096
  diagnostics: "diagnostics to show",
13982
14097
  settingsOpen: "the settings panel open",
13983
14098
  generateIdle: "no Generate running",
@@ -14003,6 +14118,10 @@ function runsOn(action, ctx, target) {
14003
14118
  if (required.includes("root")) return `root:${ctx.root}`;
14004
14119
  return "";
14005
14120
  }
14121
+ function wiresAlone(ctx) {
14122
+ const selection = ctx.selection;
14123
+ return selection && selection.nodes.length === 0 ? selection.edges.length : 0;
14124
+ }
14006
14125
  function keySatisfied(ctx, key) {
14007
14126
  if (key === "editable") return ctx.editable === true;
14008
14127
  if (key === "saved") return ctx.view?.unsaved === false;
@@ -14012,13 +14131,16 @@ function keySatisfied(ctx, key) {
14012
14131
  if (key === "sourceRefused") return ctx.sourceRefused === true;
14013
14132
  if (key === "needsConversion")
14014
14133
  return ctx.sourceRefused === true && holdsLaceShapeRefusal(ctx.diagnostics ?? []);
14015
- if (key === "selection.node")
14016
- return ctx.selection !== void 0 && ctx.selection.nodes.length > 0;
14017
- if (key === "selection.edge") return ctx.selection !== void 0 && ctx.selection.edge !== null;
14134
+ if (key === "selection.node") return (ctx.selection?.nodes.length ?? 0) > 0;
14135
+ if (key === "selection.several") return (ctx.selection?.nodes.length ?? 0) > 1;
14136
+ if (key === "selection.entryScope")
14137
+ return ctx.view !== void 0 && ctx.selection !== void 0 && inEntryScope(ctx.view, ctx.selection.nodes).length > 0;
14138
+ if (key === "selection.edge") return wiresAlone(ctx) === 1;
14139
+ if (key === "selection.edges") return wiresAlone(ctx) > 0;
14018
14140
  if (key === "diagnostics") return ctx.diagnostics !== void 0 && ctx.diagnostics.length > 0;
14019
14141
  if (key === "settingsOpen") return ctx.settingsOpen === true;
14020
14142
  if (key === "generateIdle") return ctx.generating === false;
14021
- if (key === "generating") return ctx.generating === true;
14143
+ if (key === "generating") return ctx.generating !== void 0 && ctx.generating !== false;
14022
14144
  if (key === "ungenerated") return ctx.view?.ungenerated === true;
14023
14145
  if (key === "undoable") return ctx.view?.can_undo === true;
14024
14146
  if (key === "redoable") return ctx.view?.can_redo === true;
@@ -14035,7 +14157,11 @@ function disabledReason(action, ctx, busy) {
14035
14157
  return void 0;
14036
14158
  }
14037
14159
  function busyLabelOf(action, ctx, busy) {
14038
- if (action.busy && keySatisfied(ctx, action.busy.when)) return action.busy.label;
14160
+ if (action.busy && keySatisfied(ctx, action.busy.when)) {
14161
+ const { label } = action.busy;
14162
+ if (typeof label === "string") return label;
14163
+ return ctx.generating ? label[ctx.generating] : void 0;
14164
+ }
14039
14165
  if (busy === void 0 || action.binding.kind !== "command") return void 0;
14040
14166
  return busy.kind === "run" || busy.running.path === action.binding.path ? action.label : void 0;
14041
14167
  }
@@ -14045,6 +14171,9 @@ function actionState(action, ctx, busy) {
14045
14171
  busyLabel: busyLabelOf(action, ctx, busy)
14046
14172
  };
14047
14173
  }
14174
+ function isInert(state) {
14175
+ return state.disabledReason !== void 0 || state.busyLabel !== void 0;
14176
+ }
14048
14177
  function missingPort(ports, required) {
14049
14178
  return required.find((name) => ports[name] === void 0);
14050
14179
  }
@@ -14146,6 +14275,7 @@ function createActionRunner(ports, store, options = {}) {
14146
14275
  const notifyControllers = /* @__PURE__ */ new Map();
14147
14276
  let edits = 0;
14148
14277
  const editingListeners = /* @__PURE__ */ new Set();
14278
+ const tickListeners = /* @__PURE__ */ new Set();
14149
14279
  async function asEdit(edit) {
14150
14280
  edits += 1;
14151
14281
  if (edits === 1) for (const listener of editingListeners) listener(true);
@@ -14217,7 +14347,10 @@ function createActionRunner(ports, store, options = {}) {
14217
14347
  },
14218
14348
  fail: (error) => run ? store.fail(run.resultKind, token, error) : false,
14219
14349
  detach: (kind, tok) => store.detach(kind, tok),
14220
- tick: () => store.bumpTick(),
14350
+ tick: () => {
14351
+ store.bumpTick();
14352
+ if (run) for (const listener of tickListeners) listener(run);
14353
+ },
14221
14354
  settled: onSettle
14222
14355
  };
14223
14356
  }
@@ -14348,8 +14481,9 @@ function createActionRunner(ports, store, options = {}) {
14348
14481
  const hostSpec = binding.confirm?.(ctx);
14349
14482
  if (hostSpec && !await askConfirm(hostSpec)) return;
14350
14483
  const token = {};
14351
- await binding.run(runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx)), ctx, target);
14352
- if (binding.invalidates) store.bumpTick();
14484
+ const rt = runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx));
14485
+ await binding.run(rt, ctx, target);
14486
+ if (binding.invalidates) rt.tick();
14353
14487
  }
14354
14488
  return {
14355
14489
  async run(action, ...rest) {
@@ -14396,6 +14530,12 @@ function createActionRunner(ports, store, options = {}) {
14396
14530
  editingListeners.delete(listener);
14397
14531
  };
14398
14532
  },
14533
+ onDidTick(listener) {
14534
+ tickListeners.add(listener);
14535
+ return () => {
14536
+ tickListeners.delete(listener);
14537
+ };
14538
+ },
14399
14539
  busy(action, ctx, target) {
14400
14540
  return busyOf(action, ctx, target);
14401
14541
  },
@@ -14415,6 +14555,7 @@ function createActionRunner(ports, store, options = {}) {
14415
14555
  store.detach("notify", token);
14416
14556
  }
14417
14557
  notifyControllers.clear();
14558
+ tickListeners.clear();
14418
14559
  }
14419
14560
  };
14420
14561
  }
@@ -14509,9 +14650,12 @@ function autosave(source, save, policy, report) {
14509
14650
  export {
14510
14651
  uniqueDiagnostics,
14511
14652
  diagnosticsOf,
14653
+ entryScopeIds,
14654
+ inEntryScope,
14512
14655
  keySatisfied,
14513
14656
  disabledReason,
14514
14657
  actionState,
14658
+ isInert,
14515
14659
  answering,
14516
14660
  resolveContributions,
14517
14661
  rowActions,
@@ -14519,6 +14663,8 @@ export {
14519
14663
  InputMode,
14520
14664
  Reason,
14521
14665
  currentFrame,
14666
+ GENERATE_STAGES,
14667
+ generatedTree,
14522
14668
  ApplyUnobservedError,
14523
14669
  CommandExitError,
14524
14670
  ConnectError,
@@ -14550,6 +14696,7 @@ export {
14550
14696
  MODULE_COMMAND_ACTIONS,
14551
14697
  CORE_COMMAND_ACTIONS,
14552
14698
  isPlainObject,
14699
+ deepEqual,
14553
14700
  createActionRunner,
14554
14701
  connectCaller,
14555
14702
  bridgeCaller,
@@ -14558,4 +14705,4 @@ export {
14558
14705
  AutosaveEndedError,
14559
14706
  autosave
14560
14707
  };
14561
- //# sourceMappingURL=chunk-ASG36ZXQ.mjs.map
14708
+ //# sourceMappingURL=chunk-A3ATETIA.mjs.map