preact-sigma 6.3.0 → 6.3.1

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.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SigmaRef, c as castProtected, d as sigma, f as Draft, g as Cleanup, h as AnyResource, i as SigmaDefinition, l as query, m as typeSymbol, n as ReadableSigma, o as SigmaState, p as Immutable, r as Sigma, s as SigmaTarget, t as Protected, u as setAutoFreeze } from "./sigma-CCBzhGdp.mjs";
1
+ import { a as SigmaRef, c as castProtected, d as sigma, f as Draft, g as Cleanup, h as AnyResource, i as SigmaDefinition, l as query, m as typeSymbol, n as ReadableSigma, o as SigmaState, p as Immutable, r as Sigma, s as SigmaTarget, t as Protected, u as setAutoFreeze } from "./sigma-thcYEnFu.mjs";
2
2
 
3
3
  //#region src/defaults.d.ts
4
4
  /**
@@ -44,7 +44,14 @@ declare function useListener<TTarget extends Listenable, TEvent extends InferEve
44
44
  //#region src/hooks/useSigma.d.ts
45
45
  /** Setup arguments and recreation dependencies for `useSigma(...)`. */
46
46
  type UseSigmaOptions<TSetup extends readonly any[] = any[]> = {
47
- /** Arguments passed to the sigma instance's `onSetup(...)` method. */setup: TSetup | (() => TSetup); /** Dependencies that recreate the sigma instance when they change. */
47
+ /**
48
+ * Arguments passed to the sigma instance's `onSetup(...)` method.
49
+ *
50
+ * Array setup arguments also drive setup cleanup and rerun. Function setup is
51
+ * evaluated for the current setup run, but it does not make captured render
52
+ * values reactive by itself; pass an array when setup inputs should rerun.
53
+ */
54
+ setup: TSetup | (() => TSetup); /** Dependencies that recreate the sigma instance when they change. */
48
55
  deps?: readonly any[];
49
56
  };
50
57
  /** Infers the accepted `useSigma(...)` call shape from a sigma class and its setup parameters. */
@@ -55,7 +62,8 @@ type UseSigmaArgs<T extends Sigma<any>> = T extends {
55
62
  * Creates or reuses a sigma instance for a component and returns its protected consumer view.
56
63
  *
57
64
  * Classes with `onSetup(...)` run setup in an effect and clean it up on unmount,
58
- * so the returned instance does not need a separate `useSetup(...)` call.
65
+ * so the returned instance does not need a separate `useSetup(...)` call. Array
66
+ * setup arguments rerun setup when they change; `deps` recreates the instance.
59
67
  */
60
68
  declare function useSigma<T extends Sigma<any>>(...args: UseSigmaArgs<T>): Protected<T>;
61
69
  //#endregion
@@ -1,4 +1,4 @@
1
- import { n as ReadableSigma, p as Immutable, r as Sigma } from "./sigma-CCBzhGdp.mjs";
1
+ import { n as ReadableSigma, p as Immutable, r as Sigma } from "./sigma-thcYEnFu.mjs";
2
2
 
3
3
  //#region src/persist.d.ts
4
4
  type MaybePromise<T> = T | Promise<T>;
@@ -3,9 +3,14 @@ import { Patch } from "immer";
3
3
 
4
4
  //#region src/internal/utils.d.ts
5
5
  type AnyFunction = (...args: any[]) => any;
6
- /** Function cleanup returned from setup-owned resources. */
6
+ /** Cleanup function returned by setup-owned resources and run during teardown. */
7
7
  type Cleanup = () => void;
8
- /** Cleanup resource returned from setup hooks and disposed during teardown. */
8
+ /**
9
+ * Resource shape accepted from `onSetup(...)` and `useSetup(...)`.
10
+ *
11
+ * Teardown disposes resources in reverse order and accepts cleanup functions,
12
+ * objects with `dispose()`, and objects with `[Symbol.dispose]()`.
13
+ */
9
14
  type AnyResource = Cleanup | {
10
15
  dispose(): void;
11
16
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "preact-sigma",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
4
4
  "keywords": [],
5
5
  "license": "MIT",
6
6
  "author": "Alec Larson",
@@ -24,6 +24,14 @@
24
24
  "import": "./dist/persist.mjs"
25
25
  }
26
26
  },
27
+ "scripts": {
28
+ "build": "tsdown",
29
+ "test": "vitest run",
30
+ "typecheck": "tsc --noEmit --allowImportingTsExtensions",
31
+ "fmt": "oxfmt",
32
+ "lint": "oxlint",
33
+ "prepublishOnly": "pnpm build"
34
+ },
27
35
  "devDependencies": {
28
36
  "@preact/preset-vite": "^2.10.5",
29
37
  "@types/node": "^25.5.0",
@@ -42,11 +50,5 @@
42
50
  "immer": ">=11",
43
51
  "preact": ">=10"
44
52
  },
45
- "scripts": {
46
- "build": "tsdown",
47
- "test": "vitest run",
48
- "typecheck": "tsc --noEmit --allowImportingTsExtensions",
49
- "fmt": "oxfmt",
50
- "lint": "oxlint"
51
- }
52
- }
53
+ "packageManager": "pnpm@11.5.1"
54
+ }