@lace-cloud/canvas 0.37.1 → 0.39.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Lace Cloud's visual canvas — the React + ReactFlow webview UI for
4
4
  visually composing Terraform modules. The core renders against
5
5
  `CanvasPorts` (`source`, `context`, `viewState`, `presenter`, and
6
- optional `editor`, `commands`); a host wires only the ports it can
6
+ optional `editor`, `commands`, `selection`); a host wires only the ports it can
7
7
  support, and read-only is the absence of `editor` (or a live session
8
8
  whose source tf is refused), never a flag.
9
9
 
@@ -48,6 +48,10 @@ Code, JetBrains, Storybook, the portal — renders against:
48
48
  running.
49
49
  - `viewState` (required) — the consumer-owned arrangement (node
50
50
  positions, group collapse), never transported over the wire.
51
+ - `selection` (optional) — `selected`, called each time the module
52
+ calls selected on the canvas change, with each call's canvas path
53
+ (`network`, `network.subnets`), for a host that draws something of its
54
+ own over what is selected.
51
55
 
52
56
  ## The data layer a host draws
53
57
 
@@ -178,18 +182,18 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
178
182
 
179
183
  `snapshotSource` (`src/adapters/snapshot-source.ts`) is the read-only
180
184
  `source` a host without a live engine mounts (portal's control-plane
181
- dashboards): it fetches one Bundle snapshot and never changes —
185
+ dashboards): it decodes one Bundle snapshot, whose bytes the host reads
186
+ through its own transport (`read`), and never changes —
182
187
  `unsaved`/`ungenerated`/`sourceRefused` are always false, `conflict` is
183
188
  always `null`, `diagnostics` is always empty, since a RunSnapshot has no live
184
- validator and the run's own certification already vouched for it. A fetch
185
- the server answers with a failure ends the stream `failed` with a
186
- `SnapshotFetchError`, whose `status` is the answer's HTTP status: a host
187
- words the failure by it, never by the message.
189
+ validator and the run's own certification already vouched for it. The canvas
190
+ reaches no network: a read that rejects ends the stream `failed` with the
191
+ error it rejected with, which the host words.
188
192
 
189
193
  ```ts
190
194
  import { snapshotSource } from '@lace-cloud/canvas';
191
195
 
192
- const source = snapshotSource({ bundleUrl, headers });
196
+ const source = snapshotSource({ read: () => readBundleBytes(snapshotId) });
193
197
  ```
194
198
 
195
199
  ## Save and generate
@@ -125,7 +125,7 @@
125
125
  }
126
126
 
127
127
  .lace-app__bottom-tab--active {
128
- border-bottom: 2px solid var(--lace-color-accent);
128
+ border-bottom: 2px solid var(--lace-color-ink);
129
129
  font-weight: 600;
130
130
  }
131
131
 
@@ -33,9 +33,9 @@
33
33
  }
34
34
 
35
35
  /* The sentence reads in the text colour; the glyph and the rule carry the
36
- * severity. */
36
+ * severity. Below its 192px basis the buttons wrap under it. */
37
37
  .lace-banner__message {
38
- flex: 1 1 16rem;
38
+ flex: 1 1 192px;
39
39
  min-width: 0;
40
40
  color: var(--lace-color-text-primary);
41
41
  overflow-wrap: anywhere;
@@ -0,0 +1,57 @@
1
+ /* A card's badge row (CardDecoration.tsx), standing on the card's top edge. A row
2
+ * wider than its card cuts its last badge's word at the badge's edge; each
3
+ * badge names its decoration 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
+ overflow: hidden;
18
+ }
19
+
20
+ /* A card's revision cloud (CardDecoration.tsx): a band the cloud's reach wide around the
21
+ * card, behind it, filled a step above the paper, its outline a row of
22
+ * scallops: rings of the cloud's stroke, one scallop wide, centred on the
23
+ * band's edge and repeated (`round`) to fit each side whole. */
24
+ .lace-node-cloud {
25
+ position: absolute;
26
+ inset: calc(-1 * var(--lace-node-cloud-reach));
27
+ z-index: -1;
28
+ pointer-events: none;
29
+ background: var(--lace-node-cloud-fill);
30
+ }
31
+
32
+ .lace-node-cloud::before {
33
+ --lace-node-cloud-ring: radial-gradient(
34
+ circle,
35
+ transparent calc(var(--lace-node-cloud-scallop) / 2 - 1px),
36
+ var(--lace-node-cloud-stroke) calc(var(--lace-node-cloud-scallop) / 2 - 0.6px)
37
+ calc(var(--lace-node-cloud-scallop) / 2 + 0.4px),
38
+ transparent calc(var(--lace-node-cloud-scallop) / 2 + 0.8px)
39
+ );
40
+ content: "";
41
+ position: absolute;
42
+ inset: calc(-1 * var(--lace-node-cloud-scallop) / 2);
43
+ background-image:
44
+ var(--lace-node-cloud-ring), var(--lace-node-cloud-ring), var(--lace-node-cloud-ring),
45
+ var(--lace-node-cloud-ring);
46
+ background-position:
47
+ top left,
48
+ bottom left,
49
+ top left,
50
+ top right;
51
+ background-size: var(--lace-node-cloud-scallop) var(--lace-node-cloud-scallop);
52
+ background-repeat:
53
+ round no-repeat,
54
+ round no-repeat,
55
+ no-repeat round,
56
+ no-repeat round;
57
+ }
@@ -54,7 +54,7 @@
54
54
  .lace-app__drawer-handle:hover::after,
55
55
  .lace-app__drawer-handle:active::after,
56
56
  .lace-app__drawer-handle:focus-visible::after {
57
- background: var(--lace-color-accent);
57
+ background: var(--lace-color-ink);
58
58
  }
59
59
 
60
60
  .lace-app__drawer-handle:focus-visible {
@@ -87,6 +87,7 @@
87
87
  }
88
88
 
89
89
  .lace-group-node__collapse-btn {
90
+ position: relative;
90
91
  display: flex;
91
92
  flex-shrink: 0;
92
93
  align-items: center;
@@ -103,6 +104,21 @@
103
104
  line-height: 1;
104
105
  }
105
106
 
107
+ /* The hit area: at least `--lace-size-target` square, centred on the drawn
108
+ * box, which keeps its size and place. The header's inline padding holds the
109
+ * overhang; no sibling control sits inside it. */
110
+ .lace-group-node__collapse-btn::before {
111
+ content: "";
112
+ position: absolute;
113
+ top: 50%;
114
+ left: 50%;
115
+ width: 100%;
116
+ height: 100%;
117
+ min-width: var(--lace-size-target);
118
+ min-height: var(--lace-size-target);
119
+ transform: translate(-50%, -50%);
120
+ }
121
+
106
122
  .lace-group-node__collapse-btn:hover {
107
123
  color: var(--lace-color-text-primary);
108
124
  }
@@ -81,6 +81,7 @@
81
81
  }
82
82
 
83
83
  .lace-module-node__collapse-btn {
84
+ position: relative;
84
85
  display: flex;
85
86
  flex-shrink: 0;
86
87
  align-items: center;
@@ -97,6 +98,21 @@
97
98
  line-height: 1;
98
99
  }
99
100
 
101
+ /* The hit area: at least `--lace-size-target` square, centred on the drawn
102
+ * box, which keeps its size and place. The header's clip and its padding hold
103
+ * the overhang; no sibling control sits inside it. */
104
+ .lace-module-node__collapse-btn::before {
105
+ content: "";
106
+ position: absolute;
107
+ top: 50%;
108
+ left: 50%;
109
+ width: 100%;
110
+ height: 100%;
111
+ min-width: var(--lace-size-target);
112
+ min-height: var(--lace-size-target);
113
+ transform: translate(-50%, -50%);
114
+ }
115
+
100
116
  .lace-module-node__collapse-btn:hover {
101
117
  color: var(--lace-color-text-primary);
102
118
  }
@@ -0,0 +1,9 @@
1
+ /* The canvas's paper (PaperGrid.tsx): a layer filling the flow pane behind
2
+ * the graph, painted by the tokens' `.lace-paper-layers` recipe at the shell
3
+ * paper's pitch and threads, and still while the graph moves over it. */
4
+ .lace-canvas-paper {
5
+ position: absolute;
6
+ inset: 0;
7
+ z-index: -1;
8
+ pointer-events: none;
9
+ }
@@ -14,3 +14,9 @@
14
14
  position: static;
15
15
  padding-block: 0;
16
16
  }
17
+
18
+ .lace-commit-foot__error {
19
+ color: var(--lace-color-text-danger);
20
+ white-space: pre-wrap;
21
+ overflow-wrap: anywhere;
22
+ }