diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 00000000..19ff60d2 Binary files /dev/null and b/bun.lockb differ diff --git a/create-vocs/init.ts b/create-vocs/init.ts index 10a2bf59..1350b6bc 100644 --- a/create-vocs/init.ts +++ b/create-vocs/init.ts @@ -1,8 +1,6 @@ import { dirname, resolve } from 'node:path' import { fileURLToPath } from 'node:url' import { intro, log, outro, text } from '@clack/prompts' -// @ts-expect-error -import { detect } from 'detect-package-manager' import { default as fs } from 'fs-extra' import pc from 'picocolors' diff --git a/package.json b/package.json index 57cd810b..ebd2010f 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "bun-types": "^1.0.6", "fs-extra": "^11.1.1", "globby": "^13.2.2", + "ora": "^7.0.1", "rimraf": "^5.0.5", "simple-git-hooks": "^2.9.0", "typescript": "^5.2.2" diff --git a/src/app/components/Outline.tsx b/src/app/components/Outline.tsx index 63e823e5..1096a97c 100644 --- a/src/app/components/Outline.tsx +++ b/src/app/components/Outline.tsx @@ -106,14 +106,16 @@ export function Outline({ const observer = new IntersectionObserver(([entry]) => { if (!active.current) return - if (entry.isIntersecting) setActiveId(items[items.length - 1].id) - else setActiveId(items[items.length - 2].id) + const lastItemId = items[items.length - 1].id + + if (entry.isIntersecting) setActiveId(lastItemId) + else if (activeId === lastItemId) setActiveId(items[items.length - 2].id) }) observer.observe(document.querySelector('[data-bottom-observer]')!) return () => observer.disconnect() - }, [items]) + }, [activeId, items]) // Intersection observers are a bit unreliable for fast scrolling, // use scroll event listener to sync active item. @@ -151,6 +153,8 @@ export function Outline({ if (items.length === 0) return null + console.log(activeId) + const levelItems = items.filter((item) => item.level === minLevel) return (