@altano/use-toc-visible-sections 3.0.0 → 4.0.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/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
- import { ChildOptions, VisibleElementObserver } from '@altano/use-visible-elements';
1
+ import { ChildOptions, VisibleElementObserver } from "@altano/use-visible-elements";
2
2
 
3
+ //#region src/useTocVisibleSections.d.ts
3
4
  declare function useVisibilityOfTarget(href: string): boolean;
4
5
  type Options = ChildOptions & {
5
- selector?: string;
6
- intersectionOptions?: IntersectionObserverInit;
6
+ selector?: string;
7
+ intersectionOptions?: IntersectionObserverInit;
7
8
  };
8
9
  declare function TocVisibleSectionObserver(options: Options): ReturnType<typeof VisibleElementObserver>;
9
10
 
11
+ //#endregion
10
12
  export { TocVisibleSectionObserver, useVisibilityOfTarget };
13
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,34 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
-
18
- // src/useTocVisibleSections.tsx
19
- import {
20
- VisibleElementObserver,
21
- useVisibleElements
22
- } from "@altano/use-visible-elements";
1
+ import { VisibleElementObserver, useVisibleElements } from "@altano/use-visible-elements";
23
2
  import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/useTocVisibleSections.tsx
24
5
  function useVisibilityOfTarget(href) {
25
- const visibleElements = useVisibleElements();
26
- return [...visibleElements].some((s) => s.querySelector(`:scope > ${href}`));
6
+ const visibleElements = useVisibleElements();
7
+ return [...visibleElements].some((s) => s.querySelector(`:scope > ${href}`));
27
8
  }
28
9
  function TocVisibleSectionObserver(options) {
29
- return /* @__PURE__ */ jsx(VisibleElementObserver, __spreadValues({ selector: "article section" }, options));
10
+ return /* @__PURE__ */ jsx(VisibleElementObserver, {
11
+ selector: "article section",
12
+ ...options
13
+ });
30
14
  }
31
- export {
32
- TocVisibleSectionObserver,
33
- useVisibilityOfTarget
34
- };
15
+
16
+ //#endregion
17
+ export { TocVisibleSectionObserver, useVisibilityOfTarget };
18
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altano/use-toc-visible-sections",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
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": {
@@ -23,11 +23,11 @@
23
23
  "dist/**/*.d.ts"
24
24
  ],
25
25
  "dependencies": {
26
- "@altano/use-visible-elements": "3.0.0"
26
+ "@altano/use-visible-elements": "4.0.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@arethetypeswrong/cli": "^0.17.4",
30
- "@playwright/test": "1.47.0",
30
+ "@playwright/test": "1.51.1",
31
31
  "@types/node": "^22.13.10",
32
32
  "@types/react": "^19.0.12",
33
33
  "@types/react-dom": "^19.0.4",
@@ -36,11 +36,12 @@
36
36
  "prettier": "^3.5.3",
37
37
  "react": "^19.1.0",
38
38
  "react-dom": "^19.1.0",
39
+ "tsdown": "^0.12.3",
39
40
  "typescript": "^5.8.2",
40
- "vite": "^6.2.4",
41
- "vitest": "^3.1.1",
42
- "@altano/build-config": "0.0.0",
43
- "@altano/tsconfig": "0.0.0"
41
+ "vite": "^6.2.6",
42
+ "vitest": "^3.1.4",
43
+ "@altano/build-config": "0.0.1",
44
+ "@altano/tsconfig": "0.0.1"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "react": "19.x.x"
@@ -49,8 +50,8 @@
49
50
  "access": "public"
50
51
  },
51
52
  "scripts": {
52
- "build": "tsup --config build-config/tsup.config.browser.ts",
53
- "check:exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
53
+ "build": "tsdown --config ../build-config/tsdown.config.browser.ts",
54
+ "check:exports": "attw --pack . --profile esm-only --quiet",
54
55
  "check:types:src": "tsc --noEmit",
55
56
  "check:types:test": "tsc --noEmit --project ./tests/tsconfig.json",
56
57
  "check:unused-dependencies": "depcheck",