cavalion-blocks
Advanced tools
Comparing version 0.8.9 to 0.9.1
@@ -1,2 +0,13 @@ | ||
### 2019-01-07 (1.8.8) | ||
### 2019-02-18 - 0.9.1 | ||
- Made improvements in order to instantiate from console command line | ||
### 2019-02-11 | ||
- Introducing Console | ||
- The default namespace != root namespace (/List != List) | ||
### 2019-01-21 (0.8.9) | ||
- How about a Framework7 abstraction in Blocks? | ||
- Introducing @namespaces support in source file | ||
### 2019-01-07 (0.8.8) | ||
- Pushing for server2 | ||
@@ -7,2 +18,5 @@ | ||
### 2018-12 - 0.8.5 | ||
- Fixing some issues for usage in JavaScript build of cavalion-code | ||
### 2018-09-15 - 0.8.4 | ||
@@ -9,0 +23,0 @@ - Fixing some issues for usage in v7-maps |
{ | ||
"name": "cavalion-blocks", | ||
"version": "0.8.9", | ||
"version": "0.9.1", | ||
"description": "`blocks-dot-js` `[].js`", | ||
@@ -5,0 +5,0 @@ "main": "README.js", |
@@ -93,4 +93,4 @@ | ||
/*- this/local --- I --- global/that | ||
inner -------- I --------- outer | ||
/*- this/local --- I --- global/universe | ||
inner -------- I ------------- outer | ||
@@ -97,0 +97,0 @@ So (local) versus (global), but wtf is "I" doing there in the middle? |
@@ -12,3 +12,3 @@ # [ B L O C K S ] | ||
* to persist the structure (routes, models, translations, ...) of the app as meta data for the app itself | ||
* to reboot/refresh cavalion-vcl, remove dead wood (or at least hide it to evolve with a clean slate) | ||
* to reboot/refresh a context, without worrying about details in (or _at the level of_) cavalion-vcl, well, at least hide or abstract them away in a new API | ||
* focus soley on the native-JS like way of doing this | ||
@@ -132,3 +132,4 @@ * Object.create, real properties -and all- | ||
BLOCKS loaded should pass-on inherited loaded | ||
---- | ||
@@ -348,3 +348,3 @@ define(function(require) { | ||
var factory = new Factory(require, uri || "<inline>", sourceUri, false); | ||
var factory = new Factory(require, uri || "", sourceUri, false); | ||
var p = new Promise(function(resolve, reject) { | ||
@@ -354,3 +354,3 @@ factory.load(source, function() { | ||
try { | ||
resolve(factory.newInstance()); | ||
resolve(factory.newInstance(/* owner, uri, options */)); | ||
} catch(e) { | ||
@@ -357,0 +357,0 @@ reject(e); |
@@ -68,3 +68,4 @@ define(function(require) { | ||
} | ||
function getClassName(className) { | ||
function getClassName(className, namespaces) { | ||
var root_ns = namespaces.def || ""; | ||
if(className.indexOf(":") !== -1) { | ||
@@ -79,6 +80,7 @@ className = className.split(":"); | ||
} | ||
className = String.format("%s/%s", | ||
namespaces[className[0]], className[1]); | ||
return String.format("%s/%s", namespaces[className[0]], className[1]); | ||
} else if(className.charAt(0) === '/' || root_ns === "") { | ||
return className; | ||
} | ||
return className; | ||
return root_ns + "/" + className; | ||
} | ||
@@ -98,2 +100,3 @@ function getFactoryUri(name) { | ||
constructor: function(parentRequire, uri, sourceUri, setIsRoot) { | ||
console.log("new Factory(): " + uri + " " + sourceUri); | ||
this._parentRequire = parentRequire; | ||
@@ -162,5 +165,9 @@ this._uri = uri; | ||
var require = me._parentRequire; | ||
// var namespaces = js.mixIn(Blocks.DEFAULT_NAMESPACES); | ||
/*- Parse the source into a JS structure */ | ||
var tree = parse(source, me._uri, js.normalize); | ||
/*- Make sure there is always something to require */ | ||
@@ -179,11 +186,12 @@ tree.factories.push("module"); | ||
/*- namespace support */ | ||
var ns = tree.root.properties['@namespaces']; | ||
var ns = tree.root.properties['@namespaces'] || (function() { | ||
var r = tree.root.properties._ns; | ||
delete tree.root.properties._ns; | ||
return r; | ||
}()); | ||
if(typeof ns === "string") { | ||
ns = js.str2obj(ns); | ||
} | ||
if(ns !== undefined) { | ||
js.mixIn(namespaces, tree.root.properties['@namespaces']); | ||
} | ||
tree.classes.forEach(function(className, index) { | ||
tree.classes[index] = getClassName(className); | ||
tree.classes[index] = getClassName(className, namespaces); | ||
}); | ||
@@ -213,3 +221,3 @@ | ||
if(typeof node.className === "string") { | ||
node.ctor = require(getClassName(node.className)); | ||
node.ctor = require(getClassName(node.className, namespaces)); | ||
} else if(node.inherits instanceof Array) { | ||
@@ -242,2 +250,3 @@ node.factories = []; | ||
newInstance: function(owner, uri, options) { | ||
console.log(String.format("Factory.newInstance(%n, %s, %s)", owner, uri, options), arguments); | ||
/*- Instantiates the component based upon the structure parsed */ | ||
@@ -292,3 +301,5 @@ var component; | ||
if(ref.property.isReference()) { | ||
if(ref.value && (ref.value.charAt(0) === "#")) { | ||
if(ref.value instanceof Component) { | ||
v = ref.value; | ||
} else if(ref.value && (ref.value.charAt(0) === "#")) { | ||
v = component.qs(ref.value); | ||
@@ -369,14 +380,18 @@ } else { | ||
component.setUri(node.uri || me._uri); | ||
me.apply(root, component, node, [], fixUps); | ||
} else { | ||
root.qsa("#" + node.name).map(function(component) { | ||
me.apply(root, component, node, [], fixUps); | ||
}); | ||
// First check the current scope (parent) | ||
if((component = parent.getScope()[node.name]) === undefined) { | ||
component = root.findComponent(node.name); | ||
} | ||
if(component === null) { | ||
console.warn(String.format("Inherited component %s not found (%s)", node.name, me._uri)); | ||
return; | ||
} | ||
// if((component = parent.getScope()[node.name]) === undefined) { | ||
// component = root.findComponent(node.name); | ||
// } | ||
// if(component === null) { | ||
// console.warn(String.format("Inherited component %s not found (%s)", node.name, me._uri)); | ||
// return; | ||
// } | ||
// console.log(node.name); | ||
} | ||
me.apply(root, component, node, [], fixUps); | ||
}); | ||
@@ -587,3 +602,3 @@ }, | ||
var ocallback = callback; | ||
if(ocallback && typeof name === "string") { | ||
if(callback && typeof name === "string") { | ||
callback = function() { | ||
@@ -590,0 +605,0 @@ //console.log("200 " + name); |
@@ -10,4 +10,4 @@ "use strict"; | ||
*/ | ||
["vcl-data:Array", { }, [ //array: array }, [ | ||
["vcl-data:Array", {}, [ //array: array }, [ | ||
]]; |
@@ -139,22 +139,22 @@ "leaflet/Crs, leaflet/layers/28992, leaflet/plugins/markercluster, util/Browser, util/HtmlElement"; | ||
var cluster = L.markerClusterGroup({ | ||
disableClusteringAtZoom: 13, | ||
// chunkedLoading: true, | ||
// chunkDelay: 100, | ||
// chunkProgress: function(processed, total, elapsed, layersArray) { | ||
// var progress = $$('.markers-progress', container)[0]; | ||
// var progressBar = $$('.markers-progress-bar', container)[0]; | ||
// if (elapsed > 100) { | ||
// // if it takes more than a second to load, display the progress bar: | ||
// progress.style.display = 'block'; | ||
// progressBar.style.width = Math.round(processed/total*100) + '%'; | ||
// } | ||
// if (processed === total) { | ||
// // all markers processed - hide the progress bar: | ||
// progress.style.display = ''; | ||
// } | ||
// } | ||
}); | ||
cluster.addTo(map); | ||
var cluster = L.markerClusterGroup({ | ||
disableClusteringAtZoom: 13, | ||
// chunkedLoading: true, | ||
// chunkDelay: 100, | ||
// chunkProgress: function(processed, total, elapsed, layersArray) { | ||
// var progress = $$('.markers-progress', container)[0]; | ||
// var progressBar = $$('.markers-progress-bar', container)[0]; | ||
// if (elapsed > 100) { | ||
// // if it takes more than a second to load, display the progress bar: | ||
// progress.style.display = 'block'; | ||
// progressBar.style.width = Math.round(processed/total*100) + '%'; | ||
// } | ||
// if (processed === total) { | ||
// // all markers processed - hide the progress bar: | ||
// progress.style.display = ''; | ||
// } | ||
// } | ||
}); | ||
cluster.addTo(map); | ||
@@ -171,11 +171,10 @@ // var markers = []; | ||
var addLayer = map.addLayer; | ||
map.addLayer = function(layer) { | ||
return addLayer.apply(this, arguments); | ||
}; | ||
me.vars("map", map); | ||
me.vars("cluster", cluster); | ||
me.emit("map-ready", []); | ||
var addLayer = map.addLayer; | ||
map.addLayer = function(layer) { | ||
return addLayer.apply(this, arguments); | ||
}; | ||
me.vars("map", map); | ||
me.vars("cluster", cluster); | ||
me.emit("map-ready", []); | ||
}, | ||
@@ -182,0 +181,0 @@ onLoad: function() { |
@@ -11,25 +11,25 @@ "use locale, js"; | ||
["vcl-ui:Tab", {//, Executable", { | ||
onLoad: function() { | ||
this.setText(this._name); | ||
override(this, "select", function(select) { | ||
return function() { | ||
if(!this._control) { | ||
var me = this; | ||
require([String.format("blocks/Factory!ide/%s<%s>", this.getSpecializer(), this._name)], function(factory) { | ||
// onLoad: function() { | ||
// this.setText(this._name); | ||
// override(this, "select", function(select) { | ||
// return function() { | ||
// if(!this._control) { | ||
// var me = this; | ||
// require([String.format("blocks/Factory!ide/%s<%s>", this.getSpecializer(), this._name)], function(factory) { | ||
if(me._control) return; | ||
// if(me._control) return; | ||
}); | ||
} | ||
// }); | ||
// } | ||
return select.apply(this, arguments); | ||
}; | ||
}); | ||
}, | ||
// return select.apply(this, arguments); | ||
// }; | ||
// }); | ||
// }, | ||
execute: function() { | ||
// execute: function() { | ||
}, | ||
// }, | ||
@@ -36,0 +36,0 @@ // loaded: function() { |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
81924
44
2023
10