superfly-timeline
Advanced tools
Comparing version 8.2.3-nightly-20211022-123743-dbf2337.0 to 8.2.3-nightly-20211109-110847-c7f28e5.0
@@ -5,4 +5,4 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./api/enums"), exports); | ||
(0, tslib_1.__exportStar)(require("./api/api"), exports); | ||
tslib_1.__exportStar(require("./api/enums"), exports); | ||
tslib_1.__exportStar(require("./api/api"), exports); | ||
var resolver_1 = require("./resolver/resolver"); | ||
@@ -9,0 +9,0 @@ Object.defineProperty(exports, "Resolver", { enumerable: true, get: function () { return resolver_1.Resolver; } }); |
@@ -9,3 +9,3 @@ "use strict"; | ||
function interpretExpression(expression) { | ||
if ((0, lib_1.isNumeric)(expression)) { | ||
if (lib_1.isNumeric(expression)) { | ||
return parseFloat(expression); | ||
@@ -15,3 +15,3 @@ } | ||
const expressionString = expression; | ||
return (0, lib_1.cacheResult)(expressionString, () => { | ||
return lib_1.cacheResult(expressionString, () => { | ||
const expr = expressionString.replace(new RegExp('([' + REGEXP_OPERATORS + '\\(\\)])', 'g'), ' $1 '); // Make sure there's a space between every operator & operand | ||
@@ -57,3 +57,3 @@ const words = _.compact(expr.split(' ')); | ||
const r = simplifyExpression(expr.r); | ||
if ((0, lib_1.isConstant)(l) && (0, lib_1.isConstant)(r) && _.isNumber(l) && _.isNumber(r)) { | ||
if (lib_1.isConstant(l) && lib_1.isConstant(r) && _.isNumber(l) && _.isNumber(r)) { | ||
// The operands can be combined: | ||
@@ -60,0 +60,0 @@ return o === '+' |
@@ -23,4 +23,4 @@ "use strict"; | ||
throw new Error('resolveTimeline: parameter options missing'); | ||
(0, validate_1.validateTimeline)(timeline, false); | ||
(0, lib_1.resetId)(); | ||
validate_1.validateTimeline(timeline, false); | ||
lib_1.resetId(); | ||
const resolvedTimeline = { | ||
@@ -45,3 +45,3 @@ options: { ...options }, | ||
throw Error(`All timelineObjects must be unique! (duplicate: "${obj.id}")`); | ||
const o = (0, lib_1.extendMandadory)(_.clone(obj), { | ||
const o = lib_1.extendMandadory(_.clone(obj), { | ||
resolved: { | ||
@@ -62,3 +62,3 @@ resolved: false, | ||
o.resolved.isKeyframe = true; | ||
(0, common_1.addObjectToResolvedTimeline)(resolvedTimeline, o); | ||
common_1.addObjectToResolvedTimeline(resolvedTimeline, o); | ||
// Add children: | ||
@@ -75,3 +75,3 @@ if (obj.isGroup && obj.children) { | ||
const keyframe = obj.keyframes[i]; | ||
const kf2 = (0, lib_1.extendMandadory)(_.clone(keyframe), { | ||
const kf2 = lib_1.extendMandadory(_.clone(keyframe), { | ||
layer: '', | ||
@@ -90,3 +90,3 @@ }); | ||
// Figure out which objects has changed since last time | ||
const cache = (0, cache_1.initializeCache)(options.cache, resolvedTimeline); | ||
const cache = cache_1.initializeCache(options.cache, resolvedTimeline); | ||
// Go through all new objects, and determine whether they have changed: | ||
@@ -114,3 +114,3 @@ const allNewObjects = {}; | ||
const oldHash = cache.objHashes[obj.id]; | ||
const newHash = (0, cache_1.hashTimelineObject)(obj); | ||
const newHash = cache_1.hashTimelineObject(obj); | ||
allNewObjects[obj.id] = true; | ||
@@ -180,3 +180,3 @@ if (!oldHash || oldHash !== newHash) { | ||
// it'll be invalidated anyway | ||
const dependOnReferences = (0, cache_1.getObjectReferences)(cachedObj); | ||
const dependOnReferences = cache_1.getObjectReferences(cachedObj); | ||
for (let i = 0; i < dependOnReferences.length; i++) { | ||
@@ -232,3 +232,3 @@ const ref = dependOnReferences[i]; | ||
static resolveAllStates(resolvedTimeline, cache) { | ||
return (0, state_1.resolveStates)(resolvedTimeline, cache); | ||
return state_1.resolveStates(resolvedTimeline, cache); | ||
} | ||
@@ -244,3 +244,3 @@ /** | ||
static getState(resolved, time, eventLimit) { | ||
return (0, state_1.getState)(resolved, time, eventLimit); | ||
return state_1.getState(resolved, time, eventLimit); | ||
} | ||
@@ -262,3 +262,3 @@ } | ||
let newInstances = []; | ||
const repeatingExpr = enable.repeating !== undefined ? (0, expression_1.interpretExpression)(enable.repeating) : null; | ||
const repeatingExpr = enable.repeating !== undefined ? expression_1.interpretExpression(enable.repeating) : null; | ||
const lookedRepeating = lookupExpression(resolvedTimeline, obj, repeatingExpr, 'duration'); | ||
@@ -277,3 +277,3 @@ const lookedupRepeating = lookedRepeating.instances; | ||
} | ||
const startExpr = (0, expression_1.simplifyExpression)(start); | ||
const startExpr = expression_1.simplifyExpression(start); | ||
let parentInstances = null; | ||
@@ -284,6 +284,6 @@ let hasParent = false; | ||
hasParent = true; | ||
const lookup = lookupExpression(resolvedTimeline, obj, (0, expression_1.interpretExpression)(`#${obj.resolved.parentId}`), 'start'); | ||
const lookup = lookupExpression(resolvedTimeline, obj, expression_1.interpretExpression(`#${obj.resolved.parentId}`), 'start'); | ||
parentInstances = lookup.instances; // a start-reference will always return an array, or null | ||
directReferences = directReferences.concat(lookup.allReferences); | ||
if ((0, lib_1.isConstant)(startExpr)) { | ||
if (lib_1.isConstant(startExpr)) { | ||
// Only use parent if the expression resolves to a number (ie doesn't contain any references) | ||
@@ -297,3 +297,3 @@ startRefersToParent = true; | ||
if (startRefersToParent) { | ||
lookedupStarts = (0, lib_1.applyParentInstances)(parentInstances, lookedupStarts); | ||
lookedupStarts = lib_1.applyParentInstances(parentInstances, lookedupStarts); | ||
} | ||
@@ -307,3 +307,3 @@ if (enable.while) { | ||
{ | ||
id: (0, lib_1.getId)(), | ||
id: lib_1.getId(), | ||
start: lookedupStarts.value, | ||
@@ -337,3 +337,3 @@ end: null, | ||
instance: { | ||
id: (0, lib_1.getId)(), | ||
id: lib_1.getId(), | ||
start: lookedupStarts.value, | ||
@@ -349,6 +349,6 @@ end: null, | ||
if (enable.end !== undefined) { | ||
const endExpr = (0, expression_1.interpretExpression)(enable.end); | ||
const endExpr = expression_1.interpretExpression(enable.end); | ||
let endRefersToParent = false; | ||
if (obj.resolved.parentId) { | ||
if ((0, lib_1.isConstant)(endExpr)) { | ||
if (lib_1.isConstant(endExpr)) { | ||
// Only use parent if the expression resolves to a number (ie doesn't contain any references) | ||
@@ -364,3 +364,3 @@ endRefersToParent = true; | ||
if (endRefersToParent) { | ||
lookedupEnds = (0, lib_1.applyParentInstances)(parentInstances, lookedupEnds); | ||
lookedupEnds = lib_1.applyParentInstances(parentInstances, lookedupEnds); | ||
} | ||
@@ -384,3 +384,3 @@ if (_.isArray(lookedupEnds)) { | ||
instance: { | ||
id: (0, lib_1.getId)(), | ||
id: lib_1.getId(), | ||
start: lookedupEnds.value, | ||
@@ -397,3 +397,3 @@ end: null, | ||
else if (enable.duration !== undefined) { | ||
const durationExpr = (0, expression_1.interpretExpression)(enable.duration); | ||
const durationExpr = expression_1.interpretExpression(enable.duration); | ||
const lookupDuration = lookupExpression(resolvedTimeline, obj, durationExpr, 'duration'); | ||
@@ -421,3 +421,3 @@ let lookedupDuration = lookupDuration.instances; | ||
const time = e.time + tmpLookedupDuration.value; | ||
const references = (0, lib_1.joinReferences)(e.references, tmpLookedupDuration.references); | ||
const references = lib_1.joinReferences(e.references, tmpLookedupDuration.references); | ||
events.push({ | ||
@@ -441,3 +441,3 @@ time: time, | ||
} | ||
newInstances = (0, lib_1.convertEventsToInstances)(events, false); | ||
newInstances = lib_1.convertEventsToInstances(events, false); | ||
} | ||
@@ -455,3 +455,3 @@ if (hasParent) { | ||
// If the child refers to its parent, there should be one specific instance to cap into | ||
const cappedInstance = (0, lib_1.capInstances)([instance], [referredParentInstance])[0]; | ||
const cappedInstance = lib_1.capInstances([instance], [referredParentInstance])[0]; | ||
if (cappedInstance) { | ||
@@ -472,3 +472,3 @@ if (!cappedInstance.caps) | ||
const parentInstance = parentInstances[i]; | ||
const cappedInstance = (0, lib_1.capInstances)([instance], [parentInstance])[0]; | ||
const cappedInstance = lib_1.capInstances([instance], [parentInstance])[0]; | ||
if (cappedInstance) { | ||
@@ -492,3 +492,3 @@ if (parentInstance) { | ||
} | ||
newInstances = (0, lib_1.applyRepeatingInstances)(newInstances, lookedupRepeating, resolvedTimeline.options); | ||
newInstances = lib_1.applyRepeatingInstances(newInstances, lookedupRepeating, resolvedTimeline.options); | ||
instances = instances.concat(newInstances); | ||
@@ -500,3 +500,3 @@ } | ||
if (ids[instance.id]) { | ||
instance.id = `${instance.id}_${(0, lib_1.getId)()}`; | ||
instance.id = `${instance.id}_${lib_1.getId()}`; | ||
} | ||
@@ -506,3 +506,3 @@ ids[instance.id] = true; | ||
if (obj.seamless && instances.length > 1) { | ||
instances = (0, lib_1.cleanInstances)(instances, true, false); | ||
instances = lib_1.cleanInstances(instances, true, false); | ||
} | ||
@@ -570,3 +570,3 @@ obj.resolved.resolved = true; | ||
return { instances: null, allReferences: [] }; | ||
if (_.isString(expr) && (0, lib_1.isNumeric)(expr)) { | ||
if (_.isString(expr) && lib_1.isNumeric(expr)) { | ||
return { | ||
@@ -591,3 +591,3 @@ instances: { | ||
expr = expr.trim(); | ||
if ((0, lib_1.isConstant)(expr)) { | ||
if (lib_1.isConstant(expr)) { | ||
if (expr.match(/^true$/i)) { | ||
@@ -698,3 +698,3 @@ return { | ||
value: duration, | ||
references: (0, lib_1.joinReferences)(referencedObj.id, firstInstance.references), | ||
references: lib_1.joinReferences(referencedObj.id, firstInstance.references), | ||
}); | ||
@@ -740,6 +740,6 @@ } | ||
if (invert) { | ||
returnInstances = (0, lib_1.invertInstances)(returnInstances); | ||
returnInstances = lib_1.invertInstances(returnInstances); | ||
} | ||
else { | ||
returnInstances = (0, lib_1.cleanInstances)(returnInstances, true, true); | ||
returnInstances = lib_1.cleanInstances(returnInstances, true, true); | ||
} | ||
@@ -777,3 +777,3 @@ if (ignoreFirstIfZero) { | ||
return { | ||
instances: (0, lib_1.invertInstances)(lookupExpr.r), | ||
instances: lib_1.invertInstances(lookupExpr.r), | ||
allReferences: allReferences, | ||
@@ -826,3 +826,3 @@ }; | ||
addEvents(lookupExpr.r, false); | ||
events = (0, lib_1.sortEvents)(events); | ||
events = lib_1.sortEvents(events); | ||
const calcResult = lookupExpr.o === '&' | ||
@@ -835,4 +835,4 @@ ? (left, right) => !!(left && right) | ||
}; | ||
let leftValue = (0, lib_1.isReference)(lookupExpr.l) ? !!lookupExpr.l.value : false; | ||
let rightValue = (0, lib_1.isReference)(lookupExpr.r) ? !!lookupExpr.r.value : false; | ||
let leftValue = lib_1.isReference(lookupExpr.l) ? !!lookupExpr.l.value : false; | ||
let rightValue = lib_1.isReference(lookupExpr.r) ? !!lookupExpr.r.value : false; | ||
let leftInstance = null; | ||
@@ -845,3 +845,3 @@ let rightInstance = null; | ||
instances.push({ | ||
id: (0, lib_1.getId)(), | ||
id: lib_1.getId(), | ||
start: time, | ||
@@ -861,3 +861,3 @@ end: null, | ||
}; | ||
updateInstance(0, resultValue, (0, lib_1.joinReferences)((0, lib_1.isReference)(lookupExpr.l) ? lookupExpr.l.references : [], (0, lib_1.isReference)(lookupExpr.r) ? lookupExpr.r.references : []), []); | ||
updateInstance(0, resultValue, lib_1.joinReferences(lib_1.isReference(lookupExpr.l) ? lookupExpr.l.references : [], lib_1.isReference(lookupExpr.r) ? lookupExpr.r.references : []), []); | ||
for (let i = 0; i < events.length; i++) { | ||
@@ -878,3 +878,3 @@ const e = events[i]; | ||
if (newResultValue !== resultValue) { | ||
updateInstance(e.time, newResultValue, (0, lib_1.joinReferences)(leftInstance ? leftInstance.references : [], rightInstance ? rightInstance.references : []), resultCaps); | ||
updateInstance(e.time, newResultValue, lib_1.joinReferences(leftInstance ? leftInstance.references : [], rightInstance ? rightInstance.references : []), resultCaps); | ||
resultValue = newResultValue; | ||
@@ -891,3 +891,3 @@ } | ||
value: a.value + b.value, | ||
references: (0, lib_1.joinReferences)(a.references, b.references), | ||
references: lib_1.joinReferences(a.references, b.references), | ||
}; | ||
@@ -899,3 +899,3 @@ } | ||
value: a.value - b.value, | ||
references: (0, lib_1.joinReferences)(a.references, b.references), | ||
references: lib_1.joinReferences(a.references, b.references), | ||
}; | ||
@@ -907,3 +907,3 @@ } | ||
value: a.value * b.value, | ||
references: (0, lib_1.joinReferences)(a.references, b.references), | ||
references: lib_1.joinReferences(a.references, b.references), | ||
}; | ||
@@ -915,3 +915,3 @@ } | ||
value: a.value / b.value, | ||
references: (0, lib_1.joinReferences)(a.references, b.references), | ||
references: lib_1.joinReferences(a.references, b.references), | ||
}; | ||
@@ -923,3 +923,3 @@ } | ||
value: a.value % b.value, | ||
references: (0, lib_1.joinReferences)(a.references, b.references), | ||
references: lib_1.joinReferences(a.references, b.references), | ||
}; | ||
@@ -933,3 +933,3 @@ } | ||
}; | ||
const result = (0, lib_1.operateOnArrays)(lookupExpr.l, lookupExpr.r, operate); | ||
const result = lib_1.operateOnArrays(lookupExpr.l, lookupExpr.r, operate); | ||
return { instances: result, allReferences: allReferences }; | ||
@@ -936,0 +936,0 @@ } |
@@ -212,3 +212,3 @@ "use strict"; | ||
// Cap the old instance, so it'll end at this point in time: | ||
(0, lib_1.setInstanceEndTime)(prevObj.instance, time); | ||
lib_1.setInstanceEndTime(prevObj.instance, time); | ||
// Update activeObjIds: | ||
@@ -241,3 +241,3 @@ delete activeObjIds[prevObj.id]; | ||
}; | ||
(0, common_1.addObjectToResolvedTimeline)(resolvedStates, newObj); | ||
common_1.addObjectToResolvedTimeline(resolvedStates, newObj); | ||
} | ||
@@ -393,3 +393,3 @@ const newInstance = { | ||
if (parent) { | ||
obj.resolved.instances = (0, lib_1.cleanInstances)((0, lib_1.capInstances)(obj.resolved.instances, parent.resolved.instances), false, false); | ||
obj.resolved.instances = lib_1.cleanInstances(lib_1.capInstances(obj.resolved.instances, parent.resolved.instances), false, false); | ||
} | ||
@@ -407,3 +407,3 @@ } | ||
// Cap the keyframe instances within its parents instances: | ||
keyframe.resolved.instances = (0, lib_1.capInstances)(keyframe.resolved.instances, parent.resolved.instances); | ||
keyframe.resolved.instances = lib_1.capInstances(keyframe.resolved.instances, parent.resolved.instances); | ||
// Ensure sure the instances are in the state | ||
@@ -428,3 +428,3 @@ for (let i = 0; i < keyframe.resolved.instances.length; i++) { | ||
if (obj.seamless && obj.resolved.instances.length > 1) { | ||
obj.resolved.instances = (0, lib_1.cleanInstances)(obj.resolved.instances, true, false); | ||
obj.resolved.instances = lib_1.cleanInstances(obj.resolved.instances, true, false); | ||
} | ||
@@ -431,0 +431,0 @@ } |
{ | ||
"name": "superfly-timeline", | ||
"version": "8.2.3-nightly-20211022-123743-dbf2337.0", | ||
"version": "8.2.3-nightly-20211109-110847-c7f28e5.0", | ||
"description": "A collection of rules as well as a resolver for placing objects on a virtual timeline.", | ||
@@ -89,3 +89,3 @@ "license": "MIT", | ||
"typedoc": "^0.22.6", | ||
"typescript": "^4.2.0" | ||
"typescript": "~4.2" | ||
}, | ||
@@ -92,0 +92,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
295330