Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace @swim/view

@swim/view

package documentation chat

@swim/view provides a unified HTML, SVG, and Canvas view hierarchy, with integrated controller architecture, animated procedural styling, and constraint-based layouts. @swim/view is part of the @swim/ui framework.

Installation

npm

For an npm-managed project, npm install @swim/view to make it a dependency. TypeScript sources will be installed into node_modules/@swim/view/main. Transpiled JavaScript and TypeScript definition files install into node_modules/@swim/view/lib/main. And a pre-built UMD script can be found in node_modules/@swim/view/dist/main/swim-view.js.

Browser

Browser applications can load swim-ui.js—which bundles the @swim/view library—along with its swim-core.js dependency, directly from the SwimOS CDN.

<!-- Development -->
<script src="https://cdn.swimos.org/js/latest/swim-core.js"></script>
<script src="https://cdn.swimos.org/js/latest/swim-ui.js"></script>

<!-- Production -->
<script src="https://cdn.swimos.org/js/latest/swim-core.min.js"></script>
<script src="https://cdn.swimos.org/js/latest/swim-ui.min.js"></script>

Alternatively, the swim-toolkit.js script may be loaded, along with its swim-system.js dependency, from the SwimOS CDN. The swim-toolkit.js script bundles @swim/view together with all other @swim/toolkit frameworks.

<!-- Development -->
<script src="https://cdn.swimos.org/js/latest/swim-system.js"></script>
<script src="https://cdn.swimos.org/js/latest/swim-toolkit.js"></script>

<!-- Production -->
<script src="https://cdn.swimos.org/js/latest/swim-system.min.js"></script>
<script src="https://cdn.swimos.org/js/latest/swim-toolkit.min.js"></script>

Usage

ES6/TypeScript

@swim/view can be imported as an ES6 module from TypeScript and other ES6-compatible environments.

import * as view from "@swim/view";

CommonJS/Node.js

@swim/view can also be used as a CommonJS module in Node.js applications.

var view = require("@swim/view");

Browser

When loaded by a web browser, the swim-ui.js script adds all @swim/view library exports to the global swim namespace. The swim-ui.js script requires that swim-core.js has already been loaded.

The swim-toolkit.js script also adds all @swim/view library exports to the global swim namespace, making it a drop-in replacement for swim-ui.js and swim-view.js when additional @swim/toolkit frameworks are needed.

Index

Classes

Interfaces

Type aliases

Variables

Type aliases

AttributeAnimatorType

AttributeAnimatorType: typeof String | typeof Boolean | typeof Number | typeof Length | typeof Color | typeof Transform | [typeof Number, typeof String] | [typeof Length, typeof String] | [typeof Color, typeof String]

LayoutAnchorGetState

LayoutAnchorGetState<S>: (this: S, oldState: number) => number

Type parameters

Type declaration

    • (this: S, oldState: number): number
    • Parameters

      • this: S
      • oldState: number

      Returns number

LayoutAnchorSetValue

LayoutAnchorSetValue<S>: (this: S, newValue: number) => void

Type parameters

Type declaration

    • (this: S, newValue: number): void
    • Parameters

      • this: S
      • newValue: number

      Returns void

MemberAnimatorDescriptorType

MemberAnimatorDescriptorType<V, C>: C extends typeof Transform ? MemberAnimatorDescriptor<V, Transform | null, AnyTransform | null> : C extends typeof Font ? MemberAnimatorDescriptor<V, Font | null, AnyFont | null> : C extends typeof Color ? MemberAnimatorDescriptor<V, Color | null, AnyColor | null> : C extends typeof Length ? MemberAnimatorDescriptor<V, Length | null, AnyLength | null> : C extends typeof Angle ? MemberAnimatorDescriptor<V, Angle | null, AnyAngle | null> : C extends typeof Number ? MemberAnimatorDescriptor<V, number | null, number | string | null> : C extends typeof Boolean ? MemberAnimatorDescriptor<V, boolean | null, boolean | string | null> : C extends typeof String ? MemberAnimatorDescriptor<V, string | null> : C extends typeof Object ? MemberAnimatorDescriptor<V, Object> : C extends FromAny<any> ? MemberAnimatorDescriptor<V, any> : MemberAnimatorDescriptor<V, any>

Type parameters

MemberAnimatorInit

MemberAnimatorInit<V, T>: (this: V) => T | undefined

Type parameters

Type declaration

    • (this: V): T | undefined
    • Parameters

      • this: V

      Returns T | undefined

MemberAnimatorTypeConstructor

MemberAnimatorTypeConstructor: FromAny<any> | typeof Object | typeof String | typeof Boolean | typeof Number | typeof Angle | typeof Length | typeof Color | typeof Font | typeof Transform

ModalState

ModalState: "hidden" | "showing" | "shown" | "hiding"

StyleAnimatorType

StyleAnimatorType: typeof String | typeof Number | typeof Length | typeof Color | typeof LineHeight | typeof FontFamily | typeof BoxShadow | typeof Transform | [typeof Number, typeof String] | [typeof Length, typeof String] | [typeof Color, typeof String]

ViewControllerType

ViewControllerType<V>: V extends { viewController: infer VC } ? VC : unknown

Type parameters

ViewFlags

ViewFlags: number

ViewIdiom

ViewIdiom: "unspecified" | "mobile" | "tablet" | "desktop"

ViewNodeType

ViewNodeType<V>: V extends { node: infer N } ? N : Node

Type parameters

ViewScopeInit

ViewScopeInit<V, T>: (this: V) => T

Type parameters

Type declaration

    • (this: V): T
    • Parameters

      • this: V

      Returns T

ViewportColorScheme

ViewportColorScheme: "dark" | "light" | "no-preference"

Variables

Const AttributeAnimator

AttributeAnimator: AttributeAnimatorClass = (function (_super: typeof TweenFrameAnimator): AttributeAnimatorClass {function AttributeAnimatorDecoratorFactory(attributeName: string, animatorType: AttributeAnimatorType): PropertyDecorator {if (animatorType === String) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.String, attributeName);} else if (animatorType === Boolean) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.Boolean, attributeName);} else if (animatorType === Number) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.Number, attributeName);} else if (animatorType === Length) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.Length, attributeName);} else if (animatorType === Color) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.Color, attributeName);} else if (animatorType === Transform) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.Transform, attributeName);} else if (Array.isArray(animatorType) && animatorType.length === 2) {const [type0, type1] = animatorType;if (type0 === Number && type1 === String) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.NumberOrString, attributeName);} else if (type0 === Length && type1 === String) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.LengthOrString, attributeName);} else if (type0 === Color && type1 === String) {return ElementView.decorateAttributeAnimator.bind(void 0, AttributeAnimator.ColorOrString, attributeName);}}throw new TypeError("" + animatorType);}function AttributeAnimatorConstructor<V extends ElementView, T, U = T>(this: AttributeAnimator<V, T, U>, view: V, animatorName: string,attributeName: string): AttributeAnimator<V, T, U> {Object.defineProperty(this, "name", {value: animatorName,enumerable: true,configurable: true,});this._view = view;this._attributeName = attributeName;this._auto = true;const _this = _super.call(this, void 0, null) || this;return _this;}const AttributeAnimator: AttributeAnimatorClass = function <V extends ElementView, T, U>(this: AttributeAnimator<V, T, U> | AttributeAnimatorClass,view: V | string,animatorName: string | AttributeAnimatorType,attributeName: string): AttributeAnimator<V, T, U> | PropertyDecorator {if (this instanceof AttributeAnimator) { // constructorreturn AttributeAnimatorConstructor.call(this, view, animatorName, attributeName);} else { // decorator factoryattributeName = view as string;const animatorType = animatorName as AttributeAnimatorType;return AttributeAnimatorDecoratorFactory(attributeName, animatorType);}} as AttributeAnimatorClass;__extends(AttributeAnimator, _super);Object.defineProperty(AttributeAnimator.prototype, "view", {get: function (this: AttributeAnimator<ElementView, unknown, unknown>): ElementView {return this._view;},enumerable: true,configurable: true,});Object.defineProperty(AttributeAnimator.prototype, "node", {get: function (this: AttributeAnimator<ElementView, unknown, unknown>): Element {return this._view._node;},enumerable: true,configurable: true,});Object.defineProperty(AttributeAnimator.prototype, "attributeName", {get: function (this: AttributeAnimator<ElementView, unknown, unknown>): string {return this._attributeName;},enumerable: true,configurable: true,});Object.defineProperty(AttributeAnimator.prototype, "attributeValue", {get: function <T, U>(this: AttributeAnimator<ElementView, T, unknown>): T | undefined {const value = this._view.getAttribute(this._attributeName);if (value !== null) {try {return this.parse(value);} catch (e) {// swallow parse errors}}return void 0;},enumerable: true,configurable: true,});Object.defineProperty(AttributeAnimator.prototype, "value", {get: function <T, U>(this: AttributeAnimator<ElementView, T, U>): T | undefined {let value = this._value;if (value === void 0) {value = this.attributeValue;if (value !== void 0) {this.setAuto(false);}}return value;},enumerable: true,configurable: true,});AttributeAnimator.prototype.isAuto = function (this: AttributeAnimator<ElementView, unknown, unknown>): boolean {return this._auto;};AttributeAnimator.prototype.setAuto = function (this: AttributeAnimator<ElementView, unknown, unknown>,auto: boolean): void {if (this._auto !== auto) {this._auto = auto;this._view.animatorDidSetAuto(this, auto);}};AttributeAnimator.prototype.setState = function <T, U>(this: AttributeAnimator<ElementView, T, U>,state: T | U | undefined, tween?: Tween<T>): void {if (state !== void 0) {state = this.fromAny(state);}this._auto = false;_super.prototype.setState.call(this, state, tween);};AttributeAnimator.prototype.setAutoState = function <T, U>(this: AttributeAnimator<ElementView, T, U>,state: T | U | undefined, tween?: Tween<T>): void {if (this._auto === true) {if (state !== void 0) {state = this.fromAny(state);}_super.prototype.setState.call(this, state, tween);}};AttributeAnimator.prototype.update = function <T, U>(this: AttributeAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {if (!Objects.equal(oldValue, newValue)) {this.willUpdate(newValue, oldValue);this.onUpdate(newValue, oldValue);this.didUpdate(newValue, oldValue);}};AttributeAnimator.prototype.willUpdate = function <T, U>(this: AttributeAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};AttributeAnimator.prototype.onUpdate = function <T, U>(this: AttributeAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {this._view.setAttribute(this._attributeName, newValue);};AttributeAnimator.prototype.didUpdate = function <T, U>(this: AttributeAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};AttributeAnimator.prototype.delete = function <T, U>(this: AttributeAnimator<ElementView, T, U>): void {this._view.setAttribute(this._attributeName, void 0);};AttributeAnimator.prototype.parse = function <T, U>(this: AttributeAnimator<ElementView, T, U>, value: string): T {throw new Error(); // abstract};AttributeAnimator.prototype.fromAny = function <T, U>(this: AttributeAnimator<ElementView, T, U>, value: T | U): T {throw new Error(); // abstract};return AttributeAnimator;}(TweenFrameAnimator))

Const LayoutAnchor

LayoutAnchor: LayoutAnchorClass = (function (_super: typeof ConstrainBinding): LayoutAnchorClass {function LayoutAnchorDecoratorFactory<S extends LayoutScope>(descriptor: LayoutAnchorDescriptor<S>): PropertyDecorator {return View.decorateLayoutAnchor.bind(void 0, LayoutAnchor, descriptor);}function LayoutAnchorConstructor<S extends LayoutScope>(this: LayoutAnchor<S>, scope: S, anchorName: string, value: number,strength: ConstraintStrength, enabled?: boolean): LayoutAnchor<S> {if (enabled === void 0) {enabled = false;}const _this = _super.call(this, scope, anchorName, value, strength) || this;_this._enabled = enabled;return _this;}const LayoutAnchor: LayoutAnchorClass = function <S extends LayoutScope>(this: LayoutAnchor<S> | LayoutAnchorClass,scope: S | LayoutAnchorDescriptor<S>,anchorName?: string,value?: number,strength?: ConstraintStrength,enabled?: boolean): LayoutAnchor<S> | PropertyDecorator {if (this instanceof LayoutAnchor) { // constructorlet _this: LayoutAnchor<S> = function accessor(state?: number): number | S {if (state === void 0) {return _this.state;} else {_this.enabled(true).setState(state);return _this._scope;}} as LayoutAnchor<S>;(_this as any).__proto__ = this;_this = LayoutAnchorConstructor.call(this, scope, anchorName, value, strength, enabled);return _this;} else { // decorator factoryconst descriptor = scope as LayoutAnchorDescriptor<S>;return LayoutAnchorDecoratorFactory(descriptor);}} as LayoutAnchorClass;__extends(LayoutAnchor, _super);LayoutAnchor.prototype.enabled = function <S extends LayoutScope>(this: LayoutAnchor<S>, enabled?: boolean): boolean | LayoutAnchor<S> {if (enabled === void 0) {return this._enabled;} else {this._enabled = enabled;return this;}};LayoutAnchor.prototype.updateValue = function <S extends LayoutScope>(this: LayoutAnchor<S>, newValue: number): void {const oldValue = this._value;if (oldValue !== newValue) {this._value = newValue;if (this._enabled) {const setValue = this.setValue;if (setValue !== void 0) {setValue.call(this._scope, newValue);}}}};LayoutAnchor.prototype.updateState = function <S extends LayoutScope>(this: LayoutAnchor<S>): void {if (!this._enabled) {const getState = this.getState;if (getState !== void 0) {const oldState = this._state;const newState = getState.call(this._scope, oldState);this.setState(newState);}}};return LayoutAnchor;}(ConstrainBinding))

Const MemberAnimator

MemberAnimator: MemberAnimatorClass = (function (_super: typeof TweenAnimator): MemberAnimatorClass {function MemberAnimatorDecoratorFactory<V extends AnimatedView, C extends MemberAnimatorTypeConstructor>(valueType: C, descriptor?: MemberAnimatorDescriptorType<V, C>): PropertyDecorator {if (descriptor === void 0) {descriptor = {} as MemberAnimatorDescriptorType<V, C>;}let animatorType = descriptor.animatorType;if (animatorType === void 0) {if (valueType === Object) {animatorType = MemberAnimator.Object;} else if (valueType === String) {animatorType = MemberAnimator.String;} else if (valueType === Boolean) {animatorType = MemberAnimator.Boolean;} else if (valueType === Number) {animatorType = MemberAnimator.Number;} else if (valueType === Angle) {animatorType = MemberAnimator.Angle;} else if (valueType === Length) {animatorType = MemberAnimator.Length;} else if (valueType === Color) {animatorType = MemberAnimator.Color;} else if (valueType === Font) {animatorType = MemberAnimator.Font;} else if (valueType === Transform) {animatorType = MemberAnimator.Transform;} else if (FromAny.is(valueType)) {animatorType = MemberAnimator.Any.bind(void 0, valueType);} else {throw new TypeError("" + valueType);}descriptor.animatorType = animatorType;}return AnimatedView.decorateMemberAnimator.bind(void 0, animatorType, descriptor);}function MemberAnimatorConstructor<V extends AnimatedView, T, U = T>(this: MemberAnimator<V, T, U>, view: V, animatorName: string | undefined,value?: T | U, transition?: Transition<T> | null, inherit?: string | null): MemberAnimator<V, T, U> {if (transition === void 0) {transition = null;}if (inherit === void 0) {inherit = null;}if (animatorName !== void 0) {Object.defineProperty(this, "name", {value: animatorName,enumerable: true,configurable: true,});}this._view = view;this._inherit = inherit;this._auto = true;if (value !== void 0) {value = this.fromAny(value);}const _this = _super.call(this, value, transition) || this;return _this;}const MemberAnimator: MemberAnimatorClass = function <V extends AnimatedView, T, U>(this: MemberAnimator<V, T, U> | MemberAnimatorClass,view: V | MemberAnimatorTypeConstructor,animatorName?: string | MemberAnimatorDescriptor<V, T, U>,value?: T | U,transition?: Transition<T> | null,inherit?: string | null): MemberAnimator<V, T, U> | PropertyDecorator {if (this instanceof MemberAnimator) { // constructorreturn MemberAnimatorConstructor.call(this, view, animatorName, value, transition, inherit);} else { // decorator factoryconst valueType = view as MemberAnimatorTypeConstructor;const descriptor = animatorName as MemberAnimatorDescriptor<V, T, U> | undefined;return MemberAnimatorDecoratorFactory(valueType, descriptor);}} as MemberAnimatorClass;__extends(MemberAnimator, _super);Object.defineProperty(MemberAnimator.prototype, "view", {get: function (this: MemberAnimator<AnimatedView, unknown, unknown>): AnimatedView {return this._view;},enumerable: true,configurable: true,});Object.defineProperty(MemberAnimator.prototype, "inherit", {get: function (this: MemberAnimator<AnimatedView, unknown, unknown>): string | null {return this._inherit;},enumerable: true,configurable: true,});Object.defineProperty(MemberAnimator.prototype, "superAnimator", {get: function <T, U>(this: MemberAnimator<AnimatedView, T, U>): MemberAnimator<AnimatedView, T, U> | null {const inherit = this._inherit;if (inherit !== null) {let view = this._view.parentView;while (view !== null) {if (AnimatedView.is(view)) {const animator = view.getLazyMemberAnimator(inherit);if (animator instanceof MemberAnimator) {return animator;}}view = view.parentView;}}return null;},enumerable: true,configurable: true,});Object.defineProperty(MemberAnimator.prototype, "superValue", {get: function <T, U>(this: MemberAnimator<AnimatedView, T, U>): T | undefined {const superAnimator = this.superAnimator;return superAnimator !== null ? superAnimator.value : void 0;},enumerable: true,configurable: true,});Object.defineProperty(MemberAnimator.prototype, "superState", {get: function <T, U>(this: MemberAnimator<AnimatedView, T, U>): T | undefined {const superAnimator = this.superAnimator;return superAnimator !== null ? superAnimator.state : void 0;},enumerable: true,configurable: true,});Object.defineProperty(MemberAnimator.prototype, "value", {get: function <T, U>(this: MemberAnimator<AnimatedView, T, U>): T | undefined {const value = this._value;return value !== void 0 ? value : this.superValue;},enumerable: true,configurable: true,});Object.defineProperty(MemberAnimator.prototype, "state", {get: function <T, U>(this: MemberAnimator<AnimatedView, T, U>): T | undefined {const state = this._state;return state !== void 0 ? state : this.superState;},enumerable: true,configurable: true,});MemberAnimator.prototype.isAuto = function (this: MemberAnimator<AnimatedView, unknown, unknown>): boolean {return this._auto;};MemberAnimator.prototype.setAuto = function (this: MemberAnimator<AnimatedView, unknown, unknown>,auto: boolean): void {if (this._auto !== auto) {this._auto = auto;this._view.animatorDidSetAuto(this, auto);}};MemberAnimator.prototype.setState = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,state: T | U | undefined,tween?: Tween<T>): void {if (state !== void 0) {state = this.fromAny(state);}this._auto = false;_super.prototype.setState.call(this, state, tween);};MemberAnimator.prototype.setAutoState = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,state: T | U | undefined,tween?: Tween<T>): void {if (this._auto === true) {if (state !== void 0) {state = this.fromAny(state);}_super.prototype.setState.call(this, state, tween);}};MemberAnimator.prototype.animate = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,animator: Animator = this): void {if (this._enabled || animator !== this) {this._view.animate(animator);}};MemberAnimator.prototype.update = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,newValue: T | undefined, oldValue: T | undefined): void {if (!Objects.equal(oldValue, newValue)) {this.willUpdate(newValue, oldValue);this.onUpdate(newValue, oldValue);this.didUpdate(newValue, oldValue);}};MemberAnimator.prototype.willUpdate = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};MemberAnimator.prototype.onUpdate = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};MemberAnimator.prototype.didUpdate = function <T, U>(this: MemberAnimator<AnimatedView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};MemberAnimator.prototype.cancel = function <T, U>(this: MemberAnimator<AnimatedView, T, U>): void {// nop};MemberAnimator.prototype.delete = function <T, U>(this: MemberAnimator<AnimatedView, T, U>): void {// nop};MemberAnimator.prototype.fromAny = function <T, U>(this: MemberAnimator<AnimatedView, T, U>, value: T | U): T {throw new Error(); // abstract};return MemberAnimator;}(TweenAnimator))

Const StyleAnimator

StyleAnimator: StyleAnimatorClass = (function (_super: typeof TweenFrameAnimator): StyleAnimatorClass {function StyleAnimatorDecoratorFactory(propertyNames: string | ReadonlyArray<string>,animatorType: StyleAnimatorType): PropertyDecorator {if (animatorType === String) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.String, propertyNames);} else if (animatorType === Number) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.Number, propertyNames);} else if (animatorType === Length) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.Length, propertyNames);} else if (animatorType === Color) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.Color, propertyNames);} else if (animatorType === LineHeight) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.LineHeight, propertyNames);} else if (animatorType === FontFamily) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.FontFamily, propertyNames);} else if (animatorType === BoxShadow) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.BoxShadow, propertyNames);} else if (animatorType === Transform) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.Transform, propertyNames);} else if (Array.isArray(animatorType) && animatorType.length === 2) {const [type0, type1] = animatorType;if (type0 === Number && type1 === String) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.NumberOrString, propertyNames);} else if (type0 === Length && type1 === String) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.LengthOrString, propertyNames);} else if (type0 === Color && type1 === String) {return ElementView.decorateStyleAnimator.bind(void 0, StyleAnimator.ColorOrString, propertyNames);}}throw new TypeError("" + animatorType);}function StyleAnimatorConstructor<V extends ElementView, T, U = T>(this: StyleAnimator<V, T, U>, view: V, animatorName: string,propertyNames: string | ReadonlyArray<string>): StyleAnimator<V, T, U> {Object.defineProperty(this, "name", {value: animatorName,enumerable: true,configurable: true,});this._view = view;this._propertyNames = propertyNames;this._auto = true;const _this = _super.call(this, void 0, null) || this;return _this;}const StyleAnimator: StyleAnimatorClass = function <V extends ElementView, T, U>(this: StyleAnimator<V, T, U> | StyleAnimatorClass,view: V | string | ReadonlyArray<string>,animatorName: string | StyleAnimatorType,propertyNames: string | ReadonlyArray<string>): StyleAnimator<V, T, U> | PropertyDecorator {if (this instanceof StyleAnimator) { // constructorreturn StyleAnimatorConstructor.call(this, view, animatorName, propertyNames);} else { // decorator factorypropertyNames = view as string | ReadonlyArray<string>;const animatorType = animatorName as StyleAnimatorType;return StyleAnimatorDecoratorFactory(propertyNames, animatorType);}} as StyleAnimatorClass;__extends(StyleAnimator, _super);Object.defineProperty(StyleAnimator.prototype, "view", {get: function (this: StyleAnimator<ElementView, unknown, unknown>): ElementView {return this._view;},enumerable: true,configurable: true,});Object.defineProperty(StyleAnimator.prototype, "node", {get: function (this: StyleAnimator<ElementView, unknown, unknown>): StyledElement {return this._view._node;},enumerable: true,configurable: true,});Object.defineProperty(StyleAnimator.prototype, "propertyNames", {get: function (this: StyleAnimator<ElementView, unknown, unknown>): string | ReadonlyArray<string> {return this._propertyNames;},enumerable: true,configurable: true,});Object.defineProperty(StyleAnimator.prototype, "propertyValue", {get: function <T, U>(this: StyleAnimator<ElementView, T, U>): T | undefined {const value = this._view.getStyle(this._propertyNames);if (value !== "") {try {return this.parse(value);} catch (e) {// swallow parse errors}}return void 0;},enumerable: true,configurable: true,});Object.defineProperty(StyleAnimator.prototype, "priority", {get: function (this: StyleAnimator<ElementView, unknown, unknown>): string | undefined {return this._priority;},set: function (this: StyleAnimator<ElementView, unknown, unknown>, value: string | undefined): void {this._priority = value;},enumerable: true,configurable: true,});Object.defineProperty(StyleAnimator.prototype, "value", {get: function <T, U>(this: StyleAnimator<ElementView, T, U>): T | undefined {let value = this._value;if (value === void 0) {value = this.propertyValue;if (value !== void 0) {this.setAuto(false);}}return value;},enumerable: true,configurable: true,});StyleAnimator.prototype.isAuto = function (this: StyleAnimator<ElementView, unknown, unknown>): boolean {return this._auto;};StyleAnimator.prototype.setAuto = function (this: StyleAnimator<ElementView, unknown, unknown>,auto: boolean): void {if (this._auto !== auto) {this._auto = auto;this._view.animatorDidSetAuto(this, auto);}};StyleAnimator.prototype.setState = function <T, U>(this: StyleAnimator<ElementView, T, U>,state: T | U | undefined, tween?: Tween<T>,priority?: string): void {if (state !== void 0) {state = this.fromAny(state);}if (priority !== void 0) {if (priority !== "") {this._priority = priority;} else if (this._priority !== void 0) {this._priority = void 0;}}this._auto = false;_super.prototype.setState.call(this, state, tween);};StyleAnimator.prototype.setAutoState = function <T, U>(this: StyleAnimator<ElementView, T, U>,state: T | U | undefined, tween?: Tween<T>,priority?: string): void {if (this._auto === true) {if (state !== void 0) {state = this.fromAny(state);}if (priority !== void 0) {if (priority !== "") {this._priority = priority;} else if (this._priority !== void 0) {this._priority = void 0;}}_super.prototype.setState.call(this, state, tween);}};StyleAnimator.prototype.update = function <T, U>(this: StyleAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {if (!Objects.equal(oldValue, newValue)) {this.willUpdate(newValue, oldValue);this.onUpdate(newValue, oldValue);this.didUpdate(newValue, oldValue);}};StyleAnimator.prototype.willUpdate = function <T, U>(this: StyleAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};StyleAnimator.prototype.onUpdate = function <T, U>(this: StyleAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {const propertyNames = this._propertyNames;if (typeof propertyNames === "string") {this._view.setStyle(propertyNames, newValue, this._priority);} else {for (let i = 0, n = propertyNames.length; i < n; i += 1) {this._view.setStyle(propertyNames[i], newValue, this._priority);}}};StyleAnimator.prototype.didUpdate = function <T, U>(this: StyleAnimator<ElementView, T, U>,newValue: T | undefined,oldValue: T | undefined): void {// hook};StyleAnimator.prototype.delete = function <T, U>(this: StyleAnimator<ElementView, T, U>): void {const propertyNames = this._propertyNames;if (typeof propertyNames === "string") {this._view.setStyle(propertyNames, void 0);} else {for (let i = 0, n = propertyNames.length; i < n; i += 1) {this._view.setStyle(propertyNames[i], void 0);}}};StyleAnimator.prototype.parse = function <T, U>(this: StyleAnimator<ElementView, T, U>, value: string): T {throw new Error(); // abstract};StyleAnimator.prototype.fromAny = function <T, U>(this: StyleAnimator<ElementView, T, U>, value: T | U): T {throw new Error(); // abstract};return StyleAnimator;}(TweenFrameAnimator))

Const ViewScope

ViewScope: ViewScopeClass = (function (_super: typeof Object): ViewScopeClass {function ViewScopeDecorator(viewClass: ViewClass, scopeName: string): void {const scopeType = ViewScope.Atomic;const descriptor: ViewScopeDescriptor<View, unknown> = {scopeType};View.decorateViewScope(scopeType, descriptor, viewClass, scopeName);}function ViewScopeDecoratorFactory<V extends View, T>(descriptor?: ViewScopeDescriptor<V, T>): PropertyDecorator {if (descriptor === void 0) {descriptor = {};}let scopeType = descriptor.scopeType;if (scopeType === void 0) {scopeType = ViewScope.Atomic;descriptor.scopeType = scopeType;}return View.decorateViewScope.bind(void 0, scopeType, descriptor);}function ViewScopeConstructor<V extends View, T>(this: ViewScope<V, T>, view: V, scopeName: string,value?: T, inherit?: string | null): ViewScope<V, T> {if (inherit === void 0) {inherit = null;}Object.defineProperty(this, "name", {value: scopeName,enumerable: true,configurable: true,});this._view = view;this._inherit = inherit;return this;}const ViewScope: ViewScopeClass = function <V extends View, T>(this: ViewScope<V, T> | unknown,view?: V | ViewScopeDescriptor<V, T> | unknown,scopeName?: string,value?: T,inherit?: string | null): ViewScope<V, T> | PropertyDecorator | void {if (this instanceof ViewScope) { // constructorreturn ViewScopeConstructor.call(this, view, scopeName, value, inherit);} else if (arguments.length === 1) { // decorator factoryconst descriptor = view as ViewScopeDescriptor<V, T> | undefined;return ViewScopeDecoratorFactory(descriptor);} else { // decoratorconst viewClass = view as ViewClass;ViewScopeDecorator(viewClass, scopeName!);}} as ViewScopeClass;__extends(ViewScope, _super);Object.defineProperty(ViewScope.prototype, "view", {get: function <V extends View, T>(this: ViewScope<V, T>): V {return this._view;},enumerable: true,configurable: true,});Object.defineProperty(ViewScope.prototype, "inherit", {get: function (this: ViewScope<View, unknown>): string | null {return this._inherit;},enumerable: true,configurable: true,});Object.defineProperty(ViewScope.prototype, "superScope", {get: function <T>(this: ViewScope<View, T>): ViewScope<View, T> | null {const inherit = this._inherit;if (inherit !== null) {let view = this._view.parentView;while (view !== null) {const viewScope = view.getLazyViewScope(inherit) as ViewScope<View, T> | null;if (viewScope !== null) {return viewScope;}view = view.parentView;}}return null;},enumerable: true,configurable: true,});Object.defineProperty(ViewScope.prototype, "superState", {get: function <T>(this: ViewScope<View, T>): T | undefined {const superScope = this.superScope;return superScope !== null ? superScope.state : void 0;},enumerable: true,configurable: true,});Object.defineProperty(ViewScope.prototype, "state", {get: function <T>(this: ViewScope<View, T>): T | undefined {throw new Error(); // abstract},enumerable: true,configurable: true,});ViewScope.prototype.setState = function <T>(this: ViewScope<View, T>, newState: T | undefined): void {throw new Error(); // abstract};return ViewScope;}(Object))