@vielzeug/stateit 2.0.0 → 3.0.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 +60 -290
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -9
- package/dist/stateit.cjs +1 -1
- package/dist/stateit.cjs.map +1 -1
- package/dist/stateit.d.ts +68 -0
- package/dist/stateit.d.ts.map +1 -0
- package/dist/stateit.js +294 -228
- package/dist/stateit.js.map +1 -1
- package/package.json +6 -5
- package/dist/batch.cjs +0 -2
- package/dist/batch.cjs.map +0 -1
- package/dist/batch.d.ts +0 -5
- package/dist/batch.d.ts.map +0 -1
- package/dist/batch.js +0 -28
- package/dist/batch.js.map +0 -1
- package/dist/computed.cjs +0 -2
- package/dist/computed.cjs.map +0 -1
- package/dist/computed.d.ts +0 -58
- package/dist/computed.d.ts.map +0 -1
- package/dist/computed.js +0 -65
- package/dist/computed.js.map +0 -1
- package/dist/effect.cjs +0 -2
- package/dist/effect.cjs.map +0 -1
- package/dist/effect.d.ts +0 -31
- package/dist/effect.d.ts.map +0 -1
- package/dist/effect.js +0 -53
- package/dist/effect.js.map +0 -1
- package/dist/runtime.cjs +0 -2
- package/dist/runtime.cjs.map +0 -1
- package/dist/runtime.d.ts +0 -40
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -47
- package/dist/runtime.js.map +0 -1
- package/dist/signal.cjs +0 -2
- package/dist/signal.cjs.map +0 -1
- package/dist/signal.d.ts +0 -26
- package/dist/signal.d.ts.map +0 -1
- package/dist/signal.js +0 -40
- package/dist/signal.js.map +0 -1
- package/dist/store.cjs +0 -2
- package/dist/store.cjs.map +0 -1
- package/dist/store.d.ts +0 -32
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -51
- package/dist/store.js.map +0 -1
- package/dist/types.cjs +0 -2
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.ts +0 -39
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/watch.cjs +0 -2
- package/dist/watch.cjs.map +0 -1
- package/dist/watch.d.ts +0 -36
- package/dist/watch.d.ts.map +0 -1
- package/dist/watch.js +0 -32
- package/dist/watch.js.map +0 -1
package/dist/runtime.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
//#region src/runtime.ts
|
|
2
|
-
var e = Symbol("stateit.uninitialized"), t = {
|
|
3
|
-
cleanups: null,
|
|
4
|
-
deps: null,
|
|
5
|
-
effect: null
|
|
6
|
-
}, n = {
|
|
7
|
-
depth: 0,
|
|
8
|
-
pending: /* @__PURE__ */ new Set()
|
|
9
|
-
}, r = 100, i = (e) => {
|
|
10
|
-
e.maxEffectIterations !== void 0 && (r = e.maxEffectIterations);
|
|
11
|
-
}, a = () => {
|
|
12
|
-
n.depth = 0, t.deps = null, t.effect = null, t.cleanups = null, n.pending.clear();
|
|
13
|
-
}, o = class {
|
|
14
|
-
#e = /* @__PURE__ */ new Set();
|
|
15
|
-
_track() {
|
|
16
|
-
if (t.deps !== null && t.effect !== null) {
|
|
17
|
-
let e = t.effect;
|
|
18
|
-
this.#e.add(e), t.deps.add(() => this.#e.delete(e));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
_notify() {
|
|
22
|
-
if (this.#e.size === 0) return;
|
|
23
|
-
if (n.depth > 0) {
|
|
24
|
-
for (let e of this.#e) n.pending.add(e);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
let e = [];
|
|
28
|
-
for (let t of [...this.#e]) try {
|
|
29
|
-
t();
|
|
30
|
-
} catch (t) {
|
|
31
|
-
e.push(t);
|
|
32
|
-
}
|
|
33
|
-
if (e.length) throw e.length === 1 ? e[0] : AggregateError(e, "[stateit] multiple subscriber errors");
|
|
34
|
-
}
|
|
35
|
-
}, s = (e, n, r, i) => {
|
|
36
|
-
let a = t.effect, o = t.deps, s = t.cleanups;
|
|
37
|
-
t.effect = e, t.deps = n, t.cleanups = r;
|
|
38
|
-
try {
|
|
39
|
-
return i();
|
|
40
|
-
} finally {
|
|
41
|
-
t.effect = a, t.deps = o, t.cleanups = s;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { o as ReactiveNode, e as _UNINITIALIZED, r as _maxEffectIterations, a as _resetContextForTesting, s as _withCtx, i as configureStateit, n as queue, t as scope };
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":["#subscribers"],"sources":["../src/runtime.ts"],"sourcesContent":["import type { CleanupFn, EffectCallback } from './types';\n\n/** @internal True outside of production builds; gates dev-only warnings. */\nexport const _DEV = import.meta.env.DEV;\n\nexport const _UNINITIALIZED = Symbol('stateit.uninitialized');\n\n/** @internal Active reactive tracking scope — null outside any effect/computed. */\nexport const scope = {\n cleanups: null as CleanupFn[] | null,\n deps: null as Set<CleanupFn> | null,\n effect: null as EffectCallback | null,\n};\n\n/** @internal Deferred notification queue — active only during batch(). */\nexport const queue = {\n depth: 0,\n pending: new Set<EffectCallback>(),\n};\n\nexport let _maxEffectIterations = 100;\n\n/**\n * Configures global stateit behaviour.\n * @example configureStateit({ maxEffectIterations: 200 });\n */\nexport const configureStateit = (opts: { maxEffectIterations?: number }): void => {\n if (opts.maxEffectIterations !== undefined) _maxEffectIterations = opts.maxEffectIterations;\n};\n\n/**\n * Resets the shared reactive context. Use in test setup/teardown to prevent state\n * leaks between tests when a batch or effect throws without being fully cleaned up.\n */\nexport const _resetContextForTesting = (): void => {\n queue.depth = 0;\n scope.deps = null;\n scope.effect = null;\n scope.cleanups = null;\n queue.pending.clear();\n};\n\n/** @internal Base reactive node: manages a subscriber set and batch-aware notification. */\nexport class ReactiveNode {\n #subscribers = new Set<EffectCallback>();\n\n /** Register the current tracking scope as a subscriber and store an unsubscribe\n * function in scope.deps for automatic cleanup when the effect re-runs. */\n protected _track(): void {\n if (scope.deps !== null && scope.effect !== null) {\n const fn = scope.effect;\n\n this.#subscribers.add(fn);\n scope.deps.add(() => this.#subscribers.delete(fn));\n }\n }\n\n /** Notify all subscribers. Respects batch queue depth. */\n protected _notify(): void {\n if (this.#subscribers.size === 0) return;\n\n if (queue.depth > 0) {\n for (const fn of this.#subscribers) queue.pending.add(fn);\n\n return;\n }\n\n const errors: unknown[] = [];\n\n for (const fn of [...this.#subscribers]) {\n try {\n fn();\n } catch (e) {\n errors.push(e);\n }\n }\n\n if (errors.length) {\n throw errors.length === 1 ? errors[0] : new AggregateError(errors, '[stateit] multiple subscriber errors');\n }\n }\n}\n\n/** @internal Save scope fields, swap to new tracking context, call fn, restore. */\nexport const _withCtx = <T>(\n eff: EffectCallback | null,\n deps: Set<CleanupFn> | null,\n cleanups: CleanupFn[] | null,\n fn: () => T,\n): T => {\n const pe = scope.effect;\n const pd = scope.deps;\n const pc = scope.cleanups;\n\n scope.effect = eff;\n scope.deps = deps;\n scope.cleanups = cleanups;\n\n try {\n return fn();\n } finally {\n scope.effect = pe;\n scope.deps = pd;\n scope.cleanups = pc;\n }\n};\n"],"mappings":";AAKA,IAAa,IAAiB,OAAO,wBAAwB,EAGhD,IAAQ;CACnB,UAAU;CACV,MAAM;CACN,QAAQ;CACT,EAGY,IAAQ;CACnB,OAAO;CACP,yBAAS,IAAI,KAAqB;CACnC,EAEU,IAAuB,KAMrB,KAAoB,MAAiD;AAChF,CAAI,EAAK,wBAAwB,KAAA,MAAW,IAAuB,EAAK;GAO7D,UAAsC;AAKjD,CAJA,EAAM,QAAQ,GACd,EAAM,OAAO,MACb,EAAM,SAAS,MACf,EAAM,WAAW,MACjB,EAAM,QAAQ,OAAO;GAIV,IAAb,MAA0B;CACxB,qBAAe,IAAI,KAAqB;CAIxC,SAAyB;AACvB,MAAI,EAAM,SAAS,QAAQ,EAAM,WAAW,MAAM;GAChD,IAAM,IAAK,EAAM;AAGjB,GADA,MAAA,EAAkB,IAAI,EAAG,EACzB,EAAM,KAAK,UAAU,MAAA,EAAkB,OAAO,EAAG,CAAC;;;CAKtD,UAA0B;AACxB,MAAI,MAAA,EAAkB,SAAS,EAAG;AAElC,MAAI,EAAM,QAAQ,GAAG;AACnB,QAAK,IAAM,KAAM,MAAA,EAAmB,GAAM,QAAQ,IAAI,EAAG;AAEzD;;EAGF,IAAM,IAAoB,EAAE;AAE5B,OAAK,IAAM,KAAM,CAAC,GAAG,MAAA,EAAkB,CACrC,KAAI;AACF,MAAI;WACG,GAAG;AACV,KAAO,KAAK,EAAE;;AAIlB,MAAI,EAAO,OACT,OAAM,EAAO,WAAW,IAAI,EAAO,KAAS,eAAe,GAAQ,uCAAuC;;GAMnG,KACX,GACA,GACA,GACA,MACM;CACN,IAAM,IAAK,EAAM,QACX,IAAK,EAAM,MACX,IAAK,EAAM;AAIjB,CAFA,EAAM,SAAS,GACf,EAAM,OAAO,GACb,EAAM,WAAW;AAEjB,KAAI;AACF,SAAO,GAAI;WACH;AAGR,EAFA,EAAM,SAAS,GACf,EAAM,OAAO,GACb,EAAM,WAAW"}
|
package/dist/signal.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./runtime.cjs`),t=require(`./types.cjs`);var n=class extends e.ReactiveNode{[t._SIGNAL_BRAND]=!0;#e;#t;constructor(e,t){super(),this.#e=e,this.#t=t?.equals??Object.is}get value(){return this._track(),this.#e}set value(e){this.#t(this.#e,e)||(this.#e=e,this._notify())}update(e){this.value=e(this.#e)}peek(){return this.#e}},r=(e,t)=>new n(e,t),i=new WeakMap,a=e=>{let n=i.get(e);if(n)return n;let r={get[t._SIGNAL_BRAND](){return!0},peek:()=>e.peek(),get value(){return e.value}};return i.set(e,r),r},o=e=>typeof e==`object`&&!!e&&t._SIGNAL_BRAND in e,s=e=>o(e)?e.value:e,c=e=>o(e)?e.peek():e;exports.SignalImpl=n,exports.isSignal=o,exports.peekValue=c,exports.readonly=a,exports.signal=r,exports.toValue=s;
|
|
2
|
-
//# sourceMappingURL=signal.cjs.map
|
package/dist/signal.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signal.cjs","names":["#value","#equals"],"sources":["../src/signal.ts"],"sourcesContent":["import { ReactiveNode } from './runtime';\nimport { type EqualityFn, type ReactiveOptions, type ReadonlySignal, type Signal, _SIGNAL_BRAND } from './types';\n\n/** @internal */\nexport class SignalImpl<T> extends ReactiveNode implements Signal<T> {\n readonly [_SIGNAL_BRAND] = true as const;\n #value: T;\n #equals: EqualityFn<T>;\n\n constructor(initial: T, options?: ReactiveOptions<T>) {\n super();\n this.#value = initial;\n this.#equals = options?.equals ?? Object.is;\n }\n\n get value(): T {\n this._track();\n\n return this.#value;\n }\n\n set value(next: T) {\n if (this.#equals(this.#value, next)) return;\n\n this.#value = next;\n this._notify();\n }\n\n update(fn: (current: T) => T): void {\n this.value = fn(this.#value);\n }\n\n peek(): T {\n return this.#value;\n }\n}\n\n/** Creates a reactive signal holding a single value. */\nexport const signal = <T>(initial: T, options?: ReactiveOptions<T>): Signal<T> => new SignalImpl(initial, options);\n\nconst _readonlyCache = new WeakMap<object, ReadonlySignal<unknown>>();\n\n/**\n * Returns a stable read-only view of a signal. Hides the setter at both type and runtime\n * level. The wrapper is cached — repeated calls with the same signal return the same reference.\n */\nexport const readonly = <T>(sig: ReadonlySignal<T>): ReadonlySignal<T> => {\n const cached = _readonlyCache.get(sig as object);\n\n if (cached) return cached as ReadonlySignal<T>;\n\n const wrapper: ReadonlySignal<T> = {\n get [_SIGNAL_BRAND]() {\n return true as const;\n },\n peek: () => sig.peek(),\n get value() {\n return sig.value;\n },\n };\n\n _readonlyCache.set(sig as object, wrapper as ReadonlySignal<unknown>);\n\n return wrapper;\n};\n\n/** Type guard -- identifies Signal instances (works through composition and subclasses). */\nexport const isSignal = <T = unknown>(value: unknown): value is ReadonlySignal<T> =>\n typeof value === 'object' && value !== null && _SIGNAL_BRAND in (value as object);\n\n/** Unwraps a plain value or Signal to its current value. Reads are tracked if called inside an effect. */\nexport const toValue = <T>(v: T | ReadonlySignal<T>): T => (isSignal<T>(v) ? v.value : v);\n\n/** Unwraps a plain value or Signal to its current value without registering a reactive subscription. */\nexport const peekValue = <T>(v: T | ReadonlySignal<T>): T => (isSignal<T>(v) ? v.peek() : v);\n"],"mappings":"0DAIA,IAAa,EAAb,cAAmC,EAAA,YAAkC,CACnE,CAAU,EAAA,eAAiB,GAC3B,GACA,GAEA,YAAY,EAAY,EAA8B,CACpD,OAAO,CACP,MAAA,EAAc,EACd,MAAA,EAAe,GAAS,QAAU,OAAO,GAG3C,IAAI,OAAW,CAGb,OAFA,KAAK,QAAQ,CAEN,MAAA,EAGT,IAAI,MAAM,EAAS,CACb,MAAA,EAAa,MAAA,EAAa,EAAK,GAEnC,MAAA,EAAc,EACd,KAAK,SAAS,EAGhB,OAAO,EAA6B,CAClC,KAAK,MAAQ,EAAG,MAAA,EAAY,CAG9B,MAAU,CACR,OAAO,MAAA,IAKE,GAAa,EAAY,IAA4C,IAAI,EAAW,EAAS,EAAQ,CAE5G,EAAiB,IAAI,QAMd,EAAe,GAA8C,CACxE,IAAM,EAAS,EAAe,IAAI,EAAc,CAEhD,GAAI,EAAQ,OAAO,EAEnB,IAAM,EAA6B,CACjC,IAAK,EAAA,gBAAiB,CACpB,MAAO,IAET,SAAY,EAAI,MAAM,CACtB,IAAI,OAAQ,CACV,OAAO,EAAI,OAEd,CAID,OAFA,EAAe,IAAI,EAAe,EAAmC,CAE9D,GAII,EAAyB,GACpC,OAAO,GAAU,YAAY,GAAkB,EAAA,iBAAkB,EAGtD,EAAc,GAAiC,EAAY,EAAE,CAAG,EAAE,MAAQ,EAG1E,EAAgB,GAAiC,EAAY,EAAE,CAAG,EAAE,MAAM,CAAG"}
|
package/dist/signal.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ReactiveNode } from './runtime';
|
|
2
|
-
import { type ReactiveOptions, type ReadonlySignal, type Signal, _SIGNAL_BRAND } from './types';
|
|
3
|
-
/** @internal */
|
|
4
|
-
export declare class SignalImpl<T> extends ReactiveNode implements Signal<T> {
|
|
5
|
-
#private;
|
|
6
|
-
readonly [_SIGNAL_BRAND]: true;
|
|
7
|
-
constructor(initial: T, options?: ReactiveOptions<T>);
|
|
8
|
-
get value(): T;
|
|
9
|
-
set value(next: T);
|
|
10
|
-
update(fn: (current: T) => T): void;
|
|
11
|
-
peek(): T;
|
|
12
|
-
}
|
|
13
|
-
/** Creates a reactive signal holding a single value. */
|
|
14
|
-
export declare const signal: <T>(initial: T, options?: ReactiveOptions<T>) => Signal<T>;
|
|
15
|
-
/**
|
|
16
|
-
* Returns a stable read-only view of a signal. Hides the setter at both type and runtime
|
|
17
|
-
* level. The wrapper is cached — repeated calls with the same signal return the same reference.
|
|
18
|
-
*/
|
|
19
|
-
export declare const readonly: <T>(sig: ReadonlySignal<T>) => ReadonlySignal<T>;
|
|
20
|
-
/** Type guard -- identifies Signal instances (works through composition and subclasses). */
|
|
21
|
-
export declare const isSignal: <T = unknown>(value: unknown) => value is ReadonlySignal<T>;
|
|
22
|
-
/** Unwraps a plain value or Signal to its current value. Reads are tracked if called inside an effect. */
|
|
23
|
-
export declare const toValue: <T>(v: T | ReadonlySignal<T>) => T;
|
|
24
|
-
/** Unwraps a plain value or Signal to its current value without registering a reactive subscription. */
|
|
25
|
-
export declare const peekValue: <T>(v: T | ReadonlySignal<T>) => T;
|
|
26
|
-
//# sourceMappingURL=signal.d.ts.map
|
package/dist/signal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../src/signal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAmB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjH,gBAAgB;AAChB,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,YAAa,YAAW,MAAM,CAAC,CAAC,CAAC;;IAClE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAG,IAAI,CAAU;gBAI7B,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAMpD,IAAI,KAAK,IAAI,CAAC,CAIb;IAED,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,EAKhB;IAED,MAAM,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI;IAInC,IAAI,IAAI,CAAC;CAGV;AAED,wDAAwD;AACxD,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,SAAS,CAAC,EAAE,UAAU,eAAe,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAAqC,CAAC;AAInH;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC,CAAC,KAAG,cAAc,CAAC,CAAC,CAkBpE,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,QAAQ,GAAI,CAAC,GAAG,OAAO,EAAE,OAAO,OAAO,KAAG,KAAK,IAAI,cAAc,CAAC,CAAC,CACG,CAAC;AAEpF,0GAA0G;AAC1G,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,KAAG,CAAmC,CAAC;AAE1F,wGAAwG;AACxG,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,KAAG,CAAoC,CAAC"}
|
package/dist/signal.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ReactiveNode as e } from "./runtime.js";
|
|
2
|
-
import { _SIGNAL_BRAND as t } from "./types.js";
|
|
3
|
-
//#region src/signal.ts
|
|
4
|
-
var n = class extends e {
|
|
5
|
-
[t] = !0;
|
|
6
|
-
#e;
|
|
7
|
-
#t;
|
|
8
|
-
constructor(e, t) {
|
|
9
|
-
super(), this.#e = e, this.#t = t?.equals ?? Object.is;
|
|
10
|
-
}
|
|
11
|
-
get value() {
|
|
12
|
-
return this._track(), this.#e;
|
|
13
|
-
}
|
|
14
|
-
set value(e) {
|
|
15
|
-
this.#t(this.#e, e) || (this.#e = e, this._notify());
|
|
16
|
-
}
|
|
17
|
-
update(e) {
|
|
18
|
-
this.value = e(this.#e);
|
|
19
|
-
}
|
|
20
|
-
peek() {
|
|
21
|
-
return this.#e;
|
|
22
|
-
}
|
|
23
|
-
}, r = (e, t) => new n(e, t), i = /* @__PURE__ */ new WeakMap(), a = (e) => {
|
|
24
|
-
let n = i.get(e);
|
|
25
|
-
if (n) return n;
|
|
26
|
-
let r = {
|
|
27
|
-
get [t]() {
|
|
28
|
-
return !0;
|
|
29
|
-
},
|
|
30
|
-
peek: () => e.peek(),
|
|
31
|
-
get value() {
|
|
32
|
-
return e.value;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
return i.set(e, r), r;
|
|
36
|
-
}, o = (e) => typeof e == "object" && !!e && t in e, s = (e) => o(e) ? e.value : e, c = (e) => o(e) ? e.peek() : e;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { n as SignalImpl, o as isSignal, c as peekValue, a as readonly, r as signal, s as toValue };
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=signal.js.map
|
package/dist/signal.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signal.js","names":["#value","#equals"],"sources":["../src/signal.ts"],"sourcesContent":["import { ReactiveNode } from './runtime';\nimport { type EqualityFn, type ReactiveOptions, type ReadonlySignal, type Signal, _SIGNAL_BRAND } from './types';\n\n/** @internal */\nexport class SignalImpl<T> extends ReactiveNode implements Signal<T> {\n readonly [_SIGNAL_BRAND] = true as const;\n #value: T;\n #equals: EqualityFn<T>;\n\n constructor(initial: T, options?: ReactiveOptions<T>) {\n super();\n this.#value = initial;\n this.#equals = options?.equals ?? Object.is;\n }\n\n get value(): T {\n this._track();\n\n return this.#value;\n }\n\n set value(next: T) {\n if (this.#equals(this.#value, next)) return;\n\n this.#value = next;\n this._notify();\n }\n\n update(fn: (current: T) => T): void {\n this.value = fn(this.#value);\n }\n\n peek(): T {\n return this.#value;\n }\n}\n\n/** Creates a reactive signal holding a single value. */\nexport const signal = <T>(initial: T, options?: ReactiveOptions<T>): Signal<T> => new SignalImpl(initial, options);\n\nconst _readonlyCache = new WeakMap<object, ReadonlySignal<unknown>>();\n\n/**\n * Returns a stable read-only view of a signal. Hides the setter at both type and runtime\n * level. The wrapper is cached — repeated calls with the same signal return the same reference.\n */\nexport const readonly = <T>(sig: ReadonlySignal<T>): ReadonlySignal<T> => {\n const cached = _readonlyCache.get(sig as object);\n\n if (cached) return cached as ReadonlySignal<T>;\n\n const wrapper: ReadonlySignal<T> = {\n get [_SIGNAL_BRAND]() {\n return true as const;\n },\n peek: () => sig.peek(),\n get value() {\n return sig.value;\n },\n };\n\n _readonlyCache.set(sig as object, wrapper as ReadonlySignal<unknown>);\n\n return wrapper;\n};\n\n/** Type guard -- identifies Signal instances (works through composition and subclasses). */\nexport const isSignal = <T = unknown>(value: unknown): value is ReadonlySignal<T> =>\n typeof value === 'object' && value !== null && _SIGNAL_BRAND in (value as object);\n\n/** Unwraps a plain value or Signal to its current value. Reads are tracked if called inside an effect. */\nexport const toValue = <T>(v: T | ReadonlySignal<T>): T => (isSignal<T>(v) ? v.value : v);\n\n/** Unwraps a plain value or Signal to its current value without registering a reactive subscription. */\nexport const peekValue = <T>(v: T | ReadonlySignal<T>): T => (isSignal<T>(v) ? v.peek() : v);\n"],"mappings":";;;AAIA,IAAa,IAAb,cAAmC,EAAkC;CACnE,CAAU,KAAiB;CAC3B;CACA;CAEA,YAAY,GAAY,GAA8B;AAGpD,EAFA,OAAO,EACP,MAAA,IAAc,GACd,MAAA,IAAe,GAAS,UAAU,OAAO;;CAG3C,IAAI,QAAW;AAGb,SAFA,KAAK,QAAQ,EAEN,MAAA;;CAGT,IAAI,MAAM,GAAS;AACb,QAAA,EAAa,MAAA,GAAa,EAAK,KAEnC,MAAA,IAAc,GACd,KAAK,SAAS;;CAGhB,OAAO,GAA6B;AAClC,OAAK,QAAQ,EAAG,MAAA,EAAY;;CAG9B,OAAU;AACR,SAAO,MAAA;;GAKE,KAAa,GAAY,MAA4C,IAAI,EAAW,GAAS,EAAQ,EAE5G,oBAAiB,IAAI,SAA0C,EAMxD,KAAe,MAA8C;CACxE,IAAM,IAAS,EAAe,IAAI,EAAc;AAEhD,KAAI,EAAQ,QAAO;CAEnB,IAAM,IAA6B;EACjC,KAAK,KAAiB;AACpB,UAAO;;EAET,YAAY,EAAI,MAAM;EACtB,IAAI,QAAQ;AACV,UAAO,EAAI;;EAEd;AAID,QAFA,EAAe,IAAI,GAAe,EAAmC,EAE9D;GAII,KAAyB,MACpC,OAAO,KAAU,cAAY,KAAkB,KAAkB,GAGtD,KAAc,MAAiC,EAAY,EAAE,GAAG,EAAE,QAAQ,GAG1E,KAAgB,MAAiC,EAAY,EAAE,GAAG,EAAE,MAAM,GAAG"}
|
package/dist/store.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./types.cjs`),t=require(`./computed.cjs`),n=require(`./signal.cjs`);var r=(e,t)=>{if(e===t)return!0;if(e==null||t==null)return e===t;if(typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.is(e[r],t[r]))return!1;return!0},i=class extends n.SignalImpl{[e._STORE_BRAND]=!0;#e;#t=!1;constructor(e,t){super(e,{equals:t?.equals??r}),this.#e={...e}}get frozen(){return this.#t}get value(){return super.value}set value(e){this.#t||(super.value=e)}patch(e){this.value={...this.peek(),...e}}update(e){this.value=e({...this.peek()})}reset(){this.value={...this.#e}}select(e,n){return t.computed(()=>e(this.value),n)}freeze(){this.#t=!0}},a=(e,t)=>new i(e,t),o=t=>typeof t==`object`&&!!t&&e._STORE_BRAND in t;exports.isStore=o,exports.shallowEqual=r,exports.store=a;
|
|
2
|
-
//# sourceMappingURL=store.cjs.map
|
package/dist/store.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.cjs","names":["#initial","#frozen"],"sources":["../src/store.ts"],"sourcesContent":["import { type ComputedSignal, computed } from './computed';\nimport { _DEV } from './runtime';\nimport { SignalImpl } from './signal';\nimport { type EqualityFn, type ReactiveOptions, type Signal, _STORE_BRAND } from './types';\n\n/**\n * Shallow structural equality — compares own enumerable keys by reference.\n * This is the default equality function used by `store()`. Export it to avoid\n * reimplementation when composing custom `StoreOptions.equals`.\n */\nexport const shallowEqual: EqualityFn<unknown> = (a, b) => {\n if (a === b) return true;\n\n if (a == null || b == null) return a === b;\n\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n\n const keysA = Object.keys(a as object);\n const keysB = Object.keys(b as object);\n\n if (keysA.length !== keysB.length) return false;\n\n for (const key of keysA) {\n if (!Object.is((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])) return false;\n }\n\n return true;\n};\n\nexport type StoreOptions<T extends object> = {\n /** Custom equality for top-level change detection. Default: shallowEqual */\n equals?: EqualityFn<T>;\n};\n\n/** Reactive store for object state. Implements Signal<T> so all signal primitives work natively. */\nexport interface Store<T extends object> extends Signal<T> {\n readonly frozen: boolean;\n /** Shallow-merge a partial object into the current state. */\n patch(partial: Partial<T>): void;\n /** Derive the next state from the current state via an updater function.\n * Receives a shallow copy of the current state — mutations in the updater are safe. */\n update(fn: (s: T) => T): void;\n /** Reset to the original initial state. */\n reset(): void;\n /** Create a lazily recomputed derived signal from a slice of this store's state. */\n select<U>(selector: (s: T) => U, options?: ReactiveOptions<U>): ComputedSignal<U>;\n /** Freeze the store. Further writes via patch/update/reset are silently ignored. */\n freeze(): void;\n}\n\n/** @internal */\nclass StoreImpl<T extends object> extends SignalImpl<T> implements Store<T> {\n readonly [_STORE_BRAND] = true as const;\n\n readonly #initial: T;\n #frozen = false;\n\n constructor(initial: T, options?: StoreOptions<T>) {\n super(initial, { equals: options?.equals ?? (shallowEqual as EqualityFn<T>) });\n this.#initial = { ...initial }; // defensive copy — external mutation cannot corrupt reset()\n }\n\n get frozen(): boolean {\n return this.#frozen;\n }\n\n override get value(): T {\n return super.value;\n }\n\n override set value(next: T) {\n if (this.#frozen) {\n if (_DEV) console.warn('[stateit] store is frozen — write ignored.');\n\n return;\n }\n\n super.value = next;\n }\n\n patch(partial: Partial<T>): void {\n this.value = { ...this.peek(), ...partial };\n }\n\n update(fn: (s: T) => T): void {\n this.value = fn({ ...this.peek() });\n }\n\n reset(): void {\n this.value = { ...this.#initial };\n }\n\n select<U>(selector: (s: T) => U, options?: ReactiveOptions<U>): ComputedSignal<U> {\n return computed(() => selector(this.value), options);\n }\n\n freeze(): void {\n this.#frozen = true;\n }\n}\n\n/** Creates a reactive store for the object state. */\nexport const store = <T extends object>(initial: T, options?: StoreOptions<T>): Store<T> =>\n new StoreImpl(initial, options);\n\n/** Type guard -- identifies Store instances. */\nexport const isStore = <T extends object = Record<string, unknown>>(value: unknown): value is Store<T> =>\n typeof value === 'object' && value !== null && _STORE_BRAND in value;\n"],"mappings":"qFAUA,IAAa,GAAqC,EAAG,IAAM,CACzD,GAAI,IAAM,EAAG,MAAO,GAEpB,GAAI,GAAK,MAAQ,GAAK,KAAM,OAAO,IAAM,EAEzC,GAAI,OAAO,GAAM,UAAY,OAAO,GAAM,SAAU,MAAO,GAE3D,IAAM,EAAQ,OAAO,KAAK,EAAY,CAChC,EAAQ,OAAO,KAAK,EAAY,CAEtC,GAAI,EAAM,SAAW,EAAM,OAAQ,MAAO,GAE1C,IAAK,IAAM,KAAO,EAChB,GAAI,CAAC,OAAO,GAAI,EAA8B,GAAO,EAA8B,GAAK,CAAE,MAAO,GAGnG,MAAO,IAyBH,EAAN,cAA0C,EAAA,UAAkC,CAC1E,CAAU,EAAA,cAAgB,GAE1B,GACA,GAAU,GAEV,YAAY,EAAY,EAA2B,CACjD,MAAM,EAAS,CAAE,OAAQ,GAAS,QAAW,EAAgC,CAAC,CAC9E,MAAA,EAAgB,CAAE,GAAG,EAAS,CAGhC,IAAI,QAAkB,CACpB,OAAO,MAAA,EAGT,IAAa,OAAW,CACtB,OAAO,MAAM,MAGf,IAAa,MAAM,EAAS,CACtB,MAAA,IAMJ,MAAM,MAAQ,GAGhB,MAAM,EAA2B,CAC/B,KAAK,MAAQ,CAAE,GAAG,KAAK,MAAM,CAAE,GAAG,EAAS,CAG7C,OAAO,EAAuB,CAC5B,KAAK,MAAQ,EAAG,CAAE,GAAG,KAAK,MAAM,CAAE,CAAC,CAGrC,OAAc,CACZ,KAAK,MAAQ,CAAE,GAAG,MAAA,EAAe,CAGnC,OAAU,EAAuB,EAAiD,CAChF,OAAO,EAAA,aAAe,EAAS,KAAK,MAAM,CAAE,EAAQ,CAGtD,QAAe,CACb,MAAA,EAAe,KAKN,GAA2B,EAAY,IAClD,IAAI,EAAU,EAAS,EAAQ,CAGpB,EAAuD,GAClE,OAAO,GAAU,YAAY,GAAkB,EAAA,gBAAgB"}
|
package/dist/store.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type ComputedSignal } from './computed';
|
|
2
|
-
import { type EqualityFn, type ReactiveOptions, type Signal } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Shallow structural equality — compares own enumerable keys by reference.
|
|
5
|
-
* This is the default equality function used by `store()`. Export it to avoid
|
|
6
|
-
* reimplementation when composing custom `StoreOptions.equals`.
|
|
7
|
-
*/
|
|
8
|
-
export declare const shallowEqual: EqualityFn<unknown>;
|
|
9
|
-
export type StoreOptions<T extends object> = {
|
|
10
|
-
/** Custom equality for top-level change detection. Default: shallowEqual */
|
|
11
|
-
equals?: EqualityFn<T>;
|
|
12
|
-
};
|
|
13
|
-
/** Reactive store for object state. Implements Signal<T> so all signal primitives work natively. */
|
|
14
|
-
export interface Store<T extends object> extends Signal<T> {
|
|
15
|
-
readonly frozen: boolean;
|
|
16
|
-
/** Shallow-merge a partial object into the current state. */
|
|
17
|
-
patch(partial: Partial<T>): void;
|
|
18
|
-
/** Derive the next state from the current state via an updater function.
|
|
19
|
-
* Receives a shallow copy of the current state — mutations in the updater are safe. */
|
|
20
|
-
update(fn: (s: T) => T): void;
|
|
21
|
-
/** Reset to the original initial state. */
|
|
22
|
-
reset(): void;
|
|
23
|
-
/** Create a lazily recomputed derived signal from a slice of this store's state. */
|
|
24
|
-
select<U>(selector: (s: T) => U, options?: ReactiveOptions<U>): ComputedSignal<U>;
|
|
25
|
-
/** Freeze the store. Further writes via patch/update/reset are silently ignored. */
|
|
26
|
-
freeze(): void;
|
|
27
|
-
}
|
|
28
|
-
/** Creates a reactive store for the object state. */
|
|
29
|
-
export declare const store: <T extends object>(initial: T, options?: StoreOptions<T>) => Store<T>;
|
|
30
|
-
/** Type guard -- identifies Store instances. */
|
|
31
|
-
export declare const isStore: <T extends object = Record<string, unknown>>(value: unknown) => value is Store<T>;
|
|
32
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,YAAY,CAAC;AAG3D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAgB,MAAM,SAAS,CAAC;AAE3F;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,OAAO,CAiB5C,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IAC3C,4EAA4E;IAC5E,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAEF,oGAAoG;AACpG,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,6DAA6D;IAC7D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACjC;4FACwF;IACxF,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAC9B,2CAA2C;IAC3C,KAAK,IAAI,IAAI,CAAC;IACd,oFAAoF;IACpF,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAClF,oFAAoF;IACpF,MAAM,IAAI,IAAI,CAAC;CAChB;AAqDD,qDAAqD;AACrD,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,YAAY,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,CACtD,CAAC;AAElC,gDAAgD;AAChD,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,OAAO,KAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAC/B,CAAC"}
|
package/dist/store.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { _STORE_BRAND as e } from "./types.js";
|
|
2
|
-
import { computed as t } from "./computed.js";
|
|
3
|
-
import { SignalImpl as n } from "./signal.js";
|
|
4
|
-
//#region src/store.ts
|
|
5
|
-
var r = (e, t) => {
|
|
6
|
-
if (e === t) return !0;
|
|
7
|
-
if (e == null || t == null) return e === t;
|
|
8
|
-
if (typeof e != "object" || typeof t != "object") return !1;
|
|
9
|
-
let n = Object.keys(e), r = Object.keys(t);
|
|
10
|
-
if (n.length !== r.length) return !1;
|
|
11
|
-
for (let r of n) if (!Object.is(e[r], t[r])) return !1;
|
|
12
|
-
return !0;
|
|
13
|
-
}, i = class extends n {
|
|
14
|
-
[e] = !0;
|
|
15
|
-
#e;
|
|
16
|
-
#t = !1;
|
|
17
|
-
constructor(e, t) {
|
|
18
|
-
super(e, { equals: t?.equals ?? r }), this.#e = { ...e };
|
|
19
|
-
}
|
|
20
|
-
get frozen() {
|
|
21
|
-
return this.#t;
|
|
22
|
-
}
|
|
23
|
-
get value() {
|
|
24
|
-
return super.value;
|
|
25
|
-
}
|
|
26
|
-
set value(e) {
|
|
27
|
-
this.#t || (super.value = e);
|
|
28
|
-
}
|
|
29
|
-
patch(e) {
|
|
30
|
-
this.value = {
|
|
31
|
-
...this.peek(),
|
|
32
|
-
...e
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
update(e) {
|
|
36
|
-
this.value = e({ ...this.peek() });
|
|
37
|
-
}
|
|
38
|
-
reset() {
|
|
39
|
-
this.value = { ...this.#e };
|
|
40
|
-
}
|
|
41
|
-
select(e, n) {
|
|
42
|
-
return t(() => e(this.value), n);
|
|
43
|
-
}
|
|
44
|
-
freeze() {
|
|
45
|
-
this.#t = !0;
|
|
46
|
-
}
|
|
47
|
-
}, a = (e, t) => new i(e, t), o = (t) => typeof t == "object" && !!t && e in t;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { o as isStore, r as shallowEqual, a as store };
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["#initial","#frozen"],"sources":["../src/store.ts"],"sourcesContent":["import { type ComputedSignal, computed } from './computed';\nimport { _DEV } from './runtime';\nimport { SignalImpl } from './signal';\nimport { type EqualityFn, type ReactiveOptions, type Signal, _STORE_BRAND } from './types';\n\n/**\n * Shallow structural equality — compares own enumerable keys by reference.\n * This is the default equality function used by `store()`. Export it to avoid\n * reimplementation when composing custom `StoreOptions.equals`.\n */\nexport const shallowEqual: EqualityFn<unknown> = (a, b) => {\n if (a === b) return true;\n\n if (a == null || b == null) return a === b;\n\n if (typeof a !== 'object' || typeof b !== 'object') return false;\n\n const keysA = Object.keys(a as object);\n const keysB = Object.keys(b as object);\n\n if (keysA.length !== keysB.length) return false;\n\n for (const key of keysA) {\n if (!Object.is((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])) return false;\n }\n\n return true;\n};\n\nexport type StoreOptions<T extends object> = {\n /** Custom equality for top-level change detection. Default: shallowEqual */\n equals?: EqualityFn<T>;\n};\n\n/** Reactive store for object state. Implements Signal<T> so all signal primitives work natively. */\nexport interface Store<T extends object> extends Signal<T> {\n readonly frozen: boolean;\n /** Shallow-merge a partial object into the current state. */\n patch(partial: Partial<T>): void;\n /** Derive the next state from the current state via an updater function.\n * Receives a shallow copy of the current state — mutations in the updater are safe. */\n update(fn: (s: T) => T): void;\n /** Reset to the original initial state. */\n reset(): void;\n /** Create a lazily recomputed derived signal from a slice of this store's state. */\n select<U>(selector: (s: T) => U, options?: ReactiveOptions<U>): ComputedSignal<U>;\n /** Freeze the store. Further writes via patch/update/reset are silently ignored. */\n freeze(): void;\n}\n\n/** @internal */\nclass StoreImpl<T extends object> extends SignalImpl<T> implements Store<T> {\n readonly [_STORE_BRAND] = true as const;\n\n readonly #initial: T;\n #frozen = false;\n\n constructor(initial: T, options?: StoreOptions<T>) {\n super(initial, { equals: options?.equals ?? (shallowEqual as EqualityFn<T>) });\n this.#initial = { ...initial }; // defensive copy — external mutation cannot corrupt reset()\n }\n\n get frozen(): boolean {\n return this.#frozen;\n }\n\n override get value(): T {\n return super.value;\n }\n\n override set value(next: T) {\n if (this.#frozen) {\n if (_DEV) console.warn('[stateit] store is frozen — write ignored.');\n\n return;\n }\n\n super.value = next;\n }\n\n patch(partial: Partial<T>): void {\n this.value = { ...this.peek(), ...partial };\n }\n\n update(fn: (s: T) => T): void {\n this.value = fn({ ...this.peek() });\n }\n\n reset(): void {\n this.value = { ...this.#initial };\n }\n\n select<U>(selector: (s: T) => U, options?: ReactiveOptions<U>): ComputedSignal<U> {\n return computed(() => selector(this.value), options);\n }\n\n freeze(): void {\n this.#frozen = true;\n }\n}\n\n/** Creates a reactive store for the object state. */\nexport const store = <T extends object>(initial: T, options?: StoreOptions<T>): Store<T> =>\n new StoreImpl(initial, options);\n\n/** Type guard -- identifies Store instances. */\nexport const isStore = <T extends object = Record<string, unknown>>(value: unknown): value is Store<T> =>\n typeof value === 'object' && value !== null && _STORE_BRAND in value;\n"],"mappings":";;;;AAUA,IAAa,KAAqC,GAAG,MAAM;AACzD,KAAI,MAAM,EAAG,QAAO;AAEpB,KAAI,KAAK,QAAQ,KAAK,KAAM,QAAO,MAAM;AAEzC,KAAI,OAAO,KAAM,YAAY,OAAO,KAAM,SAAU,QAAO;CAE3D,IAAM,IAAQ,OAAO,KAAK,EAAY,EAChC,IAAQ,OAAO,KAAK,EAAY;AAEtC,KAAI,EAAM,WAAW,EAAM,OAAQ,QAAO;AAE1C,MAAK,IAAM,KAAO,EAChB,KAAI,CAAC,OAAO,GAAI,EAA8B,IAAO,EAA8B,GAAK,CAAE,QAAO;AAGnG,QAAO;GAyBH,IAAN,cAA0C,EAAkC;CAC1E,CAAU,KAAgB;CAE1B;CACA,KAAU;CAEV,YAAY,GAAY,GAA2B;AAEjD,EADA,MAAM,GAAS,EAAE,QAAQ,GAAS,UAAW,GAAgC,CAAC,EAC9E,MAAA,IAAgB,EAAE,GAAG,GAAS;;CAGhC,IAAI,SAAkB;AACpB,SAAO,MAAA;;CAGT,IAAa,QAAW;AACtB,SAAO,MAAM;;CAGf,IAAa,MAAM,GAAS;AACtB,QAAA,MAMJ,MAAM,QAAQ;;CAGhB,MAAM,GAA2B;AAC/B,OAAK,QAAQ;GAAE,GAAG,KAAK,MAAM;GAAE,GAAG;GAAS;;CAG7C,OAAO,GAAuB;AAC5B,OAAK,QAAQ,EAAG,EAAE,GAAG,KAAK,MAAM,EAAE,CAAC;;CAGrC,QAAc;AACZ,OAAK,QAAQ,EAAE,GAAG,MAAA,GAAe;;CAGnC,OAAU,GAAuB,GAAiD;AAChF,SAAO,QAAe,EAAS,KAAK,MAAM,EAAE,EAAQ;;CAGtD,SAAe;AACb,QAAA,IAAe;;GAKN,KAA2B,GAAY,MAClD,IAAI,EAAU,GAAS,EAAQ,EAGpB,KAAuD,MAClE,OAAO,KAAU,cAAY,KAAkB,KAAgB"}
|
package/dist/types.cjs
DELETED
package/dist/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/** A function that tears down a subscription or effect. */\nexport type CleanupFn = () => void;\n\n/** The shape of a function passed to `effect()`. Can return an optional cleanup. */\nexport type EffectCallback = () => CleanupFn | void;\n\nexport type EqualityFn<T> = (a: T, b: T) => boolean;\n\n/** Options accepted by signal(), computed(), writable(), and store(). */\nexport type ReactiveOptions<T> = { equals?: EqualityFn<T> };\n\n/** Shared interface for disposable reactive values (computed, writable). Supports the TC39 `using` declaration. */\nexport interface Disposable {\n dispose(): void;\n [Symbol.dispose](): void;\n}\n\n/**\n * A callable subscription handle returned by `effect()` and `watch()`.\n * Can be called directly or via `.dispose()` to stop the subscription.\n * Supports the TC39 `using` declaration via `[Symbol.dispose]`.\n */\nexport interface Subscription {\n (): void;\n dispose(): void;\n [Symbol.dispose](): void;\n}\n\nexport const _SIGNAL_BRAND = Symbol('stateit.signal');\nexport const _STORE_BRAND = Symbol('stateit.store');\n\n/** Public read-only signal interface. */\nexport interface ReadonlySignal<T> {\n readonly [_SIGNAL_BRAND]: true;\n readonly value: T;\n peek(): T;\n}\n\n/** Public read/write signal interface. */\nexport interface Signal<T> extends ReadonlySignal<T> {\n value: T;\n /** Update the value by applying a function to the current value. */\n update(fn: (current: T) => T): void;\n}\n"],"mappings":"AA4BA,IAAa,EAAgB,OAAO,iBAAiB,CACxC,EAAe,OAAO,gBAAgB"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** A function that tears down a subscription or effect. */
|
|
2
|
-
export type CleanupFn = () => void;
|
|
3
|
-
/** The shape of a function passed to `effect()`. Can return an optional cleanup. */
|
|
4
|
-
export type EffectCallback = () => CleanupFn | void;
|
|
5
|
-
export type EqualityFn<T> = (a: T, b: T) => boolean;
|
|
6
|
-
/** Options accepted by signal(), computed(), writable(), and store(). */
|
|
7
|
-
export type ReactiveOptions<T> = {
|
|
8
|
-
equals?: EqualityFn<T>;
|
|
9
|
-
};
|
|
10
|
-
/** Shared interface for disposable reactive values (computed, writable). Supports the TC39 `using` declaration. */
|
|
11
|
-
export interface Disposable {
|
|
12
|
-
dispose(): void;
|
|
13
|
-
[Symbol.dispose](): void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A callable subscription handle returned by `effect()` and `watch()`.
|
|
17
|
-
* Can be called directly or via `.dispose()` to stop the subscription.
|
|
18
|
-
* Supports the TC39 `using` declaration via `[Symbol.dispose]`.
|
|
19
|
-
*/
|
|
20
|
-
export interface Subscription {
|
|
21
|
-
(): void;
|
|
22
|
-
dispose(): void;
|
|
23
|
-
[Symbol.dispose](): void;
|
|
24
|
-
}
|
|
25
|
-
export declare const _SIGNAL_BRAND: unique symbol;
|
|
26
|
-
export declare const _STORE_BRAND: unique symbol;
|
|
27
|
-
/** Public read-only signal interface. */
|
|
28
|
-
export interface ReadonlySignal<T> {
|
|
29
|
-
readonly [_SIGNAL_BRAND]: true;
|
|
30
|
-
readonly value: T;
|
|
31
|
-
peek(): T;
|
|
32
|
-
}
|
|
33
|
-
/** Public read/write signal interface. */
|
|
34
|
-
export interface Signal<T> extends ReadonlySignal<T> {
|
|
35
|
-
value: T;
|
|
36
|
-
/** Update the value by applying a function to the current value. */
|
|
37
|
-
update(fn: (current: T) => T): void;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC;AAEnC,oFAAoF;AACpF,MAAM,MAAM,cAAc,GAAG,MAAM,SAAS,GAAG,IAAI,CAAC;AAEpD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AAEpD,yEAAyE;AACzE,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAE5D,mHAAmH;AACnH,MAAM,WAAW,UAAU;IACzB,OAAO,IAAI,IAAI,CAAC;IAChB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,CAAC;IACT,OAAO,IAAI,IAAI,CAAC;IAChB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,eAA2B,CAAC;AACtD,eAAO,MAAM,YAAY,eAA0B,CAAC;AAEpD,yCAAyC;AACzC,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,IAAI,IAAI,CAAC,CAAC;CACX;AAED,0CAA0C;AAC1C,MAAM,WAAW,MAAM,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IAClD,KAAK,EAAE,CAAC,CAAC;IACT,oEAAoE;IACpE,MAAM,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CACrC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/** A function that tears down a subscription or effect. */\nexport type CleanupFn = () => void;\n\n/** The shape of a function passed to `effect()`. Can return an optional cleanup. */\nexport type EffectCallback = () => CleanupFn | void;\n\nexport type EqualityFn<T> = (a: T, b: T) => boolean;\n\n/** Options accepted by signal(), computed(), writable(), and store(). */\nexport type ReactiveOptions<T> = { equals?: EqualityFn<T> };\n\n/** Shared interface for disposable reactive values (computed, writable). Supports the TC39 `using` declaration. */\nexport interface Disposable {\n dispose(): void;\n [Symbol.dispose](): void;\n}\n\n/**\n * A callable subscription handle returned by `effect()` and `watch()`.\n * Can be called directly or via `.dispose()` to stop the subscription.\n * Supports the TC39 `using` declaration via `[Symbol.dispose]`.\n */\nexport interface Subscription {\n (): void;\n dispose(): void;\n [Symbol.dispose](): void;\n}\n\nexport const _SIGNAL_BRAND = Symbol('stateit.signal');\nexport const _STORE_BRAND = Symbol('stateit.store');\n\n/** Public read-only signal interface. */\nexport interface ReadonlySignal<T> {\n readonly [_SIGNAL_BRAND]: true;\n readonly value: T;\n peek(): T;\n}\n\n/** Public read/write signal interface. */\nexport interface Signal<T> extends ReadonlySignal<T> {\n value: T;\n /** Update the value by applying a function to the current value. */\n update(fn: (current: T) => T): void;\n}\n"],"mappings":";AA4BA,IAAa,IAAgB,OAAO,iBAAiB,EACxC,IAAe,OAAO,gBAAgB"}
|
package/dist/watch.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./effect.cjs`);var t=(t,n,r)=>{let i=r?.equals??Object.is,a=t.peek();r?.immediate&&n(a,a);let o;return o=e.effect(()=>{let e=t.value;if(!i(a,e)){let t=a;a=e,n(e,t),r?.once&&o()}}),o},n=(e,n,r)=>new Promise((i,a)=>{let o=r?.signal;try{o?.throwIfAborted()}catch(e){a(e);return}let s=t(e,e=>{(!n||n(e))&&(s(),o?.removeEventListener(`abort`,c),i(e))}),c=()=>{s(),a(o.reason)};o?.addEventListener(`abort`,c,{once:!0})});exports.nextValue=n,exports.watch=t;
|
|
2
|
-
//# sourceMappingURL=watch.cjs.map
|
package/dist/watch.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.cjs","names":[],"sources":["../src/watch.ts"],"sourcesContent":["import { effect } from './effect';\nimport { type EqualityFn, type ReadonlySignal, type Subscription } from './types';\n\nexport type WatchOptions<T> = {\n /** Custom equality; suppresses the callback when old and new values are equal. Default: Object.is */\n equals?: EqualityFn<T>;\n /** Fire the callback immediately with the current value on subscribe. */\n immediate?: boolean;\n /**\n * Auto-unsubscribe after the first *change* invocation.\n * When combined with `immediate`, the immediate call does not count against this quota —\n * the callback may fire up to twice total.\n */\n once?: boolean;\n};\n\n/**\n * Watches a Signal and calls cb when its value changes. Returns a dispose handle.\n * Does not fire on initial subscription unless `{ immediate: true }` is passed.\n * To watch a derived slice, compose with `store.select()` or `computed()`:\n *\n * @example\n * const stop = watch(count, (next, prev) => console.log(prev, '->', next));\n * const stop = watch(userStore.select(s => s.name), (name) => ...);\n */\nexport const watch = <T>(\n source: ReadonlySignal<T>,\n cb: (value: T, prev: T) => void,\n options?: WatchOptions<T>,\n): Subscription => {\n const eq: EqualityFn<T> = options?.equals ?? Object.is;\n let prev = source.peek();\n\n if (options?.immediate) cb(prev, prev);\n\n // Use `let` so the stop reference is readable inside the callback without TDZ risk.\n let stop: Subscription;\n\n // eslint-disable-next-line prefer-const\n stop = effect(() => {\n const next = source.value;\n\n if (!eq(prev, next)) {\n const old = prev;\n\n prev = next;\n cb(next, old);\n\n if (options?.once) stop();\n }\n });\n\n return stop;\n};\n\n/**\n * Returns a Promise that resolves with the next value of `source` that satisfies the optional predicate.\n * Disposes automatically after one emission — no cleanup needed.\n * Pass `{ signal: AbortSignal }` to cancel early; the promise rejects with the abort reason.\n *\n * @example\n * const name = await nextValue(userStore.select(s => s.name));\n * const nonZero = await nextValue(count, v => v > 0, { signal: AbortSignal.timeout(5000) });\n */\nexport const nextValue = <T>(\n source: ReadonlySignal<T>,\n predicate?: (v: T) => boolean,\n options?: { signal?: AbortSignal },\n): Promise<T> =>\n new Promise<T>((resolve, reject) => {\n const signal = options?.signal;\n\n try {\n signal?.throwIfAborted();\n } catch (err) {\n reject(err);\n\n return;\n }\n\n const stop = watch(source, (v) => {\n if (!predicate || predicate(v)) {\n stop();\n signal?.removeEventListener('abort', onAbort);\n resolve(v);\n }\n });\n\n const onAbort = () => {\n stop();\n reject(signal!.reason);\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n"],"mappings":"gCAyBA,IAAa,GACX,EACA,EACA,IACiB,CACjB,IAAM,EAAoB,GAAS,QAAU,OAAO,GAChD,EAAO,EAAO,MAAM,CAEpB,GAAS,WAAW,EAAG,EAAM,EAAK,CAGtC,IAAI,EAgBJ,MAbA,GAAO,EAAA,WAAa,CAClB,IAAM,EAAO,EAAO,MAEpB,GAAI,CAAC,EAAG,EAAM,EAAK,CAAE,CACnB,IAAM,EAAM,EAEZ,EAAO,EACP,EAAG,EAAM,EAAI,CAET,GAAS,MAAM,GAAM,GAE3B,CAEK,GAYI,GACX,EACA,EACA,IAEA,IAAI,SAAY,EAAS,IAAW,CAClC,IAAM,EAAS,GAAS,OAExB,GAAI,CACF,GAAQ,gBAAgB,OACjB,EAAK,CACZ,EAAO,EAAI,CAEX,OAGF,IAAM,EAAO,EAAM,EAAS,GAAM,EAC5B,CAAC,GAAa,EAAU,EAAE,IAC5B,GAAM,CACN,GAAQ,oBAAoB,QAAS,EAAQ,CAC7C,EAAQ,EAAE,GAEZ,CAEI,MAAgB,CACpB,GAAM,CACN,EAAO,EAAQ,OAAO,EAGxB,GAAQ,iBAAiB,QAAS,EAAS,CAAE,KAAM,GAAM,CAAC,EAC1D"}
|
package/dist/watch.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type EqualityFn, type ReadonlySignal, type Subscription } from './types';
|
|
2
|
-
export type WatchOptions<T> = {
|
|
3
|
-
/** Custom equality; suppresses the callback when old and new values are equal. Default: Object.is */
|
|
4
|
-
equals?: EqualityFn<T>;
|
|
5
|
-
/** Fire the callback immediately with the current value on subscribe. */
|
|
6
|
-
immediate?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Auto-unsubscribe after the first *change* invocation.
|
|
9
|
-
* When combined with `immediate`, the immediate call does not count against this quota —
|
|
10
|
-
* the callback may fire up to twice total.
|
|
11
|
-
*/
|
|
12
|
-
once?: boolean;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Watches a Signal and calls cb when its value changes. Returns a dispose handle.
|
|
16
|
-
* Does not fire on initial subscription unless `{ immediate: true }` is passed.
|
|
17
|
-
* To watch a derived slice, compose with `store.select()` or `computed()`:
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* const stop = watch(count, (next, prev) => console.log(prev, '->', next));
|
|
21
|
-
* const stop = watch(userStore.select(s => s.name), (name) => ...);
|
|
22
|
-
*/
|
|
23
|
-
export declare const watch: <T>(source: ReadonlySignal<T>, cb: (value: T, prev: T) => void, options?: WatchOptions<T>) => Subscription;
|
|
24
|
-
/**
|
|
25
|
-
* Returns a Promise that resolves with the next value of `source` that satisfies the optional predicate.
|
|
26
|
-
* Disposes automatically after one emission — no cleanup needed.
|
|
27
|
-
* Pass `{ signal: AbortSignal }` to cancel early; the promise rejects with the abort reason.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* const name = await nextValue(userStore.select(s => s.name));
|
|
31
|
-
* const nonZero = await nextValue(count, v => v > 0, { signal: AbortSignal.timeout(5000) });
|
|
32
|
-
*/
|
|
33
|
-
export declare const nextValue: <T>(source: ReadonlySignal<T>, predicate?: (v: T) => boolean, options?: {
|
|
34
|
-
signal?: AbortSignal;
|
|
35
|
-
}) => Promise<T>;
|
|
36
|
-
//# sourceMappingURL=watch.d.ts.map
|
package/dist/watch.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,qGAAqG;IACrG,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EACrB,QAAQ,cAAc,CAAC,CAAC,CAAC,EACzB,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,EAC/B,UAAU,YAAY,CAAC,CAAC,CAAC,KACxB,YAwBF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EACzB,QAAQ,cAAc,CAAC,CAAC,CAAC,EACzB,YAAY,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,EAC7B,UAAU;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KACjC,OAAO,CAAC,CAAC,CA0BR,CAAC"}
|
package/dist/watch.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { effect as e } from "./effect.js";
|
|
2
|
-
//#region src/watch.ts
|
|
3
|
-
var t = (t, n, r) => {
|
|
4
|
-
let i = r?.equals ?? Object.is, a = t.peek();
|
|
5
|
-
r?.immediate && n(a, a);
|
|
6
|
-
let o;
|
|
7
|
-
return o = e(() => {
|
|
8
|
-
let e = t.value;
|
|
9
|
-
if (!i(a, e)) {
|
|
10
|
-
let t = a;
|
|
11
|
-
a = e, n(e, t), r?.once && o();
|
|
12
|
-
}
|
|
13
|
-
}), o;
|
|
14
|
-
}, n = (e, n, r) => new Promise((i, a) => {
|
|
15
|
-
let o = r?.signal;
|
|
16
|
-
try {
|
|
17
|
-
o?.throwIfAborted();
|
|
18
|
-
} catch (e) {
|
|
19
|
-
a(e);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
let s = t(e, (e) => {
|
|
23
|
-
(!n || n(e)) && (s(), o?.removeEventListener("abort", c), i(e));
|
|
24
|
-
}), c = () => {
|
|
25
|
-
s(), a(o.reason);
|
|
26
|
-
};
|
|
27
|
-
o?.addEventListener("abort", c, { once: !0 });
|
|
28
|
-
});
|
|
29
|
-
//#endregion
|
|
30
|
-
export { n as nextValue, t as watch };
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=watch.js.map
|
package/dist/watch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","names":[],"sources":["../src/watch.ts"],"sourcesContent":["import { effect } from './effect';\nimport { type EqualityFn, type ReadonlySignal, type Subscription } from './types';\n\nexport type WatchOptions<T> = {\n /** Custom equality; suppresses the callback when old and new values are equal. Default: Object.is */\n equals?: EqualityFn<T>;\n /** Fire the callback immediately with the current value on subscribe. */\n immediate?: boolean;\n /**\n * Auto-unsubscribe after the first *change* invocation.\n * When combined with `immediate`, the immediate call does not count against this quota —\n * the callback may fire up to twice total.\n */\n once?: boolean;\n};\n\n/**\n * Watches a Signal and calls cb when its value changes. Returns a dispose handle.\n * Does not fire on initial subscription unless `{ immediate: true }` is passed.\n * To watch a derived slice, compose with `store.select()` or `computed()`:\n *\n * @example\n * const stop = watch(count, (next, prev) => console.log(prev, '->', next));\n * const stop = watch(userStore.select(s => s.name), (name) => ...);\n */\nexport const watch = <T>(\n source: ReadonlySignal<T>,\n cb: (value: T, prev: T) => void,\n options?: WatchOptions<T>,\n): Subscription => {\n const eq: EqualityFn<T> = options?.equals ?? Object.is;\n let prev = source.peek();\n\n if (options?.immediate) cb(prev, prev);\n\n // Use `let` so the stop reference is readable inside the callback without TDZ risk.\n let stop: Subscription;\n\n // eslint-disable-next-line prefer-const\n stop = effect(() => {\n const next = source.value;\n\n if (!eq(prev, next)) {\n const old = prev;\n\n prev = next;\n cb(next, old);\n\n if (options?.once) stop();\n }\n });\n\n return stop;\n};\n\n/**\n * Returns a Promise that resolves with the next value of `source` that satisfies the optional predicate.\n * Disposes automatically after one emission — no cleanup needed.\n * Pass `{ signal: AbortSignal }` to cancel early; the promise rejects with the abort reason.\n *\n * @example\n * const name = await nextValue(userStore.select(s => s.name));\n * const nonZero = await nextValue(count, v => v > 0, { signal: AbortSignal.timeout(5000) });\n */\nexport const nextValue = <T>(\n source: ReadonlySignal<T>,\n predicate?: (v: T) => boolean,\n options?: { signal?: AbortSignal },\n): Promise<T> =>\n new Promise<T>((resolve, reject) => {\n const signal = options?.signal;\n\n try {\n signal?.throwIfAborted();\n } catch (err) {\n reject(err);\n\n return;\n }\n\n const stop = watch(source, (v) => {\n if (!predicate || predicate(v)) {\n stop();\n signal?.removeEventListener('abort', onAbort);\n resolve(v);\n }\n });\n\n const onAbort = () => {\n stop();\n reject(signal!.reason);\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n"],"mappings":";;AAyBA,IAAa,KACX,GACA,GACA,MACiB;CACjB,IAAM,IAAoB,GAAS,UAAU,OAAO,IAChD,IAAO,EAAO,MAAM;AAExB,CAAI,GAAS,aAAW,EAAG,GAAM,EAAK;CAGtC,IAAI;AAgBJ,QAbA,IAAO,QAAa;EAClB,IAAM,IAAO,EAAO;AAEpB,MAAI,CAAC,EAAG,GAAM,EAAK,EAAE;GACnB,IAAM,IAAM;AAKZ,GAHA,IAAO,GACP,EAAG,GAAM,EAAI,EAET,GAAS,QAAM,GAAM;;GAE3B,EAEK;GAYI,KACX,GACA,GACA,MAEA,IAAI,SAAY,GAAS,MAAW;CAClC,IAAM,IAAS,GAAS;AAExB,KAAI;AACF,KAAQ,gBAAgB;UACjB,GAAK;AACZ,IAAO,EAAI;AAEX;;CAGF,IAAM,IAAO,EAAM,IAAS,MAAM;AAChC,GAAI,CAAC,KAAa,EAAU,EAAE,MAC5B,GAAM,EACN,GAAQ,oBAAoB,SAAS,EAAQ,EAC7C,EAAQ,EAAE;GAEZ,EAEI,UAAgB;AAEpB,EADA,GAAM,EACN,EAAO,EAAQ,OAAO;;AAGxB,IAAQ,iBAAiB,SAAS,GAAS,EAAE,MAAM,IAAM,CAAC;EAC1D"}
|