@@ -12,12 +12,13 @@ import {
1212import { NgtArgs } from '../directives/args' ;
1313import { getLocalState , prepare } from '../instance' ;
1414import { NGT_STORE , injectStore , provideStore } from '../store' ;
15- import { NgtAnyRecord , NgtInstanceNode , NgtLocalState , NgtState } from '../types' ;
15+ import { NgtAnyRecord , NgtLocalState , NgtState } from '../types' ;
1616import { applyProps } from '../utils/apply-props' ;
1717import { is } from '../utils/is' ;
18- import { NgtSignalStore , signalStore } from '../utils/signal-store' ;
18+ import { NgtSignalStore } from '../utils/signal-store' ;
1919import { NgtAnyConstructor , injectCatalogue } from './catalogue' ;
2020import {
21+ DOM_PARENT ,
2122 HTML ,
2223 NON_ROOT ,
2324 ROUTED_SCENE ,
@@ -122,23 +123,9 @@ export class NgtRenderer implements Renderer2 {
122123 }
123124
124125 if ( name === SPECIAL_DOM_TAG . NGT_VALUE ) {
125- const instanceStore = signalStore ( { parent : null , objects : [ ] , nonObjects : [ ] } ) ;
126126 return createNode (
127127 'three' ,
128- Object . assign (
129- { __ngt_renderer__ : { rawValue : undefined } } ,
130- // NOTE: we assign this manually to a raw value node
131- // because we say it is a 'three' node but we're not using prepare()
132- {
133- __ngt__ : {
134- isRaw : true ,
135- instanceStore,
136- setParent ( parent : NgtInstanceNode ) {
137- instanceStore . update ( { parent } ) ;
138- } ,
139- } ,
140- } ,
141- ) ,
128+ prepare ( { __ngt_renderer__ : { rawValue : undefined } } , { store : this . rootStore , isRaw : true } ) ,
142129 this . document ,
143130 ) ;
144131 }
@@ -182,8 +169,8 @@ export class NgtRenderer implements Renderer2 {
182169 const comment = this . delegate . createComment ( value ) ;
183170
184171 // NOTE: we attach an arrow function to the Comment node
185- // In our directives, we can call this function to then start tracking the RendererNode
186- // this is done to limit the amount of Nodes we need to process for getCreationState
172+ // In our directives, we can call this function to then start tracking the RendererNode
173+ // this is done to limit the amount of Nodes we need to process for getCreationState
187174 comment [ SPECIAL_INTERNAL_ADD_COMMENT ] = ( node : NgtRendererNode | 'args' ) => {
188175 if ( node === 'args' ) {
189176 this . argsCommentNodes . push ( comment ) ;
@@ -205,8 +192,8 @@ export class NgtRenderer implements Renderer2 {
205192 ) {
206193 addChild ( parent , newChild ) ;
207194
208- if ( newChild [ '__ngt_dom_parent__' ] && newChild [ '__ngt_dom_parent__' ] instanceof HTMLElement ) {
209- this . delegate . appendChild ( newChild [ '__ngt_dom_parent__' ] , newChild ) ;
195+ if ( newChild [ DOM_PARENT ] && newChild [ DOM_PARENT ] instanceof HTMLElement ) {
196+ this . delegate . appendChild ( newChild [ DOM_PARENT ] , newChild ) ;
210197 return ;
211198 }
212199
@@ -390,17 +377,20 @@ export class NgtRenderer implements Renderer2 {
390377 const localState = getLocalState ( el ) ;
391378 if ( localState ) localState . attach = paths ;
392379 }
393- } else if ( name === SPECIAL_PROPERTIES . RAW_VALUE ) {
380+ } else {
394381 // NOTE: coercion
395382 let maybeCoerced : string | number | boolean = value ;
396383 if ( maybeCoerced === '' || maybeCoerced === 'true' || maybeCoerced === 'false' ) {
397384 maybeCoerced = maybeCoerced === 'true' || maybeCoerced === '' ;
398385 } else if ( ! isNaN ( Number ( maybeCoerced ) ) ) {
399386 maybeCoerced = Number ( maybeCoerced ) ;
400387 }
401- rS [ NgtRendererClassId . rawValue ] = maybeCoerced ;
402- } else {
403- applyProps ( el , { [ name ] : value } ) ;
388+
389+ if ( name === SPECIAL_PROPERTIES . RAW_VALUE ) {
390+ rS [ NgtRendererClassId . rawValue ] = maybeCoerced ;
391+ } else {
392+ applyProps ( el , { [ name ] : maybeCoerced } ) ;
393+ }
404394 }
405395
406396 return false ;
0 commit comments