@nodii/dev 0.6.185 → 0.6.187
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 +26 -4
- package/dist/cli.js +17 -0
- package/dist/core.js +1 -1
- package/dist/figma.js +73 -0
- package/dist/flags.js +1 -0
- package/dist/plugin-trim.js +14 -4
- package/dist/runtime-launcher.js +4 -4
- package/dist/starting.js +2 -1
- package/dist/surface.js +15 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -348,6 +348,7 @@ nodii-dev figma published FILE_KEY|CHANGE_SET --figma-version VERSION
|
|
|
348
348
|
nodii-dev figma abandon CHANGE_SET
|
|
349
349
|
nodii-dev figma withdraw CHANGE_SET # take back a submit before anything is decided
|
|
350
350
|
nodii-dev figma split CHANGE_SET --nodes NODE[,NODE] --title TEXT # move written nodes to a new set
|
|
351
|
+
nodii-dev figma restore CHANGE_SET --lane KEY|--holder AGENT_ID --reason TEXT # staff or Steward: undo a sweep's abandon (MW8-4.3)
|
|
351
352
|
nodii-dev figma resubmit CHANGE_SET PAYLOAD.json # round 2: re-submit every rejected item
|
|
352
353
|
nodii-dev figma changeset show CHANGE_SET # items, variants, round, decision, comment
|
|
353
354
|
nodii-dev figma release FILE_KEY
|
|
@@ -464,6 +465,26 @@ Dev refuses with:
|
|
|
464
465
|
- `CHANGE_SET_NOT_EDITABLE` while the set is in review or its submit is running;
|
|
465
466
|
- `CHANGE_SET_HOLDER_REQUIRED` for anyone but the holder.
|
|
466
467
|
|
|
468
|
+
`figma restore CS --lane KEY|--holder AGENT_ID --reason TEXT` returns a set
|
|
469
|
+
that Dev's dead-holder sweep abandoned to `editing` under the named holder
|
|
470
|
+
(Dev's `restoreDesignChangeSet`, hub #705; MW8-4.3, ratified 20 Nov as DEC-0550;
|
|
471
|
+
hub-590). Use it when a lane was frozen on an exhausted account
|
|
472
|
+
and the sweep abandoned its drawn work (CS-3709, CS-3722). Dev takes back the
|
|
473
|
+
set's file lock and the scopes the sweep released, under the file's row lock,
|
|
474
|
+
and keeps its write log, items, base and history. `--lane` sends the lane key
|
|
475
|
+
and Dev resolves the lane's current agent; `--holder` takes an agent id (any
|
|
476
|
+
other value is read as a lane key). Only staff or a live Steward over the
|
|
477
|
+
lane's repositories may run it; a lane is refused.
|
|
478
|
+
|
|
479
|
+
Dev refuses with, and the CLI says what to do next for:
|
|
480
|
+
- `CHANGE_SET_SCOPE_TAKEN` or `CHANGE_SET_ALREADY_HELD` when another set took
|
|
481
|
+
a scope or the file's lock since (the set and its holder are named);
|
|
482
|
+
- `CHANGE_SET_NOT_ABANDONED` for a set that isn't abandoned, and
|
|
483
|
+
`CHANGE_SET_NOT_SWEPT` for one abandoned other than by the sweep;
|
|
484
|
+
- `RESTORE_HOLDER_NOT_LIVE` when the holder has no live lane (it would be swept
|
|
485
|
+
again), `RESTORE_HOLDER_NOT_FOUND` and `RESTORE_HOLDER_MISMATCH`;
|
|
486
|
+
- `CHANGE_SET_RESTORE_NOT_ALLOWED` for a lane caller, and `FILE_RETIRED`.
|
|
487
|
+
|
|
467
488
|
`figma withdraw` moves a change set you hold from `in_review` back to
|
|
468
489
|
`editing`, as long as no item has been decided (Dev's
|
|
469
490
|
`withdrawDesignChangeSet`). Dev refuses when the change set doesn't exist
|
|
@@ -2099,10 +2120,11 @@ list derived from each lane's own scope rather than fixed.
|
|
|
2099
2120
|
- turn off every one the lane doesn't keep, with
|
|
2100
2121
|
`--settings {"enabledPlugins":{"<name>@synced":false}}`.
|
|
2101
2122
|
|
|
2102
|
-
What a lane keeps depends on whether
|
|
2103
|
-
|
|
2104
|
-
objective or notes
|
|
2105
|
-
|
|
2123
|
+
What a lane keeps depends on whether it has a Figma boundary: a Figma scope,
|
|
2124
|
+
`design-system` or `nodii-frontend` among its repositories, or a `figma` step.
|
|
2125
|
+
Words in its objective or notes never count; coordinators' boilerplate names
|
|
2126
|
+
Surfaces in nearly every objective, so a text match kept everything on (the
|
|
2127
|
+
0.6.185 live check, 20 Nov).
|
|
2106
2128
|
- **A lane that reaches Figma** keeps the `figma` and `design` plugins and the
|
|
2107
2129
|
claude.ai connectors, which include the Figma MCP.
|
|
2108
2130
|
- **Any other lane** also runs with `ENABLE_CLAUDEAI_MCP_SERVERS=false`.
|
package/dist/cli.js
CHANGED
|
@@ -70,6 +70,9 @@ import {
|
|
|
70
70
|
withdrawItemsFrom,
|
|
71
71
|
figmaSplit,
|
|
72
72
|
figmaSplitText,
|
|
73
|
+
figmaRestore,
|
|
74
|
+
figmaRestoreText,
|
|
75
|
+
RESTORE_USAGE,
|
|
73
76
|
listFlag,
|
|
74
77
|
SPLIT_USAGE,
|
|
75
78
|
checkSubmitPayload,
|
|
@@ -283,6 +286,10 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
283
286
|
# write log into a new set you hold on the same file, base and seal; receipts
|
|
284
287
|
# move, never copied. A node an item names stays (SPLIT_NODE_IN_ITEM); the lock
|
|
285
288
|
# stays with the source. hub-572
|
|
289
|
+
figma restore CHANGE_SET --lane KEY|--holder AGENT_ID --reason TEXT
|
|
290
|
+
# staff or Steward: return a set Dev's dead-holder sweep abandoned to editing
|
|
291
|
+
# under the named holder (a lane key means its current agent), re-taking its
|
|
292
|
+
# file lock and scopes and keeping its write log. hub-590
|
|
286
293
|
figma withdraw CHANGE_SET # holder takes back a submit: in_review -> editing (or a re-submit -> applying)
|
|
287
294
|
figma withdraw CHANGE_SET --items ID[,ID] --reason TEXT [--lane-reads FILE [--removed-nodes NODE[,NODE]]]
|
|
288
295
|
# holder, coordinator or operator: take rejected items (item or node ids)
|
|
@@ -1842,6 +1849,16 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
1842
1849
|
(p) => figmaSplitText(rest[0], p.data),
|
|
1843
1850
|
);
|
|
1844
1851
|
}
|
|
1852
|
+
if (action === "restore") {
|
|
1853
|
+
if (rest.length !== 1) throw new CliError("USAGE", RESTORE_USAGE, 2);
|
|
1854
|
+
const pick = (value) => (value === true ? "" : value);
|
|
1855
|
+
const named = { lane: pick(f.lane), holder: pick(f.holder) };
|
|
1856
|
+
return emit(
|
|
1857
|
+
await figmaRestore(rest[0], { ...named, reason: pick(f.reason) }),
|
|
1858
|
+
json,
|
|
1859
|
+
(p) => figmaRestoreText(rest[0], p.data, named),
|
|
1860
|
+
);
|
|
1861
|
+
}
|
|
1845
1862
|
if (action === "resubmit")
|
|
1846
1863
|
return emit(await figmaResubmit(rest[0], rest[1], { sync: submitMode(f), ...(f["lane-reads"] ? { laneReads: await readLaneReads(f["lane-reads"]) } : {}) }), json, (p) =>
|
|
1847
1864
|
[`Re-submitted ${rest[0]}; it is ${p.data.state}.`, figmaChangeSetText(p.data), ...conformanceLines({ warnings: p.warnings })].join("\n"));
|
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.187";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
package/dist/figma.js
CHANGED
|
@@ -1153,6 +1153,79 @@ export function figmaSplitText(id, data) {
|
|
|
1153
1153
|
return `Moved ${count} node${count === 1 ? "" : "s"} (${moved.receipts ?? 0} write receipt${moved.receipts === 1 ? "" : "s"}) from ${id} to ${created.id} "${created.title}". Both sets are yours and editing; each submits with its own items.`;
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
1156
|
+
// hub-590: Dev's dead-holder sweep abandons the sets of lanes frozen on an
|
|
1157
|
+
// exhausted account (CS-3709, CS-3722). Staff or a Steward returns such a set
|
|
1158
|
+
// to editing under a named holder: Dev re-acquires its file lock and scopes and
|
|
1159
|
+
// keeps its write log (restoreDesignChangeSet).
|
|
1160
|
+
export const RESTORE_USAGE = "figma restore CHANGE_SET --lane KEY|--holder AGENT_ID --reason TEXT";
|
|
1161
|
+
|
|
1162
|
+
/** Dev's restore route and body, in one place: the holder is { holderAgentId } or { laneKey }. */
|
|
1163
|
+
export const restoreRequest = (id, holder, reason) =>
|
|
1164
|
+
["POST", `/api/v1/design/change-sets/${encode(id)}/restore`, { ...holder, reason }];
|
|
1165
|
+
|
|
1166
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1167
|
+
|
|
1168
|
+
const blocker = (details, fallback) => {
|
|
1169
|
+
const set = details?.changeSetId ?? details?.heldBy?.changeSetId ?? fallback;
|
|
1170
|
+
return details?.holderAgentId ? `${set} (held by agent ${details.holderAgentId})` : set;
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// The refusals restoreDesignChangeSet gives (hub #705), each with its next step.
|
|
1174
|
+
const RESTORE_REFUSALS = {
|
|
1175
|
+
CHANGE_SET_SCOPE_TAKEN: (id, details) =>
|
|
1176
|
+
`${blocker(details, "another open set")} took a scope ${id} held, so ${id} can't take its scopes back. Next: finish, withdraw or abandon that set (or have its holder narrow its scopes with figma scope set), then run figma restore ${id} again.`,
|
|
1177
|
+
CHANGE_SET_ALREADY_HELD: (id, details) =>
|
|
1178
|
+
`${blocker(details, "another set")} holds ${id}'s file now, and a file takes one lock per agent. Next: have its holder finish, abandon or release it, or move it with figma transfer CHANGE_SET --to LANE --reason TEXT, then run figma restore ${id} again.`,
|
|
1179
|
+
CHANGE_SET_NOT_SWEPT: (id) =>
|
|
1180
|
+
`${id} was abandoned, but not by Dev's dead-holder sweep, so it can't be restored (MW8-4.3). Next: redraw its work in a new set (figma lock), or read its history with figma changeset show ${id}.`,
|
|
1181
|
+
CHANGE_SET_NOT_ABANDONED: (id, details) =>
|
|
1182
|
+
`${id} is not abandoned${details?.state ? ` (it is ${details.state})` : ""}, so there is nothing to restore. Next: an open set moves to another lane with figma transfer ${id} --to LANE --reason TEXT.`,
|
|
1183
|
+
CHANGE_SET_RESTORE_NOT_ALLOWED: (id) =>
|
|
1184
|
+
`Only staff or a live Steward over the lane's repositories can restore ${id}; a lane can't restore a set, even its own. Next: ask the coordinator or the Steward to run figma restore ${id} --lane KEY --reason TEXT.`,
|
|
1185
|
+
RESTORE_HOLDER_NOT_LIVE: (id) =>
|
|
1186
|
+
`The named holder has no live lane, so ${id} would be swept again. Next: resume the lane (nodii-dev lane resume KEY), then run figma restore ${id} again.`,
|
|
1187
|
+
RESTORE_HOLDER_MISMATCH: (id) =>
|
|
1188
|
+
`--holder and the lane's current agent differ. Next: name the holder once, with --lane KEY or --holder AGENT_ID, and run figma restore ${id} again.`,
|
|
1189
|
+
RESTORE_HOLDER_NOT_FOUND: (id) =>
|
|
1190
|
+
`Dev has no such lane or agent to hold ${id}. Next: name a lane key from nodii-dev lane list, or the holder's agent id.`,
|
|
1191
|
+
FILE_RETIRED: (id) => `${id}'s Figma file is retired, so the set can't come back. Next: redraw the work on the file that replaced it.`,
|
|
1192
|
+
DESIGN_FILE_NOT_FOUND: (id) => `Dev has no record of ${id}'s Figma file. Next: read the set with figma changeset show ${id}.`,
|
|
1193
|
+
CHANGE_SET_NOT_FOUND: (id) => `No change set ${id} in Dev. Next: check the id with figma changeset list --all.`,
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
const given = (value) => typeof value === "string" && value.trim() ? value.trim() : null;
|
|
1197
|
+
|
|
1198
|
+
export async function figmaRestore(id, { lane, holder, reason } = {}, { request = devRequest } = {}) {
|
|
1199
|
+
if (!id) throw new CliError("USAGE", RESTORE_USAGE, 2);
|
|
1200
|
+
if (lane !== undefined && holder !== undefined) throw new CliError("USAGE", `Name the holder with --lane KEY or --holder AGENT_ID, not both: ${RESTORE_USAGE}`, 2);
|
|
1201
|
+
const named = given(lane) ?? given(holder);
|
|
1202
|
+
if (!named) throw new CliError("USAGE", `Name who holds the set with --lane KEY or --holder AGENT_ID: ${RESTORE_USAGE}`, 2);
|
|
1203
|
+
if (!given(reason)) throw new CliError("USAGE", `--reason needs why the set comes back: ${RESTORE_USAGE}`, 2);
|
|
1204
|
+
// An agent id goes as one; anything else is a lane key, which Dev resolves to its current agent.
|
|
1205
|
+
const body = lane === undefined && UUID.test(named) ? { holderAgentId: named } : { laneKey: named };
|
|
1206
|
+
try {
|
|
1207
|
+
return await request(...restoreRequest(id, body, given(reason)));
|
|
1208
|
+
} catch (error) {
|
|
1209
|
+
const say = RESTORE_REFUSALS[error?.code];
|
|
1210
|
+
if (say) throw new CliError(error.code, say(id, error.details), error.exitCode ?? 1, error.details);
|
|
1211
|
+
throw error;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export function figmaRestoreText(id, data, { lane, holder } = {}) {
|
|
1216
|
+
const set = data?.changeSet ?? {};
|
|
1217
|
+
const done = data?.restored ?? {};
|
|
1218
|
+
const agent = done.holderAgentId ?? set.holderAgentId ?? holder;
|
|
1219
|
+
const key = lane ?? (holder && !UUID.test(holder) ? holder : null);
|
|
1220
|
+
const who = key ? `lane ${key}'s agent ${agent}` : `agent ${agent}`;
|
|
1221
|
+
const scopes = done.scopes ?? [];
|
|
1222
|
+
const name = done.changeSetId ?? set.id ?? id;
|
|
1223
|
+
return [
|
|
1224
|
+
`${name} is ${set.state ?? "editing"} again under ${who}, with its file lock, ${scopes.length} scope${scopes.length === 1 ? "" : "s"}${scopes.length ? ` (${scopes.map(scopeText).join(", ")})` : ""} and its write log.`,
|
|
1225
|
+
`Next: the holder carries on drawing, then submits with nodii-dev figma submit ${name} --file SUBMISSION.json.`,
|
|
1226
|
+
].join("\n");
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1156
1229
|
/**
|
|
1157
1230
|
* Apply on the lane's reads (MW1-57.11): the reads' Figma version unless one
|
|
1158
1231
|
* is named. Reads over a chunk go up to the set first and are named by
|
package/dist/flags.js
CHANGED
|
@@ -84,6 +84,7 @@ export const COMMAND_FLAGS = {
|
|
|
84
84
|
"figma resubmit": [...SUBMIT_MODE, "dry-run", "lane-reads"],
|
|
85
85
|
"figma withdraw": ["items", "reason", "lane-reads", "removed-nodes"],
|
|
86
86
|
"figma split": ["nodes", "title"],
|
|
87
|
+
"figma restore": ["lane", "holder", "reason"],
|
|
87
88
|
"figma lane-reads-script": ["nodes"],
|
|
88
89
|
"figma abandon": ["file"],
|
|
89
90
|
// hub-260: list takes these; show takes none.
|
package/dist/plugin-trim.js
CHANGED
|
@@ -16,15 +16,25 @@ export const PLUGIN_TRIM_VARIABLE = "NODII_DEV_PLUGIN_TRIM";
|
|
|
16
16
|
|
|
17
17
|
// The design repositories hold Surfaces and Code Connect, read through Figma.
|
|
18
18
|
const FIGMA_REPOS = new Set(["design-system", "nodii-frontend"]);
|
|
19
|
-
const FIGMA_TEXT = /\b(figma|surfaces?|design[- ]system|change[- ]sets?|code connect)\b/i;
|
|
20
19
|
// What a Figma lane keeps: the Figma plugin, and the design plugin beside it.
|
|
21
20
|
const FIGMA_PLUGINS = new Set(["figma", "design"]);
|
|
22
21
|
|
|
23
|
-
/**
|
|
24
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Whether the lane has a Figma boundary: a Figma scope, a design repository,
|
|
24
|
+
* or a figma step. Words in its objective never count: the 0.6.185 live check
|
|
25
|
+
* (20 Nov) found coordinator boilerplate ("Surface changes follow MW6 1.5")
|
|
26
|
+
* in nearly every objective, so a text match kept everything on.
|
|
27
|
+
*/
|
|
28
|
+
export function laneNeedsFigma({ repos = [], figmaScopes = [], steps = [] } = {}) {
|
|
25
29
|
if (figmaScopes?.length) return true;
|
|
26
30
|
if (repos.some((repo) => FIGMA_REPOS.has(repo))) return true;
|
|
27
|
-
return
|
|
31
|
+
return steps.some((step) => /^figma/i.test(String(step ?? "")));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A lane record's step keys, from its steps and its next steps; any other shape is none. */
|
|
35
|
+
export function laneStepKeys(lane) {
|
|
36
|
+
const list = (value) => (Array.isArray(value) ? value : []);
|
|
37
|
+
return [...list(lane?.steps).map((step) => step?.stepKey), ...list(lane?.next).map((step) => step?.step)].filter((key) => typeof key === "string");
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
/** The synced plugins in a Claude profile, by their own names (plugins/synced/<org>/<dir>/.claude-plugin/plugin.json). */
|
package/dist/runtime-launcher.js
CHANGED
|
@@ -7,7 +7,7 @@ import { configPath } from "./core.js";
|
|
|
7
7
|
import { laneConfigName } from "./lane-env.js";
|
|
8
8
|
import { recordWatchedRun } from "./watchdog.js";
|
|
9
9
|
import { laneSwitchOn } from "./lane-switches.js";
|
|
10
|
-
import { laneTrim } from "./plugin-trim.js";
|
|
10
|
+
import { laneStepKeys, laneTrim } from "./plugin-trim.js";
|
|
11
11
|
import { continuationInvocation, continueTaskMessage, sessionIdFromLog, subagentBudgetLine } from "./lane-supervisor.js";
|
|
12
12
|
|
|
13
13
|
const RUNTIMES = new Set(["codex", "claude"]);
|
|
@@ -275,12 +275,12 @@ export function buildRecoveryInvocation(data, { env = process.env, home = homedi
|
|
|
275
275
|
return buildInvocation({ runId, laneKey, runtime, model, cwd, addDirs, profileHome: data.launch.profileHome, devConfigPath, trim }, { env, home });
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
/** NODII-DEV-CLI-191 change (8): a recovered lane's scope, from its Freeze and its
|
|
278
|
+
/** NODII-DEV-CLI-191 change (8): a recovered lane's scope, from its Freeze boundaries and its steps. */
|
|
279
279
|
export function recoveryScope(data) {
|
|
280
280
|
const freeze = data?.recovery?.freeze ?? {};
|
|
281
281
|
const repos = (freeze.boundaries?.repos ?? data?.lane?.repositories ?? []).map((r) => (typeof r === "string" ? r : r?.repo)).filter(Boolean);
|
|
282
|
-
const
|
|
283
|
-
return { repos, figmaScopes: data?.lane?.figmaScopes ?? freeze.boundaries?.figmaScopes ?? [],
|
|
282
|
+
const steps = laneStepKeys(data?.lane);
|
|
283
|
+
return { repos, figmaScopes: data?.lane?.figmaScopes ?? freeze.boundaries?.figmaScopes ?? [], steps };
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
function buildInvocation(options, { env = process.env, home = homedir() } = {}) {
|
package/dist/starting.js
CHANGED
|
@@ -15,6 +15,7 @@ import { cachedGet, laneReadCache } from "./read-cache.js";
|
|
|
15
15
|
import { clearCoordinatorMarker, coordinatorMarkerPath } from "./coordinator-items.js";
|
|
16
16
|
import { accountFlags, listAccounts, profilePath, registerAccount, reportUsage, usageLine } from "./accounts.js";
|
|
17
17
|
import { subagentBudgetLine } from "./lane-supervisor.js";
|
|
18
|
+
import { laneStepKeys } from "./plugin-trim.js";
|
|
18
19
|
|
|
19
20
|
const execFile = promisify(execFileCallback);
|
|
20
21
|
const via = { via: "nodii-dev" };
|
|
@@ -699,7 +700,7 @@ export async function launchLaneCommand(key, flags, {
|
|
|
699
700
|
prompt: [payload.data.brief, subagentBudgetLine(payload.data.lane?.subagentQuota ?? body.subagentQuota)].filter(Boolean).join("\n\n"),
|
|
700
701
|
runId: payload.data.run.id,
|
|
701
702
|
// NODII-DEV-CLI-191 change (8): the plugins and connectors this lane keeps follow its scope.
|
|
702
|
-
scope: { repos: repositories.map(({ repo }) => repo), figmaScopes: body.figmaScopes ?? [],
|
|
703
|
+
scope: { repos: repositories.map(({ repo }) => repo), figmaScopes: body.figmaScopes ?? [], steps: laneStepKeys(payload.data.lane) },
|
|
703
704
|
});
|
|
704
705
|
} catch (error) {
|
|
705
706
|
try {
|
package/dist/surface.js
CHANGED
|
@@ -34,7 +34,7 @@ import { MIN_FIGMA_INTERVAL_MS, figmaRest } from "./figma-rest.js";
|
|
|
34
34
|
import { createRenderer } from "./vendor/render-templates.mjs";
|
|
35
35
|
|
|
36
36
|
/** Bumped whenever the emitted code changes shape for the same inputs. */
|
|
37
|
-
export const GENERATOR_FORMAT =
|
|
37
|
+
export const GENERATOR_FORMAT = 44;
|
|
38
38
|
/**
|
|
39
39
|
* DS parts that are an item of their parent's own list or grid, so they take no sizing
|
|
40
40
|
* wrapper: a Detail Section / Row's facts are the section grid's cells, a Right Pane / Row
|
|
@@ -3279,6 +3279,17 @@ function tableOf(node, ctx) {
|
|
|
3279
3279
|
}
|
|
3280
3280
|
}
|
|
3281
3281
|
const headRow = parsed.filter((p) => p.kind === "head").at(-1) ?? null;
|
|
3282
|
+
// A body cell takes its column's alignment from the head (hub-574): a right-aligned
|
|
3283
|
+
// money head over left-aligned amounts reads each amount as the column to its left's.
|
|
3284
|
+
const headAlign = (i) => /^\s*<Table(?:Sort)?Head\b[^>]*?\scolAlign="(\w+)"/.exec(headRow?.cells[i]?.code ?? "")?.[1] ?? null;
|
|
3285
|
+
const withAlign = (code, i) => {
|
|
3286
|
+
const align = headAlign(i);
|
|
3287
|
+
if (!align || !code) return code;
|
|
3288
|
+
const m = /^(\s*<TableCell)(?=[\s>/])/.exec(code);
|
|
3289
|
+
if (!m) return code;
|
|
3290
|
+
const open = code.slice(0, openTagEnd(code.slice(m.index)) + m.index + 1);
|
|
3291
|
+
return /\scolAlign=/.test(open) ? code : code.replace(m[1], `${m[1]} colAlign="${align}"`);
|
|
3292
|
+
};
|
|
3282
3293
|
const loadingRows = parsed.filter((p) => p.kind === LOADING);
|
|
3283
3294
|
const bodyRows = parsed.filter((p) => p.kind !== "head" && p.kind !== GROUP);
|
|
3284
3295
|
// The column count is the real header's: with no header row there is none to take.
|
|
@@ -3455,14 +3466,14 @@ function tableOf(node, ctx) {
|
|
|
3455
3466
|
const secondaryKeys = new Set(keys);
|
|
3456
3467
|
const cells = first.cells.map((c, i) => {
|
|
3457
3468
|
const w = columnWidth(c.cell);
|
|
3458
|
-
let open = `<TableCell${wrapperAttrs(w, first.row)}
|
|
3469
|
+
let open = withAlign(`<TableCell${wrapperAttrs(w, first.row)}>`, i);
|
|
3459
3470
|
let close = "</TableCell>";
|
|
3460
3471
|
if (c.code && !c.held) {
|
|
3461
3472
|
const emitted = emitNode(c.cell, { ...ctx, depth: 0, parent: null, path: `${ctx.path} › ${first.row.name}`, root: false, bare: true, inTable: true, scopes: null, note: () => {} });
|
|
3462
3473
|
const own = withWidth(c.selected ? selectedCell(emitted) : emitted, w).trim();
|
|
3463
3474
|
const end = openTagEnd(own);
|
|
3464
3475
|
const tag = /^<([A-Za-z]+)/.exec(own)[1];
|
|
3465
|
-
open = own.slice(0, end + 1).replace(/\s*\/>$/, ">");
|
|
3476
|
+
open = withAlign(own.slice(0, end + 1).replace(/\s*\/>$/, ">"), i);
|
|
3466
3477
|
close = `</${tag}>`;
|
|
3467
3478
|
}
|
|
3468
3479
|
// Selection is record data even when the drawing shows every row unchecked.
|
|
@@ -3528,7 +3539,7 @@ function tableOf(node, ctx) {
|
|
|
3528
3539
|
? [skeletonRows()]
|
|
3529
3540
|
: kind === "body" && liftable
|
|
3530
3541
|
? liftedRows()
|
|
3531
|
-
: list.flatMap((p) => (p.unrecognised ? [indent(comment(p.unrecognised), depth + 2)] : [indent("<TableRow>", depth + 2), ...p.cells.map((c, i) => (p === headRow ? liftHeading(controlSort(cellCode(c, p.row, depth + 3, headKeys[i]), headKeys[i]), headKeys[i]) : p.kind === GROUP && columnCount ? cellCode(c, p.row, depth + 3, null).replace(/^(\s*<\w+)(?:\s+width=(?:\{[^}]*\}|"[^"]*"))?/, `$1 colSpan={${columnCount}} scope="colgroup"`) : cellCode(c, p.row, depth + 3, null))), indent("</TableRow>", depth + 2)]))),
|
|
3542
|
+
: list.flatMap((p) => (p.unrecognised ? [indent(comment(p.unrecognised), depth + 2)] : [indent("<TableRow>", depth + 2), ...p.cells.map((c, i) => (p === headRow ? liftHeading(controlSort(cellCode(c, p.row, depth + 3, headKeys[i]), headKeys[i]), headKeys[i]) : p.kind === GROUP && columnCount ? cellCode(c, p.row, depth + 3, null).replace(/^(\s*<\w+)(?:\s+width=(?:\{[^}]*\}|"[^"]*"))?/, `$1 colSpan={${columnCount}} scope="colgroup"`) : withAlign(cellCode(c, p.row, depth + 3, null), i))), indent("</TableRow>", depth + 2)]))),
|
|
3532
3543
|
indent(`</${tag}>`, depth + 1),
|
|
3533
3544
|
];
|
|
3534
3545
|
};
|