bookish-press 0.4.51 → 0.4.52
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.
|
@@ -25,7 +25,7 @@ $: {
|
|
|
25
25
|
const sizedText = showPlaceholder()
|
|
26
26
|
? placeholder
|
|
27
27
|
: text.replace(/\s/g, '\u00a0');
|
|
28
|
-
// Clip the text to prevent this editor from getting too long when editing
|
|
28
|
+
// Clip the text to prevent this editor from getting too long when editing. If it goes past one line,
|
|
29
29
|
// the measurements and layout are way off.
|
|
30
30
|
const trimmedText = width !== undefined &&
|
|
31
31
|
(clip === true || status === Status.Editing)
|
|
@@ -238,9 +238,9 @@ function handleKeyPress(event) {
|
|
|
238
238
|
flex-direction: row;
|
|
239
239
|
flex-wrap: wrap;
|
|
240
240
|
align-items: baseline;
|
|
241
|
-
background: var(--bookish-background-color);
|
|
242
241
|
font-family: var(--app-font);
|
|
243
242
|
font-size: var(--app-chrome-font-size);
|
|
243
|
+
row-gap: var(--app-chrome-padding);
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
.bookish-editor-toolbar:focus {
|
|
@@ -121,24 +121,24 @@ let darkLabel = '\u263E';
|
|
|
121
121
|
class={'outline ' +
|
|
122
122
|
(!expanded || collapse ? 'outline-collapsed' : 'outline-expanded')}
|
|
123
123
|
>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
<div class="outline-top">
|
|
125
|
+
<!-- Visual cue of expandability, only visible in footer mode. -->
|
|
126
|
+
<div
|
|
127
|
+
class={'outline-toggle' +
|
|
128
|
+
(headers.length === 0 ? ' outline-toggle-disabled' : '')}
|
|
129
|
+
role="button"
|
|
130
|
+
aria-label={expanded
|
|
131
|
+
? 'Collapse navigation menu'
|
|
132
|
+
: 'Expand navigation menu'}
|
|
133
|
+
tabIndex="0"
|
|
134
|
+
on:click={headers.length > 0 ? toggleExpanded : undefined}
|
|
135
|
+
on:keydown={(event) => {
|
|
136
|
+
if (event.key === 'Enter' || event.key === ' ')
|
|
137
|
+
toggleExpanded();
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{expandLabel}
|
|
141
|
+
</div>
|
|
142
142
|
<div class="outline-header-nav">
|
|
143
143
|
{#if previous !== null}<Link to="{$base}/{previous}"
|
|
144
144
|
>{previousLabel}</Link
|
|
@@ -153,6 +153,26 @@ let darkLabel = '\u263E';
|
|
|
153
153
|
>{nextLabel}</span
|
|
154
154
|
>{/if}
|
|
155
155
|
</div>
|
|
156
|
+
<!-- Dark mode toggle -->
|
|
157
|
+
<div
|
|
158
|
+
class="outline-dark-toggle"
|
|
159
|
+
role="button"
|
|
160
|
+
aria-label={$dark === true
|
|
161
|
+
? 'Switch to light mode'
|
|
162
|
+
: 'Switch to dark mode'}
|
|
163
|
+
tabIndex="0"
|
|
164
|
+
on:click={toggleReadingMode}
|
|
165
|
+
on:keydown={(event) => {
|
|
166
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
167
|
+
toggleReadingMode();
|
|
168
|
+
event.stopPropagation();
|
|
169
|
+
}
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
{$dark ? darkLabel : lightLabel}
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="outline-headers">
|
|
156
176
|
<!-- Scan through the headers and add a properly formatted link for each. -->
|
|
157
177
|
{#each headers as header, index}
|
|
158
178
|
<!-- Assumes that all headers have an H1, H2, etc. tag. -->
|
|
@@ -173,24 +193,6 @@ let darkLabel = '\u263E';
|
|
|
173
193
|
{/if}
|
|
174
194
|
{/each}
|
|
175
195
|
</div>
|
|
176
|
-
<!-- Dark mode toggle -->
|
|
177
|
-
<div
|
|
178
|
-
class="outline-reading-mode"
|
|
179
|
-
role="button"
|
|
180
|
-
aria-label={$dark === true
|
|
181
|
-
? 'Switch to light mode'
|
|
182
|
-
: 'Switch to dark mode'}
|
|
183
|
-
tabIndex="0"
|
|
184
|
-
on:click={toggleReadingMode}
|
|
185
|
-
on:keydown={(event) => {
|
|
186
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
187
|
-
toggleReadingMode();
|
|
188
|
-
event.stopPropagation();
|
|
189
|
-
}
|
|
190
|
-
}}
|
|
191
|
-
>
|
|
192
|
-
{$dark ? darkLabel : lightLabel}
|
|
193
|
-
</div>
|
|
194
196
|
</nav>
|
|
195
197
|
|
|
196
198
|
<style>
|
|
@@ -206,18 +208,10 @@ let darkLabel = '\u263E';
|
|
|
206
208
|
);
|
|
207
209
|
}
|
|
208
210
|
|
|
209
|
-
.outline-header-nav {
|
|
210
|
-
display: inline-block;
|
|
211
|
-
width: 100%;
|
|
212
|
-
padding-bottom: var(--outline-padding);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
211
|
.outline-header {
|
|
216
212
|
display: block;
|
|
217
213
|
line-height: var(--bookish-paragraph-line-height-tight);
|
|
218
214
|
text-indent: 0;
|
|
219
|
-
padding-left: 1rem;
|
|
220
|
-
padding-right: 1rem;
|
|
221
215
|
margin-bottom: 0.75rem;
|
|
222
216
|
}
|
|
223
217
|
|
|
@@ -264,16 +258,30 @@ let darkLabel = '\u263E';
|
|
|
264
258
|
color: var(--bookish-paragraph-color);
|
|
265
259
|
}
|
|
266
260
|
|
|
267
|
-
.outline-
|
|
261
|
+
.outline-dark-toggle {
|
|
268
262
|
transition: transform 0.2s ease-in;
|
|
269
263
|
}
|
|
270
264
|
|
|
271
|
-
.outline-
|
|
265
|
+
.outline-dark-toggle:hover {
|
|
272
266
|
cursor: pointer;
|
|
273
267
|
transform: scale(1.25, 1.25);
|
|
274
268
|
color: var(--bookish-paragraph-color);
|
|
275
269
|
}
|
|
276
270
|
|
|
271
|
+
.outline-top {
|
|
272
|
+
display: flex;
|
|
273
|
+
flex-direction: row;
|
|
274
|
+
flex-wrap: nowrap;
|
|
275
|
+
align-items: center;
|
|
276
|
+
width: 100%;
|
|
277
|
+
margin-bottom: 0.75rem;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* Make a little centered box to store the outline to preserve its left aligned structure, while making it easier to click. */
|
|
281
|
+
.outline-headers {
|
|
282
|
+
margin: auto;
|
|
283
|
+
}
|
|
284
|
+
|
|
277
285
|
/* Mobile */
|
|
278
286
|
@media screen and (max-width: 1200px) {
|
|
279
287
|
.outline {
|
|
@@ -281,7 +289,6 @@ let darkLabel = '\u263E';
|
|
|
281
289
|
top: 100%; /* Put it all the way off screen on the bottom, then let JS translate */
|
|
282
290
|
left: 0;
|
|
283
291
|
right: 0;
|
|
284
|
-
width: 100%;
|
|
285
292
|
z-index: 2; /* Put it above content when it's a sheet in the footer */
|
|
286
293
|
border-top: 1px solid var(--bookish-border-color-light);
|
|
287
294
|
text-align: left;
|
|
@@ -289,58 +296,38 @@ let darkLabel = '\u263E';
|
|
|
289
296
|
background-color: var(--bookish-background-color);
|
|
290
297
|
box-shadow: 0px -1px 2px rgba(0, 0, 0, 0.25);
|
|
291
298
|
backdrop-filter: blur(10px);
|
|
292
|
-
-webkit-backdrop-filter: blur(10px);
|
|
293
299
|
/* Cap height at window size. If the content is too tall, scroll it. */
|
|
294
300
|
max-height: 100%;
|
|
295
301
|
overflow-y: scroll;
|
|
302
|
+
padding: 0.5em;
|
|
296
303
|
}
|
|
297
304
|
|
|
298
|
-
|
|
299
|
-
.outline-headers {
|
|
300
|
-
width: 20em;
|
|
301
|
-
margin: auto;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.outline-header-nav {
|
|
305
|
-
text-align: center;
|
|
306
|
-
padding-top: 0.5em; /* Add some spacing when in the footer */
|
|
307
|
-
padding-bottom: 0.5em;
|
|
308
|
-
text-indent: 0 !important; /* Override header default */
|
|
309
|
-
font-size: 1.25rem !important;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.outline-reading-mode {
|
|
313
|
-
position: absolute;
|
|
314
|
-
top: 0.5em;
|
|
315
|
-
left: 0;
|
|
305
|
+
.outline-dark-toggle {
|
|
316
306
|
font-size: 1em;
|
|
317
307
|
display: inline-block;
|
|
318
|
-
padding-left: 1em;
|
|
319
|
-
padding-right: 1em;
|
|
320
308
|
}
|
|
321
309
|
|
|
322
|
-
.outline-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
310
|
+
.outline-top {
|
|
311
|
+
flex-direction: row-reverse;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.outline-toggle {
|
|
326
315
|
font-size: 1em;
|
|
327
316
|
display: inline-block;
|
|
328
|
-
padding-left: 1em;
|
|
329
|
-
padding-right: 1em;
|
|
330
317
|
transition: transform 0.2s ease-in;
|
|
331
318
|
}
|
|
332
319
|
|
|
333
|
-
.outline-
|
|
320
|
+
.outline-toggle:hover {
|
|
334
321
|
cursor: pointer;
|
|
335
322
|
transform: scale(1.25, 1.25);
|
|
336
323
|
color: var(--bookish-paragraph-color);
|
|
337
324
|
}
|
|
338
325
|
|
|
339
|
-
.outline-
|
|
326
|
+
.outline-toggle-disabled {
|
|
340
327
|
display: none;
|
|
341
328
|
}
|
|
342
329
|
|
|
343
|
-
.outline-expanded .outline-
|
|
330
|
+
.outline-expanded .outline-toggle {
|
|
344
331
|
transform: rotate(90deg);
|
|
345
332
|
}
|
|
346
333
|
|
|
@@ -351,6 +338,15 @@ let darkLabel = '\u263E';
|
|
|
351
338
|
.outline.outline-collapsed {
|
|
352
339
|
transform: translateY(-3rem);
|
|
353
340
|
}
|
|
341
|
+
|
|
342
|
+
.outline-headers {
|
|
343
|
+
width: 20em;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/* Center on mobile */
|
|
347
|
+
.outline-header-nav {
|
|
348
|
+
margin: auto;
|
|
349
|
+
}
|
|
354
350
|
}
|
|
355
351
|
|
|
356
352
|
/* Desktop */
|
|
@@ -380,14 +376,19 @@ let darkLabel = '\u263E';
|
|
|
380
376
|
margin-left: var(--outline-offset);
|
|
381
377
|
}
|
|
382
378
|
|
|
383
|
-
.outline-
|
|
379
|
+
.outline-toggle {
|
|
384
380
|
display: none;
|
|
385
381
|
}
|
|
386
382
|
|
|
387
|
-
.outline-
|
|
383
|
+
.outline-dark-toggle {
|
|
388
384
|
position: absolute;
|
|
389
385
|
top: calc(var(--outline-padding));
|
|
390
386
|
right: calc(var(--outline-padding));
|
|
391
387
|
}
|
|
388
|
+
|
|
389
|
+
/* Left align on desktop, since no collapse cue. */
|
|
390
|
+
.outline-header-nav {
|
|
391
|
+
margin-right: auto;
|
|
392
|
+
}
|
|
392
393
|
}
|
|
393
394
|
</style>
|
|
@@ -86,14 +86,12 @@ $: {
|
|
|
86
86
|
this book:
|
|
87
87
|
</p>
|
|
88
88
|
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/>
|
|
96
|
-
</p>
|
|
89
|
+
<input
|
|
90
|
+
class="query"
|
|
91
|
+
type="text"
|
|
92
|
+
placeholder="search for a word"
|
|
93
|
+
bind:value={query}
|
|
94
|
+
/>
|
|
97
95
|
|
|
98
96
|
{#if query.trim() !== ''}
|
|
99
97
|
{#if query.trim().length < 3}
|
|
@@ -131,3 +129,20 @@ $: {
|
|
|
131
129
|
{/if}
|
|
132
130
|
</Page>
|
|
133
131
|
{/if}
|
|
132
|
+
|
|
133
|
+
<style>
|
|
134
|
+
.query {
|
|
135
|
+
font-family: var(--bookish-header-font-family);
|
|
136
|
+
font-size: var(--bookish-header-font-size);
|
|
137
|
+
border: none;
|
|
138
|
+
border-bottom: 3px solid var(--bookish-border-color-light);
|
|
139
|
+
padding: var(--bookish-inline-padding);
|
|
140
|
+
display: inline-block;
|
|
141
|
+
margin-top: 2em;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.query:focus {
|
|
145
|
+
outline: none;
|
|
146
|
+
border-color: var(--bookish-highlight-color);
|
|
147
|
+
}
|
|
148
|
+
</style>
|
package/models/book/Theme.js
CHANGED
|
@@ -146,7 +146,7 @@ export const SeriousTheme = {
|
|
|
146
146
|
// Spacing
|
|
147
147
|
spacing: {
|
|
148
148
|
paragraphLineHeight: '2rem',
|
|
149
|
-
paragraphLineHeightTight: '1.
|
|
149
|
+
paragraphLineHeightTight: '1.6em',
|
|
150
150
|
headerLineHeight: '1.3em',
|
|
151
151
|
paragraphSpacing: '1.8rem',
|
|
152
152
|
headerSpacing: '2rem',
|