@@ -12,12 +12,13 @@ import {
12
12
import { NgtArgs } from '../directives/args' ;
13
13
import { getLocalState , prepare } from '../instance' ;
14
14
import { NGT_STORE , injectStore , provideStore } from '../store' ;
15
- import { NgtAnyRecord , NgtInstanceNode , NgtLocalState , NgtState } from '../types' ;
15
+ import { NgtAnyRecord , NgtLocalState , NgtState } from '../types' ;
16
16
import { applyProps } from '../utils/apply-props' ;
17
17
import { is } from '../utils/is' ;
18
- import { NgtSignalStore , signalStore } from '../utils/signal-store' ;
18
+ import { NgtSignalStore } from '../utils/signal-store' ;
19
19
import { NgtAnyConstructor , injectCatalogue } from './catalogue' ;
20
20
import {
21
+ DOM_PARENT ,
21
22
HTML ,
22
23
NON_ROOT ,
23
24
ROUTED_SCENE ,
@@ -122,23 +123,9 @@ export class NgtRenderer implements Renderer2 {
122
123
}
123
124
124
125
if ( name === SPECIAL_DOM_TAG . NGT_VALUE ) {
125
- const instanceStore = signalStore ( { parent : null , objects : [ ] , nonObjects : [ ] } ) ;
126
126
return createNode (
127
127
'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 } ) ,
142
129
this . document ,
143
130
) ;
144
131
}
@@ -182,8 +169,8 @@ export class NgtRenderer implements Renderer2 {
182
169
const comment = this . delegate . createComment ( value ) ;
183
170
184
171
// 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
187
174
comment [ SPECIAL_INTERNAL_ADD_COMMENT ] = ( node : NgtRendererNode | 'args' ) => {
188
175
if ( node === 'args' ) {
189
176
this . argsCommentNodes . push ( comment ) ;
@@ -205,8 +192,8 @@ export class NgtRenderer implements Renderer2 {
205
192
) {
206
193
addChild ( parent , newChild ) ;
207
194
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 ) ;
210
197
return ;
211
198
}
212
199
@@ -390,17 +377,20 @@ export class NgtRenderer implements Renderer2 {
390
377
const localState = getLocalState ( el ) ;
391
378
if ( localState ) localState . attach = paths ;
392
379
}
393
- } else if ( name === SPECIAL_PROPERTIES . RAW_VALUE ) {
380
+ } else {
394
381
// NOTE: coercion
395
382
let maybeCoerced : string | number | boolean = value ;
396
383
if ( maybeCoerced === '' || maybeCoerced === 'true' || maybeCoerced === 'false' ) {
397
384
maybeCoerced = maybeCoerced === 'true' || maybeCoerced === '' ;
398
385
} else if ( ! isNaN ( Number ( maybeCoerced ) ) ) {
399
386
maybeCoerced = Number ( maybeCoerced ) ;
400
387
}
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
+ }
404
394
}
405
395
406
396
return false ;
0 commit comments