Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basic-animation-stage

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-animation-stage

A panel that shows animated transitions between selection states.

  • 0.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

API Documentation

AnimationStage ⇐ ElementBase

Presents a single item as selected, providing animated transitions when the selection changes. The same animation can be shown at an arbitrary point, generally used to reflet a user-controlled touch or trackpad drag operation in progress.

Live demo

This component is intended to be used as a programmatic rendering surface for components which want to show transitional effects.

The component uses the SelectionAnimation mixin, which in turn uses the Web Animations API. For use on browsers which do not support that API natively, you will need to load the Web Animations polyfill.

For a simpler component that exhibits only a sliding effect, but does not require the Web Animations API, see basic-sliding-viewport.

Kind: global class Extends: ElementBase
Mixes: ContentAsItems , DistributedChildrenAsContent , ItemsSelection , ObserveContentChanges , SelectionAnimation , SelectionAriaActive

animationStage.applySelection(item, selected)

Apply the selection state to a single item.

Invoke this method to signal that the selected state of the indicated item has changed. By default, this applies a selected CSS class if the item is selected, and removed it if not selected.

Kind: instance method of AnimationStage. Defined by ContentAsItems mixin.

ParamTypeDescription
itemHTMLElementThe item whose selection state has changed.
selectedbooleanTrue if the item is selected, false if not.

animationStage.applySelection(item, selected)

Apply the indicate selection state to the item.

The default implementation of this method does nothing. User-visible effects will typically be handled by other mixins.

Kind: instance method of AnimationStage. Defined by ItemsSelection mixin.

ParamTypeDescription
itemHTMLElementthe item being selected/deselected
selectedbooleantrue if the item is selected, false if not

animationStage.canSelectNext : boolean

True if the selection can be moved to the next item, false if not (the selected item is the last item in the list).

Kind: instance property of AnimationStage. Defined by ItemsSelection mixin.

animationStage.canSelectPrevious : boolean

True if the selection can be moved to the previous item, false if not (the selected item is the first one in the list).

Kind: instance property of AnimationStage. Defined by ItemsSelection mixin.

animationStage.content : Array.<HTMLElement>

The content of this component, defined to be the flattened array of children distributed to the component.

Kind: instance property of AnimationStage. Defined by DistributedChildrenAsContent mixin.

"content-changed"

This event is raised when the component's contents (including distributed children) have changed.

Kind: event emitted by AnimationStage. Defined by ObserveContentChanges mixin.

animationStage.contentChanged()

Invoked when the contents of the component (including distributed children) have changed.

This method is also invoked when a component is first instantiated; the contents have essentially "changed" from being nothing. This allows the component to perform initial processing of its children.

Kind: instance method of AnimationStage. Defined by ObserveContentChanges mixin.

animationStage.itemAdded(item)

Handle a new item being added to the list.

The default implementation of this method simply sets the item's selection state to false.

Kind: instance method of AnimationStage. Defined by ItemsSelection mixin.

ParamTypeDescription
itemHTMLElementthe item being added

animationStage.itemAdded(item)

This method is invoked whenever a new item is added to the list.

The default implementation of this method does nothing. You can override this to perform per-item initialization.

Kind: instance method of AnimationStage. Defined by ContentAsItems mixin.

ParamTypeDescription
itemHTMLElementThe item that was added.

animationStage.items : Array.<HTMLElement>

The current set of items in the list. See the top-level documentation for mixin for a description of how items differ from plain content.

Kind: instance property of AnimationStage. Defined by ContentAsItems mixin.

"items-changed"

Fires when the items in the list change.

Kind: event emitted by AnimationStage. Defined by ContentAsItems mixin.

animationStage.itemsChanged()

This method is invoked when the underlying contents change. It is also invoked on component initialization – since the items have "changed" from being nothing.

Kind: instance method of AnimationStage. Defined by ContentAsItems mixin.

"selected-index-changed"

Fires when the selectedIndex property changes.

Kind: event emitted by AnimationStage. Defined by ItemsSelection mixin.

ParamTypeDescription
detail.selectedIndexnumberThe new selected index.

"selected-item-changed"

Fires when the selectedItem property changes.

Kind: event emitted by AnimationStage. Defined by ItemsSelection mixin.

ParamTypeDescription
detail.selectedItemHTMLElementThe new selected item.
detail.previousItemHTMLElementThe previously selected item.

animationStage.selectedFraction : number

A fractional value indicating how far the user has currently advanced to the next/previous item. E.g., a selectedFraction of 3.5 indicates the user is halfway between items 3 and 4.

For more details, see the FractionalSelection mixin.

Kind: instance property of AnimationStage. Defined by SelectionAnimation mixin.

animationStage.selectedIndex : number

The index of the item which is currently selected.

If selectionWraps is false, the index is -1 if there is no selection. In that case, setting the index to -1 will deselect any currently-selected item.

Kind: instance property of AnimationStage. Defined by ItemsSelection mixin.

animationStage.selectedItem : object

The currently selected item, or null if there is no selection.

Setting this property to null deselects any currently-selected item.

Kind: instance property of AnimationStage. Defined by ItemsSelection mixin.

animationStage.selectFirst()

Select the first item in the list.

Kind: instance method of AnimationStage. Defined by ItemsSelection mixin.

animationStage.selectionAnimationDuration : number

The duration of a selection animation in milliseconds.

This measures the amount of time required for a selection animation to complete. This number remains constant, even if the number of items being animated increases.

The default value is 250 milliseconds (a quarter a second).

Kind: instance property of AnimationStage. Defined by SelectionAnimation mixin. Default: 250

animationStage.selectionAnimationEffect : string

The name of a standard selection animation effect.

This is a shorthand for setting the selectionAnimationKeyframes property to standard keyframes. Supported string values:

  • "crossfade"

  • "reveal"

  • "revealWithFade"

  • "showAdjacent"

  • "slide"

  • "slideWithGap"

    Kind: instance property of AnimationStage. Defined by SelectionAnimation mixin. Default: "&quot;slide&quot;"

animationStage.selectionAnimationKeyframes : Array.<cssRules>

The keyframes that define an animation that plays for an item when moving forward in the sequence.

This is an array of CSS rules that will be applied. These are used as keyframes to animate the item with the Web Animations API.

The animation represents the state of the next item as it moves from completely unselected (offstage, usually right), to selected (center stage), to completely unselected (offstage, usually left). The center time of the animation should correspond to the item's quiscent selected state, typically in the center of the stage and at the item's largest size.

The default forward animation is a smooth slide at full size from right to left.

When moving the selection backward, this animation is played in reverse.

Kind: instance property of AnimationStage. Defined by SelectionAnimation mixin.

animationStage.selectionRequired : boolean

True if the list should always have a selection (if it has items).

Kind: instance property of AnimationStage. Defined by ItemsSelection mixin. Default: false

animationStage.selectionWraps : boolean

True if selection navigations wrap from last to first, and vice versa.

Kind: instance property of AnimationStage. Defined by ItemsSelection mixin. Default: false

animationStage.selectLast()

Select the last item in the list.

Kind: instance method of AnimationStage. Defined by ItemsSelection mixin.

animationStage.selectNext()

Select the next item in the list.

Kind: instance method of AnimationStage. Defined by ItemsSelection mixin.

animationStage.selectPrevious()

Select the previous item in the list.

Kind: instance method of AnimationStage. Defined by ItemsSelection mixin.

animationStage.showTransition : boolean

Determine whether a transition should be shown during selection.

Components like carousels often define animated CSS transitions for sliding effects. Such a transition should usually not be applied while the user is dragging, because a CSS animation will introduce a lag that makes the swipe feel sluggish. Instead, as long as the user is dragging with their finger down, the transition should be suppressed. When the user releases their finger, the transition can be restored, allowing the animation to show the carousel sliding into its final position.

Note: This property is only intended to let a component cooperate with mixins that may be applied to it, and is not intended to let someone using component permanently enable or disable transition effects.

Kind: instance property of AnimationStage. Defined by SelectionAnimation mixin.

Keywords

FAQs

Package last updated on 02 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc