Comparing version 1.0.79 to 1.0.80
{ | ||
"name": "pict", | ||
"version": "1.0.79", | ||
"version": "1.0.80", | ||
"description": "Pict browser library.", | ||
@@ -50,4 +50,4 @@ "main": "source/Pict.js", | ||
"cachetrax": "^1.0.3", | ||
"fable": "^3.0.55" | ||
"fable": "^3.0.56" | ||
} | ||
} |
@@ -29,17 +29,15 @@ /** | ||
this.serviceManager.extraServiceInitialization = (pService) => | ||
{ | ||
// Decorate services with pict so we can use that instead of fable to eliminate confusion | ||
pService.pict = this; | ||
return pService; | ||
} | ||
// Log noisness goes from 0 - 5, where 5 is show me everything. | ||
this.LogNoisiness = 0; | ||
if (typeof(this.settings.Manifests) == 'object') | ||
// Load manifest sets | ||
if (this.settings.Manifests) | ||
{ | ||
let tmpManifestKeys = Object.keys(this.settings.Manifests); | ||
if (tmpManifestKeys.length > 0) | ||
{ | ||
for (let i = 0; i < tmpManifestKeys.length; i++ ) | ||
{ | ||
// Load each manifest | ||
let tmpManifestKey = tmpManifestKeys[i]; | ||
this.serviceManager.instantiateServiceProvider('Manifest', this.settings.Manifests[tmpManifestKey], tmpManifestKey); | ||
} | ||
} | ||
this.loadManifestSet(this.settings.Manifests); | ||
} | ||
@@ -54,2 +52,22 @@ | ||
// Load manifests in as Hashed services | ||
loadManifestSet (pManifestSet) | ||
{ | ||
if (typeof(pManifestSet) != 'object') | ||
{ | ||
this.log.warn(`PICT [${this.UUID}] could not load Manifest Set; pManifestSet was not an object.`); | ||
return false; | ||
} | ||
let tmpManifestKeys = Object.keys(pManifestSet.Manifests); | ||
if (tmpManifestKeys.length > 0) | ||
{ | ||
for (let i = 0; i < tmpManifestKeys.length; i++ ) | ||
{ | ||
// Load each manifest | ||
let tmpManifestKey = tmpManifestKeys[i]; | ||
this.serviceManager.instantiateServiceProvider('Manifest', pManifestSet[tmpManifestKey], tmpManifestKey); | ||
} | ||
} | ||
} | ||
// Just passing an options will construct one for us. | ||
@@ -113,2 +131,10 @@ // Passing a hash will set the hash. | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fEntityRender]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 0) | ||
{ | ||
this.log.trace(`PICT Template [fEntityRender]::[${tmpHash}]`); | ||
} | ||
@@ -187,2 +213,12 @@ let tmpEntity = false; | ||
let tmpData = (typeof(pData) === 'object') ? pData : {}; | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fNotEmptyRender]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 2) | ||
{ | ||
this.log.trace(`PICT Template [fNotEmptyRender]::[${tmpHash}]`); | ||
} | ||
// Should switch this to indexOf so pipes can be in the content. | ||
@@ -210,2 +246,11 @@ let tmpHashParts = tmpHash.split('|'); | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fTemplateRender]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 0) | ||
{ | ||
this.log.trace(`PICT Template [fTemplateRender]::[${tmpHash}]`); | ||
} | ||
let tmpTemplateHash = false; | ||
@@ -252,2 +297,11 @@ let tmpAddressOfData = false; | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fTemplateSetRender]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 0) | ||
{ | ||
this.log.trace(`PICT Template [fTemplateSetRender]::[${tmpHash}]`); | ||
} | ||
let tmpTemplateHash = false; | ||
@@ -293,2 +347,12 @@ let tmpAddressOfData = false; | ||
let tmpData = (typeof(pData) === 'object') ? pData : {}; | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fDataRender]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`PICT Template [fDataRender]::[${tmpHash}]`); | ||
} | ||
let tmpValue = this.manifest.getValueByHash({AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash); | ||
@@ -309,2 +373,12 @@ if ((tmpValue == null) || (tmpValue == 'undefined') || (typeof(tmpValue) == 'undefined')) | ||
let tmpData = (typeof(pData) === 'object') ? pData : {}; | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fDollars]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`PICT Template [fDollars]::[${tmpHash}]`); | ||
} | ||
let tmpColumnData = this.manifest.getValueByHash({AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash); | ||
@@ -318,2 +392,12 @@ return this.defaultServices.DataFormat.formatterDollars(tmpColumnData); | ||
let tmpData = (typeof(pData) === 'object') ? pData : {}; | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fDigits]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`PICT Template [fDigits]::[${tmpHash}]`); | ||
} | ||
let tmpColumnData = this.manifest.getValueByHash({AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash); | ||
@@ -327,2 +411,7 @@ return this.defaultServices.DataFormat.formatterAddCommasToNumber(this.defaultServices.DataFormat.formatterRoundNumber(tmpColumnData, 2)); | ||
if (this.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`PICT Template [fRandomNumberString]::[${tmpHash}]`); | ||
} | ||
let tmpStringLength = 4; | ||
@@ -349,3 +438,32 @@ let tmpMaxNumber = 9999; | ||
let fRandomNumber = (pHash, pData)=> | ||
{ | ||
let tmpHash = pHash.trim(); | ||
if (this.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`PICT Template [fRandomNumber]::[${tmpHash}]`); | ||
} | ||
let tmpMinimumNumber = 0; | ||
let tmpMaxNumber = 9999999; | ||
if (tmpHash.length > 0) | ||
{ | ||
let tmpHashParts = tmpHash.split(','); | ||
if (tmpHashParts.length > 0) | ||
{ | ||
tmpMinimumNumber = parseInt(tmpHashParts[0]); | ||
} | ||
if (tmpHashParts.length > 1) | ||
{ | ||
tmpMaxNumber = parseInt(tmpHashParts[1]); | ||
} | ||
} | ||
return this.defaultServices.DataGeneration.randomIntegerBetween(tmpMinimumNumber, tmpMaxNumber); | ||
}; | ||
this.defaultServices.MetaTemplate.addPattern('{~RandomNumber:', '~}',fRandomNumber); | ||
this.defaultServices.MetaTemplate.addPattern('{~RN:', '~}',fRandomNumber); | ||
let fPascalCaseIdentifier = (pHash, pData)=> | ||
@@ -355,2 +473,12 @@ { | ||
let tmpData = (typeof(pData) === 'object') ? pData : {}; | ||
if (this.LogNoisiness > 4) | ||
{ | ||
this.log.trace(`PICT Template [fPascalCaseIdentifier]::[${tmpHash}] with tmpData:`, tmpData); | ||
} | ||
else if (this.LogNoisiness > 3) | ||
{ | ||
this.log.trace(`PICT Template [fPascalCaseIdentifier]::[${tmpHash}]`); | ||
} | ||
let tmpValue = this.manifest.getValueByHash({AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash); | ||
@@ -365,2 +493,46 @@ if ((tmpValue == null) || (tmpValue == 'undefined') || (typeof(tmpValue) == 'undefined')) | ||
let fLogValue = (pHash, pData)=> | ||
{ | ||
let tmpHash = pHash.trim(); | ||
let tmpData = (typeof(pData) === 'object') ? pData : {}; | ||
let tmpValue = this.manifest.getValueByHash({AppData:this.AppData, Bundle:this.Bundle, Record:tmpData}, tmpHash); | ||
let tmpValueType = typeof(tmpValue); | ||
if ((tmpValue == null) || (tmpValueType == 'undefined')) | ||
{ | ||
this.log.trace(`PICT Template Log Value: [${tmpHash}] is ${tmpValueType}.`); | ||
} | ||
else if (tmpValueType == 'object') | ||
{ | ||
this.log.trace(`PICT Template Log Value: [${tmpHash}] is an obect.`, tmpValue); | ||
} | ||
else | ||
{ | ||
this.log.trace(`PICT Template Log Value: [${tmpHash}] if a ${tmpValueType} = [${tmpValue}]`); | ||
} | ||
return ''; | ||
}; | ||
this.defaultServices.MetaTemplate.addPattern('{~LogValue:', '~}',fLogValue); | ||
this.defaultServices.MetaTemplate.addPattern('{~LV:', '~}',fLogValue); | ||
let fLogStatement = (pHash, pData)=> | ||
{ | ||
let tmpHash = pHash.trim(); | ||
this.log.trace(`PICT Template Log Message: ${tmpHash}`); | ||
return ''; | ||
}; | ||
this.defaultServices.MetaTemplate.addPattern('{~LogStatement:', '~}',fLogStatement); | ||
this.defaultServices.MetaTemplate.addPattern('{~LS:', '~}',fLogStatement); | ||
let fBreakpoint = (pHash, pData)=> | ||
{ | ||
let tmpHash = pHash.trim(); | ||
let tmpError = new Error(`PICT Template Breakpoint: ${tmpHash}`); | ||
this.log.trace(`PICT Template Breakpoint: ${tmpHash}`, tmpError.stack); | ||
debugger; | ||
return ''; | ||
}; | ||
this.defaultServices.MetaTemplate.addPattern('{~Breakpoint', '~}',fBreakpoint); | ||
this._DefaultPictTemplatesInitialized = true; | ||
@@ -367,0 +539,0 @@ } |
@@ -269,2 +269,4 @@ /** | ||
testPict.LogNoisiness = 4; | ||
testPict.TemplateProvider.addTemplate('Choco-Row', '<p>{~Data:Record.name~} is a file of {~Data:Record.size~} bytes big.</p>'); | ||
@@ -271,0 +273,0 @@ testPict.TemplateProvider.addTemplate('Choco-Screen', '<h1>{~D:AppData.Title~}</h1>{~TS:Choco-Row:AppData.Records.files~}'); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9232995
32465
Updatedfable@^3.0.56