ember-animated
Advanced tools
Comparing version 1.1.3 to 2.0.0
@@ -1,4 +0,3 @@ | ||
import { _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { f, i } from 'decorator-transforms/runtime'; | ||
var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
// Polyfill DOMRect | ||
@@ -14,3 +13,3 @@ // It's not available on Edge or IE11 | ||
} | ||
let DOMRectPolyfill = (_class = class DOMRectPolyfill { | ||
class DOMRectPolyfill { | ||
static fromRect(rect = {}) { | ||
@@ -20,7 +19,2 @@ return new DOMRect(rect.x ?? 0, rect.y ?? 0, rect.width ?? 0, rect.height ?? 0); | ||
constructor(x, y, width, height) { | ||
// DOMRect's properties are all non-enumerable | ||
_initializerDefineProperty(this, "x", _descriptor, this); | ||
_initializerDefineProperty(this, "y", _descriptor2, this); | ||
_initializerDefineProperty(this, "width", _descriptor3, this); | ||
_initializerDefineProperty(this, "height", _descriptor4, this); | ||
if (x != null) { | ||
@@ -39,2 +33,28 @@ this.x = x; | ||
} | ||
// DOMRect's properties are all non-enumerable | ||
static { | ||
f(this, "x", [nonEnumerable], function () { | ||
return 0; | ||
}); | ||
} | ||
#x = (i(this, "x"), void 0); | ||
static { | ||
f(this, "y", [nonEnumerable], function () { | ||
return 0; | ||
}); | ||
} | ||
#y = (i(this, "y"), void 0); | ||
static { | ||
f(this, "width", [nonEnumerable], function () { | ||
return 0; | ||
}); | ||
} | ||
#width = (i(this, "width"), void 0); | ||
static { | ||
f(this, "height", [nonEnumerable], function () { | ||
return 0; | ||
}); | ||
} | ||
#height = (i(this, "height"), void 0); | ||
get top() { | ||
@@ -66,31 +86,3 @@ return this.y; | ||
} | ||
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "x", [nonEnumerable], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: function () { | ||
return 0; | ||
} | ||
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "y", [nonEnumerable], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: function () { | ||
return 0; | ||
} | ||
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "width", [nonEnumerable], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: function () { | ||
return 0; | ||
} | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "height", [nonEnumerable], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: function () { | ||
return 0; | ||
} | ||
})), _class); | ||
} | ||
if (typeof window !== 'undefined' && !window.DOMRect) { | ||
@@ -97,0 +89,0 @@ window.DOMRect = DOMRectPolyfill; |
@@ -1,8 +0,6 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
class Child { | ||
state = 'new'; | ||
removalBlockers = 0; | ||
removalCycle = null; | ||
constructor(group, id, value, index) { | ||
_defineProperty(this, "state", 'new'); | ||
_defineProperty(this, "removalBlockers", 0); | ||
_defineProperty(this, "removalCycle", null); | ||
this.group = group; | ||
@@ -9,0 +7,0 @@ this.id = id; |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { scheduleOnce, join } from '@ember/runloop'; | ||
@@ -36,7 +35,4 @@ import { addObserver } from '@ember/object/observers'; | ||
class TaskProperty extends BaseTaskProperty { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "_bufferPolicy", void 0); | ||
_defineProperty(this, "_observes", void 0); | ||
} | ||
_bufferPolicy; | ||
_observes; | ||
restartable() { | ||
@@ -63,3 +59,2 @@ this._bufferPolicy = cancelAllButLast; | ||
} | ||
if (this._observes) { | ||
@@ -83,5 +78,5 @@ let handlerName = `_ember_animated_handler_${handlerCounter++}`; | ||
class Task { | ||
concurrency = 0; | ||
isRunning = false; | ||
constructor(context, implementation, taskProperty, name) { | ||
_defineProperty(this, "concurrency", 0); | ||
_defineProperty(this, "isRunning", false); | ||
priv.set(this, { | ||
@@ -172,3 +167,2 @@ context, | ||
}; | ||
owner.willDestroy.__ember_processes_destroyers__ = disposers; | ||
@@ -175,0 +169,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { spawnChild } from './scheduler.js'; | ||
@@ -10,5 +9,5 @@ import { rAF, microwait } from './concurrency-helpers.js'; | ||
class Motion { | ||
_motionList; | ||
_inheritedMotionList; | ||
constructor(sprite, opts = {}) { | ||
_defineProperty(this, "_motionList", void 0); | ||
_defineProperty(this, "_inheritedMotionList", void 0); | ||
this.sprite = sprite; | ||
@@ -15,0 +14,0 @@ this.opts = opts; |
@@ -1,5 +0,43 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { registerCancellation, fireCancellation } from './concurrency-helpers.js'; | ||
import { getOrCreate as getOrCreate$1 } from './singleton.js'; | ||
/* | ||
API | ||
=== | ||
spawn: GenFn -> CancelablePromise | ||
starts a new microroutine, which will run independently until it | ||
finishes or is canceled. | ||
spawnChild: GenFn -> CancelablePromise | ||
starts a new microroutine linked to the current | ||
microroutine. Throws if you're not in a current | ||
microroutine. | ||
"Linked" means that if the caller is canceled, the new | ||
microroutine is also canceled. The inverse is not true: if the new | ||
microroutine is canceled, the caller is not canceled. | ||
`cancel(caller)` causes children to be canceled regardless of what | ||
state caller is in. For example, even if caller has finished, any | ||
children that haven't already finished will still be canceled. | ||
stop: CancelablePromise -> null | ||
cancel the microroutine represented by this promise. | ||
current: () -> CancelablePromise | ||
return the promise representing the currently executing | ||
microroutine, or null if there is none. This exists because | ||
spawning happens synchronously, meaning it begins running before | ||
spawn returns, meaning there's no other way to get an early handle | ||
on yourself. | ||
*/ | ||
function getOrCreate(key, construct) { | ||
@@ -80,3 +118,2 @@ return getOrCreate$1(`scheduler.${key}`, construct); | ||
}; | ||
getCurrent = function () { | ||
@@ -99,11 +136,11 @@ return routines.cur; | ||
class MicroRoutine { | ||
generator; | ||
resolve; | ||
reject; | ||
stopped = false; | ||
state; | ||
linked = []; | ||
errorLogger; | ||
promise; | ||
constructor(genFn, linkToParent) { | ||
_defineProperty(this, "generator", void 0); | ||
_defineProperty(this, "resolve", void 0); | ||
_defineProperty(this, "reject", void 0); | ||
_defineProperty(this, "stopped", false); | ||
_defineProperty(this, "state", void 0); | ||
_defineProperty(this, "linked", []); | ||
_defineProperty(this, "errorLogger", void 0); | ||
_defineProperty(this, "promise", void 0); | ||
this.generator = genFn(); | ||
@@ -110,0 +147,0 @@ this.promise = new Promise((res, rej) => { |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { warn } from '@ember/debug'; | ||
@@ -64,25 +63,25 @@ import Ember from 'ember'; | ||
} | ||
__element; | ||
owner = null; | ||
_transform = null; | ||
_cumulativeTransform = null; | ||
_offsetSprite; | ||
_lockedToInitialPosition; | ||
_finalComputedStyle = null; | ||
_finalBounds = null; | ||
_originalFinalBounds = null; | ||
_finalPosition = null; | ||
_finalCumulativeTransform = null; | ||
_initialComputedStyle = null; | ||
_initialBounds = null; | ||
_originalInitialBounds = null; | ||
_initialPosition = null; | ||
_initialCumulativeTransform = null; | ||
_revealed; | ||
_imposedStyle = null; | ||
_styleCache = null; | ||
_collapsingChildren = null; | ||
_lockMode; | ||
_inInitialPosition = false; | ||
constructor(element, inInitialPosition, lockMode, offsetSprite) { | ||
_defineProperty(this, "__element", void 0); | ||
_defineProperty(this, "owner", null); | ||
_defineProperty(this, "_transform", null); | ||
_defineProperty(this, "_cumulativeTransform", null); | ||
_defineProperty(this, "_offsetSprite", void 0); | ||
_defineProperty(this, "_lockedToInitialPosition", void 0); | ||
_defineProperty(this, "_finalComputedStyle", null); | ||
_defineProperty(this, "_finalBounds", null); | ||
_defineProperty(this, "_originalFinalBounds", null); | ||
_defineProperty(this, "_finalPosition", null); | ||
_defineProperty(this, "_finalCumulativeTransform", null); | ||
_defineProperty(this, "_initialComputedStyle", null); | ||
_defineProperty(this, "_initialBounds", null); | ||
_defineProperty(this, "_originalInitialBounds", null); | ||
_defineProperty(this, "_initialPosition", null); | ||
_defineProperty(this, "_initialCumulativeTransform", null); | ||
_defineProperty(this, "_revealed", void 0); | ||
_defineProperty(this, "_imposedStyle", null); | ||
_defineProperty(this, "_styleCache", null); | ||
_defineProperty(this, "_collapsingChildren", null); | ||
_defineProperty(this, "_lockMode", void 0); | ||
_defineProperty(this, "_inInitialPosition", false); | ||
this.element = element; | ||
@@ -1009,3 +1008,2 @@ this._offsetSprite = offsetSprite; | ||
} | ||
let offsetParent = element.offsetParent; | ||
@@ -1061,26 +1059,24 @@ let cursor = element.parentElement; | ||
class CopiedCSS { | ||
constructor() { | ||
_defineProperty(this, 'opacity', void 0); | ||
_defineProperty(this, 'font-size', void 0); | ||
_defineProperty(this, 'font-family', void 0); | ||
_defineProperty(this, 'font-weight', void 0); | ||
_defineProperty(this, 'color', void 0); | ||
_defineProperty(this, 'background-color', void 0); | ||
_defineProperty(this, 'border-color', void 0); | ||
_defineProperty(this, 'letter-spacing', void 0); | ||
_defineProperty(this, 'line-height', void 0); | ||
_defineProperty(this, 'text-align', void 0); | ||
_defineProperty(this, 'text-transform', void 0); | ||
_defineProperty(this, 'padding', void 0); | ||
_defineProperty(this, 'padding-top', void 0); | ||
_defineProperty(this, 'padding-bottom', void 0); | ||
_defineProperty(this, 'padding-left', void 0); | ||
_defineProperty(this, 'padding-right', void 0); | ||
_defineProperty(this, 'border-radius', void 0); | ||
_defineProperty(this, 'border-top-left-radius', void 0); | ||
_defineProperty(this, 'border-top-right-radius', void 0); | ||
_defineProperty(this, 'border-bottom-left-radius', void 0); | ||
_defineProperty(this, 'border-bottom-right-radius', void 0); | ||
_defineProperty(this, 'box-shadow', void 0); | ||
} | ||
'opacity'; | ||
'font-size'; | ||
'font-family'; | ||
'font-weight'; | ||
'color'; | ||
'background-color'; | ||
'border-color'; | ||
'letter-spacing'; | ||
'line-height'; | ||
'text-align'; | ||
'text-transform'; | ||
'padding'; | ||
'padding-top'; | ||
'padding-bottom'; | ||
'padding-left'; | ||
'padding-right'; | ||
'border-radius'; | ||
'border-top-left-radius'; | ||
'border-top-right-radius'; | ||
'border-bottom-left-radius'; | ||
'border-bottom-right-radius'; | ||
'box-shadow'; | ||
} | ||
@@ -1087,0 +1083,0 @@ const COPIED_CSS_PROPERTIES = ['opacity', 'font-size', 'font-family', 'font-weight', 'color', 'background-color', 'border-color', 'letter-spacing', 'line-height', 'text-align', 'text-transform', 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', 'border-radius', 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-left-radius', 'border-bottom-right-radius', 'box-shadow']; |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { childrenSettled } from './scheduler.js'; | ||
@@ -14,5 +13,5 @@ import { getOrCreate } from './singleton.js'; | ||
} | ||
_prepared = new Set(); | ||
prepareSprite; | ||
constructor(_duration, _insertedSprites, _keptSprites, _removedSprites, _sentSprites, _receivedSprites, _beacons, onMotionStart, onMotionEnd) { | ||
_defineProperty(this, "_prepared", new Set()); | ||
_defineProperty(this, "prepareSprite", void 0); | ||
this._duration = _duration; | ||
@@ -19,0 +18,0 @@ this._insertedSprites = _insertedSprites; |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF, clock, frameState } from './concurrency-helpers.js'; | ||
@@ -16,5 +15,5 @@ import { easeInAndOut } from '../easings/cosine.js'; | ||
class Tween { | ||
curve; | ||
diff; | ||
constructor(initialValue, finalValue, duration, easing = easeInAndOut) { | ||
_defineProperty(this, "curve", void 0); | ||
_defineProperty(this, "diff", void 0); | ||
this.initialValue = initialValue; | ||
@@ -39,5 +38,5 @@ this.finalValue = finalValue; | ||
class DerivedTween { | ||
_finalValue = null; | ||
inputs; | ||
constructor(inputs, combinator) { | ||
_defineProperty(this, "_finalValue", null); | ||
_defineProperty(this, "inputs", void 0); | ||
this.combinator = combinator; | ||
@@ -89,9 +88,9 @@ this._finalValue = null; | ||
} | ||
startTime; | ||
_doneFrames = 0; | ||
_lastTick; | ||
_runTime; | ||
_timeProgress; | ||
_spaceProgress; | ||
constructor(duration, easing) { | ||
_defineProperty(this, "startTime", void 0); | ||
_defineProperty(this, "_doneFrames", 0); | ||
_defineProperty(this, "_lastTick", void 0); | ||
_defineProperty(this, "_runTime", void 0); | ||
_defineProperty(this, "_timeProgress", void 0); | ||
_defineProperty(this, "_spaceProgress", void 0); | ||
this.duration = duration; | ||
@@ -98,0 +97,0 @@ this.easing = easing; |
@@ -1,3 +0,2 @@ | ||
import { a as _defineProperty } from './_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { C as Color, a as ColorTween } from './color-GikOQVbN.js'; | ||
import { C as Color, a as ColorTween } from './color-Y2qKrpZz.js'; | ||
import Tween from './-private/tween.js'; | ||
@@ -48,2 +47,8 @@ import linear from './easings/linear.js'; | ||
} | ||
color; | ||
x; | ||
y; | ||
blur; | ||
spread; | ||
inset; | ||
constructor({ | ||
@@ -57,8 +62,2 @@ color, | ||
}) { | ||
_defineProperty(this, "color", void 0); | ||
_defineProperty(this, "x", void 0); | ||
_defineProperty(this, "y", void 0); | ||
_defineProperty(this, "blur", void 0); | ||
_defineProperty(this, "spread", void 0); | ||
_defineProperty(this, "inset", void 0); | ||
this.color = color; | ||
@@ -86,4 +85,4 @@ this.x = x; | ||
class BoxShadowTween { | ||
shadowTweens; | ||
constructor(fromShadows, toShadows, duration, easing = linear) { | ||
_defineProperty(this, "shadowTweens", void 0); | ||
let shadowCount = Math.max(fromShadows.length, toShadows.length); | ||
@@ -112,9 +111,9 @@ if (fromShadows.length < shadowCount) { | ||
class OneShadowTween { | ||
colorTween; | ||
xTween; | ||
yTween; | ||
blurTween; | ||
spreadTween; | ||
inset; | ||
constructor(fromShadow, toShadow, duration, easing) { | ||
_defineProperty(this, "colorTween", void 0); | ||
_defineProperty(this, "xTween", void 0); | ||
_defineProperty(this, "yTween", void 0); | ||
_defineProperty(this, "blurTween", void 0); | ||
_defineProperty(this, "spreadTween", void 0); | ||
_defineProperty(this, "inset", void 0); | ||
this.colorTween = new ColorTween(fromShadow.color, toShadow.color, duration, easing); | ||
@@ -121,0 +120,0 @@ this.xTween = new Tween(fromShadow.x, toShadow.x, duration, easing); |
@@ -1,2 +0,1 @@ | ||
import { _ as _applyDecoratedDescriptor, a as _defineProperty, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import Component, { setComponentTemplate } from '@ember/component'; | ||
@@ -9,6 +8,6 @@ import { inject } from '@ember/service'; | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { f, i } from 'decorator-transforms/runtime'; | ||
var TEMPLATE = precompileTemplate("{{! template-lint-disable no-yield-only }}\n{{yield}}"); | ||
var _dec, _dec2, _class, _descriptor, _descriptor2; | ||
/** | ||
@@ -70,31 +69,10 @@ A component that marks a region of the page that | ||
*/ | ||
let AnimatedBeacon = (_dec = inject('-ea-motion'), _dec2 = task(function* () { | ||
if (!this.name) { | ||
throw new Error('Beacons must have a name.'); | ||
class AnimatedBeacon extends Component { | ||
name; | ||
tagName = ''; | ||
_inserted = false; | ||
static { | ||
f(this, "motionService", [inject('-ea-motion')]); | ||
} | ||
if (this.motionService.hasBeacon(this.name)) { | ||
return; | ||
} | ||
let element = this._firstChildElement(); | ||
if (!element) { | ||
return; | ||
} | ||
let offsetParent = Sprite.offsetParentStartingAt(element); | ||
let sprite = Sprite.positionedStartingAt(element, offsetParent); | ||
yield afterRender(); | ||
yield microwait(); | ||
yield* this.motionService.staticMeasurement(() => { | ||
offsetParent.measureFinalBounds(); | ||
sprite.measureFinalBounds(); | ||
}); | ||
yield this.motionService.addBeacon.perform(this.name, sprite); | ||
}), (_class = class AnimatedBeacon extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "name", void 0); | ||
_defineProperty(this, "tagName", ''); | ||
_defineProperty(this, "_inserted", false); | ||
_initializerDefineProperty(this, "motionService", _descriptor, this); | ||
_initializerDefineProperty(this, "participate", _descriptor2, this); | ||
} | ||
#motionService = (i(this, "motionService"), void 0); | ||
didInsertElement() { | ||
@@ -132,13 +110,27 @@ super.didInsertElement(); | ||
} | ||
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "motionService", [_dec], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "participate", [_dec2], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
})), _class)); | ||
static { | ||
f(this, "participate", [task(function* () { | ||
if (!this.name) { | ||
throw new Error('Beacons must have a name.'); | ||
} | ||
if (this.motionService.hasBeacon(this.name)) { | ||
return; | ||
} | ||
let element = this._firstChildElement(); | ||
if (!element) { | ||
return; | ||
} | ||
let offsetParent = Sprite.offsetParentStartingAt(element); | ||
let sprite = Sprite.positionedStartingAt(element, offsetParent); | ||
yield afterRender(); | ||
yield microwait(); | ||
yield* this.motionService.staticMeasurement(() => { | ||
offsetParent.measureFinalBounds(); | ||
sprite.measureFinalBounds(); | ||
}); | ||
yield this.motionService.addBeacon.perform(this.name, sprite); | ||
})]); | ||
} | ||
#participate = (i(this, "participate"), void 0); | ||
} | ||
setComponentTemplate(TEMPLATE, AnimatedBeacon); | ||
@@ -145,0 +137,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { _ as _applyDecoratedDescriptor, a as _defineProperty, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { inject } from '@ember/service'; | ||
@@ -6,3 +5,2 @@ import Component, { setComponentTemplate } from '@ember/component'; | ||
import { action } from '@ember/object'; | ||
import { dependencySatisfies } from '@embroider/macros'; | ||
import { Resize } from '../motions/resize.js'; | ||
@@ -14,6 +12,6 @@ import { task } from '../-private/ember-scheduler.js'; | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { f, i, m } from 'decorator-transforms/runtime'; | ||
var TEMPLATE = precompileTemplate("{{#if this.useElementHelper}}\n {{!--\n The @class is only there to support a deprecated usage.\n --}}\n {{#let (element this.tag) as |Tag|~}}\n {{! @glint-ignore: https://github.com/typed-ember/glint/issues/610 }}\n <Tag class=\"animated-container {{@class}}\" ...attributes>\n {{yield}}\n </Tag>\n {{/let}}\n{{else}}\n {{!--\n The @class is only there to support a deprecated usage.\n --}}\n {{! @glint-ignore }}\n {{#let (component (ensure-safe-component (-element this.tag)) tagName=this.tag) as |Tag|~}}\n {{! @glint-ignore }}\n <Tag class=\"animated-container {{@class}}\" ...attributes>\n {{yield}}\n </Tag>\n {{/let}}\n{{/if}}"); | ||
var TEMPLATE = precompileTemplate("{{!--\n The @class is only there to support a deprecated usage.\n--}}\n{{#let (element this.tag) as |Tag|~}}\n {{! @glint-ignore: https://github.com/typed-ember/glint/issues/610 }}\n <Tag class=\"animated-container {{@class}}\" ...attributes>\n {{yield}}\n </Tag>\n{{/let}}"); | ||
var _dec, _dec2, _dec3, _class, _descriptor, _descriptor2, _descriptor3; | ||
/** | ||
@@ -71,75 +69,39 @@ Provides a boundary between animator components and the surrounding document | ||
*/ | ||
let AnimatedContainerComponent = (_dec = inject('-ea-motion'), _dec2 = alias('animated.isRunning'), _dec3 = task(function* (duration, animationTask) { | ||
this._startingUp = true; | ||
let service = this.motionService; | ||
let sprite; | ||
let useMotion; | ||
let element = this._ownElement(); | ||
if (element) { | ||
sprite = Sprite.sizedStartingAt(element); | ||
this.sprite = sprite; | ||
sprite.lock(); | ||
useMotion = true; | ||
} else { | ||
useMotion = this.onInitialRender; | ||
class AnimatedContainerComponent extends Component { | ||
tagName = ''; | ||
static { | ||
f(this, "motionService", [inject('-ea-motion')]); | ||
} | ||
try { | ||
yield afterRender(); | ||
yield microwait(); | ||
} finally { | ||
this._startingUp = false; | ||
} | ||
yield* service.staticMeasurement(() => { | ||
if (!sprite) { | ||
// ownElement is non-null here because we waited for render above, and | ||
// our own template definitely contains an Element | ||
sprite = Sprite.sizedEndingAt(this._ownElement()); | ||
this.sprite = sprite; | ||
} else { | ||
sprite.measureFinalBounds(); | ||
} | ||
}); | ||
if (useMotion) { | ||
yield* new this.motion(this.sprite, { | ||
duration | ||
})._run(); | ||
} | ||
yield animationTask; | ||
this.sprite.unlock(); | ||
this.sprite = null; | ||
}).restartable(), (_class = class AnimatedContainerComponent extends Component { | ||
#motionService = (i(this, "motionService"), void 0); | ||
/** | ||
* Use a custom tag for the container. Defaults to div. | ||
@argument tag | ||
@type String | ||
*/ | ||
tag = 'div'; | ||
// @todo https://github.com/typed-ember/glint/issues/610 | ||
// tag: Tag = 'div' as Tag; | ||
/** | ||
* Whether to animate the initial render. You will probably also need to set | ||
* initialInsertion=true on a child component of animated-container. | ||
* Defaults to false. | ||
@argument onInitialRender | ||
@type Boolean | ||
*/ | ||
onInitialRender = false; | ||
/** | ||
* Use a custom tag for the container. Defaults to div. | ||
@argument motion | ||
@type String | ||
*/ | ||
motion = Resize; | ||
_inserted = false; | ||
_startingUp = false; | ||
sprite = null; | ||
constructor(properties) { | ||
super(properties); | ||
_defineProperty(this, "tagName", ''); | ||
_initializerDefineProperty(this, "motionService", _descriptor, this); | ||
/** | ||
* Use a custom tag for the container. Defaults to div. | ||
@argument tag | ||
@type String | ||
*/ | ||
_defineProperty(this, "tag", 'div'); | ||
// @todo https://github.com/typed-ember/glint/issues/610 | ||
// tag: Tag = 'div' as Tag; | ||
/** | ||
* Whether to animate the initial render. You will probably also need to set | ||
* initialInsertion=true on a child component of animated-container. | ||
* Defaults to false. | ||
@argument onInitialRender | ||
@type Boolean | ||
*/ | ||
_defineProperty(this, "onInitialRender", false); | ||
/** | ||
* Use a custom tag for the container. Defaults to div. | ||
@argument motion | ||
@type String | ||
*/ | ||
_defineProperty(this, "motion", Resize); | ||
_defineProperty(this, "_inserted", false); | ||
_defineProperty(this, "_startingUp", false); | ||
_defineProperty(this, "sprite", null); | ||
_initializerDefineProperty(this, "isAnimating", _descriptor2, this); | ||
_initializerDefineProperty(this, "animate", _descriptor3, this); | ||
this.motionService.register(this).observeDescendantAnimations(this, this.maybeAnimate); // TODO: shouldn't need this cast; | ||
} | ||
didInsertElement() { | ||
@@ -173,3 +135,6 @@ super.didInsertElement(); | ||
} | ||
static { | ||
f(this, "isAnimating", [alias('animated.isRunning')]); | ||
} | ||
#isAnimating = (i(this, "isAnimating"), void 0); | ||
maybeAnimate({ | ||
@@ -183,2 +148,5 @@ duration, | ||
} | ||
static { | ||
m(this, "maybeAnimate", [action]); | ||
} | ||
beginStaticMeasurement() { | ||
@@ -194,21 +162,45 @@ if (this.sprite) { | ||
} | ||
get useElementHelper() { | ||
return dependencySatisfies('ember-element-helper', '>=0.6.1'); | ||
static { | ||
f(this, "animate", [task(function* (duration, animationTask) { | ||
this._startingUp = true; | ||
let service = this.motionService; | ||
let sprite; | ||
let useMotion; | ||
let element = this._ownElement(); | ||
if (element) { | ||
sprite = Sprite.sizedStartingAt(element); | ||
this.sprite = sprite; | ||
sprite.lock(); | ||
useMotion = true; | ||
} else { | ||
useMotion = this.onInitialRender; | ||
} | ||
try { | ||
yield afterRender(); | ||
yield microwait(); | ||
} finally { | ||
this._startingUp = false; | ||
} | ||
yield* service.staticMeasurement(() => { | ||
if (!sprite) { | ||
// ownElement is non-null here because we waited for render above, and | ||
// our own template definitely contains an Element | ||
sprite = Sprite.sizedEndingAt(this._ownElement()); | ||
this.sprite = sprite; | ||
} else { | ||
sprite.measureFinalBounds(); | ||
} | ||
}); | ||
if (useMotion) { | ||
yield* new this.motion(this.sprite, { | ||
duration | ||
})._run(); | ||
} | ||
yield animationTask; | ||
this.sprite.unlock(); | ||
this.sprite = null; | ||
}).restartable()]); | ||
} | ||
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "motionService", [_dec], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "isAnimating", [_dec2], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _applyDecoratedDescriptor(_class.prototype, "maybeAnimate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "maybeAnimate"), _class.prototype), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "animate", [_dec3], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
})), _class)); | ||
#animate = (i(this, "animate"), void 0); | ||
} | ||
setComponentTemplate(TEMPLATE, AnimatedContainerComponent); | ||
@@ -215,0 +207,0 @@ |
@@ -1,4 +0,3 @@ | ||
import { a as _defineProperty, _ as _applyDecoratedDescriptor, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { alias } from '@ember/object/computed'; | ||
import { computed, action, get } from '@ember/object'; | ||
import { computed, get, action } from '@ember/object'; | ||
import { inject } from '@ember/service'; | ||
@@ -16,6 +15,6 @@ import Component, { setComponentTemplate } from '@ember/component'; | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { f, i, m } from 'decorator-transforms/runtime'; | ||
var TEMPLATE = precompileTemplate("{{~#each this.renderedChildren key=\"id\" as |child|~}}\n <-EaListElement @child={{child}} @elementToChild={{this._elementToChild}}>\n {{~yield child.value child.index~}}\n </-EaListElement>\n{{~else}}\n {{~yield to=\"inverse\"~}}\n{{/each}}\n"); | ||
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _class2; | ||
/** | ||
@@ -59,322 +58,95 @@ A drop in replacement for `{{#each}}` that animates changes to a list. | ||
*/ | ||
let AnimatedEach = (_dec = inject('-ea-motion'), _dec2 = computed('watch'), _dec3 = computed('duration'), _dec4 = computed('items.[]', 'group'), _dec5 = alias('animate.isRunning'), _dec6 = computed('key'), _dec7 = task(function* (transition, firstTime) { | ||
let { | ||
parent, | ||
currentSprites, | ||
insertedSprites, | ||
keptSprites, | ||
removedSprites | ||
} = yield this.startAnimation.perform(transition, current()); | ||
let { | ||
matchingAnimatorsFinished | ||
} = yield this.runAnimation.perform(transition, parent, currentSprites, insertedSprites, keptSprites, removedSprites, firstTime); | ||
yield this.finalizeAnimation.perform(insertedSprites, keptSprites, removedSprites, matchingAnimatorsFinished); | ||
}).restartable(), _dec8 = task(function* (transition, animateTask) { | ||
// we remember the transition we're using in case we need to | ||
// recalculate based on other animators potentially moving our DOM | ||
// around | ||
this._lastTransition = transition; | ||
class AnimatedEach extends Component { | ||
tagName = ''; | ||
static positionalParams = ['items']; | ||
static { | ||
f(this, "motionService", [inject('-ea-motion')]); | ||
} | ||
#motionService = (i(this, "motionService"), void 0); | ||
/** | ||
* The list of data you are trying to render. | ||
@argument items | ||
@type Array | ||
*/ | ||
items; | ||
// Reset the sprite lists. These are component state mostly | ||
// because beginStaticMeasurement needs to be able to put | ||
// everything into static positioning at any point in time, so | ||
// that any animation that's starting up can figure out what the | ||
// DOM is going to look like. | ||
let keptSprites = this._keptSprites = []; | ||
let removedSprites = this._removedSprites = []; | ||
let insertedSprites = this._insertedSprites = []; | ||
/** | ||
* If set, this animator will only [match](../../between) other animators that have the same group value. | ||
@argument group | ||
@type String | ||
*/ | ||
group; | ||
// Start by locating our current sprites based off the actual DOM | ||
// elements we contain. This records their initial positions. | ||
let { | ||
currentSprites, | ||
parent | ||
} = this._findCurrentSprites(); | ||
/** | ||
* Represents the amount of time an animation takes in miliseconds. | ||
@argument duration | ||
@type Number | ||
*/ | ||
duration; | ||
// Warn the rest of the universe that we're about to animate. | ||
this.motionService.willAnimate({ | ||
task: animateTask, | ||
duration: this.durationWithDefault, | ||
component: this, | ||
children: this._renderedChildren | ||
}); | ||
/** | ||
* Specifies the [Transition](../../transitions) | ||
* to run when the list changes. | ||
@argument use | ||
@type Transition | ||
*/ | ||
use; | ||
// Make all our current sprites absolutely positioned so they won't move during render. | ||
currentSprites.forEach(sprite => sprite.lock()); | ||
/** | ||
* Specifies data-dependent [Rules](../../rules) that choose which [Transition](../../transitions) | ||
* to run when the list changes. This takes precedence over `use`. | ||
@argument rules | ||
@type Rules | ||
*/ | ||
rules; | ||
// Wait for Ember to render our latest state. | ||
yield afterRender(); | ||
return { | ||
parent, | ||
currentSprites, | ||
insertedSprites, | ||
keptSprites, | ||
removedSprites | ||
}; | ||
}), _dec9 = task(function* (transition, parent, currentSprites, insertedSprites, keptSprites, removedSprites, firstTime) { | ||
// fill the keptSprites and removedSprites lists by comparing what | ||
// we had in currentSprites with what is still in the DOM now that | ||
// rendering happened. | ||
this._partitionKeptAndRemovedSprites(currentSprites); | ||
/** | ||
* When true, all the items in the list will animate as [`insertedSprites`](../../sprites) when the `{{#animated-each}}` is first rendered. Defaults to false. | ||
@argument initialInsertion | ||
@type Boolean | ||
*/ | ||
initialInsertion = false; | ||
// perform static measurement. The motionService coordinates this | ||
// because all animators need to be simultaneously put into their | ||
// static state via beginStaticMeasurement and endStaticMeasurement. | ||
yield* this.motionService.staticMeasurement(() => { | ||
// we care about the final position of our own DOM parent. That | ||
// lets us nest motions correctly. | ||
if (parent && !parent.finalBounds) { | ||
parent.measureFinalBounds(); | ||
} | ||
for (let element of this._ownElements()) { | ||
// now is when we find all the newly inserted sprites and | ||
// remember their final bounds. | ||
if (!currentSprites.find(sprite => sprite.element === element)) { | ||
if (!parent) { | ||
parent = Sprite.offsetParentEndingAt(element); | ||
} | ||
let sprite = Sprite.positionedEndingAt(element, parent); | ||
sprite.owner = this._elementToChild.get(element); | ||
sprite.hide(); | ||
insertedSprites.push(sprite); | ||
} | ||
} | ||
// and remember the final bounds of all our kept sprites | ||
keptSprites.forEach(sprite => sprite.measureFinalBounds()); | ||
}); | ||
/** | ||
When true, all the items in the list will animate as [`removedSprites`](../../sprites) when the `{{#animated-each}}` is destroyed. Defaults to false. | ||
Note that an `<AnimatedOrphans/>` component must be actively rendered when this animator is removed for this option to have any effect. | ||
@argument finalRemoval | ||
@type Boolean | ||
*/ | ||
finalRemoval = false; | ||
// at this point we know all the geometry of our own sprites. But | ||
// some of our sprites may match up with sprites that are entering | ||
// or leaving other simulatneous animators. So we hit another | ||
// coordination point via the motionService | ||
let { | ||
farMatches, | ||
matchingAnimatorsFinished, | ||
beacons | ||
} = yield this.motionService.get('farMatch').perform(current(), insertedSprites, keptSprites, removedSprites); | ||
/** | ||
Serves the same purpose as the `key` in ember `{{#each}}`, and it's | ||
also used to compare values when [animating between components](../../between). | ||
@argument key | ||
@type String | ||
*/ | ||
key; | ||
// TODO: This is best effort. The parent isn't necessarily in | ||
// the initial position at this point, but in practice if people | ||
// are properly using animated-containers it will be locked into | ||
// that position. We only need this if there were no elements to | ||
// begin with. A better solution would figure out what the | ||
// offset parent *would* be even when there are no elements, | ||
// based on our own placeholder comment nodes. | ||
if (parent && !parent.initialBounds) { | ||
parent.measureInitialBounds(); | ||
} | ||
let [sentSprites, unmatchedRemovedSprites] = partition(removedSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.endAtSprite(other); | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
/** | ||
An optional comma-separated list of properties to observe on each of the | ||
objects in the items list. If any of those properties change, we will | ||
trigger an animated transition. Without this, we only animate when the list | ||
contents change, not when any deeper properties change. | ||
@argument watch | ||
@type String | ||
*/ | ||
watch; | ||
// if any of our inserted sprites have matching far away sprites, | ||
// they become receivedSprites and they get initialBounds | ||
// (derived from their far away matching sprite) and motion | ||
// continuity via `startAtSprite`. | ||
let [receivedSprites, unmatchedInsertedSprites] = partition(insertedSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.startAtSprite(other); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
let [matchedKeptSprites, unmatchedKeptSprites] = partition(keptSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
// TODO: once TS conversion is complete, we can go around removing all the | ||
// underscores from private things. | ||
_elementToChild = new WeakMap(); | ||
_prevItems = []; | ||
_prevSignature = []; | ||
_firstTime = true; | ||
_inserted = false; | ||
_renderedChildren = []; | ||
_renderedChildrenStartedMoving = false; | ||
_cycleCounter = 0; | ||
_keptSprites = null; | ||
_insertedSprites = null; | ||
_removedSprites = null; | ||
_lastTransition = null; | ||
_ancestorWillDestroyUs = false; | ||
// let other animators make their own partitioning decisions | ||
// before we start hiding the sent & received sprites yield | ||
yield microwait(); | ||
matchedKeptSprites.forEach(s => s.hide()); | ||
sentSprites.forEach(s => s.hide()); | ||
// By default, we don't treat sprites as "inserted" when our | ||
// component first renders. You can override that by setting | ||
// initialInsertion=true. | ||
if (firstTime && !this.initialInsertion) { | ||
// Here we are effectively hiding the inserted sprites from the | ||
// user's transition function and just immediately revealing | ||
// them in their final positions instead. | ||
unmatchedInsertedSprites.forEach(s => s.reveal()); | ||
unmatchedInsertedSprites = []; | ||
} | ||
// if we are interrupted after this point, any removed children that didn't | ||
// actually undergo a motion will be immediately destroyed. | ||
this._renderedChildrenStartedMoving = true; | ||
// Early exit if nothing is happening. | ||
if (!transition || unmatchedInsertedSprites.length === 0 && unmatchedKeptSprites.length === 0 && unmatchedRemovedSprites.length === 0 && sentSprites.length === 0 && receivedSprites.length === 0 && matchedKeptSprites.length === 0) { | ||
return { | ||
matchingAnimatorsFinished | ||
}; | ||
} | ||
let context = new TransitionContext(this.durationWithDefault, unmatchedInsertedSprites, | ||
// user-visible insertedSprites | ||
unmatchedKeptSprites, | ||
// user-visible keptSprites | ||
unmatchedRemovedSprites, | ||
// user-visible removedSprites | ||
sentSprites, | ||
// user-visible sentSprites | ||
receivedSprites.concat(matchedKeptSprites), | ||
// user-visible receivedSprites | ||
beacons, sprite => this._motionStarted(sprite, cycle), sprite => this._motionEnded(sprite, cycle)); | ||
let cycle = this._cycleCounter++; | ||
yield* runToCompletion(context, transition); | ||
return { | ||
matchingAnimatorsFinished | ||
}; | ||
}), _dec10 = task(function* (insertedSprites, keptSprites, removedSprites, matchingAnimatorsFinished) { | ||
yield matchingAnimatorsFinished; | ||
// The following cleanup ensures that all the sprites that will | ||
// stay on the page after our animation are unlocked and | ||
// revealed. We may have already revealed most of them, but if an | ||
// inserted sprite was never subject to a motion it will appear | ||
// here, and if a previous transition was interrupted before an | ||
// inserted sprite could be revealed, it could have become a kept | ||
// sprite for us. | ||
keptSprites.forEach(sprite => { | ||
sprite.unlock(); | ||
sprite.reveal(); | ||
}); | ||
insertedSprites.forEach(sprite => { | ||
sprite.unlock(); | ||
sprite.reveal(); | ||
}); | ||
this._keptSprites = null; | ||
this._removedSprites = null; | ||
this._insertedSprites = null; | ||
if (removedSprites.length > 0) { | ||
// trigger a rerender to reap our removed children | ||
this.notifyPropertyChange('renderedChildren'); | ||
// wait for the render to happen before we allow our animation | ||
// to be done | ||
yield afterRender(); | ||
} | ||
}), (_class = (_class2 = class AnimatedEach extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "tagName", ''); | ||
_initializerDefineProperty(this, "motionService", _descriptor, this); | ||
/** | ||
* The list of data you are trying to render. | ||
@argument items | ||
@type Array | ||
*/ | ||
_defineProperty(this, "items", void 0); | ||
/** | ||
* If set, this animator will only [match](../../between) other animators that have the same group value. | ||
@argument group | ||
@type String | ||
*/ | ||
_defineProperty(this, "group", void 0); | ||
/** | ||
* Represents the amount of time an animation takes in miliseconds. | ||
@argument duration | ||
@type Number | ||
*/ | ||
_defineProperty(this, "duration", void 0); | ||
/** | ||
* Specifies the [Transition](../../transitions) | ||
* to run when the list changes. | ||
@argument use | ||
@type Transition | ||
*/ | ||
_defineProperty(this, "use", void 0); | ||
/** | ||
* Specifies data-dependent [Rules](../../rules) that choose which [Transition](../../transitions) | ||
* to run when the list changes. This takes precedence over `use`. | ||
@argument rules | ||
@type Rules | ||
*/ | ||
_defineProperty(this, "rules", void 0); | ||
/** | ||
* When true, all the items in the list will animate as [`insertedSprites`](../../sprites) when the `{{#animated-each}}` is first rendered. Defaults to false. | ||
@argument initialInsertion | ||
@type Boolean | ||
*/ | ||
_defineProperty(this, "initialInsertion", false); | ||
/** | ||
When true, all the items in the list will animate as [`removedSprites`](../../sprites) when the `{{#animated-each}}` is destroyed. Defaults to false. | ||
Note that an `<AnimatedOrphans/>` component must be actively rendered when this animator is removed for this option to have any effect. | ||
@argument finalRemoval | ||
@type Boolean | ||
*/ | ||
_defineProperty(this, "finalRemoval", false); | ||
/** | ||
Serves the same purpose as the `key` in ember `{{#each}}`, and it's | ||
also used to compare values when [animating between components](../../between). | ||
@argument key | ||
@type String | ||
*/ | ||
_defineProperty(this, "key", void 0); | ||
/** | ||
An optional comma-separated list of properties to observe on each of the | ||
objects in the items list. If any of those properties change, we will | ||
trigger an animated transition. Without this, we only animate when the list | ||
contents change, not when any deeper properties change. | ||
@argument watch | ||
@type String | ||
*/ | ||
_defineProperty(this, "watch", void 0); | ||
// TODO: once TS conversion is complete, we can go around removing all the | ||
// underscores from private things. | ||
_defineProperty(this, "_elementToChild", new WeakMap()); | ||
_defineProperty(this, "_prevItems", []); | ||
_defineProperty(this, "_prevSignature", []); | ||
_defineProperty(this, "_firstTime", true); | ||
_defineProperty(this, "_inserted", false); | ||
_defineProperty(this, "_renderedChildren", []); | ||
_defineProperty(this, "_renderedChildrenStartedMoving", false); | ||
_defineProperty(this, "_cycleCounter", 0); | ||
_defineProperty(this, "_keptSprites", null); | ||
_defineProperty(this, "_insertedSprites", null); | ||
_defineProperty(this, "_removedSprites", null); | ||
_defineProperty(this, "_lastTransition", null); | ||
_defineProperty(this, "_ancestorWillDestroyUs", false); | ||
/* eslint-enable ember/require-computed-property-dependencies, ember/no-side-effects */ | ||
_initializerDefineProperty(this, "isAnimating", _descriptor2, this); | ||
// The animate task is split into three subtasks that represent | ||
// three distinct phases. This is necessary for the proper | ||
// coordination of multiple animators. | ||
// | ||
// 1. During `startAnimation`, we ignore notifications about | ||
// descendant animations (see maybeReanimate), because we're still | ||
// waiting for Ember to finish rendering anyway and we haven't | ||
// kicked off our own animation. | ||
// | ||
// 2. During `runAnimation`, other animators will know that we are | ||
// actually still animating things, so if they are entangled with | ||
// us they should not finalize. (They get entangled via farMatch, | ||
// meaning some of their sprites and some of our sprites match | ||
// up). | ||
// | ||
// 3. During `finalizeAnimation`, we are waiting for our entangled | ||
// animators that are still in `runAnimation`, then we are | ||
// cleaning up our own sprite state. | ||
// | ||
_initializerDefineProperty(this, "animate", _descriptor3, this); | ||
_initializerDefineProperty(this, "startAnimation", _descriptor4, this); | ||
// todo: restartable? | ||
_initializerDefineProperty(this, "runAnimation", _descriptor5, this); | ||
_initializerDefineProperty(this, "finalizeAnimation", _descriptor6, this); | ||
} | ||
// eslint-disable-next-line ember/classic-decorator-hooks | ||
@@ -407,2 +179,5 @@ init() { | ||
} | ||
static { | ||
m(this, "_deps", [computed('watch')]); | ||
} | ||
get durationWithDefault() { | ||
@@ -416,2 +191,5 @@ let d = this.duration; | ||
} | ||
static { | ||
m(this, "durationWithDefault", [computed('duration')]); | ||
} | ||
_invalidateRenderedChildren() { | ||
@@ -500,5 +278,17 @@ this.notifyPropertyChange('renderedChildren'); | ||
} | ||
/* eslint-enable ember/require-computed-property-dependencies, ember/no-side-effects */ | ||
static { | ||
m(this, "renderedChildren", [computed('items.[]', 'group')]); | ||
} | ||
static { | ||
f(this, "isAnimating", [alias('animate.isRunning')]); | ||
} | ||
#isAnimating = (i(this, "isAnimating"), void 0); | ||
get keyGetter() { | ||
return keyForArray(this.key); | ||
} | ||
static { | ||
m(this, "keyGetter", [computed('key')]); | ||
} | ||
didInsertElement() { | ||
@@ -538,2 +328,5 @@ super.didInsertElement(); | ||
} | ||
static { | ||
m(this, "maybeReanimate", [action]); | ||
} | ||
ancestorIsAnimating(ourState) { | ||
@@ -554,2 +347,5 @@ if (ourState === 'removing' && !this._ancestorWillDestroyUs) { | ||
} | ||
static { | ||
m(this, "ancestorIsAnimating", [action]); | ||
} | ||
_letSpritesEscape() { | ||
@@ -645,2 +441,250 @@ let transition = this._transitionFor(this._firstTime, this._prevItems, []); | ||
} | ||
// The animate task is split into three subtasks that represent | ||
// three distinct phases. This is necessary for the proper | ||
// coordination of multiple animators. | ||
// | ||
// 1. During `startAnimation`, we ignore notifications about | ||
// descendant animations (see maybeReanimate), because we're still | ||
// waiting for Ember to finish rendering anyway and we haven't | ||
// kicked off our own animation. | ||
// | ||
// 2. During `runAnimation`, other animators will know that we are | ||
// actually still animating things, so if they are entangled with | ||
// us they should not finalize. (They get entangled via farMatch, | ||
// meaning some of their sprites and some of our sprites match | ||
// up). | ||
// | ||
// 3. During `finalizeAnimation`, we are waiting for our entangled | ||
// animators that are still in `runAnimation`, then we are | ||
// cleaning up our own sprite state. | ||
// | ||
static { | ||
f(this, "animate", [task(function* (transition, firstTime) { | ||
let { | ||
parent, | ||
currentSprites, | ||
insertedSprites, | ||
keptSprites, | ||
removedSprites | ||
} = yield this.startAnimation.perform(transition, current()); | ||
let { | ||
matchingAnimatorsFinished | ||
} = yield this.runAnimation.perform(transition, parent, currentSprites, insertedSprites, keptSprites, removedSprites, firstTime); | ||
yield this.finalizeAnimation.perform(insertedSprites, keptSprites, removedSprites, matchingAnimatorsFinished); | ||
}).restartable()]); | ||
} | ||
#animate = (i(this, "animate"), void 0); | ||
static { | ||
f(this, "startAnimation", [task(function* (transition, animateTask) { | ||
// we remember the transition we're using in case we need to | ||
// recalculate based on other animators potentially moving our DOM | ||
// around | ||
this._lastTransition = transition; | ||
// Reset the sprite lists. These are component state mostly | ||
// because beginStaticMeasurement needs to be able to put | ||
// everything into static positioning at any point in time, so | ||
// that any animation that's starting up can figure out what the | ||
// DOM is going to look like. | ||
let keptSprites = this._keptSprites = []; | ||
let removedSprites = this._removedSprites = []; | ||
let insertedSprites = this._insertedSprites = []; | ||
// Start by locating our current sprites based off the actual DOM | ||
// elements we contain. This records their initial positions. | ||
let { | ||
currentSprites, | ||
parent | ||
} = this._findCurrentSprites(); | ||
// Warn the rest of the universe that we're about to animate. | ||
this.motionService.willAnimate({ | ||
task: animateTask, | ||
duration: this.durationWithDefault, | ||
component: this, | ||
children: this._renderedChildren | ||
}); | ||
// Make all our current sprites absolutely positioned so they won't move during render. | ||
currentSprites.forEach(sprite => sprite.lock()); | ||
// Wait for Ember to render our latest state. | ||
yield afterRender(); | ||
return { | ||
parent, | ||
currentSprites, | ||
insertedSprites, | ||
keptSprites, | ||
removedSprites | ||
}; | ||
})]); | ||
} | ||
#startAnimation = (i(this, "startAnimation"), void 0); | ||
static { | ||
f(this, "runAnimation", [task(function* (transition, parent, currentSprites, insertedSprites, keptSprites, removedSprites, firstTime) { | ||
// fill the keptSprites and removedSprites lists by comparing what | ||
// we had in currentSprites with what is still in the DOM now that | ||
// rendering happened. | ||
this._partitionKeptAndRemovedSprites(currentSprites); | ||
// perform static measurement. The motionService coordinates this | ||
// because all animators need to be simultaneously put into their | ||
// static state via beginStaticMeasurement and endStaticMeasurement. | ||
yield* this.motionService.staticMeasurement(() => { | ||
// we care about the final position of our own DOM parent. That | ||
// lets us nest motions correctly. | ||
if (parent && !parent.finalBounds) { | ||
parent.measureFinalBounds(); | ||
} | ||
for (let element of this._ownElements()) { | ||
// now is when we find all the newly inserted sprites and | ||
// remember their final bounds. | ||
if (!currentSprites.find(sprite => sprite.element === element)) { | ||
if (!parent) { | ||
parent = Sprite.offsetParentEndingAt(element); | ||
} | ||
let sprite = Sprite.positionedEndingAt(element, parent); | ||
sprite.owner = this._elementToChild.get(element); | ||
sprite.hide(); | ||
insertedSprites.push(sprite); | ||
} | ||
} | ||
// and remember the final bounds of all our kept sprites | ||
keptSprites.forEach(sprite => sprite.measureFinalBounds()); | ||
}); | ||
// at this point we know all the geometry of our own sprites. But | ||
// some of our sprites may match up with sprites that are entering | ||
// or leaving other simulatneous animators. So we hit another | ||
// coordination point via the motionService | ||
let { | ||
farMatches, | ||
matchingAnimatorsFinished, | ||
beacons | ||
} = yield this.motionService.get('farMatch').perform(current(), insertedSprites, keptSprites, removedSprites); | ||
// TODO: This is best effort. The parent isn't necessarily in | ||
// the initial position at this point, but in practice if people | ||
// are properly using animated-containers it will be locked into | ||
// that position. We only need this if there were no elements to | ||
// begin with. A better solution would figure out what the | ||
// offset parent *would* be even when there are no elements, | ||
// based on our own placeholder comment nodes. | ||
if (parent && !parent.initialBounds) { | ||
parent.measureInitialBounds(); | ||
} | ||
let [sentSprites, unmatchedRemovedSprites] = partition(removedSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.endAtSprite(other); | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
// if any of our inserted sprites have matching far away sprites, | ||
// they become receivedSprites and they get initialBounds | ||
// (derived from their far away matching sprite) and motion | ||
// continuity via `startAtSprite`. | ||
let [receivedSprites, unmatchedInsertedSprites] = partition(insertedSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.startAtSprite(other); | ||
return true; | ||
} | ||
return false; | ||
}); | ||
let [matchedKeptSprites, unmatchedKeptSprites] = partition(keptSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
// let other animators make their own partitioning decisions | ||
// before we start hiding the sent & received sprites yield | ||
yield microwait(); | ||
matchedKeptSprites.forEach(s => s.hide()); | ||
sentSprites.forEach(s => s.hide()); | ||
// By default, we don't treat sprites as "inserted" when our | ||
// component first renders. You can override that by setting | ||
// initialInsertion=true. | ||
if (firstTime && !this.initialInsertion) { | ||
// Here we are effectively hiding the inserted sprites from the | ||
// user's transition function and just immediately revealing | ||
// them in their final positions instead. | ||
unmatchedInsertedSprites.forEach(s => s.reveal()); | ||
unmatchedInsertedSprites = []; | ||
} | ||
// if we are interrupted after this point, any removed children that didn't | ||
// actually undergo a motion will be immediately destroyed. | ||
this._renderedChildrenStartedMoving = true; | ||
// Early exit if nothing is happening. | ||
if (!transition || unmatchedInsertedSprites.length === 0 && unmatchedKeptSprites.length === 0 && unmatchedRemovedSprites.length === 0 && sentSprites.length === 0 && receivedSprites.length === 0 && matchedKeptSprites.length === 0) { | ||
return { | ||
matchingAnimatorsFinished | ||
}; | ||
} | ||
let context = new TransitionContext(this.durationWithDefault, unmatchedInsertedSprites, | ||
// user-visible insertedSprites | ||
unmatchedKeptSprites, | ||
// user-visible keptSprites | ||
unmatchedRemovedSprites, | ||
// user-visible removedSprites | ||
sentSprites, | ||
// user-visible sentSprites | ||
receivedSprites.concat(matchedKeptSprites), | ||
// user-visible receivedSprites | ||
beacons, sprite => this._motionStarted(sprite, cycle), sprite => this._motionEnded(sprite, cycle)); | ||
let cycle = this._cycleCounter++; | ||
yield* runToCompletion(context, transition); | ||
return { | ||
matchingAnimatorsFinished | ||
}; | ||
})]); | ||
} | ||
#runAnimation = (i(this, "runAnimation"), void 0); // todo: restartable? | ||
static { | ||
f(this, "finalizeAnimation", [task(function* (insertedSprites, keptSprites, removedSprites, matchingAnimatorsFinished) { | ||
yield matchingAnimatorsFinished; | ||
// The following cleanup ensures that all the sprites that will | ||
// stay on the page after our animation are unlocked and | ||
// revealed. We may have already revealed most of them, but if an | ||
// inserted sprite was never subject to a motion it will appear | ||
// here, and if a previous transition was interrupted before an | ||
// inserted sprite could be revealed, it could have become a kept | ||
// sprite for us. | ||
keptSprites.forEach(sprite => { | ||
sprite.unlock(); | ||
sprite.reveal(); | ||
}); | ||
insertedSprites.forEach(sprite => { | ||
sprite.unlock(); | ||
sprite.reveal(); | ||
}); | ||
this._keptSprites = null; | ||
this._removedSprites = null; | ||
this._insertedSprites = null; | ||
if (removedSprites.length > 0) { | ||
// trigger a rerender to reap our removed children | ||
this.notifyPropertyChange('renderedChildren'); | ||
// wait for the render to happen before we allow our animation | ||
// to be done | ||
yield afterRender(); | ||
} | ||
})]); | ||
} | ||
#finalizeAnimation = (i(this, "finalizeAnimation"), void 0); | ||
_motionStarted(sprite, cycle) { | ||
@@ -665,33 +709,3 @@ sprite.reveal(); | ||
} | ||
}, _defineProperty(_class2, "positionalParams", ['items']), _class2), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "motionService", [_dec], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _applyDecoratedDescriptor(_class.prototype, "_deps", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "_deps"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "durationWithDefault", [_dec3], Object.getOwnPropertyDescriptor(_class.prototype, "durationWithDefault"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "renderedChildren", [_dec4], Object.getOwnPropertyDescriptor(_class.prototype, "renderedChildren"), _class.prototype), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "isAnimating", [_dec5], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _applyDecoratedDescriptor(_class.prototype, "keyGetter", [_dec6], Object.getOwnPropertyDescriptor(_class.prototype, "keyGetter"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "maybeReanimate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "maybeReanimate"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "ancestorIsAnimating", [action], Object.getOwnPropertyDescriptor(_class.prototype, "ancestorIsAnimating"), _class.prototype), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "animate", [_dec7], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "startAnimation", [_dec8], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "runAnimation", [_dec9], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "finalizeAnimation", [_dec10], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
})), _class)); | ||
} | ||
function isStable(before, after) { | ||
@@ -698,0 +712,0 @@ if (before.length !== after.length) { |
@@ -1,9 +0,8 @@ | ||
import { a as _defineProperty, _ as _applyDecoratedDescriptor } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import Component, { setComponentTemplate } from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { m } from 'decorator-transforms/runtime'; | ||
var TEMPLATE = precompileTemplate("{{#animated-value this.predicate key=this.key rules=this.rules use=this.use duration=this.duration group=this.realGroup initialInsertion=this.initialInsertion finalRemoval=this.finalRemoval as |currentPredicate|}}\n {{#if currentPredicate}}\n {{yield}}\n {{else}}\n {{yield to=\"inverse\"}}\n {{/if}}\n{{/animated-value}}\n"); | ||
var _dec, _class, _class2; | ||
/** | ||
@@ -55,18 +54,19 @@ A drop in replacement for `{{#if}}` that animates changes when the predicate changes. | ||
*/ | ||
let AnimatedIfComponent = (_dec = computed('group'), (_class = (_class2 = class AnimatedIfComponent extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "tagName", ''); | ||
_defineProperty(this, "group", void 0); | ||
_defineProperty(this, "finalRemoval", void 0); | ||
_defineProperty(this, "initialInsertion", void 0); | ||
_defineProperty(this, "key", void 0); | ||
_defineProperty(this, "rules", void 0); | ||
_defineProperty(this, "use", void 0); | ||
_defineProperty(this, "duration", void 0); | ||
} | ||
class AnimatedIfComponent extends Component { | ||
tagName = ''; | ||
static positionalParams = ['predicate']; | ||
group; | ||
finalRemoval; | ||
initialInsertion; | ||
key; | ||
rules; | ||
use; | ||
duration; | ||
get realGroup() { | ||
return this.group || `animated_if_${Math.floor(Math.random() * 1000000)}`; | ||
} | ||
}, _defineProperty(_class2, "positionalParams", ['predicate']), _class2), (_applyDecoratedDescriptor(_class.prototype, "realGroup", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "realGroup"), _class.prototype)), _class)); | ||
static { | ||
m(this, "realGroup", [computed('group')]); | ||
} | ||
} | ||
setComponentTemplate(TEMPLATE, AnimatedIfComponent); | ||
@@ -73,0 +73,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { _ as _applyDecoratedDescriptor, a as _defineProperty, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { inject } from '@ember/service'; | ||
@@ -15,6 +14,6 @@ import { action } from '@ember/object'; | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { f, i, m } from 'decorator-transforms/runtime'; | ||
var TEMPLATE = precompileTemplate("{{! template-lint-disable no-yield-only }}\n{{yield}}"); | ||
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6; | ||
/** | ||
@@ -30,161 +29,13 @@ A component that adopts any orphaned sprites so they can continue animating even | ||
*/ | ||
let AnimatedOrphans = (_dec = inject('-ea-motion'), _dec2 = alias('animate.isRunning'), _dec3 = task(function* ({ | ||
ownSprite, | ||
activeSprites | ||
}) { | ||
yield this.startAnimation.perform(ownSprite); | ||
let { | ||
matchingAnimatorsFinished | ||
} = yield this.runAnimation.perform(activeSprites, ownSprite); | ||
yield this.finalizeAnimation.perform(activeSprites, matchingAnimatorsFinished); | ||
}).restartable(), _dec4 = task(function* (ownSprite) { | ||
yield afterRender(); | ||
ownSprite.measureFinalBounds(); | ||
}), _dec5 = task(function* (activeSprites, ownSprite) { | ||
// we don't need any static measurements, but we wait for this so | ||
// we stay on the same timing as all the other animators | ||
yield* this.motionService.staticMeasurement(() => {}); | ||
// Some of the new orphan transitions may be handing us sprites we | ||
// already have matches for, in which case our active sprites take | ||
// precedence. | ||
{ | ||
let activeIds = Object.create(null); | ||
for (let sprite of activeSprites) { | ||
activeIds[`${sprite.owner.group}/${sprite.owner.id}`] = true; | ||
} | ||
for (let entry of this._newOrphanTransitions) { | ||
entry.removedSprites = entry.removedSprites.filter(s => { | ||
s.assertHasOwner(); | ||
return !activeIds[`${s.owner.group}/${s.owner.id}`]; | ||
}); | ||
} | ||
class AnimatedOrphans extends Component { | ||
classNames = this.classNames.concat('animated-orphans'); | ||
static { | ||
f(this, "motionService", [inject('-ea-motion')]); | ||
} | ||
// our sprites from prior animation runs are eligible to be | ||
// matched by other animators (this is how an orphan sprites that | ||
// are animating away can get interrupted into coming back) | ||
let { | ||
farMatches, | ||
matchingAnimatorsFinished | ||
} = yield this.motionService.get('farMatch').perform(current(), [], [], activeSprites.concat(...this._newOrphanTransitions.map(t => t.removedSprites))); | ||
let cycle = this._cycleCounter++; | ||
for (let { | ||
transition, | ||
duration, | ||
sprites | ||
} of this._groupActiveSprites(activeSprites)) { | ||
let [sentSprites, removedSprites] = partition(sprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.endAtSprite(other); | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
let context = new TransitionContext(duration, [], [], removedSprites, sentSprites, [], {}, this._onMotionStart.bind(this, cycle), this._onMotionEnd.bind(this, cycle)); | ||
spawnChild(function* () { | ||
// let other animators make their own partitioning decisions | ||
// before we start hiding the sent & received sprites | ||
yield microwait(); | ||
sentSprites.forEach(s => s.hide()); | ||
yield* runToCompletion(context, transition); | ||
}); | ||
} | ||
while (this._newOrphanTransitions.length > 0) { | ||
// This is a pop instead of a shift because we want to start the | ||
// animations in the reverse order that they were | ||
// scheduled. This is a consequence of Ember's | ||
// willDestroyElement firing from top to bottom. We want | ||
// descendants have a chance to start before their ancestors, | ||
// because each one is going to potentially trigger DOM cloning, | ||
// so any animated descendants need to get hidden before one of | ||
// their ancestors clones them. | ||
let entry = this._newOrphanTransitions.pop(); | ||
let { | ||
transition, | ||
duration, | ||
removedSprites, | ||
shouldAnimateRemoved | ||
} = entry; | ||
if (removedSprites.length === 0) { | ||
// This can happen due to our filtering based on activeIds | ||
// above: some new orphan transitions may have nothing new | ||
// that we aren't already animating. | ||
continue; | ||
} | ||
for (let _sprite of removedSprites) { | ||
// typesecript workaround for https://github.com/microsoft/TypeScript/issues/35940 | ||
let sprite = _sprite; | ||
sprite.assertHasOwner(); | ||
sprite.rehome(ownSprite); | ||
this._childToTransition.set(sprite.owner, entry); | ||
} | ||
let [sentSprites, unmatchedRemovedSprites] = partition(removedSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.endAtSprite(other); | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
let self = this; | ||
spawnChild(function* () { | ||
yield microwait(); | ||
sentSprites.forEach(s => s.hide()); | ||
// now that we've hidden any sent sprites, we can bail out | ||
// early if there is no transition they want to run | ||
if (!transition) { | ||
return; | ||
} | ||
let removedSprites; | ||
if (shouldAnimateRemoved) { | ||
removedSprites = unmatchedRemovedSprites; | ||
} else { | ||
removedSprites = []; | ||
} | ||
// Early bail out if there's nothing left that could animate | ||
if (removedSprites.length === 0 && sentSprites.length === 0) { | ||
return; | ||
} | ||
let context = new TransitionContext(duration, [], [], removedSprites, sentSprites, [], {}, self._onFirstMotionStart.bind(self, activeSprites, cycle), self._onMotionEnd.bind(self, cycle)); | ||
context.prepareSprite = self._prepareSprite.bind(self); | ||
yield* runToCompletion(context, transition); | ||
}); | ||
} | ||
yield childrenSettled(); | ||
return { | ||
matchingAnimatorsFinished | ||
}; | ||
}), _dec6 = task(function* (activeSprites, matchingAnimatorsFinished) { | ||
yield matchingAnimatorsFinished; | ||
for (let sprite of activeSprites) { | ||
sprite.element.remove(); | ||
} | ||
}), (_class = class AnimatedOrphans extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "classNames", this.classNames.concat('animated-orphans')); | ||
_initializerDefineProperty(this, "motionService", _descriptor, this); | ||
_defineProperty(this, "_newOrphanTransitions", []); | ||
_defineProperty(this, "_elementToChild", new WeakMap()); | ||
_defineProperty(this, "_childToTransition", new WeakMap()); | ||
_defineProperty(this, "_inserted", false); | ||
_defineProperty(this, "_cycleCounter", 0); | ||
_initializerDefineProperty(this, "isAnimating", _descriptor2, this); | ||
_initializerDefineProperty(this, "animate", _descriptor3, this); | ||
_initializerDefineProperty(this, "startAnimation", _descriptor4, this); | ||
_initializerDefineProperty(this, "runAnimation", _descriptor5, this); | ||
_initializerDefineProperty(this, "finalizeAnimation", _descriptor6, this); | ||
} | ||
#motionService = (i(this, "motionService"), void 0); | ||
_newOrphanTransitions = []; | ||
_elementToChild = new WeakMap(); | ||
_childToTransition = new WeakMap(); | ||
_inserted = false; | ||
_cycleCounter = 0; | ||
didInsertElement() { | ||
@@ -216,2 +67,5 @@ super.didInsertElement(); | ||
} | ||
static { | ||
m(this, "animateOrphans", [action]); | ||
} | ||
reanimate() { | ||
@@ -227,2 +81,5 @@ if (!this.get('startAnimation.isRunning')) { | ||
} | ||
static { | ||
m(this, "reanimate", [action]); | ||
} | ||
beginStaticMeasurement() { | ||
@@ -232,2 +89,165 @@ // we don't have any impact on static layout | ||
endStaticMeasurement() {} | ||
static { | ||
f(this, "isAnimating", [alias('animate.isRunning')]); | ||
} | ||
#isAnimating = (i(this, "isAnimating"), void 0); | ||
static { | ||
f(this, "animate", [task(function* ({ | ||
ownSprite, | ||
activeSprites | ||
}) { | ||
yield this.startAnimation.perform(ownSprite); | ||
let { | ||
matchingAnimatorsFinished | ||
} = yield this.runAnimation.perform(activeSprites, ownSprite); | ||
yield this.finalizeAnimation.perform(activeSprites, matchingAnimatorsFinished); | ||
}).restartable()]); | ||
} | ||
#animate = (i(this, "animate"), void 0); | ||
static { | ||
f(this, "startAnimation", [task(function* (ownSprite) { | ||
yield afterRender(); | ||
ownSprite.measureFinalBounds(); | ||
})]); | ||
} | ||
#startAnimation = (i(this, "startAnimation"), void 0); | ||
static { | ||
f(this, "runAnimation", [task(function* (activeSprites, ownSprite) { | ||
// we don't need any static measurements, but we wait for this so | ||
// we stay on the same timing as all the other animators | ||
yield* this.motionService.staticMeasurement(() => {}); | ||
// Some of the new orphan transitions may be handing us sprites we | ||
// already have matches for, in which case our active sprites take | ||
// precedence. | ||
{ | ||
let activeIds = Object.create(null); | ||
for (let sprite of activeSprites) { | ||
activeIds[`${sprite.owner.group}/${sprite.owner.id}`] = true; | ||
} | ||
for (let entry of this._newOrphanTransitions) { | ||
entry.removedSprites = entry.removedSprites.filter(s => { | ||
s.assertHasOwner(); | ||
return !activeIds[`${s.owner.group}/${s.owner.id}`]; | ||
}); | ||
} | ||
} | ||
// our sprites from prior animation runs are eligible to be | ||
// matched by other animators (this is how an orphan sprites that | ||
// are animating away can get interrupted into coming back) | ||
let { | ||
farMatches, | ||
matchingAnimatorsFinished | ||
} = yield this.motionService.get('farMatch').perform(current(), [], [], activeSprites.concat(...this._newOrphanTransitions.map(t => t.removedSprites))); | ||
let cycle = this._cycleCounter++; | ||
for (let { | ||
transition, | ||
duration, | ||
sprites | ||
} of this._groupActiveSprites(activeSprites)) { | ||
let [sentSprites, removedSprites] = partition(sprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.endAtSprite(other); | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
let context = new TransitionContext(duration, [], [], removedSprites, sentSprites, [], {}, this._onMotionStart.bind(this, cycle), this._onMotionEnd.bind(this, cycle)); | ||
spawnChild(function* () { | ||
// let other animators make their own partitioning decisions | ||
// before we start hiding the sent & received sprites | ||
yield microwait(); | ||
sentSprites.forEach(s => s.hide()); | ||
yield* runToCompletion(context, transition); | ||
}); | ||
} | ||
while (this._newOrphanTransitions.length > 0) { | ||
// This is a pop instead of a shift because we want to start the | ||
// animations in the reverse order that they were | ||
// scheduled. This is a consequence of Ember's | ||
// willDestroyElement firing from top to bottom. We want | ||
// descendants have a chance to start before their ancestors, | ||
// because each one is going to potentially trigger DOM cloning, | ||
// so any animated descendants need to get hidden before one of | ||
// their ancestors clones them. | ||
let entry = this._newOrphanTransitions.pop(); | ||
let { | ||
transition, | ||
duration, | ||
removedSprites, | ||
shouldAnimateRemoved | ||
} = entry; | ||
if (removedSprites.length === 0) { | ||
// This can happen due to our filtering based on activeIds | ||
// above: some new orphan transitions may have nothing new | ||
// that we aren't already animating. | ||
continue; | ||
} | ||
for (let _sprite of removedSprites) { | ||
// typesecript workaround for https://github.com/microsoft/TypeScript/issues/35940 | ||
let sprite = _sprite; | ||
sprite.assertHasOwner(); | ||
sprite.rehome(ownSprite); | ||
this._childToTransition.set(sprite.owner, entry); | ||
} | ||
let [sentSprites, unmatchedRemovedSprites] = partition(removedSprites, sprite => { | ||
let other = farMatches.get(sprite); | ||
if (other) { | ||
sprite.endAtSprite(other); | ||
if (other.revealed && !sprite.revealed) { | ||
sprite.startAtSprite(other); | ||
} | ||
return true; | ||
} | ||
return false; | ||
}); | ||
// eslint-disable-next-line @typescript-eslint/no-this-alias | ||
let self = this; | ||
spawnChild(function* () { | ||
yield microwait(); | ||
sentSprites.forEach(s => s.hide()); | ||
// now that we've hidden any sent sprites, we can bail out | ||
// early if there is no transition they want to run | ||
if (!transition) { | ||
return; | ||
} | ||
let removedSprites; | ||
if (shouldAnimateRemoved) { | ||
removedSprites = unmatchedRemovedSprites; | ||
} else { | ||
removedSprites = []; | ||
} | ||
// Early bail out if there's nothing left that could animate | ||
if (removedSprites.length === 0 && sentSprites.length === 0) { | ||
return; | ||
} | ||
let context = new TransitionContext(duration, [], [], removedSprites, sentSprites, [], {}, self._onFirstMotionStart.bind(self, activeSprites, cycle), self._onMotionEnd.bind(self, cycle)); | ||
context.prepareSprite = self._prepareSprite.bind(self); | ||
yield* runToCompletion(context, transition); | ||
}); | ||
} | ||
yield childrenSettled(); | ||
return { | ||
matchingAnimatorsFinished | ||
}; | ||
})]); | ||
} | ||
#runAnimation = (i(this, "runAnimation"), void 0); | ||
static { | ||
f(this, "finalizeAnimation", [task(function* (activeSprites, matchingAnimatorsFinished) { | ||
yield matchingAnimatorsFinished; | ||
for (let sprite of activeSprites) { | ||
sprite.element.remove(); | ||
} | ||
})]); | ||
} | ||
#finalizeAnimation = (i(this, "finalizeAnimation"), void 0); | ||
_findActiveSprites(ownSprite) { | ||
@@ -320,33 +340,3 @@ if (!this._inserted) { | ||
} | ||
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "motionService", [_dec], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _applyDecoratedDescriptor(_class.prototype, "animateOrphans", [action], Object.getOwnPropertyDescriptor(_class.prototype, "animateOrphans"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "reanimate", [action], Object.getOwnPropertyDescriptor(_class.prototype, "reanimate"), _class.prototype), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "isAnimating", [_dec2], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "animate", [_dec3], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "startAnimation", [_dec4], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "runAnimation", [_dec5], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "finalizeAnimation", [_dec6], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
})), _class)); | ||
} | ||
setComponentTemplate(TEMPLATE, AnimatedOrphans); | ||
@@ -353,0 +343,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty, _ as _applyDecoratedDescriptor } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { computed } from '@ember/object'; | ||
@@ -6,6 +5,6 @@ import Component, { setComponentTemplate } from '@ember/component'; | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { m } from 'decorator-transforms/runtime'; | ||
var TEMPLATE = precompileTemplate("{{#animated-each this.items key=this.key rules=this.rules use=this.use duration=this.duration group=this.group watch=this.watch initialInsertion=this.initialInsertion finalRemoval=this.finalRemoval as |item|}}\n {{yield item}}\n{{/animated-each}}\n"); | ||
var _dec, _class, _class2; | ||
/** | ||
@@ -52,25 +51,27 @@ A component that animates when a single value changes. | ||
*/ | ||
let AnimatedValueComponent = (_dec = computed('value'), (_class = (_class2 = class AnimatedValueComponent extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
/** | ||
* The data you are trying to render. | ||
@argument items | ||
@type unknown | ||
*/ | ||
_defineProperty(this, "value", void 0); | ||
_defineProperty(this, "tagName", ''); | ||
_defineProperty(this, "finalRemoval", void 0); | ||
_defineProperty(this, "initialInsertion", void 0); | ||
_defineProperty(this, "watch", void 0); | ||
_defineProperty(this, "key", void 0); | ||
_defineProperty(this, "group", void 0); | ||
_defineProperty(this, "rules", void 0); | ||
_defineProperty(this, "use", void 0); | ||
_defineProperty(this, "duration", void 0); | ||
} | ||
class AnimatedValueComponent extends Component { | ||
/** | ||
* The data you are trying to render. | ||
@argument items | ||
@type unknown | ||
*/ | ||
value; | ||
tagName = ''; | ||
finalRemoval; | ||
initialInsertion; | ||
watch; | ||
key; | ||
group; | ||
rules; | ||
use; | ||
duration; | ||
static positionalParams = ['value']; | ||
get items() { | ||
return A([this.value]); | ||
} | ||
}, _defineProperty(_class2, "positionalParams", ['value']), _class2), (_applyDecoratedDescriptor(_class.prototype, "items", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "items"), _class.prototype)), _class)); | ||
static { | ||
m(this, "items", [computed('value')]); | ||
} | ||
} | ||
setComponentTemplate(TEMPLATE, AnimatedValueComponent); | ||
@@ -77,0 +78,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { warn } from '@ember/debug'; | ||
@@ -12,9 +11,6 @@ import Component from '@ember/component'; | ||
class EaListElement extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "tagName", ''); | ||
_defineProperty(this, "isEmberAnimatedListElement", true); | ||
_defineProperty(this, "child", void 0); | ||
_defineProperty(this, "elementToChild", void 0); | ||
} | ||
tagName = ''; | ||
isEmberAnimatedListElement = true; | ||
child; | ||
elementToChild; | ||
didRender() { | ||
@@ -21,0 +17,0 @@ super.didRender(); |
@@ -1,6 +0,5 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF } from '../-private/concurrency-helpers.js'; | ||
import Motion from '../-private/motion.js'; | ||
import '../-private/sprite.js'; | ||
import { C as Color, a as ColorTween } from '../color-GikOQVbN.js'; | ||
import { C as Color, a as ColorTween } from '../color-Y2qKrpZz.js'; | ||
@@ -14,5 +13,5 @@ function adjustColor(propertyName, sprite, opts = {}) { | ||
class AdjustColor extends Motion { | ||
colorTween = null; | ||
constructor(propertyName, sprite, opts = {}) { | ||
super(sprite, opts); | ||
_defineProperty(this, "colorTween", null); | ||
this.propertyName = propertyName; | ||
@@ -19,0 +18,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import Motion from '../-private/motion.js'; | ||
@@ -24,6 +23,6 @@ import Tween from '../-private/tween.js'; | ||
class AdjustCSS extends Motion { | ||
prior = null; | ||
tween = null; | ||
constructor(propertyName, sprite, opts = {}) { | ||
super(sprite, opts); | ||
_defineProperty(this, "prior", null); | ||
_defineProperty(this, "tween", null); | ||
this.propertyName = propertyName; | ||
@@ -36,3 +35,2 @@ } | ||
} | ||
*animate() { | ||
@@ -39,0 +37,0 @@ let { |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF } from '../-private/concurrency-helpers.js'; | ||
@@ -10,7 +9,4 @@ import Motion from '../-private/motion.js'; | ||
class CompensateForScale extends Motion { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "widthTween", null); | ||
_defineProperty(this, "heightTween", null); | ||
} | ||
widthTween = null; | ||
heightTween = null; | ||
*animate() { | ||
@@ -17,0 +13,0 @@ let duration = this.duration; |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { Move } from './move.js'; | ||
@@ -12,5 +11,5 @@ import { rAF } from '../-private/concurrency-helpers.js'; | ||
class Follow extends Move { | ||
source; | ||
constructor(sprite, opts = {}) { | ||
super(sprite, opts); | ||
_defineProperty(this, "source", void 0); | ||
if (!(this.opts.source instanceof Move)) { | ||
@@ -17,0 +16,0 @@ throw new Error('Follow requires a `source` Move to follow'); |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import Motion from '../-private/motion.js'; | ||
@@ -14,6 +13,6 @@ import '../-private/sprite.js'; | ||
class MoveSVG extends Motion { | ||
prior = null; | ||
tween = null; | ||
constructor(dimension, sprite, opts = {}) { | ||
super(sprite, opts); | ||
_defineProperty(this, "prior", null); | ||
_defineProperty(this, "tween", null); | ||
this.dimension = dimension; | ||
@@ -26,3 +25,2 @@ } | ||
} | ||
*animate() { | ||
@@ -29,0 +27,0 @@ if (this.prior) { |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF } from '../-private/concurrency-helpers.js'; | ||
@@ -26,8 +25,5 @@ import Motion from '../-private/motion.js'; | ||
class Move extends Motion { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "prior", null); | ||
_defineProperty(this, "xTween", null); | ||
_defineProperty(this, "yTween", null); | ||
} | ||
prior = null; | ||
xTween = null; | ||
yTween = null; | ||
interrupted(motions) { | ||
@@ -34,0 +30,0 @@ // We only need to track the prior Move we are replacing here, |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF } from '../-private/concurrency-helpers.js'; | ||
@@ -51,7 +50,4 @@ import Motion from '../-private/motion.js'; | ||
class Opacity extends Motion { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "prior", null); | ||
_defineProperty(this, "tween", null); | ||
} | ||
prior = null; | ||
tween = null; | ||
interrupted(motions) { | ||
@@ -58,0 +54,0 @@ // SAFTEY: We just checked the types |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF } from '../-private/concurrency-helpers.js'; | ||
@@ -29,8 +28,5 @@ import Motion from '../-private/motion.js'; | ||
class Resize extends Motion { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "prior", null); | ||
_defineProperty(this, "widthTween", null); | ||
_defineProperty(this, "heightTween", null); | ||
} | ||
prior = null; | ||
widthTween = null; | ||
heightTween = null; | ||
interrupted(motions) { | ||
@@ -37,0 +33,0 @@ let prior = motions.find(m => m instanceof this.constructor); |
@@ -1,2 +0,1 @@ | ||
import { a as _defineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { rAF } from '../-private/concurrency-helpers.js'; | ||
@@ -27,7 +26,4 @@ import Motion from '../-private/motion.js'; | ||
class Scale extends Motion { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "widthTween", null); | ||
_defineProperty(this, "heightTween", null); | ||
} | ||
widthTween = null; | ||
heightTween = null; | ||
*animate() { | ||
@@ -34,0 +30,0 @@ this.sprite.assertHasInitialBounds(); |
@@ -1,2 +0,1 @@ | ||
import { _ as _applyDecoratedDescriptor, a as _defineProperty, b as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-iYhWj1qN.js'; | ||
import { computed } from '@ember/object'; | ||
@@ -7,81 +6,14 @@ import { A } from '@ember/array'; | ||
import { microwait, rAF, afterRender, allSettled } from '../-private/concurrency-helpers.js'; | ||
import { m, f, i } from 'decorator-transforms/runtime'; | ||
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4; | ||
let MotionService = (_dec = computed(), _dec2 = computed('_animators.@each.isAnimating'), _dec3 = task(function* () { | ||
yield rAF(); | ||
this.notifyPropertyChange('isAnimating'); | ||
}).observes('isAnimatingSync'), _dec4 = task(function* () { | ||
// we are idle if we experience two frames in a row with nothing | ||
// animating. | ||
while (true) { | ||
yield rAF(); | ||
if (!this.isAnimatingSync) { | ||
yield rAF(); | ||
if (!this.isAnimatingSync) { | ||
return; | ||
} | ||
} | ||
} | ||
}), _dec5 = task(function* (name, beacon) { | ||
if (!this._beacons) { | ||
this._beacons = {}; | ||
} | ||
this._beacons[name] = beacon; | ||
// allows other farMatches to start | ||
yield microwait(); | ||
// allows other farMatches to finish | ||
yield microwait(); | ||
this._beacons = null; | ||
}), _dec6 = task(function* (runAnimationTask, inserted, kept, removed, longWait = false) { | ||
let matches = new Map(); | ||
let mine = { | ||
inserted, | ||
kept, | ||
removed, | ||
matches, | ||
runAnimationTask, | ||
otherTasks: new Map() | ||
}; | ||
this._rendezvous.push(mine); | ||
yield microwait(); | ||
if (longWait) { | ||
// used by matchDestroyed because it gets called earlier in the | ||
// render cycle, so it needs to linger longer in order to | ||
// coincide with other farMatches. | ||
yield afterRender(); | ||
yield microwait(); | ||
yield microwait(); | ||
} | ||
if (this.farMatch.concurrency > 1) { | ||
this._rendezvous.forEach(target => { | ||
if (target === mine) { | ||
return; | ||
} | ||
performMatches(mine, target); | ||
performMatches(target, mine); | ||
}); | ||
} | ||
this._rendezvous.splice(this._rendezvous.indexOf(mine), 1); | ||
return { | ||
farMatches: matches, | ||
matchingAnimatorsFinished: allSettled([...mine.otherTasks.keys()]), | ||
beacons: this._beacons | ||
}; | ||
}), (_class = class MotionService extends Service { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "_rendezvous", []); | ||
_defineProperty(this, "_measurements", []); | ||
_defineProperty(this, "_animators", A()); | ||
_defineProperty(this, "_orphanObserver", null); | ||
_defineProperty(this, "_animationObservers", []); | ||
_defineProperty(this, "_descendantObservers", []); | ||
_defineProperty(this, "_ancestorObservers", new WeakMap()); | ||
_defineProperty(this, "_beacons", null); | ||
// Invalidation support for isAnimating | ||
_initializerDefineProperty(this, "_invalidateIsAnimating", _descriptor, this); | ||
_initializerDefineProperty(this, "waitUntilIdle", _descriptor2, this); | ||
_initializerDefineProperty(this, "addBeacon", _descriptor3, this); | ||
_initializerDefineProperty(this, "farMatch", _descriptor4, this); | ||
} | ||
class MotionService extends Service { | ||
_rendezvous = []; | ||
_measurements = []; | ||
_animators = A(); | ||
_orphanObserver = null; | ||
_animationObservers = []; | ||
_descendantObservers = []; | ||
_ancestorObservers = new WeakMap(); | ||
_beacons = null; | ||
// === Notification System === | ||
@@ -197,5 +129,36 @@ | ||
// (because the act of rendering can cause animations to begin). | ||
static { | ||
m(this, "isAnimating", [computed()]); | ||
} | ||
get isAnimatingSync() { | ||
return this._animators.any(animator => animator.isAnimating); | ||
} | ||
// Invalidation support for isAnimating | ||
static { | ||
m(this, "isAnimatingSync", [computed('_animators.@each.isAnimating')]); | ||
} | ||
static { | ||
f(this, "_invalidateIsAnimating", [task(function* () { | ||
yield rAF(); | ||
this.notifyPropertyChange('isAnimating'); | ||
}).observes('isAnimatingSync')]); | ||
} | ||
#_invalidateIsAnimating = (i(this, "_invalidateIsAnimating"), void 0); | ||
static { | ||
f(this, "waitUntilIdle", [task(function* () { | ||
// we are idle if we experience two frames in a row with nothing | ||
// animating. | ||
while (true) { | ||
yield rAF(); | ||
if (!this.isAnimatingSync) { | ||
yield rAF(); | ||
if (!this.isAnimatingSync) { | ||
return; | ||
} | ||
} | ||
} | ||
})]); | ||
} | ||
#waitUntilIdle = (i(this, "waitUntilIdle"), void 0); | ||
matchDestroyed(removed, transition, duration, shouldAnimateRemoved) { | ||
@@ -216,2 +179,55 @@ if (this._orphanObserver && removed.length > 0) { | ||
} | ||
static { | ||
f(this, "addBeacon", [task(function* (name, beacon) { | ||
if (!this._beacons) { | ||
this._beacons = {}; | ||
} | ||
this._beacons[name] = beacon; | ||
// allows other farMatches to start | ||
yield microwait(); | ||
// allows other farMatches to finish | ||
yield microwait(); | ||
this._beacons = null; | ||
})]); | ||
} | ||
#addBeacon = (i(this, "addBeacon"), void 0); | ||
static { | ||
f(this, "farMatch", [task(function* (runAnimationTask, inserted, kept, removed, longWait = false) { | ||
let matches = new Map(); | ||
let mine = { | ||
inserted, | ||
kept, | ||
removed, | ||
matches, | ||
runAnimationTask, | ||
otherTasks: new Map() | ||
}; | ||
this._rendezvous.push(mine); | ||
yield microwait(); | ||
if (longWait) { | ||
// used by matchDestroyed because it gets called earlier in the | ||
// render cycle, so it needs to linger longer in order to | ||
// coincide with other farMatches. | ||
yield afterRender(); | ||
yield microwait(); | ||
yield microwait(); | ||
} | ||
if (this.farMatch.concurrency > 1) { | ||
this._rendezvous.forEach(target => { | ||
if (target === mine) { | ||
return; | ||
} | ||
performMatches(mine, target); | ||
performMatches(target, mine); | ||
}); | ||
} | ||
this._rendezvous.splice(this._rendezvous.indexOf(mine), 1); | ||
return { | ||
farMatches: matches, | ||
matchingAnimatorsFinished: allSettled([...mine.otherTasks.keys()]), | ||
beacons: this._beacons | ||
}; | ||
})]); | ||
} | ||
#farMatch = (i(this, "farMatch"), void 0); | ||
willAnimate({ | ||
@@ -292,23 +308,3 @@ task, | ||
} | ||
}, (_applyDecoratedDescriptor(_class.prototype, "isAnimating", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "isAnimating"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "isAnimatingSync", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "isAnimatingSync"), _class.prototype), _descriptor = _applyDecoratedDescriptor(_class.prototype, "_invalidateIsAnimating", [_dec3], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "waitUntilIdle", [_dec4], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "addBeacon", [_dec5], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "farMatch", [_dec6], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: null | ||
})), _class)); | ||
} | ||
function performMatches(sink, source) { | ||
@@ -315,0 +311,0 @@ sink.inserted.concat(sink.kept).forEach(sprite => { |
import { importSync } from '@embroider/macros'; | ||
import { run } from '@ember/runloop'; | ||
import { C as Color } from '../color-GikOQVbN.js'; | ||
import { C as Color } from '../color-Y2qKrpZz.js'; | ||
import { relativeBounds } from '../-private/bounds.js'; | ||
@@ -5,0 +5,0 @@ import { cumulativeTransform } from '../-private/transform.js'; |
{ | ||
"name": "ember-animated", | ||
"version": "1.1.3", | ||
"version": "2.0.0", | ||
"description": "Core animation primitives for Ember", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"types": "./declarations/*.d.ts", | ||
"default": "./dist/*" | ||
"default": "./dist/*.js" | ||
}, | ||
@@ -67,13 +67,9 @@ "./test-support": { | ||
"@embroider/macros": "^1.13.3", | ||
"@embroider/util": "^1.0.0", | ||
"assert-never": "^1.2.1", | ||
"ember-element-helper": ">=0.5.0" | ||
"decorator-transforms": "^1.0.1", | ||
"ember-element-helper": ">=0.6.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.23.3", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
"@babel/plugin-proposal-decorators": "^7.23.3", | ||
"@babel/plugin-transform-class-static-block": "^7.23.3", | ||
"@babel/plugin-transform-typescript": "^7.23.3", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@babel/core": "^7.23.6", | ||
"@babel/plugin-transform-typescript": "^7.23.6", | ||
"@babel/runtime": "^7.23.5", | ||
@@ -85,14 +81,16 @@ "@embroider/addon-dev": "^4.1.2", | ||
"@glint/environment-ember-template-imports": "^1.2.1", | ||
"@glint/template": "1.2.1", | ||
"@glint/template": "^1.2.1", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@tsconfig/ember": "^2.0.0", | ||
"@tsconfig/ember": "^3.0.3", | ||
"@types/ember": "^4.0.10", | ||
"@types/ember__application": "^4.0.10", | ||
"@types/ember__array": "^4.0.9", | ||
"@types/ember__component": "^4.0.20", | ||
"@types/ember__controller": "^4.0.10", | ||
"@types/ember__component": "^4.0.21", | ||
"@types/ember__controller": "^4.0.11", | ||
"@types/ember__debug": "^4.0.7", | ||
"@types/ember__destroyable": "^4.0.4", | ||
"@types/ember__engine": "^4.0.9", | ||
"@types/ember__engine": "^4.0.10", | ||
"@types/ember__error": "^4.0.5", | ||
"@types/ember__helper": "^4.0.5", | ||
"@types/ember__modifier": "^4.0.8", | ||
"@types/ember__object": "^4.0.11", | ||
@@ -103,22 +101,21 @@ "@types/ember__owner": "^4.0.8", | ||
"@types/ember__runloop": "^4.0.8", | ||
"@types/ember__service": "^4.0.7", | ||
"@types/ember__service": "^4.0.8", | ||
"@types/ember__string": "^3.16.3", | ||
"@types/ember__template": "^4.0.5", | ||
"@types/ember__test": "^4.0.5", | ||
"@types/ember__test-helpers": "~2.9.1", | ||
"@types/ember__utils": "^4.0.6", | ||
"@typescript-eslint/eslint-plugin": "^6.12.0", | ||
"@typescript-eslint/parser": "^6.13.1", | ||
"@typescript-eslint/eslint-plugin": "^6.14.0", | ||
"@typescript-eslint/parser": "^6.14.0", | ||
"babel-plugin-ember-template-compilation": "^2.2.1", | ||
"concurrently": "^8.2.2", | ||
"ember-template-lint": "^5.12.0", | ||
"eslint": "^8.54.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-ember": "^11.11.1", | ||
"eslint-plugin-n": "^16.3.1", | ||
"ember-template-lint": "^5.13.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-ember": "^11.12.0", | ||
"eslint-plugin-n": "^16.4.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"prettier": "^3.1.0", | ||
"prettier": "^3.1.1", | ||
"prettier-plugin-ember-template-tag": "^1.1.0", | ||
"rollup": "^4.6.1", | ||
"typescript": "^5.3.2" | ||
"rollup": "^4.9.1", | ||
"typescript": "^5.3.3" | ||
}, | ||
@@ -125,0 +122,0 @@ "peerDependencies": { |
@@ -10,3 +10,3 @@ # Ember Animated | ||
- Ember.js v3.16 or above | ||
- Ember.js v4.8 or above | ||
- Embroider or ember-auto-import v2 | ||
@@ -13,0 +13,0 @@ |
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
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
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
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
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
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
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
707957
46
203
7327
+ Addeddecorator-transforms@^1.0.1
+ Added@types/node@22.10.5(transitive)
+ Addeddecorator-transforms@1.2.1(transitive)
+ Addedes-abstract@1.23.9(transitive)
+ Addedes-set-tostringtag@2.1.0(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedis-async-function@2.1.0(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedreflect.getprototypeof@1.0.10(transitive)
+ Addedregexp.prototype.flags@1.5.4(transitive)
+ Addedset-proto@1.0.0(transitive)
- Removed@embroider/util@^1.0.0
- Removed@types/node@22.10.3(transitive)
- Removedes-abstract@1.23.8(transitive)
- Removedes-set-tostringtag@2.0.3(transitive)
- Removedget-intrinsic@1.2.6(transitive)
- Removedis-async-function@2.0.0(transitive)
- Removedis-generator-function@1.0.10(transitive)
- Removedreflect.getprototypeof@1.0.9(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
Updatedember-element-helper@>=0.6.1