diff --git a/utils/docs/template/publish.js b/utils/docs/template/publish.js index 2c3e756d848e0c..0f24f7e8953423 100644 --- a/utils/docs/template/publish.js +++ b/utils/docs/template/publish.js @@ -211,6 +211,16 @@ function buildSearchListForData() { kind: item.kind }; + // Add sub-category for TSL items to improve search + if ( category === 'TSL' && item.meta && item.meta.filename ) { + + const filename = item.meta.filename.replace( /\.js$/, '' ); + // Remove "Node" suffix if present + const subCategory = filename.replace( /Node$/, '' ); + entry.subCategory = subCategory; + + } + categories[ category ].push( entry ); } @@ -521,11 +531,13 @@ function buildGlobalsNav( globals, seen ) { if ( globals.length ) { - // TSL + // TSL - organize by sub-category based on file name - let tslNav = ''; + const tslBySubCategory = new Map(); - globals.forEach( ( { kind, longname, name, tags } ) => { + globals.forEach( ( item ) => { + + const { kind, longname, name, tags, meta } = item; if ( kind !== 'typedef' && ! hasOwnProp.call( seen, longname ) ) { @@ -533,7 +545,24 @@ function buildGlobalsNav( globals, seen ) { if ( hasTslTag ) { - tslNav += `\t\t\t\t\t\t
  • ${linkto( longname, name )}
  • \n`; + // Extract sub-category from file name + let subCategory = 'Other'; + + if ( meta && meta.filename ) { + + const filename = meta.filename.replace( /\.js$/, '' ); + // Remove "Node" suffix if present + subCategory = filename.replace( /Node$/, '' ); + + } + + if ( ! tslBySubCategory.has( subCategory ) ) { + + tslBySubCategory.set( subCategory, [] ); + + } + + tslBySubCategory.get( subCategory ).push( { longname, name } ); seen[ longname ] = true; @@ -543,10 +572,32 @@ function buildGlobalsNav( globals, seen ) { } ); - nav += '\t\t\t\t\t

    TSL

    \n'; - nav += '\t\t\t\t\t\n'; + if ( tslBySubCategory.size > 0 ) { + + nav += '\t\t\t\t\t

    TSL

    \n'; + + // Sort sub-categories alphabetically + const sortedSubCategories = new Map( [ ...tslBySubCategory.entries() ].sort() ); + + for ( const [ subCategory, items ] of sortedSubCategories ) { + + nav += `\t\t\t\t\t

    ${subCategory}

    \n`; + nav += '\t\t\t\t\t\n'; + + } + + } // Globals diff --git a/utils/docs/template/static/index.html b/utils/docs/template/static/index.html index c63cb20f07d9e7..d97740a44be9e6 100644 --- a/utils/docs/template/static/index.html +++ b/utils/docs/template/static/index.html @@ -327,7 +327,14 @@

    three.js

    for ( const item of items ) { // Match against combined category and title for multi-word searches - const searchText = category + ' ' + item.title; + // For TSL items, also include the sub-category in the search + let searchText = category + ' ' + item.title; + if ( item.subCategory ) { + + searchText = category + ' ' + item.subCategory + ' ' + item.title; + + } + if ( searchText.match( regExp ) ) { results.push( { ...item, category } ); @@ -354,7 +361,8 @@

    three.js

    grouped[ className ] = { class: null, members: [], - category: item.category + category: item.category, + subCategory: item.subCategory }; } @@ -421,42 +429,119 @@

    three.js

    const highlightedCategory = highlightMatch( category, highlightRegExp ); html += `

    ${highlightedCategory}

    `; - for ( const className in byCategory[ category ] ) { + // For TSL category, group by sub-category + if ( category === 'TSL' ) { + + const bySubCategory = {}; + + for ( const className in byCategory[ category ] ) { - const group = byCategory[ category ][ className ]; + const group = byCategory[ category ][ className ]; + const subCat = group.subCategory || 'Other'; - if ( group.class ) { + if ( ! bySubCategory[ subCat ] ) { - html += '
    '; - const selectedClass = group.class.hash === currentHash ? ' selected' : ''; - const highlightedName = highlightMatch( group.class.name, highlightRegExp ); - html += `${highlightedName}`; + bySubCategory[ subCat ] = {}; + + } + + bySubCategory[ subCat ][ className ] = group; } - if ( group.members.length > 0 ) { + // Sort sub-categories and render them + const sortedSubCategories = Object.keys( bySubCategory ).sort(); + + for ( const subCat of sortedSubCategories ) { + + const highlightedSubCat = highlightMatch( subCat, highlightRegExp ); + html += `

    ${highlightedSubCat}

    `; + + for ( const className in bySubCategory[ subCat ] ) { + + const group = bySubCategory[ subCat ][ className ]; + + if ( group.class ) { + + html += '
    '; + const selectedClass = group.class.hash === currentHash ? ' selected' : ''; + const highlightedName = highlightMatch( group.class.name, highlightRegExp ); + html += `${highlightedName}`; + + } + + if ( group.members.length > 0 ) { + + if ( ! group.class ) { + + html += '
    '; + html += `${className}`; + + } + + group.members.forEach( member => { + + const selectedClass = member.hash === currentHash ? ' selected' : ''; + const highlightedName = highlightMatch( member.name, highlightRegExp ); + const suffix = member.kind === 'function' ? '()' : ''; + html += `.${highlightedName}${suffix}`; + + } ); - if ( ! group.class ) { + } + + if ( group.class || group.members.length > 0 ) { + + html += '
    '; + + } + + } + + } + + } else { + + // Regular category rendering (Core, Addons, Global) + + for ( const className in byCategory[ category ] ) { + + const group = byCategory[ category ][ className ]; + + if ( group.class ) { html += '
    '; - html += `${className}`; + const selectedClass = group.class.hash === currentHash ? ' selected' : ''; + const highlightedName = highlightMatch( group.class.name, highlightRegExp ); + html += `${highlightedName}`; } - group.members.forEach( member => { + if ( group.members.length > 0 ) { - const selectedClass = member.hash === currentHash ? ' selected' : ''; - const highlightedName = highlightMatch( member.name, highlightRegExp ); - const suffix = member.kind === 'function' ? '()' : ''; - html += `.${highlightedName}${suffix}`; + if ( ! group.class ) { - } ); + html += '
    '; + html += `${className}`; - } + } + + group.members.forEach( member => { + + const selectedClass = member.hash === currentHash ? ' selected' : ''; + const highlightedName = highlightMatch( member.name, highlightRegExp ); + const suffix = member.kind === 'function' ? '()' : ''; + html += `.${highlightedName}${suffix}`; - if ( group.class || group.members.length > 0 ) { + } ); - html += '
    '; + } + + if ( group.class || group.members.length > 0 ) { + + html += '
    '; + + } } diff --git a/utils/docs/template/tmpl/container.tmpl b/utils/docs/template/tmpl/container.tmpl index 1b921c164cfc7a..d43772559568dd 100644 --- a/utils/docs/template/tmpl/container.tmpl +++ b/utils/docs/template/tmpl/container.tmpl @@ -92,14 +92,7 @@ return isTSLPage ? hasTslTag : !hasTslTag; }); } - if (members && members.length && members.forEach) { - ?> -

    Properties

    - - - - - +

    TSL Functions

    + +

    + + + + + + + +

    Properties

    + + +

    Methods

    - + - - - +

    Static Methods

    - + - - +
    -

    .

    +

    diff --git a/utils/docs/template/tmpl/method.tmpl b/utils/docs/template/tmpl/method.tmpl index 24308fe8f15e6f..f70a7048068d81 100644 --- a/utils/docs/template/tmpl/method.tmpl +++ b/utils/docs/template/tmpl/method.tmpl @@ -1,12 +1,13 @@

    Constructor

    -

    +