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

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 +213 -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-20261118223155",
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
 
@@ -550,6 +556,17 @@
550
556
  opacity: 0.5;
551
557
  }
552
558
 
559
+ /*
560
+ * The headers of the other pin groups while a header is dragged: a column
561
+ * stays in its own group, so they take no drop. Muted rather than faded,
562
+ * since a pinned header's background must stay opaque over the cells
563
+ * scrolled under it.
564
+ */
565
+ .gridkit-data-grid .gridkit-header-cell.is-drag-blocked {
566
+ cursor: not-allowed;
567
+ color: var(--gridkit-fg-muted);
568
+ }
569
+
553
570
  /*
554
571
  * A header, cell or group row that opens the grid's context menu — its
555
572
  * `aria-keyshortcuts` names Shift+F10 then — takes a long-press for that
@@ -942,7 +959,16 @@
942
959
  outline-offset: calc(var(--gridkit-focus-ring-width) * -1);
943
960
  }
944
961
 
962
+ /*
963
+ * Sticks to the scroll area's start edge, so a group's label stays in view
964
+ * however far a wide grid scrolls sideways; as wide as its content, so it
965
+ * has room to move along its row. It sticks only while the group cell does
966
+ * not clip: `overflow: clip`, unlike `hidden`, would keep it working.
967
+ */
945
968
  .gridkit-data-grid .gridkit-grid-group-cell-content {
969
+ position: sticky;
970
+ inset-inline-start: 0;
971
+ width: max-content;
946
972
  display: flex;
947
973
  align-items: center;
948
974
  gap: calc(var(--gridkit-spacing) * 2);
@@ -1116,13 +1142,12 @@
1116
1142
  /*
1117
1143
  * Horizontal borders.
1118
1144
  *
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:
1145
+ * Each cell owns its borders, so every seam is drawn by one of its two
1146
+ * cells only, never both, or the two lines would sit side by side as a
1147
+ * doubled one: a seam between rows is the upper cell's `border-bottom`,
1148
+ * and one between columns (in the vertical variants below) the earlier
1149
+ * cell's `border-inline-end`. The seams between the header, body and
1150
+ * footer tables follow the same rule:
1126
1151
  * - header/body seam: the header's own `border-bottom` here. The body's
1127
1152
  * first row never sets a `border-top` of its own.
1128
1153
  * - body/footer seam: the footer's own `border-top` (below, alongside
@@ -1153,9 +1178,10 @@
1153
1178
  }
1154
1179
 
1155
1180
  /*
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.
1181
+ * The last row's bottom edge is no seam between two rows, so it draws no
1182
+ * line: the footer draws its own, and without a footer the line would be
1183
+ * one more than the rows have seams — the same reason
1184
+ * `gridkit-borders-vertical` drops its `:last-child` end border below.
1159
1185
  * Matched against both row kinds: the last rendered row can just as well
1160
1186
  * be a collapsed group header as a data row.
1161
1187
  */
@@ -1212,11 +1238,11 @@
1212
1238
  }
1213
1239
 
1214
1240
  /*
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.
1241
+ * The outer start and end edges are no seam between two columns, so they
1242
+ * draw no line: one there would sit against the scroll area's edge, or
1243
+ * double the grid's outer border when it has one. A group cell is both its
1244
+ * row's first and last child at once (it is the only cell), so it takes
1245
+ * both exceptions.
1220
1246
  */
1221
1247
  .gridkit-data-grid.gridkit-borders-all
1222
1248
  .gridkit-grid-header
@@ -1252,6 +1278,163 @@
1252
1278
  border-bottom: none;
1253
1279
  }
1254
1280
 
1281
+ /*
1282
+ * Pinned columns. A pinned column's header, body, footer and summary cells
1283
+ * stick to the scroll area's start or end edge, at the
1284
+ * `--gridkit-pin-offset` the grid sets on each: the summed widths of the
1285
+ * columns pinned between it and that edge. The other columns scroll under
1286
+ * them.
1287
+ *
1288
+ * After the header cell's `position: relative`, which this replaces at the
1289
+ * same specificity; sticky is a containing block too, so the resize handle
1290
+ * and the toggles stay inside the cell. `z-index: 1` lifts them over the
1291
+ * scrolling cells, whose positioned header cells would otherwise paint
1292
+ * over a start-pinned one that comes before them, and keeps them under the
1293
+ * header and footer tables (2), which pinned body cells scroll under like
1294
+ * any row.
1295
+ */
1296
+ .gridkit-data-grid
1297
+ :is(
1298
+ .gridkit-header-cell,
1299
+ .gridkit-grid-cell,
1300
+ .gridkit-grid-footer-cell,
1301
+ .gridkit-grid-group-summary-cell
1302
+ ).is-pinned-start {
1303
+ position: sticky;
1304
+ inset-inline-start: var(--gridkit-pin-offset);
1305
+ z-index: 1;
1306
+ }
1307
+
1308
+ .gridkit-data-grid
1309
+ :is(
1310
+ .gridkit-header-cell,
1311
+ .gridkit-grid-cell,
1312
+ .gridkit-grid-footer-cell,
1313
+ .gridkit-grid-group-summary-cell
1314
+ ).is-pinned-end {
1315
+ position: sticky;
1316
+ inset-inline-end: var(--gridkit-pin-offset);
1317
+ z-index: 1;
1318
+ }
1319
+
1320
+ /*
1321
+ * Keeps a cell that keyboard focus or `scrollToColumn` scrolls into view
1322
+ * clear of the pinned columns at both edges. A margin on the scrolling
1323
+ * cells rather than padding on the scroll area: a pinned cell, stuck in
1324
+ * that padding, would scroll the area to make room when focused, as the
1325
+ * header would for `scroll-margin-block` above.
1326
+ */
1327
+ .gridkit-data-grid
1328
+ :is(.gridkit-header-cell, .gridkit-grid-cell):not(
1329
+ .is-pinned-start,
1330
+ .is-pinned-end
1331
+ ) {
1332
+ scroll-margin-inline: var(--gridkit-pinned-start-width, 0px)
1333
+ var(--gridkit-pinned-end-width, 0px);
1334
+ }
1335
+
1336
+ /*
1337
+ * Opaque in every row state, without restating a row rule. The cell takes
1338
+ * its row's colour, at no specificity, so a cell's own hover or selection
1339
+ * wins over it. A sticky cell is a stacking context, so its negative-z
1340
+ * pseudo-elements paint above its own background and below its content:
1341
+ * `::before` lays the surface over it and `::after` its colour again on
1342
+ * top. A transparent row shows the surface, a translucent one its colour
1343
+ * over the surface, and neither the cells scrolled underneath. `inset: 0`
1344
+ * covers the padding box, so the borders stay visible; `box-shadow:
1345
+ * inherit` repeats the resize and drop lines `::after` would cover.
1346
+ */
1347
+ .gridkit-data-grid :where(.is-pinned-start, .is-pinned-end) {
1348
+ background-color: inherit;
1349
+ }
1350
+
1351
+ .gridkit-data-grid
1352
+ :is(
1353
+ .gridkit-header-cell,
1354
+ .gridkit-grid-cell,
1355
+ .gridkit-grid-footer-cell,
1356
+ .gridkit-grid-group-summary-cell
1357
+ ):is(.is-pinned-start, .is-pinned-end)::before,
1358
+ .gridkit-data-grid
1359
+ :is(
1360
+ .gridkit-header-cell,
1361
+ .gridkit-grid-cell,
1362
+ .gridkit-grid-footer-cell,
1363
+ .gridkit-grid-group-summary-cell
1364
+ ):is(.is-pinned-start, .is-pinned-end)::after {
1365
+ content: "";
1366
+ position: absolute;
1367
+ inset: 0;
1368
+ pointer-events: none;
1369
+ }
1370
+
1371
+ .gridkit-data-grid
1372
+ :is(
1373
+ .gridkit-header-cell,
1374
+ .gridkit-grid-cell,
1375
+ .gridkit-grid-footer-cell,
1376
+ .gridkit-grid-group-summary-cell
1377
+ ):is(.is-pinned-start, .is-pinned-end)::before {
1378
+ z-index: -2;
1379
+ background-color: var(--gridkit-surface);
1380
+ }
1381
+
1382
+ .gridkit-data-grid
1383
+ :is(
1384
+ .gridkit-header-cell,
1385
+ .gridkit-grid-cell,
1386
+ .gridkit-grid-footer-cell,
1387
+ .gridkit-grid-group-summary-cell
1388
+ ):is(.is-pinned-start, .is-pinned-end)::after {
1389
+ z-index: -1;
1390
+ background-color: inherit;
1391
+ box-shadow: inherit;
1392
+ }
1393
+
1394
+ /*
1395
+ * The divider between the pinned columns and the scrolling ones, in every
1396
+ * `borders` setting: the edge cell's own border on the scrolling side,
1397
+ * outranking the column lines above. None where the edge cell ends the
1398
+ * row, which is no seam, and none at the start edge when the end edge cell
1399
+ * comes straight after it, whose divider is then the one line between them.
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
+ ).is-pinned-start.is-pinned-edge:not(:last-child, :has(+ .is-pinned-end)) {
1408
+ border-inline-end: var(--gridkit-border-width) var(--gridkit-border-style)
1409
+ var(--gridkit-line);
1410
+ }
1411
+
1412
+ .gridkit-data-grid
1413
+ :is(
1414
+ .gridkit-header-cell,
1415
+ .gridkit-grid-cell,
1416
+ .gridkit-grid-footer-cell,
1417
+ .gridkit-grid-group-summary-cell
1418
+ ).is-pinned-end.is-pinned-edge:not(:first-child) {
1419
+ border-inline-start: var(--gridkit-border-width) var(--gridkit-border-style)
1420
+ var(--gridkit-line);
1421
+ }
1422
+
1423
+ /*
1424
+ * The cell before the end divider leaves out its own column line, which
1425
+ * would sit beside the divider as a doubled one wherever the two meet:
1426
+ * scrolled to the end, and in a grid with nothing to scroll.
1427
+ */
1428
+ .gridkit-data-grid
1429
+ :is(
1430
+ .gridkit-header-cell,
1431
+ .gridkit-grid-cell,
1432
+ .gridkit-grid-footer-cell,
1433
+ .gridkit-grid-group-summary-cell
1434
+ ):has(+ .is-pinned-end.is-pinned-edge) {
1435
+ border-inline-end: none;
1436
+ }
1437
+
1255
1438
  /*
1256
1439
  * The toolbar: the grid's first child, above the group-by bar, and unscoped
1257
1440
  * by `.gridkit-data-grid` for the same reason that bar is. It sits outside
@@ -2433,10 +2616,23 @@
2433
2616
  }
2434
2617
 
2435
2618
  .gridkit-data-grid-viewport .gridkit-data-grid-header,
2436
- .gridkit-data-grid-viewport .gridkit-data-grid-footer {
2619
+ .gridkit-data-grid-viewport .gridkit-data-grid-footer,
2620
+ .gridkit-data-grid-viewport .gridkit-grid-group-cell-content {
2437
2621
  position: static;
2438
2622
  }
2439
2623
 
2624
+ /*
2625
+ * Pinned columns print in their own places. Relative rather than
2626
+ * static: a cell stays the containing block of its background layers
2627
+ * and its header's toggles, as an unpinned header cell is.
2628
+ */
2629
+ .gridkit-data-grid-viewport
2630
+ .gridkit-data-grid
2631
+ :is(.is-pinned-start, .is-pinned-end) {
2632
+ position: relative;
2633
+ inset-inline: auto;
2634
+ }
2635
+
2440
2636
  .gridkit-data-grid-viewport .gridkit-data-grid-body {
2441
2637
  min-height: 0;
2442
2638
  }