rask-ui 0.29.3 → 0.30.0

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 (124) hide show
  1. package/dist/jsx-runtime.d.ts +1 -4
  2. package/dist/jsx-runtime.d.ts.map +1 -1
  3. package/dist/jsx-runtime.js +5 -7
  4. package/dist/render.d.ts.map +1 -1
  5. package/dist/render.js +21 -17
  6. package/dist/types.d.ts +3 -1
  7. package/dist/types.d.ts.map +1 -1
  8. package/package.json +1 -1
  9. package/swc-plugin/target/wasm32-wasip1/release/swc_plugin_rask_component.wasm +0 -0
  10. package/dist/batch.d.ts +0 -6
  11. package/dist/batch.d.ts.map +0 -1
  12. package/dist/batch.js +0 -84
  13. package/dist/compiler.d.ts +0 -4
  14. package/dist/compiler.d.ts.map +0 -1
  15. package/dist/compiler.js +0 -7
  16. package/dist/createAsync.d.ts +0 -39
  17. package/dist/createAsync.d.ts.map +0 -1
  18. package/dist/createAsync.js +0 -47
  19. package/dist/createComputed.d.ts +0 -4
  20. package/dist/createComputed.d.ts.map +0 -1
  21. package/dist/createComputed.js +0 -69
  22. package/dist/createEffect.d.ts +0 -2
  23. package/dist/createEffect.d.ts.map +0 -1
  24. package/dist/createEffect.js +0 -29
  25. package/dist/createMutation.d.ts +0 -43
  26. package/dist/createMutation.d.ts.map +0 -1
  27. package/dist/createMutation.js +0 -76
  28. package/dist/createQuery.d.ts +0 -42
  29. package/dist/createQuery.d.ts.map +0 -1
  30. package/dist/createQuery.js +0 -80
  31. package/dist/createRouter.d.ts +0 -8
  32. package/dist/createRouter.d.ts.map +0 -1
  33. package/dist/createRouter.js +0 -27
  34. package/dist/createState.d.ts +0 -28
  35. package/dist/createState.d.ts.map +0 -1
  36. package/dist/createState.js +0 -129
  37. package/dist/createTask.d.ts +0 -31
  38. package/dist/createTask.d.ts.map +0 -1
  39. package/dist/createTask.js +0 -79
  40. package/dist/createView.d.ts +0 -28
  41. package/dist/createView.d.ts.map +0 -1
  42. package/dist/createView.js +0 -77
  43. package/dist/error.d.ts +0 -5
  44. package/dist/error.d.ts.map +0 -1
  45. package/dist/error.js +0 -16
  46. package/dist/jsx.d.ts +0 -11
  47. package/dist/observation.d.ts +0 -93
  48. package/dist/observation.d.ts.map +0 -1
  49. package/dist/observation.js +0 -200
  50. package/dist/patchInferno.d.ts +0 -6
  51. package/dist/patchInferno.d.ts.map +0 -1
  52. package/dist/patchInferno.js +0 -53
  53. package/dist/tests/batch.test.d.ts +0 -2
  54. package/dist/tests/batch.test.d.ts.map +0 -1
  55. package/dist/tests/batch.test.js +0 -434
  56. package/dist/tests/createComputed.test.d.ts +0 -2
  57. package/dist/tests/createComputed.test.d.ts.map +0 -1
  58. package/dist/tests/createComputed.test.js +0 -257
  59. package/dist/tests/createContext.test.d.ts +0 -2
  60. package/dist/tests/createContext.test.d.ts.map +0 -1
  61. package/dist/tests/createContext.test.js +0 -149
  62. package/dist/tests/createEffect.test.d.ts +0 -2
  63. package/dist/tests/createEffect.test.d.ts.map +0 -1
  64. package/dist/tests/createEffect.test.js +0 -467
  65. package/dist/tests/createState.test.d.ts +0 -2
  66. package/dist/tests/createState.test.d.ts.map +0 -1
  67. package/dist/tests/createState.test.js +0 -144
  68. package/dist/tests/createTask.test.d.ts +0 -2
  69. package/dist/tests/createTask.test.d.ts.map +0 -1
  70. package/dist/tests/createTask.test.js +0 -322
  71. package/dist/tests/createView.test.d.ts +0 -2
  72. package/dist/tests/createView.test.d.ts.map +0 -1
  73. package/dist/tests/createView.test.js +0 -203
  74. package/dist/tests/error.test.d.ts +0 -2
  75. package/dist/tests/error.test.d.ts.map +0 -1
  76. package/dist/tests/error.test.js +0 -181
  77. package/dist/tests/observation.test.d.ts +0 -2
  78. package/dist/tests/observation.test.d.ts.map +0 -1
  79. package/dist/tests/observation.test.js +0 -341
  80. package/dist/tests/renderCount.test.d.ts +0 -2
  81. package/dist/tests/renderCount.test.d.ts.map +0 -1
  82. package/dist/tests/renderCount.test.js +0 -95
  83. package/dist/tests/scopeEnforcement.test.d.ts +0 -2
  84. package/dist/tests/scopeEnforcement.test.d.ts.map +0 -1
  85. package/dist/tests/scopeEnforcement.test.js +0 -157
  86. package/dist/tests/useAction.test.d.ts +0 -2
  87. package/dist/tests/useAction.test.d.ts.map +0 -1
  88. package/dist/tests/useAction.test.js +0 -132
  89. package/dist/tests/useAsync.test.d.ts +0 -2
  90. package/dist/tests/useAsync.test.d.ts.map +0 -1
  91. package/dist/tests/useAsync.test.js +0 -499
  92. package/dist/tests/useDerived.test.d.ts +0 -2
  93. package/dist/tests/useDerived.test.d.ts.map +0 -1
  94. package/dist/tests/useDerived.test.js +0 -407
  95. package/dist/tests/useEffect.test.d.ts +0 -2
  96. package/dist/tests/useEffect.test.d.ts.map +0 -1
  97. package/dist/tests/useEffect.test.js +0 -600
  98. package/dist/tests/useLookup.test.d.ts +0 -2
  99. package/dist/tests/useLookup.test.d.ts.map +0 -1
  100. package/dist/tests/useLookup.test.js +0 -299
  101. package/dist/tests/useRef.test.d.ts +0 -2
  102. package/dist/tests/useRef.test.d.ts.map +0 -1
  103. package/dist/tests/useRef.test.js +0 -189
  104. package/dist/tests/useState.test.d.ts +0 -2
  105. package/dist/tests/useState.test.d.ts.map +0 -1
  106. package/dist/tests/useState.test.js +0 -178
  107. package/dist/tests/useSuspend.test.d.ts +0 -2
  108. package/dist/tests/useSuspend.test.d.ts.map +0 -1
  109. package/dist/tests/useSuspend.test.js +0 -752
  110. package/dist/tests/useView.test.d.ts +0 -2
  111. package/dist/tests/useView.test.d.ts.map +0 -1
  112. package/dist/tests/useView.test.js +0 -305
  113. package/dist/useComputed.d.ts +0 -5
  114. package/dist/useComputed.d.ts.map +0 -1
  115. package/dist/useComputed.js +0 -69
  116. package/dist/useQuery.d.ts +0 -25
  117. package/dist/useQuery.d.ts.map +0 -1
  118. package/dist/useQuery.js +0 -25
  119. package/dist/useSuspendAsync.d.ts +0 -18
  120. package/dist/useSuspendAsync.d.ts.map +0 -1
  121. package/dist/useSuspendAsync.js +0 -37
  122. package/dist/useTask.d.ts +0 -25
  123. package/dist/useTask.d.ts.map +0 -1
  124. package/dist/useTask.js +0 -70
@@ -1,5 +1,2 @@
1
- import "inferno";
2
- export { Fragment } from "inferno";
3
- export declare function jsx(type: any, props: any, key?: any): any;
4
- export declare function jsxs(type: any, props: any, key?: any): any;
1
+ export { Fragment, createVNode as jsx, createVNode as jsxs } from "inferno";
5
2
  //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,SAAS,CAAC;AAGjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,MAAM,CAAC,OAAO,UAAU,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;AACnE,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,WAAW,IAAI,GAAG,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,SAAS,CAAC"}
@@ -1,7 +1,5 @@
1
- // JSX runtime for TypeScript type checking
2
- // The actual JSX transformation is done by SWC plugin at build time
3
- // This file only provides type declarations for TypeScript's "jsx": "react-jsx" mode
4
- // Import inferno to get the global JSX namespace
5
- import "inferno";
6
- // Re-export Fragment for JSX fragment syntax
7
- export { Fragment } from "inferno";
1
+ // JSX runtime stub for TypeScript's "jsx": "react-jsx" mode
2
+ // The actual JSX transformation is done by the SWC plugin at build time,
3
+ // but Vite's dependency optimizer resolves and bundles this module at runtime,
4
+ // so we need real exports (not just type declarations) to avoid missing export errors
5
+ export { Fragment, createVNode as jsx, createVNode as jsxs } from "inferno";
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAGlD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,QAkEjE"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAGlD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,QA2FjE"}
package/dist/render.js CHANGED
@@ -13,8 +13,9 @@ export function render(...params) {
13
13
  * Temporarily patches document.addEventListener during render to capture
14
14
  * and wrap Inferno's delegated event listeners with syncBatch
15
15
  */
16
- const originalAddEventListener = document.addEventListener.bind(document);
17
- const patchedEvents = new Set();
16
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
17
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
18
+ const wrappedListeners = new WeakMap();
18
19
  // Inferno's delegated events
19
20
  const INFERNO_EVENTS = [
20
21
  "click",
@@ -35,28 +36,31 @@ export function render(...params) {
35
36
  "submit",
36
37
  ];
37
38
  // Temporarily replace addEventListener
38
- document.addEventListener = function (type, listener, options) {
39
+ EventTarget.prototype.addEventListener = function (type, listener, options) {
39
40
  // Only wrap Inferno's delegated event listeners
40
- if (INFERNO_EVENTS.includes(type) &&
41
- typeof listener === "function" &&
42
- !patchedEvents.has(type)) {
43
- patchedEvents.add(type);
41
+ if (INFERNO_EVENTS.includes(type) && typeof listener === "function") {
44
42
  const wrappedListener = function (event) {
45
43
  transaction(() => {
46
44
  listener.call(this, event);
47
45
  });
48
46
  };
49
- return originalAddEventListener(type, wrappedListener, options);
47
+ wrappedListeners.set(listener, wrappedListener);
48
+ return originalAddEventListener.call(this, type, wrappedListener, options);
50
49
  }
51
50
  // @ts-ignore
52
- return originalAddEventListener(type, listener, options);
51
+ return originalAddEventListener.call(this, type, listener, options);
53
52
  };
54
- try {
55
- // Call render - Inferno will synchronously attach its listeners
56
- return infernoRender(...params);
57
- }
58
- finally {
59
- // Restore original addEventListener
60
- document.addEventListener = originalAddEventListener;
61
- }
53
+ EventTarget.prototype.removeEventListener = function (type, listener, options) {
54
+ if (INFERNO_EVENTS.includes(type) &&
55
+ typeof listener === "function" &&
56
+ wrappedListeners.has(listener)) {
57
+ const wrappedListener = wrappedListeners.get(listener);
58
+ wrappedListeners.delete(listener);
59
+ // @ts-ignore
60
+ return originalRemoveEventListener.call(this, type, wrappedListener, options);
61
+ }
62
+ // @ts-ignore
63
+ return originalRemoveEventListener.call(this, type, listener, options);
64
+ };
65
+ return infernoRender(...params);
62
66
  }
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ClipboardEvent as InfernoClipboardEvent, ChangeEvent as InfernoChangeEvent, DragEvent as InfernoDragEvent, FocusEvent as InfernoFocusEvent, FormEvent as InfernoFormEvent, InfernoMouseEvent, InfernoAnimationEvent, InfernoKeyboardEvent, InfernoPointerEvent, InfernoTouchEvent, InfernoWheelEvent, InfernoTransitionEvent, CompositionEvent as InfernoCompositionEvent, Inferno, Refs } from "inferno";
1
+ import type { ClipboardEvent as InfernoClipboardEvent, ChangeEvent as InfernoChangeEvent, DragEvent as InfernoDragEvent, FocusEvent as InfernoFocusEvent, FormEvent as InfernoFormEvent, InfernoMouseEvent, InfernoAnimationEvent, InfernoKeyboardEvent, InfernoPointerEvent, InfernoTouchEvent, InfernoWheelEvent, InfernoTransitionEvent, CompositionEvent as InfernoCompositionEvent, Inferno, InfernoNode, Refs } from "inferno";
2
2
  declare global {
3
3
  namespace Rask {
4
4
  interface Component<P = {}> {
@@ -19,6 +19,8 @@ declare global {
19
19
  type FocusEvent<T = Element> = InfernoFocusEvent<T>;
20
20
  type FormEvent<T = Element> = InfernoFormEvent<T>;
21
21
  type CompositionEvent<T = Element> = InfernoCompositionEvent<T>;
22
+ type Children = InfernoNode;
23
+ type RaskNode = InfernoNode;
22
24
  type ElementProps<T extends keyof JSX.IntrinsicElements> = Omit<JSX.IntrinsicElements[T], keyof Inferno.Attributes>;
23
25
  }
24
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,IAAI,qBAAqB,EACvC,WAAW,IAAI,kBAAkB,EACjC,SAAS,IAAI,gBAAgB,EAC7B,UAAU,IAAI,iBAAiB,EAC/B,SAAS,IAAI,gBAAgB,EAC7B,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,IAAI,uBAAuB,EAC3C,OAAO,EAGP,IAAI,EACL,MAAM,SAAS,CAAC;AAEjB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI,CAAC;QACb,UAAiB,SAAS,CAAC,CAAC,GAAG,EAAE;YAC/B,CAAC,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC;YAChB,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;YAC7C,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;SAC3C;QAED,KAAY,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC3D,KAAY,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACnE,KAAY,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,oBAAoB,CAAC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CAAC,CAAC;QAC7D,KAAY,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACzD,KAAY,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC3D,KAAY,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACzD,KAAY,gBAAgB,CAAC,CAAC,GAAG,OAAO,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC;QACvE,KAAY,QAAQ,GAAG,WAAW,CAAC;QACnC,KAAY,QAAQ,GAAG,WAAW,CAAC;QACnC,KAAY,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,IAAI,IAAI,CACpE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACxB,MAAM,OAAO,CAAC,UAAU,CACzB,CAAC;KACH;CACF;AAGD,OAAO,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rask-ui",
3
- "version": "0.29.3",
3
+ "version": "0.30.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/dist/batch.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export type QueuedCallback = (() => void) & {
2
- __queued: boolean;
3
- };
4
- export declare function queue(cb: QueuedCallback): void;
5
- export declare function syncBatch(cb: () => void): void;
6
- //# sourceMappingURL=batch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../src/batch.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AA+BlE,wBAAgB,KAAK,CAAC,EAAE,EAAE,cAAc,QAgBvC;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,QA6CvC"}
package/dist/batch.js DELETED
@@ -1,84 +0,0 @@
1
- const asyncQueue = [];
2
- const syncQueueStack = [];
3
- let inInteractive = 0;
4
- let asyncScheduled = false;
5
- function scheduleAsyncFlush() {
6
- if (asyncScheduled)
7
- return;
8
- asyncScheduled = true;
9
- queueMicrotask(flushAsyncQueue);
10
- }
11
- function flushAsyncQueue() {
12
- asyncScheduled = false;
13
- if (!asyncQueue.length)
14
- return;
15
- // Note: we intentionally DO NOT snapshot.
16
- // If callbacks queue more async work, it gets picked up
17
- // in this same loop because length grows.
18
- for (let i = 0; i < asyncQueue.length; i++) {
19
- const cb = asyncQueue[i];
20
- asyncQueue[i] = undefined;
21
- cb();
22
- cb.__queued = false;
23
- }
24
- asyncQueue.length = 0;
25
- }
26
- export function queue(cb) {
27
- if (cb.__queued)
28
- return;
29
- cb.__queued = true;
30
- // If we're in a sync batch, push to the current sync queue
31
- if (syncQueueStack.length) {
32
- syncQueueStack[syncQueueStack.length - 1].push(cb);
33
- return;
34
- }
35
- // Otherwise, push to async queue
36
- asyncQueue.push(cb);
37
- if (!inInteractive) {
38
- scheduleAsyncFlush();
39
- }
40
- }
41
- export function syncBatch(cb) {
42
- // Create a new queue for this sync batch
43
- const queue = [];
44
- syncQueueStack.push(queue);
45
- try {
46
- cb();
47
- }
48
- catch (e) {
49
- // Pop the queue even on error, but don't flush
50
- syncQueueStack.pop();
51
- throw e;
52
- }
53
- // CASCADING SYNCHRONOUS UPDATES
54
- // ------------------------------
55
- // Keep flushing the queue in a loop while it has work. This is critical for handling
56
- // cascading reactive updates where one observer's notification triggers another.
57
- //
58
- // Example cascade: state → derived → component
59
- // 1. User updates state in a syncBatch
60
- // 2. Derived observer is notified and queued
61
- // 3. Derived observer runs, marks derived as dirty
62
- // 4. Derived's signal notifies component observers
63
- // 5. Component observers are added to the SAME queue (because it's still on the stack)
64
- // 6. Loop continues, flushing component observers
65
- //
66
- // By keeping the queue on the stack during the flush loop, all synchronous cascades
67
- // are captured in the same batch. This ensures:
68
- // - No updates escape to the async queue
69
- // - Components render with fully updated derived values
70
- // - Deduplication works across the entire cascade (same observer can't be queued twice)
71
- //
72
- // The loop terminates when all cascades have settled (queue is empty).
73
- while (queue.length > 0) {
74
- for (let i = 0; i < queue.length; i++) {
75
- const cb = queue[i];
76
- queue[i] = undefined;
77
- cb();
78
- cb.__queued = false;
79
- }
80
- queue.length = 0;
81
- }
82
- // Pop the queue after everything is flushed
83
- syncQueueStack.pop();
84
- }
@@ -1,4 +0,0 @@
1
- export { createVNode, createFragment, createTextVNode, normalizeProps, Component, } from "inferno";
2
- import { VNode } from "inferno";
3
- export declare function createComponentVNode(_: any, component: any, props: any | undefined, key: any, ref: any): VNode;
4
- //# sourceMappingURL=compiler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../src/compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,cAAc,EACd,SAAS,GACV,MAAM,SAAS,CAAC;AAEjB,OAAO,EAGL,KAAK,EACN,MAAM,SAAS,CAAC;AAIjB,wBAAgB,oBAAoB,CAClC,CAAC,EAAE,GAAG,EACN,SAAS,EAAE,GAAG,EACd,KAAK,EAAE,GAAG,YAAK,EACf,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,GACP,KAAK,CASP"}
package/dist/compiler.js DELETED
@@ -1,7 +0,0 @@
1
- export { createVNode, createFragment, createTextVNode, normalizeProps, Component, } from "inferno";
2
- import { createComponentVNode as infernoCreateComponentVnode, } from "inferno";
3
- import { RaskComponent } from "./component";
4
- export function createComponentVNode(_, component, props = {}, key, ref) {
5
- props.__component = component;
6
- return infernoCreateComponentVnode(4 /* VNodeFlags.ComponentClass */, RaskComponent, props, key, ref);
7
- }
@@ -1,39 +0,0 @@
1
- type AsyncState<T> = {
2
- isPending: true;
3
- value: null;
4
- error: null;
5
- } | {
6
- isPending: false;
7
- value: T;
8
- error: null;
9
- } | {
10
- isPending: false;
11
- value: null;
12
- error: string;
13
- };
14
- /**
15
- * Creates a reactive async state that tracks the lifecycle of a promise.
16
- *
17
- * @warning **Do not destructure the returned reactive object!** Destructuring breaks reactivity.
18
- * Access properties directly in your render function instead.
19
- *
20
- * @example
21
- * // ❌ Bad - destructuring loses reactivity
22
- * function Component() {
23
- * const async = createAsync(fetchData());
24
- * const { isPending, value, error } = async; // Don't do this!
25
- * return () => <div>{isPending ? "Loading..." : value}</div>; // Won't update!
26
- * }
27
- *
28
- * // ✅ Good - access properties directly
29
- * function Component() {
30
- * const async = createAsync(fetchData());
31
- * return () => <div>{async.isPending ? "Loading..." : async.value}</div>;
32
- * }
33
- *
34
- * @param promise - The promise to track
35
- * @returns Reactive state with isPending, value, and error properties
36
- */
37
- export declare function createAsync<T>(promise: Promise<T>): AsyncState<T>;
38
- export {};
39
- //# sourceMappingURL=createAsync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAsync.d.ts","sourceRoot":"","sources":["../src/createAsync.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,CAAC,CAAC,IACb;IACE,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,iBAwBjD"}
@@ -1,47 +0,0 @@
1
- import { createState } from "./createState";
2
- /**
3
- * Creates a reactive async state that tracks the lifecycle of a promise.
4
- *
5
- * @warning **Do not destructure the returned reactive object!** Destructuring breaks reactivity.
6
- * Access properties directly in your render function instead.
7
- *
8
- * @example
9
- * // ❌ Bad - destructuring loses reactivity
10
- * function Component() {
11
- * const async = createAsync(fetchData());
12
- * const { isPending, value, error } = async; // Don't do this!
13
- * return () => <div>{isPending ? "Loading..." : value}</div>; // Won't update!
14
- * }
15
- *
16
- * // ✅ Good - access properties directly
17
- * function Component() {
18
- * const async = createAsync(fetchData());
19
- * return () => <div>{async.isPending ? "Loading..." : async.value}</div>;
20
- * }
21
- *
22
- * @param promise - The promise to track
23
- * @returns Reactive state with isPending, value, and error properties
24
- */
25
- export function createAsync(promise) {
26
- const state = createState({
27
- isPending: true,
28
- error: null,
29
- value: null,
30
- });
31
- promise
32
- .then((value) => {
33
- Object.assign(state, {
34
- value,
35
- error: null,
36
- isPending: false,
37
- });
38
- })
39
- .catch((error) => {
40
- Object.assign(state, {
41
- value: null,
42
- error: String(error),
43
- isPending: false,
44
- });
45
- });
46
- return state;
47
- }
@@ -1,4 +0,0 @@
1
- export declare function createComputed<T extends Record<string, () => any>>(computed: T): {
2
- [K in keyof T]: ReturnType<T[K]>;
3
- };
4
- //# sourceMappingURL=createComputed.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createComputed.d.ts","sourceRoot":"","sources":["../src/createComputed.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,EAChE,QAAQ,EAAE,CAAC,GACV;KACA,CAAC,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACjC,CA0EA"}
@@ -1,69 +0,0 @@
1
- import { getCurrentComponent, createCleanup } from "./component";
2
- import { INSPECT_MARKER, INSPECTOR_ENABLED } from "./inspect";
3
- import { getCurrentObserver, Observer, Signal } from "./observation";
4
- export function createComputed(computed) {
5
- const currentComponent = getCurrentComponent();
6
- const proxy = {};
7
- let notifyInspectorRef = {};
8
- for (const prop in computed) {
9
- let isDirty = true;
10
- let value;
11
- const signal = new Signal();
12
- const computedObserver = new Observer(() => {
13
- isDirty = true;
14
- signal.notify();
15
- if (INSPECTOR_ENABLED) {
16
- notifyInspectorRef.current?.notify({
17
- type: "computed",
18
- path: notifyInspectorRef.current.path.concat(prop),
19
- isDirty: true,
20
- value,
21
- });
22
- }
23
- });
24
- createCleanup(() => computedObserver.dispose());
25
- Object.defineProperty(proxy, prop, {
26
- enumerable: true,
27
- configurable: true,
28
- get() {
29
- const currentObserver = getCurrentObserver();
30
- if (currentObserver) {
31
- currentObserver.subscribeSignal(signal);
32
- }
33
- if (isDirty) {
34
- const stopObserving = computedObserver.observe();
35
- value = computed[prop]();
36
- stopObserving();
37
- isDirty = false;
38
- if (INSPECTOR_ENABLED) {
39
- notifyInspectorRef.current?.notify({
40
- type: "computed",
41
- path: notifyInspectorRef.current.path.concat(prop),
42
- isDirty: false,
43
- value,
44
- });
45
- }
46
- return value;
47
- }
48
- return value;
49
- },
50
- });
51
- }
52
- if (INSPECTOR_ENABLED) {
53
- Object.defineProperty(proxy, INSPECT_MARKER, {
54
- enumerable: false,
55
- configurable: false,
56
- get() {
57
- return !notifyInspectorRef.current;
58
- },
59
- set: (value) => {
60
- Object.defineProperty(notifyInspectorRef, "current", {
61
- get() {
62
- return value.current;
63
- },
64
- });
65
- },
66
- });
67
- }
68
- return proxy;
69
- }
@@ -1,2 +0,0 @@
1
- export declare function createEffect(cb: () => void | (() => void)): void;
2
- //# sourceMappingURL=createEffect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createEffect.d.ts","sourceRoot":"","sources":["../src/createEffect.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,QA2BzD"}
@@ -1,29 +0,0 @@
1
- import { syncBatch } from "./batch";
2
- import { createCleanup, getCurrentComponent } from "./component";
3
- import { Observer } from "./observation";
4
- export function createEffect(cb) {
5
- const component = getCurrentComponent();
6
- if (!component || component.isRendering) {
7
- throw new Error("Only use createEffect in component setup");
8
- }
9
- let disposer;
10
- const observer = new Observer(() => {
11
- syncBatch(runEffect);
12
- });
13
- const runEffect = () => {
14
- try {
15
- disposer?.();
16
- }
17
- catch (error) {
18
- console.error("Error in effect dispose function:", error);
19
- }
20
- const stopObserving = observer.observe();
21
- disposer = cb();
22
- stopObserving();
23
- };
24
- createCleanup(() => {
25
- observer.dispose();
26
- disposer?.();
27
- });
28
- runEffect();
29
- }
@@ -1,43 +0,0 @@
1
- type MutationState<T> = {
2
- isPending: true;
3
- params: T;
4
- error: null;
5
- } | {
6
- isPending: false;
7
- params: null;
8
- error: null;
9
- } | {
10
- isPending: false;
11
- params: null;
12
- error: string;
13
- };
14
- export type Mutation<T> = MutationState<T> & {
15
- mutate(): void;
16
- mutate(params: T): void;
17
- };
18
- /**
19
- * Creates a reactive mutation that manages async mutations with loading and error states.
20
- *
21
- * @warning **Do not destructure the returned reactive object!** Destructuring breaks reactivity.
22
- * Access properties directly in your render function instead.
23
- *
24
- * @example
25
- * // ❌ Bad - destructuring loses reactivity
26
- * function Component() {
27
- * const mutation = createMutation((params) => updateUser(params));
28
- * const { isPending, error } = mutation; // Don't do this!
29
- * return () => <button disabled={isPending}>Save</button>; // Won't update!
30
- * }
31
- *
32
- * // ✅ Good - access properties directly
33
- * function Component() {
34
- * const mutation = createMutation((params) => updateUser(params));
35
- * return () => <button disabled={mutation.isPending}>Save</button>;
36
- * }
37
- *
38
- * @param mutator - Function that performs the mutation and returns a promise
39
- * @returns Reactive mutation object with isPending, params, error properties and mutate method
40
- */
41
- export declare function createMutation<T>(mutator: (params: T) => Promise<T>): Mutation<T>;
42
- export {};
43
- //# sourceMappingURL=createMutation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createMutation.d.ts","sourceRoot":"","sources":["../src/createMutation.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,CAAC,CAAC,IAChB;IACE,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEN,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IAC3C,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GACjC,QAAQ,CAAC,CAAC,CAAC,CA0Db"}
@@ -1,76 +0,0 @@
1
- import { createState } from "./createState";
2
- /**
3
- * Creates a reactive mutation that manages async mutations with loading and error states.
4
- *
5
- * @warning **Do not destructure the returned reactive object!** Destructuring breaks reactivity.
6
- * Access properties directly in your render function instead.
7
- *
8
- * @example
9
- * // ❌ Bad - destructuring loses reactivity
10
- * function Component() {
11
- * const mutation = createMutation((params) => updateUser(params));
12
- * const { isPending, error } = mutation; // Don't do this!
13
- * return () => <button disabled={isPending}>Save</button>; // Won't update!
14
- * }
15
- *
16
- * // ✅ Good - access properties directly
17
- * function Component() {
18
- * const mutation = createMutation((params) => updateUser(params));
19
- * return () => <button disabled={mutation.isPending}>Save</button>;
20
- * }
21
- *
22
- * @param mutator - Function that performs the mutation and returns a promise
23
- * @returns Reactive mutation object with isPending, params, error properties and mutate method
24
- */
25
- export function createMutation(mutator) {
26
- const state = createState({
27
- isPending: false,
28
- params: null,
29
- error: null,
30
- });
31
- const assign = (newState) => {
32
- Object.assign(state, newState);
33
- };
34
- let currentAbortController;
35
- return {
36
- get isPending() {
37
- return state.isPending;
38
- },
39
- get params() {
40
- return state.params;
41
- },
42
- get error() {
43
- return state.error;
44
- },
45
- mutate(params) {
46
- currentAbortController?.abort();
47
- const abortController = (currentAbortController = new AbortController());
48
- assign({
49
- isPending: true,
50
- params,
51
- error: null,
52
- });
53
- mutator(params)
54
- .then(() => {
55
- if (abortController.signal.aborted) {
56
- return;
57
- }
58
- assign({
59
- isPending: false,
60
- params: null,
61
- error: null,
62
- });
63
- })
64
- .catch((error) => {
65
- if (abortController.signal.aborted) {
66
- return;
67
- }
68
- assign({
69
- isPending: false,
70
- params: null,
71
- error: String(error),
72
- });
73
- });
74
- },
75
- };
76
- }
@@ -1,42 +0,0 @@
1
- type QueryState<T> = {
2
- isPending: true;
3
- data: T | null;
4
- error: null;
5
- } | {
6
- isPending: false;
7
- data: T;
8
- error: null;
9
- } | {
10
- isPending: false;
11
- data: null;
12
- error: string;
13
- };
14
- export type Query<T> = QueryState<T> & {
15
- fetch(force?: boolean): void;
16
- };
17
- /**
18
- * Creates a reactive query that manages data fetching with loading and error states.
19
- *
20
- * @warning **Do not destructure the returned reactive object!** Destructuring breaks reactivity.
21
- * Access properties directly in your render function instead.
22
- *
23
- * @example
24
- * // ❌ Bad - destructuring loses reactivity
25
- * function Component() {
26
- * const query = createQuery(() => fetchUsers());
27
- * const { isPending, data, error } = query; // Don't do this!
28
- * return () => <div>{isPending ? "Loading..." : data.length}</div>; // Won't update!
29
- * }
30
- *
31
- * // ✅ Good - access properties directly
32
- * function Component() {
33
- * const query = createQuery(() => fetchUsers());
34
- * return () => <div>{query.isPending ? "Loading..." : query.data.length}</div>;
35
- * }
36
- *
37
- * @param fetcher - Function that returns a promise with the data to fetch
38
- * @returns Reactive query object with isPending, data, error properties and fetch method
39
- */
40
- export declare function createQuery<T>(fetcher: () => Promise<T>): Query<T>;
41
- export {};
42
- //# sourceMappingURL=createQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createQuery.d.ts","sourceRoot":"","sources":["../src/createQuery.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,CAAC,CAAC,IACb;IACE,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,IAAI,CAAC;CACb,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEN,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG;IACrC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CA+DlE"}