@gridkitjs/theme-css 0.0.0-dev-20261118190822 → 0.0.0-dev-20261118204728

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/styles.css +186 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridkitjs/theme-css",
3
- "version": "0.0.0-dev-20261118190822",
3
+ "version": "0.0.0-dev-20261118204728",
4
4
  "description": "Plain-CSS theme for GridKit — palette tokens, dark mode and grid styles, no Tailwind needed.",
5
5
  "license": "MIT",
6
6
  "author": "Blagoja Blazhevski",
package/src/styles.css CHANGED
@@ -435,9 +435,15 @@
435
435
  * `fixed` is what makes a width a width. Under the default `auto` layout the
436
436
  * browser treats the colgroup as a hint and re-apportions space by content,
437
437
  * so dragging one column visibly shifts its neighbours.
438
+ *
439
+ * Separate borders, so each cell owns its lines: a cell made to stick
440
+ * sideways carries them along, where a collapsed table would paint them at
441
+ * the cell's unstuck place. Each seam is drawn by one of its two cells
442
+ * only, as the borders section below explains.
438
443
  */
439
444
  .gridkit-data-grid {
440
- border-collapse: collapse;
445
+ border-collapse: separate;
446
+ border-spacing: 0;
441
447
  table-layout: fixed;
442
448
  }
443
449
 
@@ -942,7 +948,16 @@
942
948
  outline-offset: calc(var(--gridkit-focus-ring-width) * -1);
943
949
  }
944
950
 
951
+ /*
952
+ * Sticks to the scroll area's start edge, so a group's label stays in view
953
+ * however far a wide grid scrolls sideways; as wide as its content, so it
954
+ * has room to move along its row. It sticks only while the group cell does
955
+ * not clip: `overflow: clip`, unlike `hidden`, would keep it working.
956
+ */
945
957
  .gridkit-data-grid .gridkit-grid-group-cell-content {
958
+ position: sticky;
959
+ inset-inline-start: 0;
960
+ width: max-content;
946
961
  display: flex;
947
962
  align-items: center;
948
963
  gap: calc(var(--gridkit-spacing) * 2);
@@ -1116,13 +1131,12 @@
1116
1131
  /*
1117
1132
  * Horizontal borders.
1118
1133
  *
1119
- * Header, body, and footer are three separate `<table>`s, so
1120
- * `border-collapse` only ever merges borders within one of them — it
1121
- * cannot merge a header border against a body border the way it would
1122
- * merge two adjacent body rows' borders in one shared `<tbody>`. Each seam
1123
- * below is therefore deliberately defined from one side only, never both,
1124
- * or the two tables' independent borders would render as a doubled line
1125
- * instead of collapsing into one:
1134
+ * Each cell owns its borders, so every seam is drawn by one of its two
1135
+ * cells only, never both, or the two lines would sit side by side as a
1136
+ * doubled one: a seam between rows is the upper cell's `border-bottom`,
1137
+ * and one between columns (in the vertical variants below) the earlier
1138
+ * cell's `border-inline-end`. The seams between the header, body and
1139
+ * footer tables follow the same rule:
1126
1140
  * - header/body seam: the header's own `border-bottom` here. The body's
1127
1141
  * first row never sets a `border-top` of its own.
1128
1142
  * - body/footer seam: the footer's own `border-top` (below, alongside
@@ -1153,9 +1167,10 @@
1153
1167
  }
1154
1168
 
1155
1169
  /*
1156
- * The last row's bottom edge has no row below it to collapse with, so
1157
- * unlike every internal boundary it is a genuinely extra line — the same
1158
- * reason `gridkit-borders-vertical` drops its `:last-child` end border below.
1170
+ * The last row's bottom edge is no seam between two rows, so it draws no
1171
+ * line: the footer draws its own, and without a footer the line would be
1172
+ * one more than the rows have seams — the same reason
1173
+ * `gridkit-borders-vertical` drops its `:last-child` end border below.
1159
1174
  * Matched against both row kinds: the last rendered row can just as well
1160
1175
  * be a collapsed group header as a data row.
1161
1176
  */
@@ -1212,11 +1227,11 @@
1212
1227
  }
1213
1228
 
1214
1229
  /*
1215
- * The outer start and end edges have no neighbouring cell to collapse with, so
1216
- * unlike every internal boundary they are a genuinely extra line — without
1217
- * this the table would render two lines wider than the sum of its columns. A
1218
- * group cell is both its row's first and last child at once (it is the
1219
- * only cell), so it takes both exceptions.
1230
+ * The outer start and end edges are no seam between two columns, so they
1231
+ * draw no line: one there would sit against the scroll area's edge, or
1232
+ * double the grid's outer border when it has one. A group cell is both its
1233
+ * row's first and last child at once (it is the only cell), so it takes
1234
+ * both exceptions.
1220
1235
  */
1221
1236
  .gridkit-data-grid.gridkit-borders-all
1222
1237
  .gridkit-grid-header
@@ -1252,6 +1267,147 @@
1252
1267
  border-bottom: none;
1253
1268
  }
1254
1269
 
1270
+ /*
1271
+ * Pinned columns. A pinned column's header, body, footer and summary cells
1272
+ * stick to the scroll area's start or end edge, at the
1273
+ * `--gridkit-pin-offset` the grid sets on each: the summed widths of the
1274
+ * columns pinned between it and that edge. The other columns scroll under
1275
+ * them.
1276
+ *
1277
+ * After the header cell's `position: relative`, which this replaces at the
1278
+ * same specificity; sticky is a containing block too, so the resize handle
1279
+ * and the toggles stay inside the cell. `z-index: 1` lifts them over the
1280
+ * scrolling cells, whose positioned header cells would otherwise paint
1281
+ * over a start-pinned one that comes before them, and keeps them under the
1282
+ * header and footer tables (2), which pinned body cells scroll under like
1283
+ * any row.
1284
+ */
1285
+ .gridkit-data-grid
1286
+ :is(
1287
+ .gridkit-header-cell,
1288
+ .gridkit-grid-cell,
1289
+ .gridkit-grid-footer-cell,
1290
+ .gridkit-grid-group-summary-cell
1291
+ ).is-pinned-start {
1292
+ position: sticky;
1293
+ inset-inline-start: var(--gridkit-pin-offset);
1294
+ z-index: 1;
1295
+ }
1296
+
1297
+ .gridkit-data-grid
1298
+ :is(
1299
+ .gridkit-header-cell,
1300
+ .gridkit-grid-cell,
1301
+ .gridkit-grid-footer-cell,
1302
+ .gridkit-grid-group-summary-cell
1303
+ ).is-pinned-end {
1304
+ position: sticky;
1305
+ inset-inline-end: var(--gridkit-pin-offset);
1306
+ z-index: 1;
1307
+ }
1308
+
1309
+ /*
1310
+ * Opaque in every row state, without restating a row rule. The cell takes
1311
+ * its row's colour, at no specificity, so a cell's own hover or selection
1312
+ * wins over it. A sticky cell is a stacking context, so its negative-z
1313
+ * pseudo-elements paint above its own background and below its content:
1314
+ * `::before` lays the surface over it and `::after` its colour again on
1315
+ * top. A transparent row shows the surface, a translucent one its colour
1316
+ * over the surface, and neither the cells scrolled underneath. `inset: 0`
1317
+ * covers the padding box, so the borders stay visible; `box-shadow:
1318
+ * inherit` repeats the resize and drop lines `::after` would cover.
1319
+ */
1320
+ .gridkit-data-grid :where(.is-pinned-start, .is-pinned-end) {
1321
+ background-color: inherit;
1322
+ }
1323
+
1324
+ .gridkit-data-grid
1325
+ :is(
1326
+ .gridkit-header-cell,
1327
+ .gridkit-grid-cell,
1328
+ .gridkit-grid-footer-cell,
1329
+ .gridkit-grid-group-summary-cell
1330
+ ):is(.is-pinned-start, .is-pinned-end)::before,
1331
+ .gridkit-data-grid
1332
+ :is(
1333
+ .gridkit-header-cell,
1334
+ .gridkit-grid-cell,
1335
+ .gridkit-grid-footer-cell,
1336
+ .gridkit-grid-group-summary-cell
1337
+ ):is(.is-pinned-start, .is-pinned-end)::after {
1338
+ content: "";
1339
+ position: absolute;
1340
+ inset: 0;
1341
+ pointer-events: none;
1342
+ }
1343
+
1344
+ .gridkit-data-grid
1345
+ :is(
1346
+ .gridkit-header-cell,
1347
+ .gridkit-grid-cell,
1348
+ .gridkit-grid-footer-cell,
1349
+ .gridkit-grid-group-summary-cell
1350
+ ):is(.is-pinned-start, .is-pinned-end)::before {
1351
+ z-index: -2;
1352
+ background-color: var(--gridkit-surface);
1353
+ }
1354
+
1355
+ .gridkit-data-grid
1356
+ :is(
1357
+ .gridkit-header-cell,
1358
+ .gridkit-grid-cell,
1359
+ .gridkit-grid-footer-cell,
1360
+ .gridkit-grid-group-summary-cell
1361
+ ):is(.is-pinned-start, .is-pinned-end)::after {
1362
+ z-index: -1;
1363
+ background-color: inherit;
1364
+ box-shadow: inherit;
1365
+ }
1366
+
1367
+ /*
1368
+ * The divider between the pinned columns and the scrolling ones, in every
1369
+ * `borders` setting: the edge cell's own border on the scrolling side,
1370
+ * outranking the column lines above. None where the edge cell ends the
1371
+ * row, which is no seam, and none at the start edge when the end edge cell
1372
+ * comes straight after it, whose divider is then the one line between them.
1373
+ */
1374
+ .gridkit-data-grid
1375
+ :is(
1376
+ .gridkit-header-cell,
1377
+ .gridkit-grid-cell,
1378
+ .gridkit-grid-footer-cell,
1379
+ .gridkit-grid-group-summary-cell
1380
+ ).is-pinned-start.is-pinned-edge:not(:last-child, :has(+ .is-pinned-end)) {
1381
+ border-inline-end: var(--gridkit-border-width) var(--gridkit-border-style)
1382
+ var(--gridkit-line);
1383
+ }
1384
+
1385
+ .gridkit-data-grid
1386
+ :is(
1387
+ .gridkit-header-cell,
1388
+ .gridkit-grid-cell,
1389
+ .gridkit-grid-footer-cell,
1390
+ .gridkit-grid-group-summary-cell
1391
+ ).is-pinned-end.is-pinned-edge:not(:first-child) {
1392
+ border-inline-start: var(--gridkit-border-width) var(--gridkit-border-style)
1393
+ var(--gridkit-line);
1394
+ }
1395
+
1396
+ /*
1397
+ * The cell before the end divider leaves out its own column line, which
1398
+ * would sit beside the divider as a doubled one wherever the two meet:
1399
+ * scrolled to the end, and in a grid with nothing to scroll.
1400
+ */
1401
+ .gridkit-data-grid
1402
+ :is(
1403
+ .gridkit-header-cell,
1404
+ .gridkit-grid-cell,
1405
+ .gridkit-grid-footer-cell,
1406
+ .gridkit-grid-group-summary-cell
1407
+ ):has(+ .is-pinned-end.is-pinned-edge) {
1408
+ border-inline-end: none;
1409
+ }
1410
+
1255
1411
  /*
1256
1412
  * The toolbar: the grid's first child, above the group-by bar, and unscoped
1257
1413
  * by `.gridkit-data-grid` for the same reason that bar is. It sits outside
@@ -2433,10 +2589,23 @@
2433
2589
  }
2434
2590
 
2435
2591
  .gridkit-data-grid-viewport .gridkit-data-grid-header,
2436
- .gridkit-data-grid-viewport .gridkit-data-grid-footer {
2592
+ .gridkit-data-grid-viewport .gridkit-data-grid-footer,
2593
+ .gridkit-data-grid-viewport .gridkit-grid-group-cell-content {
2437
2594
  position: static;
2438
2595
  }
2439
2596
 
2597
+ /*
2598
+ * Pinned columns print in their own places. Relative rather than
2599
+ * static: a cell stays the containing block of its background layers
2600
+ * and its header's toggles, as an unpinned header cell is.
2601
+ */
2602
+ .gridkit-data-grid-viewport
2603
+ .gridkit-data-grid
2604
+ :is(.is-pinned-start, .is-pinned-end) {
2605
+ position: relative;
2606
+ inset-inline: auto;
2607
+ }
2608
+
2440
2609
  .gridkit-data-grid-viewport .gridkit-data-grid-body {
2441
2610
  min-height: 0;
2442
2611
  }