11import { Children } from "@alloy-js/core/jsx-runtime" ;
22import { SourceFileScope } from "../../scopes/source-file.js" ;
3- import { Block , computed , SourceFile as CoreSourceFile , Scope , useBinder } from "@alloy-js/core" ;
3+ import { Block , computed , SourceFile as CoreSourceFile , Scope , Show , useBinder } from "@alloy-js/core" ;
44import {
55 useTypeSpecFormatOptions
66} from "../../contexts/format-options.js" ;
@@ -35,9 +35,8 @@ export interface SourceFileProps {
3535export function SourceFile ( props : SourceFileProps ) {
3636 const sourceFileScope = new SourceFileScope ( props . path ) ;
3737
38- const nsContext = useNamespaceContext ( ) ;
3938 const globalNs = getGlobalNamespace ( useBinder ( ) ) ;
40- const nsSymbol = props ?. namespace ?? ( nsContext ? nsContext . symbol : globalNs ) ;
39+ const nsSymbol = props ?. namespace ?? globalNs ;
4140
4241 const content = computed ( ( ) => (
4342 < NamespaceScopes symbol = { nsSymbol } > { props . children } </ NamespaceScopes >
@@ -52,26 +51,14 @@ export function SourceFile(props: SourceFileProps) {
5251 reference = { Reference }
5352 { ...options }
5453 >
55- < Scope value = { sourceFileScope } >
56- { nsSymbol === globalNs ?
57- content
58- : < >
59- namespace < NamespaceName symbol = { nsSymbol } />
60- { sourceFileScope . hasBlockNamespace ?
61- < >
62- { " " }
63- < Block > { content } </ Block >
64- </ >
65- :< >
66- ;< hbr />
67- < hbr />
68- { content }
69- </ >
70-
71- }
72- </ >
73- }
74- </ Scope >
54+ < Scope value = { sourceFileScope } >
55+ < Show when = { nsSymbol !== globalNs } >
56+ namespace < NamespaceName symbol = { nsSymbol } /> ;
57+ < hbr />
58+ < hbr />
59+ </ Show >
60+ { content }
61+ </ Scope >
7562 </ CoreSourceFile >
7663 ) ;
7764}
0 commit comments