@michaelyagi/shoji 0.1.0-alpha.6
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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/esm/core/EventBus.d.ts +16 -0
- package/dist/esm/core/FocusTrap.d.ts +9 -0
- package/dist/esm/core/Gallery.d.ts +221 -0
- package/dist/esm/core/GestureController.d.ts +50 -0
- package/dist/esm/core/LiveRegion.d.ts +6 -0
- package/dist/esm/core/SlideManager.d.ts +83 -0
- package/dist/esm/core/bodyScrollLock.d.ts +2 -0
- package/dist/esm/core/dom.d.ts +27 -0
- package/dist/esm/core/icons.d.ts +6 -0
- package/dist/esm/core/index.d.ts +5 -0
- package/dist/esm/core/index.js +1966 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/plugin.d.ts +54 -0
- package/dist/esm/core/rotateFlipNormalize.d.ts +19 -0
- package/dist/esm/core/scan.d.ts +8 -0
- package/dist/esm/core/types.d.ts +268 -0
- package/dist/esm/core/zoomTransition.d.ts +33 -0
- package/dist/esm/gestures/GestureEngine.d.ts +78 -0
- package/dist/esm/index.css +475 -0
- package/dist/esm/index.d.ts +32 -0
- package/dist/esm/index.js +24 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index2.css +22 -0
- package/dist/esm/index3.css +166 -0
- package/dist/esm/index4.css +27 -0
- package/dist/esm/plugins/activeThumbnail/index.d.ts +26 -0
- package/dist/esm/plugins/activeThumbnail/index.js +48 -0
- package/dist/esm/plugins/activeThumbnail/index.js.map +1 -0
- package/dist/esm/plugins/autoplay/icons.d.ts +3 -0
- package/dist/esm/plugins/autoplay/index.d.ts +17 -0
- package/dist/esm/plugins/autoplay/index.js +177 -0
- package/dist/esm/plugins/autoplay/index.js.map +1 -0
- package/dist/esm/plugins/fullscreen/icons.d.ts +3 -0
- package/dist/esm/plugins/fullscreen/index.d.ts +17 -0
- package/dist/esm/plugins/fullscreen/index.js +74 -0
- package/dist/esm/plugins/fullscreen/index.js.map +1 -0
- package/dist/esm/plugins/layout/index.d.ts +191 -0
- package/dist/esm/plugins/layout/index.js +746 -0
- package/dist/esm/plugins/layout/index.js.map +1 -0
- package/dist/esm/plugins/layout/justified.d.ts +68 -0
- package/dist/esm/plugins/layout/masonry.d.ts +92 -0
- package/dist/esm/plugins/rotateFlip/icons.d.ts +5 -0
- package/dist/esm/plugins/rotateFlip/index.d.ts +17 -0
- package/dist/esm/plugins/rotateFlip/index.js +138 -0
- package/dist/esm/plugins/rotateFlip/index.js.map +1 -0
- package/dist/esm/plugins/video/index.d.ts +13 -0
- package/dist/esm/plugins/video/index.js +95 -0
- package/dist/esm/plugins/video/index.js.map +1 -0
- package/dist/esm/plugins/video/youtube.d.ts +61 -0
- package/dist/esm/plugins/zoom/icons.d.ts +4 -0
- package/dist/esm/plugins/zoom/index.d.ts +30 -0
- package/dist/esm/plugins/zoom/index.js +274 -0
- package/dist/esm/plugins/zoom/index.js.map +1 -0
- package/dist/esm/plugins/zoom/zoomMath.d.ts +24 -0
- package/dist/esm/transitions/SlideTransition.d.ts +25 -0
- package/dist/esm/transitions/presets.d.ts +21 -0
- package/dist/esm/zoomTransition-bbKHpVpA.js +110 -0
- package/dist/esm/zoomTransition-bbKHpVpA.js.map +1 -0
- package/dist/shoji.css +690 -0
- package/dist/shoji.js +3605 -0
- package/dist/shoji.js.map +1 -0
- package/dist/shoji.min.css +1 -0
- package/dist/shoji.min.js +2 -0
- package/dist/shoji.min.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core theme tokens (DESIGN.md §9). Dark is the default theme; `.shoji-light`
|
|
3
|
+
* overrides to light. No hardcoded colors/sizes elsewhere in JS or CSS —
|
|
4
|
+
* everything routes through these custom properties.
|
|
5
|
+
*/
|
|
6
|
+
:root {
|
|
7
|
+
/* .shoji-outer's own page-level z-index — relative to the rest of the
|
|
8
|
+
host page, not to anything inside the lightbox. Real pages routinely
|
|
9
|
+
put sticky navbars/sidebars/toast containers at 1000-9999, so this
|
|
10
|
+
needs real headroom, not the small internal scale below (which only
|
|
11
|
+
orders backdrop/slides/overlay/toolbar/toast *against each other*,
|
|
12
|
+
inside the stacking context .shoji-outer's own z-index establishes). */
|
|
13
|
+
--shoji-z-base: 9000;
|
|
14
|
+
|
|
15
|
+
--shoji-z-backdrop: 0;
|
|
16
|
+
--shoji-z-slides: 10;
|
|
17
|
+
--shoji-z-overlay: 20;
|
|
18
|
+
--shoji-z-toolbar: 30;
|
|
19
|
+
--shoji-z-toast: 40;
|
|
20
|
+
|
|
21
|
+
--shoji-color-bg: #0b0b0d;
|
|
22
|
+
--shoji-color-fg: #f5f5f5;
|
|
23
|
+
--shoji-color-accent: #4da3ff;
|
|
24
|
+
--shoji-color-backdrop: rgba(0, 0, 0, 0.92);
|
|
25
|
+
--shoji-color-toolbar-bg: rgba(20, 20, 22, 0.85);
|
|
26
|
+
--shoji-color-disabled: rgba(245, 245, 245, 0.35);
|
|
27
|
+
|
|
28
|
+
--shoji-focus-ring: 2px solid var(--shoji-color-accent);
|
|
29
|
+
--shoji-progress: var(--shoji-color-accent);
|
|
30
|
+
|
|
31
|
+
--shoji-spacing-sm: 0.5rem;
|
|
32
|
+
--shoji-spacing-md: 1rem;
|
|
33
|
+
--shoji-spacing-lg: 1.5rem;
|
|
34
|
+
|
|
35
|
+
--shoji-easing: cubic-bezier(0.4, 0, 0.2, 1);
|
|
36
|
+
--shoji-duration: 300ms;
|
|
37
|
+
/* Caps how tall the caption box can grow before it scrolls internally —
|
|
38
|
+
an unbounded caption on a long string would otherwise creep up over a
|
|
39
|
+
video slide's native control bar underneath it (bottom-left, same
|
|
40
|
+
corner), silently swallowing scrub/volume/fullscreen clicks with no
|
|
41
|
+
way to reach them. `min()` also bounds it on a short/wide dialog
|
|
42
|
+
(mobile landscape), where a `rem`-only cap could still eat most of
|
|
43
|
+
the available height. */
|
|
44
|
+
--shoji-caption-max-height: min(8rem, 30%);
|
|
45
|
+
/* Reserved space at the top of a provider embed (YouTube etc.) so its own
|
|
46
|
+
hover-revealed title bar never sits under Shoji's toolbar — matches the
|
|
47
|
+
toolbar's own rendered height (44px button + top/bottom padding).
|
|
48
|
+
Permanent, not tied to the toolbar's auto-hide state, so the video
|
|
49
|
+
never resizes as the toolbar fades in/out. HTML5 video has no top-of-
|
|
50
|
+
player UI at all, so it's untouched. */
|
|
51
|
+
--shoji-provider-video-top-inset: calc(44px + 2 * var(--shoji-spacing-sm));
|
|
52
|
+
/* DESIGN.md §2.4 — the gesture engine's own documented default easing for
|
|
53
|
+
drag-to-navigate/drag-to-close settle animations specifically (a snap
|
|
54
|
+
tuned for "released mid-motion," distinct from --shoji-easing's
|
|
55
|
+
open/close/zoom-transition curve). */
|
|
56
|
+
--shoji-momentum-easing: cubic-bezier(0.2, 0, 0, 1);
|
|
57
|
+
|
|
58
|
+
/* System-font stack: no webfont download, renders instantly, looks native
|
|
59
|
+
(San Francisco / Segoe UI / Roboto) on every platform. */
|
|
60
|
+
--shoji-font-family:
|
|
61
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
|
|
62
|
+
'Apple Color Emoji', 'Segoe UI Emoji';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.shoji-light {
|
|
66
|
+
--shoji-color-bg: #fafafa;
|
|
67
|
+
--shoji-color-fg: #111111;
|
|
68
|
+
--shoji-color-backdrop: rgba(255, 255, 255, 0.96);
|
|
69
|
+
--shoji-color-toolbar-bg: rgba(255, 255, 255, 0.9);
|
|
70
|
+
--shoji-color-disabled: rgba(17, 17, 17, 0.35);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (prefers-reduced-motion: reduce) {
|
|
74
|
+
:root {
|
|
75
|
+
--shoji-duration: 0ms;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Lightbox structure (DESIGN.md §2.3 slides, §2.6 dialog). Built lazily on first open(). */
|
|
80
|
+
.shoji-outer {
|
|
81
|
+
display: none;
|
|
82
|
+
position: fixed;
|
|
83
|
+
inset: 0;
|
|
84
|
+
z-index: var(--shoji-z-base);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.shoji-outer.shoji-open {
|
|
88
|
+
display: block;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.shoji-backdrop {
|
|
92
|
+
position: absolute;
|
|
93
|
+
inset: 0;
|
|
94
|
+
z-index: var(--shoji-z-backdrop);
|
|
95
|
+
background: var(--shoji-color-backdrop);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.shoji-dialog {
|
|
99
|
+
position: relative;
|
|
100
|
+
z-index: var(--shoji-z-slides);
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
height: 100%;
|
|
104
|
+
color: var(--shoji-color-fg);
|
|
105
|
+
font-family: var(--shoji-font-family);
|
|
106
|
+
outline: none;
|
|
107
|
+
/* DESIGN.md §2.4 — the gesture engine owns horizontal/vertical drag on
|
|
108
|
+
this element; without this, touch browsers intercept the same gesture
|
|
109
|
+
for native scroll/pull-to-refresh/back-navigation before JS ever sees
|
|
110
|
+
enough movement to lock a direction. Buttons/video inside remain
|
|
111
|
+
interactive regardless (this is about implicit browser gesture
|
|
112
|
+
handling, not pointer-events). */
|
|
113
|
+
touch-action: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.shoji-toolbar {
|
|
117
|
+
position: absolute;
|
|
118
|
+
inset: 0 0 auto 0;
|
|
119
|
+
z-index: var(--shoji-z-toolbar);
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
padding: var(--shoji-spacing-sm);
|
|
123
|
+
pointer-events: none;
|
|
124
|
+
/* Reported from real usage: the Zoom plugin's frequent scale() updates on
|
|
125
|
+
the photo (a sibling, not a descendant) could show as GPU tile-seam
|
|
126
|
+
artifacts (thin lines) through the toolbar's own semi-transparent,
|
|
127
|
+
border-radius buttons — the same class of rendering quirk already noted
|
|
128
|
+
for progressive image decode. Promoting the toolbar to its own stable
|
|
129
|
+
compositing layer, decoupled from the photo's repaints, avoids it. */
|
|
130
|
+
will-change: transform;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* DESIGN.md §3 — ctx.ui.toolbar(slot, ...) inserts plugin buttons into these;
|
|
134
|
+
pointer-events re-enabled per-slot (not per-button) so gaps between slots
|
|
135
|
+
stay click-through even once a slot has content. `flex-wrap: wrap` (not
|
|
136
|
+
`overflow-x: auto`) is deliberate: several plugins loaded together on a
|
|
137
|
+
narrow/mobile viewport can add up to more 44px buttons than the width
|
|
138
|
+
allows (CLAUDE.md's own touch-target size, non-negotiable), and this
|
|
139
|
+
project treats horizontal scroll as something to design around, not
|
|
140
|
+
reach for (see the layout plugin's masonry `orientation: 'horizontal'`,
|
|
141
|
+
which was rebuilt specifically to avoid it) — wrapping to a second row
|
|
142
|
+
keeps every button reachable by a tap with no sideways scroll gesture
|
|
143
|
+
anywhere in the lightbox chrome either. */
|
|
144
|
+
.shoji-toolbar-slot {
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-wrap: wrap;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: var(--shoji-spacing-sm);
|
|
149
|
+
pointer-events: auto;
|
|
150
|
+
max-width: 45%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.shoji-toolbar-left {
|
|
154
|
+
justify-content: flex-start;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.shoji-toolbar-right {
|
|
158
|
+
justify-content: flex-end;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.shoji-close,
|
|
162
|
+
.shoji-nav,
|
|
163
|
+
.shoji-toolbar-button {
|
|
164
|
+
appearance: none;
|
|
165
|
+
border: none;
|
|
166
|
+
padding: 0;
|
|
167
|
+
width: 44px;
|
|
168
|
+
height: 44px;
|
|
169
|
+
border-radius: 50%;
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
background: rgba(0, 0, 0, 0.4);
|
|
174
|
+
color: var(--shoji-color-fg);
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.shoji-close:hover,
|
|
179
|
+
.shoji-nav:hover,
|
|
180
|
+
.shoji-toolbar-button:hover {
|
|
181
|
+
background: rgba(0, 0, 0, 0.6);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.shoji-close:focus-visible,
|
|
185
|
+
.shoji-nav:focus-visible,
|
|
186
|
+
.shoji-toolbar-button:focus-visible {
|
|
187
|
+
outline: var(--shoji-focus-ring);
|
|
188
|
+
outline-offset: 2px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.shoji-nav {
|
|
192
|
+
position: absolute;
|
|
193
|
+
top: 50%;
|
|
194
|
+
transform: translateY(-50%);
|
|
195
|
+
z-index: var(--shoji-z-toolbar);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.shoji-nav-prev {
|
|
199
|
+
left: var(--shoji-spacing-md);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.shoji-nav-next {
|
|
203
|
+
right: var(--shoji-spacing-md);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.shoji-nav:disabled {
|
|
207
|
+
opacity: 0.3;
|
|
208
|
+
cursor: default;
|
|
209
|
+
pointer-events: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.shoji-close[hidden],
|
|
213
|
+
.shoji-nav[hidden],
|
|
214
|
+
.shoji-toolbar-button[hidden] {
|
|
215
|
+
display: none;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* DESIGN.md §2.3 — while the active slide's own content is still loading,
|
|
219
|
+
feature/plugin toolbar buttons (zoom, rotate, fullscreen, autoplay, any
|
|
220
|
+
custom plugin's own button) dim and stop responding, since they'd
|
|
221
|
+
otherwise act on content about to be replaced. Deliberately scoped to
|
|
222
|
+
`.shoji-toolbar-button` only — `.shoji-close`/`.shoji-nav` are different
|
|
223
|
+
classes, so closing and navigating are never blocked by a slow image.
|
|
224
|
+
`pointer-events: none` here is the mouse half; Gallery.ts's matching
|
|
225
|
+
`tabIndex = -1` is the keyboard half (this alone wouldn't stop
|
|
226
|
+
Enter/Space activating an already-focused button). */
|
|
227
|
+
.shoji-outer.shoji-slide-loading .shoji-toolbar-button {
|
|
228
|
+
opacity: 0.3;
|
|
229
|
+
cursor: default;
|
|
230
|
+
pointer-events: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.shoji-slides {
|
|
234
|
+
position: relative;
|
|
235
|
+
flex: 1;
|
|
236
|
+
overflow: hidden;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.shoji-slide {
|
|
240
|
+
position: absolute;
|
|
241
|
+
inset: 0;
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items: center;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
/* transform (translateX per pool offset) is set inline by SlideManager */
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.shoji-slide-media {
|
|
249
|
+
/* Definite size (not max-width/max-height alone) so the img's own
|
|
250
|
+
percentage-based max-width/max-height below has something concrete to
|
|
251
|
+
resolve against — otherwise it sizes to the image's natural dimensions
|
|
252
|
+
instead of being contained, and object-fit: contain never engages. */
|
|
253
|
+
width: 100%;
|
|
254
|
+
height: 100%;
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: center;
|
|
257
|
+
justify-content: center;
|
|
258
|
+
/* Anchors .shoji-video-play-overlay's absolute positioning to this box
|
|
259
|
+
specifically, not implicitly to whichever positioned ancestor happens
|
|
260
|
+
to be next up (currently .shoji-slide, coincidentally the same size —
|
|
261
|
+
explicit here so that stays true even if that ever changes). */
|
|
262
|
+
position: relative;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.shoji-slide-img,
|
|
266
|
+
.shoji-slide-video {
|
|
267
|
+
display: block;
|
|
268
|
+
max-width: 100%;
|
|
269
|
+
max-height: 100%;
|
|
270
|
+
object-fit: contain;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* max-width/max-height above only ever *cap* size — a real photo is normally
|
|
274
|
+
bigger than the slide area, so that's correct. A low-res open() placeholder
|
|
275
|
+
(§2.3) is the opposite case: deliberately small, so it needs to be forced
|
|
276
|
+
up to fill the frame (blurry, on purpose) instead of rendering at its own
|
|
277
|
+
tiny natural size. object-fit: contain (inherited above) still letterboxes
|
|
278
|
+
it within that forced box, just per the thumbnail's own aspect ratio. */
|
|
279
|
+
.shoji-slide-open-placeholder {
|
|
280
|
+
width: 100%;
|
|
281
|
+
height: 100%;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* DESIGN.md §4-video — a provider's embed (an <iframe>, typically) has no
|
|
285
|
+
natural size Shoji can measure the way a decoded image/video does, so
|
|
286
|
+
this just fills whatever box it's given; supply item.width/height for a
|
|
287
|
+
correctly-shaped box (applyAspect() sets aspect-ratio on the slide-media
|
|
288
|
+
container itself from those), same as any other slide. */
|
|
289
|
+
.shoji-slide-provider-video {
|
|
290
|
+
width: 100%;
|
|
291
|
+
height: 100%;
|
|
292
|
+
box-sizing: border-box;
|
|
293
|
+
padding-top: var(--shoji-provider-video-top-inset);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.shoji-slide-provider-video[hidden] {
|
|
297
|
+
display: none;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.shoji-slide-provider-video iframe {
|
|
301
|
+
display: block;
|
|
302
|
+
width: 100%;
|
|
303
|
+
height: 100%;
|
|
304
|
+
border: 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* A paused video's own play affordance — native browser styling for this
|
|
308
|
+
varies too much to rely on alone (some show a big centered play icon,
|
|
309
|
+
some don't). Faint/translucent, same visual language as the toolbar's
|
|
310
|
+
own round icon buttons, just bigger — a primary, hard-to-miss affordance,
|
|
311
|
+
not a small chrome control. Deliberately not gated by any GalleryOptions
|
|
312
|
+
flag (purely presentational — hiding it changes nothing functionally,
|
|
313
|
+
the video is still clickable either way); a host not wanting it just
|
|
314
|
+
overrides this selector in their own CSS. */
|
|
315
|
+
.shoji-video-play-overlay {
|
|
316
|
+
position: absolute;
|
|
317
|
+
top: 50%;
|
|
318
|
+
left: 50%;
|
|
319
|
+
transform: translate(-50%, -50%);
|
|
320
|
+
width: var(--shoji-video-overlay-size, 64px);
|
|
321
|
+
height: var(--shoji-video-overlay-size, 64px);
|
|
322
|
+
border-radius: 50%;
|
|
323
|
+
border: none;
|
|
324
|
+
padding: 0;
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
justify-content: center;
|
|
328
|
+
background: var(--shoji-video-overlay-bg, rgba(0, 0, 0, 0.4));
|
|
329
|
+
color: var(--shoji-video-overlay-color, var(--shoji-color-fg));
|
|
330
|
+
cursor: pointer;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.shoji-video-play-overlay[hidden] {
|
|
334
|
+
display: none;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/* DESIGN.md §2.5 — the temporary clone SlideTransition animates the
|
|
338
|
+
outgoing slide's content out on. Sits above the normal (unpositioned
|
|
339
|
+
z-index) pool slots by DOM order alone, but z-index is set explicitly
|
|
340
|
+
here rather than relied on implicitly, matching how every other overlay
|
|
341
|
+
layer in this file states its stacking intent up front. Not interactive
|
|
342
|
+
(it's a decorative clone mid-removal) and never receives its own size —
|
|
343
|
+
it fills `.shoji-slides` exactly like the real `.shoji-slide` it's a
|
|
344
|
+
snapshot of, so the cloned `.shoji-slide-media` inside it (already
|
|
345
|
+
`width/height: 100%`) lines up pixel-for-pixel with no extra CSS needed. */
|
|
346
|
+
.shoji-slide-ghost {
|
|
347
|
+
position: absolute;
|
|
348
|
+
inset: 0;
|
|
349
|
+
z-index: 1;
|
|
350
|
+
pointer-events: none;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.shoji-slide-placeholder {
|
|
354
|
+
color: var(--shoji-color-disabled);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* DESIGN.md §2.3 — shown in place of a slide's content while it's still
|
|
358
|
+
decoding/loading (outside the `preload` window, where nothing was ready
|
|
359
|
+
ahead of time). CSS-only rotation (no JS-driven layout, per CLAUDE.md);
|
|
360
|
+
disabled under prefers-reduced-motion the same as every other animation
|
|
361
|
+
here, rather than left spinning regardless. */
|
|
362
|
+
.shoji-slide-spinner {
|
|
363
|
+
width: var(--shoji-spinner-size, 40px);
|
|
364
|
+
height: var(--shoji-spinner-size, 40px);
|
|
365
|
+
border-radius: 50%;
|
|
366
|
+
border: var(--shoji-spinner-thickness, 3px) solid var(--shoji-color-disabled);
|
|
367
|
+
border-top-color: var(--shoji-color-accent);
|
|
368
|
+
animation: shoji-spin 0.8s linear infinite;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@keyframes shoji-spin {
|
|
372
|
+
to {
|
|
373
|
+
transform: rotate(360deg);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@media (prefers-reduced-motion: reduce) {
|
|
378
|
+
.shoji-slide-spinner {
|
|
379
|
+
animation: none;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* A normal flex item within .shoji-toolbar-left (not independently
|
|
384
|
+
positioned) — .shoji-slides still gets the full dialog height either way,
|
|
385
|
+
no reserved gutter at top or bottom, since the toolbar itself overlays the
|
|
386
|
+
slides rather than pushing them down. Flowing alongside whatever else is
|
|
387
|
+
in that slot (e.g. a plugin's ctx.ui.toolbar('left', ...) button) keeps it
|
|
388
|
+
from overlapping and stealing clicks the way independent absolute
|
|
389
|
+
positioning did. */
|
|
390
|
+
.shoji-counter {
|
|
391
|
+
padding: 0.25rem 0.6rem;
|
|
392
|
+
border-radius: 999px;
|
|
393
|
+
background: rgba(0, 0, 0, 0.4);
|
|
394
|
+
font-size: 0.875rem;
|
|
395
|
+
white-space: nowrap;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.shoji-counter[hidden] {
|
|
399
|
+
display: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.shoji-caption {
|
|
403
|
+
position: absolute;
|
|
404
|
+
bottom: var(--shoji-spacing-md);
|
|
405
|
+
left: var(--shoji-spacing-md);
|
|
406
|
+
z-index: var(--shoji-z-toolbar);
|
|
407
|
+
width: fit-content;
|
|
408
|
+
max-width: calc(100% - 2 * var(--shoji-spacing-md));
|
|
409
|
+
max-height: var(--shoji-caption-max-height);
|
|
410
|
+
overflow-y: auto;
|
|
411
|
+
overscroll-behavior: contain;
|
|
412
|
+
padding: var(--shoji-spacing-sm) var(--shoji-spacing-md);
|
|
413
|
+
border-radius: 8px;
|
|
414
|
+
background: var(--shoji-color-toolbar-bg);
|
|
415
|
+
text-align: left;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/* A real bug: height-capping the caption (above) still isn't enough on its
|
|
419
|
+
own — a video that fills most of the dialog leaves little to no
|
|
420
|
+
letterboxing gap, so even a short caption's opaque background can land
|
|
421
|
+
directly on the native control bar underneath it (same corner). Letting
|
|
422
|
+
clicks pass straight through the caption on a video slide (Gallery.ts
|
|
423
|
+
toggles this class from `item.video`, HTML5 or a provider like YouTube
|
|
424
|
+
alike) is what actually guarantees the controls stay reachable, not just
|
|
425
|
+
"usually clear of them." Re-enabled on any real child element so a rich
|
|
426
|
+
HTML caption's own links/buttons (DESIGN.md §2.1) stay clickable — only
|
|
427
|
+
a plain-string caption (no element children at all) ever fully passes
|
|
428
|
+
through. Photo slides are untouched: nothing below them needs protecting,
|
|
429
|
+
so the caption keeps its normal scrollable/selectable behavior there. */
|
|
430
|
+
.shoji-caption--video {
|
|
431
|
+
pointer-events: none;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.shoji-caption--video > * {
|
|
435
|
+
pointer-events: auto;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.shoji-caption[hidden] {
|
|
439
|
+
display: none;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/* DESIGN.md §2.8 — idle auto-hide. Opacity only, never display:none, never
|
|
443
|
+
removed from the tab order: a hidden-but-focused control stays interactive,
|
|
444
|
+
just visually faded (see Gallery's isControlFocused() guard). */
|
|
445
|
+
.shoji-toolbar,
|
|
446
|
+
.shoji-nav,
|
|
447
|
+
.shoji-counter,
|
|
448
|
+
.shoji-caption {
|
|
449
|
+
transition: opacity var(--shoji-duration) var(--shoji-easing);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.shoji-controls-hidden .shoji-toolbar,
|
|
453
|
+
.shoji-controls-hidden .shoji-nav,
|
|
454
|
+
.shoji-controls-hidden .shoji-counter,
|
|
455
|
+
.shoji-controls-hidden .shoji-caption {
|
|
456
|
+
opacity: 0;
|
|
457
|
+
pointer-events: none;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/* !important: wins over any plugin's own cursor styling (e.g. zoom.css's
|
|
461
|
+
zoom-in/grab affordances) without core needing to know that plugin's
|
|
462
|
+
selectors — the hidden state means nothing should suggest interactivity. */
|
|
463
|
+
.shoji-controls-hidden,
|
|
464
|
+
.shoji-controls-hidden * {
|
|
465
|
+
cursor: none !important;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.shoji-live-region {
|
|
469
|
+
position: absolute;
|
|
470
|
+
width: 1px;
|
|
471
|
+
height: 1px;
|
|
472
|
+
overflow: hidden;
|
|
473
|
+
clip: rect(0 0 0 0);
|
|
474
|
+
white-space: nowrap;
|
|
475
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Gallery } from './core';
|
|
2
|
+
export type { GalleryItem, GalleryOptions, GalleryEvents, MediaSource, VideoDescriptor, Unsubscribe, } from './core';
|
|
3
|
+
export type { ShojiPlugin, PluginContext, VideoProviderRenderer } from './core/plugin';
|
|
4
|
+
/**
|
|
5
|
+
* `new Shoji(el, options)` — the UMD global (CLAUDE.md: "UMD build exposes
|
|
6
|
+
* exactly one global"). The default export *is* the constructor, not a
|
|
7
|
+
* namespace object, so `<script src="shoji.js">` usage matches the default
|
|
8
|
+
* import used by bundler/ESM consumers. Headless/tree-shaking consumers who
|
|
9
|
+
* want the class as a named import can pull it from the `shoji/core`
|
|
10
|
+
* subpath instead.
|
|
11
|
+
*
|
|
12
|
+
* Official plugins are attached as static properties (`Shoji.Autoplay`) so
|
|
13
|
+
* the single-file build stays "one global" (CLAUDE.md) while still shipping
|
|
14
|
+
* every official plugin's code — self-registering, no extra <script> tags —
|
|
15
|
+
* per CLAUDE.md's single-file distribution requirement. A host opts a
|
|
16
|
+
* gallery into one with `new Shoji(el, { plugins: [Shoji.Autoplay] })`.
|
|
17
|
+
* Bundler users who only want to pull in specific plugins' code (tree-shaking
|
|
18
|
+
* this static attachment away) should import from the `shoji/plugins/*`
|
|
19
|
+
* subpath instead of this default export.
|
|
20
|
+
*/
|
|
21
|
+
declare const Shoji: typeof Gallery & {
|
|
22
|
+
Autoplay: import('./core').ShojiPlugin;
|
|
23
|
+
Layout: import('./core').ShojiPlugin;
|
|
24
|
+
ActiveThumbnail: import('./core').ShojiPlugin;
|
|
25
|
+
Fullscreen: import('./core').ShojiPlugin;
|
|
26
|
+
RotateFlip: import('./core').ShojiPlugin;
|
|
27
|
+
Video: import('./core').ShojiPlugin;
|
|
28
|
+
Zoom: import('./core').ShojiPlugin;
|
|
29
|
+
/** `package.json`'s own version — the single source of truth, read via a named JSON import so a bundler can tree-shake away everything else in package.json (devDependencies, scripts, ...) rather than embedding the whole file. */
|
|
30
|
+
version: string;
|
|
31
|
+
};
|
|
32
|
+
export default Shoji;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Gallery } from "./core/index.js";
|
|
2
|
+
import { ActiveThumbnail } from "./plugins/activeThumbnail/index.js";
|
|
3
|
+
import { Autoplay } from "./plugins/autoplay/index.js";
|
|
4
|
+
import { Fullscreen } from "./plugins/fullscreen/index.js";
|
|
5
|
+
import { Layout } from "./plugins/layout/index.js";
|
|
6
|
+
import { RotateFlip } from "./plugins/rotateFlip/index.js";
|
|
7
|
+
import { Video } from "./plugins/video/index.js";
|
|
8
|
+
import { Zoom } from "./plugins/zoom/index.js";
|
|
9
|
+
const version = "0.1.0-alpha.6";
|
|
10
|
+
const Shoji = Object.assign(Gallery, {
|
|
11
|
+
Autoplay,
|
|
12
|
+
Layout,
|
|
13
|
+
ActiveThumbnail,
|
|
14
|
+
Fullscreen,
|
|
15
|
+
RotateFlip,
|
|
16
|
+
Video,
|
|
17
|
+
Zoom,
|
|
18
|
+
/** `package.json`'s own version — the single source of truth, read via a named JSON import so a bundler can tree-shake away everything else in package.json (devDependencies, scripts, ...) rather than embedding the whole file. */
|
|
19
|
+
version
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
Shoji as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { Gallery } from './core';\nimport { ActiveThumbnail } from './plugins/activeThumbnail';\nimport { Autoplay } from './plugins/autoplay';\nimport { Fullscreen } from './plugins/fullscreen';\nimport { Layout } from './plugins/layout';\nimport { RotateFlip } from './plugins/rotateFlip';\nimport { Video } from './plugins/video';\nimport { Zoom } from './plugins/zoom';\nimport { version } from '../package.json';\n\nimport './styles/shoji.css';\n\nexport type {\n GalleryItem,\n GalleryOptions,\n GalleryEvents,\n MediaSource,\n VideoDescriptor,\n Unsubscribe,\n} from './core';\nexport type { ShojiPlugin, PluginContext, VideoProviderRenderer } from './core/plugin';\n\n/**\n * `new Shoji(el, options)` — the UMD global (CLAUDE.md: \"UMD build exposes\n * exactly one global\"). The default export *is* the constructor, not a\n * namespace object, so `<script src=\"shoji.js\">` usage matches the default\n * import used by bundler/ESM consumers. Headless/tree-shaking consumers who\n * want the class as a named import can pull it from the `shoji/core`\n * subpath instead.\n *\n * Official plugins are attached as static properties (`Shoji.Autoplay`) so\n * the single-file build stays \"one global\" (CLAUDE.md) while still shipping\n * every official plugin's code — self-registering, no extra <script> tags —\n * per CLAUDE.md's single-file distribution requirement. A host opts a\n * gallery into one with `new Shoji(el, { plugins: [Shoji.Autoplay] })`.\n * Bundler users who only want to pull in specific plugins' code (tree-shaking\n * this static attachment away) should import from the `shoji/plugins/*`\n * subpath instead of this default export.\n */\nconst Shoji = Object.assign(Gallery, {\n Autoplay,\n Layout,\n ActiveThumbnail,\n Fullscreen,\n RotateFlip,\n Video,\n Zoom,\n /** `package.json`'s own version — the single source of truth, read via a named JSON import so a bundler can tree-shake away everything else in package.json (devDependencies, scripts, ...) rather than embedding the whole file. */\n version,\n});\n\nexport default Shoji;\n"],"names":[],"mappings":";;;;;;;;;AAuCA,MAAM,QAAQ,OAAO,OAAO,SAAS;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AACF,CAAC;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* DESIGN.md §4-autoplay — thin progress bar along the bottom edge, tracking
|
|
2
|
+
time-to-next-advance for timed (image) slides. Hidden during video slides,
|
|
3
|
+
where the video's own runtime — not a fixed interval — drives advancement. */
|
|
4
|
+
.shoji-autoplay-progress {
|
|
5
|
+
position: absolute;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
height: 3px;
|
|
10
|
+
background: rgba(255, 255, 255, 0.15);
|
|
11
|
+
z-index: var(--shoji-z-toolbar);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.shoji-autoplay-progress[hidden] {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.shoji-autoplay-progress-bar {
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 0%;
|
|
21
|
+
background: var(--shoji-progress);
|
|
22
|
+
}
|