New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

superfly-timeline

Package Overview
Dependencies
Maintainers
0
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superfly-timeline - npm Package Compare versions

Comparing version

to
9.0.3

11

dist/resolver/LayerStateHandler.d.ts

@@ -12,2 +12,6 @@ import { ResolvedTimelineObject } from '../api';

private layer;
/**
* Maps an array of object ids to an object id (objects that directly reference an reference).
*/
private directReferenceMap;
private pointsInTime;

@@ -18,3 +22,7 @@ /** List of object ids on the layer */

objectsOnLayer: ResolvedTimelineObject[];
constructor(resolvedTimeline: ResolvedTimelineHandler, instance: InstanceHandler, layer: string);
constructor(resolvedTimeline: ResolvedTimelineHandler, instance: InstanceHandler, layer: string,
/**
* Maps an array of object ids to an object id (objects that directly reference an reference).
*/
directReferenceMap: Map<string, string[]>);
/** Resolve conflicts between objects on the layer. */

@@ -24,2 +32,3 @@ resolveConflicts(): void;

private addPointInTime;
private compareInstancesToCheck;
}

@@ -26,0 +35,0 @@ export interface TimeEvent {

78

dist/resolver/LayerStateHandler.js

@@ -11,7 +11,51 @@ "use strict";

class LayerStateHandler {
constructor(resolvedTimeline, instance, layer) {
constructor(resolvedTimeline, instance, layer,
/**
* Maps an array of object ids to an object id (objects that directly reference an reference).
*/
directReferenceMap) {
this.resolvedTimeline = resolvedTimeline;
this.instance = instance;
this.layer = layer;
this.directReferenceMap = directReferenceMap;
this.pointsInTime = {};
this.compareInstancesToCheck = (a, b) => {
// Note: we assume that there are no keyframes here. (if there where, they would be sorted first)
if (a.instance.id === b.instance.id &&
a.instance.start === b.instance.start &&
a.instance.end === b.instance.end) {
// A & B are the same instance, it is a zero-length instance!
// In this case, put the start before the end:
if (a.instanceEvent === 'start' && b.instanceEvent === 'end')
return -1;
if (a.instanceEvent === 'end' && b.instanceEvent === 'start')
return 1;
}
// Handle ending instances first:
if (a.instanceEvent === 'start' && b.instanceEvent === 'end')
return 1;
if (a.instanceEvent === 'end' && b.instanceEvent === 'start')
return -1;
if (a.instance.start === a.instance.end || b.instance.start === b.instance.end) {
// Put later-ending instances last (in the case of zero-length vs non-zero-length instance):
const difference = (a.instance.end ?? Infinity) - (b.instance.end ?? Infinity);
if (difference)
return difference;
}
// If A references B, A should be handled after B, (B might resolve into a zero-length instance)
const aRefObjIds = this.directReferenceMap.get(a.obj.id);
if (aRefObjIds?.includes(b.obj.id))
return -1;
const bRefObjIds = this.directReferenceMap.get(b.obj.id);
if (bRefObjIds?.includes(a.obj.id))
return 1;
if (a.obj.resolved && b.obj.resolved) {
// Deeper objects (children in groups) comes later, we want to check the parent groups first:
const difference = a.obj.resolved.levelDeep - b.obj.resolved.levelDeep;
if (difference)
return difference;
}
// Last resort, sort by id to make it deterministic:
return (0, lib_1.compareStrings)(a.obj.id, b.obj.id) || (0, lib_1.compareStrings)(a.instance.id, b.instance.id);
};
this.objectsOnLayer = [];

@@ -93,3 +137,3 @@ this.objectIdsOnLayer = this.resolvedTimeline.getLayerObjects(layer);

const instancesToCheck = this.pointsInTime[time];
instancesToCheck.sort(compareInstancesToCheck);
instancesToCheck.sort(this.compareInstancesToCheck);
for (let j = 0; j < instancesToCheck.length; j++) {

@@ -222,32 +266,2 @@ const o = instancesToCheck[j];

}
function compareInstancesToCheck(a, b) {
// Note: we assume that there are no keyframes here. (if there where, they would be sorted first)
if (a.instance.id === b.instance.id && a.instance.start === b.instance.start && a.instance.end === b.instance.end) {
// A & B are the same instance, it is a zero-length instance!
// In this case, put the start before the end:
if (a.instanceEvent === 'start' && b.instanceEvent === 'end')
return -1;
if (a.instanceEvent === 'end' && b.instanceEvent === 'start')
return 1;
}
// Handle ending instances first:
if (a.instanceEvent === 'start' && b.instanceEvent === 'end')
return 1;
if (a.instanceEvent === 'end' && b.instanceEvent === 'start')
return -1;
if (a.instance.start === a.instance.end || b.instance.start === b.instance.end) {
// Put later-ending instances last (in the case of zero-length vs non-zero-length instance):
const difference = (a.instance.end ?? Infinity) - (b.instance.end ?? Infinity);
if (difference)
return difference;
}
if (a.obj.resolved && b.obj.resolved) {
// Deeper objects (children in groups) comes later, we want to check the parent groups first:
const difference = a.obj.resolved.levelDeep - b.obj.resolved.levelDeep;
if (difference)
return difference;
}
// Last resort, sort by id to make it deterministic:
return (0, lib_1.compareStrings)(a.obj.id, b.obj.id) || (0, lib_1.compareStrings)(a.instance.id, b.instance.id);
}
const removeFromAspiringInstances = (aspiringInstances, objId) => {

@@ -254,0 +268,0 @@ const returnInstances = [];

@@ -976,3 +976,3 @@ "use strict";

resolveConflictsForLayer(layer) {
const handler = new LayerStateHandler_1.LayerStateHandler(this, this.instance, layer);
const handler = new LayerStateHandler_1.LayerStateHandler(this, this.instance, layer, this.directReferenceMap);
// Fast path: If an object on this layer depends on an already changed object we should skip this layer, this iteration.

@@ -979,0 +979,0 @@ // Because the objects will likely change during the next resolve-iteration anyway.

{
"name": "superfly-timeline",
"version": "9.0.2",
"version": "9.0.3",
"description": "A collection of rules as well as a resolver for placing objects on a virtual timeline.",

@@ -95,3 +95,4 @@ "license": "MIT",

"tagPrefix": ""
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

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 not supported yet

Sorry, the diff of this file is not supported yet