preact-sigma 6.2.0 → 6.2.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/README.md +0 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/persist.d.mts +1 -1
- package/dist/persist.mjs +1 -1
- package/dist/{sigma-DEKK3bHd.mjs → sigma-B7kPkW-M.mjs} +5 -4
- package/dist/{sigma-BfaJUPWw.d.mts → sigma-cb2HeDjg.d.mts} +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,4 @@ console.log(counter.doubled); // 2
|
|
|
49
49
|
- Persistence-specific guidance lives in [`docs/persist.md`](./docs/persist.md).
|
|
50
50
|
- Migration guidance from v5 lives in [`docs/migrations/v5-to-v6.md`](./docs/migrations/v5-to-v6.md).
|
|
51
51
|
- Runnable usage patterns live in [`examples/`](./examples/).
|
|
52
|
-
- [`examples/basic-counter.ts`](./examples/basic-counter.ts)
|
|
53
|
-
- [`examples/command-palette.tsx`](./examples/command-palette.tsx)
|
|
54
|
-
- [`examples/external-query-sync.tsx`](./examples/external-query-sync.tsx)
|
|
55
52
|
- Exact exported signatures and public API comments live in `dist/index.d.mts` and `dist/persist.d.mts` after `pnpm build`.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SigmaRef, c as castProtected, d as sigma, f as Draft, h as Cleanup, 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-
|
|
1
|
+
import { a as SigmaRef, c as castProtected, d as sigma, f as Draft, h as Cleanup, 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-cb2HeDjg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/defaults.d.ts
|
|
4
4
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as setAutoFreeze, c as listenersSymbol, i as query, n as SigmaTarget, o as sigma, r as castProtected, s as isPlainObject, t as Sigma } from "./sigma-
|
|
1
|
+
import { a as setAutoFreeze, c as listenersSymbol, i as query, n as SigmaTarget, o as sigma, r as castProtected, s as isPlainObject, t as Sigma } from "./sigma-B7kPkW-M.mjs";
|
|
2
2
|
import { useEffect, useRef } from "preact/hooks";
|
|
3
3
|
//#region src/defaults.ts
|
|
4
4
|
/**
|
package/dist/persist.d.mts
CHANGED
package/dist/persist.mjs
CHANGED
|
@@ -418,22 +418,23 @@ var SigmaTarget = class SigmaTarget extends Sigma {
|
|
|
418
418
|
/** Helpers for observing, accessing, capturing, and replacing committed sigma state. */
|
|
419
419
|
const sigma = /* @__PURE__ */ Object.freeze({
|
|
420
420
|
subscribe: ((instance, keyOrListener, listenerOrOptions) => {
|
|
421
|
+
const source = instance;
|
|
421
422
|
if (typeof keyOrListener === "string") {
|
|
422
|
-
const signal = getStateSignal(
|
|
423
|
+
const signal = getStateSignal(source, keyOrListener);
|
|
423
424
|
if (!signal) throw new Error(`[preact-sigma] Property named "${keyOrListener}" is not signal-backed.`);
|
|
424
425
|
return signal.subscribe(listenerOrOptions);
|
|
425
426
|
}
|
|
426
427
|
const listener = keyOrListener;
|
|
427
428
|
if (listenerOrOptions?.patches) patchListeners.add(listener);
|
|
428
|
-
let subscriptions = changeListenersMap.get(
|
|
429
|
+
let subscriptions = changeListenersMap.get(source);
|
|
429
430
|
if (!subscriptions) {
|
|
430
431
|
subscriptions = /* @__PURE__ */ new Set();
|
|
431
|
-
changeListenersMap.set(
|
|
432
|
+
changeListenersMap.set(source, subscriptions);
|
|
432
433
|
}
|
|
433
434
|
subscriptions.add(listener);
|
|
434
435
|
return () => {
|
|
435
436
|
subscriptions.delete(listener);
|
|
436
|
-
if (!subscriptions.size) changeListenersMap.delete(
|
|
437
|
+
if (!subscriptions.size) changeListenersMap.delete(source);
|
|
437
438
|
};
|
|
438
439
|
}),
|
|
439
440
|
getSignal(instance, key) {
|
|
@@ -141,14 +141,14 @@ declare class SigmaTarget<TEvents extends object = {}, TState extends object = {
|
|
|
141
141
|
/** Helpers for observing, accessing, capturing, and replacing committed sigma state. */
|
|
142
142
|
declare const sigma: Readonly<{
|
|
143
143
|
/** Subscribes to committed state publishes or to one signal-backed top-level state key. */subscribe: {
|
|
144
|
-
<TState extends object>(instance:
|
|
144
|
+
<TState extends object>(instance: ReadableSigma<TState>, listener: (nextState: Immutable<TState>, baseState: Immutable<TState>, patches: Patch[], inversePatches: Patch[]) => void, options: {
|
|
145
145
|
patches: true;
|
|
146
146
|
}): Cleanup;
|
|
147
|
-
<TState extends object>(instance:
|
|
147
|
+
<TState extends object>(instance: ReadableSigma<TState>, listener: (nextState: Immutable<TState>, baseState: Immutable<TState>, patches: Patch[] | undefined, inversePatches: Patch[] | undefined) => void, options: {
|
|
148
148
|
patches: boolean;
|
|
149
149
|
}): Cleanup;
|
|
150
|
-
<TState extends object>(instance:
|
|
151
|
-
<TState extends object, TKey extends Extract<keyof TState, string>>(instance:
|
|
150
|
+
<TState extends object>(instance: ReadableSigma<TState>, listener: (nextState: Immutable<TState>, baseState: Immutable<TState>) => void): Cleanup;
|
|
151
|
+
<TState extends object, TKey extends Extract<keyof TState, string>>(instance: ReadableSigma<TState>, key: TKey, listener: (value: Immutable<TState[TKey]>) => void): Cleanup;
|
|
152
152
|
}; /** Returns the readonly signal backing one top-level state key. */
|
|
153
153
|
getSignal<TState extends object, TKey extends Extract<keyof TState, string>>(instance: Sigma<TState>, key: TKey): ReadonlySignal<Immutable<TState[TKey]>>; /** Captures the current committed top-level state snapshot. */
|
|
154
154
|
captureState<TState extends object>(instance: ReadableSigma<TState>): Immutable<TState>; /** Publishes a plain-object snapshot, including readonly captured snapshots, as committed state. */
|