@ -330,15 +330,38 @@ class Component extends StyleAndScriptStoringComponent {
* for error tracking .
* /
if ( extStore . _ type === ExtStoreType . INTERNALIZED_WITHIN ) {
let sizings = Object . keys ( this . _ modifier . _ modifications )
. filter ( e => e . includes ( "width" ) || e . includes ( "height" ) )
. filter ( e => this . _ modifier . _ modifications [ e ] . includes ( "calc" ) )
. reduce ( ( a , c ) => a . add (
c ,
this . _ modifier
. _ modifications [ c ]
. split ( '(' ) [ 1 ]
. split ( ' - ' ) [ 0 ]
) , new ObjectAccessObject ( ) ) ;
fillAttrsInContainerByCb (
this . _ modifier . _ modifications ,
this . _ element ,
( key , val , el ) => { el . style [ key ] = val ; }
) ;
let hasElSizing = sizings . keys . some ( k => Object . keys ( this . _ element . style ) . includes ( k ) ) ;
if ( sizings . keys . length > 0 && ! hasElSizing ) {
console . log ( "Fixing sizing - because not supported 'calc'" , sizings ) ;
fillAttrsInContainerByCb (
sizings ,
this . _ element ,
( key , val , el ) => { el . style [ key ] = val ; }
) ;
}
} else {
/* ADDS ELEMENT MODIFIER TO this._styles list for styles processing */
let modifierSSD = new SStoreDefinition ( ) ;
modifierSSD . _ identifier = this . _ compName ;
modifierSSD . _ identifier = "." + this . _ compName ;
modifierSSD . _ definition = this . _ modifier . _ modifications ;
modifierSSD . _ extStore = extStore ;
this . _ styles . unshift ( modifierSSD ) ;
@ -372,16 +395,8 @@ class Component extends StyleAndScriptStoringComponent {
break ;
case ExtStoreType . INDIVIDUALLY_DOC_HEAD :
let container = document . createElement ( "style" ) ;
let container = generateAndFillStyleTag ( [ ssd ] ) ;
container . setAttribute ( "data-compel-individually-nr" , counter ++ ) ;
let styleRules = Object . keys ( ssd . _ definition ) ;
for ( let j = 0 ; j < styleRules . length ; j ++ ) {
let rule = styleRules [ j ] ;
container . innerText += ` ${ rule } { ${ ssd . _ definition [ rule ] } } ` ;
}
Page . addElementToPage ( container , refESType ) ;
break ;
@ -476,6 +491,7 @@ class Component extends StyleAndScriptStoringComponent {
this . _ wenity = new WebTrinity ( ) ;
/* DEAL WITH COMPONENT MODIFICATION FIRST */
this . _ modifier . _ modifications [ "box-sizing" ] = "border-box" ;
this . _ modifier . _ modifications [ "justify-content" ] = this . _ arrangement ;
this . _ modifier . _ modifications [ "align-content" ] = this . _ alignment ;
this . _ modifier . _ modifications [ "align-items" ] = this . _ alignment ;
@ -494,7 +510,9 @@ class Component extends StyleAndScriptStoringComponent {
child = child . toComponent ( ) ;
}
child . _ modifier . _ updateDimensionsBy ( this . _ modifier . _ paddingValues ) ;
if ( Page . _ useCssCalc ) {
child . _ modifier . _ updateDimensionsBy ( this . _ modifier . _ paddingValues ) ;
}
child = child . generate ( ) ;
let wenity = this . _ appendChildComponent ( child ) ;
@ -513,10 +531,66 @@ class Component extends StyleAndScriptStoringComponent {
* /
const funcCollections = this . _ processFunctions ( functionStore ) ;
/ * *
*
* @ param { Map < ExtStoreType , Array < SStoreDefinition >> } source
* @ param { Map < ExtStoreType , Array < SStoreDefinition >> } target
* @ param { ExtStoreType } extStoreType
* @ returns
* /
function transferCollectedFunctions ( source , target , extStoreType ) {
if ( source ) {
if ( source . has ( extStoreType ) ) {
if ( funcCollections . has ( extStoreType ) ) {
target . get ( extStoreType )
. push ( source . get ( extStoreType ) )
} else {
target . set (
extStoreType ,
source . get ( extStoreType )
) ;
}
}
}
return target ;
}
function executeOnExtStoreTypeCollectedTriple ( func ) {
return new Map ( [
{ [ ExtStoreType . COLLECTED_SEGMENT_BEGIN ] : func ( ExtStoreType . COLLECTED_SEGMENT_BEGIN ) } ,
{ [ ExtStoreType . COLLECTED_DOC_HEAD ] : func ( ExtStoreType . COLLECTED_DOC_HEAD ) } ,
{ [ ExtStoreType . COLLECTED_DOC_FOOTER ] : func ( ExtStoreType . COLLECTED_DOC_FOOTER ) }
] ) ;
}
for ( let i = 0 ; i < collectedWenities . length ; i ++ ) {
const child = collectedWenities [ i ] ;
if ( child . js ) {
executeOnExtStoreTypeCollectedTriple (
( extstoretype ) => transferCollectedFunctions ( child . js , funcCollections , extstoretype )
) ;
}
}
if ( this . # isCompel ) {
funcCollections . get ( ExtStoreType . COLLECTED_DOC_FOOTER )
funcCollections . get ( ExtStoreType . COLLECTED_DOC_HEAD )
funcCollections . get ( ExtStoreType . COLLECTED_SEGMENT_BEGIN )
function dealCollected ( map , extStoreType ) {
if ( map . has ( extStoreType ) ) {
let collectionScriptTag = generateAndFillScriptTag ( map . get ( extStoreType ) ) ;
if ( extStoreType === ExtStoreType . COLLECTED_SEGMENT_BEGIN ) {
this . _ element . insertAdjacentElement (
"afterbegin" ,
generateAndFillScriptTag ( segment )
) ;
} else {
Page . addElementToPage (
collectionScriptTag ,
extStoreType
) ;
}
}
}
executeOnExtStoreTypeCollectedTriple ( ( est ) => dealCollected ( funcCollections , est ) ) ;
} else {
this . _ wenity . js = funcCollections ;
this . _ wenity . css = styleCollection ;