Comparing version 0.8.3-rc1 to 0.8.4
@@ -254,2 +254,3 @@ 'use strict'; | ||
}; | ||
var data = {}; | ||
@@ -260,3 +261,4 @@ var hooks = /*#__PURE__*/Object.freeze({ | ||
_mount: _mount, | ||
_run: _run | ||
_run: _run, | ||
data: data | ||
}); | ||
@@ -451,10 +453,4 @@ | ||
}); | ||
} // $O({object, parentDepth, depth, _key, _val, _object}) { | ||
// const key = `${parentDepth}.$O` | ||
// handleHooks({object, depth, key, _, _key, _val, _object}) | ||
// } | ||
}, | ||
onArray: { | ||
A: function A(_ref8) { | ||
}, | ||
$O: function $O(_ref8) { | ||
var object = _ref8.object, | ||
@@ -466,3 +462,3 @@ parentDepth = _ref8.parentDepth, | ||
_object = _ref8._object; | ||
var key = "".concat(depth, ".A"); | ||
var key = "".concat(parentDepth, ".$O"); | ||
handleHooks({ | ||
@@ -477,4 +473,6 @@ object: object, | ||
}); | ||
}, | ||
A$: function A$(_ref9) { | ||
} | ||
}, | ||
onArray: { | ||
A: function A(_ref9) { | ||
var object = _ref9.object, | ||
@@ -486,4 +484,4 @@ parentDepth = _ref9.parentDepth, | ||
_object = _ref9._object; | ||
var key = "".concat(depth, ".A$"); | ||
handleEachHooks({ | ||
var key = "".concat(depth, ".A"); | ||
handleHooks({ | ||
object: object, | ||
@@ -493,2 +491,3 @@ depth: depth, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
@@ -498,4 +497,5 @@ _object: _object | ||
}, | ||
$: function $$$1(_ref10) { | ||
A$: function A$(_ref10) { | ||
var object = _ref10.object, | ||
parentDepth = _ref10.parentDepth, | ||
depth = _ref10.depth, | ||
@@ -505,3 +505,3 @@ _key = _ref10._key, | ||
_object = _ref10._object; | ||
var key = "".concat(depth, ".$"); | ||
var key = "".concat(depth, ".A$"); | ||
handleEachHooks({ | ||
@@ -515,12 +515,5 @@ object: object, | ||
}); | ||
} // $A({object, parentDepth, depth, _key, _val, _object}) { | ||
// const key = `${parentDepth}.$A` | ||
// handleHooks({object, depth, key, _, _key, _val, _object}) | ||
// } | ||
}, | ||
onFunction: { | ||
F: function F(_ref11) { | ||
}, | ||
$: function $$$1(_ref11) { | ||
var object = _ref11.object, | ||
parentDepth = _ref11.parentDepth, | ||
depth = _ref11.depth, | ||
@@ -530,4 +523,4 @@ _key = _ref11._key, | ||
_object = _ref11._object; | ||
var key = "".concat(depth, ".F"); | ||
handleHooks({ | ||
var key = "".concat(depth, ".$"); | ||
handleEachHooks({ | ||
object: object, | ||
@@ -537,14 +530,7 @@ depth: depth, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} // $F({object, parentDepth, depth, _key, _val, _object}) { | ||
// const key = `${parentDepth}.$F` | ||
// handleHooks({object, depth, key, _, _key, _val, _object}) | ||
// } | ||
}, | ||
onVariable: { | ||
V: function V(_ref12) { | ||
}, | ||
$A: function $A(_ref12) { | ||
var object = _ref12.object, | ||
@@ -556,2 +542,60 @@ parentDepth = _ref12.parentDepth, | ||
_object = _ref12._object; | ||
var key = "".concat(parentDepth, ".$A"); | ||
handleHooks({ | ||
object: object, | ||
depth: depth, | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
}, | ||
onFunction: { | ||
F: function F(_ref13) { | ||
var object = _ref13.object, | ||
parentDepth = _ref13.parentDepth, | ||
depth = _ref13.depth, | ||
_key = _ref13._key, | ||
_val = _ref13._val, | ||
_object = _ref13._object; | ||
var key = "".concat(depth, ".F"); | ||
handleHooks({ | ||
object: object, | ||
depth: depth, | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
}, | ||
$F: function $F(_ref14) { | ||
var object = _ref14.object, | ||
parentDepth = _ref14.parentDepth, | ||
depth = _ref14.depth, | ||
_key = _ref14._key, | ||
_val = _ref14._val, | ||
_object = _ref14._object; | ||
var key = "".concat(parentDepth, ".$F"); | ||
handleHooks({ | ||
object: object, | ||
depth: depth, | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
}, | ||
onVariable: { | ||
V: function V(_ref15) { | ||
var object = _ref15.object, | ||
parentDepth = _ref15.parentDepth, | ||
depth = _ref15.depth, | ||
_key = _ref15._key, | ||
_val = _ref15._val, | ||
_object = _ref15._object; | ||
var key = "".concat(depth, ".V"); | ||
@@ -567,7 +611,21 @@ handleHooks({ | ||
}); | ||
} // $V({object, parentDepth, depth, _key, _val, _object}) { | ||
// const key = `${parentDepth}.$V` | ||
// handleHooks({object, depth, key, _, _key, _val, _object}) | ||
// } | ||
}, | ||
$V: function $V(_ref16) { | ||
var object = _ref16.object, | ||
parentDepth = _ref16.parentDepth, | ||
depth = _ref16.depth, | ||
_key = _ref16._key, | ||
_val = _ref16._val, | ||
_object = _ref16._object; | ||
var key = "".concat(parentDepth, ".$V"); | ||
handleHooks({ | ||
object: object, | ||
depth: depth, | ||
key: key, | ||
_: _2, | ||
_key: _key, | ||
_val: _val, | ||
_object: _object | ||
}); | ||
} | ||
} | ||
@@ -609,3 +667,4 @@ }; | ||
var validHook = has(_[HOOKS], depth); | ||
if (depth != '' && !validHook) return; | ||
var parentValidHook = has(_[HOOKS], parentDepth); | ||
if (depth != '' && !validHook && !parentValidHook) return; | ||
var scanHooks = _scanHooks[hook]; | ||
@@ -628,5 +687,7 @@ scanHooks && $(scanHooks, function (key, shook) { | ||
hook = data.hook, | ||
depth = data.depth; | ||
depth = data.depth, | ||
parentDepth = data.parentDepth; | ||
var validHook = has(_[HOOKS], depth); | ||
if (depth != '' && !validHook) return; | ||
var parentValidHook = has(_[HOOKS], parentDepth); | ||
if (depth != '' && !validHook && !parentValidHook) return; | ||
hook && BindHook(data); | ||
@@ -1201,3 +1262,3 @@ scanObject({ | ||
_ref$depth = _ref.depth, | ||
depth = _ref$depth === void 0 ? null : _ref$depth, | ||
depth = _ref$depth === void 0 ? '' : _ref$depth, | ||
onObject = _ref.onObject, | ||
@@ -1278,139 +1339,2 @@ onArray = _ref.onArray, | ||
var ECS = Symbol('ecs'); | ||
var _query = function query(_, datas) { | ||
var _$ECS = _[ECS], | ||
entities = _$ECS.entities, | ||
components = _$ECS.components; | ||
datas = Array.isArray(datas) ? datas : [datas]; | ||
var valid = true; | ||
var _entities = new Map(); | ||
var cps = datas.map(function (cp) { | ||
return components[cp] || (valid = false); | ||
}); | ||
if (!valid) return []; | ||
var _cps = _slicedToArray(cps, 1), | ||
_cps$ = _cps[0], | ||
filter = _cps$ === void 0 ? [] : _cps$; | ||
filter.forEach(function (id) { | ||
cps.forEach(function (c) { | ||
if (!c.has(id)) { | ||
filter.delete(id); | ||
} | ||
}); | ||
}); | ||
filter.forEach(function (id) { | ||
_entities.set(id, entities[id]); | ||
}); | ||
return _entities; | ||
}; | ||
var _queryRaw = function queryRaw(_, datas) { | ||
var _$ECS2 = _[ECS], | ||
raws = _$ECS2.raws, | ||
components = _$ECS2.components; | ||
datas = Array.isArray(datas) ? datas : [datas]; | ||
var valid = true; | ||
var _entities = new Map(); | ||
var cps = datas.map(function (cp) { | ||
return components[cp] || (valid = false); | ||
}); | ||
if (!valid) return []; | ||
var _cps2 = _slicedToArray(cps, 1), | ||
_cps2$ = _cps2[0], | ||
filter = _cps2$ === void 0 ? [] : _cps2$; | ||
filter.forEach(function (id) { | ||
cps.forEach(function (c) { | ||
if (!c.has(id)) { | ||
filter.delete(id); | ||
} | ||
}); | ||
}); | ||
filter.forEach(function (id) { | ||
_entities.set(id, raws[id]); | ||
}); | ||
return _entities; | ||
}; | ||
var entity = function entity(_ref) { | ||
var _Object$assign; | ||
var _ = _ref._; | ||
Object.assign(_, (_Object$assign = {}, _defineProperty(_Object$assign, ECS, { | ||
raws: {}, | ||
entities: {}, | ||
components: {} | ||
}), _defineProperty(_Object$assign, "query", function query(_object) { | ||
return _query(_, _object); | ||
}), _defineProperty(_Object$assign, "queryRaw", function queryRaw(_object) { | ||
return _queryRaw(_, _object); | ||
}), _Object$assign)); | ||
var _$ECS3 = _[ECS], | ||
entities = _$ECS3.entities, | ||
components = _$ECS3.components, | ||
raws = _$ECS3.raws; | ||
return { | ||
name: 'entity', | ||
$entity: { | ||
$: function $$$1(_ref2) { | ||
var _val = _ref2._val, | ||
cp = _ref2.cp; | ||
var cache = {}; | ||
var entitiyID = uuid.v1(); | ||
raws[entitiyID] = _val; | ||
var onAny = function onAny(_ref3) { | ||
var object = _ref3.object, | ||
parentDepth = _ref3.parentDepth, | ||
depth = _ref3.depth, | ||
_key = _ref3._key, | ||
_val = _ref3._val; | ||
if (_key === 'val') { | ||
set$1(cache, parentDepth, _val); | ||
} | ||
}; | ||
var onObject = function onObject(_ref4) { | ||
var object = _ref4.object, | ||
depth = _ref4.depth, | ||
_key = _ref4._key, | ||
_val = _ref4._val; | ||
scanObject({ | ||
object: object, | ||
depth: depth, | ||
onObject: onObject, | ||
onAny: onAny | ||
}); | ||
}; | ||
onObject({ | ||
object: _val, | ||
depth: '' | ||
}); | ||
$(cache, function (k, v) { | ||
var target = components[k]; | ||
if (!target) { | ||
target = new Set([entitiyID]); | ||
set$1(components, k, target); | ||
} else { | ||
target.add(entitiyID, v); | ||
} | ||
}); | ||
entities[entitiyID] = cache; | ||
} | ||
} | ||
}; | ||
}; | ||
var assign = Object.assign; | ||
@@ -1487,5 +1411,1 @@ var $core = function $core(_, _object) { | ||
exports._equal = _equal$$1; | ||
exports.ECS = ECS; | ||
exports.query = _query; | ||
exports.queryRaw = _queryRaw; | ||
exports.entity = entity; |
{ | ||
"name": "menhera", | ||
"version": "0.8.3-rc1", | ||
"version": "0.8.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
34404
1258