Skip to content

Commit

Permalink
Merge pull request #95 from SuperFlyTV/wip/big-rewrite
Browse files Browse the repository at this point in the history
Major change: Timeline logic takes conflicts into account in references
  • Loading branch information
nytamin authored Aug 23, 2023
2 parents de01edc + 9a41f41 commit 17b17ad
Show file tree
Hide file tree
Showing 74 changed files with 9,174 additions and 6,345 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
examples/*.js
examples/*.js
tests/*.js
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish prerelease
name: Publish Nightly

on:
# Allows you to run this workflow manually from the Actions tab
Expand Down Expand Up @@ -74,6 +74,9 @@ jobs:
- name: Bump version and build
if: ${{ steps.do-publish.outputs.publish }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "superflytvab"
COMMIT_TIMESTAMP=$(git log -1 --pretty=format:%ct HEAD)
COMMIT_DATE=$(date -d @$COMMIT_TIMESTAMP +%Y%m%d-%H%M%S)
GIT_HASH=$(git rev-parse --short HEAD)
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,24 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Prepare Environment
run: |
yarn install
yarn build
env:
CI: true
- name: Run tests
run: |
yarn unit --coverage=true
env:
CI: true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ wallaby.conf.js

.DS_Store
.vscode/settings.json
tests/
123 changes: 123 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Migration instructions

## 8.x.x -> 9.x.x

### API change

- `Resolver.resolveTimeline()` and `Resolver.resolveAllStates()` have been combined into one: `resolveTimeline()`.
- `Resolver.getState` has been renamed to `getResolvedState`.
- `validateIdString` has been renamed to `validateReferenceString`.
- `resolvedTimeline.statistics` properties have changed.

```typescript
// Before

// Resolve the timeline
const options: ResolveOptions = {
time: 0,
}
const resolvedTimeline = Resolver.resolveTimeline(timeline, options)
const resolvedStates = Resolver.resolveAllStates(resolvedTimeline)
// Calculate the state at a certain time:
const state = Resolver.getState(resolvedStates, 15)

// After

// Resolve the timeline
const options: ResolveOptions = {
time: 0,
}
const resolvedTimeline = resolveTimeline(timeline, options)
// Calculate the state at a certain time:
const state = getResolvedState(resolvedTimeline, 15)
```

### Timeline logic change

Before, references where evaluated on the original (non conflicted timeline-objects).
After, the references are updated when a conflict affects the dependees.

```typescript
const timeline = {
{id: 'A', layer: '1', enable: {start: 10, end: 100}}
{id: 'B', layer: '1', enable: {start: 50, end: null}}

{id: 'X', layer: '1', enable: {while: '#A'}}
}

// Before:
// A playing at [{start: 10, end: 50 }] (interrupted by B)
// B playing at [{start: 50, end: null }]
// X playing at [{start: 10, end: 100 }] (still references the original times of A)

// After:
// A playing at [{start: 10, end: 50 }] (interrupted by B)
// B playing at [{start: 50, end: null }]
// X playing at [{start: 10, end: 50 }] (references the updated times of A)
```

### Modified tests:

- basic.test.ts: "negative length object"
Instead of resolving to an instance of negative length, it resolves to a zero-length instance
- basic.test.ts: "negative length object sandwich 2"
Instead of resolving to an instance of negative length, it resolves to a zero-length instance
- basic.test.ts: "seamless"
Zero-length enables are kept as zero-length instances (before, they where removed)
- various:
Instance references does now contain references on the form "#ObjId", ".className",
before they could be naked strings

## 7.x.x -> 8.x.x

This release dropped support for **Node 8**.

## 6.x.x -> 7.x.x

### API Change

The structure of the timeline-objects has changed significantly.

```typescript
// Before:
const beforeTL = [
{
id: 'A',
trigger: {
type: Timeline.Enums.TriggerType.TIME_RELATIVE,
value: '#objId.start',
},
duration: 60,
LLayer: 1,
},
{
id: 'B',
trigger: {
type: Timeline.Enums.TriggerType.TIME_ABSOLUTE,
value: 100,
},
duration: 60,
LLayer: 1,
},
]

// After:
const afterTL = [
{
id: 'A',
enable: {
start: '#objId.start',
duration: 60,
},
layer: 1,
},
{
id: 'B',
enable: {
start: 100,
duration: 60,
},
layer: 1,
},
]
```
Loading

0 comments on commit 17b17ad

Please sign in to comment.