@sovereignfs/ui 0.91.0 → 0.96.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/README.md +1 -1
- package/dist/AppTile.module.css +100 -0
- package/dist/AvatarStack.module.css +46 -0
- package/dist/DateRangePicker.module.css +33 -0
- package/dist/FloatingActionButton.module.css +70 -0
- package/dist/Map.module.css +110 -0
- package/dist/PhotoGrid.module.css +44 -0
- package/dist/PhotoViewer.module.css +153 -0
- package/dist/chunk-E24U223W.js +36 -0
- package/dist/index.d.ts +189 -15
- package/dist/index.js +2419 -1153
- package/dist/map.d.ts +87 -0
- package/dist/map.js +384 -0
- package/package.json +11 -2
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm install @sovereignfs/ui
|
|
|
19
19
|
import { Button, Input, Card, Dialog, Drawer } from '@sovereignfs/ui';
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Available components and hooks: `Avatar`, `Badge`, `Button`, `Calendar`, `Card`, `CheckableListRow`, `Checkbox`, `CodeTextarea`, `ConfirmDialog`, `DatePicker`, `Dialog`, `DragHandleRow`, `Drawer`, `EmptyState`, `FormField`, `Icon`, `IconPicker`, `Input`, `Menu`, `NavTabs`, `OverlayHeader`, `PageHeader`, `Popover`, `QuantityStepper`, `SegmentedControl`, `Select`, `Sheet`, `Spinner`, `SplitPane`, `StatusBadge`, `SuggestionInput`, `SystemBanner`, `Tabs`, `TagInput`, `Textarea`, `Toast` / `useToast`, `Toggle`, `Tooltip`, `useDoubleTapHandler`, `useIsMobile`, `useLongPress`, and `useSingleOrDoubleTap`.
|
|
22
|
+
Available components and hooks: `Avatar`, `Badge`, `Button`, `Calendar`, `Card`, `CheckableListRow`, `Checkbox`, `CodeTextarea`, `ConfirmDialog`, `DatePicker`, `DateRangePicker`, `Dialog`, `DragHandleRow`, `Drawer`, `EmptyState`, `FormField`, `Icon`, `IconPicker`, `Input`, `Menu`, `NavTabs`, `OverlayHeader`, `PageHeader`, `Popover`, `QuantityStepper`, `SegmentedControl`, `Select`, `Sheet`, `Spinner`, `SplitPane`, `StatusBadge`, `SuggestionInput`, `SystemBanner`, `Tabs`, `TagInput`, `Textarea`, `Toast` / `useToast`, `Toggle`, `Tooltip`, `useDoubleTapHandler`, `useIsMobile`, `useLongPress`, and `useSingleOrDoubleTap`.
|
|
23
23
|
|
|
24
24
|
### Tokens
|
|
25
25
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* A card with its content centred in a column: icon box, name, description (which takes the spare height, so the divider and tags sit at
|
|
2
|
+
the bottom and a row of tiles lines up), then the tags. The size is the earlier launcher's. */
|
|
3
|
+
.tile {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: var(--sv-space-3);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
height: 100%;
|
|
10
|
+
padding: var(--sv-space-6) var(--sv-space-5);
|
|
11
|
+
border: 1px solid var(--sv-color-border);
|
|
12
|
+
border-radius: var(--sv-radius-lg);
|
|
13
|
+
background: var(--sv-color-surface-raised);
|
|
14
|
+
box-shadow: var(--sv-shadow-card);
|
|
15
|
+
color: var(--sv-color-text-primary);
|
|
16
|
+
text-align: center;
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.link:focus-visible {
|
|
21
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
22
|
+
outline-offset: 2px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (hover: hover) {
|
|
26
|
+
.link:hover {
|
|
27
|
+
border-color: var(--sv-color-border-strong);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.icon {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
flex: none;
|
|
36
|
+
width: 48px;
|
|
37
|
+
height: 48px;
|
|
38
|
+
border-radius: var(--sv-radius-md);
|
|
39
|
+
background: var(--sv-color-surface-sunken);
|
|
40
|
+
color: var(--sv-color-text-primary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.name {
|
|
44
|
+
max-width: 100%;
|
|
45
|
+
font-size: var(--sv-font-size-md);
|
|
46
|
+
font-weight: var(--sv-font-weight-medium);
|
|
47
|
+
overflow-wrap: anywhere;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.description {
|
|
51
|
+
flex: 1;
|
|
52
|
+
color: var(--sv-color-text-muted);
|
|
53
|
+
font-size: var(--sv-font-size-sm);
|
|
54
|
+
line-height: 1.5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Without a description the space is taken by this, so the tags still sit at the bottom. */
|
|
58
|
+
.fill {
|
|
59
|
+
flex: 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.separator {
|
|
63
|
+
display: block;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 1px;
|
|
66
|
+
background: var(--sv-color-border);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tags {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
gap: var(--sv-space-2);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* A place for one more: dashed, flat and quiet, in the same footprint. */
|
|
77
|
+
.ghost {
|
|
78
|
+
border-style: dashed;
|
|
79
|
+
border-color: var(--sv-color-border-strong);
|
|
80
|
+
background: transparent;
|
|
81
|
+
box-shadow: none;
|
|
82
|
+
color: var(--sv-color-text-muted);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ghost .icon {
|
|
86
|
+
border: 1px dashed var(--sv-color-border-strong);
|
|
87
|
+
background: transparent;
|
|
88
|
+
color: inherit;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ghost .name {
|
|
92
|
+
font-weight: var(--sv-font-weight-regular);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (hover: hover) {
|
|
96
|
+
.ghost.link:hover {
|
|
97
|
+
color: var(--sv-color-text-primary);
|
|
98
|
+
background: var(--sv-color-surface-sunken);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.stack {
|
|
2
|
+
--stack-size: 32px;
|
|
3
|
+
--stack-overlap: calc(var(--stack-size) * -0.28);
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
font-family: var(--sv-font-family);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sm {
|
|
11
|
+
--stack-size: 24px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.md {
|
|
15
|
+
--stack-size: 32px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lg {
|
|
19
|
+
--stack-size: 40px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Each avatar sits in a ring of the surface it is on, so overlapping ones stay apart in light and dark. */
|
|
23
|
+
.item {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
box-shadow: 0 0 0 2px var(--sv-color-surface);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.item + .item {
|
|
30
|
+
margin-inline-start: var(--stack-overlap);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.more {
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
min-width: var(--stack-size);
|
|
38
|
+
height: var(--stack-size);
|
|
39
|
+
padding-inline: 6px;
|
|
40
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
41
|
+
background: var(--sv-color-surface-raised);
|
|
42
|
+
color: var(--sv-color-text-muted);
|
|
43
|
+
font-size: var(--sv-font-size-label);
|
|
44
|
+
font-weight: var(--sv-font-weight-medium);
|
|
45
|
+
font-variant-numeric: tabular-nums;
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* DateRangePicker — the shading of a range on top of Calendar's grid. Tokens only. A cell is the grid cell around a day's button; the days between the two ends are shaded across the whole cell, and the ends are
|
|
2
|
+
* shaded on the side that faces the range, so the range reads as one band. */
|
|
3
|
+
|
|
4
|
+
.cell {
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.cellInside {
|
|
9
|
+
background: var(--sv-color-surface-sunken);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.cellStart {
|
|
13
|
+
background: linear-gradient(to right, transparent 50%, var(--sv-color-surface-sunken) 50%);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.cellEnd {
|
|
17
|
+
background: linear-gradient(to left, transparent 50%, var(--sv-color-surface-sunken) 50%);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.summary {
|
|
21
|
+
margin: 0;
|
|
22
|
+
min-height: 1.5em;
|
|
23
|
+
text-align: center;
|
|
24
|
+
font-family: var(--sv-font-family);
|
|
25
|
+
font-size: var(--sv-font-size-sm);
|
|
26
|
+
color: var(--sv-color-text-muted);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* A day in a range keeps the same ring as in Calendar, drawn inside the cell so the shading around it is not cut. */
|
|
30
|
+
.cell button:focus-visible {
|
|
31
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
32
|
+
outline-offset: -2px;
|
|
33
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.fab {
|
|
2
|
+
/* Above the footer the shell or MobileFooter publishes; with none, above the home indicator. */
|
|
3
|
+
position: fixed;
|
|
4
|
+
inset-inline-end: max(var(--sv-space-4), env(safe-area-inset-right, 0px));
|
|
5
|
+
bottom: calc(var(--sv-shell-footer-height, env(safe-area-inset-bottom, 0px)) + var(--sv-space-4));
|
|
6
|
+
/* Under the footer's and an overlay's own layers (101, 100): it floats over the page, never over a sheet. */
|
|
7
|
+
z-index: 99;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
gap: var(--sv-space-2);
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
min-width: 56px;
|
|
14
|
+
height: 56px;
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: var(--sv-radius-full);
|
|
18
|
+
background: var(--sv-color-accent);
|
|
19
|
+
color: var(--sv-color-text-on-accent);
|
|
20
|
+
box-shadow: var(--sv-shadow-overlay);
|
|
21
|
+
font-family: var(--sv-font-family);
|
|
22
|
+
font-size: var(--sv-font-size-sm);
|
|
23
|
+
font-weight: var(--sv-font-weight-medium);
|
|
24
|
+
line-height: 1;
|
|
25
|
+
text-decoration: none;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
touch-action: manipulation;
|
|
28
|
+
transition:
|
|
29
|
+
background-color 0.15s ease,
|
|
30
|
+
transform 0.1s ease;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.extended {
|
|
34
|
+
padding-inline: var(--sv-space-5);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.icon {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.label {
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.fab:focus-visible {
|
|
48
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
49
|
+
outline-offset: 3px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.fab:active {
|
|
53
|
+
transform: scale(0.96);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (hover: hover) {
|
|
57
|
+
.fab:hover {
|
|
58
|
+
background: var(--sv-color-accent-hover);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
.fab {
|
|
64
|
+
transition: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.fab:active {
|
|
68
|
+
transform: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
min-height: 240px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
border-radius: inherit;
|
|
8
|
+
background: var(--sv-color-surface-sunken);
|
|
9
|
+
font-family: var(--sv-font-family);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.picking {
|
|
13
|
+
cursor: crosshair;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Markers are real buttons: reached by Tab, named for a screen reader, in token colours. */
|
|
17
|
+
.marker {
|
|
18
|
+
--marker-colour: var(--sv-color-accent);
|
|
19
|
+
display: block;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 22px;
|
|
22
|
+
height: 22px;
|
|
23
|
+
padding: 0;
|
|
24
|
+
border: 3px solid var(--sv-color-surface);
|
|
25
|
+
border-radius: var(--sv-radius-full);
|
|
26
|
+
background: var(--marker-colour);
|
|
27
|
+
box-shadow: var(--sv-shadow-control);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
touch-action: manipulation;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* A finger needs more than 22px: the target grows around the dot without growing the dot. */
|
|
33
|
+
.marker::after {
|
|
34
|
+
content: '';
|
|
35
|
+
position: absolute;
|
|
36
|
+
inset: -11px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.marker:focus-visible {
|
|
40
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
41
|
+
outline-offset: 3px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.selected {
|
|
45
|
+
width: 28px;
|
|
46
|
+
height: 28px;
|
|
47
|
+
box-shadow:
|
|
48
|
+
0 0 0 3px var(--sv-color-focus-ring),
|
|
49
|
+
var(--sv-shadow-control);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.cluster {
|
|
53
|
+
width: 36px;
|
|
54
|
+
height: 36px;
|
|
55
|
+
background: var(--sv-color-accent);
|
|
56
|
+
color: var(--sv-color-text-on-accent);
|
|
57
|
+
font-family: var(--sv-font-family);
|
|
58
|
+
font-size: var(--sv-font-size-sm);
|
|
59
|
+
font-weight: var(--sv-font-weight-medium);
|
|
60
|
+
font-variant-numeric: tabular-nums;
|
|
61
|
+
line-height: 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.accent,
|
|
65
|
+
.success,
|
|
66
|
+
.warning,
|
|
67
|
+
.error,
|
|
68
|
+
.neutral {
|
|
69
|
+
/* the colour comes from --marker-colour, set on the element from the tone's token */
|
|
70
|
+
background: var(--marker-colour);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.position {
|
|
74
|
+
width: 18px;
|
|
75
|
+
height: 18px;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
border: 3px solid var(--sv-color-surface);
|
|
78
|
+
border-radius: var(--sv-radius-full);
|
|
79
|
+
background: var(--sv-color-accent);
|
|
80
|
+
box-shadow:
|
|
81
|
+
0 0 0 0 color-mix(in srgb, var(--sv-color-accent) 45%, transparent),
|
|
82
|
+
var(--sv-shadow-control);
|
|
83
|
+
animation: pulse 2.4s ease-out infinite;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@keyframes pulse {
|
|
87
|
+
to {
|
|
88
|
+
box-shadow:
|
|
89
|
+
0 0 0 16px color-mix(in srgb, var(--sv-color-accent) 0%, transparent),
|
|
90
|
+
var(--sv-shadow-control);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.pin {
|
|
95
|
+
width: 26px;
|
|
96
|
+
height: 26px;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
border: 3px solid var(--sv-color-surface);
|
|
99
|
+
border-radius: var(--sv-radius-full) var(--sv-radius-full) var(--sv-radius-full) 0;
|
|
100
|
+
background: var(--sv-color-accent);
|
|
101
|
+
box-shadow: var(--sv-shadow-control);
|
|
102
|
+
rotate: -45deg;
|
|
103
|
+
translate: 0 -8px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@media (prefers-reduced-motion: reduce) {
|
|
107
|
+
.position {
|
|
108
|
+
animation: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.grid {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
|
|
4
|
+
gap: var(--sv-space-1);
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
list-style: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.cell {
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.thumb {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
aspect-ratio: 1;
|
|
19
|
+
padding: 0;
|
|
20
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
21
|
+
border-radius: var(--sv-radius-md);
|
|
22
|
+
background: var(--sv-color-surface-sunken);
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
touch-action: manipulation;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.thumb:focus-visible {
|
|
29
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
30
|
+
outline-offset: 2px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (hover: hover) {
|
|
34
|
+
.thumb:hover {
|
|
35
|
+
border-color: var(--sv-color-text-muted);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.img {
|
|
40
|
+
display: block;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
object-fit: cover;
|
|
44
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
.scrim {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
z-index: 110;
|
|
5
|
+
background: color-mix(in srgb, var(--sv-black) calc(var(--photo-fade, 1) * 94%), transparent);
|
|
6
|
+
opacity: 0;
|
|
7
|
+
transition: opacity 0.25s ease;
|
|
8
|
+
font-family: var(--sv-font-family);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.scrimOpen {
|
|
12
|
+
opacity: 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.panel {
|
|
16
|
+
position: absolute;
|
|
17
|
+
inset: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
color: var(--sv-color-text-on-dark-fill);
|
|
21
|
+
outline: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.bar {
|
|
25
|
+
position: absolute;
|
|
26
|
+
inset-block-start: 0;
|
|
27
|
+
inset-inline: 0;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
padding: max(var(--sv-space-3), env(safe-area-inset-top))
|
|
33
|
+
max(var(--sv-space-3), env(safe-area-inset-right)) var(--sv-space-3)
|
|
34
|
+
max(var(--sv-space-3), env(safe-area-inset-left));
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.bar > * {
|
|
39
|
+
pointer-events: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.count {
|
|
43
|
+
font-size: var(--sv-font-size-sm);
|
|
44
|
+
font-variant-numeric: tabular-nums;
|
|
45
|
+
padding-inline: var(--sv-space-2);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.control {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
width: 44px;
|
|
53
|
+
height: 44px;
|
|
54
|
+
border: none;
|
|
55
|
+
border-radius: var(--sv-radius-full);
|
|
56
|
+
background: color-mix(in srgb, var(--sv-black) 45%, transparent);
|
|
57
|
+
color: inherit;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
touch-action: manipulation;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.control:focus-visible {
|
|
63
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
64
|
+
outline-offset: 2px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (hover: hover) {
|
|
68
|
+
.control:hover {
|
|
69
|
+
background: color-mix(in srgb, var(--sv-black) 70%, transparent);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.previous,
|
|
74
|
+
.next {
|
|
75
|
+
position: absolute;
|
|
76
|
+
inset-block-start: 50%;
|
|
77
|
+
z-index: 2;
|
|
78
|
+
translate: 0 -50%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.previous {
|
|
82
|
+
inset-inline-start: max(var(--sv-space-3), env(safe-area-inset-left));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.next {
|
|
86
|
+
inset-inline-end: max(var(--sv-space-3), env(safe-area-inset-right));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* A touch screen swipes; the arrow buttons are for a pointer and a keyboard. */
|
|
90
|
+
@media (pointer: coarse) {
|
|
91
|
+
.previous,
|
|
92
|
+
.next {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.stage {
|
|
98
|
+
position: relative;
|
|
99
|
+
flex: 1;
|
|
100
|
+
min-height: 0;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
/* Every gesture here is ours: the browser must not scroll or zoom the page under a finger. */
|
|
106
|
+
touch-action: none;
|
|
107
|
+
user-select: none;
|
|
108
|
+
-webkit-user-select: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.image {
|
|
112
|
+
max-width: 100%;
|
|
113
|
+
max-height: 100%;
|
|
114
|
+
object-fit: contain;
|
|
115
|
+
transform-origin: center;
|
|
116
|
+
transition: transform 0.2s ease;
|
|
117
|
+
will-change: transform;
|
|
118
|
+
-webkit-user-drag: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Under a finger the photo follows it exactly, with no easing to lag behind. */
|
|
122
|
+
.dragging {
|
|
123
|
+
transition: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.failed {
|
|
127
|
+
margin: 0;
|
|
128
|
+
padding: var(--sv-space-6);
|
|
129
|
+
text-align: center;
|
|
130
|
+
color: var(--sv-color-text-on-dark-fill);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.caption {
|
|
134
|
+
position: relative;
|
|
135
|
+
z-index: 2;
|
|
136
|
+
max-height: 30%;
|
|
137
|
+
overflow-y: auto;
|
|
138
|
+
padding: var(--sv-space-3) max(var(--sv-space-4), env(safe-area-inset-right))
|
|
139
|
+
max(var(--sv-space-4), env(safe-area-inset-bottom))
|
|
140
|
+
max(var(--sv-space-4), env(safe-area-inset-left));
|
|
141
|
+
background: color-mix(in srgb, var(--sv-black) 55%, transparent);
|
|
142
|
+
font-size: var(--sv-font-size-sm);
|
|
143
|
+
line-height: 1.45;
|
|
144
|
+
text-align: center;
|
|
145
|
+
overflow-wrap: anywhere;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@media (prefers-reduced-motion: reduce) {
|
|
149
|
+
.scrim,
|
|
150
|
+
.image {
|
|
151
|
+
transition: none;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/motion.ts
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
function useMountTransition(open, durationMs) {
|
|
6
|
+
const [phase, setPhase] = useState(open ? "entering" : "closed");
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (open) {
|
|
9
|
+
setPhase("entering");
|
|
10
|
+
const raf = requestAnimationFrame(() => setPhase("open"));
|
|
11
|
+
return () => cancelAnimationFrame(raf);
|
|
12
|
+
}
|
|
13
|
+
setPhase((p) => p === "closed" ? "closed" : "closing");
|
|
14
|
+
const timer = setTimeout(() => setPhase("closed"), durationMs);
|
|
15
|
+
return () => clearTimeout(timer);
|
|
16
|
+
}, [open, durationMs]);
|
|
17
|
+
return { mounted: phase !== "closed", phase };
|
|
18
|
+
}
|
|
19
|
+
function usePrefersReducedMotion() {
|
|
20
|
+
const [reduced, setReduced] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
23
|
+
setReduced(mql.matches);
|
|
24
|
+
function handleChange(e) {
|
|
25
|
+
setReduced(e.matches);
|
|
26
|
+
}
|
|
27
|
+
mql.addEventListener("change", handleChange);
|
|
28
|
+
return () => mql.removeEventListener("change", handleChange);
|
|
29
|
+
}, []);
|
|
30
|
+
return reduced;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
useMountTransition,
|
|
35
|
+
usePrefersReducedMotion
|
|
36
|
+
};
|