reifyui 0.7.0 → 0.7.1
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 +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/sheet/SheetGrid.jsx +32 -2
- package/styles/sheet.css +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reifyui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "The open-source rendering & interaction layer for agentic applications. Stream and render any agent's output as polished, application-native UI \u2014 model-agnostic, framework-agnostic, design-system-native. The foundation for building generative-UI and agent products.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
package/src/index.js
CHANGED
|
@@ -44,7 +44,7 @@ export {
|
|
|
44
44
|
export { AuthForm } from './auth/AuthForm.jsx';
|
|
45
45
|
export { GoogleButton, GOOGLE_ENABLED } from './auth/GoogleButton.jsx';
|
|
46
46
|
// Shared AI-spreadsheet grid (reusable in the Sheets product AND studio Spaces).
|
|
47
|
-
export { SheetGrid, sheetToDelimited, sheetToAoA } from './sheet/SheetGrid.jsx';
|
|
47
|
+
export { SheetGrid, sheetToDelimited, sheetToAoA, fitRowHeights } from './sheet/SheetGrid.jsx';
|
|
48
48
|
// Files, drawn the same wherever they appear. FileTypeIcon uses react-file-icon when it is
|
|
49
49
|
// installed (an optional peer) and falls back to an extension badge when it is not.
|
|
50
50
|
export { FileTypeIcon, extOf } from './components/FileTypeIcon.jsx';
|
package/src/sheet/SheetGrid.jsx
CHANGED
|
@@ -468,7 +468,7 @@ export function SheetGrid({
|
|
|
468
468
|
</thead>
|
|
469
469
|
<tbody>
|
|
470
470
|
{rows.map((row, ri) => (
|
|
471
|
-
<tr key={row.id}
|
|
471
|
+
<tr key={row.id} data-row-id={row.id}
|
|
472
472
|
style={{
|
|
473
473
|
...(rowHeight(row) ? { height: rowHeight(row) } : null),
|
|
474
474
|
'--shg-clamp': Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18)),
|
|
@@ -496,7 +496,7 @@ export function SheetGrid({
|
|
|
496
496
|
runCell: onRunCell && !readOnly ? () => onRunCell(row.id, col.id) : null,
|
|
497
497
|
});
|
|
498
498
|
return (
|
|
499
|
-
<td key={col.id}
|
|
499
|
+
<td key={col.id} data-col-id={col.id}
|
|
500
500
|
className={'shg-cell' + (computed ? ' shg-cell-compute' : '')
|
|
501
501
|
+ (c.status && computed ? ` shg-cell-${c.status}` : '')
|
|
502
502
|
+ (peer ? ' shg-cell-peer' : '')}
|
|
@@ -713,6 +713,36 @@ function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onA
|
|
|
713
713
|
);
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
+
/**
|
|
717
|
+
* The height each row would need to show its content in full, measured from what is on screen.
|
|
718
|
+
*
|
|
719
|
+
* A row is clamped to its height by design — a sheet you cannot scan is not a sheet. But after a
|
|
720
|
+
* run, the thing a person wants is the answer, and an answer cut off at one line with no way to
|
|
721
|
+
* see the rest is the grid hiding the work it just paid for. So the host measures and commits a
|
|
722
|
+
* height, ONCE, rather than the grid guessing continuously.
|
|
723
|
+
*
|
|
724
|
+
* Measured, not estimated: `scrollHeight` is what the content actually occupies at this width,
|
|
725
|
+
* including the file cards. A formula over character counts would be a number nobody derived.
|
|
726
|
+
*
|
|
727
|
+
* Returns { rowId: px } for the rows given (or every row), clamped to [min, max].
|
|
728
|
+
*/
|
|
729
|
+
export function fitRowHeights(container, { rowIds, min = 34, max = 320, padding = 12 } = {}) {
|
|
730
|
+
if (!container) return {};
|
|
731
|
+
const out = {};
|
|
732
|
+
const rows = container.querySelectorAll('tr[data-row-id]');
|
|
733
|
+
for (const tr of rows) {
|
|
734
|
+
const id = tr.getAttribute('data-row-id');
|
|
735
|
+
if (rowIds && !rowIds.includes(id)) continue;
|
|
736
|
+
let tallest = 0;
|
|
737
|
+
for (const cell of tr.querySelectorAll('td[data-col-id] .shg-val')) {
|
|
738
|
+
// The value box is clipped to the row; its scrollHeight is the content's real height.
|
|
739
|
+
tallest = Math.max(tallest, cell.scrollHeight);
|
|
740
|
+
}
|
|
741
|
+
if (tallest) out[id] = Math.min(max, Math.max(min, Math.round(tallest + padding)));
|
|
742
|
+
}
|
|
743
|
+
return out;
|
|
744
|
+
}
|
|
745
|
+
|
|
716
746
|
// ── Export helpers (CSV / TSV / array-of-arrays) ─────────────────────────────
|
|
717
747
|
// cellText(cell, column) lets a host say what one of its own column types is worth in a flat
|
|
718
748
|
// file. Without it a cell whose value is an object exports as raw JSON, which is what a
|
package/styles/sheet.css
CHANGED
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
/* The cell is the constraint on its own value. This used to carry an inline max-width of the
|
|
61
61
|
column width minus 20, or 400px where the column had no explicit width — a number nothing
|
|
62
62
|
derived, which ellipsised a value long before its own cell ran out of room. */
|
|
63
|
-
.shg-val { display: flex; align-items:
|
|
63
|
+
.shg-val { display: flex; align-items: flex-start; gap: 6px; padding: 6px 10px; height: 100%;
|
|
64
64
|
width: 100%; min-width: 0; box-sizing: border-box; }
|
|
65
65
|
.shg-val-txt {
|
|
66
|
-
flex: 1; min-width: 0; color: var(--uic-ink, #111317);
|
|
66
|
+
flex: 1; min-width: 0; color: var(--uic-ink, #111317); align-self: flex-start;
|
|
67
67
|
/* Wrap to the row's height; the last visible line ellipsizes. Rows at the
|
|
68
68
|
default height clamp to one line (classic sheet behavior); taller rows
|
|
69
69
|
show more lines. --shg-clamp is set per row from its height. */
|