@@ -239,7 +239,8 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
239239 * Which dasha endpoint fed this element. `sub`, `antara` and `sookshma` are the
240240 * three drill-down levels and render identically; they stay distinct because
241241 * each maps one-to-one onto its endpoint binding, which is what lets a widget
242- * pick a level. The LABELS come from the payload, not from here.
242+ * pick a level. The heading and the level LABELS come from the payload, not
243+ * from here, so a host that cannot set attributes still renders correctly.
243244 */
244245 @property ( { type : String , reflect : true } )
245246 period : 'current' | 'major' | 'sub' | 'antara' | 'sookshma' = 'current' ;
@@ -248,11 +249,6 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
248249 @state ( )
249250 private view : 'timeline' | 'readings' | 'frame' = 'timeline' ;
250251
251- /** True for any of the drill-down levels, which share one layout. */
252- private get isDrillDown ( ) : boolean {
253- return this . period !== 'current' && this . period !== 'major' ;
254- }
255-
256252 protected renderEmpty ( ) {
257253 return html `< div class ="roxy-empty " role ="status "> No dasha data</ div > ` ;
258254 }
@@ -412,16 +408,25 @@ export class RoxyDashaTimeline extends RoxyDataElement<DashaData> {
412408 </ dl > ` ;
413409 }
414410
411+ /**
412+ * Heading, decided by the PAYLOAD first and the `period` attribute only as a
413+ * tie-break.
414+ *
415+ * Not every host can set the attribute. The WordPress plugin maps an
416+ * operationId to a bare component tag with no attrs, so every dasha shortcode
417+ * arrives with the default `period="current"`; keying off the attribute alone
418+ * titled an antardasha list "Active dashas" there. A drill-down response is
419+ * self-identifying (it carries a parent period), so the markup does not need
420+ * to be told.
421+ */
415422 private heading ( d : DashaData ) : string {
416- if ( this . period === 'major' ) return 'Vimshottari Mahadasha' ;
417- if ( this . isDrillDown ) {
418- const parent = parentOf ( d ) ;
419- const level = levelOf ( d ) ;
420- return parent
421- ? `${ level } s in ${ parent . period . planet } ${ parent . label } `
422- : `${ level } s` ;
423+ const parent = parentOf ( d ) ;
424+ if ( parent ) {
425+ return `${ levelOf ( d ) } s in ${ parent . period . planet } ${ parent . label } ` ;
423426 }
424- return 'Active dashas' ;
427+ if ( 'mahadashas' in d ) return 'Vimshottari Mahadasha' ;
428+ if ( 'mahadasha' in d ) return 'Active dashas' ;
429+ return this . period === 'major' ? 'Vimshottari Mahadasha' : 'Active dashas' ;
425430 }
426431
427432 /**
0 commit comments