@@ -2,7 +2,7 @@ import {emit, on} from '@spearwolf/eventize';
22import { createSignal , type Signal , type SignalReader , value } from '@spearwolf/signalize' ;
33import { afterEach , describe , expect , it , vi } from 'vitest' ;
44import { MessageToView } from '../constants.js' ;
5- import type { ShadowObjectParams } from '../types.js' ;
5+ import type { ShadowObjectCreationAPI } from '../types.js' ;
66import { generateUUID } from '../utils/generateUUID.js' ;
77import { onCreate , onDestroy } from './events.js' ;
88import { Kernel , type MessageToViewEvent } from './Kernel.js' ;
@@ -246,17 +246,17 @@ describe('Kernel', () => {
246246 } ) ;
247247 } ) ;
248248
249- describe ( 'ShadowObjectParams API' , ( ) => {
249+ describe ( 'Shadow Object Creation API' , ( ) => {
250250 describe ( 'useProperty' , ( ) => {
251251 it ( 'should return a signal reader for entity property' , ( ) => {
252252 const registry = new Registry ( ) ;
253253 const kernel = new Kernel ( registry ) ;
254254
255- let capturedPropertyReader : ReturnType < ShadowObjectParams [ 'useProperty' ] > | undefined ;
255+ let capturedPropertyReader : ReturnType < ShadowObjectCreationAPI [ 'useProperty' ] > | undefined ;
256256
257257 @ShadowObject ( { registry, token : 'testUseProperty' } )
258258 class TestUseProperty {
259- constructor ( { useProperty} : ShadowObjectParams ) {
259+ constructor ( { useProperty} : ShadowObjectCreationAPI ) {
260260 capturedPropertyReader = useProperty ( 'testProp' ) ;
261261 }
262262 }
@@ -278,12 +278,12 @@ describe('Kernel', () => {
278278 const registry = new Registry ( ) ;
279279 const kernel = new Kernel ( registry ) ;
280280
281- let reader1 : ReturnType < ShadowObjectParams [ 'useProperty' ] > | undefined ;
282- let reader2 : ReturnType < ShadowObjectParams [ 'useProperty' ] > | undefined ;
281+ let reader1 : ReturnType < ShadowObjectCreationAPI [ 'useProperty' ] > | undefined ;
282+ let reader2 : ReturnType < ShadowObjectCreationAPI [ 'useProperty' ] > | undefined ;
283283
284284 @ShadowObject ( { registry, token : 'testUsePropertyCache' } )
285285 class TestUsePropertyCache {
286- constructor ( { useProperty} : ShadowObjectParams ) {
286+ constructor ( { useProperty} : ShadowObjectCreationAPI ) {
287287 reader1 = useProperty ( 'testProp' ) ;
288288 reader2 = useProperty ( 'testProp' ) ;
289289 }
@@ -304,11 +304,11 @@ describe('Kernel', () => {
304304 const registry = new Registry ( ) ;
305305 const kernel = new Kernel ( registry ) ;
306306
307- let capturedProps : Record < string , ReturnType < ShadowObjectParams [ 'useProperty' ] > > | undefined ;
307+ let capturedProps : Record < string , ReturnType < ShadowObjectCreationAPI [ 'useProperty' ] > > | undefined ;
308308
309309 @ShadowObject ( { registry, token : 'testUseProperties' } )
310310 class TestUseProperties {
311- constructor ( { useProperties} : ShadowObjectParams ) {
311+ constructor ( { useProperties} : ShadowObjectCreationAPI ) {
312312 capturedProps = useProperties ( { foo : 'propA' , bar : 'propB' } ) ;
313313 }
314314 }
@@ -334,19 +334,19 @@ describe('Kernel', () => {
334334 const kernel = new Kernel ( registry ) ;
335335
336336 const contextName = Symbol ( 'testContext' ) ;
337- let capturedContext : ReturnType < ShadowObjectParams [ 'useContext' ] > | undefined ;
337+ let capturedContext : ReturnType < ShadowObjectCreationAPI [ 'useContext' ] > | undefined ;
338338
339339 @ShadowObject ( { registry, token : 'parentProvider' } )
340340 class ParentProvider {
341- constructor ( { provideContext} : ShadowObjectParams ) {
341+ constructor ( { provideContext} : ShadowObjectCreationAPI ) {
342342 provideContext ( contextName , 'contextValue' ) ;
343343 }
344344 }
345345 expect ( ParentProvider ) . toBeDefined ( ) ;
346346
347347 @ShadowObject ( { registry, token : 'childConsumer' } )
348348 class ChildConsumer {
349- constructor ( { useContext} : ShadowObjectParams ) {
349+ constructor ( { useContext} : ShadowObjectCreationAPI ) {
350350 capturedContext = useContext ( contextName ) ;
351351 }
352352 }
@@ -373,19 +373,19 @@ describe('Kernel', () => {
373373
374374 const contextName = 'signalContext' ;
375375 const sourceSignal = createSignal ( 'initial' ) ;
376- let capturedContext : ReturnType < ShadowObjectParams [ 'useContext' ] > | undefined ;
376+ let capturedContext : ReturnType < ShadowObjectCreationAPI [ 'useContext' ] > | undefined ;
377377
378378 @ShadowObject ( { registry, token : 'signalProvider' } )
379379 class SignalProvider {
380- constructor ( { provideContext} : ShadowObjectParams ) {
380+ constructor ( { provideContext} : ShadowObjectCreationAPI ) {
381381 provideContext ( contextName , sourceSignal . get ) ;
382382 }
383383 }
384384 expect ( SignalProvider ) . toBeDefined ( ) ;
385385
386386 @ShadowObject ( { registry, token : 'signalConsumer' } )
387387 class SignalConsumer {
388- constructor ( { useContext} : ShadowObjectParams ) {
388+ constructor ( { useContext} : ShadowObjectCreationAPI ) {
389389 capturedContext = useContext ( contextName ) ;
390390 }
391391 }
@@ -411,12 +411,12 @@ describe('Kernel', () => {
411411 const registry = new Registry ( ) ;
412412 const kernel = new Kernel ( registry ) ;
413413
414- let ctx1 : ReturnType < ShadowObjectParams [ 'useContext' ] > | undefined ;
415- let ctx2 : ReturnType < ShadowObjectParams [ 'useContext' ] > | undefined ;
414+ let ctx1 : ReturnType < ShadowObjectCreationAPI [ 'useContext' ] > | undefined ;
415+ let ctx2 : ReturnType < ShadowObjectCreationAPI [ 'useContext' ] > | undefined ;
416416
417417 @ShadowObject ( { registry, token : 'testContextCache' } )
418418 class TestContextCache {
419- constructor ( { useContext} : ShadowObjectParams ) {
419+ constructor ( { useContext} : ShadowObjectCreationAPI ) {
420420 ctx1 = useContext ( 'myContext' ) ;
421421 ctx2 = useContext ( 'myContext' ) ;
422422 }
@@ -438,19 +438,19 @@ describe('Kernel', () => {
438438 const kernel = new Kernel ( registry ) ;
439439
440440 const contextName = 'parentOnlyContext' ;
441- let capturedParentContext : ReturnType < ShadowObjectParams [ 'useParentContext' ] > | undefined ;
441+ let capturedParentContext : ReturnType < ShadowObjectCreationAPI [ 'useParentContext' ] > | undefined ;
442442
443443 @ShadowObject ( { registry, token : 'parentCtxProvider' } )
444444 class ParentCtxProvider {
445- constructor ( { provideContext} : ShadowObjectParams ) {
445+ constructor ( { provideContext} : ShadowObjectCreationAPI ) {
446446 provideContext ( contextName , 'parentValue' ) ;
447447 }
448448 }
449449 expect ( ParentCtxProvider ) . toBeDefined ( ) ;
450450
451451 @ShadowObject ( { registry, token : 'childCtxConsumer' } )
452452 class ChildCtxConsumer {
453- constructor ( { useParentContext} : ShadowObjectParams ) {
453+ constructor ( { useParentContext} : ShadowObjectCreationAPI ) {
454454 capturedParentContext = useParentContext ( contextName ) ;
455455 }
456456 }
@@ -475,19 +475,19 @@ describe('Kernel', () => {
475475 const kernel = new Kernel ( registry ) ;
476476
477477 const globalCtxName = 'globalContext' ;
478- let capturedGlobalCtx : ReturnType < ShadowObjectParams [ 'useContext' ] > | undefined ;
478+ let capturedGlobalCtx : ReturnType < ShadowObjectCreationAPI [ 'useContext' ] > | undefined ;
479479
480480 @ShadowObject ( { registry, token : 'globalProvider' } )
481481 class GlobalProvider {
482- constructor ( { provideGlobalContext} : ShadowObjectParams ) {
482+ constructor ( { provideGlobalContext} : ShadowObjectCreationAPI ) {
483483 provideGlobalContext ( globalCtxName , 'globalValue' ) ;
484484 }
485485 }
486486 expect ( GlobalProvider ) . toBeDefined ( ) ;
487487
488488 @ShadowObject ( { registry, token : 'globalConsumer' } )
489489 class GlobalConsumer {
490- constructor ( { useContext} : ShadowObjectParams ) {
490+ constructor ( { useContext} : ShadowObjectCreationAPI ) {
491491 capturedGlobalCtx = useContext ( globalCtxName ) ;
492492 }
493493 }
@@ -512,19 +512,19 @@ describe('Kernel', () => {
512512
513513 const globalCtxName = 'globalSignalContext' ;
514514 const sourceSignal = createSignal ( 'globalInitial' ) ;
515- let capturedGlobalCtx : ReturnType < ShadowObjectParams [ 'useContext' ] > | undefined ;
515+ let capturedGlobalCtx : ReturnType < ShadowObjectCreationAPI [ 'useContext' ] > | undefined ;
516516
517517 @ShadowObject ( { registry, token : 'globalSignalProvider' } )
518518 class GlobalSignalProvider {
519- constructor ( { provideGlobalContext} : ShadowObjectParams ) {
519+ constructor ( { provideGlobalContext} : ShadowObjectCreationAPI ) {
520520 provideGlobalContext ( globalCtxName , sourceSignal . get ) ;
521521 }
522522 }
523523 expect ( GlobalSignalProvider ) . toBeDefined ( ) ;
524524
525525 @ShadowObject ( { registry, token : 'globalSignalConsumer' } )
526526 class GlobalSignalConsumer {
527- constructor ( { useContext} : ShadowObjectParams ) {
527+ constructor ( { useContext} : ShadowObjectCreationAPI ) {
528528 capturedGlobalCtx = useContext ( globalCtxName ) ;
529529 }
530530 }
@@ -559,7 +559,7 @@ describe('Kernel', () => {
559559
560560 @ShadowObject ( { registry, token : 'testResource' } )
561561 class TestResource {
562- constructor ( { createResource} : ShadowObjectParams ) {
562+ constructor ( { createResource} : ShadowObjectCreationAPI ) {
563563 resourceSignal = createResource ( createFn , cleanupFn ) ;
564564 }
565565 }
@@ -587,7 +587,7 @@ describe('Kernel', () => {
587587
588588 @ShadowObject ( { registry, token : 'testUndefinedResource' } )
589589 class TestUndefinedResource {
590- constructor ( { createResource} : ShadowObjectParams ) {
590+ constructor ( { createResource} : ShadowObjectCreationAPI ) {
591591 createResource ( createFn , cleanupFn ) ;
592592 }
593593 }
@@ -611,7 +611,7 @@ describe('Kernel', () => {
611611
612612 @ShadowObject ( { registry, token : 'testEffect' } )
613613 class TestEffect {
614- constructor ( { createEffect} : ShadowObjectParams ) {
614+ constructor ( { createEffect} : ShadowObjectCreationAPI ) {
615615 createEffect ( ( ) => {
616616 effectFn ( testSignal . get ( ) ) ;
617617 } ) ;
@@ -639,7 +639,7 @@ describe('Kernel', () => {
639639
640640 @ShadowObject ( { registry, token : 'testEffectDestroy' } )
641641 class TestEffectDestroy {
642- constructor ( { createEffect} : ShadowObjectParams ) {
642+ constructor ( { createEffect} : ShadowObjectCreationAPI ) {
643643 createEffect ( ( ) => {
644644 effectFn ( testSignal . get ( ) ) ;
645645 } ) ;
@@ -669,7 +669,7 @@ describe('Kernel', () => {
669669
670670 @ShadowObject ( { registry, token : 'testCreateSignal' } )
671671 class TestCreateSignal {
672- constructor ( { createSignal : cs } : ShadowObjectParams ) {
672+ constructor ( { createSignal : cs } : ShadowObjectCreationAPI ) {
673673 createdSignal = cs < string > ( 'initial' ) ;
674674 }
675675 }
@@ -695,7 +695,7 @@ describe('Kernel', () => {
695695
696696 @ShadowObject ( { registry, token : 'testSignalDestroy' } )
697697 class TestSignalDestroy {
698- constructor ( { createSignal : cs } : ShadowObjectParams ) {
698+ constructor ( { createSignal : cs } : ShadowObjectCreationAPI ) {
699699 createdSignal = cs < string > ( 'test' ) ;
700700 }
701701 }
@@ -724,7 +724,7 @@ describe('Kernel', () => {
724724
725725 @ShadowObject ( { registry, token : 'testMemo' } )
726726 class TestMemo {
727- constructor ( { createMemo} : ShadowObjectParams ) {
727+ constructor ( { createMemo} : ShadowObjectCreationAPI ) {
728728 memoReader = createMemo < number > ( ( ) => sourceSignal . get ( ) * 2 ) ;
729729 }
730730 }
@@ -753,7 +753,7 @@ describe('Kernel', () => {
753753
754754 @ShadowObject ( { registry, token : 'testOn' } )
755755 class TestOn {
756- constructor ( { on : subscribe } : ShadowObjectParams ) {
756+ constructor ( { on : subscribe } : ShadowObjectCreationAPI ) {
757757 subscribe ( emitter , 'testEvent' , eventHandler ) ;
758758 }
759759 }
@@ -783,7 +783,7 @@ describe('Kernel', () => {
783783
784784 @ShadowObject ( { registry, token : 'testOnce' } )
785785 class TestOnce {
786- constructor ( { once : subscribeOnce } : ShadowObjectParams ) {
786+ constructor ( { once : subscribeOnce } : ShadowObjectCreationAPI ) {
787787 subscribeOnce ( emitter , 'singleEvent' , eventHandler ) ;
788788 }
789789 }
@@ -812,7 +812,7 @@ describe('Kernel', () => {
812812
813813 @ShadowObject ( { registry, token : 'testOnceNoFire' } )
814814 class TestOnceNoFire {
815- constructor ( { once : subscribeOnce } : ShadowObjectParams ) {
815+ constructor ( { once : subscribeOnce } : ShadowObjectCreationAPI ) {
816816 subscribeOnce ( emitter , 'neverFiredEvent' , eventHandler ) ;
817817 }
818818 }
@@ -837,7 +837,7 @@ describe('Kernel', () => {
837837
838838 @ShadowObject ( { registry, token : 'testOnDestroy' } )
839839 class TestOnDestroy {
840- constructor ( { onDestroy : registerDestroy } : ShadowObjectParams ) {
840+ constructor ( { onDestroy : registerDestroy } : ShadowObjectCreationAPI ) {
841841 registerDestroy ( destroyCallback ) ;
842842 }
843843 }
@@ -861,7 +861,7 @@ describe('Kernel', () => {
861861
862862 @ShadowObject ( { registry, token : 'testMultipleOnDestroy' } )
863863 class TestMultipleOnDestroy {
864- constructor ( { onDestroy : registerDestroy } : ShadowObjectParams ) {
864+ constructor ( { onDestroy : registerDestroy } : ShadowObjectCreationAPI ) {
865865 registerDestroy ( ( ) => callOrder . push ( 1 ) ) ;
866866 registerDestroy ( ( ) => callOrder . push ( 2 ) ) ;
867867 registerDestroy ( ( ) => callOrder . push ( 3 ) ) ;
0 commit comments