From 7ec50e1660edbe289c4ae79d78df6252108f66fe Mon Sep 17 00:00:00 2001 From: Jan Andrle Date: Mon, 3 Mar 2025 15:23:55 +0100 Subject: [PATCH] :bug: coumputed signal --- dist/dde-with-signals.js | 2 +- dist/esm-with-signals.d.ts | 9 ++++++--- dist/esm-with-signals.js | 2 +- dist/esm.d.ts | 9 ++++++--- src/signals-lib/signals-lib.js | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/dist/dde-with-signals.js b/dist/dde-with-signals.js index 38c3092..bf2dbba 100644 --- a/dist/dde-with-signals.js +++ b/dist/dde-with-signals.js @@ -718,7 +718,7 @@ function signal(value, actions) { const [origin, ...deps_old] = deps.get(contextReWatch); deps.set(contextReWatch, /* @__PURE__ */ new Set([origin])); stack_watch.push(contextReWatch); - write(out, value.get()); + write(out, value()); stack_watch.pop(); if (!deps_old.length) return; const deps_curr = deps.get(contextReWatch); diff --git a/dist/esm-with-signals.d.ts b/dist/esm-with-signals.d.ts index 984922c..3e0b79c 100644 --- a/dist/esm-with-signals.d.ts +++ b/dist/esm-with-signals.d.ts @@ -52,9 +52,12 @@ type IsReadonly = * @private */ type ElementAttributes= Partial<{ - [K in keyof _fromElsInterfaces]: IsReadonly<_fromElsInterfaces, K> extends false - ? _fromElsInterfaces[K] | ddeSignal<_fromElsInterfaces[K]> - : ddeStringable + [K in keyof _fromElsInterfaces]: + _fromElsInterfaces[K] extends ((...p: any[])=> any) + ? _fromElsInterfaces[K] | ((...p: Parameters<_fromElsInterfaces[K]>)=> ddeSignal[K]>>) + : (IsReadonly<_fromElsInterfaces, K> extends false + ? _fromElsInterfaces[K] | ddeSignal<_fromElsInterfaces[K]> + : ddeStringable) } & AttrsModified> & Record; export function classListDeclarative( element: El, diff --git a/dist/esm-with-signals.js b/dist/esm-with-signals.js index 634aad3..510172c 100644 --- a/dist/esm-with-signals.js +++ b/dist/esm-with-signals.js @@ -716,7 +716,7 @@ function signal(value, actions) { const [origin, ...deps_old] = deps.get(contextReWatch); deps.set(contextReWatch, /* @__PURE__ */ new Set([origin])); stack_watch.push(contextReWatch); - write(out, value.get()); + write(out, value()); stack_watch.pop(); if (!deps_old.length) return; const deps_curr = deps.get(contextReWatch); diff --git a/dist/esm.d.ts b/dist/esm.d.ts index 9efeb24..efa2424 100644 --- a/dist/esm.d.ts +++ b/dist/esm.d.ts @@ -52,9 +52,12 @@ type IsReadonly = * @private */ type ElementAttributes= Partial<{ - [K in keyof _fromElsInterfaces]: IsReadonly<_fromElsInterfaces, K> extends false - ? _fromElsInterfaces[K] | ddeSignal<_fromElsInterfaces[K]> - : ddeStringable + [K in keyof _fromElsInterfaces]: + _fromElsInterfaces[K] extends ((...p: any[])=> any) + ? _fromElsInterfaces[K] | ((...p: Parameters<_fromElsInterfaces[K]>)=> ddeSignal[K]>>) + : (IsReadonly<_fromElsInterfaces, K> extends false + ? _fromElsInterfaces[K] | ddeSignal<_fromElsInterfaces[K]> + : ddeStringable) } & AttrsModified> & Record; export function classListDeclarative( element: El, diff --git a/src/signals-lib/signals-lib.js b/src/signals-lib/signals-lib.js index c85c815..8e09afb 100644 --- a/src/signals-lib/signals-lib.js +++ b/src/signals-lib/signals-lib.js @@ -62,7 +62,7 @@ export function signal(value, actions){ deps.set(contextReWatch, new Set([ origin ])); stack_watch.push(contextReWatch); - write(out, value.get()); + write(out, value()); stack_watch.pop(); if(!deps_old.length) return;