mates 0.2.0 → 0.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/dist/Mutables/atom/index.d.ts +1 -1
- package/dist/Mutables/atom/index.d.ts.map +1 -1
- package/dist/Template/x-x.d.ts.map +1 -1
- package/dist/css-in-js/theme.d.ts.map +1 -1
- package/dist/index.d.ts +160 -160
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +52 -38
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/Mutables/atom/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-x.d.ts","sourceRoot":"","sources":["../../lib/Template/x-x.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"x-x.d.ts","sourceRoot":"","sources":["../../lib/Template/x-x.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,2BAA2B,CAAC;AAWhF,qBAAa,SAAU,SAAQ,WAAW;IACxC,OAAO,CAAC,MAAM,CAAsB;IAE7B,QAAQ,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAA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,KAAA,EAyBX;IAED,IAAI,IAAI,QAEP;IAMD,gBAAgB;IAIhB,iBAAiB;IAgCjB,oBAAoB;IAqBpB,OAAO,CAAC,qBAAqB,CAa3B;IAEF,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ;IAazC,OAAO;IA6CP,OAAO,CAAC,eAAe;IAqFvB,OAAO,CAAC,kBAAkB;CAiF3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../lib/css-in-js/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../lib/css-in-js/theme.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,sCAAsC,CAAC;AAK9C;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,aAAa,IAAI;IAC7C,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI;IACrD,wFAAwF;IACxF,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B;;;;;OAKG;IACH,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AA4CF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAC/C,MAAM,EAAE,CAAC,GACR,iBAAiB,CAAC,CAAC,CAAC,CAmDtB;AAID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAQtE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import { TemplateResult, nothing } from 'lit-html';
|
|
3
3
|
export { TemplateResult, html, noChange, nothing, render, svg } from 'lit-html';
|
|
4
|
-
export { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
5
4
|
export { asyncAppend } from 'lit-html/directives/async-append.js';
|
|
6
5
|
export { asyncReplace } from 'lit-html/directives/async-replace.js';
|
|
7
6
|
export { cache as litCache } from 'lit-html/directives/cache.js';
|
|
@@ -15,6 +14,7 @@ export { range } from 'lit-html/directives/range.js';
|
|
|
15
14
|
import { KeyFn } from 'lit-html/directives/repeat.js';
|
|
16
15
|
export { repeat } from 'lit-html/directives/repeat.js';
|
|
17
16
|
export { styleMap } from 'lit-html/directives/style-map.js';
|
|
17
|
+
export { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
18
18
|
export { until } from 'lit-html/directives/until.js';
|
|
19
19
|
export { when } from 'lit-html/directives/when.js';
|
|
20
20
|
import * as CSS from 'csstype';
|
|
@@ -239,165 +239,6 @@ declare const MA: {
|
|
|
239
239
|
};
|
|
240
240
|
type MatesAnimationClass = (typeof MA)[keyof typeof MA];
|
|
241
241
|
|
|
242
|
-
declare class ZeroPromise<T = any> {
|
|
243
|
-
private state;
|
|
244
|
-
private controller;
|
|
245
|
-
private resolveFn;
|
|
246
|
-
private rejectFn;
|
|
247
|
-
private promise;
|
|
248
|
-
__isZeroPromise__: boolean;
|
|
249
|
-
constructor();
|
|
250
|
-
isActive(): boolean;
|
|
251
|
-
isResolved(): boolean;
|
|
252
|
-
isRejected(): boolean;
|
|
253
|
-
isCancelled(): boolean;
|
|
254
|
-
get signal(): AbortSignal;
|
|
255
|
-
toActive(): this;
|
|
256
|
-
resolve(value: T): void;
|
|
257
|
-
reject(error: any): void;
|
|
258
|
-
cancel(reason?: any): void;
|
|
259
|
-
then<R1 = T, R2 = never>(onFulfilled?: (v: T) => R1 | PromiseLike<R1>, onRejected?: (e: any) => R2 | PromiseLike<R2>): Promise<R1 | R2>;
|
|
260
|
-
catch<R = never>(onRejected?: (e: any) => R | PromiseLike<R>): Promise<T | R>;
|
|
261
|
-
finally(onFinally?: () => void): Promise<T>;
|
|
262
|
-
get [Symbol.toStringTag](): string;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Global component running status tracker.
|
|
267
|
-
* Used to enforce safety checks and prevent certain operations during specific
|
|
268
|
-
* execution contexts.
|
|
269
|
-
*/
|
|
270
|
-
declare const componentRunningStatus: {
|
|
271
|
-
/**
|
|
272
|
-
* Set to true while a scope's setup() method is running.
|
|
273
|
-
*
|
|
274
|
-
* NOTE: setup() is called during scope creation, which can only happen inside
|
|
275
|
-
* a component's outer function. The outer function is an unrestricted context,
|
|
276
|
-
* so setup() inherits the same permissions — reactive primitives (atoms, events,
|
|
277
|
-
* channels, actions, setters, on(), effect(), …) CAN be created freely here,
|
|
278
|
-
* exactly as they can be in the outer function itself.
|
|
279
|
-
*
|
|
280
|
-
* This flag is kept for informational / tooling purposes (e.g. CSS-in-JS
|
|
281
|
-
* assertModuleLevel checks) and is NOT used by assertNotInRestrictedContext.
|
|
282
|
-
*/
|
|
283
|
-
setupInProgress: boolean;
|
|
284
|
-
/**
|
|
285
|
-
* Set to true while the template function (inner render function) is running.
|
|
286
|
-
*
|
|
287
|
-
* During template execution reactive primitives CANNOT be created because the
|
|
288
|
-
* template reruns on every update — creating atoms/events/etc. here would
|
|
289
|
-
* produce a new instance on every render, causing memory leaks and broken
|
|
290
|
-
* reactivity. Only `scope()` / `useScope()` lookups are permitted.
|
|
291
|
-
*/
|
|
292
|
-
templateInProgress: boolean;
|
|
293
|
-
/**
|
|
294
|
-
* Set to true while a component's outer function is running.
|
|
295
|
-
* Tracked for debugging / devtools purposes only — does NOT restrict anything.
|
|
296
|
-
* Reactive primitives CAN be created freely in the outer function.
|
|
297
|
-
*/
|
|
298
|
-
viewOuterInProgress: boolean;
|
|
299
|
-
/**
|
|
300
|
-
* Set to true while an `eleHook()` or `htmlHook()` mount or lifecycle
|
|
301
|
-
* callback is executing. Indicates that a hook is in progress and allows
|
|
302
|
-
* certain operations that would otherwise be restricted.
|
|
303
|
-
*/
|
|
304
|
-
isHookRunning: boolean;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Returns true when the current execution context forbids the creation of new
|
|
308
|
-
* reactive primitives.
|
|
309
|
-
*
|
|
310
|
-
* Restricted contexts
|
|
311
|
-
* ───────────────────
|
|
312
|
-
* • Template function — reruns every render; primitives created here leak
|
|
313
|
-
* • effect() / memo() — should only read state, never create new primitives
|
|
314
|
-
*
|
|
315
|
-
* Unrestricted contexts
|
|
316
|
-
* ─────────────────────
|
|
317
|
-
* • ES module scope — top of file, safe to create global primitives
|
|
318
|
-
* • Component outer fn — runs once on mount; the canonical place for locals
|
|
319
|
-
* • Scope setup() — called from the outer fn, inherits its permissions
|
|
320
|
-
* • Hook callbacks — eleHook / htmlHook mount and lifecycle methods run
|
|
321
|
-
* with isHookRunning = true. Subscriptions and atom
|
|
322
|
-
* creation are permitted because the hook author owns
|
|
323
|
-
* teardown via the onCleanup return value.
|
|
324
|
-
*/
|
|
325
|
-
declare function isInRestrictedContext(): boolean;
|
|
326
|
-
/**
|
|
327
|
-
* Throws a descriptive error when called from a restricted execution context.
|
|
328
|
-
*
|
|
329
|
-
* Allowed
|
|
330
|
-
* ───────
|
|
331
|
-
* ✅ ES module scope (top-level, outside any component)
|
|
332
|
-
* ✅ Component outer function (runs once on mount)
|
|
333
|
-
* ✅ Scope setup() (runs inside the outer function — same rules)
|
|
334
|
-
* ✅ Hook callbacks (isHookRunning === true)
|
|
335
|
-
* eleHook / htmlHook mount and lifecycle methods
|
|
336
|
-
* may freely subscribe and create atoms. The hook
|
|
337
|
-
* author is responsible for unsubscribing inside
|
|
338
|
-
* the onCleanup return — this is NOT automatic.
|
|
339
|
-
*
|
|
340
|
-
* Forbidden
|
|
341
|
-
* ─────────
|
|
342
|
-
* ❌ Template / render function (templateInProgress === true)
|
|
343
|
-
* ❌ effect() or memo() callback (isEffectRunning() === true)
|
|
344
|
-
*/
|
|
345
|
-
declare function assertNotInRestrictedContext(operationName: string): void;
|
|
346
|
-
/**
|
|
347
|
-
* Throws unless the current execution context is a component's outer function
|
|
348
|
-
* (i.e. `viewOuterInProgress === true`).
|
|
349
|
-
*
|
|
350
|
-
* Use this for APIs — such as `ws()` — that register cleanup handlers via
|
|
351
|
-
* `registerCleanup` and therefore require an active component host. Calling
|
|
352
|
-
* them at module level or inside inner functions (event handlers, timers, etc.)
|
|
353
|
-
* would silently skip cleanup, leaving timers and sockets running after the
|
|
354
|
-
* component unmounts.
|
|
355
|
-
*
|
|
356
|
-
* Allowed
|
|
357
|
-
* ───────
|
|
358
|
-
* ✅ Component outer function (viewOuterInProgress === true)
|
|
359
|
-
* ✅ Scope setup() (sets viewOuterInProgress = true, same rules)
|
|
360
|
-
*
|
|
361
|
-
* Forbidden
|
|
362
|
-
* ─────────
|
|
363
|
-
* ❌ Module / file scope (no active host, no cleanup)
|
|
364
|
-
* ❌ Inner functions / event handlers (outer fn has already returned)
|
|
365
|
-
* ❌ Template / render function (templateInProgress === true)
|
|
366
|
-
* ❌ effect() or memo() callback (isEffectRunning() === true)
|
|
367
|
-
*/
|
|
368
|
-
declare function assertComponentOuterContext(operationName: string): void;
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Read tracking state for dependency collection.
|
|
372
|
-
* Used by atoms, units, getters, and effects to track which stores are read
|
|
373
|
-
* during reactive computations.
|
|
374
|
-
*/
|
|
375
|
-
declare function isReadTrackingEnabled(): boolean;
|
|
376
|
-
declare function getStoresBeingRead(): Set<any>;
|
|
377
|
-
declare function isEffectRunning(): boolean;
|
|
378
|
-
declare function addStoreBeingRead(store: any): void;
|
|
379
|
-
declare function pushEffect(): void;
|
|
380
|
-
declare function popEffect(): void;
|
|
381
|
-
interface TrackingSnapshot {
|
|
382
|
-
prevEnabled: boolean;
|
|
383
|
-
prevStores: Set<any>;
|
|
384
|
-
}
|
|
385
|
-
declare function saveAndEnableTracking(): TrackingSnapshot;
|
|
386
|
-
declare function restoreTracking(prev: TrackingSnapshot): Set<any>;
|
|
387
|
-
declare const startTracking: typeof saveAndEnableTracking;
|
|
388
|
-
declare const stopTracking: typeof restoreTracking;
|
|
389
|
-
|
|
390
|
-
type TimerType = "timeout" | "interval";
|
|
391
|
-
type TimerId = ReturnType<typeof setTimeout> | ReturnType<typeof setInterval>;
|
|
392
|
-
/**
|
|
393
|
-
* Internal helper to create managed timers with automatic cleanup
|
|
394
|
-
* @param fn - Function to execute
|
|
395
|
-
* @param delay - Delay/interval in milliseconds
|
|
396
|
-
* @param type - Timer type (timeout or interval)
|
|
397
|
-
* @returns Timer ID
|
|
398
|
-
*/
|
|
399
|
-
declare const createManagedTimer: (fn: () => void, delay: number, type: TimerType) => TimerId;
|
|
400
|
-
|
|
401
242
|
type ActionFn = (...args: any[]) => any;
|
|
402
243
|
type ActionSubscriber<T extends ActionFn> = (result?: ReturnType<T>) => void;
|
|
403
244
|
type ActionBeforeInterceptor<T extends ActionFn> = (next: (...args: any[]) => ReturnType<T>, ...args: Parameters<T>) => ReturnType<T>;
|
|
@@ -1035,6 +876,29 @@ declare function throttle<T extends (...args: any[]) => any>(func: T, wait: numb
|
|
|
1035
876
|
flush: () => ReturnType<T> | undefined;
|
|
1036
877
|
};
|
|
1037
878
|
|
|
879
|
+
declare class ZeroPromise<T = any> {
|
|
880
|
+
private state;
|
|
881
|
+
private controller;
|
|
882
|
+
private resolveFn;
|
|
883
|
+
private rejectFn;
|
|
884
|
+
private promise;
|
|
885
|
+
__isZeroPromise__: boolean;
|
|
886
|
+
constructor();
|
|
887
|
+
isActive(): boolean;
|
|
888
|
+
isResolved(): boolean;
|
|
889
|
+
isRejected(): boolean;
|
|
890
|
+
isCancelled(): boolean;
|
|
891
|
+
get signal(): AbortSignal;
|
|
892
|
+
toActive(): this;
|
|
893
|
+
resolve(value: T): void;
|
|
894
|
+
reject(error: any): void;
|
|
895
|
+
cancel(reason?: any): void;
|
|
896
|
+
then<R1 = T, R2 = never>(onFulfilled?: (v: T) => R1 | PromiseLike<R1>, onRejected?: (e: any) => R2 | PromiseLike<R2>): Promise<R1 | R2>;
|
|
897
|
+
catch<R = never>(onRejected?: (e: any) => R | PromiseLike<R>): Promise<T | R>;
|
|
898
|
+
finally(onFinally?: () => void): Promise<T>;
|
|
899
|
+
get [Symbol.toStringTag](): string;
|
|
900
|
+
}
|
|
901
|
+
|
|
1038
902
|
/**
|
|
1039
903
|
* mates — ssr/ssr-bridge.ts
|
|
1040
904
|
*
|
|
@@ -5716,6 +5580,142 @@ declare function resolveAsyncValue(val: any): Promise<any>;
|
|
|
5716
5580
|
*/
|
|
5717
5581
|
declare function unwrapModule(module: any): any;
|
|
5718
5582
|
|
|
5583
|
+
type TimerType = "timeout" | "interval";
|
|
5584
|
+
type TimerId = ReturnType<typeof setTimeout> | ReturnType<typeof setInterval>;
|
|
5585
|
+
/**
|
|
5586
|
+
* Internal helper to create managed timers with automatic cleanup
|
|
5587
|
+
* @param fn - Function to execute
|
|
5588
|
+
* @param delay - Delay/interval in milliseconds
|
|
5589
|
+
* @param type - Timer type (timeout or interval)
|
|
5590
|
+
* @returns Timer ID
|
|
5591
|
+
*/
|
|
5592
|
+
declare const createManagedTimer: (fn: () => void, delay: number, type: TimerType) => TimerId;
|
|
5593
|
+
|
|
5594
|
+
/**
|
|
5595
|
+
* Global component running status tracker.
|
|
5596
|
+
* Used to enforce safety checks and prevent certain operations during specific
|
|
5597
|
+
* execution contexts.
|
|
5598
|
+
*/
|
|
5599
|
+
declare const componentRunningStatus: {
|
|
5600
|
+
/**
|
|
5601
|
+
* Set to true while a scope's setup() method is running.
|
|
5602
|
+
*
|
|
5603
|
+
* NOTE: setup() is called during scope creation, which can only happen inside
|
|
5604
|
+
* a component's outer function. The outer function is an unrestricted context,
|
|
5605
|
+
* so setup() inherits the same permissions — reactive primitives (atoms, events,
|
|
5606
|
+
* channels, actions, setters, on(), effect(), …) CAN be created freely here,
|
|
5607
|
+
* exactly as they can be in the outer function itself.
|
|
5608
|
+
*
|
|
5609
|
+
* This flag is kept for informational / tooling purposes (e.g. CSS-in-JS
|
|
5610
|
+
* assertModuleLevel checks) and is NOT used by assertNotInRestrictedContext.
|
|
5611
|
+
*/
|
|
5612
|
+
setupInProgress: boolean;
|
|
5613
|
+
/**
|
|
5614
|
+
* Set to true while the template function (inner render function) is running.
|
|
5615
|
+
*
|
|
5616
|
+
* During template execution reactive primitives CANNOT be created because the
|
|
5617
|
+
* template reruns on every update — creating atoms/events/etc. here would
|
|
5618
|
+
* produce a new instance on every render, causing memory leaks and broken
|
|
5619
|
+
* reactivity. Only `scope()` / `useScope()` lookups are permitted.
|
|
5620
|
+
*/
|
|
5621
|
+
templateInProgress: boolean;
|
|
5622
|
+
/**
|
|
5623
|
+
* Set to true while a component's outer function is running.
|
|
5624
|
+
* Tracked for debugging / devtools purposes only — does NOT restrict anything.
|
|
5625
|
+
* Reactive primitives CAN be created freely in the outer function.
|
|
5626
|
+
*/
|
|
5627
|
+
viewOuterInProgress: boolean;
|
|
5628
|
+
/**
|
|
5629
|
+
* Set to true while an `eleHook()` or `htmlHook()` mount or lifecycle
|
|
5630
|
+
* callback is executing. Indicates that a hook is in progress and allows
|
|
5631
|
+
* certain operations that would otherwise be restricted.
|
|
5632
|
+
*/
|
|
5633
|
+
isHookRunning: boolean;
|
|
5634
|
+
};
|
|
5635
|
+
/**
|
|
5636
|
+
* Returns true when the current execution context forbids the creation of new
|
|
5637
|
+
* reactive primitives.
|
|
5638
|
+
*
|
|
5639
|
+
* Restricted contexts
|
|
5640
|
+
* ───────────────────
|
|
5641
|
+
* • Template function — reruns every render; primitives created here leak
|
|
5642
|
+
* • effect() / memo() — should only read state, never create new primitives
|
|
5643
|
+
*
|
|
5644
|
+
* Unrestricted contexts
|
|
5645
|
+
* ─────────────────────
|
|
5646
|
+
* • ES module scope — top of file, safe to create global primitives
|
|
5647
|
+
* • Component outer fn — runs once on mount; the canonical place for locals
|
|
5648
|
+
* • Scope setup() — called from the outer fn, inherits its permissions
|
|
5649
|
+
* • Hook callbacks — eleHook / htmlHook mount and lifecycle methods run
|
|
5650
|
+
* with isHookRunning = true. Subscriptions and atom
|
|
5651
|
+
* creation are permitted because the hook author owns
|
|
5652
|
+
* teardown via the onCleanup return value.
|
|
5653
|
+
*/
|
|
5654
|
+
declare function isInRestrictedContext(): boolean;
|
|
5655
|
+
/**
|
|
5656
|
+
* Throws a descriptive error when called from a restricted execution context.
|
|
5657
|
+
*
|
|
5658
|
+
* Allowed
|
|
5659
|
+
* ───────
|
|
5660
|
+
* ✅ ES module scope (top-level, outside any component)
|
|
5661
|
+
* ✅ Component outer function (runs once on mount)
|
|
5662
|
+
* ✅ Scope setup() (runs inside the outer function — same rules)
|
|
5663
|
+
* ✅ Hook callbacks (isHookRunning === true)
|
|
5664
|
+
* eleHook / htmlHook mount and lifecycle methods
|
|
5665
|
+
* may freely subscribe and create atoms. The hook
|
|
5666
|
+
* author is responsible for unsubscribing inside
|
|
5667
|
+
* the onCleanup return — this is NOT automatic.
|
|
5668
|
+
*
|
|
5669
|
+
* Forbidden
|
|
5670
|
+
* ─────────
|
|
5671
|
+
* ❌ Template / render function (templateInProgress === true)
|
|
5672
|
+
* ❌ effect() or memo() callback (isEffectRunning() === true)
|
|
5673
|
+
*/
|
|
5674
|
+
declare function assertNotInRestrictedContext(operationName: string): void;
|
|
5675
|
+
/**
|
|
5676
|
+
* Throws unless the current execution context is a component's outer function
|
|
5677
|
+
* (i.e. `viewOuterInProgress === true`).
|
|
5678
|
+
*
|
|
5679
|
+
* Use this for APIs — such as `ws()` — that register cleanup handlers via
|
|
5680
|
+
* `registerCleanup` and therefore require an active component host. Calling
|
|
5681
|
+
* them at module level or inside inner functions (event handlers, timers, etc.)
|
|
5682
|
+
* would silently skip cleanup, leaving timers and sockets running after the
|
|
5683
|
+
* component unmounts.
|
|
5684
|
+
*
|
|
5685
|
+
* Allowed
|
|
5686
|
+
* ───────
|
|
5687
|
+
* ✅ Component outer function (viewOuterInProgress === true)
|
|
5688
|
+
* ✅ Scope setup() (sets viewOuterInProgress = true, same rules)
|
|
5689
|
+
*
|
|
5690
|
+
* Forbidden
|
|
5691
|
+
* ─────────
|
|
5692
|
+
* ❌ Module / file scope (no active host, no cleanup)
|
|
5693
|
+
* ❌ Inner functions / event handlers (outer fn has already returned)
|
|
5694
|
+
* ❌ Template / render function (templateInProgress === true)
|
|
5695
|
+
* ❌ effect() or memo() callback (isEffectRunning() === true)
|
|
5696
|
+
*/
|
|
5697
|
+
declare function assertComponentOuterContext(operationName: string): void;
|
|
5698
|
+
|
|
5699
|
+
/**
|
|
5700
|
+
* Read tracking state for dependency collection.
|
|
5701
|
+
* Used by atoms, units, getters, and effects to track which stores are read
|
|
5702
|
+
* during reactive computations.
|
|
5703
|
+
*/
|
|
5704
|
+
declare function isReadTrackingEnabled(): boolean;
|
|
5705
|
+
declare function getStoresBeingRead(): Set<any>;
|
|
5706
|
+
declare function isEffectRunning(): boolean;
|
|
5707
|
+
declare function addStoreBeingRead(store: any): void;
|
|
5708
|
+
declare function pushEffect(): void;
|
|
5709
|
+
declare function popEffect(): void;
|
|
5710
|
+
interface TrackingSnapshot {
|
|
5711
|
+
prevEnabled: boolean;
|
|
5712
|
+
prevStores: Set<any>;
|
|
5713
|
+
}
|
|
5714
|
+
declare function saveAndEnableTracking(): TrackingSnapshot;
|
|
5715
|
+
declare function restoreTracking(prev: TrackingSnapshot): Set<any>;
|
|
5716
|
+
declare const startTracking: typeof saveAndEnableTracking;
|
|
5717
|
+
declare const stopTracking: typeof restoreTracking;
|
|
5718
|
+
|
|
5719
5719
|
/**
|
|
5720
5720
|
* Deep-clones a value. Uses native structuredClone when available (modern browsers),
|
|
5721
5721
|
* otherwise falls back to a recursive clone that supports primitives, plain objects,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,M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