|
1190 | 1190 | .canvas-host [data-bareforge-container][data-bareforge-hint]:empty::before { |
1191 | 1191 | content: attr(data-bareforge-hint); |
1192 | 1192 | } |
| 1193 | + /* --- editor-only table fallback (no `columns` configured) -------- */ |
| 1194 | + /* x-table is `display:grid` and x-table-row is |
| 1195 | + `grid-template-columns: subgrid`, both driven by the table's |
| 1196 | + `columns` attribute. With no `columns`: |
| 1197 | + - the table falls back to *implicit* tracks that size to |
| 1198 | + max-content, so its cells overflow the page box and ignore the |
| 1199 | + container's padding; and |
| 1200 | + - the row's subgrid collapses to one column, stacking cells |
| 1201 | + vertically. |
| 1202 | + Until `columns` is configured (it's inspector-editable), give the |
| 1203 | + table one shrinkable full-width track so it fits the container, and |
| 1204 | + flow each row's cells into equal auto columns so they read |
| 1205 | + horizontally. The moment the user sets `columns`, neither rule |
| 1206 | + matches and the real subgrid takes over — on the canvas and in the |
| 1207 | + export. Editor-only (.canvas-host). */ |
| 1208 | + .canvas-host x-table:not([columns]), |
| 1209 | + .canvas-host x-table[columns=""] { |
| 1210 | + grid-template-columns: minmax(0, 1fr) !important; |
| 1211 | + } |
| 1212 | + .canvas-host x-table:not([columns]) x-table-row, |
| 1213 | + .canvas-host x-table[columns=""] x-table-row { |
| 1214 | + grid-template-columns: none !important; |
| 1215 | + grid-auto-flow: column !important; |
| 1216 | + grid-auto-columns: minmax(0, 1fr) !important; |
| 1217 | + } |
| 1218 | + /* The table/row/cell are nested grid items, and a grid item's default |
| 1219 | + `min-width: auto` (its content's min-content) blocks shrinking — so |
| 1220 | + populated cells refuse to fit and the row overflows the page box. |
| 1221 | + Let all three levels shrink to their track. Scoped to `:not(:empty)` |
| 1222 | + so EMPTY table elements keep the empty-container affordance's |
| 1223 | + `min-width: 120px` + `min-height: 80px` — otherwise an empty table |
| 1224 | + collapses in a flex/grid parent and has no droppable footprint to |
| 1225 | + drop the first row into. */ |
| 1226 | + .canvas-host x-table:not(:empty), |
| 1227 | + .canvas-host x-table-row:not(:empty), |
| 1228 | + .canvas-host x-table-cell:not(:empty) { min-width: 0 !important; } |
| 1229 | + /* An EMPTY cell beside populated siblings is still a subgrid (or |
| 1230 | + auto-flow) grid item, not a standalone drop zone. The generic |
| 1231 | + empty-container affordance adds `margin: 4px 0`, and a stretched grid |
| 1232 | + item fills `track − margins` — so the empty cell renders ~8px shorter |
| 1233 | + than its populated siblings and sits vertically centred (4px gap top |
| 1234 | + and bottom) instead of filling the row. Its `min-width: 120px` also |
| 1235 | + fights the table's equal-width column tracks. Zero both for empty |
| 1236 | + table cells: the cell then stretches to the row height and follows its |
| 1237 | + column track, while the affordance's `min-height` floor + dashed |
| 1238 | + (empty) label survive so an all-empty row keeps a droppable footprint |
| 1239 | + (stretch wins whenever a sibling makes the row taller). */ |
| 1240 | + .canvas-host x-table-cell[data-bareforge-container]:empty { |
| 1241 | + margin: 0; |
| 1242 | + min-width: 0; |
| 1243 | + } |
1193 | 1244 | /* Containers that host an absolute :background child get this |
1194 | 1245 | class from the reconciler so they form a positioned ancestor |
1195 | 1246 | without touching their own inline style. `isolation: isolate` |
|
0 commit comments