@enigmax/primitives 0.25.0 → 0.27.0
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/dist/chunk-2RIO4VDV.js +121 -0
- package/dist/{chunk-DZMHY3SU.js → chunk-CPJJ3FPW.js} +17 -7
- package/dist/chunk-EYZ366LP.js +189 -0
- package/dist/chunk-HUUINHPR.js +135 -0
- package/dist/chunk-JLZDS6CV.js +177 -0
- package/dist/chunk-O2UJ5ZIX.js +387 -0
- package/dist/chunk-PVDU6AZU.js +953 -0
- package/dist/{chunk-Z3VDE7OA.js → chunk-YQV5XZIA.js} +2 -2
- package/dist/clipboard-menu-eemzEBqB.d.ts +93 -0
- package/dist/context-DR1dpO8b.d.ts +54 -0
- package/dist/{clipboard-menu-B_ouitfS.d.ts → context-menu-qqpGBkny.d.ts} +7 -91
- package/dist/index.d.ts +292 -2
- package/dist/index.js +5 -3
- package/dist/menu-52PXC5PL.js +33 -0
- package/dist/menu-YIGMPFUP.js +58 -0
- package/dist/next/index.d.ts +6 -2
- package/dist/next/index.js +12 -8
- package/dist/react/context-menu.d.ts +15 -55
- package/dist/react/context-menu.js +2 -2
- package/dist/react/image.d.ts +112 -0
- package/dist/react/image.js +3 -0
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.js +12 -8
- package/dist/react/input.js +1 -1
- package/dist/react/video.d.ts +126 -0
- package/dist/react/video.js +3 -0
- package/dist/react-router/index.d.ts +6 -2
- package/dist/react-router/index.js +12 -8
- package/dist/viewer-N5WLFB24.js +3 -0
- package/package.json +15 -2
- package/recipes/context-menu/styles.css +8 -1
- package/recipes/image/styles.css +182 -0
- package/recipes/video/styles.css +154 -0
- package/registry.json +486 -5
- package/src/core/context-menu.ts +22 -3
- package/src/core/image-viewer.ts +269 -0
- package/src/core/player.ts +345 -0
- package/src/index.ts +55 -0
- package/src/react/context-menu/root.tsx +27 -5
- package/src/react/context-menu/styles.ts +8 -1
- package/src/react/image/icons.tsx +59 -0
- package/src/react/image/index.tsx +185 -0
- package/src/react/image/menu.tsx +80 -0
- package/src/react/image/styles.ts +213 -0
- package/src/react/image/types.ts +116 -0
- package/src/react/image/viewer.tsx +571 -0
- package/src/react/index.ts +3 -0
- package/src/react/video/icons.tsx +135 -0
- package/src/react/video/index.tsx +731 -0
- package/src/react/video/menu.tsx +66 -0
- package/src/react/video/rail.tsx +99 -0
- package/src/react/video/styles.ts +161 -0
- package/src/react/video/types.ts +141 -0
- /package/dist/{chunk-3MGBZOAU.js → chunk-RMNXVWQ4.js} +0 -0
- /package/dist/{chunk-MSOCCQGH.js → chunk-T7I6WJSN.js} +0 -0
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { useInput } from '../chunk-
|
|
2
|
+
export { useInput } from '../chunk-T7I6WJSN.js';
|
|
3
|
+
export { useSearch } from '../chunk-45UHLZYT.js';
|
|
4
|
+
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
3
5
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
4
6
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
5
|
-
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
7
|
+
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-CPJJ3FPW.js';
|
|
6
8
|
export { SelectionList, useSelection } from '../chunk-N6PDHMAX.js';
|
|
9
|
+
export { Image } from '../chunk-2RIO4VDV.js';
|
|
10
|
+
import '../chunk-EYZ366LP.js';
|
|
11
|
+
export { Video } from '../chunk-PVDU6AZU.js';
|
|
7
12
|
import { Button } from '../chunk-6BGBYUSZ.js';
|
|
8
13
|
export { getLinkComponent, setLinkComponent, useButton } from '../chunk-6BGBYUSZ.js';
|
|
9
14
|
export { Flag } from '../chunk-NPHRS2Q7.js';
|
|
10
15
|
export { Toaster, toast, useSonner } from '../chunk-WPTBURIC.js';
|
|
11
16
|
export { createNotificationQueue, defaultQueue, useNotifications } from '../chunk-QYMUIW5I.js';
|
|
12
17
|
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
13
|
-
export { useSearch } from '../chunk-45UHLZYT.js';
|
|
14
|
-
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
15
18
|
import '../chunk-KJINGUQN.js';
|
|
19
|
+
export { colorEquals, formatColor, hslToRgb, hsvToRgb, parseColor, rgbToHsl, rgbToHsv, toHex } from '../chunk-S2FPN5ID.js';
|
|
20
|
+
import '../chunk-2QFTRNAZ.js';
|
|
16
21
|
import '../chunk-IXVMRVD4.js';
|
|
17
22
|
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
18
|
-
export {
|
|
19
|
-
export { CLIPBOARD_PREFIX, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-Z3VDE7OA.js';
|
|
23
|
+
export { CLIPBOARD_PREFIX, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-YQV5XZIA.js';
|
|
20
24
|
export { DEFAULT_SELECTION_SHORTCUTS, createSelection } from '../chunk-WSQC3PCC.js';
|
|
25
|
+
import '../chunk-JLZDS6CV.js';
|
|
21
26
|
import '../chunk-MMQPZGSU.js';
|
|
22
27
|
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-LMZJBOZG.js';
|
|
23
28
|
import '../chunk-SNYUBXWQ.js';
|
|
24
29
|
import '../chunk-UOSSNUSC.js';
|
|
25
|
-
|
|
26
|
-
export { Input } from '../chunk-3MGBZOAU.js';
|
|
30
|
+
export { Input } from '../chunk-RMNXVWQ4.js';
|
|
27
31
|
import '../chunk-KVLSOQTI.js';
|
|
28
32
|
import '../chunk-F25CGNQC.js';
|
|
29
33
|
export { PaletteContent, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteRoot, PaletteTrigger, SearchPalette, usePaletteContext } from '../chunk-FGBIZDV2.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enigmax/primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Headless components: the behaviour, the timing and the accessibility, with no styles of their own. Framework-agnostic core plus thin adapters.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -37,6 +37,14 @@
|
|
|
37
37
|
"types": "./dist/react/selection.d.ts",
|
|
38
38
|
"import": "./dist/react/selection.js"
|
|
39
39
|
},
|
|
40
|
+
"./react/image": {
|
|
41
|
+
"types": "./dist/react/image.d.ts",
|
|
42
|
+
"import": "./dist/react/image.js"
|
|
43
|
+
},
|
|
44
|
+
"./react/video": {
|
|
45
|
+
"types": "./dist/react/video.d.ts",
|
|
46
|
+
"import": "./dist/react/video.js"
|
|
47
|
+
},
|
|
40
48
|
"./react/button": {
|
|
41
49
|
"types": "./dist/react/button.d.ts",
|
|
42
50
|
"import": "./dist/react/button.js"
|
|
@@ -90,6 +98,8 @@
|
|
|
90
98
|
"./toast.css": "./recipes/toast/styles.css",
|
|
91
99
|
"./input.css": "./recipes/input/styles.css",
|
|
92
100
|
"./color.css": "./recipes/color/styles.css",
|
|
101
|
+
"./image.css": "./recipes/image/styles.css",
|
|
102
|
+
"./video.css": "./recipes/video/styles.css",
|
|
93
103
|
"./marquee.css": "./recipes/marquee/styles.css",
|
|
94
104
|
"./logo-marquee.css": "./recipes/logo-marquee/styles.css",
|
|
95
105
|
"./palette.css": "./recipes/palette/styles.css",
|
|
@@ -179,7 +189,10 @@
|
|
|
179
189
|
"shortcuts",
|
|
180
190
|
"toast",
|
|
181
191
|
"unstyled",
|
|
182
|
-
"vanilla"
|
|
192
|
+
"vanilla",
|
|
193
|
+
"lightbox",
|
|
194
|
+
"image-viewer",
|
|
195
|
+
"video-player"
|
|
183
196
|
],
|
|
184
197
|
"license": "Apache-2.0",
|
|
185
198
|
"author": "FJRG2007 <fjrg2007@tpeoficial.com>",
|
|
@@ -21,6 +21,13 @@
|
|
|
21
21
|
--enigma-menu-accent: #fbbf24;
|
|
22
22
|
--enigma-menu-danger: #f87171;
|
|
23
23
|
--enigma-menu-danger-bg: rgba(248, 113, 113, 0.12);
|
|
24
|
+
|
|
25
|
+
/* Above the lightbox, which sits at 9999, because a menu is opened FROM whatever is on
|
|
26
|
+
top: the image viewer's own three-dot menu was portalled to the same body and painted
|
|
27
|
+
underneath it, so its rows could be neither seen nor pressed. A menu is the topmost
|
|
28
|
+
transient surface on a page, and this is the number that says so. It belongs here and
|
|
29
|
+
not in the light-scheme block, or half the readers get an invalid z-index. */
|
|
30
|
+
--enigma-menu-z: 10000;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
@media (prefers-color-scheme: light) {
|
|
@@ -41,7 +48,7 @@
|
|
|
41
48
|
and what a menu opened at the pointer needs. Fixed rather than absolute so a scrolling
|
|
42
49
|
ancestor cannot drag it away from the place it was opened. */
|
|
43
50
|
[data-enigma-menu-panel] {
|
|
44
|
-
position: fixed; z-index:
|
|
51
|
+
position: fixed; z-index: var(--enigma-menu-z);
|
|
45
52
|
box-sizing: border-box;
|
|
46
53
|
min-width: var(--enigma-menu-min-width);
|
|
47
54
|
max-width: min(22rem, calc(100vw - 1rem));
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The image stylesheet.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED from src/react/image/styles.ts by scripts/sync-recipes.mjs - edit that file, not
|
|
5
|
+
* this one. It exists as a stylesheet as well as a string because the component injects it,
|
|
6
|
+
* and this is the same sheet for anyone who would rather import it, copy it with
|
|
7
|
+
* `enigma add image --copy`, or fork it outright.
|
|
8
|
+
*/
|
|
9
|
+
:root {
|
|
10
|
+
--enigma-image-backdrop: rgba(0, 0, 0, 0.92);
|
|
11
|
+
--enigma-image-text: #f5f5f5;
|
|
12
|
+
--enigma-image-muted: #a3a3a3;
|
|
13
|
+
--enigma-image-control-bg: rgba(23, 23, 23, 0.72);
|
|
14
|
+
--enigma-image-control-hover: rgba(64, 64, 64, 0.82);
|
|
15
|
+
--enigma-image-control-size: 2.25rem;
|
|
16
|
+
--enigma-image-radius: 0.625rem;
|
|
17
|
+
--enigma-image-gap: 0.75rem;
|
|
18
|
+
--enigma-image-thumb-size: 3.5rem;
|
|
19
|
+
--enigma-image-focus: #f5f5f5;
|
|
20
|
+
/* Above the page's own chrome, not merely above its content: a header or a sticky sidebar
|
|
21
|
+
with a z-index of its own would otherwise paint over the dialog covering it. */
|
|
22
|
+
--enigma-image-z: 9999;
|
|
23
|
+
/* How long the picture takes to fly out of the page and back into it, and the curve it
|
|
24
|
+
flies on. They are the numbers core/image-viewer.ts waits for, so a project that
|
|
25
|
+
changes one here changes it there - see the note above the keyframes. */
|
|
26
|
+
--enigma-image-flight: 300ms;
|
|
27
|
+
--enigma-image-flight-ease: cubic-bezier(0.2, 0, 0.2, 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* The thumbnail in the page. Only what the behaviour needs: the pointer says it opens, and
|
|
31
|
+
the box is the caller's to size. */
|
|
32
|
+
[data-enigma-image] { display: inline-flex; max-width: 100%; }
|
|
33
|
+
[data-enigma-image][data-clickable] { cursor: zoom-in; }
|
|
34
|
+
/* Stated on the picture as well as inherited: a project that restyles the trigger button is
|
|
35
|
+
one cursor: pointer away from a thumbnail that no longer says it enlarges. */
|
|
36
|
+
[data-enigma-image][data-clickable] img { cursor: zoom-in; }
|
|
37
|
+
[data-enigma-image] img { display: block; max-width: 100%; height: auto; }
|
|
38
|
+
/* A real box, never display:contents: an element without one cannot be focused in Chromium,
|
|
39
|
+
so a viewer closed with Escape would hand focus to the body instead of back to the picture
|
|
40
|
+
it was opened from, and the next Tab would start at the top of the page. */
|
|
41
|
+
[data-enigma-image-trigger] {
|
|
42
|
+
display: inline-flex; max-width: 100%; padding: 0; margin: 0;
|
|
43
|
+
background: none; border: 0; color: inherit; font: inherit; cursor: inherit;
|
|
44
|
+
}
|
|
45
|
+
[data-enigma-image-trigger]:focus-visible img { outline: 2px solid var(--enigma-image-focus); outline-offset: 3px; }
|
|
46
|
+
|
|
47
|
+
/* The viewer. Fixed and portalled: a lightbox inside the page's own stacking context is a
|
|
48
|
+
lightbox some ancestor's overflow or transform will clip. */
|
|
49
|
+
[data-enigma-image-viewer] {
|
|
50
|
+
position: fixed; inset: 0; z-index: var(--enigma-image-z);
|
|
51
|
+
display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
|
|
52
|
+
background: var(--enigma-image-backdrop);
|
|
53
|
+
color: var(--enigma-image-text);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* The opening: the backdrop arrives while the picture flies out of the page, and the toolbar
|
|
57
|
+
and the strip arrive with it rather than being there first over a picture that is still on
|
|
58
|
+
its way. data-state is only ever "opening" or "closing" while an animation is meant to be
|
|
59
|
+
running, so a viewer that skipped the flight - reduced motion, animate={false} - matches
|
|
60
|
+
none of these rules and simply exists. */
|
|
61
|
+
@keyframes enigma-image-in { from { background-color: transparent; } to { background-color: var(--enigma-image-backdrop); } }
|
|
62
|
+
@keyframes enigma-image-chrome { from { opacity: 0; } to { opacity: 1; } }
|
|
63
|
+
[data-enigma-image-viewer][data-state="opening"] { animation: enigma-image-in var(--enigma-image-flight) ease-out; }
|
|
64
|
+
[data-enigma-image-viewer][data-state="opening"] [data-enigma-image-bar],
|
|
65
|
+
[data-enigma-image-viewer][data-state="opening"] [data-enigma-image-foot],
|
|
66
|
+
[data-enigma-image-viewer][data-state="opening"] [data-enigma-image-nav] {
|
|
67
|
+
animation: enigma-image-chrome var(--enigma-image-flight) ease-out;
|
|
68
|
+
}
|
|
69
|
+
/* On the way out the backdrop drains, and the dialog stops taking presses: it is over the
|
|
70
|
+
page again, so a click through it would land on whatever is now under the pointer. */
|
|
71
|
+
[data-enigma-image-viewer][data-state="closing"] {
|
|
72
|
+
background-color: transparent; pointer-events: none;
|
|
73
|
+
transition: background-color var(--enigma-image-flight) var(--enigma-image-flight-ease);
|
|
74
|
+
}
|
|
75
|
+
[data-enigma-image-viewer][data-state="closing"] [data-enigma-image-bar],
|
|
76
|
+
[data-enigma-image-viewer][data-state="closing"] [data-enigma-image-foot],
|
|
77
|
+
[data-enigma-image-viewer][data-state="closing"] [data-enigma-image-nav] {
|
|
78
|
+
opacity: 0; transition: opacity calc(var(--enigma-image-flight) / 2) ease-in;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[data-enigma-image-bar] {
|
|
82
|
+
display: flex; align-items: center; gap: 0.5rem;
|
|
83
|
+
padding: var(--enigma-image-gap);
|
|
84
|
+
}
|
|
85
|
+
[data-enigma-image-counter] {
|
|
86
|
+
font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--enigma-image-muted);
|
|
87
|
+
margin-inline-end: auto;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[data-enigma-image-button] {
|
|
91
|
+
display: grid; place-items: center; flex: none;
|
|
92
|
+
width: var(--enigma-image-control-size); height: var(--enigma-image-control-size);
|
|
93
|
+
padding: 0; color: var(--enigma-image-text);
|
|
94
|
+
background: var(--enigma-image-control-bg); border: 0; border-radius: 999px;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
97
|
+
[data-enigma-image-button]:hover { background: var(--enigma-image-control-hover); }
|
|
98
|
+
[data-enigma-image-button]:focus-visible { outline: 2px solid var(--enigma-image-focus); outline-offset: 2px; }
|
|
99
|
+
[data-enigma-image-button][disabled] { opacity: 0.35; cursor: not-allowed; }
|
|
100
|
+
|
|
101
|
+
/* The frame the picture is fitted into, and the surface every gesture is measured against. */
|
|
102
|
+
[data-enigma-image-frame] {
|
|
103
|
+
position: relative; overflow: hidden;
|
|
104
|
+
display: grid; place-items: center;
|
|
105
|
+
/* Room for the arrows down each side, so they sit beside the picture rather than on it. */
|
|
106
|
+
padding: 0 calc(var(--enigma-image-control-size) + var(--enigma-image-gap) * 1.5);
|
|
107
|
+
/* The drag IS the control once zoomed, so the page must not scroll under it. */
|
|
108
|
+
touch-action: none;
|
|
109
|
+
-webkit-user-select: none; user-select: none;
|
|
110
|
+
}
|
|
111
|
+
[data-enigma-image-frame] img {
|
|
112
|
+
max-width: 100%; max-height: 100%;
|
|
113
|
+
-webkit-user-drag: none;
|
|
114
|
+
will-change: transform;
|
|
115
|
+
}
|
|
116
|
+
/* Only while it is MOVING, which is not the same as "during the flight".
|
|
117
|
+
A transition left on permanently would put 300ms of lag between the wheel and the zoom, and
|
|
118
|
+
turn every pan into a drag the picture follows late. And one left on during "pending" is
|
|
119
|
+
worse than useless: putting the picture on the thumbnail is itself a transform change, so it
|
|
120
|
+
animated there over 300ms - behind a hidden element - and by the time anybody could see it
|
|
121
|
+
the flight was nearly over. */
|
|
122
|
+
[data-enigma-image-frame][data-flying="moving"] img { transition: transform var(--enigma-image-flight) var(--enigma-image-flight-ease); }
|
|
123
|
+
/* Not drawn until there is somewhere to fly from - see the note on the attribute. The spinner
|
|
124
|
+
is what stands in for it, the same one a slow picture gets. */
|
|
125
|
+
[data-enigma-image-frame][data-flying="pending"] img { visibility: hidden; }
|
|
126
|
+
@media (prefers-reduced-motion: reduce) {
|
|
127
|
+
[data-enigma-image-frame][data-flying="moving"] img { transition: none; }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* The cursor says what a press does, which in a lightbox is three different things. The empty
|
|
131
|
+
part of the frame IS the backdrop and closes it; the picture at rest takes a double press to
|
|
132
|
+
enlarge; once it is enlarged the gesture is a drag. */
|
|
133
|
+
[data-enigma-image-frame] { cursor: zoom-out; }
|
|
134
|
+
[data-enigma-image-frame][data-zoom] img { cursor: zoom-in; }
|
|
135
|
+
[data-enigma-image-frame][data-zoomed],
|
|
136
|
+
[data-enigma-image-frame][data-zoomed] img { cursor: grab; }
|
|
137
|
+
[data-enigma-image-frame][data-panning],
|
|
138
|
+
[data-enigma-image-frame][data-panning] img { cursor: grabbing; }
|
|
139
|
+
[data-enigma-image-frame][data-loading] img { opacity: 0.35; }
|
|
140
|
+
|
|
141
|
+
/* Left and right sit over the picture rather than beside it: the frame is the biggest thing
|
|
142
|
+
on screen and the arrows have to be reachable without hunting for an edge. */
|
|
143
|
+
[data-enigma-image-nav] {
|
|
144
|
+
position: absolute; top: 50%; translate: 0 -50%;
|
|
145
|
+
width: var(--enigma-image-control-size); height: var(--enigma-image-control-size);
|
|
146
|
+
}
|
|
147
|
+
[data-enigma-image-nav="previous"] { left: var(--enigma-image-gap); }
|
|
148
|
+
[data-enigma-image-nav="next"] { right: var(--enigma-image-gap); }
|
|
149
|
+
|
|
150
|
+
[data-enigma-image-spinner] {
|
|
151
|
+
position: absolute; width: 1.75rem; height: 1.75rem;
|
|
152
|
+
border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: var(--enigma-image-text);
|
|
153
|
+
border-radius: 999px; animation: enigma-image-spin 700ms linear infinite;
|
|
154
|
+
}
|
|
155
|
+
@keyframes enigma-image-spin { to { rotate: 360deg; } }
|
|
156
|
+
@media (prefers-reduced-motion: reduce) {
|
|
157
|
+
[data-enigma-image-spinner] { animation-duration: 2s; }
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
[data-enigma-image-foot] { display: grid; gap: 0.5rem; padding: var(--enigma-image-gap); }
|
|
161
|
+
[data-enigma-image-caption] {
|
|
162
|
+
margin: 0; text-align: center; font-size: 0.8125rem; line-height: 1.5;
|
|
163
|
+
color: var(--enigma-image-muted);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* The strip. Scrolls on its own rather than wrapping: a gallery of forty is one row you drag
|
|
167
|
+
through, not five rows that push the picture off the screen. */
|
|
168
|
+
[data-enigma-image-strip] {
|
|
169
|
+
display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: thin;
|
|
170
|
+
justify-content: safe center;
|
|
171
|
+
padding-bottom: 0.25rem;
|
|
172
|
+
}
|
|
173
|
+
[data-enigma-image-thumb] {
|
|
174
|
+
flex: none; width: var(--enigma-image-thumb-size); height: var(--enigma-image-thumb-size);
|
|
175
|
+
padding: 0; overflow: hidden;
|
|
176
|
+
background: none; border: 0; border-radius: 0.375rem;
|
|
177
|
+
opacity: 0.55; cursor: pointer;
|
|
178
|
+
}
|
|
179
|
+
[data-enigma-image-thumb] img { width: 100%; height: 100%; object-fit: cover; }
|
|
180
|
+
[data-enigma-image-thumb]:hover { opacity: 0.85; }
|
|
181
|
+
[data-enigma-image-thumb][aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--enigma-image-focus); }
|
|
182
|
+
[data-enigma-image-thumb]:focus-visible { outline: 2px solid var(--enigma-image-focus); outline-offset: 2px; }
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The video stylesheet.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED from src/react/video/styles.ts by scripts/sync-recipes.mjs - edit that file, not
|
|
5
|
+
* this one. It exists as a stylesheet as well as a string because the component injects it,
|
|
6
|
+
* and this is the same sheet for anyone who would rather import it, copy it with
|
|
7
|
+
* `enigma add video --copy`, or fork it outright.
|
|
8
|
+
*/
|
|
9
|
+
:root {
|
|
10
|
+
--enigma-video-accent: #3b82f6;
|
|
11
|
+
--enigma-video-bg: #000000;
|
|
12
|
+
--enigma-video-text: #ffffff;
|
|
13
|
+
--enigma-video-muted: rgba(255, 255, 255, 0.72);
|
|
14
|
+
--enigma-video-rail: rgba(255, 255, 255, 0.28);
|
|
15
|
+
--enigma-video-buffer: rgba(255, 255, 255, 0.45);
|
|
16
|
+
--enigma-video-panel-bg: rgba(23, 23, 23, 0.96);
|
|
17
|
+
--enigma-video-radius: 0.5rem;
|
|
18
|
+
--enigma-video-control-size: 2rem;
|
|
19
|
+
/* The icons are sized HERE and not in em of the bar's text: 1.25em of a 13px label is a
|
|
20
|
+
16px icon, and the same markup in a project with larger type silently grew a different
|
|
21
|
+
player. */
|
|
22
|
+
--enigma-video-icon-size: 1.125rem;
|
|
23
|
+
--enigma-video-rail-height: 0.3125rem;
|
|
24
|
+
--enigma-video-rail-hover: 0.5rem;
|
|
25
|
+
--enigma-video-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-enigma-video] {
|
|
29
|
+
position: relative; display: block; width: 100%; overflow: hidden;
|
|
30
|
+
background: var(--enigma-video-bg); border-radius: var(--enigma-video-radius);
|
|
31
|
+
color: var(--enigma-video-text);
|
|
32
|
+
font-size: 0.8125rem; line-height: 1;
|
|
33
|
+
}
|
|
34
|
+
[data-enigma-video] video { display: block; width: 100%; height: 100%; }
|
|
35
|
+
/* Fullscreen needs no sizing of its own: the UA stylesheet pins the fullscreen element to the
|
|
36
|
+
screen with !important, which outranks anything a page or this sheet can say, and a video
|
|
37
|
+
element already fits itself with object-fit: contain. Only the corner is ours. */
|
|
38
|
+
[data-enigma-video][data-fullscreen] { border-radius: 0; }
|
|
39
|
+
[data-enigma-video][data-hidden] { cursor: none; }
|
|
40
|
+
|
|
41
|
+
/* The big one, while nothing is playing. Plyr's shape: a filled circle over the poster,
|
|
42
|
+
large enough to be the obvious target on a phone. */
|
|
43
|
+
[data-enigma-video-big] {
|
|
44
|
+
position: absolute; inset: 0; margin: auto;
|
|
45
|
+
display: grid; place-items: center;
|
|
46
|
+
width: 3.75rem; height: 3.75rem; padding: 0;
|
|
47
|
+
color: var(--enigma-video-text); background: var(--enigma-video-accent);
|
|
48
|
+
border: 0; border-radius: 999px; box-shadow: var(--enigma-video-shadow);
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
[data-enigma-video-big]:focus-visible { outline: 2px solid var(--enigma-video-text); outline-offset: 3px; }
|
|
52
|
+
|
|
53
|
+
[data-enigma-video-overlay] { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
|
|
54
|
+
[data-enigma-video-overlay] > * { pointer-events: auto; }
|
|
55
|
+
|
|
56
|
+
[data-enigma-video-spinner] {
|
|
57
|
+
width: 2rem; height: 2rem;
|
|
58
|
+
border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: var(--enigma-video-text);
|
|
59
|
+
border-radius: 999px; animation: enigma-video-spin 700ms linear infinite;
|
|
60
|
+
}
|
|
61
|
+
@keyframes enigma-video-spin { to { rotate: 360deg; } }
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
[data-enigma-video-spinner] { animation-duration: 2s; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-enigma-video-controls] {
|
|
67
|
+
position: absolute; inset-inline: 0; bottom: 0;
|
|
68
|
+
display: flex; align-items: center; gap: 0.375rem;
|
|
69
|
+
padding: 2.5rem 0.625rem 0.625rem;
|
|
70
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
|
|
71
|
+
transition: opacity 180ms ease, translate 180ms ease;
|
|
72
|
+
}
|
|
73
|
+
[data-enigma-video][data-hidden] [data-enigma-video-controls] { opacity: 0; translate: 0 0.5rem; pointer-events: none; }
|
|
74
|
+
@media (prefers-reduced-motion: reduce) {
|
|
75
|
+
[data-enigma-video-controls] { transition: none; }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-enigma-video-button] {
|
|
79
|
+
display: grid; place-items: center; flex: none;
|
|
80
|
+
width: var(--enigma-video-control-size); height: var(--enigma-video-control-size);
|
|
81
|
+
padding: 0; color: var(--enigma-video-text); background: none; border: 0; border-radius: 0.375rem;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
84
|
+
[data-enigma-video-button] svg { width: var(--enigma-video-icon-size); height: var(--enigma-video-icon-size); flex: none; }
|
|
85
|
+
[data-enigma-video-big] svg { width: 1.5rem; height: 1.5rem; }
|
|
86
|
+
[data-enigma-video-button]:hover { background: rgba(255, 255, 255, 0.16); }
|
|
87
|
+
[data-enigma-video-button]:focus-visible { outline: 2px solid var(--enigma-video-text); outline-offset: 1px; }
|
|
88
|
+
[data-enigma-video-button][aria-pressed="true"] { color: var(--enigma-video-accent); }
|
|
89
|
+
|
|
90
|
+
[data-enigma-video-time] { flex: none; color: var(--enigma-video-muted); font-variant-numeric: tabular-nums; }
|
|
91
|
+
|
|
92
|
+
/* The rail. Its hit area is the row, not the 5px line: a scrubber you have to hit exactly is
|
|
93
|
+
one people miss and then seek by accident. */
|
|
94
|
+
[data-enigma-video-rail] {
|
|
95
|
+
position: relative; flex: 1; min-width: 3rem; height: 1rem;
|
|
96
|
+
display: flex; align-items: center;
|
|
97
|
+
cursor: pointer; touch-action: none;
|
|
98
|
+
}
|
|
99
|
+
[data-enigma-video-track] {
|
|
100
|
+
position: relative; width: 100%; height: var(--enigma-video-rail-height);
|
|
101
|
+
background: var(--enigma-video-rail); border-radius: 999px; overflow: hidden;
|
|
102
|
+
transition: height 120ms ease;
|
|
103
|
+
}
|
|
104
|
+
[data-enigma-video-rail]:hover [data-enigma-video-track],
|
|
105
|
+
[data-enigma-video-rail]:focus-visible [data-enigma-video-track] { height: var(--enigma-video-rail-hover); }
|
|
106
|
+
[data-enigma-video-rail]:focus-visible { outline: 2px solid var(--enigma-video-text); outline-offset: 2px; border-radius: 999px; }
|
|
107
|
+
[data-enigma-video-buffer] { position: absolute; inset-block: 0; left: 0; background: var(--enigma-video-buffer); }
|
|
108
|
+
[data-enigma-video-played] { position: absolute; inset-block: 0; left: 0; background: var(--enigma-video-accent); }
|
|
109
|
+
[data-enigma-video-knob] {
|
|
110
|
+
position: absolute; top: 50%; translate: -50% -50%;
|
|
111
|
+
width: 0.75rem; height: 0.75rem; border-radius: 999px;
|
|
112
|
+
background: var(--enigma-video-text); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* The volume rail folds away until the control is reached, which is what keeps a narrow
|
|
117
|
+
player from spending a third of its bar on something rarely touched. */
|
|
118
|
+
[data-enigma-video-volume] { display: flex; align-items: center; flex: none; }
|
|
119
|
+
[data-enigma-video-volume] [data-enigma-video-rail] {
|
|
120
|
+
width: 0; min-width: 0; opacity: 0; transition: width 140ms ease, opacity 140ms ease;
|
|
121
|
+
}
|
|
122
|
+
[data-enigma-video-volume]:hover [data-enigma-video-rail],
|
|
123
|
+
[data-enigma-video-volume]:focus-within [data-enigma-video-rail] { width: 4.5rem; min-width: 4.5rem; opacity: 1; }
|
|
124
|
+
|
|
125
|
+
[data-enigma-video-menu] { position: relative; flex: none; }
|
|
126
|
+
/* The panel opens upward, and the player CLIPS - it has to, or a rounded corner is not
|
|
127
|
+
rounded. So its height is bounded by the room above the button that opened it (measured, and
|
|
128
|
+
set inline) and what does not fit scrolls. Without this a speed list plus a language list is
|
|
129
|
+
a panel with its top cut off on any player under about 300px. */
|
|
130
|
+
[data-enigma-video-panel] {
|
|
131
|
+
position: absolute; right: 0; bottom: calc(100% + 0.5rem); z-index: 2;
|
|
132
|
+
box-sizing: border-box; min-width: 8.5rem; max-width: calc(100vw - 2rem); padding: 0.25rem;
|
|
133
|
+
max-height: 14rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
|
|
134
|
+
background: var(--enigma-video-panel-bg); border-radius: 0.5rem; box-shadow: var(--enigma-video-shadow);
|
|
135
|
+
}
|
|
136
|
+
[data-enigma-video-option] {
|
|
137
|
+
display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
|
|
138
|
+
width: 100%; padding: 0.4375rem 0.5rem;
|
|
139
|
+
color: var(--enigma-video-text); background: none; border: 0; border-radius: 0.375rem;
|
|
140
|
+
font: inherit; text-align: left; cursor: pointer;
|
|
141
|
+
}
|
|
142
|
+
[data-enigma-video-option]:hover { background: rgba(255, 255, 255, 0.12); }
|
|
143
|
+
[data-enigma-video-option][aria-checked="true"] { color: var(--enigma-video-accent); }
|
|
144
|
+
[data-enigma-video-option]:focus-visible { outline: 2px solid var(--enigma-video-text); outline-offset: -2px; }
|
|
145
|
+
/* Sticky because the panel scrolls: the language you are choosing between should still say
|
|
146
|
+
which list it belongs to when the speeds have scrolled past it. */
|
|
147
|
+
[data-enigma-video-heading] {
|
|
148
|
+
position: sticky; top: 0; z-index: 1; margin: 0;
|
|
149
|
+
padding: 0.375rem 0.5rem; color: var(--enigma-video-muted);
|
|
150
|
+
background: var(--enigma-video-panel-bg);
|
|
151
|
+
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em;
|
|
152
|
+
}
|
|
153
|
+
[data-enigma-video-option] svg { width: 0.875rem; height: 0.875rem; flex: none; }
|
|
154
|
+
[data-enigma-video-option] span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|