@smallpen/cli 0.1.0-alpha.15 → 0.1.0-alpha.16
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/bin/inspection-output.mjs +37 -19
- package/bin/smallpen.mjs +6 -0
- package/package.json +3 -3
|
@@ -153,21 +153,24 @@ export function inspectionReport(
|
|
|
153
153
|
const copies = [...ancestry(node), raw].filter(
|
|
154
154
|
(candidate) => (stored[candidate.id] ?? candidate).instance,
|
|
155
155
|
);
|
|
156
|
-
const overrides =
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
variant?.nodes?.[key.slice(0, key.lastIndexOf(":"))]?.name ??
|
|
166
|
-
"component element",
|
|
156
|
+
const overrides = [];
|
|
157
|
+
const fieldOverrides = [];
|
|
158
|
+
for (const copy of copies) {
|
|
159
|
+
for (const [key, value] of Object.entries((stored[copy.id] ?? copy).instance?.overrides ?? {})) {
|
|
160
|
+
const path = key.slice(0, key.lastIndexOf(":"));
|
|
161
|
+
const target = path === copy.sourceNodeId ? copy.id : `${copy.id}__${path}`;
|
|
162
|
+
const item = {
|
|
163
|
+
element: target === raw.id ? source?.name ?? "component element"
|
|
164
|
+
: variant?.nodes?.[path]?.name ?? projection.nodes[target]?.name ?? "component element",
|
|
167
165
|
field: key.slice(key.lastIndexOf(":") + 1),
|
|
168
166
|
value,
|
|
169
|
-
}
|
|
170
|
-
|
|
167
|
+
};
|
|
168
|
+
// The instance summary includes edits inside it. A field's source
|
|
169
|
+
// depends only on overrides that target that exact projected node.
|
|
170
|
+
if (copy.id === raw.id || target === raw.id) overrides.push(item);
|
|
171
|
+
if (target === raw.id) fieldOverrides.push(item);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
171
174
|
const placed = stored[raw.id];
|
|
172
175
|
if (placed?.instance && source) {
|
|
173
176
|
for (const name of [
|
|
@@ -177,16 +180,25 @@ export function inspectionReport(
|
|
|
177
180
|
"visible",
|
|
178
181
|
"textStyle",
|
|
179
182
|
"tokenBindings",
|
|
183
|
+
"layout-gap",
|
|
184
|
+
"layout-padding",
|
|
185
|
+
"layout-item-margin",
|
|
186
|
+
"cornerRadius",
|
|
187
|
+
"shadow",
|
|
180
188
|
])
|
|
181
189
|
if (
|
|
182
190
|
Object.hasOwn(placed, name) &&
|
|
191
|
+
(name !== "tokenBindings" || Object.keys(placed[name] ?? {}).length > 0) &&
|
|
183
192
|
JSON.stringify(placed[name]) !== JSON.stringify(source[name])
|
|
184
|
-
)
|
|
185
|
-
|
|
193
|
+
) {
|
|
194
|
+
const item = {
|
|
186
195
|
element: source.name,
|
|
187
196
|
field: name,
|
|
188
197
|
value: placed[name],
|
|
189
|
-
}
|
|
198
|
+
};
|
|
199
|
+
overrides.push(item);
|
|
200
|
+
fieldOverrides.push(item);
|
|
201
|
+
}
|
|
190
202
|
}
|
|
191
203
|
return {
|
|
192
204
|
name: set?.name ?? "unknown component",
|
|
@@ -196,6 +208,7 @@ export function inspectionReport(
|
|
|
196
208
|
.filter((axis) => selection[axis.id] !== undefined)
|
|
197
209
|
.map((axis) => `${axis.name}=${selection[axis.id]}`),
|
|
198
210
|
overrides,
|
|
211
|
+
fieldOverrides,
|
|
199
212
|
// A located App copy may lack its full source chain. Absence of
|
|
200
213
|
// metadata is not proof that no overrides exist.
|
|
201
214
|
overridesKnown:
|
|
@@ -293,12 +306,16 @@ export function inspectionReport(
|
|
|
293
306
|
};
|
|
294
307
|
}
|
|
295
308
|
}
|
|
296
|
-
const overridden = component?.overrides
|
|
309
|
+
const overridden = (component?.fieldOverrides ?? component?.overrides)?.some(
|
|
297
310
|
(item) =>
|
|
298
311
|
item.element === component.element &&
|
|
299
312
|
(keys.includes(item.field) ||
|
|
300
313
|
(name === "fill" && item.field === "fills") ||
|
|
301
314
|
(name === "stroke" && item.field === "strokes") ||
|
|
315
|
+
(name === "gap" && item.field === "layout-gap") ||
|
|
316
|
+
(name.startsWith("padding") && item.field === "layout-padding") ||
|
|
317
|
+
(name.startsWith("margin") && item.field === "layout-item-margin") ||
|
|
318
|
+
(name.startsWith("radius") && item.field === "cornerRadius") ||
|
|
302
319
|
(item.field === "textStyle" &&
|
|
303
320
|
Object.hasOwn(item.value ?? {}, name)) ||
|
|
304
321
|
(item.field === "tokenBindings" &&
|
|
@@ -357,6 +374,7 @@ export function inspectionReport(
|
|
|
357
374
|
const nodes = layers.map(({ node, depth, index }) => {
|
|
358
375
|
const raw = projection.nodes[node.id];
|
|
359
376
|
const component = componentInfo(node);
|
|
377
|
+
const { fieldOverrides: _fieldOverrides, ...componentSource } = component ?? {};
|
|
360
378
|
const actual = snapshot.nodes[node.id];
|
|
361
379
|
const parent = parents.get(node.id);
|
|
362
380
|
const parentBounds =
|
|
@@ -406,7 +424,7 @@ export function inspectionReport(
|
|
|
406
424
|
add(
|
|
407
425
|
"gap",
|
|
408
426
|
raw["layout-gap"]?.[column ? "row-gap" : "column-gap"],
|
|
409
|
-
[
|
|
427
|
+
[column ? "rowGap" : "columnGap", "itemSpacing"],
|
|
410
428
|
0,
|
|
411
429
|
);
|
|
412
430
|
for (const [side, key] of [
|
|
@@ -557,7 +575,7 @@ export function inspectionReport(
|
|
|
557
575
|
...(layout ? { layout } : {}),
|
|
558
576
|
fields,
|
|
559
577
|
source: component
|
|
560
|
-
? { kind: "component", ...
|
|
578
|
+
? { kind: "component", ...componentSource }
|
|
561
579
|
: { kind: "page" },
|
|
562
580
|
visibility: {
|
|
563
581
|
value: node.visible,
|
package/bin/smallpen.mjs
CHANGED
|
@@ -3190,6 +3190,11 @@ async function rebuildBefore(snapshot, history, cut) {
|
|
|
3190
3190
|
let complete = true;
|
|
3191
3191
|
for (const entry of [...newer].reverse()) {
|
|
3192
3192
|
if (!entry.inverseBatch) {
|
|
3193
|
+
if (entry.history?.status === "partial")
|
|
3194
|
+
throw new SmallPenError("batch_history_unavailable", "The design was saved, but this earlier revision cannot be reconstructed from the bounded history cache", {
|
|
3195
|
+
batchId: entry.batchId, revision: snapshot.revision, history: entry.history,
|
|
3196
|
+
nextOperations: [{ argv: ["view", snapshot.locator, "--as", "spec", "--json"], operation: "smallpen.view" }],
|
|
3197
|
+
});
|
|
3193
3198
|
complete = false;
|
|
3194
3199
|
break;
|
|
3195
3200
|
}
|
|
@@ -3243,6 +3248,7 @@ async function changesCommand(packagePath, args) {
|
|
|
3243
3248
|
packageId: snapshot.manifest.packageId,
|
|
3244
3249
|
...BATCH_HISTORY_LIMITS,
|
|
3245
3250
|
retainedBatches: histories[index].length,
|
|
3251
|
+
incompleteBatches: histories[index].filter((entry) => entry.history?.status === "partial").length,
|
|
3246
3252
|
oldestRevision: histories[index][0]?.baseRevision,
|
|
3247
3253
|
newestRevision: histories[index].at(-1)?.revision,
|
|
3248
3254
|
})),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smallpen/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"bin"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@smallpen/core": "0.1.0-alpha.
|
|
19
|
-
"@smallpen/local-package": "0.1.0-alpha.
|
|
18
|
+
"@smallpen/core": "0.1.0-alpha.16",
|
|
19
|
+
"@smallpen/local-package": "0.1.0-alpha.16"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|