@slotted/styles 0.1.0-beta.13 → 0.1.0-beta.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slotted/styles",
3
- "version": "0.1.0-beta.13",
3
+ "version": "0.1.0-beta.15",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1305,4 +1305,256 @@
1305
1305
  border-color: CanvasText;
1306
1306
  }
1307
1307
  }
1308
+
1309
+ /* ── The sheet on the platform's scroll ─────────────────────────────── */
1310
+
1311
+ /**
1312
+ * An overlay sheet from the bottom that a hand moves (`data-drag`) is moved by
1313
+ * the platform's own scroll: the layer scrolls, a spacer the height of the
1314
+ * layer comes before the panel, and `scrollTop` is how much of the panel is
1315
+ * in sight. The stops are snap points that `attachSheetScroll` in
1316
+ * `@slotted/core/extent` lays out, so the finger, the fling and the landing
1317
+ * are the compositor's. The layer takes no press of its own: the scrim and
1318
+ * the panel do, and a touch on the panel scrolls the layer.
1319
+ */
1320
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag] {
1321
+ display: block;
1322
+ overflow-x: hidden;
1323
+ overflow-y: auto;
1324
+ overscroll-behavior: contain;
1325
+ scroll-snap-type: y mandatory;
1326
+ scroll-padding-block-end: var(--slotted-keyboard-inset, 0px);
1327
+ scrollbar-width: none;
1328
+ scroll-timeline: --slotted-drawer-sheet block;
1329
+ pointer-events: none;
1330
+ }
1331
+
1332
+ /**
1333
+ * Opening and closing are the same scroll a hand ends with: the binding
1334
+ * scrolls the layer to the resting stop or to nothing on the platform's
1335
+ * smooth scroll, so a sheet sent away by a press outside leaves the way a
1336
+ * dragged one does. The panel does not slide on its own, and the layer is
1337
+ * kept for as long as that scroll takes (Chrome: about 440 ms across a
1338
+ * phone's height). Leaving, nothing re-snaps: a re-snap would lift the panel
1339
+ * back into view on its way out.
1340
+ */
1341
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag] {
1342
+ --_reveal: content-visibility
1343
+ calc(var(--slotted-duration-long) + var(--slotted-duration-medium)) allow-discrete;
1344
+ }
1345
+
1346
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]:not([data-open]) {
1347
+ scroll-snap-type: none;
1348
+ }
1349
+
1350
+ /* Nor before the stops are laid out: the opening scrolls up from out of sight, not from the panel's end. */
1351
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]:not([data-sheet-ready]) {
1352
+ scroll-snap-type: none;
1353
+ }
1354
+
1355
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]:not([data-open])
1356
+ > [data-part-panel] {
1357
+ translate: 0 0;
1358
+ }
1359
+
1360
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]::-webkit-scrollbar {
1361
+ display: none;
1362
+ }
1363
+
1364
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]::before {
1365
+ content: '';
1366
+ display: block;
1367
+ block-size: 100%;
1368
+ }
1369
+
1370
+ /* Fixed, so a touch on it scrolls nothing and a press on it is a press outside. */
1371
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag] > [data-part-backdrop] {
1372
+ position: fixed;
1373
+ inset: 0;
1374
+ }
1375
+
1376
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]:not([data-undimmed])
1377
+ > [data-part-backdrop] {
1378
+ pointer-events: auto;
1379
+ }
1380
+
1381
+ /**
1382
+ * The panel clips its corners without being a scroll container, so what
1383
+ * sticks inside it sticks to the layer's scrollport: the screen. The measure
1384
+ * does not ease; nothing animates it, the scroll moves the panel. The second
1385
+ * shadow is the panel's surface below its edge, which a rubber band past the
1386
+ * highest stop shows instead of a gap.
1387
+ */
1388
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag] > [data-part-panel] {
1389
+ pointer-events: auto;
1390
+ scroll-snap-align: end;
1391
+ margin-inline: auto;
1392
+ overflow: clip;
1393
+ max-block-size: none;
1394
+ box-shadow:
1395
+ var(--slotted-shadow-lg),
1396
+ 0 50vh 0 0 var(--slotted-drawer-surface, var(--slotted-surface-raised, Canvas));
1397
+ transition:
1398
+ translate var(--_slide),
1399
+ border-start-start-radius var(--_move),
1400
+ border-start-end-radius var(--_move);
1401
+ }
1402
+
1403
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]
1404
+ > [data-part-panel]
1405
+ > [data-part-footer] {
1406
+ position: sticky;
1407
+ inset-block-end: var(--slotted-keyboard-inset, 0px);
1408
+ z-index: 1;
1409
+ background: var(--slotted-drawer-surface, var(--slotted-surface-raised, Canvas));
1410
+ }
1411
+
1412
+ /**
1413
+ * `drag="panel"`: one scroll for the sheet and what it holds, Android's
1414
+ * nested scrolling in a single scroller. The panel is as tall as its content;
1415
+ * the body does not scroll on its own. A hand pushing up from a lower stop
1416
+ * lifts the sheet to the top of the screen and, without letting go, goes on
1417
+ * scrolling the content under the header that sticks there; pulling down
1418
+ * from the top of the content brings the sheet down. A panel taller than the
1419
+ * layer is a snap area larger than the snapport, so every position inside it
1420
+ * is a resting one. Content at rest past the top is read with the snap off
1421
+ * (`data-sheet-content`); going back below the top turns it on, and that
1422
+ * re-snap stops a fling out of the content at the top.
1423
+ */
1424
+ /* The rows take their content and a last one what is left, so the content's end is read off its parts. */
1425
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel'] > [data-part-panel] {
1426
+ block-size: auto;
1427
+ min-block-size: var(--slotted-drawer-sheet-height, 0px);
1428
+ grid-template-rows: auto auto auto auto minmax(0, 1fr);
1429
+ }
1430
+
1431
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel'][data-sheet-scrolls]
1432
+ > [data-part-panel] {
1433
+ scroll-snap-align: start;
1434
+ }
1435
+
1436
+ /* Content at rest past the top: the snap is off so a layout does not re-snap it to the top. */
1437
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel'][data-sheet-content] {
1438
+ scroll-snap-type: none;
1439
+ }
1440
+
1441
+ /* No finger on content at rest: the spacer folds, and the top of the content is an edge. */
1442
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel'][data-sheet-anchored]::before {
1443
+ block-size: 0;
1444
+ }
1445
+
1446
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel']
1447
+ > [data-part-panel]
1448
+ > [data-part-body] {
1449
+ overflow: visible;
1450
+ overscroll-behavior: auto;
1451
+ }
1452
+
1453
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel']
1454
+ > [data-part-panel]
1455
+ > [data-part-resizer] {
1456
+ position: sticky;
1457
+ inset-block-start: 0;
1458
+ z-index: 2;
1459
+ background: var(--slotted-drawer-surface, var(--slotted-surface-raised, Canvas));
1460
+ }
1461
+
1462
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel']
1463
+ > [data-part-panel]
1464
+ > [data-part-header] {
1465
+ position: sticky;
1466
+ inset-block-start: 0;
1467
+ z-index: 1;
1468
+ background: var(--slotted-drawer-surface, var(--slotted-surface-raised, Canvas));
1469
+ }
1470
+
1471
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='panel']
1472
+ > [data-part-panel]:has(> [data-part-resizer])
1473
+ > [data-part-header] {
1474
+ inset-block-start: var(--_resizer-thickness);
1475
+ }
1476
+
1477
+ /**
1478
+ * `drag="resizer"`: only the grabber moves the sheet. The panel is laid out at
1479
+ * the highest stop and the body scrolls inside it, at the highest stop only.
1480
+ */
1481
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='resizer']
1482
+ > [data-part-panel] {
1483
+ block-size: var(--slotted-drawer-sheet-height, auto);
1484
+ touch-action: none;
1485
+ }
1486
+
1487
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='resizer']
1488
+ > [data-part-panel]
1489
+ > [data-part-body] {
1490
+ touch-action: pan-y;
1491
+ }
1492
+
1493
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag='resizer']:not(
1494
+ [data-top-stop]
1495
+ )
1496
+ > [data-part-panel]
1497
+ > [data-part-body] {
1498
+ overflow: hidden;
1499
+ }
1500
+
1501
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]
1502
+ > [data-part-panel]
1503
+ > [data-part-resizer] {
1504
+ touch-action: pan-y;
1505
+ }
1506
+
1507
+ /* A region the consumer keeps from the sheet: its own scroll never passes on to it. */
1508
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag] [data-drawer-drag='none'] {
1509
+ overscroll-behavior: contain;
1510
+ }
1511
+
1512
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]
1513
+ > [data-part-stops]
1514
+ [data-part-stop] {
1515
+ position: absolute;
1516
+ inset-inline: 0;
1517
+ block-size: 0;
1518
+ scroll-snap-align: start;
1519
+ pointer-events: none;
1520
+ }
1521
+
1522
+ /**
1523
+ * The scrim dims with the sheet: out of sight it is clear, at the lowest stop
1524
+ * it is whole. The element keeps the fade it opens and closes with; the
1525
+ * scroll drives a layer inside it, and the two multiply.
1526
+ */
1527
+ @supports (animation-timeline: scroll()) {
1528
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag] > [data-part-backdrop] {
1529
+ background: none;
1530
+ }
1531
+
1532
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag]
1533
+ > [data-part-backdrop]::before {
1534
+ content: '';
1535
+ position: absolute;
1536
+ inset: 0;
1537
+ /* A decoration: unthemed, it is not painted rather than painted in a system colour. */
1538
+ background: var(--slotted-drawer-scrim, var(--slotted-scrim));
1539
+ animation: slotted-drawer-sheet-dim linear both;
1540
+ animation-timeline: --slotted-drawer-sheet;
1541
+ animation-range: 0px var(--slotted-drawer-sheet-floor, 100%);
1542
+ }
1543
+
1544
+ /* Reading content, the sheet is at the top: the scrim is whole, wherever the scroll is. */
1545
+ [data-ui-drawer][data-mode='overlay'][data-side='bottom'][data-drag][data-sheet-content]
1546
+ > [data-part-backdrop]::before {
1547
+ animation: none;
1548
+ }
1549
+ }
1550
+
1551
+ @keyframes slotted-drawer-sheet-dim {
1552
+ from {
1553
+ opacity: 0;
1554
+ }
1555
+
1556
+ to {
1557
+ opacity: 1;
1558
+ }
1559
+ }
1308
1560
  }
@@ -29,6 +29,8 @@
29
29
  "--slotted-drawer-resizer-line-color",
30
30
  "--slotted-drawer-rule-color",
31
31
  "--slotted-drawer-scrim",
32
+ "--slotted-drawer-sheet-floor",
33
+ "--slotted-drawer-sheet-height",
32
34
  "--slotted-drawer-sheet-inline-size",
33
35
  "--slotted-drawer-surface",
34
36
  "--slotted-drawer-title-color",