From e89bbe0513913189776aa90d45c5d66e91112fac Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Sat, 16 Dec 2023 15:38:31 -0800 Subject: [PATCH] fix: ensure that signalify() does not count as reading a dependency, to avoid infinite loops. Only a user's explicit read of a property after trying to signalify the property should count as a dependency (namely when signalify() was a no-op because the property was already signalifies before hand elsewhere such as an object from a library) --- dist/index.test.js | 25 +++++++++++++++++++++++++ dist/index.test.js.map | 2 +- dist/signalify.d.ts.map | 2 +- dist/signalify.js | 7 +++++-- dist/signalify.js.map | 2 +- src/index.test.ts | 24 ++++++++++++++++++++++++ src/signalify.ts | 6 ++++-- 7 files changed, 61 insertions(+), 7 deletions(-) diff --git a/dist/index.test.js b/dist/index.test.js index 97b996a..b0daf8f 100644 --- a/dist/index.test.js +++ b/dist/index.test.js @@ -428,6 +428,31 @@ describe('classy-solid', () => { expect(doer.do).toBe(newFunc); expect(doer.do()).toBe(123); }); + describe('signalify', () => { + it('is not tracked inside of an effect to prevent loops', () => { + // Library author provides obj + const obj = { + n: 123 + }; + signalify(obj, 'n'); // library author might signalify obj.n + + // User code: + createEffect(() => { + // o.n may or may not already be signalified, user does not know, but they want to be sure they can react to its changes. + signalify(obj, 'n'); + obj.n = 123; // does not make an infinite loop + + // A deeper effect will be reading the property. + createEffect(() => { + console.log(obj.n); + }); + }); + + // No expectations in this test, the test passes if a maximum + // callstack size error (infinite loop) does not happen. + }); + }); + it('show that signalify causes constructor to be reactive when used manually instead of decorators', () => { class Foo { amount = 3; diff --git a/dist/index.test.js.map b/dist/index.test.js.map index e26b329..cfe66e0 100644 --- a/dist/index.test.js.map +++ b/dist/index.test.js.map @@ -1 +1 @@ -{"version":3,"file":"index.test.js","names":["createComputed","createEffect","createRoot","createSignal","untrack","createMutable","render","html","createSignalObject","reactive","signalify","createSignalFunction","signal","createDeferredEffect","component","describe","it","num","set","expect","get","toBe","setResult","n","count","foo","runCount","stop","_stop","Promise","resolve","_initClass","_init_colors","_initProto","_Butterfly","Butterfly","e","c","_applyDecs","colors","_wingSize","wingSize","s","b","testButterflyProps","_initClass2","_init_colors2","_initProto2","_initClass3","_init_colors3","_Butterfly3","_Butterfly2","_SubButterfly","SubButterfly","_initClass4","_initClass5","_init_colors4","_initProto3","_Insect2","_Insect","Insect","constructor","double","_Butterfly4","arg","b2","prototype","_init_foo","_initClass6","_init_bar","Foo","_Bar","Bar","bar","toThrow","_initClass7","_init_do","_Doer","Doer","do","doer","newFunc","amount","_initClass8","_init_amount","_initClass9","_init_double","_Foo2","_Foo","_Bar2","noLoop","not","_initClass10","onMountCalled","onCleanupCalled","_CoolComp","CoolComp","onMount","onCleanup","template","props","root","document","createElement","body","append","dispose","textContent","remove","_initProto4","args","_initClass11","_init_foo2","_init_bar2","_CoolComp2","a","setA","xit","_initClass12","_init_foo3","_init_bar3","_CoolComp3","o","initialColors","n1","num3","n3","undefined","num4","bool","b1","bool2","n4","func","fn","n5","func2","fn2","n6","stringOrFunc1","sf1","sf2","sf3","sf6","sf7","sf8","stringOrFunc2","sf9","sf10","sf11","sf12","sf13","sf14","sf15"],"sources":["../src/index.test.ts"],"sourcesContent":["import {createComputed, createEffect, createRoot, createSignal, untrack} from 'solid-js'\nimport {createMutable} from 'solid-js/store'\nimport {render} from 'solid-js/web'\nimport html from 'solid-js/html'\nimport {\n\tcreateSignalObject,\n\treactive,\n\tsignalify,\n\tcreateSignalFunction,\n\tsignal,\n\tcreateDeferredEffect,\n\tcomponent,\n} from './index.js'\n\n// TODO move type def to @lume/cli, map @types/jest's `expect` type into the\n// global env.\ndeclare global {\n\tfunction expect(...args: any[]): any\n}\n\ndescribe('classy-solid', () => {\n\tdescribe('createSignalObject()', () => {\n\t\tit('has gettable and settable values via .get and .set methods', async () => {\n\t\t\tconst num = createSignalObject(0)\n\n\t\t\t// Set the variable's value by passing a value in.\n\t\t\tnum.set(1)\n\t\t\t// Read the variable's value by calling it with no args.\n\t\t\texpect(num.get()).toBe(1)\n\n\t\t\t// increment example:\n\t\t\tconst setResult = num.set(num.get() + 1)\n\t\t\texpect(num.get()).toBe(2)\n\t\t\texpect(setResult).toBe(2)\n\n\t\t\t// Set with a function that accepts the previous value and returns the next value.\n\t\t\tnum.set(n => n + 1)\n\t\t\texpect(num.get()).toBe(3)\n\t\t})\n\t})\n\n\tdescribe('createSignalFunction()', () => {\n\t\tit('has gettable and settable values via a single overloaded function', async () => {\n\t\t\tconst num = createSignalFunction(0)\n\n\t\t\t// Set the variable's value by passing a value in.\n\t\t\tnum(1)\n\t\t\t// Read the variable's value by calling it with no args.\n\t\t\texpect(num()).toBe(1)\n\n\t\t\t// increment example:\n\t\t\tconst setResult = num(num() + 1)\n\t\t\texpect(num()).toBe(2)\n\t\t\texpect(setResult).toBe(2)\n\n\t\t\t// Set with a function that accepts the previous value and returns the next value.\n\t\t\tnum(n => n + 1)\n\t\t\texpect(num()).toBe(3)\n\t\t})\n\t})\n\n\tdescribe('createDeferredEffect()', () => {\n\t\tit('works', async () => {\n\t\t\tconst count = createSignalFunction(0)\n\t\t\tconst foo = createSignalFunction(0)\n\n\t\t\tlet runCount = 0\n\n\t\t\tconst stop = (() => {\n\t\t\t\tlet stop!: () => void\n\n\t\t\t\tcreateRoot(_stop => {\n\t\t\t\t\tstop = _stop\n\n\t\t\t\t\t// Runs once initially after the current root context just\n\t\t\t\t\t// like createEffect, then any time it re-runs due to a\n\t\t\t\t\t// change in a dependency, the re-run will be deferred in\n\t\t\t\t\t// the next microtask and will run only once (not once per\n\t\t\t\t\t// signal that changed)\n\t\t\t\t\tcreateDeferredEffect(() => {\n\t\t\t\t\t\tcount()\n\t\t\t\t\t\tfoo()\n\t\t\t\t\t\trunCount++\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\t\treturn stop\n\t\t\t})()\n\n\t\t\t// Queues the effect to run in the next microtask\n\t\t\tcount(1)\n\t\t\tcount(2)\n\t\t\tfoo(3)\n\n\t\t\t// Still 1 because the deferred effect didn't run yet, it will in the next microtask.\n\t\t\texpect(runCount).toBe(1)\n\n\t\t\tawait Promise.resolve()\n\n\t\t\t// It ran only once in the previous microtask (batched), not once per signal write.\n\t\t\texpect(runCount).toBe(2)\n\n\t\t\tcount(3)\n\t\t\tcount(4)\n\t\t\tfoo(5)\n\n\t\t\texpect(runCount).toBe(2)\n\n\t\t\tawait Promise.resolve()\n\n\t\t\texpect(runCount).toBe(3)\n\n\t\t\t// Stops the effect from re-running. It can now be garbage collected.\n\t\t\tstop()\n\n\t\t\tcount(3)\n\t\t\tcount(4)\n\t\t\tfoo(5)\n\n\t\t\texpect(runCount).toBe(3)\n\n\t\t\tawait Promise.resolve()\n\n\t\t\t// Still the same because it was stopped, so it didn't run in the\n\t\t\t// macrotask prior to the await.\n\t\t\texpect(runCount).toBe(3)\n\n\t\t\t// Double check just in case (the wrong implementation would make it\n\t\t\t// skip two microtasks before running).\n\t\t\tawait Promise.resolve()\n\t\t\texpect(runCount).toBe(3)\n\t\t})\n\t})\n\n\tdescribe('@reactive, @signal, and signalify', () => {\n\t\tit('makes class properties reactive, using class and property/accessor decorators', () => {\n\t\t\t@reactive\n\t\t\tclass Butterfly {\n\t\t\t\t@signal colors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\t@signal\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly()\n\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('maintains reactivity in subclass overridden fields', async () => {\n\t\t\t@reactive\n\t\t\tclass Butterfly {\n\t\t\t\t@signal colors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\t@signal\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@reactive\n\t\t\tclass SubButterfly extends Butterfly {\n\t\t\t\t@signal override colors = 123\n\t\t\t}\n\n\t\t\tconst b = new SubButterfly()\n\n\t\t\ttestButterflyProps(b, 123)\n\t\t})\n\n\t\tit('does not prevent superclass constructor from receiving subclass constructor args', () => {\n\t\t\t@reactive\n\t\t\tclass Insect {\n\t\t\t\tconstructor(public double: number) {}\n\t\t\t}\n\n\t\t\t@reactive\n\t\t\tclass Butterfly extends Insect {\n\t\t\t\t@signal colors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\t@signal\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\n\t\t\t\tconstructor(arg: number) {\n\t\t\t\t\tsuper(arg * 2)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly(4)\n\n\t\t\texpect(b.double).toBe(8)\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('makes class properties reactive, not using any decorators, specified in the constructor', () => {\n\t\t\tclass Butterfly {\n\t\t\t\tcolors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly()\n\n\t\t\ttestButterflyProps(b)\n\n\t\t\t// quick type check:\n\t\t\tconst b2 = new Butterfly()\n\t\t\tsignalify(\n\t\t\t\tb2,\n\t\t\t\t'colors',\n\t\t\t\t'wingSize',\n\t\t\t\t// @ts-expect-error \"foo\" is not a property on Butterfly\n\t\t\t\t'foo',\n\t\t\t)\n\t\t})\n\n\t\tit('makes class properties reactive, with signalify in the constructor', () => {\n\t\t\tclass Butterfly {\n\t\t\t\tcolors: number\n\t\t\t\t_wingSize: number\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tthis.colors = 3\n\t\t\t\t\tthis._wingSize = 2\n\n\t\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly()\n\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('works with a function-style class, with signalify in the constructor', () => {\n\t\t\tfunction Butterfly() {\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis.colors = 3\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis._wingSize = 2\n\n\t\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\t// @ts-ignore\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('works with a function-style class, with properties on the prototype, and signalify in constructor', () => {\n\t\t\tfunction Butterfly() {\n\t\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tcolors: 3,\n\t\t\t\t_wingSize: 2,\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('can be used on a function-style class, with properties on the prototype, and signalify on the prototype', () => {\n\t\t\tfunction Butterfly() {}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tcolors: 3,\n\t\t\t\t_wingSize: 2,\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tsignalify(Butterfly.prototype, 'colors', 'wingSize')\n\n\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('can be used on a function-style class, with properties in the constructor, and signalify on the prototype', () => {\n\t\t\tfunction Butterfly() {\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis.colors = 3\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis._wingSize = 2\n\t\t\t}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tsignalify(Butterfly.prototype, 'colors', 'wingSize')\n\n\t\t\t// @ts-ignore\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('throws an error when @signal is used without @reactive', async () => {\n\t\t\texpect(() => {\n\t\t\t\t// user forgot to use @reactive here\n\t\t\t\tclass Foo {\n\t\t\t\t\t@signal foo = 'hoo'\n\t\t\t\t}\n\n\t\t\t\tFoo\n\n\t\t\t\t@reactive\n\t\t\t\tclass Bar {\n\t\t\t\t\t@signal bar = 123\n\t\t\t\t}\n\n\t\t\t\tnew Bar()\n\t\t\t}).toThrow('Did you forget')\n\n\t\t\t// TODO how to check for an error thrown from a microtask?\n\t\t\t// (window.addEventListener('error') seems not to work)\n\t\t\t//\n\t\t\t// It just won't work, the error seems to never fire here in the\n\t\t\t// tests, but it works fine when testing manually in Chrome.\n\n\t\t\t// const errPromise = new Promise(r => window.addEventListener('error', e => r(e), {once: true}))\n\n\t\t\t// @reactive\n\t\t\t// class Foo {\n\t\t\t// \t@signal foo = 'hoo'\n\t\t\t// }\n\n\t\t\t// Foo\n\n\t\t\t// // user forgot to use @reactive here\n\t\t\t// class Bar {\n\t\t\t// \t@signal bar = 123\n\t\t\t// }\n\n\t\t\t// Bar\n\n\t\t\t// const err = await errPromise\n\n\t\t\t// expect(err.message).toContain('Did you forget')\n\t\t})\n\n\t\tit('works with function values', () => {\n\t\t\t// This test ensures that functions are handled propertly, because\n\t\t\t// if passed without being wrapped to a signal setter it will be\n\t\t\t// called immediately with the previous value and be expected to\n\t\t\t// return a new value, instead of being set as the actual new value.\n\n\t\t\t@reactive\n\t\t\tclass Doer {\n\t\t\t\t@signal do: (() => unknown) | null = null\n\t\t\t}\n\n\t\t\tconst doer = new Doer()\n\n\t\t\texpect(doer.do).toBe(null)\n\n\t\t\tconst newFunc = () => 123\n\t\t\tdoer.do = newFunc\n\n\t\t\texpect(doer.do).toBe(newFunc)\n\t\t\texpect(doer.do()).toBe(123)\n\t\t})\n\n\t\tit('show that signalify causes constructor to be reactive when used manually instead of decorators', () => {\n\t\t\tclass Foo {\n\t\t\t\tamount = 3\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsignalify(this, 'amount')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tclass Bar extends Foo {\n\t\t\t\tdouble = 0\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper()\n\t\t\t\t\tsignalify(this, 'double')\n\t\t\t\t\tthis.double = this.amount * 2 // this tracks access of .amount\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet count = 0\n\t\t\tlet b!: Bar\n\n\t\t\tcreateEffect(() => {\n\t\t\t\tb = new Bar() // tracks .amount\n\t\t\t\tcount++\n\t\t\t})\n\n\t\t\texpect(count).toBe(1)\n\n\t\t\tb.amount = 4 // triggers\n\n\t\t\texpect(count).toBe(2)\n\t\t})\n\n\t\tit('show how to manually untrack constructors when not using decorators', () => {\n\t\t\tclass Foo {\n\t\t\t\tamount = 3\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsignalify(this, 'amount')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tclass Bar extends Foo {\n\t\t\t\tdouble = 0\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper()\n\t\t\t\t\tsignalify(this, 'double')\n\n\t\t\t\t\tuntrack(() => {\n\t\t\t\t\t\tthis.double = this.amount * 2\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet count = 0\n\t\t\tlet b!: Bar\n\n\t\t\tcreateEffect(() => {\n\t\t\t\tb = new Bar() // does not track .amount\n\t\t\t\tcount++\n\t\t\t})\n\n\t\t\texpect(count).toBe(1)\n\n\t\t\tb.amount = 4 // will not trigger\n\n\t\t\texpect(count).toBe(1)\n\t\t})\n\n\t\tit('automatically does not track reactivity in constructors when using decorators', () => {\n\t\t\t@reactive\n\t\t\tclass Foo {\n\t\t\t\t@signal amount = 3\n\t\t\t}\n\n\t\t\t@reactive\n\t\t\tclass Bar extends Foo {\n\t\t\t\t@signal double = 0\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper()\n\t\t\t\t\tthis.double = this.amount * 2 // this read of .amount should not be tracked\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet b: Bar\n\t\t\tlet count = 0\n\n\t\t\tfunction noLoop() {\n\t\t\t\tcreateEffect(() => {\n\t\t\t\t\tb = new Bar() // this should not track\n\t\t\t\t\tcount++\n\t\t\t\t})\n\t\t\t}\n\n\t\t\texpect(noLoop).not.toThrow()\n\n\t\t\tconst b2 = b!\n\n\t\t\tb!.amount = 4 // hence this should not trigger\n\n\t\t\t// If the effect ran only once initially, not when setting b.colors,\n\t\t\t// then both variables should reference the same instance\n\t\t\texpect(count).toBe(1)\n\t\t\texpect(b!).toBe(b2)\n\t\t})\n\t})\n\n\tdescribe('@component', () => {\n\t\tit('allows to define a class using class syntax', () => {\n\t\t\tlet onMountCalled = false\n\t\t\tlet onCleanupCalled = false\n\n\t\t\t@component\n\t\t\tclass CoolComp {\n\t\t\t\tonMount() {\n\t\t\t\t\tonMountCalled = true\n\t\t\t\t}\n\n\t\t\t\tonCleanup() {\n\t\t\t\t\tonCleanupCalled = true\n\t\t\t\t}\n\n\t\t\t\ttemplate(props: any) {\n\t\t\t\t\texpect(props.foo).toBe(123)\n\t\t\t\t\treturn html`
hello classes!
`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tconst dispose = render(() => html`<${CoolComp} foo=${123} />`, root)\n\n\t\t\texpect(root.textContent).toBe('hello classes!')\n\t\t\texpect(onMountCalled).toBe(true)\n\t\t\texpect(onCleanupCalled).toBe(false)\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\n\t\t\texpect(onCleanupCalled).toBe(true)\n\n\t\t\t// throws on non-class use\n\t\t\texpect(() => {\n\t\t\t\tclass CoolComp {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t@component\n\t\t\t\t\tonMount() {}\n\t\t\t\t}\n\t\t\t\tCoolComp\n\t\t\t}).toThrow('component decorator should only be used on a class')\n\t\t})\n\n\t\tit('works in tandem with @reactive and @signal for reactivity', async () => {\n\t\t\t@component\n\t\t\t@reactive\n\t\t\tclass CoolComp {\n\t\t\t\t@signal foo = 0\n\t\t\t\t@signal bar = 0\n\n\t\t\t\ttemplate() {\n\t\t\t\t\treturn html`
foo: ${() => this.foo}, bar: ${() => this.bar}
`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tconst [a, setA] = createSignal(1)\n\t\t\tconst b = createSignalFunction(2)\n\n\t\t\t// FIXME Why do we need `() => b()` instead of just `b` here? Does `html`\n\t\t\t// check the `length` of the function and do something based on\n\t\t\t// that? Or does it get passed to a @signal property's setter and\n\t\t\t// receives the previous value?\n\t\t\tconst dispose = render(() => html`<${CoolComp} foo=${a} bar=${() => b()} />`, root)\n\n\t\t\texpect(root.textContent).toBe('foo: 1, bar: 2')\n\n\t\t\tsetA(3)\n\t\t\tb(4)\n\n\t\t\texpect(root.textContent).toBe('foo: 3, bar: 4')\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\t\t})\n\n\t\tit('works without decorators', () => {\n\t\t\tconst CoolComp = component(\n\t\t\t\tclass CoolComp {\n\t\t\t\t\tfoo = 0\n\t\t\t\t\tbar = 0\n\n\t\t\t\t\tconstructor() {\n\t\t\t\t\t\tsignalify(this)\n\t\t\t\t\t}\n\n\t\t\t\t\ttemplate() {\n\t\t\t\t\t\treturn html`
foo: ${() => this.foo}, bar: ${() => this.bar}
`\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tconst [a, setA] = createSignal(1)\n\t\t\tconst b = createSignalFunction(2)\n\n\t\t\t// FIXME Why do we need `() => b()` instead of just `b` here? Does `html`\n\t\t\t// check the `length` of the function and do something based on\n\t\t\t// that? Or does it get passed to a @signal property's setter and\n\t\t\t// receives the previous value?\n\t\t\tconst dispose = render(() => html`<${CoolComp} foo=${a} bar=${() => b()} />`, root)\n\n\t\t\texpect(root.textContent).toBe('foo: 1, bar: 2')\n\n\t\t\tsetA(3)\n\t\t\tb(4)\n\n\t\t\texpect(root.textContent).toBe('foo: 3, bar: 4')\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\t\t})\n\n\t\t// FIXME not working, the spread doesn't seem to do anything.\n\t\txit('works with reactive spreads', async () => {\n\t\t\t@component\n\t\t\t@reactive\n\t\t\tclass CoolComp {\n\t\t\t\t@signal foo = 0\n\t\t\t\t@signal bar = 0\n\n\t\t\t\ttemplate() {\n\t\t\t\t\treturn html`
foo: ${() => this.foo}, bar: ${() => this.bar}
`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tlet o = createMutable({o: {foo: 123}})\n\n\t\t\t// neither of these work\n\t\t\t// const dispose = render(() => html`<${CoolComp} ...${() => o.o} />`, root)\n\t\t\tconst dispose = render(() => html`<${CoolComp} ...${o.o} />`, root)\n\n\t\t\texpect(root.textContent).toBe('foo: 123, bar: 0')\n\n\t\t\to.o = {bar: 456}\n\n\t\t\texpect(root.textContent).toBe('foo: 123, bar: 456')\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\t\t})\n\t})\n})\n\nfunction testButterflyProps(b: {colors: number; wingSize: number; _wingSize: number}, initialColors = 3) {\n\tlet count = 0\n\n\tcreateRoot(() => {\n\t\tcreateComputed(() => {\n\t\t\tb.colors\n\t\t\tb.wingSize\n\t\t\tcount++\n\t\t})\n\t})\n\n\texpect(b.colors).toBe(initialColors, 'initial colors value')\n\texpect(b.wingSize).toBe(2, 'initial wingSize value')\n\texpect(b._wingSize).toBe(2, 'ensure the original accessor works')\n\texpect(count).toBe(1, 'Should be reactive')\n\n\tb.colors++\n\n\texpect(b.colors).toBe(initialColors + 1, 'incremented colors value')\n\texpect(count).toBe(2, 'Should be reactive')\n\n\tb.wingSize++\n\n\texpect(b.wingSize).toBe(3, 'incremented wingSize value')\n\texpect(b._wingSize).toBe(3, 'ensure the original accessor works')\n\texpect(count).toBe(3, 'Should be reactive')\n}\n\n//////////////////////////////////////////////////////////////////////////\n// createSignalObject type tests ///////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////\n\n{\n\tconst num = createSignalObject(1)\n\tlet n1: number = num.get()\n\tn1\n\tnum.set(123)\n\tnum.set(n => (n1 = n + 1))\n\t// @ts-expect-error Expected 1 arguments, but got 0. ts(2554)\n\tnum.set()\n\n\tconst num3 = createSignalObject()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n3: number = num3.get()\n\tnum3.set(123)\n\tnum3.set(undefined) // ok, accepts undefined\n\t// @ts-expect-error Object is possibly 'undefined'. ts(2532) (the `n` value)\n\tnum3.set(n => (n3 = n + 1))\n\t// num3.set() // ok, accepts undefined // FIXME broke in Solid 1.7.9\n\n\t// @ts-expect-error Argument of type 'boolean' is not assignable to parameter of type 'number'. ts(2345)\n\tconst num4 = createSignalObject(true)\n\n\tconst bool = createSignalObject(true)\n\tlet b1: boolean = bool.get()\n\tb1\n\tbool.set(false)\n\tbool.set(b => (b1 = !b))\n\t// @ts-expect-error Expected 1 arguments, but got 0. ts(2554)\n\tbool.set()\n\n\tconst bool2 = createSignalObject()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n4: boolean = bool2.get()\n\tbool2.set(false)\n\tbool2.set(undefined) // ok, accepts undefined\n\tbool2.set(n => (n4 = !n)) // ok because undefined is being converted to boolean\n\t// @ts-expect-error Type 'boolean | undefined' is not assignable to type 'boolean'. ts(2322)\n\tbool2.set(n => (n4 = n))\n\t// bool2.set() // ok, accepts undefined // FIXME try Solid 1.7.9\n\n\tconst func = createSignalObject(() => 1)\n\t// @ts-expect-error 1 is not assignable to function (no overload matches)\n\tfunc.set(() => 1)\n\tfunc.set(() => (): 1 => 1) // ok, set the value to a function\n\tconst fn: () => 1 = func.get() // ok, returns function value\n\tfn\n\tconst n5: 1 = func.get()()\n\tn5\n\n\tconst func2 = createSignalObject<() => number>(() => 1)\n\t// @FIXME-ts-expect-error number is not assignable to function (no overload matches)\n\tfunc2.set(() => 1) // FIXME should be a type error. Try Solid 1.7.9\n\tfunc2.set(() => () => 1) // ok, set the value to a function\n\tconst fn2: () => number = func2.get() // ok, returns function value\n\tfn2\n\tconst n6: number = func2.get()()\n\tn6\n\n\tconst stringOrFunc1 = createSignalObject<(() => number) | string>('')\n\t// @FIXME-ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc1.set(() => 1) // FIXME should be a type error. Try Solid 1.7.9\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf1: () => number = stringOrFunc1.set(() => () => 1)\n\tsf1\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf2: string = stringOrFunc1.set('oh yeah')\n\tsf2\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf3: string = stringOrFunc1.set(() => 'oh yeah')\n\tsf3\n\t// @ts-expect-error cannot set signal to undefined\n\tstringOrFunc1.set()\n\t// @ts-expect-error cannot set signal to undefined\n\tstringOrFunc1.set(undefined)\n\t// @ts-expect-error return value might be string\n\tconst sf6: () => number = stringOrFunc1.get()\n\tsf6\n\tconst sf7: (() => number) | string | undefined = stringOrFunc1.get()\n\tsf7\n\tconst sf8: (() => number) | string = stringOrFunc1.get()\n\tsf8\n\n\tconst stringOrFunc2 = createSignalObject<(() => number) | string>()\n\t// @FIXME-ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc2.set(() => 1) // FIXME should be a type error. Try Solid 1.7.9\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf9: () => number = stringOrFunc2.set(() => () => 1)\n\tsf9\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf10: string = stringOrFunc2.set('oh yeah')\n\tsf10\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf11: string = stringOrFunc2.set(() => 'oh yeah')\n\tsf11\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf12: undefined = stringOrFunc2.set()\n\tsf12\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf13: undefined = stringOrFunc2.set(undefined)\n\tsf13\n\tconst sf14: (() => number) | string | undefined = stringOrFunc2.get()\n\tsf14\n\t// @ts-expect-error return value might be undefined\n\tconst sf15: (() => number) | string = stringOrFunc2.get()\n\tsf15\n}\n\n//////////////////////////////////////////////////////////////////////////\n// createSignalFunction type tests ///////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////\n\n{\n\tconst num = createSignalFunction(1)\n\tlet n1: number = num()\n\tn1\n\tnum(123)\n\tnum(n => (n1 = n + 1))\n\tnum()\n\n\tconst num3 = createSignalFunction()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n3: number = num3()\n\tnum3(123)\n\tnum3(undefined) // ok, accepts undefined\n\t// @ts-expect-error Object is possibly 'undefined'. ts(2532) (the `n` value)\n\tnum3(n => (n3 = n + 1))\n\tnum3() // ok, getter\n\n\t// @ts-expect-error Argument of type 'boolean' is not assignable to parameter of type 'number'. ts(2345)\n\tconst num4 = createSignalFunction(true)\n\n\tconst bool = createSignalFunction(true)\n\tlet b1: boolean = bool()\n\tb1\n\tbool(false)\n\tbool(b => (b1 = !b))\n\tbool()\n\n\tconst bool2 = createSignalFunction()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n4: boolean = bool2()\n\tbool2(false)\n\tbool2(undefined) // ok, accepts undefined\n\tbool2(n => (n4 = !n)) // ok because undefined is being converted to boolean\n\t// @ts-expect-error Type 'boolean | undefined' is not assignable to type 'boolean'. ts(2322)\n\tbool2(n => (n4 = n))\n\tbool2() // ok, accepts undefined\n\n\tconst func = createSignalFunction(() => 1)\n\t// @ts-expect-error 1 is not assignable to function (no overload matches)\n\tfunc(() => 1)\n\tfunc(() => (): 1 => 1) // ok, set the value to a function\n\tconst fn: () => 1 = func() // ok, returns function value\n\tfn\n\tconst n5: 1 = func()()\n\tn5\n\n\tconst func2 = createSignalFunction<() => number>(() => 1)\n\t// @ts-expect-error number is not assignable to function (no overload matches)\n\tfunc2(() => 1)\n\tfunc2(() => () => 1) // ok, set the value to a function\n\tconst fn2: () => number = func2() // ok, returns function value\n\tfn2\n\tconst n6: number = func2()()\n\tn6\n\n\tconst stringOrFunc1 = createSignalFunction<(() => number) | string>('')\n\t// @ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc1(() => 1)\n\tconst sf1: () => number = stringOrFunc1(() => () => 1)\n\tsf1\n\tconst sf2: string = stringOrFunc1('oh yeah')\n\tsf2\n\tconst sf3: string = stringOrFunc1(() => 'oh yeah')\n\tsf3\n\tstringOrFunc1() // ok, getter\n\t// @ts-expect-error cannot set signal to undefined\n\tstringOrFunc1(undefined)\n\t// @ts-expect-error return value might be string\n\tconst sf6: () => number = stringOrFunc1()\n\tsf6\n\tconst sf7: (() => number) | string | undefined = stringOrFunc1()\n\tsf7\n\tconst sf8: (() => number) | string = stringOrFunc1()\n\tsf8\n\n\tconst stringOrFunc2 = createSignalFunction<(() => number) | string>()\n\t// @ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc2(() => 1)\n\tconst sf9: () => number = stringOrFunc2(() => () => 1)\n\tsf9\n\tconst sf10: string = stringOrFunc2('oh yeah')\n\tsf10\n\tconst sf11: string = stringOrFunc2(() => 'oh yeah')\n\tsf11\n\t// @ts-expect-error 'string | (() => number) | undefined' is not assignable to type 'undefined'.\n\tconst sf12: undefined = stringOrFunc2()\n\tsf12\n\tconst sf13: undefined = stringOrFunc2(undefined)\n\tsf13\n\tconst sf14: (() => number) | string | undefined = stringOrFunc2()\n\tsf14\n\t// @ts-expect-error return value might be undefined\n\tconst sf15: (() => number) | string = stringOrFunc2()\n\tsf15\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAQA,cAAc,EAAEC,YAAY,EAAEC,UAAU,EAAEC,YAAY,EAAEC,OAAO,QAAO,UAAU;AACxF,SAAQC,aAAa,QAAO,gBAAgB;AAC5C,SAAQC,MAAM,QAAO,cAAc;AACnC,OAAOC,IAAI,MAAM,eAAe;AAChC,SACCC,kBAAkB,EAClBC,QAAQ,EACRC,SAAS,EACTC,oBAAoB,EACpBC,MAAM,EACNC,oBAAoB,EACpBC,SAAS,QACH,YAAY;;AAEnB;AACA;AAKAC,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC9BA,QAAQ,CAAC,sBAAsB,EAAE,MAAM;IACtCC,EAAE,CAAC,4DAA4D,E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,CAAC,CAAC,CAAC;EAC5BE,EAAE;EAEF,MAAMC,aAAa,GAAGhI,oBAAoB,CAA0B,EAAE,CAAC;EACvE;EACAgI,aAAa,CAAC,MAAM,CAAC,CAAC;EACtB,MAAMC,GAAiB,GAAGD,aAAa,CAAC,MAAM,MAAM,CAAC,CAAC;EACtDC,GAAG;EACH,MAAMC,GAAW,GAAGF,aAAa,CAAC,SAAS,CAAC;EAC5CE,GAAG;EACH,MAAMC,GAAW,GAAGH,aAAa,CAAC,MAAM,SAAS,CAAC;EAClDG,GAAG;EACHH,aAAa,CAAC,CAAC,EAAC;EAChB;EACAA,aAAa,CAACZ,SAAS,CAAC;EACxB;EACA,MAAMgB,GAAiB,GAAGJ,aAAa,CAAC,CAAC;EACzCI,GAAG;EACH,MAAMC,GAAwC,GAAGL,aAAa,CAAC,CAAC;EAChEK,GAAG;EACH,MAAMC,GAA4B,GAAGN,aAAa,CAAC,CAAC;EACpDM,GAAG;EAEH,MAAMC,aAAa,GAAGvI,oBAAoB,CAA0B,CAAC;EACrE;EACAuI,aAAa,CAAC,MAAM,CAAC,CAAC;EACtB,MAAMC,GAAiB,GAAGD,aAAa,CAAC,MAAM,MAAM,CAAC,CAAC;EACtDC,GAAG;EACH,MAAMC,IAAY,GAAGF,aAAa,CAAC,SAAS,CAAC;EAC7CE,IAAI;EACJ,MAAMC,IAAY,GAAGH,aAAa,CAAC,MAAM,SAAS,CAAC;EACnDG,IAAI;EACJ;EACA,MAAMC,IAAe,GAAGJ,aAAa,CAAC,CAAC;EACvCI,IAAI;EACJ,MAAMC,IAAe,GAAGL,aAAa,CAACnB,SAAS,CAAC;EAChDwB,IAAI;EACJ,MAAMC,IAAyC,GAAGN,aAAa,CAAC,CAAC;EACjEM,IAAI;EACJ;EACA,MAAMC,IAA6B,GAAGP,aAAa,CAAC,CAAC;EACrDO,IAAI;AACL"} \ No newline at end of file +{"version":3,"file":"index.test.js","names":["createComputed","createEffect","createRoot","createSignal","untrack","createMutable","render","html","createSignalObject","reactive","signalify","createSignalFunction","signal","createDeferredEffect","component","describe","it","num","set","expect","get","toBe","setResult","n","count","foo","runCount","stop","_stop","Promise","resolve","_initClass","_init_colors","_initProto","_Butterfly","Butterfly","e","c","_applyDecs","colors","_wingSize","wingSize","s","b","testButterflyProps","_initClass2","_init_colors2","_initProto2","_initClass3","_init_colors3","_Butterfly3","_Butterfly2","_SubButterfly","SubButterfly","_initClass4","_initClass5","_init_colors4","_initProto3","_Insect2","_Insect","Insect","constructor","double","_Butterfly4","arg","b2","prototype","_init_foo","_initClass6","_init_bar","Foo","_Bar","Bar","bar","toThrow","_initClass7","_init_do","_Doer","Doer","do","doer","newFunc","obj","console","log","amount","_initClass8","_init_amount","_initClass9","_init_double","_Foo2","_Foo","_Bar2","noLoop","not","_initClass10","onMountCalled","onCleanupCalled","_CoolComp","CoolComp","onMount","onCleanup","template","props","root","document","createElement","body","append","dispose","textContent","remove","_initProto4","args","_initClass11","_init_foo2","_init_bar2","_CoolComp2","a","setA","xit","_initClass12","_init_foo3","_init_bar3","_CoolComp3","o","initialColors","n1","num3","n3","undefined","num4","bool","b1","bool2","n4","func","fn","n5","func2","fn2","n6","stringOrFunc1","sf1","sf2","sf3","sf6","sf7","sf8","stringOrFunc2","sf9","sf10","sf11","sf12","sf13","sf14","sf15"],"sources":["../src/index.test.ts"],"sourcesContent":["import {createComputed, createEffect, createRoot, createSignal, untrack} from 'solid-js'\nimport {createMutable} from 'solid-js/store'\nimport {render} from 'solid-js/web'\nimport html from 'solid-js/html'\nimport {\n\tcreateSignalObject,\n\treactive,\n\tsignalify,\n\tcreateSignalFunction,\n\tsignal,\n\tcreateDeferredEffect,\n\tcomponent,\n} from './index.js'\n\n// TODO move type def to @lume/cli, map @types/jest's `expect` type into the\n// global env.\ndeclare global {\n\tfunction expect(...args: any[]): any\n}\n\ndescribe('classy-solid', () => {\n\tdescribe('createSignalObject()', () => {\n\t\tit('has gettable and settable values via .get and .set methods', async () => {\n\t\t\tconst num = createSignalObject(0)\n\n\t\t\t// Set the variable's value by passing a value in.\n\t\t\tnum.set(1)\n\t\t\t// Read the variable's value by calling it with no args.\n\t\t\texpect(num.get()).toBe(1)\n\n\t\t\t// increment example:\n\t\t\tconst setResult = num.set(num.get() + 1)\n\t\t\texpect(num.get()).toBe(2)\n\t\t\texpect(setResult).toBe(2)\n\n\t\t\t// Set with a function that accepts the previous value and returns the next value.\n\t\t\tnum.set(n => n + 1)\n\t\t\texpect(num.get()).toBe(3)\n\t\t})\n\t})\n\n\tdescribe('createSignalFunction()', () => {\n\t\tit('has gettable and settable values via a single overloaded function', async () => {\n\t\t\tconst num = createSignalFunction(0)\n\n\t\t\t// Set the variable's value by passing a value in.\n\t\t\tnum(1)\n\t\t\t// Read the variable's value by calling it with no args.\n\t\t\texpect(num()).toBe(1)\n\n\t\t\t// increment example:\n\t\t\tconst setResult = num(num() + 1)\n\t\t\texpect(num()).toBe(2)\n\t\t\texpect(setResult).toBe(2)\n\n\t\t\t// Set with a function that accepts the previous value and returns the next value.\n\t\t\tnum(n => n + 1)\n\t\t\texpect(num()).toBe(3)\n\t\t})\n\t})\n\n\tdescribe('createDeferredEffect()', () => {\n\t\tit('works', async () => {\n\t\t\tconst count = createSignalFunction(0)\n\t\t\tconst foo = createSignalFunction(0)\n\n\t\t\tlet runCount = 0\n\n\t\t\tconst stop = (() => {\n\t\t\t\tlet stop!: () => void\n\n\t\t\t\tcreateRoot(_stop => {\n\t\t\t\t\tstop = _stop\n\n\t\t\t\t\t// Runs once initially after the current root context just\n\t\t\t\t\t// like createEffect, then any time it re-runs due to a\n\t\t\t\t\t// change in a dependency, the re-run will be deferred in\n\t\t\t\t\t// the next microtask and will run only once (not once per\n\t\t\t\t\t// signal that changed)\n\t\t\t\t\tcreateDeferredEffect(() => {\n\t\t\t\t\t\tcount()\n\t\t\t\t\t\tfoo()\n\t\t\t\t\t\trunCount++\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\t\treturn stop\n\t\t\t})()\n\n\t\t\t// Queues the effect to run in the next microtask\n\t\t\tcount(1)\n\t\t\tcount(2)\n\t\t\tfoo(3)\n\n\t\t\t// Still 1 because the deferred effect didn't run yet, it will in the next microtask.\n\t\t\texpect(runCount).toBe(1)\n\n\t\t\tawait Promise.resolve()\n\n\t\t\t// It ran only once in the previous microtask (batched), not once per signal write.\n\t\t\texpect(runCount).toBe(2)\n\n\t\t\tcount(3)\n\t\t\tcount(4)\n\t\t\tfoo(5)\n\n\t\t\texpect(runCount).toBe(2)\n\n\t\t\tawait Promise.resolve()\n\n\t\t\texpect(runCount).toBe(3)\n\n\t\t\t// Stops the effect from re-running. It can now be garbage collected.\n\t\t\tstop()\n\n\t\t\tcount(3)\n\t\t\tcount(4)\n\t\t\tfoo(5)\n\n\t\t\texpect(runCount).toBe(3)\n\n\t\t\tawait Promise.resolve()\n\n\t\t\t// Still the same because it was stopped, so it didn't run in the\n\t\t\t// macrotask prior to the await.\n\t\t\texpect(runCount).toBe(3)\n\n\t\t\t// Double check just in case (the wrong implementation would make it\n\t\t\t// skip two microtasks before running).\n\t\t\tawait Promise.resolve()\n\t\t\texpect(runCount).toBe(3)\n\t\t})\n\t})\n\n\tdescribe('@reactive, @signal, and signalify', () => {\n\t\tit('makes class properties reactive, using class and property/accessor decorators', () => {\n\t\t\t@reactive\n\t\t\tclass Butterfly {\n\t\t\t\t@signal colors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\t@signal\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly()\n\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('maintains reactivity in subclass overridden fields', async () => {\n\t\t\t@reactive\n\t\t\tclass Butterfly {\n\t\t\t\t@signal colors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\t@signal\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@reactive\n\t\t\tclass SubButterfly extends Butterfly {\n\t\t\t\t@signal override colors = 123\n\t\t\t}\n\n\t\t\tconst b = new SubButterfly()\n\n\t\t\ttestButterflyProps(b, 123)\n\t\t})\n\n\t\tit('does not prevent superclass constructor from receiving subclass constructor args', () => {\n\t\t\t@reactive\n\t\t\tclass Insect {\n\t\t\t\tconstructor(public double: number) {}\n\t\t\t}\n\n\t\t\t@reactive\n\t\t\tclass Butterfly extends Insect {\n\t\t\t\t@signal colors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\t@signal\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\n\t\t\t\tconstructor(arg: number) {\n\t\t\t\t\tsuper(arg * 2)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly(4)\n\n\t\t\texpect(b.double).toBe(8)\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('makes class properties reactive, not using any decorators, specified in the constructor', () => {\n\t\t\tclass Butterfly {\n\t\t\t\tcolors = 3\n\t\t\t\t_wingSize = 2\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly()\n\n\t\t\ttestButterflyProps(b)\n\n\t\t\t// quick type check:\n\t\t\tconst b2 = new Butterfly()\n\t\t\tsignalify(\n\t\t\t\tb2,\n\t\t\t\t'colors',\n\t\t\t\t'wingSize',\n\t\t\t\t// @ts-expect-error \"foo\" is not a property on Butterfly\n\t\t\t\t'foo',\n\t\t\t)\n\t\t})\n\n\t\tit('makes class properties reactive, with signalify in the constructor', () => {\n\t\t\tclass Butterfly {\n\t\t\t\tcolors: number\n\t\t\t\t_wingSize: number\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t}\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t}\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tthis.colors = 3\n\t\t\t\t\tthis._wingSize = 2\n\n\t\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst b = new Butterfly()\n\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('works with a function-style class, with signalify in the constructor', () => {\n\t\t\tfunction Butterfly() {\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis.colors = 3\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis._wingSize = 2\n\n\t\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\t// @ts-ignore\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('works with a function-style class, with properties on the prototype, and signalify in constructor', () => {\n\t\t\tfunction Butterfly() {\n\t\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\t\tsignalify(this, 'colors', 'wingSize')\n\t\t\t}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tcolors: 3,\n\t\t\t\t_wingSize: 2,\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('can be used on a function-style class, with properties on the prototype, and signalify on the prototype', () => {\n\t\t\tfunction Butterfly() {}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tcolors: 3,\n\t\t\t\t_wingSize: 2,\n\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tsignalify(Butterfly.prototype, 'colors', 'wingSize')\n\n\t\t\t// @ts-ignore no type checking for ES5-style classes.\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('can be used on a function-style class, with properties in the constructor, and signalify on the prototype', () => {\n\t\t\tfunction Butterfly() {\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis.colors = 3\n\t\t\t\t// @ts-ignore\n\t\t\t\tthis._wingSize = 2\n\t\t\t}\n\n\t\t\tButterfly.prototype = {\n\t\t\t\tget wingSize() {\n\t\t\t\t\treturn this._wingSize\n\t\t\t\t},\n\t\t\t\tset wingSize(s: number) {\n\t\t\t\t\tthis._wingSize = s\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tsignalify(Butterfly.prototype, 'colors', 'wingSize')\n\n\t\t\t// @ts-ignore\n\t\t\tconst b = new Butterfly()\n\t\t\ttestButterflyProps(b)\n\t\t})\n\n\t\tit('throws an error when @signal is used without @reactive', async () => {\n\t\t\texpect(() => {\n\t\t\t\t// user forgot to use @reactive here\n\t\t\t\tclass Foo {\n\t\t\t\t\t@signal foo = 'hoo'\n\t\t\t\t}\n\n\t\t\t\tFoo\n\n\t\t\t\t@reactive\n\t\t\t\tclass Bar {\n\t\t\t\t\t@signal bar = 123\n\t\t\t\t}\n\n\t\t\t\tnew Bar()\n\t\t\t}).toThrow('Did you forget')\n\n\t\t\t// TODO how to check for an error thrown from a microtask?\n\t\t\t// (window.addEventListener('error') seems not to work)\n\t\t\t//\n\t\t\t// It just won't work, the error seems to never fire here in the\n\t\t\t// tests, but it works fine when testing manually in Chrome.\n\n\t\t\t// const errPromise = new Promise(r => window.addEventListener('error', e => r(e), {once: true}))\n\n\t\t\t// @reactive\n\t\t\t// class Foo {\n\t\t\t// \t@signal foo = 'hoo'\n\t\t\t// }\n\n\t\t\t// Foo\n\n\t\t\t// // user forgot to use @reactive here\n\t\t\t// class Bar {\n\t\t\t// \t@signal bar = 123\n\t\t\t// }\n\n\t\t\t// Bar\n\n\t\t\t// const err = await errPromise\n\n\t\t\t// expect(err.message).toContain('Did you forget')\n\t\t})\n\n\t\tit('works with function values', () => {\n\t\t\t// This test ensures that functions are handled propertly, because\n\t\t\t// if passed without being wrapped to a signal setter it will be\n\t\t\t// called immediately with the previous value and be expected to\n\t\t\t// return a new value, instead of being set as the actual new value.\n\n\t\t\t@reactive\n\t\t\tclass Doer {\n\t\t\t\t@signal do: (() => unknown) | null = null\n\t\t\t}\n\n\t\t\tconst doer = new Doer()\n\n\t\t\texpect(doer.do).toBe(null)\n\n\t\t\tconst newFunc = () => 123\n\t\t\tdoer.do = newFunc\n\n\t\t\texpect(doer.do).toBe(newFunc)\n\t\t\texpect(doer.do()).toBe(123)\n\t\t})\n\n\t\tdescribe('signalify', () => {\n\t\t\tit('is not tracked inside of an effect to prevent loops', () => {\n\t\t\t\t// Library author provides obj\n\t\t\t\tconst obj = {n: 123}\n\t\t\t\tsignalify(obj, 'n') // library author might signalify obj.n\n\n\t\t\t\t// User code:\n\t\t\t\tcreateEffect(() => {\n\t\t\t\t\t// o.n may or may not already be signalified, user does not know, but they want to be sure they can react to its changes.\n\t\t\t\t\tsignalify(obj, 'n')\n\n\t\t\t\t\tobj.n = 123 // does not make an infinite loop\n\n\t\t\t\t\t// A deeper effect will be reading the property.\n\t\t\t\t\tcreateEffect(() => {\n\t\t\t\t\t\tconsole.log(obj.n)\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\t\t// No expectations in this test, the test passes if a maximum\n\t\t\t\t// callstack size error (infinite loop) does not happen.\n\t\t\t})\n\t\t})\n\n\t\tit('show that signalify causes constructor to be reactive when used manually instead of decorators', () => {\n\t\t\tclass Foo {\n\t\t\t\tamount = 3\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsignalify(this, 'amount')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tclass Bar extends Foo {\n\t\t\t\tdouble = 0\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper()\n\t\t\t\t\tsignalify(this, 'double')\n\t\t\t\t\tthis.double = this.amount * 2 // this tracks access of .amount\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet count = 0\n\t\t\tlet b!: Bar\n\n\t\t\tcreateEffect(() => {\n\t\t\t\tb = new Bar() // tracks .amount\n\t\t\t\tcount++\n\t\t\t})\n\n\t\t\texpect(count).toBe(1)\n\n\t\t\tb.amount = 4 // triggers\n\n\t\t\texpect(count).toBe(2)\n\t\t})\n\n\t\tit('show how to manually untrack constructors when not using decorators', () => {\n\t\t\tclass Foo {\n\t\t\t\tamount = 3\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsignalify(this, 'amount')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tclass Bar extends Foo {\n\t\t\t\tdouble = 0\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper()\n\t\t\t\t\tsignalify(this, 'double')\n\n\t\t\t\t\tuntrack(() => {\n\t\t\t\t\t\tthis.double = this.amount * 2\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet count = 0\n\t\t\tlet b!: Bar\n\n\t\t\tcreateEffect(() => {\n\t\t\t\tb = new Bar() // does not track .amount\n\t\t\t\tcount++\n\t\t\t})\n\n\t\t\texpect(count).toBe(1)\n\n\t\t\tb.amount = 4 // will not trigger\n\n\t\t\texpect(count).toBe(1)\n\t\t})\n\n\t\tit('automatically does not track reactivity in constructors when using decorators', () => {\n\t\t\t@reactive\n\t\t\tclass Foo {\n\t\t\t\t@signal amount = 3\n\t\t\t}\n\n\t\t\t@reactive\n\t\t\tclass Bar extends Foo {\n\t\t\t\t@signal double = 0\n\n\t\t\t\tconstructor() {\n\t\t\t\t\tsuper()\n\t\t\t\t\tthis.double = this.amount * 2 // this read of .amount should not be tracked\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet b: Bar\n\t\t\tlet count = 0\n\n\t\t\tfunction noLoop() {\n\t\t\t\tcreateEffect(() => {\n\t\t\t\t\tb = new Bar() // this should not track\n\t\t\t\t\tcount++\n\t\t\t\t})\n\t\t\t}\n\n\t\t\texpect(noLoop).not.toThrow()\n\n\t\t\tconst b2 = b!\n\n\t\t\tb!.amount = 4 // hence this should not trigger\n\n\t\t\t// If the effect ran only once initially, not when setting b.colors,\n\t\t\t// then both variables should reference the same instance\n\t\t\texpect(count).toBe(1)\n\t\t\texpect(b!).toBe(b2)\n\t\t})\n\t})\n\n\tdescribe('@component', () => {\n\t\tit('allows to define a class using class syntax', () => {\n\t\t\tlet onMountCalled = false\n\t\t\tlet onCleanupCalled = false\n\n\t\t\t@component\n\t\t\tclass CoolComp {\n\t\t\t\tonMount() {\n\t\t\t\t\tonMountCalled = true\n\t\t\t\t}\n\n\t\t\t\tonCleanup() {\n\t\t\t\t\tonCleanupCalled = true\n\t\t\t\t}\n\n\t\t\t\ttemplate(props: any) {\n\t\t\t\t\texpect(props.foo).toBe(123)\n\t\t\t\t\treturn html`
hello classes!
`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tconst dispose = render(() => html`<${CoolComp} foo=${123} />`, root)\n\n\t\t\texpect(root.textContent).toBe('hello classes!')\n\t\t\texpect(onMountCalled).toBe(true)\n\t\t\texpect(onCleanupCalled).toBe(false)\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\n\t\t\texpect(onCleanupCalled).toBe(true)\n\n\t\t\t// throws on non-class use\n\t\t\texpect(() => {\n\t\t\t\tclass CoolComp {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t@component\n\t\t\t\t\tonMount() {}\n\t\t\t\t}\n\t\t\t\tCoolComp\n\t\t\t}).toThrow('component decorator should only be used on a class')\n\t\t})\n\n\t\tit('works in tandem with @reactive and @signal for reactivity', async () => {\n\t\t\t@component\n\t\t\t@reactive\n\t\t\tclass CoolComp {\n\t\t\t\t@signal foo = 0\n\t\t\t\t@signal bar = 0\n\n\t\t\t\ttemplate() {\n\t\t\t\t\treturn html`
foo: ${() => this.foo}, bar: ${() => this.bar}
`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tconst [a, setA] = createSignal(1)\n\t\t\tconst b = createSignalFunction(2)\n\n\t\t\t// FIXME Why do we need `() => b()` instead of just `b` here? Does `html`\n\t\t\t// check the `length` of the function and do something based on\n\t\t\t// that? Or does it get passed to a @signal property's setter and\n\t\t\t// receives the previous value?\n\t\t\tconst dispose = render(() => html`<${CoolComp} foo=${a} bar=${() => b()} />`, root)\n\n\t\t\texpect(root.textContent).toBe('foo: 1, bar: 2')\n\n\t\t\tsetA(3)\n\t\t\tb(4)\n\n\t\t\texpect(root.textContent).toBe('foo: 3, bar: 4')\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\t\t})\n\n\t\tit('works without decorators', () => {\n\t\t\tconst CoolComp = component(\n\t\t\t\tclass CoolComp {\n\t\t\t\t\tfoo = 0\n\t\t\t\t\tbar = 0\n\n\t\t\t\t\tconstructor() {\n\t\t\t\t\t\tsignalify(this)\n\t\t\t\t\t}\n\n\t\t\t\t\ttemplate() {\n\t\t\t\t\t\treturn html`
foo: ${() => this.foo}, bar: ${() => this.bar}
`\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tconst [a, setA] = createSignal(1)\n\t\t\tconst b = createSignalFunction(2)\n\n\t\t\t// FIXME Why do we need `() => b()` instead of just `b` here? Does `html`\n\t\t\t// check the `length` of the function and do something based on\n\t\t\t// that? Or does it get passed to a @signal property's setter and\n\t\t\t// receives the previous value?\n\t\t\tconst dispose = render(() => html`<${CoolComp} foo=${a} bar=${() => b()} />`, root)\n\n\t\t\texpect(root.textContent).toBe('foo: 1, bar: 2')\n\n\t\t\tsetA(3)\n\t\t\tb(4)\n\n\t\t\texpect(root.textContent).toBe('foo: 3, bar: 4')\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\t\t})\n\n\t\t// FIXME not working, the spread doesn't seem to do anything.\n\t\txit('works with reactive spreads', async () => {\n\t\t\t@component\n\t\t\t@reactive\n\t\t\tclass CoolComp {\n\t\t\t\t@signal foo = 0\n\t\t\t\t@signal bar = 0\n\n\t\t\t\ttemplate() {\n\t\t\t\t\treturn html`
foo: ${() => this.foo}, bar: ${() => this.bar}
`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst root = document.createElement('div')\n\t\t\tdocument.body.append(root)\n\n\t\t\tlet o = createMutable({o: {foo: 123}})\n\n\t\t\t// neither of these work\n\t\t\t// const dispose = render(() => html`<${CoolComp} ...${() => o.o} />`, root)\n\t\t\tconst dispose = render(() => html`<${CoolComp} ...${o.o} />`, root)\n\n\t\t\texpect(root.textContent).toBe('foo: 123, bar: 0')\n\n\t\t\to.o = {bar: 456}\n\n\t\t\texpect(root.textContent).toBe('foo: 123, bar: 456')\n\n\t\t\tdispose()\n\t\t\troot.remove()\n\t\t})\n\t})\n})\n\nfunction testButterflyProps(b: {colors: number; wingSize: number; _wingSize: number}, initialColors = 3) {\n\tlet count = 0\n\n\tcreateRoot(() => {\n\t\tcreateComputed(() => {\n\t\t\tb.colors\n\t\t\tb.wingSize\n\t\t\tcount++\n\t\t})\n\t})\n\n\texpect(b.colors).toBe(initialColors, 'initial colors value')\n\texpect(b.wingSize).toBe(2, 'initial wingSize value')\n\texpect(b._wingSize).toBe(2, 'ensure the original accessor works')\n\texpect(count).toBe(1, 'Should be reactive')\n\n\tb.colors++\n\n\texpect(b.colors).toBe(initialColors + 1, 'incremented colors value')\n\texpect(count).toBe(2, 'Should be reactive')\n\n\tb.wingSize++\n\n\texpect(b.wingSize).toBe(3, 'incremented wingSize value')\n\texpect(b._wingSize).toBe(3, 'ensure the original accessor works')\n\texpect(count).toBe(3, 'Should be reactive')\n}\n\n//////////////////////////////////////////////////////////////////////////\n// createSignalObject type tests ///////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////\n\n{\n\tconst num = createSignalObject(1)\n\tlet n1: number = num.get()\n\tn1\n\tnum.set(123)\n\tnum.set(n => (n1 = n + 1))\n\t// @ts-expect-error Expected 1 arguments, but got 0. ts(2554)\n\tnum.set()\n\n\tconst num3 = createSignalObject()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n3: number = num3.get()\n\tnum3.set(123)\n\tnum3.set(undefined) // ok, accepts undefined\n\t// @ts-expect-error Object is possibly 'undefined'. ts(2532) (the `n` value)\n\tnum3.set(n => (n3 = n + 1))\n\t// num3.set() // ok, accepts undefined // FIXME broke in Solid 1.7.9\n\n\t// @ts-expect-error Argument of type 'boolean' is not assignable to parameter of type 'number'. ts(2345)\n\tconst num4 = createSignalObject(true)\n\n\tconst bool = createSignalObject(true)\n\tlet b1: boolean = bool.get()\n\tb1\n\tbool.set(false)\n\tbool.set(b => (b1 = !b))\n\t// @ts-expect-error Expected 1 arguments, but got 0. ts(2554)\n\tbool.set()\n\n\tconst bool2 = createSignalObject()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n4: boolean = bool2.get()\n\tbool2.set(false)\n\tbool2.set(undefined) // ok, accepts undefined\n\tbool2.set(n => (n4 = !n)) // ok because undefined is being converted to boolean\n\t// @ts-expect-error Type 'boolean | undefined' is not assignable to type 'boolean'. ts(2322)\n\tbool2.set(n => (n4 = n))\n\t// bool2.set() // ok, accepts undefined // FIXME try Solid 1.7.9\n\n\tconst func = createSignalObject(() => 1)\n\t// @ts-expect-error 1 is not assignable to function (no overload matches)\n\tfunc.set(() => 1)\n\tfunc.set(() => (): 1 => 1) // ok, set the value to a function\n\tconst fn: () => 1 = func.get() // ok, returns function value\n\tfn\n\tconst n5: 1 = func.get()()\n\tn5\n\n\tconst func2 = createSignalObject<() => number>(() => 1)\n\t// @FIXME-ts-expect-error number is not assignable to function (no overload matches)\n\tfunc2.set(() => 1) // FIXME should be a type error. Try Solid 1.7.9\n\tfunc2.set(() => () => 1) // ok, set the value to a function\n\tconst fn2: () => number = func2.get() // ok, returns function value\n\tfn2\n\tconst n6: number = func2.get()()\n\tn6\n\n\tconst stringOrFunc1 = createSignalObject<(() => number) | string>('')\n\t// @FIXME-ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc1.set(() => 1) // FIXME should be a type error. Try Solid 1.7.9\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf1: () => number = stringOrFunc1.set(() => () => 1)\n\tsf1\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf2: string = stringOrFunc1.set('oh yeah')\n\tsf2\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf3: string = stringOrFunc1.set(() => 'oh yeah')\n\tsf3\n\t// @ts-expect-error cannot set signal to undefined\n\tstringOrFunc1.set()\n\t// @ts-expect-error cannot set signal to undefined\n\tstringOrFunc1.set(undefined)\n\t// @ts-expect-error return value might be string\n\tconst sf6: () => number = stringOrFunc1.get()\n\tsf6\n\tconst sf7: (() => number) | string | undefined = stringOrFunc1.get()\n\tsf7\n\tconst sf8: (() => number) | string = stringOrFunc1.get()\n\tsf8\n\n\tconst stringOrFunc2 = createSignalObject<(() => number) | string>()\n\t// @FIXME-ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc2.set(() => 1) // FIXME should be a type error. Try Solid 1.7.9\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf9: () => number = stringOrFunc2.set(() => () => 1)\n\tsf9\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf10: string = stringOrFunc2.set('oh yeah')\n\tsf10\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf11: string = stringOrFunc2.set(() => 'oh yeah')\n\tsf11\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf12: undefined = stringOrFunc2.set()\n\tsf12\n\t// @ts-expect-error FIXME try Solid 1.7.9\n\tconst sf13: undefined = stringOrFunc2.set(undefined)\n\tsf13\n\tconst sf14: (() => number) | string | undefined = stringOrFunc2.get()\n\tsf14\n\t// @ts-expect-error return value might be undefined\n\tconst sf15: (() => number) | string = stringOrFunc2.get()\n\tsf15\n}\n\n//////////////////////////////////////////////////////////////////////////\n// createSignalFunction type tests ///////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////\n\n{\n\tconst num = createSignalFunction(1)\n\tlet n1: number = num()\n\tn1\n\tnum(123)\n\tnum(n => (n1 = n + 1))\n\tnum()\n\n\tconst num3 = createSignalFunction()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n3: number = num3()\n\tnum3(123)\n\tnum3(undefined) // ok, accepts undefined\n\t// @ts-expect-error Object is possibly 'undefined'. ts(2532) (the `n` value)\n\tnum3(n => (n3 = n + 1))\n\tnum3() // ok, getter\n\n\t// @ts-expect-error Argument of type 'boolean' is not assignable to parameter of type 'number'. ts(2345)\n\tconst num4 = createSignalFunction(true)\n\n\tconst bool = createSignalFunction(true)\n\tlet b1: boolean = bool()\n\tb1\n\tbool(false)\n\tbool(b => (b1 = !b))\n\tbool()\n\n\tconst bool2 = createSignalFunction()\n\t// @ts-expect-error Type 'undefined' is not assignable to type 'number'. ts(2322)\n\tlet n4: boolean = bool2()\n\tbool2(false)\n\tbool2(undefined) // ok, accepts undefined\n\tbool2(n => (n4 = !n)) // ok because undefined is being converted to boolean\n\t// @ts-expect-error Type 'boolean | undefined' is not assignable to type 'boolean'. ts(2322)\n\tbool2(n => (n4 = n))\n\tbool2() // ok, accepts undefined\n\n\tconst func = createSignalFunction(() => 1)\n\t// @ts-expect-error 1 is not assignable to function (no overload matches)\n\tfunc(() => 1)\n\tfunc(() => (): 1 => 1) // ok, set the value to a function\n\tconst fn: () => 1 = func() // ok, returns function value\n\tfn\n\tconst n5: 1 = func()()\n\tn5\n\n\tconst func2 = createSignalFunction<() => number>(() => 1)\n\t// @ts-expect-error number is not assignable to function (no overload matches)\n\tfunc2(() => 1)\n\tfunc2(() => () => 1) // ok, set the value to a function\n\tconst fn2: () => number = func2() // ok, returns function value\n\tfn2\n\tconst n6: number = func2()()\n\tn6\n\n\tconst stringOrFunc1 = createSignalFunction<(() => number) | string>('')\n\t// @ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc1(() => 1)\n\tconst sf1: () => number = stringOrFunc1(() => () => 1)\n\tsf1\n\tconst sf2: string = stringOrFunc1('oh yeah')\n\tsf2\n\tconst sf3: string = stringOrFunc1(() => 'oh yeah')\n\tsf3\n\tstringOrFunc1() // ok, getter\n\t// @ts-expect-error cannot set signal to undefined\n\tstringOrFunc1(undefined)\n\t// @ts-expect-error return value might be string\n\tconst sf6: () => number = stringOrFunc1()\n\tsf6\n\tconst sf7: (() => number) | string | undefined = stringOrFunc1()\n\tsf7\n\tconst sf8: (() => number) | string = stringOrFunc1()\n\tsf8\n\n\tconst stringOrFunc2 = createSignalFunction<(() => number) | string>()\n\t// @ts-expect-error number not assignable to string | (()=>number) | undefined\n\tstringOrFunc2(() => 1)\n\tconst sf9: () => number = stringOrFunc2(() => () => 1)\n\tsf9\n\tconst sf10: string = stringOrFunc2('oh yeah')\n\tsf10\n\tconst sf11: string = stringOrFunc2(() => 'oh yeah')\n\tsf11\n\t// @ts-expect-error 'string | (() => number) | undefined' is not assignable to type 'undefined'.\n\tconst sf12: undefined = stringOrFunc2()\n\tsf12\n\tconst sf13: undefined = stringOrFunc2(undefined)\n\tsf13\n\tconst sf14: (() => number) | string | undefined = stringOrFunc2()\n\tsf14\n\t// @ts-expect-error return value might be undefined\n\tconst sf15: (() => number) | string = stringOrFunc2()\n\tsf15\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAQA,cAAc,EAAEC,YAAY,EAAEC,UAAU,EAAEC,YAAY,EAAEC,OAAO,QAAO,UAAU;AACxF,SAAQC,aAAa,QAAO,gBAAgB;AAC5C,SAAQC,MAAM,QAAO,cAAc;AACnC,OAAOC,IAAI,MAAM,eAAe;AAChC,SACCC,kBAAkB,EAClBC,QAAQ,EACRC,SAAS,EACTC,oBAAoB,EACpBC,MAAM,EACNC,oBAAoB,EACpBC,SAAS,QACH,YAAY;;AAEnB;AACA;AAKAC,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC9BA,QAAQ,CAAC,sBAAsB,EAAE,MAAM;IACtCC,EAAE,CAAC,4DAA4D,EAAE,YAAY;MAC5E,MAAMC,GAAG,GAAGT,kBAAkB,CAAC,CAAC,CAAC;;MAEjC;MACAS,GAAG,CAACC,GAAG,CAAC,CAAC,CAAC;MACV;MACAC,MAAM,CAACF,GAAG,CAACG,GAAG,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;;MAEzB;MACA,MAAMC,SAAS,GAAGL,GAAG,CAACC,GAAG,CAACD,GAAG,CAACG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;MACxCD,MAAM,CAACF,GAAG,CAACG,GAAG,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;MACzBF,MAAM,CAACG,SAAS,CAAC,CAACD,IAAI,CAAC,CAAC,CAAC;;MAEzB;MACAJ,GAAG,CAACC,GAAG,CAACK,CAAC,IAAIA,CAAC,GAAG,CAAC,CAAC;MACnBJ,MAAM,CAACF,GAAG,CAACG,GA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CAA0B,EAAE,CAAC;EACvE;EACAmI,aAAa,CAAC,MAAM,CAAC,CAAC;EACtB,MAAMC,GAAiB,GAAGD,aAAa,CAAC,MAAM,MAAM,CAAC,CAAC;EACtDC,GAAG;EACH,MAAMC,GAAW,GAAGF,aAAa,CAAC,SAAS,CAAC;EAC5CE,GAAG;EACH,MAAMC,GAAW,GAAGH,aAAa,CAAC,MAAM,SAAS,CAAC;EAClDG,GAAG;EACHH,aAAa,CAAC,CAAC,EAAC;EAChB;EACAA,aAAa,CAACZ,SAAS,CAAC;EACxB;EACA,MAAMgB,GAAiB,GAAGJ,aAAa,CAAC,CAAC;EACzCI,GAAG;EACH,MAAMC,GAAwC,GAAGL,aAAa,CAAC,CAAC;EAChEK,GAAG;EACH,MAAMC,GAA4B,GAAGN,aAAa,CAAC,CAAC;EACpDM,GAAG;EAEH,MAAMC,aAAa,GAAG1I,oBAAoB,CAA0B,CAAC;EACrE;EACA0I,aAAa,CAAC,MAAM,CAAC,CAAC;EACtB,MAAMC,GAAiB,GAAGD,aAAa,CAAC,MAAM,MAAM,CAAC,CAAC;EACtDC,GAAG;EACH,MAAMC,IAAY,GAAGF,aAAa,CAAC,SAAS,CAAC;EAC7CE,IAAI;EACJ,MAAMC,IAAY,GAAGH,aAAa,CAAC,MAAM,SAAS,CAAC;EACnDG,IAAI;EACJ;EACA,MAAMC,IAAe,GAAGJ,aAAa,CAAC,CAAC;EACvCI,IAAI;EACJ,MAAMC,IAAe,GAAGL,aAAa,CAACnB,SAAS,CAAC;EAChDwB,IAAI;EACJ,MAAMC,IAAyC,GAAGN,aAAa,CAAC,CAAC;EACjEM,IAAI;EACJ;EACA,MAAMC,IAA6B,GAAGP,aAAa,CAAC,CAAC;EACrDO,IAAI;AACL"} \ No newline at end of file diff --git a/dist/signalify.d.ts.map b/dist/signalify.d.ts.map index 5792a04..be6bcbc 100644 --- a/dist/signalify.d.ts.map +++ b/dist/signalify.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"signalify.d.ts","sourceRoot":"","sources":["../src/signalify.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAC7E,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAczE;;GAEG;AACH,wBAAgB,uBAAuB,gCAItC;AASD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,WAE7E;AASD,iBAAS,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAC7C,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAC9B,UAAU,GAAE,OAAmB,EAe/B,QAAQ,UAAQ,GACd,IAAI,CA+FN"} \ No newline at end of file +{"version":3,"file":"signalify.d.ts","sourceRoot":"","sources":["../src/signalify.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAC7E,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAczE;;GAEG;AACH,wBAAgB,uBAAuB,gCAItC;AASD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,WAE7E;AASD,iBAAS,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAC7C,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAG9B,UAAU,GAAE,OAAkC,EAe9C,QAAQ,UAAQ,GACd,IAAI,CA+FN"} \ No newline at end of file diff --git a/dist/signalify.js b/dist/signalify.js index 3d3b62a..6657dc3 100644 --- a/dist/signalify.js +++ b/dist/signalify.js @@ -1,5 +1,5 @@ import { getInheritedDescriptor } from 'lowclass'; -import { createSignal, $PROXY } from 'solid-js'; +import { createSignal, $PROXY, untrack } from 'solid-js'; const signalifiedProps = new WeakMap(); /** @@ -84,7 +84,10 @@ function trackPropSetAtLeastOnce(instance, prop) { propsSetAtLeastOnce.get(instance).add(prop); } const isSignalGetter = new WeakSet(); -function createSignalAccessor(obj, prop, initialVal = obj[prop], +function createSignalAccessor(obj, prop, +// Untrack here to be extra safe this doesn't count as a dependency and +// cause a reactivity loop. +initialVal = untrack(() => obj[prop]), // If an object already has a particular signalified property, override it // with a new one anyway (useful for maintaining consistency with class // inheritance where class fields always override fields from base classes diff --git a/dist/signalify.js.map b/dist/signalify.js.map index 4cfe3d9..1be1a10 100644 --- a/dist/signalify.js.map +++ b/dist/signalify.js.map @@ -1 +1 @@ -{"version":3,"file":"signalify.js","names":["getInheritedDescriptor","createSignal","$PROXY","signalifiedProps","WeakMap","signalify","obj","props","_props","length","Object","keys","concat","getOwnPropertySymbols","prop","createSignalAccessor","gotCreateSignalAccessor","getCreateSignalAccessor","Error","propsSetAtLeastOnce","__isPropSetAtLeastOnce","instance","get","has","trackPropSetAtLeastOnce","set","Set","add","isSignalGetter","WeakSet","initialVal","override","proxy","descriptor","originalGet","originalSet","console","warn","toString","value","writable","s","equals","configurable","enumerable","call","newValue","defineProperty"],"sources":["../src/signalify.ts"],"sourcesContent":["import {getInheritedDescriptor} from 'lowclass'\nimport {createSignal, $PROXY} from 'solid-js'\nimport type {PropKey, PropSpec} from './decorators/types.js'\n\nconst signalifiedProps = new WeakMap>()\n\n/**\n * Convert properties on an object into Solid signal-backed properties.\n *\n * There are two ways to use this: either by defining which properties to\n * convert to signal-backed properties by providing an array as property names\n * in the second arg, which is useful on plain objects, or by passing in `this`\n * and `this.constructor` within the `constructor` of a class that has\n * properties decorated with `@signal`.\n *\n * Example with a class:\n *\n * ```js\n * import {signalify} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * class Counter {\n * count = 0\n *\n * constructor() {\n * signalify(this, 'count')\n * setInterval(() => this.count++, 1000)\n * }\n * }\n *\n * const counter = new Counter\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n *\n * Example with a plain object:\n *\n * ```js\n * import {signalify} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * const counter = {\n * count: 0\n * }\n *\n * signalify(counter, 'count')\n * setInterval(() => counter.count++, 1000)\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n */\nexport function signalify(obj: T, ...props: (keyof T)[]): T\nexport function signalify(obj: T): T\nexport function signalify(obj: Obj, ...props: [] | [Map] | PropertyKey[]) {\n\t// We cast from PropertyKey[] to PropKey[] because numbers can't actually be keys, only string | symbol.\n\tconst _props = props.length\n\t\t? (props as PropKey[])\n\t\t: (Object.keys(obj) as PropKey[]).concat(Object.getOwnPropertySymbols(obj))\n\n\tfor (const prop of _props) createSignalAccessor(obj, prop)\n\n\treturn obj\n}\n\nlet gotCreateSignalAccessor = false\n\n/**\n * This ensures that `createSignalAccessor` is kept internal to classy-solid only.\n */\nexport function getCreateSignalAccessor() {\n\tif (gotCreateSignalAccessor) throw new Error('Export \"createSignalAccessor\" is internal to classy-solid only.')\n\tgotCreateSignalAccessor = true\n\treturn createSignalAccessor\n}\n\n// propsSetAtLeastOnce is a Set that tracks which reactive properties have been\n// set at least once.\nconst propsSetAtLeastOnce = new WeakMap>()\n\n// @lume/element uses this to detect if a reactive prop has been set, and if so\n// will not overwrite the value with any pre-existing value from custom element\n// pre-upgrade.\nexport function __isPropSetAtLeastOnce(instance: object, prop: string | symbol) {\n\treturn !!propsSetAtLeastOnce.get(instance)?.has(prop)\n}\n\nfunction trackPropSetAtLeastOnce(instance: object, prop: string | symbol) {\n\tif (!propsSetAtLeastOnce.has(instance)) propsSetAtLeastOnce.set(instance, new Set())\n\tpropsSetAtLeastOnce.get(instance)!.add(prop)\n}\n\nconst isSignalGetter = new WeakSet()\n\nfunction createSignalAccessor(\n\tobj: T,\n\tprop: Exclude,\n\tinitialVal: unknown = obj[prop],\n\t// If an object already has a particular signalified property, override it\n\t// with a new one anyway (useful for maintaining consistency with class\n\t// inheritance where class fields always override fields from base classes\n\t// due to their [[Define]] semantics). False is a good default for signalify()\n\t// usage where someone is augmenting an existing object, but true is more\n\t// useful with usage of @signal on class fields.\n\t//\n\t// Note that if @signal were to specify this as false, it would cause\n\t// @signal-decorated subclass fields to override base class\n\t// @signal-decorated fields with a new value descriptor but without\n\t// signalifiying the field, effectively disabling reactivity, which is a bug\n\t// (a field decorated with @signal *must* be reactive). The test named\n\t// \"maintains reactivity in subclass overridden fields\" was added to ensure\n\t// that the subclass use case works.\n\toverride = false,\n): void {\n\tif (!override && signalifiedProps.get(obj)?.has(prop)) return\n\n\t// Special case for Solid proxies: if the object is already a solid proxy,\n\t// all properties are already reactive, no need to signalify.\n\t// @ts-expect-error special indexed access\n\tconst proxy = obj[$PROXY] as T\n\tif (proxy) return\n\n\tlet descriptor: PropertyDescriptor | undefined = getInheritedDescriptor(obj, prop)\n\n\tlet originalGet: (() => any) | undefined\n\tlet originalSet: ((v: any) => void) | undefined\n\n\tif (descriptor) {\n\t\toriginalGet = descriptor.get\n\t\toriginalSet = descriptor.set\n\n\t\t// Even if override is true, if we have a signal accessor, there's no\n\t\t// need to replace it with another signal accessor. We only need to\n\t\t// override when the current descriptor is not a signal accessor.\n\t\t// TODO this needs tests.\n\t\tif (originalGet && isSignalGetter.has(originalGet)) return\n\n\t\tif (originalGet || originalSet) {\n\t\t\t// reactivity requires both\n\t\t\tif (!originalGet || !originalSet) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`@signal\\` decorator was used on an accessor named \"${prop.toString()}\" which had a getter or a setter, but not both. Reactivity on accessors works only when accessors have both get and set. In this case the decorator does not do anything.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.get\n\t\t\tdelete descriptor.set\n\t\t} else {\n\t\t\t// If there was a value descriptor, trust it as the source of truth\n\t\t\t// for initialVal. For example, if the user class modifies the value\n\t\t\t// after the initializer, it will have a different value than what\n\t\t\t// we tracked from the initializer.\n\t\t\tinitialVal = descriptor.value\n\n\t\t\t// if it isn't writable, we don't need to make a reactive variable because\n\t\t\t// the value won't change\n\t\t\tif (!descriptor.writable) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`@signal\\` decorator was used on a property named \"${prop.toString()}\" that is not writable. Reactivity is not enabled for non-writable properties.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.value\n\t\t\tdelete descriptor.writable\n\t\t}\n\t}\n\n\tconst s = createSignal(initialVal, {equals: false})\n\n\tdescriptor = {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\t...descriptor,\n\t\tget: originalGet\n\t\t\t? function (this: T): unknown {\n\t\t\t\t\ts[0]() // read\n\t\t\t\t\treturn originalGet!.call(this)\n\t\t\t }\n\t\t\t: function (this: any): unknown {\n\t\t\t\t\treturn s[0]() // read\n\t\t\t },\n\t\tset: originalSet\n\t\t\t? function (this: any, newValue: unknown) {\n\t\t\t\t\toriginalSet!.call(this, newValue)\n\n\t\t\t\t\ttrackPropSetAtLeastOnce(this, prop)\n\n\t\t\t\t\t// write\n\t\t\t\t\tif (typeof newValue === 'function') s[1](() => newValue)\n\t\t\t\t\telse s[1](newValue)\n\t\t\t }\n\t\t\t: function (this: any, newValue: unknown) {\n\t\t\t\t\ttrackPropSetAtLeastOnce(this, prop)\n\n\t\t\t\t\t// write\n\t\t\t\t\tif (typeof newValue === 'function') s[1](() => newValue)\n\t\t\t\t\telse s[1](newValue)\n\t\t\t },\n\t}\n\n\tisSignalGetter.add(descriptor.get!)\n\n\tObject.defineProperty(obj, prop, descriptor)\n\n\tif (!signalifiedProps.has(obj)) signalifiedProps.set(obj, new Set())\n\tsignalifiedProps.get(obj)!.add(prop)\n}\n\ntype Obj = Record\n"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,UAAU;AAC/C,SAAQC,YAAY,EAAEC,MAAM,QAAO,UAAU;AAG7C,MAAMC,gBAAgB,GAAG,IAAIC,OAAO,CAA+B,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,SAASC,SAASA,CAACC,GAAQ,EAAE,GAAGC,KAAoD,EAAE;EAC5F;EACA,MAAMC,MAAM,GAAGD,KAAK,CAACE,MAAM,GACvBF,KAAK,GACLG,MAAM,CAACC,IAAI,CAACL,GAAG,CAAC,CAAeM,MAAM,CAACF,MAAM,CAACG,qBAAqB,CAACP,GAAG,CAAC,CAAC;EAE5E,KAAK,MAAMQ,IAAI,IAAIN,MAAM,EAAEO,oBAAoB,CAACT,GAAG,EAAEQ,IAAI,CAAC;EAE1D,OAAOR,GAAG;AACX;AAEA,IAAIU,uBAAuB,GAAG,KAAK;;AAEnC;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACzC,IAAID,uBAAuB,EAAE,MAAM,IAAIE,KAAK,CAAC,iEAAiE,CAAC;EAC/GF,uBAAuB,GAAG,IAAI;EAC9B,OAAOD,oBAAoB;AAC5B;;AAEA;AAC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AAEL,CAAC,CAAC,CAAC,CAAC,CAAC,MAAMK,QAAQ,CAAC,MACnDL,CAAC,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC;IACnB,CAAC,GACD,UAAqBA,QAAiB,EAAE;MACxCtB,uBAAuB,CAAC,IAAI,EAAEV,IAAI,CAAC;;MAEnC;MACA,IAAI,OAAOgC,QAAQ,KAAK,UAAU,EAAEL,CAAC,CAAC,CAAC,CAAC,CAAC,MAAMK,QAAQ,CAAC,MACnDL,CAAC,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC;IACnB;EACJ,CAAC;EAEDlB,cAAc,CAACD,GAAG,CAACM,UAAU,CAACX,GAAI,CAAC;EAEnCZ,MAAM,CAACqC,cAAc,CAACzC,GAAG,EAAEQ,IAAI,EAAEmB,UAAU,CAAC;EAE5C,IAAI,CAAC9B,gBAAgB,CAACoB,GAAG,CAACjB,GAAG,CAAC,EAAEH,gBAAgB,CAACsB,GAAG,CAACnB,GAAG,EAAE,IAAIoB,GAAG,CAAC,CAAC,CAAC;EACpEvB,gBAAgB,CAACmB,GAAG,CAAChB,GAAG,CAAC,CAAEqB,GAAG,CAACb,IAAI,CAAC;AACrC"} \ No newline at end of file +{"version":3,"file":"signalify.js","names":["getInheritedDescriptor","createSignal","$PROXY","untrack","signalifiedProps","WeakMap","signalify","obj","props","_props","length","Object","keys","concat","getOwnPropertySymbols","prop","createSignalAccessor","gotCreateSignalAccessor","getCreateSignalAccessor","Error","propsSetAtLeastOnce","__isPropSetAtLeastOnce","instance","get","has","trackPropSetAtLeastOnce","set","Set","add","isSignalGetter","WeakSet","initialVal","override","proxy","descriptor","originalGet","originalSet","console","warn","toString","value","writable","s","equals","configurable","enumerable","call","newValue","defineProperty"],"sources":["../src/signalify.ts"],"sourcesContent":["import {getInheritedDescriptor} from 'lowclass'\nimport {createSignal, $PROXY, untrack} from 'solid-js'\nimport type {PropKey, PropSpec} from './decorators/types.js'\n\nconst signalifiedProps = new WeakMap>()\n\n/**\n * Convert properties on an object into Solid signal-backed properties.\n *\n * There are two ways to use this: either by defining which properties to\n * convert to signal-backed properties by providing an array as property names\n * in the second arg, which is useful on plain objects, or by passing in `this`\n * and `this.constructor` within the `constructor` of a class that has\n * properties decorated with `@signal`.\n *\n * Example with a class:\n *\n * ```js\n * import {signalify} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * class Counter {\n * count = 0\n *\n * constructor() {\n * signalify(this, 'count')\n * setInterval(() => this.count++, 1000)\n * }\n * }\n *\n * const counter = new Counter\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n *\n * Example with a plain object:\n *\n * ```js\n * import {signalify} from 'classy-solid'\n * import {createEffect} from 'solid-js'\n *\n * const counter = {\n * count: 0\n * }\n *\n * signalify(counter, 'count')\n * setInterval(() => counter.count++, 1000)\n *\n * createEffect(() => {\n * console.log('count:', counter.count)\n * })\n * ```\n */\nexport function signalify(obj: T, ...props: (keyof T)[]): T\nexport function signalify(obj: T): T\nexport function signalify(obj: Obj, ...props: [] | [Map] | PropertyKey[]) {\n\t// We cast from PropertyKey[] to PropKey[] because numbers can't actually be keys, only string | symbol.\n\tconst _props = props.length\n\t\t? (props as PropKey[])\n\t\t: (Object.keys(obj) as PropKey[]).concat(Object.getOwnPropertySymbols(obj))\n\n\tfor (const prop of _props) createSignalAccessor(obj, prop)\n\n\treturn obj\n}\n\nlet gotCreateSignalAccessor = false\n\n/**\n * This ensures that `createSignalAccessor` is kept internal to classy-solid only.\n */\nexport function getCreateSignalAccessor() {\n\tif (gotCreateSignalAccessor) throw new Error('Export \"createSignalAccessor\" is internal to classy-solid only.')\n\tgotCreateSignalAccessor = true\n\treturn createSignalAccessor\n}\n\n// propsSetAtLeastOnce is a Set that tracks which reactive properties have been\n// set at least once.\nconst propsSetAtLeastOnce = new WeakMap>()\n\n// @lume/element uses this to detect if a reactive prop has been set, and if so\n// will not overwrite the value with any pre-existing value from custom element\n// pre-upgrade.\nexport function __isPropSetAtLeastOnce(instance: object, prop: string | symbol) {\n\treturn !!propsSetAtLeastOnce.get(instance)?.has(prop)\n}\n\nfunction trackPropSetAtLeastOnce(instance: object, prop: string | symbol) {\n\tif (!propsSetAtLeastOnce.has(instance)) propsSetAtLeastOnce.set(instance, new Set())\n\tpropsSetAtLeastOnce.get(instance)!.add(prop)\n}\n\nconst isSignalGetter = new WeakSet()\n\nfunction createSignalAccessor(\n\tobj: T,\n\tprop: Exclude,\n\t// Untrack here to be extra safe this doesn't count as a dependency and\n\t// cause a reactivity loop.\n\tinitialVal: unknown = untrack(() => obj[prop]),\n\t// If an object already has a particular signalified property, override it\n\t// with a new one anyway (useful for maintaining consistency with class\n\t// inheritance where class fields always override fields from base classes\n\t// due to their [[Define]] semantics). False is a good default for signalify()\n\t// usage where someone is augmenting an existing object, but true is more\n\t// useful with usage of @signal on class fields.\n\t//\n\t// Note that if @signal were to specify this as false, it would cause\n\t// @signal-decorated subclass fields to override base class\n\t// @signal-decorated fields with a new value descriptor but without\n\t// signalifiying the field, effectively disabling reactivity, which is a bug\n\t// (a field decorated with @signal *must* be reactive). The test named\n\t// \"maintains reactivity in subclass overridden fields\" was added to ensure\n\t// that the subclass use case works.\n\toverride = false,\n): void {\n\tif (!override && signalifiedProps.get(obj)?.has(prop)) return\n\n\t// Special case for Solid proxies: if the object is already a solid proxy,\n\t// all properties are already reactive, no need to signalify.\n\t// @ts-expect-error special indexed access\n\tconst proxy = obj[$PROXY] as T\n\tif (proxy) return\n\n\tlet descriptor: PropertyDescriptor | undefined = getInheritedDescriptor(obj, prop)\n\n\tlet originalGet: (() => any) | undefined\n\tlet originalSet: ((v: any) => void) | undefined\n\n\tif (descriptor) {\n\t\toriginalGet = descriptor.get\n\t\toriginalSet = descriptor.set\n\n\t\t// Even if override is true, if we have a signal accessor, there's no\n\t\t// need to replace it with another signal accessor. We only need to\n\t\t// override when the current descriptor is not a signal accessor.\n\t\t// TODO this needs tests.\n\t\tif (originalGet && isSignalGetter.has(originalGet)) return\n\n\t\tif (originalGet || originalSet) {\n\t\t\t// reactivity requires both\n\t\t\tif (!originalGet || !originalSet) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`@signal\\` decorator was used on an accessor named \"${prop.toString()}\" which had a getter or a setter, but not both. Reactivity on accessors works only when accessors have both get and set. In this case the decorator does not do anything.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.get\n\t\t\tdelete descriptor.set\n\t\t} else {\n\t\t\t// If there was a value descriptor, trust it as the source of truth\n\t\t\t// for initialVal. For example, if the user class modifies the value\n\t\t\t// after the initializer, it will have a different value than what\n\t\t\t// we tracked from the initializer.\n\t\t\tinitialVal = descriptor.value\n\n\t\t\t// if it isn't writable, we don't need to make a reactive variable because\n\t\t\t// the value won't change\n\t\t\tif (!descriptor.writable) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`@signal\\` decorator was used on a property named \"${prop.toString()}\" that is not writable. Reactivity is not enabled for non-writable properties.`,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdelete descriptor.value\n\t\t\tdelete descriptor.writable\n\t\t}\n\t}\n\n\tconst s = createSignal(initialVal, {equals: false})\n\n\tdescriptor = {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\t...descriptor,\n\t\tget: originalGet\n\t\t\t? function (this: T): unknown {\n\t\t\t\t\ts[0]() // read\n\t\t\t\t\treturn originalGet!.call(this)\n\t\t\t }\n\t\t\t: function (this: any): unknown {\n\t\t\t\t\treturn s[0]() // read\n\t\t\t },\n\t\tset: originalSet\n\t\t\t? function (this: any, newValue: unknown) {\n\t\t\t\t\toriginalSet!.call(this, newValue)\n\n\t\t\t\t\ttrackPropSetAtLeastOnce(this, prop)\n\n\t\t\t\t\t// write\n\t\t\t\t\tif (typeof newValue === 'function') s[1](() => newValue)\n\t\t\t\t\telse s[1](newValue)\n\t\t\t }\n\t\t\t: function (this: any, newValue: unknown) {\n\t\t\t\t\ttrackPropSetAtLeastOnce(this, prop)\n\n\t\t\t\t\t// write\n\t\t\t\t\tif (typeof newValue === 'function') s[1](() => newValue)\n\t\t\t\t\telse s[1](newValue)\n\t\t\t },\n\t}\n\n\tisSignalGetter.add(descriptor.get!)\n\n\tObject.defineProperty(obj, prop, descriptor)\n\n\tif (!signalifiedProps.has(obj)) signalifiedProps.set(obj, new Set())\n\tsignalifiedProps.get(obj)!.add(prop)\n}\n\ntype Obj = Record\n"],"mappings":"AAAA,SAAQA,sBAAsB,QAAO,UAAU;AAC/C,SAAQC,YAAY,EAAEC,MAAM,EAAEC,OAAO,QAAO,UAAU;AAGtD,MAAMC,gBAAgB,GAAG,IAAIC,OAAO,CAA+B,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,SAASC,SAASA,CAACC,GAAQ,EAAE,GAAGC,KAAoD,EAAE;EAC5F;EACA,MAAMC,MAAM,GAAGD,KAAK,CAACE,MAAM,GACvBF,KAAK,GACLG,MAAM,CAACC,IAAI,CAACL,GAAG,CAAC,CAAeM,MAAM,CAACF,MAAM,CAACG,qBAAqB,CAACP,GAAG,CAAC,CAAC;EAE5E,KAAK,MAAMQ,IAAI,IAAIN,MAAM,EAAEO,oBAAoB,CAACT,GAAG,EAAEQ,IAAI,CAAC;EAE1D,OAAOR,GAAG;AACX;AAEA,IAAIU,uBAAuB,GAAG,KAAK;;AAEnC;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAA,EAAG;EACzC,IAAID,uBAAuB,EAAE,MAAM,IAAIE,KAAK,CAAC,iEAAiE,CAAC;EAC/GF,uBAAuB,GAAG,IAAI;EAC9B,OAAOD,oBAAoB;A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;;MAEnC;MACA,IAAI,OAAOgC,QAAQ,KAAK,UAAU,EAAEL,CAAC,CAAC,CAAC,CAAC,CAAC,MAAMK,QAAQ,CAAC,MACnDL,CAAC,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC;IACnB,CAAC,GACD,UAAqBA,QAAiB,EAAE;MACxCtB,uBAAuB,CAAC,IAAI,EAAEV,IAAI,CAAC;;MAEnC;MACA,IAAI,OAAOgC,QAAQ,KAAK,UAAU,EAAEL,CAAC,CAAC,CAAC,CAAC,CAAC,MAAMK,QAAQ,CAAC,MACnDL,CAAC,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC;IACnB;EACJ,CAAC;EAEDlB,cAAc,CAACD,GAAG,CAACM,UAAU,CAACX,GAAI,CAAC;EAEnCZ,MAAM,CAACqC,cAAc,CAACzC,GAAG,EAAEQ,IAAI,EAAEmB,UAAU,CAAC;EAE5C,IAAI,CAAC9B,gBAAgB,CAACoB,GAAG,CAACjB,GAAG,CAAC,EAAEH,gBAAgB,CAACsB,GAAG,CAACnB,GAAG,EAAE,IAAIoB,GAAG,CAAC,CAAC,CAAC;EACpEvB,gBAAgB,CAACmB,GAAG,CAAChB,GAAG,CAAC,CAAEqB,GAAG,CAACb,IAAI,CAAC;AACrC"} \ No newline at end of file diff --git a/src/index.test.ts b/src/index.test.ts index addf302..2d5532b 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -425,6 +425,30 @@ describe('classy-solid', () => { expect(doer.do()).toBe(123) }) + describe('signalify', () => { + it('is not tracked inside of an effect to prevent loops', () => { + // Library author provides obj + const obj = {n: 123} + signalify(obj, 'n') // library author might signalify obj.n + + // User code: + createEffect(() => { + // o.n may or may not already be signalified, user does not know, but they want to be sure they can react to its changes. + signalify(obj, 'n') + + obj.n = 123 // does not make an infinite loop + + // A deeper effect will be reading the property. + createEffect(() => { + console.log(obj.n) + }) + }) + + // No expectations in this test, the test passes if a maximum + // callstack size error (infinite loop) does not happen. + }) + }) + it('show that signalify causes constructor to be reactive when used manually instead of decorators', () => { class Foo { amount = 3 diff --git a/src/signalify.ts b/src/signalify.ts index adba28e..9d2c652 100644 --- a/src/signalify.ts +++ b/src/signalify.ts @@ -1,5 +1,5 @@ import {getInheritedDescriptor} from 'lowclass' -import {createSignal, $PROXY} from 'solid-js' +import {createSignal, $PROXY, untrack} from 'solid-js' import type {PropKey, PropSpec} from './decorators/types.js' const signalifiedProps = new WeakMap>() @@ -98,7 +98,9 @@ const isSignalGetter = new WeakSet() function createSignalAccessor( obj: T, prop: Exclude, - initialVal: unknown = obj[prop], + // Untrack here to be extra safe this doesn't count as a dependency and + // cause a reactivity loop. + initialVal: unknown = untrack(() => obj[prop]), // If an object already has a particular signalified property, override it // with a new one anyway (useful for maintaining consistency with class // inheritance where class fields always override fields from base classes