@fluixi/reactive 1.0.0-alpha.53

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 (176) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +343 -0
  3. package/dist/cdn/reactive.cjs +1 -0
  4. package/dist/cdn/reactive.d.ts +11 -0
  5. package/dist/cdn/reactive.d.ts.map +1 -0
  6. package/dist/cdn/reactive.global.js +1 -0
  7. package/dist/cdn/reactive.js +10 -0
  8. package/dist/cdn/reactive.mjs +1 -0
  9. package/dist/cdn/signal.cjs +1 -0
  10. package/dist/cdn/signal.d.ts +19 -0
  11. package/dist/cdn/signal.d.ts.map +1 -0
  12. package/dist/cdn/signal.global.js +1 -0
  13. package/dist/cdn/signal.js +18 -0
  14. package/dist/cdn/signal.mjs +1 -0
  15. package/dist/index.cjs +1 -0
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/index.mjs +1 -0
  20. package/dist/lib/index.cjs +1 -0
  21. package/dist/lib/index.d.ts +5 -0
  22. package/dist/lib/index.d.ts.map +1 -0
  23. package/dist/lib/index.js +4 -0
  24. package/dist/lib/index.mjs +1 -0
  25. package/dist/lib/observable/index.cjs +1 -0
  26. package/dist/lib/observable/index.d.ts +4 -0
  27. package/dist/lib/observable/index.d.ts.map +1 -0
  28. package/dist/lib/observable/index.js +3 -0
  29. package/dist/lib/observable/index.mjs +1 -0
  30. package/dist/lib/observable/observable.cjs +1 -0
  31. package/dist/lib/observable/observable.d.ts +383 -0
  32. package/dist/lib/observable/observable.d.ts.map +1 -0
  33. package/dist/lib/observable/observable.js +339 -0
  34. package/dist/lib/observable/observable.mjs +1 -0
  35. package/dist/lib/observable/subscription.cjs +1 -0
  36. package/dist/lib/observable/subscription.d.ts +70 -0
  37. package/dist/lib/observable/subscription.d.ts.map +1 -0
  38. package/dist/lib/observable/subscription.js +190 -0
  39. package/dist/lib/observable/subscription.mjs +1 -0
  40. package/dist/lib/observable/types.cjs +1 -0
  41. package/dist/lib/observable/types.d.ts +44 -0
  42. package/dist/lib/observable/types.d.ts.map +1 -0
  43. package/dist/lib/observable/types.js +1 -0
  44. package/dist/lib/observable/types.mjs +0 -0
  45. package/dist/lib/signal/cached-resource.cjs +1 -0
  46. package/dist/lib/signal/cached-resource.d.ts +94 -0
  47. package/dist/lib/signal/cached-resource.d.ts.map +1 -0
  48. package/dist/lib/signal/cached-resource.js +257 -0
  49. package/dist/lib/signal/cached-resource.mjs +1 -0
  50. package/dist/lib/signal/graph/children.cjs +1 -0
  51. package/dist/lib/signal/graph/children.d.ts +2 -0
  52. package/dist/lib/signal/graph/children.d.ts.map +1 -0
  53. package/dist/lib/signal/graph/children.js +30 -0
  54. package/dist/lib/signal/graph/children.mjs +1 -0
  55. package/dist/lib/signal/graph/compat.cjs +1 -0
  56. package/dist/lib/signal/graph/compat.d.ts +64 -0
  57. package/dist/lib/signal/graph/compat.d.ts.map +1 -0
  58. package/dist/lib/signal/graph/compat.js +178 -0
  59. package/dist/lib/signal/graph/compat.mjs +1 -0
  60. package/dist/lib/signal/graph/core.cjs +1 -0
  61. package/dist/lib/signal/graph/core.d.ts +95 -0
  62. package/dist/lib/signal/graph/core.d.ts.map +1 -0
  63. package/dist/lib/signal/graph/core.js +254 -0
  64. package/dist/lib/signal/graph/core.mjs +1 -0
  65. package/dist/lib/signal/graph/derived.cjs +1 -0
  66. package/dist/lib/signal/graph/derived.d.ts +14 -0
  67. package/dist/lib/signal/graph/derived.d.ts.map +1 -0
  68. package/dist/lib/signal/graph/derived.js +81 -0
  69. package/dist/lib/signal/graph/derived.mjs +1 -0
  70. package/dist/lib/signal/graph/detect.cjs +1 -0
  71. package/dist/lib/signal/graph/detect.d.ts +16 -0
  72. package/dist/lib/signal/graph/detect.d.ts.map +1 -0
  73. package/dist/lib/signal/graph/detect.js +36 -0
  74. package/dist/lib/signal/graph/detect.mjs +1 -0
  75. package/dist/lib/signal/graph/error-boundary.cjs +1 -0
  76. package/dist/lib/signal/graph/error-boundary.d.ts +16 -0
  77. package/dist/lib/signal/graph/error-boundary.d.ts.map +1 -0
  78. package/dist/lib/signal/graph/error-boundary.js +34 -0
  79. package/dist/lib/signal/graph/error-boundary.mjs +1 -0
  80. package/dist/lib/signal/graph/index.cjs +1 -0
  81. package/dist/lib/signal/graph/index.d.ts +21 -0
  82. package/dist/lib/signal/graph/index.d.ts.map +1 -0
  83. package/dist/lib/signal/graph/index.js +20 -0
  84. package/dist/lib/signal/graph/index.mjs +1 -0
  85. package/dist/lib/signal/graph/resource.cjs +1 -0
  86. package/dist/lib/signal/graph/resource.d.ts +36 -0
  87. package/dist/lib/signal/graph/resource.d.ts.map +1 -0
  88. package/dist/lib/signal/graph/resource.js +156 -0
  89. package/dist/lib/signal/graph/resource.mjs +1 -0
  90. package/dist/lib/signal/graph/runtime.cjs +1 -0
  91. package/dist/lib/signal/graph/runtime.d.ts +56 -0
  92. package/dist/lib/signal/graph/runtime.d.ts.map +1 -0
  93. package/dist/lib/signal/graph/runtime.js +277 -0
  94. package/dist/lib/signal/graph/runtime.mjs +1 -0
  95. package/dist/lib/signal/graph/signal-next.cjs +1 -0
  96. package/dist/lib/signal/graph/signal-next.d.ts +37 -0
  97. package/dist/lib/signal/graph/signal-next.d.ts.map +1 -0
  98. package/dist/lib/signal/graph/signal-next.js +41 -0
  99. package/dist/lib/signal/graph/signal-next.mjs +1 -0
  100. package/dist/lib/signal/graph/ssr-hooks.cjs +1 -0
  101. package/dist/lib/signal/graph/ssr-hooks.d.ts +28 -0
  102. package/dist/lib/signal/graph/ssr-hooks.d.ts.map +1 -0
  103. package/dist/lib/signal/graph/ssr-hooks.js +45 -0
  104. package/dist/lib/signal/graph/ssr-hooks.mjs +1 -0
  105. package/dist/lib/signal/graph/state.cjs +1 -0
  106. package/dist/lib/signal/graph/state.d.ts +43 -0
  107. package/dist/lib/signal/graph/state.d.ts.map +1 -0
  108. package/dist/lib/signal/graph/state.js +37 -0
  109. package/dist/lib/signal/graph/state.mjs +1 -0
  110. package/dist/lib/signal/graph/suspense.cjs +1 -0
  111. package/dist/lib/signal/graph/suspense.d.ts +13 -0
  112. package/dist/lib/signal/graph/suspense.d.ts.map +1 -0
  113. package/dist/lib/signal/graph/suspense.js +36 -0
  114. package/dist/lib/signal/graph/suspense.mjs +1 -0
  115. package/dist/lib/signal/index-legacy.cjs +1 -0
  116. package/dist/lib/signal/index-legacy.d.ts +12 -0
  117. package/dist/lib/signal/index-legacy.d.ts.map +1 -0
  118. package/dist/lib/signal/index-legacy.js +11 -0
  119. package/dist/lib/signal/index-legacy.mjs +1 -0
  120. package/dist/lib/signal/index.cjs +1 -0
  121. package/dist/lib/signal/index.d.ts +12 -0
  122. package/dist/lib/signal/index.d.ts.map +1 -0
  123. package/dist/lib/signal/index.js +11 -0
  124. package/dist/lib/signal/index.mjs +1 -0
  125. package/dist/lib/signal/list.cjs +1 -0
  126. package/dist/lib/signal/list.d.ts +39 -0
  127. package/dist/lib/signal/list.d.ts.map +1 -0
  128. package/dist/lib/signal/list.js +172 -0
  129. package/dist/lib/signal/list.mjs +1 -0
  130. package/dist/lib/signal/signal.cjs +1 -0
  131. package/dist/lib/signal/signal.d.ts +295 -0
  132. package/dist/lib/signal/signal.d.ts.map +1 -0
  133. package/dist/lib/signal/signal.js +1219 -0
  134. package/dist/lib/signal/signal.mjs +1 -0
  135. package/dist/lib/signal/types.cjs +1 -0
  136. package/dist/lib/signal/types.d.ts +133 -0
  137. package/dist/lib/signal/types.d.ts.map +1 -0
  138. package/dist/lib/signal/types.js +38 -0
  139. package/dist/lib/signal/types.mjs +1 -0
  140. package/dist/lib/signal/utilities.cjs +1 -0
  141. package/dist/lib/signal/utilities.d.ts +355 -0
  142. package/dist/lib/signal/utilities.d.ts.map +1 -0
  143. package/dist/lib/signal/utilities.js +504 -0
  144. package/dist/lib/signal/utilities.mjs +1 -0
  145. package/dist/lib/store/index.cjs +1 -0
  146. package/dist/lib/store/index.d.ts +14 -0
  147. package/dist/lib/store/index.d.ts.map +1 -0
  148. package/dist/lib/store/index.js +11 -0
  149. package/dist/lib/store/index.mjs +1 -0
  150. package/dist/lib/store/setter.types.cjs +1 -0
  151. package/dist/lib/store/setter.types.d.ts +79 -0
  152. package/dist/lib/store/setter.types.d.ts.map +1 -0
  153. package/dist/lib/store/setter.types.js +65 -0
  154. package/dist/lib/store/setter.types.mjs +0 -0
  155. package/dist/lib/store/store.cjs +1 -0
  156. package/dist/lib/store/store.d.ts +86 -0
  157. package/dist/lib/store/store.d.ts.map +1 -0
  158. package/dist/lib/store/store.js +442 -0
  159. package/dist/lib/store/store.mjs +1 -0
  160. package/dist/lib/store/types.cjs +1 -0
  161. package/dist/lib/store/types.d.ts +57 -0
  162. package/dist/lib/store/types.d.ts.map +1 -0
  163. package/dist/lib/store/types.js +1 -0
  164. package/dist/lib/store/types.mjs +0 -0
  165. package/dist/lib/store/utils.cjs +1 -0
  166. package/dist/lib/store/utils.d.ts +13 -0
  167. package/dist/lib/store/utils.d.ts.map +1 -0
  168. package/dist/lib/store/utils.js +29 -0
  169. package/dist/lib/store/utils.mjs +1 -0
  170. package/dist/lib/subject.cjs +1 -0
  171. package/dist/lib/subject.d.ts +14 -0
  172. package/dist/lib/subject.d.ts.map +1 -0
  173. package/dist/lib/subject.js +169 -0
  174. package/dist/lib/subject.mjs +1 -0
  175. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  176. package/package.json +114 -0
@@ -0,0 +1 @@
1
+ import{isObject as pt}from"@fluixi/utils/object";import{isFunction as Ie}from"@fluixi/utils/functions";var $=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let o of t)o.remove(this);if(n){for(let o of n)if(Ie(o)&&!(o instanceof e))try{o()}catch(r){console.error("Error in unsubscribe function:",r)}else if(pt(o)&&typeof o.unsubscribe=="function")try{o.unsubscribe()}catch(r){console.error("Error unsubscribing child:",r)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:o}=this;if(n){if(Ie(t))try{t()}catch(r){console.error("Error in unsubscribe function:",r)}else if(t.unsubscribe)try{t.unsubscribe()}catch(r){console.error("Error unsubscribing:",r)}return this}return o||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let o=n.indexOf(t);o!==-1&&(n.splice(o,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===1&&(this._parentOrParents=n[0]))}}};var Q=class extends ${constructor(n,o,r){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:o,complete:r}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(o){throw o}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},de=class extends Q{constructor(n,o,r,s){super(n,o,r);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};var W=class extends ${constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,o){let r;t instanceof Q?r=t:r=new de(t,n,o);let{_subscribe:s}=this;try{let l=s.call(this,r);l&&(typeof l=="function"||typeof l.unsubscribe=="function")&&r.add(l)}catch(l){r.error(l)}return r}pipe(...t){return t.length===0?this:t.reduce((n,o)=>o(n),this)}toPromise(){return new Promise((t,n)=>{let o;this.subscribe({next:r=>o=r,error:n,complete:()=>t(o)})})}};import{isPromise as le}from"@fluixi/utils";var Z=!1,vt=Symbol.for("signal"),ht=Symbol.for("memo"),Tt=Symbol.for("resource");function ee(e){return typeof e=="function"&&e[vt]===!0}function bt(e){return typeof e=="function"&&e[ht]===!0}function yt(e){return typeof e=="function"&&e[Tt]===!0}function mt(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function wt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function xt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Me(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Me(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var gt="__fluixi_signal_next_state__",St=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[gt]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:St,onSuspend:null,onError:null};var Le=0,Be=1,z=2,te=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ne=class extends te{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,this.observers)for(let n of[...this.observers])n.markDirty(z);pe(this)}}peek(){return this._value}},G=class extends te{constructor(n,o){super();this._threw=!1;this._initialized=!1;this.state=z;this.sources=null;this._fn=n,this._equals=o?.equals===!1?()=>!1:o?.equals??Object.is}get(){if(a.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Be&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===z)break}(this.state===z||!this._initialized)&&this.recompute(),this.state=Le}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=a.consumer,o=a.untracked;a.consumer=this,a.untracked=!1;let r,s=!1,l;try{r=this._fn()}catch(f){s=!0,l=f,r=this._value}finally{a.consumer=n,a.untracked=o}let c=!this._initialized||this._threw!==s||(s?l!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=s,this._error=l,this._value=r,c){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(z);pe(this)}}markDirty(n){if(this.state>=n)return;let o=this.state===Le;if(this.state=n,o){if(this.observers)for(let r of[...this.observers])r.markDirty(Be);pe(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function pe(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var re=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function Ot(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ge(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Te(){return a.owner}function oe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function be(e){a.owner&&(a.owner.cleanups??=[]).push(e)}function ve(e){if(e.owned){for(let t=e.owned.length-1;t>=0;t--)ve(e.owned[t]);e.owned=null}if(e.cleanups){for(let t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}}function je(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Ct(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(ye)))}function ye(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function Ve(){a.batchDepth===0&&ye()}var he=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Ot(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new G(()=>{ve(this.owner),oe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new re(()=>Ct(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),ve(this.owner))}};function $e(e){let t=new he(e);return()=>t.dispose()}function Rt(e){return!!e&&typeof e.then=="function"}je(()=>{});var We=Symbol.for("signal"),_t=Symbol.for("memo"),At=Symbol.for("signal-node");function me(e,t){let n=new ne(e,{equals:t?.equals}),o=(()=>n.get()),r=(s=>{let l=typeof s=="function"?s(n.peek()):s;return n.set(l),Ve(),l});return Object.defineProperty(o,We,{value:!0,enumerable:!0}),Object.defineProperty(o,At,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[o,r]}function se(e,t,n){let o=t,r=Te(),s=new G(()=>oe(r,()=>{try{return o=e(o)}catch(c){if(Rt(c))return Ge(c),o;throw c}}),{equals:n?.equals}),l=(()=>s.get());return Object.defineProperty(l,We,{value:!0,enumerable:!0}),Object.defineProperty(l,_t,{value:!0,enumerable:!0}),l}function we(e,t){let n=t;return $e(()=>{n=e(n)})}function ze(e,t=(n,o)=>n===o){let n=new Map;return we(()=>{let o=e();for(let[r,s]of n){let[l,c]=s,f=t(r,o);l()!==f&&c(f)}}),o=>{let r=n.get(o);if(!r){let[s,l]=me(!1);r=[s,l],n.set(o,r);let c=e();l(t(o,c))}return r[0]()}}function Ft(e,t){let[n,o]=me(e(),t);return we(()=>{let r=e();t?.timeoutMs?setTimeout(()=>o(()=>r),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>o(()=>r)):Promise.resolve().then(()=>o(()=>r))}),n}function Et(e,t){let n,o=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{if(n=void 0,r.length>0){let s=r[r.length-1];typeof s=="object"&&s&&!s.tagName&&s.target&&s.target.tagName&&(s=s.target),s&&typeof s=="object"&&s.tagName&&(s.tagName.toLowerCase()==="input"||s.tagName.toLowerCase()==="textarea")&&s.focus()}e(...r)},t)};return be(()=>{n!==void 0&&clearTimeout(n)}),o}function ie(e){if(typeof e=="function"&&!e.length){let t=e();return ee(t)?t:ie(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let o=ie(e[n]);Array.isArray(o)?t.push.apply(t,o):t.push(o)}return t}return e}function He(e){let t=se(e);return se(()=>ie(t()))}var xe=null;function Pt(e){xe=e}function Ye(e){xe&&xe(e)}var ge=null;function kt(e){ge=e}function Ke(e){return ge?ge(e):void 0}var Se=null;function Dt(e){Se=e}function Xe(){return Se?Se():void 0}var Oe=null;function qt(e){Oe=e}function Je(e,t){Oe&&Oe(e,t)}var Ee=Symbol.for("signal"),Nt=Symbol.for("memo"),Ut=Symbol.for("resource"),Qe=Symbol("fluixi-proxy"),tt=Symbol.for("signal-node"),A=0,H=1,E=2,F=3,u=null,d=null,i=null,ue=null,ae=0,It=!1,Ce=!1,j=0,Mt=1e6,m=new WeakMap,g=null;var Lt=null,Bt=new Map,Gt=0,Re={context:null,owner:null,routeData:new Map,matchedRoute:new Map};function Mn(e){u=e,Re.owner=e,Re.context=e}function Ln(){return Re}function jt(){return`node_${++Gt}_${Date.now()}`}function Vt(e){!1}function nt(e,t,n){let o={id:jt(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return Vt(o),o}function rt(e,t){return e===t}function Pe(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}var _e=null,Ae=null;function ot(){if(!_e){let[e,t]=M(!1);_e=e,Ae=t}}function st(e){if(i)i.indexOf(e)===-1&&i.push(e);else if(g&&g.running&&!e.pure)g.effects.indexOf(e)===-1&&g.effects.push(e);else if(!e.pure||e.computed)X(e);else if(e.pure&&!e.computed&&e.accessor){let t=d,n=i;d=null,i=[],e.accessor(),d=t;let o=i;if(i=n,o.length>0){let r=i;ce(o),i=r}}}function Ze(e,t){for(let n=0;n<e.length;n++)t(e[n])}function M(e,t){let n=e;typeof n=="object"&&n&&Qe in n&&delete n[Qe];let o=nt("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),r=[l,c];m.set(r,new Set);let s;function l(){let f=d;if(f){f.sources?f.sources.indexOf(r)===-1&&f.sources.push(r):f.sources=[r];let p=m.get(r);p&&!p.has(f)&&p.add(f)}return n}function c(f){let p=typeof f=="function"?f(n):f,b=o.equals||rt;if(t?.equals===!1||!b(n,p)){n=p,o.value=p,o.version++,o.updated=Date.now();let k=m.get(r);if(k&&k.size>0){let D=function(v,h=!1){let q=v.state;if(!(q===F&&v===d)){if(h&&!v.pure){q===A&&(v.state=H,It&&(i!==null&&i.indexOf(v)===-1?i.push(v):C.push(v)));return}if(!w.has(v)&&(w.add(v),v.state=E,q===A||q===H?C.push(v):!v.pure&&i!==null&&i.indexOf(v)===-1&&i.push(v),v.pure&&v.accessor)){let O=m.get(v.accessor);O&&Ze(Array.from(O),R=>D(R,!0))}}};var x=D;let S=Array.from(k),C=[],w=new Set;Ze(S,D);for(let v of C)st(v)}}}return l.toObservable=()=>new W(f=>{let p=!0;return K(()=>{let x=l();p?p=!1:f.next(x)})}),Object.defineProperty(l,Ee,{value:!0,enumerable:!0}),Object.defineProperty(l,tt,{value:o,enumerable:!1}),r}function K(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&P(T);return r&&(o.suspense=r),ke(o,t),()=>U(o)}function ke(e,t){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let r=0;r<e.owned.length;r++)U(e.owned[r]);e.owned=null}let n=d,o=u;if(d=e,u=e,ae++,ae>Mt)throw ae=0,d=n,u=o,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=F;let r=e.fn(t);typeof r=="function"&&(e.cleanups?e.cleanups.push(r):e.cleanups=[r]),e.state===F&&(e.state=A)}catch(r){if(le(r)){let s=T&&P(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Pe(r)}finally{d=n,u=o}}function X(e){if(!(e.disposed||!e.fn||e.state===A)&&(e.state===E||e.state===H||e.state===F)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)U(e.owned[t]);e.owned=null}e.renderEffect?lt(e):ke(e,e.value)}}function U(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=m.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)U(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function $t(e,t,n){let o=nt("memo",t,{equals:n?.equals===!1?void 0:n?.equals,name:n?.name}),r={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,updatedAt:null,node:o,accessor:void 0};u&&(u.owned?u.owned.push(r):u.owned=[r]);let s=()=>{if(d&&d!==r){d.sources?d.sources.indexOf(s)===-1&&d.sources.push(s):d.sources=[s];let c=s;m.has(c)||m.set(c,new Set);let f=m.get(c);f&&f.add(d)}if(r.state!==A){if(r.sources){for(let p of r.sources){let b=m.get(p);b&&b.delete(r)}r.sources=null,r.sourceSlots=null}if(r.cleanups){for(let p=0;p<r.cleanups.length;p++)r.cleanups[p]();r.cleanups=null}if(r.owned){for(let p=0;p<r.owned.length;p++)U(r.owned[p]);r.owned=null}let c=d,f=u;d=r,u=r,r.state=F;try{let p=r.fn(r.value),b=o.equals||rt;if(n?.equals===!1||!b(r.value,p)){r.value=p,o.value=p,o.version++,o.updated=Date.now();let k=s,S=m.get(k);if(S&&S.size>0){let v=function(h,q=!1){if(h===r)return;let O=h.state;if(O!==F){if(q&&!h.pure){O===A&&(h.state=H,i!==null&&i.indexOf(h)===-1?i.push(h):w.push(h));return}if(!D.has(h)&&(D.add(h),h.state=E,O===A||O===H?w.push(h):!h.pure&&i!==null&&i.indexOf(h)===-1&&i.push(h),h.pure&&h.accessor)){let R=m.get(h.accessor);if(R&&R.size>0)for(let V of Array.from(R))v(V,!0)}}};var l=v;let C=Array.from(S),w=[],D=new Set;for(let h=0;h<C.length;h++)v(C[h]);for(let h of w)st(h)}}r.state===F&&(r.state=A)}catch(p){if(le(p)){let b=T&&P(T);if(!b&&T){let x=f;for(;x;){if(x.contexts?.has(T.id)){b=x.contexts.get(T.id);break}x=x.owner}}return b&&(b.increment(),p.finally(()=>b.decrement())),r.value}Pe(p)}finally{d=c,u=f}}return r.value};return r.accessor=s,m.set(s,new Set),s.toObservable=()=>new W(l=>{let c=!0;return K(()=>{let p=s();c?c=!1:l.next(p)})}),Object.defineProperty(s,Ee,{value:!0,enumerable:!0}),Object.defineProperty(s,Nt,{value:!0,enumerable:!0}),Object.defineProperty(s,tt,{value:o,enumerable:!1}),s}function ce(e){let t=[],n=[];for(let r of e)r.pure&&!r.computed&&r.accessor?t.indexOf(r)===-1&&t.push(r):(r.computed||!r.pure)&&n.indexOf(r)===-1&&n.push(r);i=[];let o=0;for(;o<t.length;){let r=t[o++],s=m.get(r.accessor);if(s&&s.size>0){let c=d;d=null,r.accessor(),d=c}let l=i.splice(0);for(let c of l)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}i=null;for(let r of n)(r.computed||!r.pure)&&X(r)}function _(e){if(i&&j>0)return e();if(i&&j===0){let t=i,n=[];i=n,j++;let o;try{o=e()}finally{j--,i=t}let r=i;return ce(n),i=r,o}j++,i=[],ue=[];try{return e()}finally{j--,it()}}function it(){if(!Ce){Ce=!0,ae=0;try{for(;i&&i.length>0;){let e=i;i=null,ce(e)}if(i=null,ue){let e=ue;ue=null;for(let t=0;t<e.length;t++)X(e[t])}}finally{Ce=!1}}}function Wt(e){let t={owned:null,cleanups:null,contexts:null,owner:u},n=d;d=null;let o=u;u=t;try{return e(()=>{if(t.owned)for(let r=0;r<t.owned.length;r++)U(t.owned[r]);if(t.cleanups)for(let r=0;r<t.cleanups.length;r++)t.cleanups[r]()})}finally{u=o,d=n}}function Y(e){let t=d;d=null;try{return e()}finally{d=t}}function Fe(e){u&&(u.cleanups?u.cleanups.push(e):u.cleanups=[e])}function zt(e,t,n={}){let o,r;typeof t=="function"?(o=typeof e=="function"?e:()=>e,r=t):(o=()=>!0,r=e,t&&typeof t=="object"&&(n=t));let{initialValue:s,name:l}=n,c=Xe(),f=c!==void 0?Ke(c):void 0,p=f!==void 0,[b,x]=M(f!==void 0?f.value:n.initialValue,{equals:!1}),[k,S]=M(void 0,{equals:!1}),[C,w]=M(f!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[D,v]=M(void 0,{equals:!1}),[h,q]=M(void 0,{equals:!1}),O=Symbol(),R=O,V=!1,ct=y=>{if(!(typeof localStorage>"u"))try{y&&localStorage.setItem("storage",JSON.stringify({data:y,timestamp:Date.now()}))}catch(L){console.error(`Failed to save resource to cache (${l}):`,L)}},ft=K(()=>{let y=o?o():e;if(h(),y===!1||y===null||y===void 0){R=O,_(()=>{w("unresolved"),v(void 0),S(void 0)});return}let L=V;if(V=!1,R!==O&&y===R&&!L)return;if(R=y,p){p=!1;return}let B=!1;Fe(()=>B=!0);let Ne=Y(C),dt=Y(b),Ue=Ne==="ready"||Ne==="refreshing";_(()=>{w(Ue?"refreshing":"pending"),S(void 0)});try{let N=r(y,{value:dt,refetching:Ue});if(le(N)){v(N),Ye(N),N.then(I=>{B||(c!==void 0&&Je(c,I),_(()=>{x(()=>I),ct(I),w("ready"),v(void 0)}))},I=>{B||_(()=>{S(I),w("errored"),v(void 0)})}).catch(I=>{B||_(()=>{S(I),w("errored"),v(void 0)})});let fe=T&&P(T);fe&&(fe.increment(),N.finally(()=>fe.decrement()))}else{if(B)return;_(()=>{x(()=>N),w("ready"),v(void 0)})}}catch(N){if(B)return;_(()=>{S(N),w("errored"),v(void 0)})}});Fe(ft);let qe=()=>{let y=C();return y==="pending"||y==="refreshing"},J=(()=>{let y=k();if(y)throw y;if(qe()){let L=D();if(L)throw L}return b()});return Object.defineProperty(J,Ut,{value:!0,enumerable:!0}),Object.defineProperty(J,Ee,{value:!0,enumerable:!0}),Object.defineProperties(J,{state:{get:C},loading:{get:()=>qe()},error:{get:k},latest:{get:b}}),[J,{mutate:x,refetch:()=>{V=!0,q(void 0)}}]}function Ht(){return u}function Yt(e,t){let n=u,o=d;u=e,d=null;try{return t()}finally{u=n,d=o}}function De(e){let t=Symbol("context"),n=Kt(t);return{id:t,Provider:n,defaultValue:e}}function Kt(e){return t=>{let n=u;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let o;return at(()=>{o=Y(()=>{let r=u;return r&&(r.contexts||(r.contexts=new Map),r.contexts.set(e,t.value)),He(()=>t.children)})}),o}}function P(e){let t=u;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Xt(){return new Promise(e=>{queueMicrotask(()=>{it(),e()})})}function ut(e){if(g&&g.running)return e(),g.done;ot();let t,n=new Promise(r=>t=r),o={running:!0,effects:[],resolve:t,done:n};g=o;try{e()}finally{o.running=!1}return o.effects.length?(Ae(!0),Promise.resolve().then(()=>{let r=o.effects.splice(0);g=null,Ae(!1),r.length&&_(()=>{for(let s of r)s.state=E,X(s)}),t()}),n):(g=null,t(),n)}function Jt(){return ot(),[_e,ut]}function Qt(e,t,n){let o=n?.defer??!1,r=!0;return s=>{let l=e();return o&&r?(r=!1,s):Y(()=>t(l,s))}}function at(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&P(T);return r&&(o.suspense=r),lt(o),()=>U(o)}function lt(e){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let r=0;r<e.cleanups.length;r++)e.cleanups[r]();e.cleanups=null}if(e.owned){for(let r=0;r<e.owned.length;r++)U(e.owned[r]);e.owned=null}let t=d,n=u,o=i;d=e,u=e,i===null&&(i=[]),e.state=F;try{let r=e.fn(e.value);typeof r=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(r)),e.value=r,e.state===F&&(e.state=A)}catch(r){if(le(r)){let s=T&&P(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Pe(r)}finally{d=t,u=n;let r=i;if(i=o,r!==o&&r&&r.length>0){let s=i;ce(r),i=s}}}function Zt(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,computed:!0,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]),g&&g.running?(i||(i=[]),i.indexOf(o)===-1&&i.push(o)):i?i.indexOf(o)===-1&&i.push(o):ke(o,t)}var T;function en(){return T||(T=De())}var et;function tn(){return et||(et=De())}function nn(e){if(!e.length)return;let t=e.slice();e.length=0;for(let n of t)n.state=E,X(n)}function rn(e){let t=T&&P(T);t&&t.inFallback()?K(()=>{t.inFallback()||e()}):e()}function on(e){Lt=e}function sn(e){let t=T&&P(T);return t&&(t.increment(),e.finally(()=>t.decrement())),e}var Gn={createSignal:M,createEffect:K,createMemo:$t,createComputed:Zt,createRoot:Wt,createSelector:ze,createResource:zt,batch:_,untrack:Y,onCleanup:Fe,getOwner:Ht,runWithOwner:Yt,createContext:De,useContext:P,flush:Xt,startTransition:ut,useTransition:Jt,isSignal:ee,on:Qt,createRenderEffect:at,getSuspenseContext:en,getSuspenseListContext:tn,resumeEffects:nn,onResolve:rn,setScheduler:on,trackPromise:sn};export{Nt as $MEMO,Qe as $PROXY,Ut as $RESOURCE,Ee as $SIGNAL,Z as __DEV__,_ as batch,Zt as createComputed,De as createContext,Et as createDebounce,Ft as createDeferred,K as createEffect,$t as createMemo,Kt as createProvider,at as createRenderEffect,zt as createResource,Wt as createRoot,ze as createSelector,M as createSignal,Gn as default,Xt as flush,Ht as getOwner,Ke as getServerData,Ln as getSharedConfig,en as getSuspenseContext,tn as getSuspenseListContext,mt as isComponent,bt as isMemo,xt as isProvider,yt as isResource,ee as isSignal,wt as isSuspense,Me as makeArrayFlat,Xe as nextResourceId,Qt as on,Fe as onCleanup,rn as onResolve,He as readChildren,Je as reportResourceData,nn as resumeEffects,Yt as runWithOwner,Mn as setOwner,qt as setResourceDataSink,Dt as setResourceIdSource,Pt as setResourceTracker,on as setScheduler,kt as setServerDataGetter,Re as sharedConfig,ut as startTransition,sn as trackPromise,Ye as trackResourcePromise,Y as untrack,P as useContext,Jt as useTransition};
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var d=(a,n)=>{for(var r in n)i(a,r,{get:n[r],enumerable:!0})},m=(a,n,r,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of u(n))!l.call(a,o)&&o!==r&&i(a,o,{get:()=>n[o],enumerable:!(e=b(n,o))||e.enumerable});return a};var p=a=>m(i({},"__esModule",{value:!0}),a);var v={};d(v,{ComputationType:()=>s,SignalMode:()=>t});module.exports=p(v);var t=(e=>(e.GRANULAR="granular",e.STREAM="stream",e.ADAPTIVE="adaptive",e))(t||{}),s=(e=>(e.EFFECT="effect",e.MEMO="memo",e.DERIVED="derived",e))(s||{});
@@ -0,0 +1,133 @@
1
+ import { Observable, Subscription } from '@fluixi/reactive/observable';
2
+ import { Subject } from '../subject.js';
3
+ export type EqualityFn<T> = (a: T, b: T) => boolean;
4
+ export declare enum SignalMode {
5
+ /** SolidJS style - granular updates */
6
+ GRANULAR = "granular",
7
+ /** RxJS style - observable streams */
8
+ STREAM = "stream",
9
+ /** Adaptive - switches based on usage */
10
+ ADAPTIVE = "adaptive"
11
+ }
12
+ /**
13
+ * Universal Signal Interface
14
+ */
15
+ export interface UniversalSignal<T> {
16
+ /** Get current value (tracked) */
17
+ get value(): T;
18
+ /** Set value (reactive update) */
19
+ set value(newValue: T);
20
+ /** Peek at value without tracking */
21
+ peek(): T;
22
+ /** Update based on previous value */
23
+ update(updater: (prev: T) => T): void;
24
+ /** Get as Observable */
25
+ $: Observable<T>;
26
+ /** Subscribe to changes */
27
+ subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
28
+ /** Pipe operators */
29
+ pipe: (...operators: any[]) => Observable<T>;
30
+ /** Get current mode */
31
+ readonly mode: SignalMode;
32
+ /** Switch operating mode */
33
+ setMode(mode: SignalMode): void;
34
+ /** Signal version (increments on change) */
35
+ readonly version: number;
36
+ /** Signal name */
37
+ readonly name?: string;
38
+ /** Dispose signal */
39
+ dispose(): void;
40
+ /** String representation */
41
+ toString(): string;
42
+ readonly _meta: SignalMeta<T>;
43
+ }
44
+ /**
45
+ * Signal metadata for performance optimization
46
+ */
47
+ /**
48
+ * Computation types
49
+ */
50
+ export declare enum ComputationType {
51
+ EFFECT = "effect",
52
+ MEMO = "memo",
53
+ DERIVED = "derived"
54
+ }
55
+ /**
56
+ * Signal value wrapper with metadata
57
+ */
58
+ export interface SignalValue<T> {
59
+ value: T;
60
+ version: number;
61
+ observers: Set<Computation<any>>;
62
+ dependencies: Set<Computation<any>>;
63
+ isPending: boolean;
64
+ }
65
+ /**
66
+ * Computation node for dependency tracking
67
+ */
68
+ export interface SignalMeta<T> {
69
+ value: T;
70
+ version: number;
71
+ observers: Set<Computation<any>>;
72
+ dependencies: Set<Computation<any>>;
73
+ subject?: Subject<T>;
74
+ observable?: Observable<T>;
75
+ hitCount: number;
76
+ lastAccessed: number;
77
+ mode: SignalMode;
78
+ name?: string;
79
+ id?: string;
80
+ creationStack?: string;
81
+ performanceProfile: {
82
+ reads: number;
83
+ writes: number;
84
+ averageDepth: number;
85
+ executionTime: number;
86
+ };
87
+ }
88
+ export interface UniversalSignalOptions<T> {
89
+ name?: string;
90
+ mode?: SignalMode;
91
+ equals?: EqualityFn<T>;
92
+ scheduler?: any;
93
+ adaptive?: boolean;
94
+ cache?: {
95
+ enabled: boolean;
96
+ ttl?: number;
97
+ maxSize?: number;
98
+ };
99
+ performanceHint?: 'readHeavy' | 'writeHeavy' | 'balanced';
100
+ debug?: boolean;
101
+ }
102
+ export interface Computation<T = any> {
103
+ id: number;
104
+ type: ComputationType;
105
+ fn: () => T;
106
+ value: T;
107
+ dependencies: Set<SignalValue<any> | SignalMeta<any>>;
108
+ observers: Set<Computation<any>>;
109
+ version: number;
110
+ isStale: boolean;
111
+ isRunning: boolean;
112
+ isDisposed: boolean;
113
+ scheduler?: any;
114
+ onCleanup?: () => void;
115
+ equals?: (a: T, b: T) => boolean;
116
+ }
117
+ export interface HybridComputation<T = any> extends Computation<T> {
118
+ id: number;
119
+ fn: () => T;
120
+ value: T;
121
+ observers: Set<HybridComputation<any>>;
122
+ version: number;
123
+ isStale: boolean;
124
+ isRunning: boolean;
125
+ observable?: Observable<T>;
126
+ subscription?: Subscription;
127
+ mode: SignalMode;
128
+ executionTime: number;
129
+ dependencyCount: number;
130
+ onCleanup?: () => void;
131
+ onDispose?: () => void;
132
+ }
133
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/signal/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIxC,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;AAEpD,oBAAY,UAAU;IACpB,uCAAuC;IACvC,QAAQ,aAAa;IACrB,sCAAsC;IACtC,MAAM,WAAW;IACjB,yCAAyC;IACzC,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAGhC,kCAAkC;IAClC,IAAI,KAAK,IAAI,CAAC,CAAC;IAEf,kCAAkC;IAClC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE;IAEvB,qCAAqC;IACrC,IAAI,IAAI,CAAC,CAAC;IAEV,qCAAqC;IACrC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAItC,wBAAwB;IACxB,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC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,YAAY,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IAEpB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;IAChE,EAAE,EAAE,MAAM,CAAC;IAEX,EAAE,EAAE,MAAM,CAAC,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;IAGT,SAAS,EAAE,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IAEnB,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3B,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B,IAAI,EAAE,UAAU,CAAC;IAEjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB"}
@@ -0,0 +1,38 @@
1
+ export var SignalMode;
2
+ (function (SignalMode) {
3
+ /** SolidJS style - granular updates */
4
+ SignalMode["GRANULAR"] = "granular";
5
+ /** RxJS style - observable streams */
6
+ SignalMode["STREAM"] = "stream";
7
+ /** Adaptive - switches based on usage */
8
+ SignalMode["ADAPTIVE"] = "adaptive";
9
+ })(SignalMode || (SignalMode = {}));
10
+ /**
11
+ * Signal metadata for performance optimization
12
+ */
13
+ // interface SignalMeta<T> {
14
+ // value: T;
15
+ // version: number;
16
+ // // Granular tracking
17
+ // observers: Set<Computation<any>>;
18
+ // dependencies: Set<Computation<any>>;
19
+ // // Stream tracking
20
+ // subject?: Subject<T>;
21
+ // observable?: Observable<T>;
22
+ // // Performance
23
+ // hitCount: number;
24
+ // lastAccessed: number;
25
+ // mode: SignalMode;
26
+ // // Debugging
27
+ // name?: string;
28
+ // creationStack?: string;
29
+ // }
30
+ /**
31
+ * Computation types
32
+ */
33
+ export var ComputationType;
34
+ (function (ComputationType) {
35
+ ComputationType["EFFECT"] = "effect";
36
+ ComputationType["MEMO"] = "memo";
37
+ ComputationType["DERIVED"] = "derived";
38
+ })(ComputationType || (ComputationType = {}));
@@ -0,0 +1 @@
1
+ var n=(e=>(e.GRANULAR="granular",e.STREAM="stream",e.ADAPTIVE="adaptive",e))(n||{}),a=(e=>(e.EFFECT="effect",e.MEMO="memo",e.DERIVED="derived",e))(a||{});export{a as ComputationType,n as SignalMode};
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})},j=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of K(e))!G.call(t,o)&&o!==r&&m(t,o,{get:()=>e[o],enumerable:!(n=I(e,o))||n.enumerable});return t};var H=t=>j(m({},"__esModule",{value:!0}),t);var ve={};V(ve,{combineSignal:()=>se,combineSignals:()=>ie,debounceSignal:()=>he,distinctSignal:()=>oe,everySignal:()=>te,filterSignal:()=>X,findSignal:()=>ee,guardSignal:()=>fe,mapSignal:()=>Q,mergeSignal:()=>ue,omitSignal:()=>le,pickSignal:()=>pe,readSignal:()=>Te,reduceSignal:()=>Z,selectSignal:()=>ae,someSignal:()=>re,sortSignal:()=>ne,throttleSignal:()=>be,whenSignal:()=>de,zipSignal:()=>ce});module.exports=H(ve);var L="__fluixi_signal_next_state__",N=t=>{typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)},s=globalThis[L]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:N,onSuspend:null,onError:null};var k=0,C=1,d=2,h=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(s.untracked)return;let e=s.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},b=class extends h{constructor(e,r){super(),this._value=e,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,this.observers)for(let r of[...this.observers])r.markDirty(d);w(this)}}peek(){return this._value}},l=class extends h{constructor(r,n){super();this._threw=!1;this._initialized=!1;this.state=d;this.sources=null;this._fn=r,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){if(s.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===C&&this.sources){for(let r of this.sources)if(r.updateIfNecessary(),this.state===d)break}(this.state===d||!this._initialized)&&this.recompute(),this.state=k}recompute(){if(this.sources){for(let a of this.sources)a.observers?.delete(this);this.sources.clear()}let r=s.consumer,n=s.untracked;s.consumer=this,s.untracked=!1;let o,i=!1,u;try{o=this._fn()}catch(a){i=!0,u=a,o=this._value}finally{s.consumer=r,s.untracked=n}let p=!this._initialized||this._threw!==i||(i?u!==this._error:!this._equals(this._value,o));if(this._initialized=!0,this._threw=i,this._error=u,this._value=o,p){if(this.version++,this.observers)for(let a of[...this.observers])a.markDirty(d);w(this)}}markDirty(r){if(this.state>=r)return;let n=this.state===k;if(this.state=r,n){if(this.observers)for(let o of[...this.observers])o.markDirty(C);w(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function w(t){if(t.watchers)for(let e of[...t.watchers])e._notify(t)}var T=class{constructor(e){this._watched=new Set;this._pending=new Set;this._notifyFn=e}watch(...e){for(let r of e)this._watched.add(r),(r.watchers??=new Set).add(this)}unwatch(...e){for(let r of e)this._watched.delete(r),r.watchers?.delete(this),this._pending.delete(r)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let r=this._pending.size===0;this._pending.add(e),r&&this._notifyFn()}};function z(t){return{cleanups:null,owned:null,parent:t,contexts:null}}function P(t){return s.onSuspend?(s.onSuspend(t,s.owner),!0):!1}function U(){return s.owner}function S(t,e){let r=s.owner;s.owner=t;try{return e()}finally{s.owner=r}}function O(t){if(t.owned){for(let e=t.owned.length-1;e>=0;e--)O(t.owned[e]);t.owned=null}if(t.cleanups){for(let e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}}function E(t){s.hostSchedule=t??(e=>{Promise.resolve().then(e)})}function W(t){t.queued||(t.queued=!0,s.queue.push(t),!s.scheduled&&s.batchDepth===0&&(s.scheduled=!0,s.hostSchedule(A)))}function A(){if(s.scheduled=!1,s.flushing)return;s.flushing=!0;let t=0;try{for(;s.queue.length;){if(++t>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let e=s.queue;s.queue=[];for(let r of e)r.queued=!1,r.disposed||r.run()}}finally{s.flushing=!1}}function D(){s.batchDepth===0&&A()}var x=class{constructor(e){this.queued=!1;this.disposed=!1;this.owner=z(s.owner),s.owner&&(s.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new l(()=>{O(this.owner),S(this.owner,()=>{let r=e();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),this.watcher=new T(()=>W(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&s.onSuspend){s.onSuspend(e,this.owner);return}if(s.onError&&s.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),O(this.owner))}};function R(t){let e=new x(t);return()=>e.dispose()}function Y(t){return!!t&&typeof t.then=="function"}E(()=>{});var q=Symbol.for("signal"),$=Symbol.for("memo"),J=Symbol.for("signal-node");function g(t,e){let r=new b(t,{equals:e?.equals}),n=(()=>r.get()),o=(i=>{let u=typeof i=="function"?i(r.peek()):i;return r.set(u),D(),u});return Object.defineProperty(n,q,{value:!0,enumerable:!0}),Object.defineProperty(n,J,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),[n,o]}function c(t,e,r){let n=e,o=U(),i=new l(()=>S(o,()=>{try{return n=t(n)}catch(p){if(Y(p))return P(p),n;throw p}}),{equals:r?.equals}),u=(()=>i.get());return Object.defineProperty(u,q,{value:!0,enumerable:!0}),Object.defineProperty(u,$,{value:!0,enumerable:!0}),u}function M(t,e){let r=e;return R(()=>{r=t(r)})}var B=require("@fluixi/utils/object"),_=require("@fluixi/utils/functions"),f=class t{constructor(e){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;e&&(this._subscriptions=[e])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:e,_subscriptions:r}=this;if(e instanceof t)e.remove(this);else if(e!==null)for(let n of e)n.remove(this);if(r){for(let n of r)if((0,_.isFunction)(n)&&!(n instanceof t))try{n()}catch(o){console.error("Error in unsubscribe function:",o)}else if((0,B.isObject)(n)&&typeof n.unsubscribe=="function")try{n.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(e){if(!e||e===this)return this;if(e.closed)return this;let{_closed:r,_subscriptions:n}=this;if(r){if((0,_.isFunction)(e))try{e()}catch(o){console.error("Error in unsubscribe function:",o)}else if(e.unsubscribe)try{e.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return n||(this._subscriptions=[]),this._subscriptions.push(e),e instanceof t&&e._addParent(this),this}remove(e){let{_subscriptions:r}=this;if(!r)return;let n=r.indexOf(e);n!==-1&&(r.splice(n,1),e._removeParent(this))}_addParent(e){let{_parentOrParents:r}=this;r?Array.isArray(r)?r.push(e):this._parentOrParents=[r,e]:this._parentOrParents=e}_removeParent(e){let{_parentOrParents:r}=this;if(r===e)this._parentOrParents=null;else if(Array.isArray(r)){let n=r.indexOf(e);n!==-1&&(r.splice(n,1),r.length===1&&(this._parentOrParents=r[0]))}}};var v=class extends f{constructor(r,n,o){super();this.isStopped=!1;let i;r?typeof r=="object"?i=r:i={next:r,error:n,complete:o}:i={},this.destination=i}next(r){if(!this.isStopped&&this.destination.next)try{this.destination.next(r)}catch(n){this.error(n)}}error(r){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(r)}catch(n){throw n}else throw r;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(r){this.error(r);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},F=class extends v{constructor(r,n,o,i){super(r,n,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=i||null}next(r){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(r)}catch(n){this.error(n)}}error(r){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(r)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};var y=class extends f{constructor(e){if(super(),e)this._subscribe=e;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(e,r,n){let o;e instanceof v?o=e:o=new F(e,r,n);let{_subscribe:i}=this;try{let u=i.call(this,o);u&&(typeof u=="function"||typeof u.unsubscribe=="function")&&o.add(u)}catch(u){o.error(u)}return o}pipe(...e){return e.length===0?this:e.reduce((r,n)=>n(r),this)}toPromise(){return new Promise((e,r)=>{let n;this.subscribe({next:o=>n=o,error:r,complete:()=>e(n)})})}};function Q(t,e,r){return c(()=>e(t()),void 0,r)}function X(t,e,r){return c(()=>t().filter(e),void 0,r)}function Z(t,e,r,n){return c(()=>t().reduce(e,r),void 0,n)}function ee(t,e,r){return c(()=>t().find(e),void 0,r)}function re(t,e,r){return c(()=>t().some(e),void 0,r)}function te(t,e,r){return c(()=>t().every(e),void 0,r)}function ne(t,e,r){return c(()=>[...t()].sort(e),void 0,r)}function oe(t,e){return c(()=>[...new Set(t())],void 0,e)}function se(t,e,r){return c(()=>{let n=t.map(o=>o());return e(n)},void 0,r)}function ie(...t){return new y(e=>{let r=()=>t.map(o=>typeof o=="function"?o():o.get()),n=t.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{e.next(r())}):typeof o!="function"?o.subscribe(()=>{e.next(r())}):M(()=>{e.next(r())}));return()=>{n.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function ue(t,e,r){return c(()=>t()||e(),void 0,r)}function ce(t,e,r,n){return c(()=>r(t(),e()),void 0,n)}function ae(t,e,r){return c(()=>e(t()),void 0,{equals:r,internal:!0})}function pe(t,e,r){return c(()=>{let n=t(),o={};for(let i of e)o[i]=n[i];return o},void 0,r)}function le(t,e,r){return c(()=>{let o={...t()};for(let i of e)delete o[i];return o},void 0,r)}function de(t,e,r,n){return c(()=>t()?e():r(),void 0,n)}function fe(t,e,r){return c(()=>t()?e():void 0,void 0,r)}function he(t,e,r){let[n,o]=g(t()),i;return c(()=>{let u=t();clearTimeout(i),i=setTimeout(()=>o(()=>u),e)}),n}function be(t,e,r){let[n,o]=g(t()),i=0,u;return c(()=>{let p=t(),a=Date.now();a-i>=e?(i=a,o(()=>p)):(clearTimeout(u),u=setTimeout(()=>{i=Date.now(),o(()=>p)},e-(a-i)))}),n}function Te(t){let e=t;for(;typeof e=="function";)e=e();return e}
@@ -0,0 +1,355 @@
1
+ /**
2
+ * @fileoverview Signal Utility Functions
3
+ * @description Common utility functions for transforming and combining signals
4
+ * @version 1.0.0
5
+ */
6
+ import { type Accessor, type MemoOptions, type EnhancedSignal } from './signal.js';
7
+ import { Observable } from '../observable/observable.js';
8
+ /**
9
+ * Transform a signal value through a mapping function
10
+ * @template T - Input signal type
11
+ * @template U - Output signal type
12
+ * @param signal - Source signal to transform
13
+ * @param fn - Mapping function to apply to signal value
14
+ * @param options - Memo options for equality checking
15
+ * @returns New accessor with transformed value
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const count = createSignal(5);
20
+ * const doubled = map(count[0], x => x * 2);
21
+ * console.log(doubled()); // 10
22
+ * ```
23
+ */
24
+ export declare function mapSignal<T, U>(signal: Accessor<T>, fn: (value: T) => U, options?: MemoOptions<U>): Accessor<U>;
25
+ /**
26
+ * Filter an array signal using a predicate function
27
+ * @template T - Array element type
28
+ * @param signal - Source signal containing array
29
+ * @param predicate - Filter function to test each element
30
+ * @param options - Memo options for equality checking
31
+ * @returns New accessor with filtered array
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const [numbers] = createSignal([1, 2, 3, 4, 5]);
36
+ * const evens = filter(numbers, x => x % 2 === 0);
37
+ * console.log(evens()); // [2, 4]
38
+ * ```
39
+ */
40
+ export declare function filterSignal<T>(signal: Accessor<T[]>, predicate: (value: T, index: number) => boolean, options?: MemoOptions<T[]>): Accessor<T[]>;
41
+ /**
42
+ * Reduce an array signal to a single value
43
+ * @template T - Array element type
44
+ * @template U - Accumulator type
45
+ * @param signal - Source signal containing array
46
+ * @param reducer - Reducer function
47
+ * @param initialValue - Initial accumulator value
48
+ * @param options - Memo options for equality checking
49
+ * @returns New accessor with reduced value
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const [numbers] = createSignal([1, 2, 3, 4, 5]);
54
+ * const sum = reduce(numbers, (acc, x) => acc + x, 0);
55
+ * console.log(sum()); // 15
56
+ * ```
57
+ */
58
+ export declare function reduceSignal<T, U>(signal: Accessor<T[]>, reducer: (accumulator: U, current: T, index: number) => U, initialValue: U, options?: MemoOptions<U>): Accessor<U>;
59
+ /**
60
+ * Find first element in array signal matching predicate
61
+ * @template T - Array element type
62
+ * @param signal - Source signal containing array
63
+ * @param predicate - Predicate function to test elements
64
+ * @param options - Memo options for equality checking
65
+ * @returns New accessor with found element or undefined
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const [users] = createSignal([{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }]);
70
+ * const user = find(users, u => u.id === 2);
71
+ * console.log(user()?.name); // 'Bob'
72
+ * ```
73
+ */
74
+ export declare function findSignal<T>(signal: Accessor<T[]>, predicate: (value: T, index: number) => boolean, options?: MemoOptions<T | undefined>): Accessor<T | undefined>;
75
+ /**
76
+ * Check if any element in array signal matches predicate
77
+ * @template T - Array element type
78
+ * @param signal - Source signal containing array
79
+ * @param predicate - Predicate function to test elements
80
+ * @param options - Memo options for equality checking
81
+ * @returns New accessor returning boolean
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const [numbers] = createSignal([1, 2, 3, 4, 5]);
86
+ * const hasEven = some(numbers, x => x % 2 === 0);
87
+ * console.log(hasEven()); // true
88
+ * ```
89
+ */
90
+ export declare function someSignal<T>(signal: Accessor<T[]>, predicate: (value: T, index: number) => boolean, options?: MemoOptions<boolean>): Accessor<boolean>;
91
+ /**
92
+ * Check if all elements in array signal match predicate
93
+ * @template T - Array element type
94
+ * @param signal - Source signal containing array
95
+ * @param predicate - Predicate function to test elements
96
+ * @param options - Memo options for equality checking
97
+ * @returns New accessor returning boolean
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * const [numbers] = createSignal([2, 4, 6, 8]);
102
+ * const allEven = every(numbers, x => x % 2 === 0);
103
+ * console.log(allEven()); // true
104
+ * ```
105
+ */
106
+ export declare function everySignal<T>(signal: Accessor<T[]>, predicate: (value: T, index: number) => boolean, options?: MemoOptions<boolean>): Accessor<boolean>;
107
+ /**
108
+ * Sort an array signal
109
+ * @template T - Array element type
110
+ * @param signal - Source signal containing array
111
+ * @param compareFn - Optional compare function for sorting
112
+ * @param options - Memo options for equality checking
113
+ * @returns New accessor with sorted array
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * const [numbers] = createSignal([3, 1, 4, 1, 5]);
118
+ * const sorted = sort(numbers);
119
+ * console.log(sorted()); // [1, 1, 3, 4, 5]
120
+ * ```
121
+ */
122
+ export declare function sortSignal<T>(signal: Accessor<T[]>, compareFn?: (a: T, b: T) => number, options?: MemoOptions<T[]>): Accessor<T[]>;
123
+ /**
124
+ * Get unique values from array signal
125
+ * @template T - Array element type
126
+ * @param signal - Source signal containing array
127
+ * @param options - Memo options for equality checking
128
+ * @returns New accessor with unique values
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const [numbers] = createSignal([1, 2, 2, 3, 3, 3, 4]);
133
+ * const unique = distinct(numbers);
134
+ * console.log(unique()); // [1, 2, 3, 4]
135
+ * ```
136
+ */
137
+ export declare function distinctSignal<T>(signal: Accessor<T[]>, options?: MemoOptions<T[]>): Accessor<T[]>;
138
+ /**
139
+ * Combine multiple signals into a single computed signal
140
+ * @template T - Tuple type of signal values
141
+ * @template U - Result type
142
+ * @param signals - Array of signals to combine
143
+ * @param combiner - Function to combine signal values
144
+ * @param options - Memo options for equality checking
145
+ * @returns New accessor with combined value
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const [a] = createSignal(1);
150
+ * const [b] = createSignal(2);
151
+ * const sum = combine([a, b], ([x, y]) => x + y);
152
+ * console.log(sum()); // 3
153
+ * ```
154
+ */
155
+ export declare function combineSignal<T extends any[], U>(signals: {
156
+ [K in keyof T]: Accessor<T[K]>;
157
+ }, combiner: (values: T) => U, options?: MemoOptions<U>): Accessor<U>;
158
+ /**
159
+ * Combine multiple signals into observable
160
+ */
161
+ export declare function combineSignals<T extends any[]>(...signals: {
162
+ [K in keyof T]: Accessor<T[K]> | EnhancedSignal<T[K]>;
163
+ }): Observable<T>;
164
+ /**
165
+ * Merge two signals, returning value from first truthy signal
166
+ * @template T - Signal value type
167
+ * @param primary - Primary signal
168
+ * @param fallback - Fallback signal if primary is falsy
169
+ * @param options - Memo options for equality checking
170
+ * @returns New accessor with merged value
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * const [user] = createSignal(null);
175
+ * const [guest] = createSignal({ name: 'Guest' });
176
+ * const current = merge(user, guest);
177
+ * console.log(current()?.name); // 'Guest'
178
+ * ```
179
+ */
180
+ export declare function mergeSignal<T>(primary: Accessor<T>, fallback: Accessor<T>, options?: MemoOptions<T>): Accessor<T>;
181
+ /**
182
+ * Combine two signals using a binary operator
183
+ * @template T - First signal type
184
+ * @template U - Second signal type
185
+ * @template V - Result type
186
+ * @param a - First signal
187
+ * @param b - Second signal
188
+ * @param operator - Binary operator function
189
+ * @param options - Memo options for equality checking
190
+ * @returns New accessor with combined value
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * const [x] = createSignal(5);
195
+ * const [y] = createSignal(3);
196
+ * const product = zip(x, y, (a, b) => a * b);
197
+ * console.log(product()); // 15
198
+ * ```
199
+ */
200
+ export declare function zipSignal<T, U, V>(a: Accessor<T>, b: Accessor<U>, operator: (a: T, b: U) => V, options?: MemoOptions<V>): Accessor<V>;
201
+ /**
202
+ * Select a derived value from a signal with custom equality
203
+ * Only updates when selected value changes according to equals function
204
+ * @template T - Signal type
205
+ * @template U - Selected value type
206
+ * @param signal - Source signal
207
+ * @param selector - Function to select value from signal
208
+ * @param equals - Optional equality function (defaults to Object.is)
209
+ * @returns New accessor with selected value
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * const [user] = createSignal({ id: 1, name: 'Alice', age: 30 });
214
+ * const userName = select(user, u => u.name);
215
+ * // Only updates when name changes, not when age changes
216
+ * ```
217
+ */
218
+ export declare function selectSignal<T, U>(signal: Accessor<T>, selector: (value: T) => U, equals?: (a: U, b: U) => boolean): Accessor<U>;
219
+ /**
220
+ * Pick specific properties from an object signal
221
+ * @template T - Object type
222
+ * @template K - Property keys
223
+ * @param signal - Source signal containing object
224
+ * @param keys - Array of property keys to pick
225
+ * @param options - Memo options for equality checking
226
+ * @returns New accessor with picked properties
227
+ *
228
+ * @example
229
+ * ```typescript
230
+ * const [user] = createSignal({ id: 1, name: 'Alice', age: 30, email: 'alice@example.com' });
231
+ * const userData = pick(user, ['name', 'email']);
232
+ * console.log(userData()); // { name: 'Alice', email: 'alice@example.com' }
233
+ * ```
234
+ */
235
+ export declare function pickSignal<T extends Record<string, any>, K extends keyof T>(signal: Accessor<T>, keys: K[], options?: MemoOptions<Pick<T, K>>): Accessor<Pick<T, K>>;
236
+ /**
237
+ * Omit specific properties from an object signal
238
+ * @template T - Object type
239
+ * @template K - Property keys to omit
240
+ * @param signal - Source signal containing object
241
+ * @param keys - Array of property keys to omit
242
+ * @param options - Memo options for equality checking
243
+ * @returns New accessor with omitted properties
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * const [user] = createSignal({ id: 1, name: 'Alice', age: 30, password: 'secret' });
248
+ * const safeUser = omit(user, ['password']);
249
+ * console.log(safeUser()); // { id: 1, name: 'Alice', age: 30 }
250
+ * ```
251
+ */
252
+ export declare function omitSignal<T extends Record<string, any>, K extends keyof T>(signal: Accessor<T>, keys: K[], options?: MemoOptions<Omit<T, K>>): Accessor<Omit<T, K>>;
253
+ /**
254
+ * Conditionally compute signal based on condition
255
+ * @template T - Result type
256
+ * @param condition - Condition signal or accessor
257
+ * @param whenTrue - Accessor to use when condition is true
258
+ * @param whenFalse - Accessor to use when condition is false
259
+ * @param options - Memo options for equality checking
260
+ * @returns New accessor with conditional value
261
+ *
262
+ * @example
263
+ * ```typescript
264
+ * const [isLoggedIn] = createSignal(false);
265
+ * const [user] = createSignal({ name: 'Alice' });
266
+ * const [guest] = createSignal({ name: 'Guest' });
267
+ * const currentUser = when(isLoggedIn, user, guest);
268
+ * console.log(currentUser()?.name); // 'Guest'
269
+ * ```
270
+ */
271
+ export declare function whenSignal<T>(condition: Accessor<boolean>, whenTrue: Accessor<T>, whenFalse: Accessor<T>, options?: MemoOptions<T>): Accessor<T>;
272
+ /**
273
+ * Compute signal only when condition is true, otherwise return undefined
274
+ * @template T - Result type
275
+ * @param condition - Condition signal or accessor
276
+ * @param accessor - Accessor to use when condition is true
277
+ * @param options - Memo options for equality checking
278
+ * @returns New accessor with conditional value or undefined
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const [showDetails] = createSignal(false);
283
+ * const [details] = createSignal({ info: 'Details here' });
284
+ * const visibleDetails = guard(showDetails, details);
285
+ * console.log(visibleDetails()); // undefined (when showDetails is false)
286
+ * ```
287
+ */
288
+ export declare function guardSignal<T>(condition: Accessor<boolean>, accessor: Accessor<T>, options?: MemoOptions<T | undefined>): Accessor<T | undefined>;
289
+ /**
290
+ * Debounce a signal - only update after delay period with no changes
291
+ * @template T - Signal type
292
+ * @param signal - Source signal to debounce
293
+ * @param delay - Delay in milliseconds
294
+ * @param options - Memo options for equality checking
295
+ * @returns New accessor with debounced value
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * const [search] = createSignal('');
300
+ * const debouncedSearch = debounce(search, 300);
301
+ * // debouncedSearch only updates 300ms after last search change
302
+ * ```
303
+ */
304
+ export declare function debounceSignal<T>(signal: Accessor<T>, delay: number, options?: MemoOptions<T>): Accessor<T>;
305
+ /**
306
+ * Throttle a signal - limit update frequency
307
+ * @template T - Signal type
308
+ * @param signal - Source signal to throttle
309
+ * @param delay - Minimum delay between updates in milliseconds
310
+ * @param options - Memo options for equality checking
311
+ * @returns New accessor with throttled value
312
+ *
313
+ * @example
314
+ * ```typescript
315
+ * const [scroll] = createSignal(0);
316
+ * const throttledScroll = throttle(scroll, 100);
317
+ * // throttledScroll updates at most once per 100ms
318
+ * ```
319
+ */
320
+ export declare function throttleSignal<T>(signal: Accessor<T>, delay: number, options?: MemoOptions<T>): Accessor<T>;
321
+ export { type Accessor, type MemoOptions } from './signal.js';
322
+ /**
323
+ * Creates a deferred promise with exposed resolve and reject methods
324
+ *
325
+ * This utility function creates a Promise along with its resolver functions,
326
+ * allowing for more control over when and how the promise resolves or rejects.
327
+ * Useful for converting callback-based APIs to promises, implementing timeouts,
328
+ * or coordinating complex async flows.
329
+ *
330
+ * @template T - The type of the value the promise resolves with
331
+ * @returns An object containing the promise, resolve function, and reject function
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * // Create a promise with external controls
336
+ * const deferred = createDeferred<Response>();
337
+ *
338
+ * // Set up timeout
339
+ * const timeoutId = setTimeout(() => {
340
+ * deferred.reject(new Error('Request timed out'));
341
+ * }, 5000);
342
+ *
343
+ * // Make the request
344
+ * fetch('/api/data')
345
+ * .then(deferred.resolve)
346
+ * .catch(deferred.reject)
347
+ * .finally(() => clearTimeout(timeoutId));
348
+ *
349
+ * // Return the promise to the caller
350
+ * return deferred.promise;
351
+ * ```
352
+ */
353
+ export type ReadSignal<T, depth extends 0 | 1 | 2 | 3 | 4 = 0> = depth extends 4 ? T : T extends Accessor<infer U> ? U extends (() => any) ? ReadSignal<U, depth extends 4 ? 4 : depth extends 3 ? 3 : depth extends 2 ? 2 : depth extends 1 ? 1 : 0> : U : T;
354
+ export declare function readSignal<T>(signal?: Accessor<T> | T | null): ReadSignal<T>;
355
+ //# sourceMappingURL=utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/lib/signal/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAMzD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EACnB,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