next-flipbook 2.0.0 → 2.2.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/README.md +5 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/types.d.ts +14 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/ui/UiStore.d.ts +3 -0
- package/dist/core/ui/UiStore.d.ts.map +1 -1
- package/dist/core/ui/UiStore.js +5 -1
- package/dist/core/ui/UiStore.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/components/FlipBook.d.ts.map +1 -1
- package/dist/react/components/FlipBook.js +72 -9
- package/dist/react/components/FlipBook.js.map +1 -1
- package/dist/react/components/FlipBookBackgroundControl.d.ts +3 -1
- package/dist/react/components/FlipBookBackgroundControl.d.ts.map +1 -1
- package/dist/react/components/FlipBookBackgroundControl.js +2 -2
- package/dist/react/components/FlipBookBackgroundControl.js.map +1 -1
- package/dist/react/components/FlipBookControls.d.ts +2 -0
- package/dist/react/components/FlipBookControls.d.ts.map +1 -1
- package/dist/react/components/FlipBookControls.js +24 -1
- package/dist/react/components/FlipBookControls.js.map +1 -1
- package/dist/react/components/FlipBookDock.d.ts +14 -0
- package/dist/react/components/FlipBookDock.d.ts.map +1 -0
- package/dist/react/components/FlipBookDock.js +167 -0
- package/dist/react/components/FlipBookDock.js.map +1 -0
- package/dist/react/components/FlipBookEdgeArrows.d.ts +6 -0
- package/dist/react/components/FlipBookEdgeArrows.d.ts.map +1 -0
- package/dist/react/components/FlipBookEdgeArrows.js +34 -0
- package/dist/react/components/FlipBookEdgeArrows.js.map +1 -0
- package/dist/react/components/FlipBookHeader.d.ts +14 -0
- package/dist/react/components/FlipBookHeader.d.ts.map +1 -0
- package/dist/react/components/FlipBookHeader.js +61 -0
- package/dist/react/components/FlipBookHeader.js.map +1 -0
- package/dist/react/components/FlipBookMoreMenu.d.ts +13 -0
- package/dist/react/components/FlipBookMoreMenu.d.ts.map +1 -0
- package/dist/react/components/FlipBookMoreMenu.js +125 -0
- package/dist/react/components/FlipBookMoreMenu.js.map +1 -0
- package/dist/react/components/FlipBookRail.d.ts +10 -0
- package/dist/react/components/FlipBookRail.d.ts.map +1 -0
- package/dist/react/components/FlipBookRail.js +65 -0
- package/dist/react/components/FlipBookRail.js.map +1 -0
- package/dist/react/components/FlipBookSidePanel.d.ts +11 -3
- package/dist/react/components/FlipBookSidePanel.d.ts.map +1 -1
- package/dist/react/components/FlipBookSidePanel.js +41 -25
- package/dist/react/components/FlipBookSidePanel.js.map +1 -1
- package/dist/react/components/FlipBookStage.d.ts.map +1 -1
- package/dist/react/components/FlipBookStage.js +1 -1
- package/dist/react/components/FlipBookStage.js.map +1 -1
- package/dist/react/components/FlipBookToolbar.d.ts +6 -1
- package/dist/react/components/FlipBookToolbar.d.ts.map +1 -1
- package/dist/react/components/FlipBookToolbar.js +16 -18
- package/dist/react/components/FlipBookToolbar.js.map +1 -1
- package/dist/react/components/FlipBookToolbarButton.d.ts +3 -1
- package/dist/react/components/FlipBookToolbarButton.d.ts.map +1 -1
- package/dist/react/components/FlipBookToolbarButton.js +10 -8
- package/dist/react/components/FlipBookToolbarButton.js.map +1 -1
- package/dist/react/components/FlipBookTour.d.ts +16 -0
- package/dist/react/components/FlipBookTour.d.ts.map +1 -0
- package/dist/react/components/FlipBookTour.js +257 -0
- package/dist/react/components/FlipBookTour.js.map +1 -0
- package/dist/react/components/PasswordDialog.js +1 -1
- package/dist/react/components/PasswordDialog.js.map +1 -1
- package/dist/react/controller.d.ts.map +1 -1
- package/dist/react/controller.js +5 -0
- package/dist/react/controller.js.map +1 -1
- package/dist/react/icons.d.ts +1 -1
- package/dist/react/icons.d.ts.map +1 -1
- package/dist/react/icons.js +3 -0
- package/dist/react/icons.js.map +1 -1
- package/dist/react/index.d.ts +11 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/locale.d.ts.map +1 -1
- package/dist/react/locale.js +31 -0
- package/dist/react/locale.js.map +1 -1
- package/dist/react/studioStyles.d.ts +14 -0
- package/dist/react/studioStyles.d.ts.map +1 -0
- package/dist/react/studioStyles.js +26 -0
- package/dist/react/studioStyles.js.map +1 -0
- package/dist/react/theme.d.ts +10 -3
- package/dist/react/theme.d.ts.map +1 -1
- package/dist/react/theme.js +117 -0
- package/dist/react/theme.js.map +1 -1
- package/dist/react/tutorialStorage.d.ts +8 -0
- package/dist/react/tutorialStorage.d.ts.map +1 -0
- package/dist/react/tutorialStorage.js +38 -0
- package/dist/react/tutorialStorage.js.map +1 -0
- package/dist/styles.css +419 -0
- package/dist/types/index.d.ts +129 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -85,3 +85,422 @@
|
|
|
85
85
|
transition: none;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* The anime themes (theme="anime", theme="anime-night", and any theme object that starts from one).
|
|
91
|
+
*
|
|
92
|
+
* The tokens give the colours, the round floating toolbar, the page outlines and the font. This is
|
|
93
|
+
* the finish that tokens cannot give: outlined buttons that lift on hover and press in, an "on"
|
|
94
|
+
* state you can see without colour, dashed disabled buttons, a counter you can find at a glance, a
|
|
95
|
+
* toolbar split into capsules, tabs and thumbnails as stickers. It reads the tokens, so a changed
|
|
96
|
+
* `accent` or `toolbarColor` recolours all of it. Inline styles win over a stylesheet, so a few
|
|
97
|
+
* rules say !important, as the thumbnail rules above do.
|
|
98
|
+
*/
|
|
99
|
+
.flipbook-root[data-flipbook-theme^="anime"] {
|
|
100
|
+
--anime-ink: var(--flipbook-toolbar-color, #2b2455);
|
|
101
|
+
--anime-tint: color-mix(in srgb, var(--flipbook-accent, #c8206f) 16%, transparent);
|
|
102
|
+
--anime-hover: color-mix(in srgb, var(--flipbook-accent, #c8206f) 8%, transparent);
|
|
103
|
+
--anime-line: color-mix(in srgb, var(--flipbook-toolbar-color, #2b2455) 30%, transparent);
|
|
104
|
+
--anime-pressed: var(--flipbook-button-pressed-background, #ffc9e1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* The bar is split into capsules (navigation, zoom, actions) so that the groups read as groups. */
|
|
108
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-toolbar] > div,
|
|
109
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-controls] > div {
|
|
110
|
+
padding: 3px 6px;
|
|
111
|
+
border-radius: 20px;
|
|
112
|
+
background: color-mix(in srgb, var(--anime-ink) 6%, transparent);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Where am I: the page counter is the one number a reader looks for, so it is a badge. */
|
|
116
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-counter] {
|
|
117
|
+
min-width: 6ch;
|
|
118
|
+
padding: 7px 14px;
|
|
119
|
+
border: 2px solid var(--anime-ink);
|
|
120
|
+
border-radius: 999px;
|
|
121
|
+
background: color-mix(in srgb, var(--flipbook-accent, #c8206f) 20%, var(--flipbook-toolbar-background, #fffaf6));
|
|
122
|
+
box-shadow: 0 2px 0 var(--anime-ink);
|
|
123
|
+
font-weight: 800;
|
|
124
|
+
letter-spacing: 0.02em;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Buttons: an outline that appears on hover, a lift, and a press. */
|
|
128
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button] {
|
|
129
|
+
border: 2px solid transparent !important;
|
|
130
|
+
font-weight: 700;
|
|
131
|
+
transition:
|
|
132
|
+
transform 120ms ease,
|
|
133
|
+
background-color 120ms ease,
|
|
134
|
+
border-color 120ms ease,
|
|
135
|
+
box-shadow 120ms ease;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* Hover is an outline and a faint tint. "On" (below) is a solid fill with a shadow, so the two never
|
|
140
|
+
* look alike. Only where there is a pointer that can hover: on a touch screen :hover sticks to the
|
|
141
|
+
* button that was just tapped, and a tapped button would look as if it were switched on.
|
|
142
|
+
*/
|
|
143
|
+
@media (hover: hover) {
|
|
144
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button]:hover:not([aria-disabled="true"]) {
|
|
145
|
+
border-color: var(--anime-ink) !important;
|
|
146
|
+
background: var(--anime-hover) !important;
|
|
147
|
+
transform: translateY(-1px);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button]:active:not([aria-disabled="true"]) {
|
|
152
|
+
transform: translateY(1px);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* On: a filled, outlined, shadowed button. It differs from "off" in shape as well as in colour. */
|
|
156
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button][aria-pressed="true"],
|
|
157
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button][aria-pressed="true"]:hover:not([aria-disabled="true"]) {
|
|
158
|
+
border-color: var(--anime-ink) !important;
|
|
159
|
+
background: var(--anime-pressed) !important;
|
|
160
|
+
box-shadow: 0 2px 0 var(--anime-ink);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Off and unavailable: dashed and faint, so that "greyed out" is not only a lower opacity. */
|
|
164
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button][aria-disabled="true"] {
|
|
165
|
+
border-style: dashed !important;
|
|
166
|
+
border-color: var(--anime-line) !important;
|
|
167
|
+
opacity: 0.55 !important;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Focus: a thick ring that is never the colour of the thing it is round. */
|
|
171
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button]:focus-visible,
|
|
172
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb]:focus-visible,
|
|
173
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="tab"]:focus-visible,
|
|
174
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-result]:focus-visible,
|
|
175
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-search-input]:focus-visible {
|
|
176
|
+
outline: 3px solid var(--anime-ink);
|
|
177
|
+
outline-offset: 2px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button-label] {
|
|
181
|
+
letter-spacing: 0.01em;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* The side panel is a card, and a sheet on a narrow screen. */
|
|
185
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-panel="sidebar"] {
|
|
186
|
+
margin-block: 10px;
|
|
187
|
+
margin-inline-start: 10px;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
border: 2.5px solid var(--anime-ink) !important;
|
|
190
|
+
border-radius: 20px;
|
|
191
|
+
box-shadow: 0 4px 0 var(--anime-ink) !important;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-panel="sheet"] {
|
|
195
|
+
border: 2.5px solid var(--anime-ink) !important;
|
|
196
|
+
border-bottom: 0 !important;
|
|
197
|
+
border-radius: 22px 22px 0 0 !important;
|
|
198
|
+
box-shadow: 0 -4px 0 var(--anime-ink) !important;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="tablist"] {
|
|
202
|
+
padding: 3px !important;
|
|
203
|
+
border-radius: 999px !important;
|
|
204
|
+
background: var(--anime-tint) !important;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="tab"] {
|
|
208
|
+
padding-inline: 8px !important;
|
|
209
|
+
border: 2px solid transparent !important;
|
|
210
|
+
border-radius: 999px !important;
|
|
211
|
+
font-weight: 700 !important;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="tab"][aria-selected="true"] {
|
|
215
|
+
border-color: var(--anime-ink) !important;
|
|
216
|
+
background: var(--anime-pressed) !important;
|
|
217
|
+
/* The text of the tab that is open sits on the "on" fill, so it takes the "on" text colour (the night theme's fill is pink and its text is dark). */
|
|
218
|
+
color: var(--flipbook-button-pressed-color, inherit) !important;
|
|
219
|
+
box-shadow: 0 2px 0 var(--anime-ink) !important;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@media (hover: hover) {
|
|
223
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="tab"]:hover:not([aria-selected="true"]) {
|
|
224
|
+
background: var(--anime-hover) !important;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Thumbnails are stickers: an outlined card, an outlined page with a hard shadow, the open one in the accent. */
|
|
229
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb] {
|
|
230
|
+
border: 2px solid transparent !important;
|
|
231
|
+
border-radius: 16px !important;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@media (hover: hover) {
|
|
235
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb]:hover:not([aria-current="page"]) {
|
|
236
|
+
border-color: var(--anime-line) !important;
|
|
237
|
+
background: var(--anime-hover) !important;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb][aria-current="page"] {
|
|
242
|
+
border-color: var(--anime-ink) !important;
|
|
243
|
+
background: color-mix(in srgb, var(--flipbook-accent, #c8206f) 20%, transparent) !important;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb] > span:first-child {
|
|
247
|
+
border-radius: 6px !important;
|
|
248
|
+
box-shadow:
|
|
249
|
+
0 0 0 2px var(--anime-ink),
|
|
250
|
+
2px 3px 0 2px var(--anime-line) !important;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb][aria-current="page"] > span:first-child {
|
|
254
|
+
box-shadow:
|
|
255
|
+
0 0 0 2px var(--anime-ink),
|
|
256
|
+
3px 4px 0 2px var(--flipbook-accent, #c8206f) !important;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb] > span:last-child {
|
|
260
|
+
font-weight: 800 !important;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* Search. */
|
|
264
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-search-input] {
|
|
265
|
+
padding: 8px 14px !important;
|
|
266
|
+
border: 2px solid var(--anime-ink) !important;
|
|
267
|
+
border-radius: 999px !important;
|
|
268
|
+
font-weight: 600 !important;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* The browser's own "clear" cross in the ink colour, so that it is as easy to see as the rest. */
|
|
272
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-search-input]::-webkit-search-cancel-button {
|
|
273
|
+
width: 14px;
|
|
274
|
+
height: 14px;
|
|
275
|
+
-webkit-appearance: none;
|
|
276
|
+
appearance: none;
|
|
277
|
+
background: var(--anime-ink);
|
|
278
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 2.5l9 9m0-9l-9 9' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
279
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 2.5l9 9m0-9l-9 9' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-result] {
|
|
284
|
+
border-radius: 14px !important;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-result][aria-current="true"] {
|
|
288
|
+
background: var(--anime-pressed) !important;
|
|
289
|
+
box-shadow: inset 0 0 0 2px var(--anime-ink);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.flipbook-root[data-flipbook-theme^="anime"] mark {
|
|
293
|
+
padding: 0 3px;
|
|
294
|
+
border-radius: 4px !important;
|
|
295
|
+
background: #ffe27a !important;
|
|
296
|
+
color: #2b2455 !important;
|
|
297
|
+
box-shadow: 0 0 0 1px #2b2455;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* A notice is a sticker too: inked, with a star. The star is decoration, so it has no text alternative. */
|
|
301
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-notice] {
|
|
302
|
+
padding: 9px 18px !important;
|
|
303
|
+
border: 2px solid var(--anime-ink);
|
|
304
|
+
background: var(--anime-ink) !important;
|
|
305
|
+
color: var(--flipbook-toolbar-background, #fffaf6) !important;
|
|
306
|
+
box-shadow: 0 3px 0 color-mix(in srgb, var(--anime-ink) 35%, transparent);
|
|
307
|
+
font-weight: 700 !important;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-notice]::before {
|
|
311
|
+
content: "\2726";
|
|
312
|
+
content: "\2726" / "";
|
|
313
|
+
margin-inline-end: 8px;
|
|
314
|
+
color: color-mix(in srgb, var(--flipbook-accent, #c8206f) 45%, white);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* The password dialog and the hotspot popover. */
|
|
318
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="dialog"] {
|
|
319
|
+
border: 2.5px solid var(--anime-ink);
|
|
320
|
+
border-radius: 22px !important;
|
|
321
|
+
box-shadow: 0 5px 0 var(--anime-ink) !important;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="dialog"] input {
|
|
325
|
+
border: 2px solid var(--anime-ink) !important;
|
|
326
|
+
border-radius: 14px !important;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="dialog"] button {
|
|
330
|
+
border: 2px solid var(--anime-ink) !important;
|
|
331
|
+
border-radius: 999px !important;
|
|
332
|
+
font-weight: 700;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/*
|
|
336
|
+
* A narrow container (under 420 px, `data-flipbook-narrow`): the same toolbar with less air in it, and
|
|
337
|
+
* 40 px buttons instead of 44, so that previous / counter / next and the zoom buttons share a row, and
|
|
338
|
+
* all seven actions fit one row, on a phone as narrow as 360 px, where 44 px would need a third row
|
|
339
|
+
* (about 50 px of a short screen). 40 px is still far above the 24 px that WCAG 2.2 AA asks for.
|
|
340
|
+
* Inline styles set the bar's margin, padding and gap, hence !important.
|
|
341
|
+
*/
|
|
342
|
+
.flipbook-root[data-flipbook-theme^="anime"][data-flipbook-narrow] {
|
|
343
|
+
--flipbook-bar-margin: 6px 6px 8px !important;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.flipbook-root[data-flipbook-theme^="anime"][data-flipbook-narrow] [data-flipbook-toolbar] {
|
|
347
|
+
--flipbook-button-size: 40px;
|
|
348
|
+
column-gap: 6px !important;
|
|
349
|
+
padding-inline: 6px !important;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.flipbook-root[data-flipbook-theme^="anime"][data-flipbook-narrow] [data-flipbook-toolbar] > div,
|
|
353
|
+
.flipbook-root[data-flipbook-theme^="anime"][data-flipbook-narrow] [data-flipbook-controls] > div {
|
|
354
|
+
gap: 0 !important;
|
|
355
|
+
padding: 2px 3px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.flipbook-root[data-flipbook-theme^="anime"][data-flipbook-narrow] [data-flipbook-counter] {
|
|
359
|
+
min-width: 0 !important;
|
|
360
|
+
padding: 6px 7px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* The zoom percentage ("100%") is the one button wider than it is tall; it only needs room for its digits. */
|
|
364
|
+
.flipbook-root[data-flipbook-theme^="anime"][data-flipbook-narrow] [data-flipbook-fit] {
|
|
365
|
+
min-width: 4ch !important;
|
|
366
|
+
padding-inline: 2px !important;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/*
|
|
370
|
+
* Forced colours (Windows "contrast themes"): shadows and tints are dropped, so the "on" state that
|
|
371
|
+
* is a fill and a shadow would vanish. Say it in the system's own colours instead.
|
|
372
|
+
*/
|
|
373
|
+
@media (forced-colors: active) {
|
|
374
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button][aria-pressed="true"],
|
|
375
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button][aria-pressed="true"]:hover:not([aria-disabled="true"]),
|
|
376
|
+
.flipbook-root[data-flipbook-theme^="anime"] [role="tab"][aria-selected="true"],
|
|
377
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-thumb][aria-current="page"],
|
|
378
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-result][aria-current="true"] {
|
|
379
|
+
forced-color-adjust: none;
|
|
380
|
+
border-color: Highlight !important;
|
|
381
|
+
background: Highlight !important;
|
|
382
|
+
color: HighlightText !important;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
@media (prefers-reduced-motion: reduce) {
|
|
387
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button] {
|
|
388
|
+
transition: none;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button]:hover:not([aria-disabled="true"]),
|
|
392
|
+
.flipbook-root[data-flipbook-theme^="anime"] [data-flipbook-button]:active:not([aria-disabled="true"]) {
|
|
393
|
+
transform: none;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/*
|
|
398
|
+
* The studio layout (layout="studio"). Everything here only makes it nicer: without this file the
|
|
399
|
+
* viewer works, with the browser's own slider and plain buttons.
|
|
400
|
+
*/
|
|
401
|
+
.flipbook-root [data-flipbook-rail-button]:hover:not([aria-pressed="true"]),
|
|
402
|
+
.flipbook-root [data-flipbook-search-launcher]:hover,
|
|
403
|
+
.flipbook-root [data-flipbook-menu] [role="menuitem"]:hover:not([aria-disabled="true"]),
|
|
404
|
+
.flipbook-root [data-flipbook-edge]:hover:not(:disabled) {
|
|
405
|
+
background: rgba(127, 127, 127, 0.2) !important;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.flipbook-root [data-flipbook-rail-button]:focus-visible,
|
|
409
|
+
.flipbook-root [data-flipbook-search-launcher]:focus-visible,
|
|
410
|
+
.flipbook-root [data-flipbook-menu] [role="menuitem"]:focus-visible,
|
|
411
|
+
.flipbook-root [data-flipbook-page-field]:focus-visible,
|
|
412
|
+
.flipbook-root [data-flipbook-scrubber]:focus-visible,
|
|
413
|
+
.flipbook-root [data-flipbook-tour-card] button:focus-visible {
|
|
414
|
+
outline: 2px solid var(--flipbook-focus, var(--flipbook-accent, #2563eb));
|
|
415
|
+
outline-offset: 2px;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.flipbook-root [data-flipbook-edge]:disabled {
|
|
419
|
+
opacity: 0.35;
|
|
420
|
+
cursor: default;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* The page slider: a track that fills with the accent up to the thumb, and a round thumb. */
|
|
424
|
+
.flipbook-root [data-flipbook-scrubber] {
|
|
425
|
+
-webkit-appearance: none;
|
|
426
|
+
appearance: none;
|
|
427
|
+
background: transparent;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.flipbook-root [data-flipbook-scrubber]::-webkit-slider-runnable-track {
|
|
431
|
+
height: 6px;
|
|
432
|
+
border-radius: 999px;
|
|
433
|
+
background: linear-gradient(
|
|
434
|
+
to right,
|
|
435
|
+
var(--flipbook-accent, #2563eb) var(--flipbook-scrub, 0%),
|
|
436
|
+
rgba(127, 127, 127, 0.4) var(--flipbook-scrub, 0%)
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.flipbook-root [data-flipbook-scrubber]::-webkit-slider-thumb {
|
|
441
|
+
-webkit-appearance: none;
|
|
442
|
+
appearance: none;
|
|
443
|
+
width: 18px;
|
|
444
|
+
height: 18px;
|
|
445
|
+
margin-top: -6px;
|
|
446
|
+
border-radius: 50%;
|
|
447
|
+
border: 2px solid var(--flipbook-accent, #2563eb);
|
|
448
|
+
background: var(--flipbook-toolbar-color, #1f2328);
|
|
449
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.flipbook-root [data-flipbook-scrubber]::-moz-range-track {
|
|
453
|
+
height: 6px;
|
|
454
|
+
border-radius: 999px;
|
|
455
|
+
background: rgba(127, 127, 127, 0.4);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.flipbook-root [data-flipbook-scrubber]::-moz-range-progress {
|
|
459
|
+
height: 6px;
|
|
460
|
+
border-radius: 999px;
|
|
461
|
+
background: var(--flipbook-accent, #2563eb);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.flipbook-root [data-flipbook-scrubber]::-moz-range-thumb {
|
|
465
|
+
width: 14px;
|
|
466
|
+
height: 14px;
|
|
467
|
+
border-radius: 50%;
|
|
468
|
+
border: 2px solid var(--flipbook-accent, #2563eb);
|
|
469
|
+
background: var(--flipbook-toolbar-color, #1f2328);
|
|
470
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.flipbook-root [data-flipbook-scrubber]:disabled {
|
|
474
|
+
opacity: 0.4;
|
|
475
|
+
cursor: default;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/* A narrow viewer: the dock keeps to one row, the page box gets a little smaller. */
|
|
479
|
+
.flipbook-root[data-flipbook-narrow] [data-flipbook-dock] {
|
|
480
|
+
gap: 2px !important;
|
|
481
|
+
padding: 6px 6px !important;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.flipbook-root[data-flipbook-narrow] [data-flipbook-page-field] {
|
|
485
|
+
width: 6ch !important;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
@media (forced-colors: active) {
|
|
489
|
+
.flipbook-root [data-flipbook-rail-button][aria-pressed="true"] {
|
|
490
|
+
forced-color-adjust: none;
|
|
491
|
+
border: 2px solid Highlight !important;
|
|
492
|
+
background: Highlight !important;
|
|
493
|
+
color: HighlightText !important;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.flipbook-root [data-flipbook-tour-spot] {
|
|
497
|
+
outline: 3px solid Highlight;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@media (prefers-reduced-motion: reduce) {
|
|
502
|
+
.flipbook-root [data-flipbook-tour-spot],
|
|
503
|
+
.flipbook-root [data-flipbook-tour-card] {
|
|
504
|
+
transition: none !important;
|
|
505
|
+
}
|
|
506
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { BookmarkStorage } from "../core/bookmarks/BookmarkStore.js";
|
|
|
9
9
|
import type { StorageLike } from "../core/persistence/readingState.js";
|
|
10
10
|
import type { PasswordReason, PdfOptions, PdfSource } from "../pdf/types.js";
|
|
11
11
|
import type { ThumbnailSize } from "../core/appearance/AppearanceStore.js";
|
|
12
|
-
export type { EngineState, FlipBookActionControls, FlipBookAppearanceControls, FlipBookOutlineControls, FlipBookOutlineItem, FlipBookSearchControls, FlipBookBookmarkControls, FlipBookController, FlipBookDirection, FlipBookFlipStyle, FlipBookFullscreenControls, FlipBookMode, FlipBookOrientation, FlipBookNavigation, FlipBookPanelControls, FlipBookView, FlipBookZoomControls, WhileTurning, } from "../core/types.js";
|
|
12
|
+
export type { EngineState, FlipBookActionControls, FlipBookAppearanceControls, FlipBookOutlineControls, FlipBookOutlineItem, FlipBookSearchControls, FlipBookBookmarkControls, FlipBookController, FlipBookDirection, FlipBookFlipStyle, FlipBookFullscreenControls, FlipBookMode, FlipBookOrientation, FlipBookNavigation, FlipBookPanelControls, FlipBookTutorialControls, FlipBookView, FlipBookZoomControls, WhileTurning, } from "../core/types.js";
|
|
13
13
|
export type { BookmarkStorage } from "../core/bookmarks/BookmarkStore.js";
|
|
14
14
|
export type { PanelId, UiSnapshot } from "../core/ui/UiStore.js";
|
|
15
15
|
export type { AppearanceSnapshot, ThumbnailSize, ThumbnailSizeName } from "../core/appearance/AppearanceStore.js";
|
|
@@ -21,8 +21,12 @@ export type { FlipBookError, FlipBookErrorCode } from "../core/errors.js";
|
|
|
21
21
|
export type { ImageCandidate, ImageLoaderArgs, ImageOptions } from "../image/select.js";
|
|
22
22
|
export type { AspectRatioProp } from "../core/layout/sizing.js";
|
|
23
23
|
export type { PasswordReason, PdfOptions, PdfSource } from "../pdf/types.js";
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The built-in looks. `light` is the default. `anime` (a pastel sky, inked outlines and a floating
|
|
26
|
+
* toolbar with a labelled button for every action) and `anime-night` are described in
|
|
27
|
+
* `docs/customisation.md`.
|
|
28
|
+
*/
|
|
29
|
+
export type FlipBookThemeName = "light" | "dark" | "sepia" | "midnight" | "midnight-glass" | "anime" | "anime-night";
|
|
26
30
|
/** A built-in theme by name. */
|
|
27
31
|
export type FlipBookTheme = FlipBookThemeName;
|
|
28
32
|
/**
|
|
@@ -31,7 +35,7 @@ export type FlipBookTheme = FlipBookThemeName;
|
|
|
31
35
|
* thing written in code. Colours are any CSS colour; a number for a length means pixels.
|
|
32
36
|
*/
|
|
33
37
|
export interface FlipBookThemeTokens {
|
|
34
|
-
/** Behind the book
|
|
38
|
+
/** Behind the book: a colour, or any CSS `background`, a gradient for instance. */
|
|
35
39
|
background: string;
|
|
36
40
|
/** The toolbar, the side panel and popovers. */
|
|
37
41
|
toolbarBackground: string;
|
|
@@ -60,6 +64,39 @@ export interface FlipBookThemeTokens {
|
|
|
60
64
|
spineShade: number | false;
|
|
61
65
|
/** How far the crease reaches into the page: `"14%"` (the default) or a number of pixels. */
|
|
62
66
|
spineWidth: number | string;
|
|
67
|
+
/**
|
|
68
|
+
* The text and icons that sit on an `accent` fill: the Open button of the password dialog, and
|
|
69
|
+
* any button a theme fills with the accent. Default white. Pick a colour that reads on `accent`.
|
|
70
|
+
*/
|
|
71
|
+
onAccent: string;
|
|
72
|
+
/**
|
|
73
|
+
* Space round the toolbar, as the CSS `margin` shorthand, so that it floats above the
|
|
74
|
+
* background instead of sitting flush: `"8px 12px 12px"`. Default none.
|
|
75
|
+
*/
|
|
76
|
+
barMargin: string;
|
|
77
|
+
/** Rounds the corners of the toolbar. Default square. */
|
|
78
|
+
barRadius: number | string;
|
|
79
|
+
/** A border round the toolbar, as the CSS `border` shorthand: `"2px solid #2b2455"`. Default none. */
|
|
80
|
+
barBorder: string;
|
|
81
|
+
/** A shadow under the toolbar, written like `box-shadow`. Default none. */
|
|
82
|
+
barShadow: string;
|
|
83
|
+
/** Rounds every toolbar button. Default 8px. */
|
|
84
|
+
buttonRadius: number | string;
|
|
85
|
+
/**
|
|
86
|
+
* The width and height of the toolbar's icon buttons, in pixels or as a CSS length. Default 36.
|
|
87
|
+
* The anime themes use 44, the size that WCAG 2.2 and the platform guidelines recommend for a
|
|
88
|
+
* touch target; set it to `44` in your own theme for the same.
|
|
89
|
+
*/
|
|
90
|
+
buttonSize: number | string;
|
|
91
|
+
/** The fill of a button that is on (bookmarked, panel open, fullscreen). Default a faint grey. */
|
|
92
|
+
buttonPressedBackground: string;
|
|
93
|
+
/** The text and icon colour of a button that is on. Default: the toolbar's. */
|
|
94
|
+
buttonPressedColor: string;
|
|
95
|
+
/**
|
|
96
|
+
* How much the studio layout's header, rail, dock and panel blur what is behind them, in pixels or
|
|
97
|
+
* as a CSS length. It only shows through a translucent `toolbarBackground`. Default 0: no blur.
|
|
98
|
+
*/
|
|
99
|
+
glassBlur: number | string;
|
|
63
100
|
}
|
|
64
101
|
/** A theme of your own: a built-in one to start from, and the tokens that differ. */
|
|
65
102
|
export interface FlipBookThemeDefinition extends Partial<FlipBookThemeTokens> {
|
|
@@ -68,6 +105,8 @@ export interface FlipBookThemeDefinition extends Partial<FlipBookThemeTokens> {
|
|
|
68
105
|
}
|
|
69
106
|
/** What the `theme` prop takes. */
|
|
70
107
|
export type FlipBookThemeInput = FlipBookThemeName | FlipBookThemeDefinition;
|
|
108
|
+
/** When the toolbar prints the name of each action under its icon. */
|
|
109
|
+
export type FlipBookToolbarLabels = "auto" | "always" | "hidden";
|
|
71
110
|
/** The parts of the viewer that `classNames` and `styles` can reach. */
|
|
72
111
|
export type FlipBookPart = "root" | "stage" | "book" | "page" | "toolbar" | "panel" | "notice";
|
|
73
112
|
/** A raster or SVG page. Pass `width` and `height` to skip measuring the image. */
|
|
@@ -164,6 +203,15 @@ export interface FlipBookLocale {
|
|
|
164
203
|
fit: string;
|
|
165
204
|
fullscreen: string;
|
|
166
205
|
exitFullscreen: string;
|
|
206
|
+
/**
|
|
207
|
+
* The words printed under the bookmark and fullscreen buttons when the toolbar shows labels
|
|
208
|
+
* (`toolbarLabels`). The other buttons print their own names. Like `fit`, they have to be
|
|
209
|
+
* contained in the button's full name (`addBookmark` and `removeBookmark` contain "Bookmark",
|
|
210
|
+
* `fullscreen` and `exitFullscreen` contain "Fullscreen"), so that someone who speaks to their
|
|
211
|
+
* device can say what they see.
|
|
212
|
+
*/
|
|
213
|
+
addBookmarkShort: string;
|
|
214
|
+
fullscreenShort: string;
|
|
167
215
|
thumbnails: string;
|
|
168
216
|
bookmarks: string;
|
|
169
217
|
pagesTab: string;
|
|
@@ -224,6 +272,42 @@ export interface FlipBookLocale {
|
|
|
224
272
|
/** `{url}` is the address. */
|
|
225
273
|
linkOpen: string;
|
|
226
274
|
linkPage: string;
|
|
275
|
+
/** Name of the box in the studio layout where a page number is typed. */
|
|
276
|
+
pageField: string;
|
|
277
|
+
/** Name of the slider in the studio layout that moves through the pages. */
|
|
278
|
+
scrubber: string;
|
|
279
|
+
/** Names the row of panel buttons (Pages, Search, Contents, Bookmarks) in the studio layout. */
|
|
280
|
+
railLabel: string;
|
|
281
|
+
/** Name of the button that opens the menu of download, print, share and the tour. */
|
|
282
|
+
moreActions: string;
|
|
283
|
+
/** The menu entry that starts the tour, and the name of `startTutorial()`'s button. */
|
|
284
|
+
tourStart: string;
|
|
285
|
+
tourNext: string;
|
|
286
|
+
tourBack: string;
|
|
287
|
+
tourSkip: string;
|
|
288
|
+
tourDone: string;
|
|
289
|
+
/** `{step}` of `{total}`. */
|
|
290
|
+
tourStepOf: string;
|
|
291
|
+
/** Names the tour's dialog for a screen reader. */
|
|
292
|
+
tourDialogLabel: string;
|
|
293
|
+
tourWelcomeTitle: string;
|
|
294
|
+
tourWelcomeBody: string;
|
|
295
|
+
tourPagesTitle: string;
|
|
296
|
+
tourPagesBody: string;
|
|
297
|
+
tourScrubTitle: string;
|
|
298
|
+
tourScrubBody: string;
|
|
299
|
+
tourZoomTitle: string;
|
|
300
|
+
tourZoomBody: string;
|
|
301
|
+
tourRailTitle: string;
|
|
302
|
+
tourRailBody: string;
|
|
303
|
+
tourSearchTitle: string;
|
|
304
|
+
tourSearchBody: string;
|
|
305
|
+
tourBookmarkTitle: string;
|
|
306
|
+
tourBookmarkBody: string;
|
|
307
|
+
tourMoreTitle: string;
|
|
308
|
+
tourMoreBody: string;
|
|
309
|
+
tourEndTitle: string;
|
|
310
|
+
tourEndBody: string;
|
|
227
311
|
}
|
|
228
312
|
export interface BookmarkOptions {
|
|
229
313
|
/** Controlled list of bookmarked pages. Changes you make elsewhere flow in here. */
|
|
@@ -552,6 +636,31 @@ export interface FlipBookStageProps {
|
|
|
552
636
|
renderError?: (error: FlipBookError) => ReactNode;
|
|
553
637
|
renderEmpty?: () => ReactNode;
|
|
554
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* How the controls are arranged. `"classic"` is the original: one toolbar under the book, with the
|
|
641
|
+
* panel as a sidebar or a sheet. `"studio"` has a header (title, search, bookmark, more), a rail of
|
|
642
|
+
* panel buttons that becomes a tab bar on a phone, a dock with a page box and a slider, and a sheet
|
|
643
|
+
* that pushes the book up instead of covering it. See `docs/customisation.md`.
|
|
644
|
+
*/
|
|
645
|
+
export type FlipBookLayout = "classic" | "studio";
|
|
646
|
+
/** Where the tutorial remembers that it was shown. */
|
|
647
|
+
export type FlipBookTutorialStorage = "local" | "session" | "none";
|
|
648
|
+
/** Settings for the step-by-step tutorial. `tutorial` takes `true` for these defaults. */
|
|
649
|
+
export interface FlipBookTutorialOptions {
|
|
650
|
+
/**
|
|
651
|
+
* Open the tutorial by itself the first time the book shows, once it is not yet remembered as
|
|
652
|
+
* seen. Turn this off to start it only from the More menu or `startTutorial()`. Default true.
|
|
653
|
+
*/
|
|
654
|
+
autoStart?: boolean;
|
|
655
|
+
/**
|
|
656
|
+
* Where "seen" is remembered. `"local"` keeps it between visits, `"session"` until the tab
|
|
657
|
+
* closes, `"none"` not at all (an auto-start tutorial then opens on every load). Use `"none"` or
|
|
658
|
+
* `"session"` until a visitor has agreed to storage. Default `"local"`.
|
|
659
|
+
*/
|
|
660
|
+
storage?: FlipBookTutorialStorage;
|
|
661
|
+
/** The key it is stored under, so that two books can be taught separately. Default `"flipbook-tutorial"`. */
|
|
662
|
+
storageKey?: string;
|
|
663
|
+
}
|
|
555
664
|
export interface FlipBookProps extends FlipBookBookProps, FlipBookStageProps {
|
|
556
665
|
/** CSS width. Default `"100%"`. */
|
|
557
666
|
width?: number | string;
|
|
@@ -568,6 +677,13 @@ export interface FlipBookProps extends FlipBookBookProps, FlipBookStageProps {
|
|
|
568
677
|
toolbar?: boolean;
|
|
569
678
|
/** Which edge of the viewer the toolbar sits on. Default `"bottom"`. */
|
|
570
679
|
toolbarPosition?: "top" | "bottom";
|
|
680
|
+
/**
|
|
681
|
+
* Print the name of each action under its icon (Bookmark, Search, Pages, Fullscreen, Download…),
|
|
682
|
+
* so that nobody has to hover to find out what a button does, and touch screens have no hover.
|
|
683
|
+
* `"auto"` shows them when the viewer is at least 560 px wide, `"always"` and `"hidden"` do what
|
|
684
|
+
* they say. Default `"hidden"`, except that the `anime` themes default to `"auto"`.
|
|
685
|
+
*/
|
|
686
|
+
toolbarLabels?: FlipBookToolbarLabels;
|
|
571
687
|
/** Replaces the whole toolbar. `controls` is the same object `useFlipBook()` returns. */
|
|
572
688
|
renderToolbar?: (api: {
|
|
573
689
|
controls: UseFlipBookResult;
|
|
@@ -576,5 +692,14 @@ export interface FlipBookProps extends FlipBookBookProps, FlipBookStageProps {
|
|
|
576
692
|
navigation?: boolean;
|
|
577
693
|
/** Arrow keys, Home and End. Default true. */
|
|
578
694
|
keyboard?: boolean;
|
|
695
|
+
/** How the controls are arranged: `"classic"` (default) or `"studio"`. */
|
|
696
|
+
layout?: FlipBookLayout;
|
|
697
|
+
/** The studio layout's header prints this above the page range. Default: the viewer's name. */
|
|
698
|
+
title?: string;
|
|
699
|
+
/**
|
|
700
|
+
* A step-by-step tutorial in a popup: it points at the controls one at a time. `true` for the
|
|
701
|
+
* defaults, or options. Works in the `studio` layout; the `classic` one gets the short version.
|
|
702
|
+
*/
|
|
703
|
+
tutorial?: boolean | FlipBookTutorialOptions;
|
|
579
704
|
}
|
|
580
705
|
//# sourceMappingURL=index.d.ts.map
|