@altano/use-toc-visible-sections 4.0.1 → 4.0.3
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 +26 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +21 -20
package/README.md
CHANGED
|
@@ -59,11 +59,35 @@ export default () => (
|
|
|
59
59
|
<article>
|
|
60
60
|
<section>
|
|
61
61
|
<h1 id="heading1">Lorem ipsum dolor sit amet.</h1>
|
|
62
|
-
<p>
|
|
62
|
+
<p>
|
|
63
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Eius libero
|
|
64
|
+
autem in? Dicta explicabo cum laudantium voluptas voluptate quaerat
|
|
65
|
+
inventore eos? Facilis, quae, doloribus dolorum doloremque voluptatum,
|
|
66
|
+
labore omnis ipsum architecto debitis quibusdam quam recusandae delectus
|
|
67
|
+
nesciunt voluptate iusto sequi saepe voluptatibus quis officiis illo
|
|
68
|
+
dolor hic. Laudantium harum, quas tempora nobis doloremque odit sint
|
|
69
|
+
fugit ea non beatae maxime enim odio debitis ullam delectus minima
|
|
70
|
+
assumenda expedita. Laboriosam magni, voluptate harum officiis,
|
|
71
|
+
voluptatibus illum porro minima architecto inventore eaque iusto a,
|
|
72
|
+
praesentium nihil cum veritatis sunt! Incidunt debitis dignissimos hic
|
|
73
|
+
soluta alias nisi asperiores nulla non? Corrupti, perspiciatis ducimus.
|
|
74
|
+
</p>
|
|
63
75
|
</section>
|
|
64
76
|
<section>
|
|
65
77
|
<h1 id="heading2">Dignissimos aliquam dolorum</h1>
|
|
66
|
-
<p>
|
|
78
|
+
<p>
|
|
79
|
+
Quis veniam qui quas! Repellendus tenetur nemo explicabo laborum cumque
|
|
80
|
+
similique dicta cum ab quae ducimus aliquam ut animi sequi accusamus,
|
|
81
|
+
dolorem perspiciatis quis doloremque, et dolorum voluptatem sunt, hic
|
|
82
|
+
quidem nihil eveniet! Tenetur, consequatur nemo possimus sint quo itaque
|
|
83
|
+
accusantium, voluptatibus facilis eveniet earum voluptas veniam quidem
|
|
84
|
+
minima dolore? Aspernatur adipisci iste expedita exercitationem pariatur
|
|
85
|
+
ex tenetur error doloribus nihil maxime eos repudiandae dolore omnis
|
|
86
|
+
nesciunt, delectus illum, aperiam fugit blanditiis ipsa alias quaerat
|
|
87
|
+
cupiditate eum numquam! Sed, ipsum. Eaque animi doloremque
|
|
88
|
+
exercitationem amet eum, accusamus deserunt in atque, excepturi sunt,
|
|
89
|
+
unde pariatur consequuntur repellendus aut quas sit ratione!
|
|
90
|
+
</p>
|
|
67
91
|
</section>
|
|
68
92
|
</article>
|
|
69
93
|
);
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,8 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
|
|
4
4
|
//#region src/useTocVisibleSections.tsx
|
|
5
5
|
function useVisibilityOfTarget(href) {
|
|
6
|
-
|
|
7
|
-
return [...visibleElements].some((s) => s.querySelector(`:scope > ${href}`));
|
|
6
|
+
return [...useVisibleElements()].some((s) => s.querySelector(`:scope > ${href}`));
|
|
8
7
|
}
|
|
9
8
|
function TocVisibleSectionObserver(options) {
|
|
10
9
|
return /* @__PURE__ */ jsx(VisibleElementObserver, {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/useTocVisibleSections.tsx"],"sourcesContent":["import {\n VisibleElementObserver,\n useVisibleElements,\n type ChildOptions,\n} from \"@altano/use-visible-elements\";\n\nexport function useVisibilityOfTarget(href: string): boolean {\n const visibleElements = useVisibleElements();\n return [...visibleElements].some((s) => s.querySelector(`:scope > ${href}`));\n}\n\ntype Options = ChildOptions & {\n selector?: string;\n intersectionOptions?: IntersectionObserverInit;\n};\n\nexport function TocVisibleSectionObserver(\n options: Options,\n): ReturnType<typeof VisibleElementObserver> {\n return <VisibleElementObserver selector=\"article section\" {...options} />;\n}\n"],"mappings":";;;;AAMA,SAAgB,sBAAsB,MAAuB;CAE3D,OAAO,CAAC,GADgB,mBACC,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,cAAc,YAAY,MAAM,CAAC;AAC7E;AAOA,SAAgB,0BACd,SAC2C;CAC3C,OAAO,oBAAC,wBAAD;EAAwB,UAAS;EAAkB,GAAI;CAAU;AAC1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altano/use-toc-visible-sections",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Intersection-Observer-based Table of Contents Scroll Spy React Hook",
|
|
5
5
|
"homepage": "https://github.com/altano/npm-packages/tree/main/packages/use-toc-visible-sections",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"author": {
|
|
13
13
|
"name": "Alan Norbauer",
|
|
14
|
-
"email": "
|
|
14
|
+
"email": "alan@norbauer.com",
|
|
15
15
|
"url": "https://alan.norbauer.com"
|
|
16
16
|
},
|
|
17
17
|
"sideEffects": false,
|
|
@@ -24,24 +24,25 @@
|
|
|
24
24
|
"dist/**/*.d.ts"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@altano/use-visible-elements": "4.0.
|
|
27
|
+
"@altano/use-visible-elements": "4.0.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@arethetypeswrong/cli": "^0.
|
|
31
|
-
"@playwright/test": "1.
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"@types/react": "^19.
|
|
34
|
-
"@types/react-dom": "^19.
|
|
30
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
31
|
+
"@playwright/test": "1.59.1",
|
|
32
|
+
"@types/node": "^26.1.1",
|
|
33
|
+
"@types/react": "^19.2.17",
|
|
34
|
+
"@types/react-dom": "^19.2.3",
|
|
35
35
|
"depcheck": "^1.4.7",
|
|
36
|
-
"eslint": "^9.
|
|
37
|
-
"prettier": "
|
|
38
|
-
"react": "^19.
|
|
39
|
-
"react-dom": "^19.
|
|
40
|
-
"tsdown": "^0.
|
|
41
|
-
"typescript": "^
|
|
42
|
-
"vite": "^
|
|
43
|
-
"vitest": "^
|
|
36
|
+
"eslint": "^9.39.5",
|
|
37
|
+
"prettier": "3.9.6",
|
|
38
|
+
"react": "^19.2.8",
|
|
39
|
+
"react-dom": "^19.2.8",
|
|
40
|
+
"tsdown": "^0.22.13",
|
|
41
|
+
"typescript": "^6.0.3",
|
|
42
|
+
"vite": "^8.1.5",
|
|
43
|
+
"vitest": "^4.1.10",
|
|
44
44
|
"@altano/build-config": "0.0.1",
|
|
45
|
+
"@altano/testing": "0.0.1",
|
|
45
46
|
"@altano/tsconfig": "0.0.1"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
@@ -51,19 +52,19 @@
|
|
|
51
52
|
"access": "public"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
|
-
"build": "tsdown
|
|
55
|
+
"build": "tsdown",
|
|
55
56
|
"check:exports": "attw --pack . --profile esm-only --quiet",
|
|
56
57
|
"check:types:src": "tsc --noEmit",
|
|
57
58
|
"check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
|
|
58
59
|
"check:unused-dependencies": "depcheck",
|
|
59
60
|
"clean": "rm -rf .turbo && rm -rf .tsbuildinfo && rm -rf node_modules && rm -rf dist",
|
|
60
61
|
"dev": "pnpm run build --watch",
|
|
61
|
-
"format": "prettier --check
|
|
62
|
-
"format:fix": "prettier --write
|
|
62
|
+
"format": "prettier --check .",
|
|
63
|
+
"format:fix": "prettier --write .",
|
|
63
64
|
"lint": "eslint",
|
|
64
65
|
"lint:fix": "TIMING=1 pnpm lint --fix",
|
|
65
66
|
"lint:timing": "TIMING=1 pnpm lint",
|
|
66
|
-
"test:e2e": "playwright test",
|
|
67
|
+
"test:e2e": "NODE_OPTIONS='--no-experimental-strip-types' playwright test",
|
|
67
68
|
"test:e2e:server": "vite --strictPort --port 4727 ./tests/e2e",
|
|
68
69
|
"test:e2e:ui": "playwright test --ui"
|
|
69
70
|
}
|