pict 1.0.93 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pict.compatible.js +10 -4
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +10 -4
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +4 -4
- package/test/Pict_tests.js +1 -1
package/dist/pict.compatible.js
CHANGED
|
@@ -971,7 +971,7 @@ _this29.waterfall=libAsyncWaterfall;_this29.eachLimit=libAsyncEachLimit;return _
|
|
|
971
971
|
// Now that es6 gives us this, use the native thingy.
|
|
972
972
|
// Nevermind, the native thing is not stable enough across environments
|
|
973
973
|
// Basic shallow copy
|
|
974
|
-
_createClass2(FableServiceUtility,[{key:"extend",value:function extend(pDestinationObject){for(var i=0;i<(arguments.length<=1?0:arguments.length-1);i++){var tmpSourceObject=i+1<1||arguments.length<=i+1?undefined:arguments[i+1];var tmpObjectProperties=Object.keys(tmpSourceObject);for(var k=0;k<tmpObjectProperties.length;k++){pDestinationObject[tmpObjectProperties[k]]=tmpSourceObject[tmpObjectProperties[k]];}}return pDestinationObject;}// Underscore and lodash have a behavior, _.template, which compiles a
|
|
974
|
+
_createClass2(FableServiceUtility,[{key:"extend",value:function extend(pDestinationObject){for(var i=0;i<(arguments.length<=1?0:arguments.length-1);i++){var tmpSourceObject=i+1<1||arguments.length<=i+1?undefined:arguments[i+1];if(_typeof(tmpSourceObject)==='object'){var tmpObjectProperties=Object.keys(tmpSourceObject);for(var k=0;k<tmpObjectProperties.length;k++){pDestinationObject[tmpObjectProperties[k]]=tmpSourceObject[tmpObjectProperties[k]];}}}return pDestinationObject;}// Underscore and lodash have a behavior, _.template, which compiles a
|
|
975
975
|
// string-based template with code snippets into simple executable pieces,
|
|
976
976
|
// with the added twist of returning a precompiled function ready to go.
|
|
977
977
|
},{key:"template",value:function template(pTemplateText,pData){var tmpTemplate=this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Template');return tmpTemplate.buildTemplateFunction(pTemplateText,pData);}// Build a template function from a template hash, and, register it with the service provider
|
|
@@ -1741,9 +1741,13 @@ preDotState===0||// The (right-most) trimmed path component is exactly '..'
|
|
|
1741
1741
|
preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":77}],72:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictSettings={Name:'DefaultPictApplication',InitializeOnLoad:true,// The main "viewport" is the view that is used to host our application
|
|
1742
1742
|
MainViewportView:'Default-View',MainViewportRenderable:'Application-Default-View-Renderable',MainViewportDestinationAddress:'Application-Destination-Address',MainViewportDefaultDataAddress:'',// Whether or not we should automatically render the main viewport when appropriate
|
|
1743
1743
|
AutoRenderMainViewportView:false,Manifests:{},// The prefix to prepend on all template destination hashes
|
|
1744
|
-
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this34=_super20.call(this,pFable,tmpOptions,pServiceHash);_this34.serviceType='PictApplication'
|
|
1744
|
+
IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this34=_super20.call(this,pFable,tmpOptions,pServiceHash);_this34.serviceType='PictApplication';// Convenience and consistency naming
|
|
1745
|
+
_this34.pict=_this34.fable;// Wire in the essential Pict state
|
|
1746
|
+
_this34.AppData=_this34.fable.AppData;_this34.initializationFunctionSet=[];var tmpManifestKeys=Object.keys(_this34.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
|
|
1745
1747
|
var tmpManifestKey=tmpManifestKeys[i];_this34.fable.serviceManager.instantiateServiceProvider('Manifest',_this34.options.Manifests[tmpManifestKey],tmpManifestKey);}}if(_this34.options.InitializeOnLoad){return _possibleConstructorReturn(_this34,_this34.initialize());}if(_this34.options.AutoRenderMainViewportView){_this34.log.info("Pict Application ".concat(_this34.options.Name,"[").concat(_this34.UUID,"]::[").concat(_this34.Hash,"] beginning auto render of [").concat(_this34.options.MainViewportView,"::").concat(_this34.options.MainViewportRenderable,"]."));_this34.renderAsync(_this34.options.MainViewportView,_this34.options.MainViewportRenderable,_this34.options.MainViewportDestinationAddress,_this34.options.MainViewportDefaultDataAddress,function(){});}return _this34;}// TODO: do we need an asynchronous version of this?
|
|
1746
|
-
_createClass2(PictApplication,[{key:"solve",value:function solve(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] executing solve() function..."));return true;}},{key:"
|
|
1748
|
+
_createClass2(PictApplication,[{key:"solve",value:function solve(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] executing solve() function..."));return true;}},{key:"onBeforeInitialize",value:function onBeforeInitialize(){return true;}// Used for controls and the like to initialize their state
|
|
1749
|
+
},{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"onAfterInitialize",value:function onAfterInitialize(){return true;}},{key:"initialize",value:function initialize(){this.onBeforeInitialize();this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] beginning initialization..."));this.internalInitialize();this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] initialization complete."));this.onAfterInitialize();}},{key:"render",value:function render(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpView=typeof pViewHash==='string'?this.servicesMap.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.render(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress);}},{key:"renderAsync",value:function renderAsync(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var tmpView=typeof pViewHash==='string'?this.servicesMap.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback);}}]);return PictApplication;}(libFableServiceBase);module.exports=PictApplication;},{"fable-serviceproviderbase":33}],73:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:'DEFAULT',InitializeOnLoad:true,RenderOnLoad:false,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,PictView);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this35=_super21.call(this,pFable,tmpOptions,pServiceHash);_this35.serviceType='PictView';// Convenience and consistency naming
|
|
1750
|
+
_this35.pict=_this35.fable;// Wire in the essential Pict state
|
|
1747
1751
|
_this35.AppData=_this35.fable.AppData;// Load all templates from the array in the options
|
|
1748
1752
|
// Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
|
|
1749
1753
|
for(var i=0;i<_this35.options.Templates.length;i++){var tmpTemplate=_this35.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," options object.");}_this35.fable.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
|
|
@@ -1753,7 +1757,9 @@ for(var _i12=0;_i12<_this35.options.DefaultTemplates.length;_i12++){var tmpDefau
|
|
|
1753
1757
|
// They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
|
|
1754
1758
|
// The only parts that are necessary are Identifier and Template
|
|
1755
1759
|
// A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
|
|
1756
|
-
_this35.renderables={};for(var _i13=0;_i13<_this35.options.Renderables.length;_i13++){var tmpRenderable=_this35.options.Renderables[_i13];if(!tmpRenderable.hasOwnProperty('RenderableHash')||!tmpRenderable.hasOwnProperty('TemplateHash')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Renderable ").concat(_i13," in the options array."),tmpRenderable);}else{_this35.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}if(_this35.options.InitializeOnLoad){_this35.initialize();}if(_this35.options.RenderOnLoad){_this35.render(_this35.options.DefaultRenderable,_this35.options.DefaultDestinationAddress,_this35.options.DefaultTemplateRecordAddress);_this35.
|
|
1760
|
+
_this35.renderables={};for(var _i13=0;_i13<_this35.options.Renderables.length;_i13++){var tmpRenderable=_this35.options.Renderables[_i13];if(!tmpRenderable.hasOwnProperty('RenderableHash')||!tmpRenderable.hasOwnProperty('TemplateHash')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Renderable ").concat(_i13," in the options array."),tmpRenderable);}else{_this35.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}if(_this35.options.InitializeOnLoad){_this35.initialize();}if(_this35.options.RenderOnLoad){_this35.onBeforeInitialRender();_this35.render(_this35.options.DefaultRenderable,_this35.options.DefaultDestinationAddress,_this35.options.DefaultTemplateRecordAddress);_this35.onAfterInitialRender();}return _this35;}_createClass2(PictView,[{key:"onBeforeInitialize",value:function onBeforeInitialize(){return true;}// Used for controls and the like to initialize their state
|
|
1761
|
+
},{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"onAfterInitialize",value:function onAfterInitialize(){return true;}},{key:"initialize",value:function initialize(){this.onBeforeInitialize();// Potentially do something with the return values of these?
|
|
1762
|
+
this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));this.internalInitialize();this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization complete."));this.onAfterInitialRender();}},{key:"onBeforeInitialRender",value:function onBeforeInitialRender(){return true;}},{key:"onBeforeRender",value:function onBeforeRender(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){return true;}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;this.onBeforeRender(pRenderable,tmpRenderDestinationAddress,tmpDataAddress);var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;var tmpContent=this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData);this.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);return this.onAfterRender(pRenderable,tmpRenderDestinationAddress,tmpDataAddress);}},{key:"onAfterRender",value:function onAfterRender(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){return true;}},{key:"onAfterInitialRender",value:function onAfterInitialRender(){return true;}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this36=this;var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable.")));}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return fCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this36.log.error("PictView [".concat(_this36.UUID,"]::[").concat(_this36.Hash,"] ").concat(_this36.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it did not parse the template."),pError);return fCallback(pError);}_this36.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);return fCallback(null,pContent);});}}]);return PictView;}(libFableServiceBase);module.exports=PictView;},{"fable-serviceproviderbase":33}],74:[function(require,module,exports){/**
|
|
1757
1763
|
* Precedent Meta-Templating
|
|
1758
1764
|
*
|
|
1759
1765
|
* @license MIT
|