@isograph/react-disposable-state 0.0.0-main-b8e58245 → 0.0.0-main-709dc2bb

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.
Files changed (57) hide show
  1. package/.turbo/turbo-compile-libs.log +9 -2
  2. package/dist/CacheItem.d.mts +63 -0
  3. package/dist/CacheItem.d.mts.map +1 -0
  4. package/dist/CacheItem.d.ts +33 -29
  5. package/dist/CacheItem.d.ts.map +1 -1
  6. package/dist/CacheItem.js +191 -271
  7. package/dist/CacheItem.mjs +193 -0
  8. package/dist/CacheItem.mjs.map +1 -0
  9. package/dist/ParentCache.d.mts +45 -0
  10. package/dist/ParentCache.d.mts.map +1 -0
  11. package/dist/ParentCache.d.ts +27 -22
  12. package/dist/ParentCache.d.ts.map +1 -1
  13. package/dist/ParentCache.js +69 -85
  14. package/dist/ParentCache.mjs +73 -0
  15. package/dist/ParentCache.mjs.map +1 -0
  16. package/dist/_virtual/rolldown_runtime.js +25 -0
  17. package/dist/index.d.mts +9 -0
  18. package/dist/index.d.ts +9 -9
  19. package/dist/index.js +24 -24
  20. package/dist/index.mjs +11 -0
  21. package/dist/useCachedResponsivePrecommitValue.d.mts +43 -0
  22. package/dist/useCachedResponsivePrecommitValue.d.mts.map +1 -0
  23. package/dist/useCachedResponsivePrecommitValue.d.ts +9 -4
  24. package/dist/useCachedResponsivePrecommitValue.d.ts.map +1 -1
  25. package/dist/useCachedResponsivePrecommitValue.js +55 -90
  26. package/dist/useCachedResponsivePrecommitValue.mjs +57 -0
  27. package/dist/useCachedResponsivePrecommitValue.mjs.map +1 -0
  28. package/dist/useDisposableState.d.mts +13 -0
  29. package/dist/useDisposableState.d.mts.map +1 -0
  30. package/dist/useDisposableState.d.ts +10 -7
  31. package/dist/useDisposableState.d.ts.map +1 -1
  32. package/dist/useDisposableState.js +36 -72
  33. package/dist/useDisposableState.mjs +37 -0
  34. package/dist/useDisposableState.mjs.map +1 -0
  35. package/dist/useHasCommittedRef.d.mts +11 -0
  36. package/dist/useHasCommittedRef.d.mts.map +1 -0
  37. package/dist/useHasCommittedRef.d.ts +7 -2
  38. package/dist/useHasCommittedRef.d.ts.map +1 -1
  39. package/dist/useHasCommittedRef.js +15 -11
  40. package/dist/useHasCommittedRef.mjs +17 -0
  41. package/dist/useHasCommittedRef.mjs.map +1 -0
  42. package/dist/useLazyDisposableState.d.mts +20 -0
  43. package/dist/useLazyDisposableState.d.mts.map +1 -0
  44. package/dist/useLazyDisposableState.d.ts +9 -4
  45. package/dist/useLazyDisposableState.d.ts.map +1 -1
  46. package/dist/useLazyDisposableState.js +32 -39
  47. package/dist/useLazyDisposableState.mjs +34 -0
  48. package/dist/useLazyDisposableState.mjs.map +1 -0
  49. package/dist/useUpdatableDisposableState.d.mts +43 -0
  50. package/dist/useUpdatableDisposableState.d.mts.map +1 -0
  51. package/dist/useUpdatableDisposableState.d.ts +10 -7
  52. package/dist/useUpdatableDisposableState.d.ts.map +1 -1
  53. package/dist/useUpdatableDisposableState.js +73 -89
  54. package/dist/useUpdatableDisposableState.mjs +74 -0
  55. package/dist/useUpdatableDisposableState.mjs.map +1 -0
  56. package/package.json +14 -6
  57. package/dist/index.d.ts.map +0 -1
@@ -1,5 +1,12 @@
1
1
  ../.. |  WARN  Unsupported engine: wanted: {"node":"22.9.0"} (current: {"node":"v22.21.1","pnpm":"10.15.0"})
2
2
 
3
- > @isograph/react-disposable-state@0.0.0-main-b8e58245 compile-libs /home/runner/work/isograph/isograph/libs/isograph-react-disposable-state
4
- > rimraf dist && tsc -p tsconfig.pkg.json
3
+ > @isograph/react-disposable-state@0.0.0-main-709dc2bb compile-libs /home/runner/work/isograph/isograph/libs/isograph-react-disposable-state
4
+ > tsdown
5
5
 
6
+ ℹ tsdown v0.15.10 powered by rolldown v1.0.0-beta.44
7
+ ℹ Using tsdown config: /home/runner/work/isograph/isograph/tsdown.config.ts
8
+ (node:2472) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/isograph/isograph/tsdown.config.ts is not specified and it doesn't parse as CommonJS.
9
+ Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
10
+ To eliminate this warning, add "type": "module" to /home/runner/work/isograph/isograph/package.json.
11
+ (Use `node --trace-warnings ...` to show where the warning was created)
12
+ ℹ Build start
@@ -0,0 +1,63 @@
1
+ import { CleanupFn, Factory, ItemCleanupPair } from "@isograph/disposable-types";
2
+
3
+ //#region src/CacheItem.d.ts
4
+ type NotInParentCacheAndDisposed = {
5
+ kind: 'NotInParentCacheAndDisposed';
6
+ };
7
+ type NotInParentCacheAndNotDisposed<T> = {
8
+ kind: 'NotInParentCacheAndNotDisposed';
9
+ value: T;
10
+ disposeValue: () => void;
11
+ permanentRetainCount: number;
12
+ };
13
+ type InParentCacheAndNotDisposed<T> = {
14
+ kind: 'InParentCacheAndNotDisposed';
15
+ value: T;
16
+ disposeValue: () => void;
17
+ removeFromParentCache: () => void;
18
+ temporaryRetainCount: number;
19
+ permanentRetainCount: number;
20
+ };
21
+ type CacheItemState<T> = InParentCacheAndNotDisposed<T> | NotInParentCacheAndNotDisposed<T> | NotInParentCacheAndDisposed;
22
+ type CacheItemOptions = {
23
+ temporaryRetainTime: number;
24
+ };
25
+ /**
26
+ * CacheItem:
27
+ *
28
+ * Terminology:
29
+ * - TRC = Temporary Retain Count
30
+ * - PRC = Permanent Retain Count
31
+ *
32
+ * A CacheItem<T> can be in three states:
33
+ * In parent cache? | Item disposed? | TRC | PRC | Name
34
+ * -----------------+----------------+-----+-----+-------------------------------
35
+ * In parent cache | Not disposed | >0 | >=0 | InParentCacheAndNotDisposed
36
+ * Removed | Not disposed | 0 | >0 | NotInParentCacheAndNotDisposed
37
+ * Removed | Disposed | 0 | 0 | NotInParentCacheAndNotDisposed
38
+ *
39
+ * A cache item can only move down rows. As in, if its in the parent cache,
40
+ * it can be removed. It can never be replaced in the parent cache. (If a
41
+ * parent cache becomes full again, it will contain a new CacheItem.) The
42
+ * contained item can be disposed, but never un-disposed.
43
+ *
44
+ * So, the valid transitions are:
45
+ * - InParentCacheAndNotDisposed => NotInParentCacheAndNotDisposed
46
+ * - InParentCacheAndNotDisposed => NotInParentCacheAndDisposed
47
+ * - NotInParentCacheAndNotDisposed => NotInParentCacheAndDisposed
48
+ */
49
+ declare class CacheItem<T> {
50
+ private __state;
51
+ private __options;
52
+ constructor(factory: Factory<T>, removeFromParentCache: CleanupFn, options: CacheItemOptions | void);
53
+ getValue(): T;
54
+ permanentRetainIfNotDisposed(disposeOfTemporaryRetain: CleanupFn): ItemCleanupPair<T> | null;
55
+ temporaryRetain(): CleanupFn;
56
+ permanentRetain(): CleanupFn;
57
+ private __maybeExitInParentCacheAndNotDisposedState;
58
+ private __maybeExitNotInParentCacheAndNotDisposedState;
59
+ }
60
+ declare function createTemporarilyRetainedCacheItem<T>(factory: Factory<T>, removeFromParentCache: CleanupFn, options: CacheItemOptions | void): [CacheItem<T>, CleanupFn];
61
+ //#endregion
62
+ export { CacheItem, CacheItemOptions, CacheItemState, InParentCacheAndNotDisposed, NotInParentCacheAndDisposed, NotInParentCacheAndNotDisposed, createTemporarilyRetainedCacheItem };
63
+ //# sourceMappingURL=CacheItem.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CacheItem.d.mts","names":[],"sources":["../src/CacheItem.ts"],"sourcesContent":[],"mappings":";;;KAQY,2BAAA;;AAAZ,CAAA;AAGY,KAAA,8BAA8B,CAAA,CAAA,CAAA,GAAA;EAQ9B,IAAA,EAAA,gCAA2B;EAa3B,KAAA,EAnBH,CAmBG;EACoB,YAAA,EAAA,GAAA,GAAA,IAAA;EAA5B,oBAAA,EAAA,MAAA;CAC+B;AAA/B,KAfQ,2BAeR,CAAA,CAAA,CAAA,GAAA;EACA,IAAA,EAAA,6BAAA;EAA2B,KAAA,EAdtB,CAcsB;EAEnB,YAAA,EAAA,GAAA,GAAgB,IAAA;EA+Bf,qBAAS,EAAA,GAAA,GAAA,IAAA;EAUD,oBAAA,EAAA,MAAA;EAAR,oBAAA,EAAA,MAAA;CACc;AACd,KAhDD,cAgDC,CAAA,CAAA,CAAA,GA/CT,2BA+CS,CA/CmB,CA+CnB,CAAA,GA9CT,8BA8CS,CA9CsB,CA8CtB,CAAA,GA7CT,2BA6CS;AAgBC,KA3DF,gBAAA,GA2DE;EAkBgB,mBAAA,EAAA,MAAA;CACT;;;;;AAyPrB;;;;;;;;;;;;;;;;;;;;cAxSa;;;uBAUA,QAAQ,2BACM,oBACd;cAgBC;yDAkBgB,YACzB,gBAAgB;qBA+EA;qBAqEA;;;;iBAqGL,+CACL,QAAQ,2BACM,oBACd,2BACP,UAAU,IAAI"}
@@ -1,24 +1,26 @@
1
- import type { CleanupFn, Factory, ItemCleanupPair } from '@isograph/disposable-types';
2
- export type NotInParentCacheAndDisposed = {
3
- kind: 'NotInParentCacheAndDisposed';
1
+ import { CleanupFn, Factory, ItemCleanupPair } from "@isograph/disposable-types";
2
+
3
+ //#region src/CacheItem.d.ts
4
+ type NotInParentCacheAndDisposed = {
5
+ kind: 'NotInParentCacheAndDisposed';
4
6
  };
5
- export type NotInParentCacheAndNotDisposed<T> = {
6
- kind: 'NotInParentCacheAndNotDisposed';
7
- value: T;
8
- disposeValue: () => void;
9
- permanentRetainCount: number;
7
+ type NotInParentCacheAndNotDisposed<T> = {
8
+ kind: 'NotInParentCacheAndNotDisposed';
9
+ value: T;
10
+ disposeValue: () => void;
11
+ permanentRetainCount: number;
10
12
  };
11
- export type InParentCacheAndNotDisposed<T> = {
12
- kind: 'InParentCacheAndNotDisposed';
13
- value: T;
14
- disposeValue: () => void;
15
- removeFromParentCache: () => void;
16
- temporaryRetainCount: number;
17
- permanentRetainCount: number;
13
+ type InParentCacheAndNotDisposed<T> = {
14
+ kind: 'InParentCacheAndNotDisposed';
15
+ value: T;
16
+ disposeValue: () => void;
17
+ removeFromParentCache: () => void;
18
+ temporaryRetainCount: number;
19
+ permanentRetainCount: number;
18
20
  };
19
- export type CacheItemState<T> = InParentCacheAndNotDisposed<T> | NotInParentCacheAndNotDisposed<T> | NotInParentCacheAndDisposed;
20
- export type CacheItemOptions = {
21
- temporaryRetainTime: number;
21
+ type CacheItemState<T> = InParentCacheAndNotDisposed<T> | NotInParentCacheAndNotDisposed<T> | NotInParentCacheAndDisposed;
22
+ type CacheItemOptions = {
23
+ temporaryRetainTime: number;
22
24
  };
23
25
  /**
24
26
  * CacheItem:
@@ -44,16 +46,18 @@ export type CacheItemOptions = {
44
46
  * - InParentCacheAndNotDisposed => NotInParentCacheAndDisposed
45
47
  * - NotInParentCacheAndNotDisposed => NotInParentCacheAndDisposed
46
48
  */
47
- export declare class CacheItem<T> {
48
- private __state;
49
- private __options;
50
- constructor(factory: Factory<T>, removeFromParentCache: CleanupFn, options: CacheItemOptions | void);
51
- getValue(): T;
52
- permanentRetainIfNotDisposed(disposeOfTemporaryRetain: CleanupFn): ItemCleanupPair<T> | null;
53
- temporaryRetain(): CleanupFn;
54
- permanentRetain(): CleanupFn;
55
- private __maybeExitInParentCacheAndNotDisposedState;
56
- private __maybeExitNotInParentCacheAndNotDisposedState;
49
+ declare class CacheItem<T> {
50
+ private __state;
51
+ private __options;
52
+ constructor(factory: Factory<T>, removeFromParentCache: CleanupFn, options: CacheItemOptions | void);
53
+ getValue(): T;
54
+ permanentRetainIfNotDisposed(disposeOfTemporaryRetain: CleanupFn): ItemCleanupPair<T> | null;
55
+ temporaryRetain(): CleanupFn;
56
+ permanentRetain(): CleanupFn;
57
+ private __maybeExitInParentCacheAndNotDisposedState;
58
+ private __maybeExitNotInParentCacheAndNotDisposedState;
57
59
  }
58
- export declare function createTemporarilyRetainedCacheItem<T>(factory: Factory<T>, removeFromParentCache: CleanupFn, options: CacheItemOptions | void): [CacheItem<T>, CleanupFn];
60
+ declare function createTemporarilyRetainedCacheItem<T>(factory: Factory<T>, removeFromParentCache: CleanupFn, options: CacheItemOptions | void): [CacheItem<T>, CleanupFn];
61
+ //#endregion
62
+ export { CacheItem, CacheItemOptions, CacheItemState, InParentCacheAndNotDisposed, NotInParentCacheAndDisposed, NotInParentCacheAndNotDisposed, createTemporarilyRetainedCacheItem };
59
63
  //# sourceMappingURL=CacheItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CacheItem.d.ts","sourceRoot":"","sources":["../src/CacheItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAIpC,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,6BAA6B,CAAC;CACrC,CAAC;AACF,MAAM,MAAM,8BAA8B,CAAC,CAAC,IAAI;IAC9C,IAAI,EAAE,gCAAgC,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC;IACT,YAAY,EAAE,MAAM,IAAI,CAAC;IAGzB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AACF,MAAM,MAAM,2BAA2B,CAAC,CAAC,IAAI;IAC3C,IAAI,EAAE,6BAA6B,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC;IACT,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAGlC,oBAAoB,EAAE,MAAM,CAAC;IAG7B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,IACxB,2BAA2B,CAAC,CAAC,CAAC,GAC9B,8BAA8B,CAAC,CAAC,CAAC,GACjC,2BAA2B,CAAC;AAEhC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAKF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,SAAS,CAAC,CAAC;IACtB,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,SAAS,CAA0B;gBAQzC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,qBAAqB,EAAE,SAAS,EAChC,OAAO,EAAE,gBAAg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