@invana/blocks 0.0.34 → 0.0.35
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 +23 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -6
- package/dist/index.d.ts +11 -6
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -1176,10 +1176,11 @@ interface GanttSpecBar {
|
|
|
1176
1176
|
};
|
|
1177
1177
|
/** The bar's own hover card. Any one of these opens it. */
|
|
1178
1178
|
summary?: string;
|
|
1179
|
-
result?: Record<string,
|
|
1179
|
+
result?: Record<string, unknown>;
|
|
1180
1180
|
error?: {
|
|
1181
1181
|
code?: string;
|
|
1182
1182
|
message?: string;
|
|
1183
|
+
detail?: string;
|
|
1183
1184
|
};
|
|
1184
1185
|
log?: string;
|
|
1185
1186
|
}
|
|
@@ -1208,12 +1209,14 @@ interface GanttSpecRow {
|
|
|
1208
1209
|
summary?: string;
|
|
1209
1210
|
/** What it said last — the card's foot. */
|
|
1210
1211
|
log?: string;
|
|
1212
|
+
/** Why it failed — `detail` is the longer account under the message. */
|
|
1211
1213
|
error?: {
|
|
1212
1214
|
code?: string;
|
|
1213
1215
|
message?: string;
|
|
1216
|
+
detail?: string;
|
|
1214
1217
|
};
|
|
1215
|
-
/** What it produced, as label/value pairs on the card — `{ rows: 412 }
|
|
1216
|
-
result?: Record<string,
|
|
1218
|
+
/** What it produced, as label/value pairs on the card — `{ rows: 412 }`; nested values read as JSON. */
|
|
1219
|
+
result?: Record<string, unknown>;
|
|
1217
1220
|
/** The tasks it split into, indented under it. A task with no timing draws their stretch. */
|
|
1218
1221
|
subtasks?: GanttSpecRow[];
|
|
1219
1222
|
/** Drawn open. The reader can open and close it either way. */
|
|
@@ -1228,7 +1231,7 @@ interface GanttOptions {
|
|
|
1228
1231
|
nowMs?: number;
|
|
1229
1232
|
/** The run has not decided its length yet: the last tick reads `8s+`. */
|
|
1230
1233
|
openEnded?: boolean;
|
|
1231
|
-
/** Intervals on the axis. `4` by default. */
|
|
1234
|
+
/** Intervals on the axis. `4` by default; on `seq`, one per step (or an even divisor of a long plan). */
|
|
1232
1235
|
ticks?: number;
|
|
1233
1236
|
/** The key column, in px. Defaults to the longest key, up to 40%. */
|
|
1234
1237
|
labelWidth?: number;
|
|
@@ -1658,7 +1661,9 @@ interface BlockProps<K extends BlockKind = BlockKind> {
|
|
|
1658
1661
|
/**
|
|
1659
1662
|
* Set into running text: a table's outer cells sit flush with the words
|
|
1660
1663
|
* around it. Only the assistant sets it; everywhere else a table keeps its
|
|
1661
|
-
* cell padding.
|
|
1664
|
+
* cell padding. Only the table block reads it — grid, scope, proposal and
|
|
1665
|
+
* confirm are always seamless, since unset each would draw a box inside
|
|
1666
|
+
* the frame that already holds it.
|
|
1662
1667
|
*/
|
|
1663
1668
|
seamless?: boolean;
|
|
1664
1669
|
}
|
|
@@ -1833,7 +1838,7 @@ interface BlockComponentProps {
|
|
|
1833
1838
|
/**
|
|
1834
1839
|
* Set into running text: the outer cells of a table sit flush with the words
|
|
1835
1840
|
* around it. The assistant sets it; a board panel or a page section does not,
|
|
1836
|
-
* so its tables keep their padding.
|
|
1841
|
+
* so its tables keep their padding. Only the table block reads it.
|
|
1837
1842
|
*/
|
|
1838
1843
|
seamless?: boolean;
|
|
1839
1844
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1176,10 +1176,11 @@ interface GanttSpecBar {
|
|
|
1176
1176
|
};
|
|
1177
1177
|
/** The bar's own hover card. Any one of these opens it. */
|
|
1178
1178
|
summary?: string;
|
|
1179
|
-
result?: Record<string,
|
|
1179
|
+
result?: Record<string, unknown>;
|
|
1180
1180
|
error?: {
|
|
1181
1181
|
code?: string;
|
|
1182
1182
|
message?: string;
|
|
1183
|
+
detail?: string;
|
|
1183
1184
|
};
|
|
1184
1185
|
log?: string;
|
|
1185
1186
|
}
|
|
@@ -1208,12 +1209,14 @@ interface GanttSpecRow {
|
|
|
1208
1209
|
summary?: string;
|
|
1209
1210
|
/** What it said last — the card's foot. */
|
|
1210
1211
|
log?: string;
|
|
1212
|
+
/** Why it failed — `detail` is the longer account under the message. */
|
|
1211
1213
|
error?: {
|
|
1212
1214
|
code?: string;
|
|
1213
1215
|
message?: string;
|
|
1216
|
+
detail?: string;
|
|
1214
1217
|
};
|
|
1215
|
-
/** What it produced, as label/value pairs on the card — `{ rows: 412 }
|
|
1216
|
-
result?: Record<string,
|
|
1218
|
+
/** What it produced, as label/value pairs on the card — `{ rows: 412 }`; nested values read as JSON. */
|
|
1219
|
+
result?: Record<string, unknown>;
|
|
1217
1220
|
/** The tasks it split into, indented under it. A task with no timing draws their stretch. */
|
|
1218
1221
|
subtasks?: GanttSpecRow[];
|
|
1219
1222
|
/** Drawn open. The reader can open and close it either way. */
|
|
@@ -1228,7 +1231,7 @@ interface GanttOptions {
|
|
|
1228
1231
|
nowMs?: number;
|
|
1229
1232
|
/** The run has not decided its length yet: the last tick reads `8s+`. */
|
|
1230
1233
|
openEnded?: boolean;
|
|
1231
|
-
/** Intervals on the axis. `4` by default. */
|
|
1234
|
+
/** Intervals on the axis. `4` by default; on `seq`, one per step (or an even divisor of a long plan). */
|
|
1232
1235
|
ticks?: number;
|
|
1233
1236
|
/** The key column, in px. Defaults to the longest key, up to 40%. */
|
|
1234
1237
|
labelWidth?: number;
|
|
@@ -1658,7 +1661,9 @@ interface BlockProps<K extends BlockKind = BlockKind> {
|
|
|
1658
1661
|
/**
|
|
1659
1662
|
* Set into running text: a table's outer cells sit flush with the words
|
|
1660
1663
|
* around it. Only the assistant sets it; everywhere else a table keeps its
|
|
1661
|
-
* cell padding.
|
|
1664
|
+
* cell padding. Only the table block reads it — grid, scope, proposal and
|
|
1665
|
+
* confirm are always seamless, since unset each would draw a box inside
|
|
1666
|
+
* the frame that already holds it.
|
|
1662
1667
|
*/
|
|
1663
1668
|
seamless?: boolean;
|
|
1664
1669
|
}
|
|
@@ -1833,7 +1838,7 @@ interface BlockComponentProps {
|
|
|
1833
1838
|
/**
|
|
1834
1839
|
* Set into running text: the outer cells of a table sit flush with the words
|
|
1835
1840
|
* around it. The assistant sets it; a board panel or a page section does not,
|
|
1836
|
-
* so its tables keep their padding.
|
|
1841
|
+
* so its tables keep their padding. Only the table block reads it.
|
|
1837
1842
|
*/
|
|
1838
1843
|
seamless?: boolean;
|
|
1839
1844
|
/**
|
package/dist/index.js
CHANGED
|
@@ -859,6 +859,21 @@ var toBar = ({ chip, ...bar }) => ({
|
|
|
859
859
|
});
|
|
860
860
|
var STEP_TICK = (n) => `step ${Math.round(n)}`;
|
|
861
861
|
var STEPS = (n) => Math.round(n) === 1 ? "1 step" : `${Math.round(n)} steps`;
|
|
862
|
+
var lastEnd = (spec) => {
|
|
863
|
+
const end = (b) => (b.startMs ?? 0) + (b.durationMs ?? 0);
|
|
864
|
+
const ends = (tasks) => tasks.flatMap((t) => [
|
|
865
|
+
...t.startMs != null ? [end(t)] : [],
|
|
866
|
+
...(t.attempts ?? []).map(end),
|
|
867
|
+
...(t.segments ?? []).map(end),
|
|
868
|
+
...ends(t.subtasks ?? [])
|
|
869
|
+
]);
|
|
870
|
+
return Math.max(spec.nowMs ?? 0, ...ends(spec.tasks), ...(spec.seams ?? []).map(end));
|
|
871
|
+
};
|
|
872
|
+
var stepTicks = (span) => {
|
|
873
|
+
if (span <= 8) return span;
|
|
874
|
+
for (let n = 8; n > 1; n--) if (span % n === 0) return n;
|
|
875
|
+
return 1;
|
|
876
|
+
};
|
|
862
877
|
var toRow = ({ open: _open, subtasks, segments, ...task }) => ({
|
|
863
878
|
...task,
|
|
864
879
|
bars: segments?.map(toBar),
|
|
@@ -885,6 +900,10 @@ function GanttBlock({ spec, onAction }) {
|
|
|
885
900
|
}
|
|
886
901
|
}
|
|
887
902
|
const rows = React18.useMemo(() => spec.tasks.map(toRow), [spec.tasks]);
|
|
903
|
+
const seq = spec.scale === "seq";
|
|
904
|
+
const steps = seq ? spec.spanMs ?? Math.max(Math.ceil(lastEnd(spec)), 1) : void 0;
|
|
905
|
+
const span = steps ?? spec.spanMs;
|
|
906
|
+
const ticks = spec.ticks ?? (steps != null ? stepTicks(steps) : void 0);
|
|
888
907
|
const pick = (key) => {
|
|
889
908
|
setSelected(key);
|
|
890
909
|
onAction?.("select", key);
|
|
@@ -893,12 +912,12 @@ function GanttBlock({ spec, onAction }) {
|
|
|
893
912
|
Gantt,
|
|
894
913
|
{
|
|
895
914
|
rows,
|
|
896
|
-
spanMs:
|
|
915
|
+
spanMs: span,
|
|
897
916
|
nowMs: spec.nowMs,
|
|
898
917
|
openEnded: spec.openEnded,
|
|
899
|
-
ticks
|
|
900
|
-
formatTick:
|
|
901
|
-
formatDuration:
|
|
918
|
+
ticks,
|
|
919
|
+
formatTick: seq ? STEP_TICK : void 0,
|
|
920
|
+
formatDuration: seq ? STEPS : void 0,
|
|
902
921
|
labelWidth: spec.labelWidth,
|
|
903
922
|
durationWidth: spec.durationWidth,
|
|
904
923
|
palette: spec.palette,
|
|
@@ -1331,7 +1350,6 @@ function ProposalBlock({ spec, onAction }) {
|
|
|
1331
1350
|
ProposalCard,
|
|
1332
1351
|
{
|
|
1333
1352
|
flush: true,
|
|
1334
|
-
seamless: true,
|
|
1335
1353
|
title: spec.heading,
|
|
1336
1354
|
done: spec.done?.label,
|
|
1337
1355
|
consequence: spec.consequence,
|