bloggie 0.4.2 → 0.4.4
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/AGENTS.md +4 -0
- package/README.md +5 -0
- package/e2e/editor.js +72 -0
- package/e2e/jump.js +29 -2
- package/e2e/run.js +29 -7
- package/editor/client.js +42 -10
- package/editor/editor.css +39 -1
- package/editor/integration.js +1 -1
- package/editor/panel.js +110 -6
- package/editor/patch.js +4 -3
- package/editor/source.js +53 -5
- package/jump/client.js +9 -0
- package/layouts/Post.astro +17 -11
- package/lib/pages.js +29 -0
- package/package.json +1 -1
- package/pages/index.astro +90 -38
- package/scripts/export/agent.js +2 -2
- package/scripts/export/common.js +10 -4
- package/scripts/export/dev.js +7 -5
- package/scripts/export/index.js +14 -10
- package/scripts/export/page.js +4 -3
- package/scripts/export-posts.js +26 -11
- package/skills/bloggie-slides/SKILL.md +2 -1
- package/styles/site.css +117 -11
- package/template/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -19,6 +19,10 @@ and figures. `template/` is the starter blog that `scripts/create.js` copies (`n
|
|
|
19
19
|
- A release goes to npm: raise the last number of `version` in `package.json`, 0.4.0 to 0.4.1 (the middle number goes
|
|
20
20
|
up once others contribute), and the template's `bloggie` dependency with it; then `npm publish` here. Publish
|
|
21
21
|
`create/` (`create-bloggie`) only when its `index.js` changes.
|
|
22
|
+
- An agent never runs `npm publish`: it needs the maintainer's npm login and a one-time password. When asked to
|
|
23
|
+
publish, an agent prepares the release (the version numbers, the commits) and then prints the commands for the
|
|
24
|
+
maintainer to run, with full paths: `cd <this folder> && npm publish`, and the same in `create/` when it changes.
|
|
25
|
+
After the maintainer says it is done, the agent checks the release with `npm view bloggie version`.
|
|
22
26
|
- From a blog, `npm run bloggie:push -- -m "…" --yes` (`scripts/publish.js`) publishes `bloggie/` as one new commit on
|
|
23
27
|
top of the engine's main and opens a pull request: to a branch of the engine's repository if you may push there,
|
|
24
28
|
else of your fork (`gh` makes it; without `gh`, `--remote <fork>`). `--main` pushes to main. None of the blog's
|
package/README.md
CHANGED
|
@@ -98,9 +98,13 @@ src/pages/posts/<slug>/
|
|
|
98
98
|
index.mdx the post: Markdown, math and figure tags
|
|
99
99
|
slides.mdx its deck (optional)
|
|
100
100
|
data/ media/ the numbers and pictures it shows
|
|
101
|
+
<name>.mdx a subpage, at /posts/<slug>/<name>/ (optional)
|
|
102
|
+
<name>/ a subpage that is a folder: its own index.mdx, and slides.mdx if it has a deck
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
The blog's home page is an index that lists every post, newest first.
|
|
106
|
+
A subpage, such as an appendix or a long table, uses the post layout but is not listed on the home page; link to it from its post.
|
|
107
|
+
It can sit at any depth under the post, so a post can also hold earlier posts as an archive.
|
|
104
108
|
You can ask an agent to write a post or its slides, or edit it yourself in Markdown and HTML.
|
|
105
109
|
|
|
106
110
|
## One style, written down for your agent
|
|
@@ -125,6 +129,7 @@ A note written as `((…))` anywhere in a file asks the agent to address it and
|
|
|
125
129
|
The <img src=".github/readme/download.svg" height="14" alt="download"> in each post's byline downloads the post as one HTML file, with its styles, figures and deck inside.
|
|
126
130
|
It opens from disk with no internet, so you can present from a laptop offline or send the post by email.
|
|
127
131
|
The menu beside it also offers the post as text for an AI agent.
|
|
132
|
+
A subpage has no downloads unless its front matter sets `downloads: true`, since each download adds to the build's time; a post can turn them off with `downloads: false`.
|
|
128
133
|
|
|
129
134
|
## Publish
|
|
130
135
|
|
package/e2e/editor.js
CHANGED
|
@@ -124,6 +124,31 @@ export async function editorChecks({ check, launch, root }) {
|
|
|
124
124
|
return observed
|
|
125
125
|
})
|
|
126
126
|
|
|
127
|
+
// Every slide of every deck, moved to the start, the end and one place each way: every slide keeps its
|
|
128
|
+
// kind (a `#` that moves past the title is given its kind in a tag), and the moved slide keeps its text.
|
|
129
|
+
await check(LABEL, 'every slide of every deck moves, and every slide keeps its kind', () => {
|
|
130
|
+
const observed = {}
|
|
131
|
+
for (const slug of decksIn(root)) {
|
|
132
|
+
const source = readFileSync(join(root, 'src/pages/posts', slug, 'slides.mdx'), 'utf8')
|
|
133
|
+
const before = outline(source).slides
|
|
134
|
+
const n = before.length
|
|
135
|
+
let moves = 0
|
|
136
|
+
for (let from = 0; from < n; from++) {
|
|
137
|
+
for (const to of new Set([0, n - 1, from - 1, from + 1].filter((t) => t >= 0 && t < n && t !== from))) {
|
|
138
|
+
const order = before.map((s, i) => i)
|
|
139
|
+
order.splice(to, 0, ...order.splice(from, 1))
|
|
140
|
+
const after = outline(applyEdit(source, { type: 'move-slide', slide: from, to }).source).slides
|
|
141
|
+
const kinds = after.map((s) => s.kind).join()
|
|
142
|
+
if (kinds !== order.map((i) => before[i].kind).join()) throw new Error(`${slug}: moving slide ${from + 1} to ${to + 1} gives the kinds ${kinds}`)
|
|
143
|
+
if (after[to].opaque !== before[from].opaque || after[to].hashes.join() !== before[from].hashes.join()) throw new Error(`${slug}: slide ${from + 1}, moved to ${to + 1}, changed its blocks`)
|
|
144
|
+
moves++
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
observed[slug] = `${moves} moves`
|
|
148
|
+
}
|
|
149
|
+
return observed
|
|
150
|
+
})
|
|
151
|
+
|
|
127
152
|
const copy = copyProject(root)
|
|
128
153
|
let dev = null
|
|
129
154
|
let browser = null
|
|
@@ -398,6 +423,30 @@ export async function editorChecks({ check, launch, root }) {
|
|
|
398
423
|
return `"${value}" written, rendered as ${shown}, and undone, in place`
|
|
399
424
|
})
|
|
400
425
|
|
|
426
|
+
await step('⌘S saves the Markdown being edited and a size step before its pause, and the browser does not save the page', async () => {
|
|
427
|
+
const prevented = await ev(`(() => { const e = new KeyboardEvent('keydown', { key: 's', code: 'KeyS', metaKey: true, ctrlKey: true, bubbles: true, cancelable: true }); document.body.dispatchEvent(e); return e.defaultPrevented })()`)
|
|
428
|
+
if (!prevented) throw new Error('⌘S was not prevented: the browser would save the page')
|
|
429
|
+
const p = await center(paragraph)
|
|
430
|
+
await click(p.x, p.y)
|
|
431
|
+
await key('Enter')
|
|
432
|
+
await page.waitFor(`document.querySelector('.se-source textarea')`, { timeout: 5000, what: 'the Markdown editor' })
|
|
433
|
+
await ev(`document.querySelector('.se-source textarea').value = 'Saved with ⌘S.'`)
|
|
434
|
+
await drawn(() => key('s', ['meta']))
|
|
435
|
+
if (!read().includes('Saved with ⌘S.') || (await ev(`!!document.querySelector('.se-source')`))) throw new Error('⌘S did not save and close the Markdown editor')
|
|
436
|
+
await drawn(() => key('z', ['meta']))
|
|
437
|
+
// A size step waits 450 ms before it is written; ⌘S writes it at once.
|
|
438
|
+
await click(p.x, p.y)
|
|
439
|
+
await key('.', ['meta', 'shift'])
|
|
440
|
+
const start = Date.now()
|
|
441
|
+
await key('s', ['meta'])
|
|
442
|
+
await page.waitFor(`document.querySelector('.se-status')?.textContent === 'Saving…' || document.querySelector('.se-status')?.textContent === 'Saved'`, { timeout: 2000, what: 'the size step to be sent' })
|
|
443
|
+
const sent = Date.now() - start
|
|
444
|
+
await saved()
|
|
445
|
+
if (!/font-size: \d+px/.test(readBlock(read(), target.id).style) || sent > 300) throw new Error(`after ⌘S the style is "${readBlock(read(), target.id).style}", sent after ${sent} ms`)
|
|
446
|
+
await undoAll()
|
|
447
|
+
return `⌘S prevented; the Markdown saved and the size step sent ${sent} ms after ⌘S`
|
|
448
|
+
})
|
|
449
|
+
|
|
401
450
|
await step('⌘D copies a list as a list of its own, and undo removes the copy', async () => {
|
|
402
451
|
const index = await ev(`[...document.querySelectorAll('.deck > .slide')].findIndex((s) => s.querySelector('.slide-body > ul[data-edit]'))`)
|
|
403
452
|
await ev(`location.hash = '#${index + 1}'`)
|
|
@@ -474,6 +523,29 @@ export async function editorChecks({ check, launch, root }) {
|
|
|
474
523
|
return `${count} → ${copied} → ${count} slides; the copy was shown as slide ${now}`
|
|
475
524
|
})
|
|
476
525
|
|
|
526
|
+
await step('a dragged thumbnail moves its slide, ⌘↑ moves it back one, and undo brings slides.mdx back; nothing reloads', async () => {
|
|
527
|
+
const hashes = (text) => outline(text).slides.map((s) => s.hash)
|
|
528
|
+
const was = hashes(original)
|
|
529
|
+
await ev(`document.querySelector('.se-panel').scrollTop = 0`)
|
|
530
|
+
await sleep(200)
|
|
531
|
+
// From thumbnail 2 to the lower half of thumbnail 4: slide 2 becomes slide 4.
|
|
532
|
+
const from = await center('.se-slide[data-index="1"] .se-slide-frame')
|
|
533
|
+
const below = await ev(`(() => { const r = document.querySelector('.se-slide[data-index="3"]').getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height * 0.75 } })()`)
|
|
534
|
+
await drawn(() => drag(from.x, from.y, below.x, below.y))
|
|
535
|
+
const dragged = hashes(read())
|
|
536
|
+
const state = await ev(`({ thumbs: document.querySelectorAll('.se-panel .se-slide').length, current: document.querySelector('.se-slide.se-current')?.dataset.index, ghost: !!document.querySelector('.se-ghost') })`)
|
|
537
|
+
if (dragged[3] !== was[1] || dragged[1] !== was[2] || dragged[2] !== was[3]) throw new Error('slides.mdx does not have slide 2 as slide 4')
|
|
538
|
+
if (state.thumbs !== was.length || (await at()) !== 4 || state.current !== '3' || state.ghost) throw new Error(`after the drag: ${JSON.stringify(state)}, on slide ${await at()}`)
|
|
539
|
+
await drawn(() => key('ArrowUp', ['meta']))
|
|
540
|
+
const keyed = hashes(read())
|
|
541
|
+
if (keyed[2] !== was[1] || (await at()) !== 3) throw new Error(`after ⌘↑ the slide is not slide 3 (on slide ${await at()})`)
|
|
542
|
+
await drawn(() => key('z', ['meta']))
|
|
543
|
+
await drawn(() => key('z', ['meta']))
|
|
544
|
+
if (read() !== original) throw new Error('undo did not bring slides.mdx back')
|
|
545
|
+
if ((await ev(`document.querySelectorAll('.se-panel .se-slide').length`)) !== was.length) throw new Error('the slide list lost a thumbnail')
|
|
546
|
+
return 'slide 2 → 4 by a drag, → 3 by ⌘↑, and back by two undos'
|
|
547
|
+
})
|
|
548
|
+
|
|
477
549
|
await step('Delete and its undo are drawn in place, and a figure on another slide keeps running', async () => {
|
|
478
550
|
const demo = await ev(`[...document.querySelectorAll('.deck > .slide')].findIndex((s) => s.querySelector('astro-island[data-edit] .fig-play'))`)
|
|
479
551
|
const figure = `.deck > .slide:nth-child(${demo + 1}) astro-island`
|
package/e2e/jump.js
CHANGED
|
@@ -64,6 +64,7 @@ title: Jump to source check (slides)
|
|
|
64
64
|
---
|
|
65
65
|
|
|
66
66
|
import RoleKey from '@bloggie/components/RoleKey.astro'
|
|
67
|
+
import Dots from '@/figures/e2e-jump/Dots.svelte'
|
|
67
68
|
|
|
68
69
|
# Jump Check Deck
|
|
69
70
|
|
|
@@ -76,6 +77,10 @@ Slide text names Aberdeen.
|
|
|
76
77
|
## Second Slide Shows Roles
|
|
77
78
|
|
|
78
79
|
<RoleKey />
|
|
80
|
+
|
|
81
|
+
## Third Slide Shows Dots
|
|
82
|
+
|
|
83
|
+
<Dots client:load />
|
|
79
84
|
`
|
|
80
85
|
|
|
81
86
|
const DOTS = `<script>
|
|
@@ -239,7 +244,7 @@ export async function jumpChecks({ check, launch, root }) {
|
|
|
239
244
|
}
|
|
240
245
|
})
|
|
241
246
|
|
|
242
|
-
await check(LABEL, 'on a deck: a slide\'s title, its text, and a component after the notes of the slide before', async () => {
|
|
247
|
+
await check(LABEL, 'on a deck: a slide\'s title, its text, and a component after the notes of the slide before; in the slide editor, Enter on a part of a figure', async () => {
|
|
243
248
|
const show = async (text) => {
|
|
244
249
|
const n = await page.evaluate(`[...document.querySelectorAll('.deck > section.slide')].findIndex((s) => s.textContent.includes(${JSON.stringify(text)})) + 1`)
|
|
245
250
|
await page.evaluate(`location.hash = '#${n}'`)
|
|
@@ -254,7 +259,29 @@ export async function jumpChecks({ check, launch, root }) {
|
|
|
254
259
|
const text = opens(await jump(await page.evaluate(wordPoint('Aberdeen', active))), DECK_FILE, 'Aberdeen')
|
|
255
260
|
await show('Second Slide')
|
|
256
261
|
const roles = opens(await jump(await page.evaluate(boxPoint('.deck > section.slide.active .role-list li'))), DECK_FILE, '<RoleKey')
|
|
257
|
-
|
|
262
|
+
// In the slide editor, Enter on an element inside a figure (selected with a double-click) opens it, as a
|
|
263
|
+
// Cmd+Shift+click does.
|
|
264
|
+
await show('Third Slide')
|
|
265
|
+
await page.waitFor(`${active}.querySelector('.e2e-dots circle')?.__svelte_meta`, { what: 'the figure on the deck to hydrate' })
|
|
266
|
+
const press = async (key, code, vk, text) => {
|
|
267
|
+
await page.cdp('Input.dispatchKeyEvent', { type: 'keyDown', key, code, windowsVirtualKeyCode: vk, text })
|
|
268
|
+
await page.cdp('Input.dispatchKeyEvent', { type: 'keyUp', key, code, windowsVirtualKeyCode: vk })
|
|
269
|
+
}
|
|
270
|
+
await press('e', 'KeyE', 69, 'e')
|
|
271
|
+
await page.waitFor(`document.body.classList.contains('se-on') && document.querySelector('.se-toolbar')`, { what: 'edit mode' })
|
|
272
|
+
const c = await page.evaluate(boxPoint('.deck > section.slide.active .e2e-dots circle', 8))
|
|
273
|
+
for (const clickCount of [1, 2]) {
|
|
274
|
+
await page.cdp('Input.dispatchMouseEvent', { type: 'mousePressed', x: c.x, y: c.y, button: 'left', buttons: 1, clickCount })
|
|
275
|
+
await page.cdp('Input.dispatchMouseEvent', { type: 'mouseReleased', x: c.x, y: c.y, button: 'left', clickCount })
|
|
276
|
+
}
|
|
277
|
+
await page.waitFor(`document.querySelector('.se-what')?.textContent.includes('› circle')`, { what: 'the circle selected inside the figure' })
|
|
278
|
+
const before = await page.evaluate('window.__jumps.length')
|
|
279
|
+
await press('Enter', 'Enter', 13, '\r')
|
|
280
|
+
const answer = await page.waitFor(`window.__jumps.length > ${before} && window.__jumps.at(-1)`, { what: 'the dev server to answer the editor' })
|
|
281
|
+
const editor = opens(answer, 'src/figures/e2e-jump/Dots.svelte', '<circle')
|
|
282
|
+
await press('Escape', 'Escape', 27)
|
|
283
|
+
await press('e', 'KeyE', 69, 'e')
|
|
284
|
+
return { title, text, roles, editor }
|
|
258
285
|
})
|
|
259
286
|
|
|
260
287
|
if (existsSync(join(copy, 'src/pages/posts/how-this-blog-works/index.mdx'))) {
|
package/e2e/run.js
CHANGED
|
@@ -25,6 +25,7 @@ import { editorChecks } from './editor.js'
|
|
|
25
25
|
import { liveChecks } from './live.js'
|
|
26
26
|
import { jumpChecks } from './jump.js'
|
|
27
27
|
import { tocList, tocUse, tocSpace } from './toc.js'
|
|
28
|
+
import { downloadNames } from '../lib/pages.js'
|
|
28
29
|
|
|
29
30
|
const root = process.cwd() // the blog (lib/blog.js)
|
|
30
31
|
const dist = join(root, 'dist')
|
|
@@ -64,6 +65,8 @@ const htmlPages = (dir) => readdirSync(dir, { withFileTypes: true }).flatMap((en
|
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
const hasDeck = (post) => existsSync(join(dist, 'posts', post, 'slides', 'index.html'))
|
|
68
|
+
// A post or a subpage, at any depth under posts/ (lib/pages.js), as its path there; null for a deck or another page.
|
|
69
|
+
const postPath = (path) => (/^posts\/.+\/$/.test(path) && !path.endsWith('/slides/') ? path.slice('posts/'.length, -1) : null)
|
|
67
70
|
const siteUrl = (await import('../lib/blog.js')).site.url
|
|
68
71
|
|
|
69
72
|
const browser = await launch()
|
|
@@ -144,7 +147,20 @@ for (const file of htmlPages(dist)) {
|
|
|
144
147
|
return `${media.length} figures, medium="${want}"`
|
|
145
148
|
})
|
|
146
149
|
}
|
|
147
|
-
if (
|
|
150
|
+
if (postPath(path)) {
|
|
151
|
+
// The byline's links (layouts/Post.astro) go to pages and files the build made: the deck, when there is a Slides
|
|
152
|
+
// link, and the two downloads, when there is a download control. A subpage beside its post's deck has no Slides link.
|
|
153
|
+
await check(label, "the byline's Slides and download links lead to built files", async () => {
|
|
154
|
+
const links = await page.evaluate(`[...document.querySelectorAll('.byline a[href]')].map((a) => a.getAttribute('href'))`)
|
|
155
|
+
const local = links.filter((href) => !/^[a-z]+:/i.test(href) && !href.startsWith('#'))
|
|
156
|
+
const base = process.env.BASE_PATH || '/'
|
|
157
|
+
const missing = local.filter((href) => {
|
|
158
|
+
const file = join(dist, new URL(href, new URL(path, 'http://x/')).pathname.slice(base.length))
|
|
159
|
+
return !existsSync(file) && !existsSync(join(file, 'index.html'))
|
|
160
|
+
})
|
|
161
|
+
if (missing.length) throw new Error(`no built file for ${missing.join(', ')}`)
|
|
162
|
+
return local.length ? local.join(', ') : 'no Slides or download links'
|
|
163
|
+
})
|
|
148
164
|
// Every section heading ends in a faint # that links to it (Post.astro), for sharing a section.
|
|
149
165
|
await check(label, 'every section heading has an anchor that links to it', async () => {
|
|
150
166
|
const headings = await page.evaluate(`[...document.querySelectorAll('.wrap :is(h2, h3, h4)')].filter((h) => !h.closest('astro-island, .references, .post-list')).map((h) => ({ id: h.id, text: h.textContent.trim(), href: h.querySelector('.heading-anchor')?.getAttribute('href') }))`)
|
|
@@ -276,7 +292,7 @@ for (const file of htmlPages(dist)) {
|
|
|
276
292
|
}
|
|
277
293
|
})
|
|
278
294
|
}
|
|
279
|
-
const post = path
|
|
295
|
+
const post = postPath(path)
|
|
280
296
|
if (!post) continue
|
|
281
297
|
|
|
282
298
|
// The table of contents (bloggie/lib/toc.js): every post lists its sections; the example post is used as a reader would.
|
|
@@ -297,11 +313,16 @@ for (const file of htmlPages(dist)) {
|
|
|
297
313
|
await figures(label, { screenshots: true })
|
|
298
314
|
await check(label, 'no errors while the figures were used', noProblems)
|
|
299
315
|
|
|
316
|
+
// A subpage offers no downloads unless its front matter asks for them (lib/pages.js); then there is nothing more to check.
|
|
317
|
+
if (!(await page.evaluate(`!!document.querySelector('[data-download]')`))) continue
|
|
318
|
+
|
|
300
319
|
// The interactive download, opened from disk.
|
|
301
|
-
const
|
|
302
|
-
const
|
|
320
|
+
const names = downloadNames(post)
|
|
321
|
+
const folder = post.includes('/') ? post.slice(0, post.lastIndexOf('/') + 1) : '' // labels: 'slug.html' for a post
|
|
322
|
+
const download = join(dist, 'posts', post, names.page)
|
|
323
|
+
const agentFile = join(dist, 'posts', post, names.agent)
|
|
303
324
|
for (const f of [download, agentFile]) if (existsSync(f)) files[relative(dist, f)] = { bytes: statSync(f).size, sha256: createHash('sha256').update(readFileSync(f)).digest('hex') }
|
|
304
|
-
const offline = `${
|
|
325
|
+
const offline = `${folder}${names.page} (from disk)`
|
|
305
326
|
await check(offline, 'opens from file://, and every figure hydrates, with no errors', async () => {
|
|
306
327
|
if (!existsSync(download)) throw new Error(`${download} is missing`)
|
|
307
328
|
const islands = await open(pathToFileURL(download).href)
|
|
@@ -327,7 +348,8 @@ for (const file of htmlPages(dist)) {
|
|
|
327
348
|
const frame = `document.querySelector('#slides iframe')`
|
|
328
349
|
await page.evaluate(`document.dispatchEvent(new KeyboardEvent('keydown', { key: 's', bubbles: true }))`)
|
|
329
350
|
await page.waitFor(`${frame} && !document.getElementById('slides').hidden`, { timeout: 5000, what: 'the deck frame to open' })
|
|
330
|
-
|
|
351
|
+
// A deck with no figures passes once its frame has loaded.
|
|
352
|
+
await page.waitFor(`(() => { const d = ${frame}.contentDocument; const islands = d && d.readyState === 'complete' && d.querySelector('.deck') && [...d.querySelectorAll('astro-island')]; return islands && islands.every((el) => !el.hasAttribute('ssr')) })()`, { timeout: 30000, what: 'the deck figures to hydrate' })
|
|
331
353
|
const figures = await page.evaluate(`${frame}.contentDocument.querySelectorAll('astro-island').length`)
|
|
332
354
|
const video = await page.waitFor(`(() => { const v = ${frame}.contentDocument.querySelector('video'); return !v ? 'no video' : v.readyState >= 1 && !v.error ? 'duration ' + v.duration.toFixed(1) + ' s' : '' })()`, { timeout: 20000, what: 'the deck video to load' })
|
|
333
355
|
await page.evaluate(`${frame}.contentDocument.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))`)
|
|
@@ -338,7 +360,7 @@ for (const file of htmlPages(dist)) {
|
|
|
338
360
|
}
|
|
339
361
|
|
|
340
362
|
// The agent download: text only, one description per figure, every equation with its TeX.
|
|
341
|
-
await check(`${
|
|
363
|
+
await check(`${folder}${names.agent}`, 'has no scripts, describes every figure, and keeps the TeX of every equation', () => {
|
|
342
364
|
const agent = readFileSync(agentFile, 'utf8')
|
|
343
365
|
const html = readFileSync(file, 'utf8')
|
|
344
366
|
const count = (s, pattern) => (s.match(pattern) ?? []).length
|
package/editor/client.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
// a figure, a demo note), add one to the selection, draw a box
|
|
8
8
|
// around several on the slide's background
|
|
9
9
|
// ⌘+click, double-click a figure select an element inside a block, such as a figure's label;
|
|
10
|
-
// Esc (or Shift+Enter) goes back out to the block
|
|
10
|
+
// Esc (or Shift+Enter) goes back out to the block, and Enter opens
|
|
11
|
+
// its source, as ⌘⇧+click does (bloggie/jump/)
|
|
11
12
|
// Option+click use the figure under the pointer as a reader does
|
|
12
13
|
// drag move; it snaps to where it started and to the stage's center
|
|
13
14
|
// lines (hold ⌘ to place it freely)
|
|
@@ -29,9 +30,12 @@
|
|
|
29
30
|
// ⌘D, Delete, ⌘A duplicate, delete, select every block of the slide
|
|
30
31
|
// Tab, Shift+Tab next, previous block
|
|
31
32
|
// ⌘Z, ⌘⇧Z undo, redo (the dev server keeps the steps, across reloads)
|
|
33
|
+
// ⌘S save now: the Markdown being edited, a typed size, and a change of
|
|
34
|
+
// CSS still in its pause; the browser does not save the page
|
|
32
35
|
//
|
|
33
|
-
// The column on the left shows every slide (panel.js): click one to show it
|
|
34
|
-
// the slide and Delete deletes it, as do the buttons
|
|
36
|
+
// The column on the left shows every slide (panel.js): click one to show it, drag one to move its
|
|
37
|
+
// slide. There ⌘↑ ⌘↓ move the slide, and ⌘D duplicates it and Delete deletes it, as do the buttons
|
|
38
|
+
// at the column's top for the slide on the stage.
|
|
35
39
|
//
|
|
36
40
|
// A change of CSS is sent to the dev server (integration.js), which writes it to slides.mdx; the
|
|
37
41
|
// page shows it already. A change of text, or of the blocks or slides, the page draws from the
|
|
@@ -45,7 +49,7 @@ import { fetchRender, reconcile } from './patch.js'
|
|
|
45
49
|
import { hex, pickColor } from './eyedropper.js'
|
|
46
50
|
|
|
47
51
|
const STAGE = { width: 1600, height: 900 }
|
|
48
|
-
const PROTOCOL =
|
|
52
|
+
const PROTOCOL = 4 // integration.js's: the dev server's half must be as new as this file
|
|
49
53
|
const ENDPOINT = `${import.meta.env.BASE_URL.replace(/\/?$/, '/')}__slide-editor`
|
|
50
54
|
const MANAGED = ['translate', 'width', 'max-width', 'font-family', 'font-size', 'font-weight', 'font-style', 'text-align', 'color', 'fill', 'z-index', 'position', 'display']
|
|
51
55
|
const COLORS = [
|
|
@@ -479,10 +483,14 @@ export function initEditor(deck) {
|
|
|
479
483
|
onPick: (i) => { select([]); location.hash = `#${i + 1}` },
|
|
480
484
|
onDuplicate: (i) => slideEdit('duplicate-slide', i),
|
|
481
485
|
onDelete: (i) => slideEdit('delete-slide', i),
|
|
486
|
+
onMove: (from, to) => {
|
|
487
|
+
select([])
|
|
488
|
+
structural({ type: 'move-slide', slide: from, to }, (data) => panel.focus(data.slide), rebuildPanel)
|
|
489
|
+
},
|
|
482
490
|
current: activeIndex,
|
|
483
491
|
})
|
|
484
492
|
let panel = makePanel()
|
|
485
|
-
// After slides were added or
|
|
493
|
+
// After slides were added, removed or moved: a new list, shown if editing is on.
|
|
486
494
|
function rebuildPanel() {
|
|
487
495
|
panel.hide()
|
|
488
496
|
panel = makePanel()
|
|
@@ -636,13 +644,15 @@ export function initEditor(deck) {
|
|
|
636
644
|
styleWords({ color: withAlpha(base, Number(opacityInput.value)) }, range)
|
|
637
645
|
}, COMMIT_DELAY)
|
|
638
646
|
})
|
|
647
|
+
function commitSize() {
|
|
648
|
+
const value = clamp(round(Number(sizeInput.value)), 6, 400)
|
|
649
|
+
if (value) setEach(() => ({ 'font-size': `${value}px` }), true)
|
|
650
|
+
sizeInput.blur()
|
|
651
|
+
}
|
|
639
652
|
sizeInput.addEventListener('keydown', (event) => {
|
|
640
653
|
event.stopPropagation()
|
|
641
|
-
if (event.key === 'Enter' && targets().length)
|
|
642
|
-
|
|
643
|
-
if (value) setEach(() => ({ 'font-size': `${value}px` }), true)
|
|
644
|
-
sizeInput.blur()
|
|
645
|
-
} else if (event.key === 'Escape') sizeInput.blur()
|
|
654
|
+
if (event.key === 'Enter' && targets().length) commitSize()
|
|
655
|
+
else if (event.key === 'Escape') sizeInput.blur()
|
|
646
656
|
})
|
|
647
657
|
|
|
648
658
|
// --- selection ---------------------------------------------------------------------------------
|
|
@@ -1201,6 +1211,22 @@ export function initEditor(deck) {
|
|
|
1201
1211
|
box.querySelector('[data-act="save"]').addEventListener('click', saveText)
|
|
1202
1212
|
}
|
|
1203
1213
|
|
|
1214
|
+
// ⌘S: save what is not in slides.mdx yet. Every other edit was written when it was made.
|
|
1215
|
+
function saveNow(target) {
|
|
1216
|
+
if (editor) return saveText()
|
|
1217
|
+
if (target === sizeInput && targets().length) commitSize()
|
|
1218
|
+
if (pending.size) return flush()
|
|
1219
|
+
if (statusEl.dataset.kind !== 'busy') setStatus('Saved: every edit is in slides.mdx', 'ok')
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
// Enter on an element inside a block: open the line that writes it (a figure's .svelte, or the
|
|
1223
|
+
// deck's Markdown), through jump to source.
|
|
1224
|
+
function jumpToSource(el) {
|
|
1225
|
+
const r = el.getBoundingClientRect()
|
|
1226
|
+
const ask = new CustomEvent('bloggie:jump', { cancelable: true, detail: { target: el, x: r.left + r.width / 2, y: r.top + r.height / 2 } })
|
|
1227
|
+
if (window.dispatchEvent(ask)) setStatus('Jump to source is not on in this dev server', 'error')
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1204
1230
|
function closeEditor() {
|
|
1205
1231
|
editor?.panel.remove()
|
|
1206
1232
|
editor = null
|
|
@@ -1440,6 +1466,11 @@ export function initEditor(deck) {
|
|
|
1440
1466
|
const code = event.code
|
|
1441
1467
|
const mod = event.metaKey || event.ctrlKey
|
|
1442
1468
|
const alt = event.altKey
|
|
1469
|
+
if (on && mod && !alt && code === 'KeyS') {
|
|
1470
|
+
event.preventDefault()
|
|
1471
|
+
event.stopPropagation()
|
|
1472
|
+
return saveNow(event.target)
|
|
1473
|
+
}
|
|
1443
1474
|
if (picking || editor || typing(event.target)) return
|
|
1444
1475
|
// The palette's opacity slider keeps its arrow keys; Esc still closes the palette.
|
|
1445
1476
|
if (event.target instanceof Element && event.target.closest('.se-palette') && event.key !== 'Escape') return
|
|
@@ -1476,6 +1507,7 @@ export function initEditor(deck) {
|
|
|
1476
1507
|
const moves = { ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, -step], ArrowDown: [0, step] }
|
|
1477
1508
|
if (moves[key] && !mod && !alt) { handled(); return nudge(...moves[key]) }
|
|
1478
1509
|
if (key === 'Enter' && event.shiftKey && inner) { handled(); return select([inner.block]) }
|
|
1510
|
+
if (key === 'Enter' && !mod && inner) { handled(); return jumpToSource(inner.el) }
|
|
1479
1511
|
if (key === 'Enter' && !mod && !inner && selection.length === 1) { handled(); return openEditor(primary()) }
|
|
1480
1512
|
if ((key === 'Delete' || key === 'Backspace') && !mod) { handled(); return removeSelection() }
|
|
1481
1513
|
if (mod && !alt && code === 'KeyD') { handled(); return inner ? undefined : duplicateSelection() }
|
package/editor/editor.css
CHANGED
|
@@ -401,6 +401,44 @@
|
|
|
401
401
|
border-right: 1px solid var(--rule);
|
|
402
402
|
font: 12px/1 var(--sans);
|
|
403
403
|
color: var(--text-muted);
|
|
404
|
+
user-select: none;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.se-panel.se-dragging,
|
|
408
|
+
.se-panel.se-dragging .se-slide {
|
|
409
|
+
cursor: grabbing;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.se-panel.se-dragging .se-slide .se-slide-tools {
|
|
413
|
+
display: none;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* A dragged thumbnail: its place in the list is dimmed, a copy follows the pointer, and a line
|
|
417
|
+
shows where the slide goes, above the copy; the list's head stays above both. */
|
|
418
|
+
.se-slide.se-dragged {
|
|
419
|
+
opacity: 0.35;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.se-slide-frame.se-ghost {
|
|
423
|
+
position: fixed;
|
|
424
|
+
left: 0;
|
|
425
|
+
top: 0;
|
|
426
|
+
z-index: 2;
|
|
427
|
+
pointer-events: none;
|
|
428
|
+
opacity: 0.75;
|
|
429
|
+
box-shadow: 0 0 0 2px var(--series-1), 0 6px 18px rgb(0 0 0 / 25%);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.se-drop {
|
|
433
|
+
position: absolute;
|
|
434
|
+
left: 26px;
|
|
435
|
+
right: 8px;
|
|
436
|
+
height: 3px;
|
|
437
|
+
margin-top: -1.5px;
|
|
438
|
+
z-index: 3;
|
|
439
|
+
border-radius: 2px;
|
|
440
|
+
background: var(--series-1);
|
|
441
|
+
pointer-events: none;
|
|
404
442
|
}
|
|
405
443
|
|
|
406
444
|
.se-slide {
|
|
@@ -494,7 +532,7 @@
|
|
|
494
532
|
.se-panel-head {
|
|
495
533
|
position: sticky;
|
|
496
534
|
top: 0;
|
|
497
|
-
z-index:
|
|
535
|
+
z-index: 4;
|
|
498
536
|
display: flex;
|
|
499
537
|
align-items: center;
|
|
500
538
|
gap: 4px;
|
package/editor/integration.js
CHANGED
|
@@ -19,7 +19,7 @@ const ENDPOINT = '/__slide-editor'
|
|
|
19
19
|
// The version of the requests and answers between the page (client.js) and this server. The dev
|
|
20
20
|
// server loads this file when it starts, but the page's code is new on every load: after a change
|
|
21
21
|
// here, the page tells the author to restart `npm run dev` rather than work with an older server.
|
|
22
|
-
export const PROTOCOL =
|
|
22
|
+
export const PROTOCOL = 4
|
|
23
23
|
const HISTORY = 200 // undo steps kept per file
|
|
24
24
|
|
|
25
25
|
const version = (text) => createHash('sha256').update(text).digest('hex').slice(0, 16)
|
package/editor/panel.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// The slide editor's overview (client.js): every slide of the deck as a thumbnail in a column on the
|
|
2
|
-
// left, as in a slide editor. Click one to show it.
|
|
3
|
-
//
|
|
2
|
+
// left, as in a slide editor. Click one to show it. Drag one to move its slide: a line shows where it
|
|
3
|
+
// goes, the list scrolls when the pointer is near its top or bottom, and Esc cancels. With a
|
|
4
|
+
// thumbnail focused, ↑ ↓ move between slides, ⌘↑ ⌘↓ move the slide up or down, ⌘⇧↑ ⌘⇧↓ to the
|
|
5
|
+
// start or the end, ⌘D duplicates the slide and Delete deletes it; each thumbnail also has buttons
|
|
6
|
+
// for the last two.
|
|
4
7
|
//
|
|
5
8
|
// A thumbnail is a copy of the slide's elements, scaled down: it is drawn once when it scrolls into
|
|
6
9
|
// view, and again when the editor changes the slide. It is a picture only. Its figures are copies of
|
|
@@ -9,6 +12,8 @@
|
|
|
9
12
|
|
|
10
13
|
const STAGE_WIDTH = 1600
|
|
11
14
|
const THUMB_WIDTH = 176 // px on screen
|
|
15
|
+
const DRAG_START = 5 // px the pointer moves before a press on a thumbnail becomes a drag
|
|
16
|
+
const SCROLL_EDGE = 48 // px from the list's top or bottom where a drag scrolls it
|
|
12
17
|
|
|
13
18
|
// A copy of a slide that shows it and runs nothing.
|
|
14
19
|
function snapshot(slide) {
|
|
@@ -49,7 +54,7 @@ export function stillCopy(element) {
|
|
|
49
54
|
return copy
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
export function createPanel({ deck, slides, onPick, onDuplicate, onDelete, current: shown }) {
|
|
57
|
+
export function createPanel({ deck, slides, onPick, onDuplicate, onDelete, onMove, current: shown }) {
|
|
53
58
|
const panel = document.createElement('aside')
|
|
54
59
|
panel.className = 'se-panel'
|
|
55
60
|
panel.setAttribute('aria-label', 'Slides')
|
|
@@ -87,10 +92,102 @@ export function createPanel({ deck, slides, onPick, onDuplicate, onDelete, curre
|
|
|
87
92
|
for (const entry of entries) if (entry.isIntersecting && !drawn.has(Number(entry.target.dataset.index))) draw(Number(entry.target.dataset.index))
|
|
88
93
|
}, { root: panel, rootMargin: '200px 0px' })
|
|
89
94
|
|
|
95
|
+
// Drag a thumbnail to move its slide. `gap` is where it would go: before thumbnail `gap`, or after
|
|
96
|
+
// the last one. A drop sends one move; the list is drawn again after it, so this list takes no
|
|
97
|
+
// second drag.
|
|
98
|
+
const line = document.createElement('div')
|
|
99
|
+
line.className = 'se-drop'
|
|
100
|
+
let drag = null // { from, pointerId, x, y (where it started), clientY, moving, ghost, offset, scrolling }
|
|
101
|
+
let moved = false
|
|
102
|
+
let dropped = false // a drag just ended: the click that follows it picks no slide
|
|
103
|
+
const gapAt = (clientY) => {
|
|
104
|
+
const i = items.findIndex((item) => { const r = item.getBoundingClientRect(); return clientY < r.top + r.height / 2 })
|
|
105
|
+
return i < 0 ? items.length : i
|
|
106
|
+
}
|
|
107
|
+
// The move a drop at `gap` makes, or null where the slide would stay.
|
|
108
|
+
const target = (gap) => (gap === drag.from || gap === drag.from + 1 ? null : gap > drag.from ? gap - 1 : gap)
|
|
109
|
+
const place = () => {
|
|
110
|
+
const gap = gapAt(drag.clientY)
|
|
111
|
+
if (target(gap) === null) return line.remove()
|
|
112
|
+
const below = items[gap]
|
|
113
|
+
const above = items[gap - 1]
|
|
114
|
+
line.style.top = `${below ? below.offsetTop : above.offsetTop + above.offsetHeight}px`
|
|
115
|
+
if (!line.isConnected) panel.append(line)
|
|
116
|
+
}
|
|
117
|
+
const autoscroll = () => {
|
|
118
|
+
if (!drag?.moving) return
|
|
119
|
+
const r = panel.getBoundingClientRect()
|
|
120
|
+
const top = head.getBoundingClientRect().bottom
|
|
121
|
+
const dy = drag.clientY < top + SCROLL_EDGE ? -(top + SCROLL_EDGE - drag.clientY) : drag.clientY > r.bottom - SCROLL_EDGE ? drag.clientY - (r.bottom - SCROLL_EDGE) : 0
|
|
122
|
+
if (dy) { panel.scrollTop += dy / 3; place() }
|
|
123
|
+
drag.scrolling = requestAnimationFrame(autoscroll)
|
|
124
|
+
}
|
|
125
|
+
const endDrag = () => {
|
|
126
|
+
if (!drag) return
|
|
127
|
+
cancelAnimationFrame(drag.scrolling)
|
|
128
|
+
drag.ghost?.remove()
|
|
129
|
+
line.remove()
|
|
130
|
+
items[drag.from].classList.remove('se-dragged')
|
|
131
|
+
panel.classList.remove('se-dragging')
|
|
132
|
+
window.removeEventListener('keydown', onEscape, true)
|
|
133
|
+
drag = null
|
|
134
|
+
}
|
|
135
|
+
const onEscape = (event) => {
|
|
136
|
+
if (event.key !== 'Escape') return
|
|
137
|
+
event.preventDefault()
|
|
138
|
+
event.stopPropagation()
|
|
139
|
+
endDrag()
|
|
140
|
+
}
|
|
141
|
+
panel.addEventListener('pointerdown', (event) => {
|
|
142
|
+
const item = event.target.closest('.se-slide')
|
|
143
|
+
if (!item || event.button !== 0 || event.target.closest('button') || moved) return
|
|
144
|
+
drag = { from: Number(item.dataset.index), pointerId: event.pointerId, x: event.clientX, y: event.clientY, moving: false }
|
|
145
|
+
})
|
|
146
|
+
panel.addEventListener('pointermove', (event) => {
|
|
147
|
+
if (!drag || event.pointerId !== drag.pointerId) return
|
|
148
|
+
drag.clientY = event.clientY
|
|
149
|
+
if (!drag.moving) {
|
|
150
|
+
if (Math.hypot(event.clientX - drag.x, event.clientY - drag.y) < DRAG_START) return
|
|
151
|
+
drag.moving = true
|
|
152
|
+
panel.setPointerCapture(event.pointerId)
|
|
153
|
+
const item = items[drag.from]
|
|
154
|
+
item.classList.add('se-dragged')
|
|
155
|
+
panel.classList.add('se-dragging')
|
|
156
|
+
const frame = item.querySelector('.se-slide-frame')
|
|
157
|
+
const r = frame.getBoundingClientRect()
|
|
158
|
+
drag.ghost = frame.cloneNode(true)
|
|
159
|
+
drag.ghost.classList.add('se-ghost')
|
|
160
|
+
drag.offset = [drag.x - r.left, drag.y - r.top]
|
|
161
|
+
panel.append(drag.ghost)
|
|
162
|
+
window.addEventListener('keydown', onEscape, true)
|
|
163
|
+
drag.scrolling = requestAnimationFrame(autoscroll)
|
|
164
|
+
}
|
|
165
|
+
drag.ghost.style.translate = `${event.clientX - drag.offset[0]}px ${event.clientY - drag.offset[1]}px`
|
|
166
|
+
place()
|
|
167
|
+
})
|
|
168
|
+
panel.addEventListener('pointerup', (event) => {
|
|
169
|
+
if (!drag || event.pointerId !== drag.pointerId) return
|
|
170
|
+
const to = drag.moving ? target(gapAt(event.clientY)) : null
|
|
171
|
+
const { from, moving } = drag
|
|
172
|
+
endDrag()
|
|
173
|
+
if (!moving) return
|
|
174
|
+
dropped = true
|
|
175
|
+
setTimeout(() => { dropped = false })
|
|
176
|
+
if (to === null) return
|
|
177
|
+
moved = true
|
|
178
|
+
// Show the order at once; the editor draws the list again from the new render.
|
|
179
|
+
const item = items[from]
|
|
180
|
+
const others = items.filter((x) => x !== item)
|
|
181
|
+
if (to < others.length) others[to].before(item)
|
|
182
|
+
else others.at(-1).after(item)
|
|
183
|
+
onMove(from, to)
|
|
184
|
+
})
|
|
185
|
+
panel.addEventListener('pointercancel', endDrag)
|
|
186
|
+
|
|
90
187
|
let current = -1
|
|
91
188
|
panel.addEventListener('click', (event) => {
|
|
92
189
|
const item = event.target.closest('.se-slide')
|
|
93
|
-
if (!item) return
|
|
190
|
+
if (!item || dropped) return
|
|
94
191
|
const i = Number(item.dataset.index)
|
|
95
192
|
const act = event.target.closest('button[data-act]')?.dataset.act
|
|
96
193
|
if (act === 'duplicate') return onDuplicate(i)
|
|
@@ -101,8 +198,14 @@ export function createPanel({ deck, slides, onPick, onDuplicate, onDelete, curre
|
|
|
101
198
|
panel.addEventListener('keydown', (event) => {
|
|
102
199
|
const mod = event.metaKey || event.ctrlKey
|
|
103
200
|
const handled = () => { event.preventDefault(); event.stopPropagation() }
|
|
104
|
-
|
|
105
|
-
|
|
201
|
+
const up = ['ArrowUp', 'ArrowLeft'].includes(event.key)
|
|
202
|
+
const down = ['ArrowDown', 'ArrowRight'].includes(event.key)
|
|
203
|
+
if (mod && (up || down)) {
|
|
204
|
+
handled()
|
|
205
|
+
const to = event.shiftKey ? (up ? 0 : items.length - 1) : current + (up ? -1 : 1)
|
|
206
|
+
if (!moved && current >= 0 && to >= 0 && to < items.length && to !== current) { moved = true; onMove(current, to) }
|
|
207
|
+
} else if (up && current > 0) { handled(); onPick(current - 1); items[current - 1].focus() }
|
|
208
|
+
else if (down && current < items.length - 1) { handled(); onPick(current + 1); items[current + 1].focus() }
|
|
106
209
|
else if ((event.key === 'Delete' || event.key === 'Backspace') && !mod) { handled(); onDelete(current) }
|
|
107
210
|
else if (mod && event.code === 'KeyD') { handled(); onDuplicate(current) }
|
|
108
211
|
else if (event.key.startsWith('Arrow')) handled()
|
|
@@ -115,6 +218,7 @@ export function createPanel({ deck, slides, onPick, onDuplicate, onDelete, curre
|
|
|
115
218
|
items.forEach((item) => seen.observe(item))
|
|
116
219
|
},
|
|
117
220
|
hide() {
|
|
221
|
+
endDrag()
|
|
118
222
|
seen.disconnect()
|
|
119
223
|
panel.remove()
|
|
120
224
|
},
|
package/editor/patch.js
CHANGED
|
@@ -175,7 +175,7 @@ function renumber(slide, to, ids) {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// Swap the new render's changes into the deck. Returns each kept element's old id → new id, the new
|
|
178
|
-
// indexes of the slides drawn again, and whether
|
|
178
|
+
// indexes of the slides drawn again, and whether slides were added, removed or moved.
|
|
179
179
|
export function reconcile(deck, was, is, doc) {
|
|
180
180
|
const freshDeck = doc.querySelector('.deck')
|
|
181
181
|
if (!freshDeck) throw new Error('the new render has no deck')
|
|
@@ -188,7 +188,8 @@ export function reconcile(deck, was, is, doc) {
|
|
|
188
188
|
const ids = new Map()
|
|
189
189
|
const drawn = []
|
|
190
190
|
let previous = null
|
|
191
|
-
|
|
191
|
+
const ops = align(was.slides.map((s) => s.hash), is.slides.map((s) => s.hash))
|
|
192
|
+
for (const { op, a, b } of ops) {
|
|
192
193
|
if (op === 'keep') {
|
|
193
194
|
renumber(live[a], b, ids)
|
|
194
195
|
previous = live[a]
|
|
@@ -211,5 +212,5 @@ export function reconcile(deck, was, is, doc) {
|
|
|
211
212
|
previous = slide
|
|
212
213
|
} else live[a].remove()
|
|
213
214
|
}
|
|
214
|
-
return { ids, drawn, recount:
|
|
215
|
+
return { ids, drawn, recount: ops.some(({ op }) => op === 'insert' || op === 'remove') }
|
|
215
216
|
}
|