@octane-xplat/lottie 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,286 +0,0 @@
1
- import { LottieViewBase, autoPlayProperty, keyPathColorsProperty, loopProperty, progressProperty, renderModeProperty, srcProperty, stretchProperty } from "./src/lottie/index.common.js";
2
- import { clamp } from "./src/lottie/utils.js";
3
- import { Color, File, Http, Utils, knownFolders, path } from "@nativescript/core";
4
- //#region src/vendor/ui-lottie/src/lottie/index.android.ts
5
- /**********************************************************************************
6
- * (c) 2017, Brad Martin.
7
- * Licensed under the MIT license.
8
- *
9
- * Version 1.0.0 bradwaynemartin@gmail.com
10
- **********************************************************************************/
11
- var LottieProperty;
12
- var LottieKeyPath;
13
- var LottieValueCallback;
14
- var LottieCompositionFactory;
15
- var cache = /* @__PURE__ */ new Map();
16
- async function loadLottieJSON(iconSrc) {
17
- if (!cache.has(iconSrc)) {
18
- const r = await File.fromPath(iconSrc).readText();
19
- cache.set(iconSrc, r);
20
- return r;
21
- }
22
- return cache.get(iconSrc);
23
- }
24
- function loadLottieJSONSync(iconSrc) {
25
- if (!cache.has(iconSrc)) {
26
- const r = File.fromPath(iconSrc).readTextSync();
27
- cache.set(iconSrc, r);
28
- return r;
29
- }
30
- return cache.get(iconSrc);
31
- }
32
- var RenderMode = {
33
- get AUTOMATIC() {
34
- return com.airbnb.lottie.RenderMode.AUTOMATIC;
35
- },
36
- get HARDWARE() {
37
- return com.airbnb.lottie.RenderMode.HARDWARE;
38
- },
39
- get SOFTWARE() {
40
- return com.airbnb.lottie.RenderMode.SOFTWARE;
41
- }
42
- };
43
- var LottieView = class extends LottieViewBase {
44
- constructor(..._args) {
45
- super(..._args);
46
- this._cancelled = false;
47
- }
48
- createNativeView() {
49
- return new com.nativescript.lottie.LottieAnimationView(this._context);
50
- }
51
- get completionBlock() {
52
- return this._completionBlock;
53
- }
54
- set completionBlock(block) {
55
- this._completionBlock = block;
56
- if (block) {
57
- if (!this.animatorListener) {
58
- const that = new WeakRef(this);
59
- this.animatorListener = new android.animation.Animator.AnimatorListener({
60
- onAnimationCancel: (_animator) => {
61
- const owner = that?.get();
62
- if (owner) owner._cancelled = true;
63
- },
64
- onAnimationEnd: (_animator) => {
65
- const owner = that?.get();
66
- if (owner?._completionBlock) owner._completionBlock(!owner._cancelled);
67
- if (owner) owner._cancelled = false;
68
- },
69
- onAnimationRepeat: (_animator) => {},
70
- onAnimationStart: (_animator) => {}
71
- });
72
- if (this.nativeViewProtected) this.nativeViewProtected.addAnimatorListener(this.animatorListener);
73
- }
74
- } else if (this.animatorListener) {
75
- if (this.nativeViewProtected) this.nativeViewProtected.removeAnimatorListener(this.animatorListener);
76
- this.animatorListener = null;
77
- }
78
- }
79
- initNativeView() {
80
- if (this.animatorListener) this.nativeViewProtected.addAnimatorListener(this.animatorListener);
81
- if (!this.loadedListener) {
82
- const that = new WeakRef(this);
83
- this.loadedListener = new com.airbnb.lottie.LottieOnCompositionLoadedListener({ onCompositionLoaded: (composition) => {
84
- const owner = that?.get();
85
- if (owner) setTimeout(() => {
86
- owner.notify({
87
- eventName: LottieViewBase.compositionLoadedEvent,
88
- composition
89
- });
90
- if (owner.autoPlay && !owner.isAnimating()) owner.playAnimation();
91
- }, 0);
92
- } });
93
- }
94
- this.nativeViewProtected.addLottieOnCompositionLoadedListener(this.loadedListener);
95
- const that = new WeakRef(this);
96
- this.nativeViewProtected.setFailureListener(new com.airbnb.lottie.LottieListener({ onResult: (result) => {
97
- const owner = that?.get();
98
- if (owner) owner.notify({
99
- eventName: LottieViewBase.loadFailedEvent,
100
- error: result
101
- });
102
- } }));
103
- }
104
- disposeNativeView() {
105
- if (this.animatorListener) this.nativeViewProtected.removeAnimatorListener(this.animatorListener);
106
- if (this.loadedListener) this.nativeViewProtected.removeLottieOnCompositionLoadedListener(this.loadedListener);
107
- super.disposeNativeView();
108
- }
109
- setColor(value, keyPath) {
110
- const nativeView = this.nativeViewProtected;
111
- if (nativeView && value && keyPath && keyPath.length) {
112
- if (keyPath[keyPath.length - 1].toLowerCase() === "color") {
113
- keyPath = [...keyPath];
114
- keyPath.pop();
115
- if (keyPath.length === 0) return;
116
- }
117
- const nativeKeyPath = Array.create(java.lang.String, keyPath.length);
118
- for (let index = 0; index < keyPath.length; index++) nativeKeyPath[index] = keyPath[index];
119
- if (!LottieProperty) LottieProperty = com.airbnb.lottie.LottieProperty;
120
- if (!LottieValueCallback) LottieValueCallback = com.airbnb.lottie.value.LottieValueCallback;
121
- if (!LottieKeyPath) LottieKeyPath = com.airbnb.lottie.model.KeyPath;
122
- const color = value instanceof Color ? value : new Color(value);
123
- const colorFilter = new com.airbnb.lottie.SimpleColorFilter(color.android);
124
- nativeView.addValueCallback(new LottieKeyPath(nativeKeyPath), LottieProperty.COLOR_FILTER, new LottieValueCallback(colorFilter));
125
- }
126
- }
127
- setOpacity(value, keyPath) {
128
- if (this.nativeViewProtected && value != null && keyPath && keyPath.length) {
129
- if (keyPath[keyPath.length - 1].toLowerCase() === "opacity") {
130
- keyPath = [...keyPath];
131
- keyPath.pop();
132
- if (keyPath.length === 0) return;
133
- }
134
- const nativeKeyPath = Array.create(java.lang.String, keyPath.length);
135
- keyPath.forEach((key, index) => {
136
- nativeKeyPath[index] = new java.lang.String(key);
137
- });
138
- value = clamp(value);
139
- if (!LottieProperty) LottieProperty = com.airbnb.lottie.LottieProperty;
140
- if (!LottieValueCallback) LottieValueCallback = com.airbnb.lottie.value.LottieValueCallback;
141
- if (!LottieKeyPath) LottieKeyPath = com.airbnb.lottie.model.KeyPath;
142
- this.nativeViewProtected.addValueCallback(new LottieKeyPath(nativeKeyPath), LottieProperty.OPACITY, new LottieValueCallback(new java.lang.Integer(value * 255)));
143
- }
144
- }
145
- playAnimation() {
146
- if (this.nativeViewProtected) {
147
- this.nativeViewProtected.setMinAndMaxProgress(0, 1);
148
- this.nativeViewProtected.playAnimation();
149
- }
150
- }
151
- playAnimationFromProgressToProgress(startProgress, endProgress) {
152
- if (this.nativeViewProtected) {
153
- startProgress = startProgress ? clamp(startProgress) : 0;
154
- endProgress = endProgress ? clamp(endProgress) : 1;
155
- this.nativeViewProtected.setMinAndMaxProgress(startProgress, endProgress);
156
- this.nativeViewProtected.playAnimation();
157
- }
158
- }
159
- isAnimating() {
160
- return this.nativeViewProtected ? this.nativeViewProtected.isAnimating() : false;
161
- }
162
- get speed() {
163
- return this.nativeViewProtected ? this.nativeViewProtected.getSpeed() : void 0;
164
- }
165
- set speed(value) {
166
- if (this.nativeViewProtected && value) this.nativeViewProtected.setSpeed(value);
167
- }
168
- get duration() {
169
- return this.nativeViewProtected ? this.nativeViewProtected.getDuration() : void 0;
170
- }
171
- cancelAnimation() {
172
- if (this.nativeViewProtected) this.nativeViewProtected.cancelAnimation();
173
- }
174
- pauseAnimation() {
175
- if (this.nativeViewProtected) this.nativeViewProtected.pauseAnimation();
176
- }
177
- resumeAnimation() {
178
- if (this.nativeViewProtected) this.nativeViewProtected.resumeAnimation();
179
- }
180
- [srcProperty.setNative](src) {
181
- try {
182
- if (!LottieCompositionFactory) LottieCompositionFactory = com.airbnb.lottie.LottieCompositionFactory;
183
- const view = this.nativeViewProtected;
184
- let result;
185
- if (!src) {} else if (src[0] === "{") {
186
- if (this.async) view.setAnimationFromJson(src, null);
187
- else result = LottieCompositionFactory.fromJsonStringSync(src, null);
188
- } else if (/^https?:/i.test(src)) {
189
- const match = /\.(zip|lottie|json)(?=[?#]|$)/i.exec(src);
190
- const dest = path.join(knownFolders.temp().path, `lottie-${Date.now()}${match ? match[0].toLowerCase() : ".json"}`);
191
- Http.getFile(src, dest).then(() => {
192
- this.src = dest;
193
- }).catch((error) => {
194
- console.error(error);
195
- this.notify({
196
- eventName: "loadFailed",
197
- error
198
- });
199
- });
200
- } else if (src.startsWith(Utils.RESOURCE_PREFIX)) {
201
- const resName = src.replace(Utils.RESOURCE_PREFIX, "");
202
- if (this.async) view.setAnimation(resName);
203
- else result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, resName);
204
- } else {
205
- if (!/.(json|zip|lottie)$/.test(src)) src += ".json";
206
- if (src[0] === "~") {
207
- if (this.async) view.setAnimation("app/" + src.substring(2));
208
- else result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, "app/" + src.substring(2));
209
- } else if (!src.startsWith("file:/") && src[0] !== "/") {
210
- if (this.async) view.setAnimation("app/" + src);
211
- else result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, src);
212
- } else {
213
- const filePath = src.startsWith("file:") ? src.substring(5) : src;
214
- if (/\.(zip|lottie)$/i.test(filePath)) {
215
- const stream = new java.util.zip.ZipInputStream(new java.io.FileInputStream(filePath));
216
- if (this.async) {
217
- const owner = new WeakRef(this);
218
- com.airbnb.lottie.LottieCompositionFactory.fromZipStream(stream, null).addListener(new com.airbnb.lottie.LottieListener({ onResult: (composition) => {
219
- const view = owner.get()?.nativeViewProtected;
220
- if (view) view.setComposition(composition);
221
- } })).addFailureListener(new com.airbnb.lottie.LottieListener({ onResult: (error) => console.error(error) }));
222
- } else result = com.airbnb.lottie.LottieCompositionFactory.fromZipStreamSync(stream, null);
223
- } else if (this.async) loadLottieJSON(src).then((result) => {
224
- if (this.nativeViewProtected) this.nativeViewProtected.setAnimationFromJson(result, null);
225
- });
226
- else result = LottieCompositionFactory.fromJsonStringSync(loadLottieJSONSync(src), null);
227
- }
228
- }
229
- if (result) {
230
- if (result.getException()) {
231
- console.error(result.getException());
232
- this.notify({
233
- eventName: LottieViewBase.loadFailedEvent,
234
- error: result.getException()
235
- });
236
- } else view.setComposition(result.getValue());
237
- }
238
- if (this.autoPlay) this.playAnimation();
239
- } catch (error) {
240
- console.error(error);
241
- this.notify({
242
- eventName: LottieViewBase.loadFailedEvent,
243
- error
244
- });
245
- }
246
- }
247
- [loopProperty.setNative](loop) {
248
- this.nativeViewProtected.setRepeatCount(loop ? -1 : 0);
249
- }
250
- [progressProperty.setNative](value) {
251
- this.nativeViewProtected.setProgress(value);
252
- }
253
- [renderModeProperty.setNative](renderMode) {
254
- this.nativeViewProtected.setRenderMode(renderMode);
255
- }
256
- [keyPathColorsProperty.setNative](value) {
257
- Object.keys(value).forEach((k) => this.setColor(value[k], k.split("|")));
258
- }
259
- [autoPlayProperty.setNative](autoPlay) {
260
- if (autoPlay) {
261
- if (!this.isAnimating()) this.playAnimation();
262
- } else {
263
- this.cancelAnimation();
264
- if (this.progress) this.nativeViewProtected.setProgress(this.progress);
265
- }
266
- }
267
- [stretchProperty.getDefault]() {
268
- return "aspectFit";
269
- }
270
- [stretchProperty.setNative](value) {
271
- switch (value) {
272
- case "aspectFit":
273
- this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);
274
- break;
275
- case "aspectFill":
276
- this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.CENTER_CROP);
277
- break;
278
- case "fill":
279
- this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.FIT_XY);
280
- break;
281
- default: this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.MATRIX);
282
- }
283
- }
284
- };
285
- //#endregion
286
- export { LottieView, RenderMode };
@@ -1,214 +0,0 @@
1
- import { LottieViewBase, autoPlayProperty, keyPathColorsProperty, loopProperty, progressProperty, srcProperty, stretchProperty } from "./src/lottie/index.common.js";
2
- import { clamp } from "./src/lottie/utils.js";
3
- import { Color, Http, Utils, View, knownFolders, path } from "@nativescript/core";
4
- //#region src/vendor/ui-lottie/src/lottie/index.ios.ts
5
- /**********************************************************************************
6
- * (c) 2017, Nathan Walker.
7
- * Licensed under the MIT license.
8
- *
9
- * Version 1.0.0 walkerrunpdx@gmail.com
10
- **********************************************************************************/
11
- var appPath = knownFolders.currentApp().path;
12
- CompatibleLottieLogger.overrideLottieLogger();
13
- var LottieView = class LottieView extends LottieViewBase {
14
- constructor(..._args) {
15
- super(..._args);
16
- this._imageSourceAffectsLayout = true;
17
- }
18
- createNativeView() {
19
- return CompatibleAnimationView.new();
20
- }
21
- initNativeView() {
22
- super.initNativeView();
23
- this.nativeViewProtected.translatesAutoresizingMaskIntoConstraints = true;
24
- }
25
- onLoaded() {
26
- super.onLoaded();
27
- if (this.autoPlay && !this.isAnimating()) this.playAnimation();
28
- }
29
- [keyPathColorsProperty.setNative](value) {
30
- Object.keys(value).forEach((k) => this.setColor(value[k], k.split("|")));
31
- }
32
- [srcProperty.setNative](src) {
33
- try {
34
- if (!src) this.nativeViewProtected.compatibleAnimation = null;
35
- else if (src[0] === "{") this.nativeViewProtected.compatibleAnimation = CompatibleAnimation.alloc().initWithJson(src);
36
- else if (src.startsWith(Utils.RESOURCE_PREFIX)) {
37
- const resName = src.replace(Utils.RESOURCE_PREFIX, "");
38
- this.nativeViewProtected.compatibleAnimation = CompatibleAnimation.alloc().initWithNameBundle(resName.replace(".json", "").replace(".lottie", ""), NSBundle.mainBundle);
39
- } else if (/^https?:/i.test(src)) {
40
- const match = /\.(zip|lottie|json)(?=[?#]|$)/i.exec(src);
41
- const dest = path.join(knownFolders.temp().path, `lottie-${Date.now()}${match ? match[0].toLowerCase() : ".json"}`);
42
- Http.getFile(src, dest).then(() => {
43
- this.src = dest;
44
- }).catch((error) => {
45
- console.error(error);
46
- this.notify({
47
- eventName: "loadFailed",
48
- error
49
- });
50
- });
51
- } else {
52
- if (src[0] === "~") src = `${path.join(appPath, src.substring(2))}`;
53
- if (!/.(json|zip|lottie)$/.test(src)) src += ".json";
54
- if (!src.startsWith("file:/") && src[0] !== "/") this.nativeViewProtected.compatibleAnimation = CompatibleAnimation.alloc().initWithNameSubdirectoryBundle(src.replace(".json", "").replace(".lottie", ""), null, NSBundle.mainBundle);
55
- else this.nativeViewProtected.compatibleAnimation = CompatibleAnimation.alloc().initWithFilepath(src);
56
- }
57
- if (this.keyPathColors) this[keyPathColorsProperty.setNative](this.keyPathColors);
58
- if (this._imageSourceAffectsLayout) this.requestLayout();
59
- if (this.autoPlay && !this.isAnimating()) this.playAnimation();
60
- if (src && !/^https?:/i.test(src)) {
61
- const view = this.nativeViewProtected;
62
- setTimeout(() => {
63
- if (view && view.compatibleAnimation && view.animationDuration >= 0) this.notify({
64
- eventName: LottieViewBase.compositionLoadedEvent,
65
- composition: view.compatibleAnimation
66
- });
67
- else this.notify({
68
- eventName: LottieViewBase.loadFailedEvent,
69
- error: src
70
- });
71
- }, 0);
72
- }
73
- } catch (error) {
74
- console.error(error);
75
- this.notify({
76
- eventName: LottieViewBase.loadFailedEvent,
77
- error
78
- });
79
- }
80
- }
81
- [loopProperty.setNative](loop) {
82
- this.nativeViewProtected.loopAnimationCount = loop ? -1 : 0;
83
- }
84
- [autoPlayProperty.setNative](autoPlay) {
85
- if (autoPlay) {
86
- if (!this.isAnimating()) this.playAnimation();
87
- } else if (this.isAnimating()) this.cancelAnimation();
88
- }
89
- setColor(value, keyPath) {
90
- if (this.nativeView && value && keyPath && keyPath.length) {
91
- if (keyPath[keyPath.length - 1].toLowerCase() !== "color") {
92
- keyPath = [...keyPath];
93
- keyPath.push("Color");
94
- }
95
- const color = value instanceof Color ? value : new Color(value);
96
- this.nativeViewProtected.setColorValueForKeypath(color.ios, CompatibleAnimationKeypath.alloc().initWithKeypath(keyPath.join(".")));
97
- }
98
- }
99
- setOpacity(value, keyPath) {
100
- if (this.nativeView && value != null && keyPath && keyPath.length) {
101
- keyPath = [...keyPath];
102
- if (keyPath[keyPath.length - 1].toLowerCase() !== "opacity") keyPath.push("Opacity");
103
- this.nativeViewProtected.setFloatValueForKeypath(clamp(value) * 100, CompatibleAnimationKeypath.alloc().initWithKeypath(keyPath.join(".")));
104
- }
105
- }
106
- playAnimation() {
107
- setTimeout(() => {
108
- if (this.nativeViewProtected) {
109
- if (this.completionBlock) this.nativeViewProtected.playWithCompletion((animationFinished) => {
110
- if (this.completionBlock) this.completionBlock(animationFinished);
111
- });
112
- else this.nativeViewProtected.play();
113
- }
114
- }, 0);
115
- }
116
- playAnimationFromProgressToProgress(startProgress, endProgress) {
117
- if (this.nativeViewProtected) {
118
- startProgress = startProgress ? clamp(startProgress) : 0;
119
- endProgress = endProgress ? clamp(endProgress) : 1;
120
- if (this.completionBlock) this.nativeViewProtected.playFromProgressToProgressCompletion(startProgress, endProgress, this.completionBlock);
121
- else this.nativeViewProtected.playFromProgressToProgressCompletion(startProgress, endProgress, null);
122
- }
123
- }
124
- cancelAnimation() {
125
- if (this.nativeViewProtected) this.nativeViewProtected.pause();
126
- }
127
- pauseAnimation() {
128
- if (this.nativeViewProtected) this.nativeViewProtected.pause();
129
- }
130
- resumeAnimation() {
131
- if (this.nativeViewProtected) this.nativeViewProtected.play();
132
- }
133
- isAnimating() {
134
- return this.nativeView ? this.nativeViewProtected.isAnimationPlaying : false;
135
- }
136
- [progressProperty.setNative](value) {
137
- this.nativeViewProtected.currentProgress = value;
138
- }
139
- set speed(value) {
140
- if (this.nativeView && value) this.nativeViewProtected.animationSpeed = value;
141
- }
142
- get speed() {
143
- return this.nativeView ? this.nativeViewProtected.animationSpeed : void 0;
144
- }
145
- get duration() {
146
- return this.nativeView && this.nativeViewProtected.animationDuration;
147
- }
148
- set contentMode(mode) {
149
- if (this.nativeViewProtected) this.nativeViewProtected.contentMode = mode;
150
- }
151
- onMeasure(widthMeasureSpec, heightMeasureSpec) {
152
- const intrinsicContentSize = this.nativeViewProtected.intrinsicContentSize;
153
- const width = Utils.layout.getMeasureSpecSize(widthMeasureSpec);
154
- const widthMode = Utils.layout.getMeasureSpecMode(widthMeasureSpec);
155
- const height = Utils.layout.getMeasureSpecSize(heightMeasureSpec);
156
- const heightMode = Utils.layout.getMeasureSpecMode(heightMeasureSpec);
157
- const nativeWidth = intrinsicContentSize ? Utils.layout.toDevicePixels(intrinsicContentSize.width) : 0;
158
- const nativeHeight = intrinsicContentSize ? Utils.layout.toDevicePixels(intrinsicContentSize.height) : 0;
159
- let measureWidth = Math.max(nativeWidth, this.effectiveMinWidth);
160
- let measureHeight = Math.max(nativeHeight, this.effectiveMinHeight);
161
- const finiteWidth = widthMode !== Utils.layout.UNSPECIFIED;
162
- const finiteHeight = heightMode !== Utils.layout.UNSPECIFIED;
163
- this._imageSourceAffectsLayout = widthMode !== Utils.layout.EXACTLY || heightMode !== Utils.layout.EXACTLY;
164
- if (nativeWidth !== 0 && nativeHeight !== 0 && (finiteWidth || finiteHeight)) {
165
- const scale = LottieView.computeScaleFactor(width, height, finiteWidth, finiteHeight, nativeWidth, nativeHeight, this.stretch);
166
- const resultW = Math.round(nativeWidth * scale.width);
167
- const resultH = Math.round(nativeHeight * scale.height);
168
- measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
169
- measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
170
- }
171
- const widthAndState = View.resolveSizeAndState(measureWidth, width, widthMode, 0);
172
- const heightAndState = View.resolveSizeAndState(measureHeight, height, heightMode, 0);
173
- this.setMeasuredDimension(widthAndState, heightAndState);
174
- }
175
- static computeScaleFactor(measureWidth, measureHeight, widthIsFinite, heightIsFinite, nativeWidth, nativeHeight, imageStretch) {
176
- let scaleW = 1;
177
- let scaleH = 1;
178
- if ((imageStretch === "aspectFill" || imageStretch === "aspectFit" || imageStretch === "fill") && (widthIsFinite || heightIsFinite)) {
179
- scaleW = nativeWidth > 0 ? measureWidth / nativeWidth : 0;
180
- scaleH = nativeHeight > 0 ? measureHeight / nativeHeight : 0;
181
- if (!widthIsFinite) scaleW = scaleH;
182
- else if (!heightIsFinite) scaleH = scaleW;
183
- else switch (imageStretch) {
184
- case "aspectFit":
185
- scaleH = scaleW < scaleH ? scaleW : scaleH;
186
- scaleW = scaleH;
187
- break;
188
- case "aspectFill":
189
- scaleH = scaleW > scaleH ? scaleW : scaleH;
190
- scaleW = scaleH;
191
- }
192
- }
193
- return {
194
- width: scaleW,
195
- height: scaleH
196
- };
197
- }
198
- [stretchProperty.setNative](value) {
199
- switch (value) {
200
- case "aspectFit":
201
- this.nativeViewProtected.contentMode = UIViewContentMode.ScaleAspectFit;
202
- break;
203
- case "aspectFill":
204
- this.nativeViewProtected.contentMode = UIViewContentMode.ScaleAspectFill;
205
- break;
206
- case "fill":
207
- this.nativeViewProtected.contentMode = UIViewContentMode.ScaleToFill;
208
- break;
209
- default: this.nativeViewProtected.contentMode = UIViewContentMode.TopLeft;
210
- }
211
- }
212
- };
213
- //#endregion
214
- export { LottieView };
@@ -1,50 +0,0 @@
1
- import { Property, View, booleanConverter } from "@nativescript/core";
2
- //#region src/vendor/ui-lottie/src/lottie/index.common.ts
3
- /**********************************************************************************
4
- * (c) 2017, Nathan Walker.
5
- * Licensed under the MIT license.
6
- *
7
- * Version 1.0.0 walkerrunpdx@gmail.com
8
- **********************************************************************************/
9
- var LottieViewBase = class extends View {
10
- static {
11
- this.compositionLoadedEvent = "compositionLoaded";
12
- }
13
- static {
14
- this.loadFailedEvent = "loadFailed";
15
- }
16
- };
17
- var srcProperty = new Property({ name: "src" });
18
- srcProperty.register(LottieViewBase);
19
- var asyncProperty = new Property({
20
- name: "async",
21
- defaultValue: false,
22
- valueConverter: booleanConverter
23
- });
24
- asyncProperty.register(LottieViewBase);
25
- var loopProperty = new Property({
26
- name: "loop",
27
- defaultValue: false,
28
- valueConverter: booleanConverter
29
- });
30
- loopProperty.register(LottieViewBase);
31
- var autoPlayProperty = new Property({
32
- name: "autoPlay",
33
- defaultValue: false,
34
- valueConverter: booleanConverter
35
- });
36
- autoPlayProperty.register(LottieViewBase);
37
- var renderModeProperty = new Property({ name: "renderMode" });
38
- renderModeProperty.register(LottieViewBase);
39
- var progressProperty = new Property({ name: "progress" });
40
- progressProperty.register(LottieViewBase);
41
- var stretchProperty = new Property({
42
- name: "stretch",
43
- defaultValue: "aspectFit",
44
- affectsLayout: global.isIOS
45
- });
46
- stretchProperty.register(LottieViewBase);
47
- var keyPathColorsProperty = new Property({ name: "keyPathColors" });
48
- keyPathColorsProperty.register(LottieViewBase);
49
- //#endregion
50
- export { LottieViewBase, asyncProperty, autoPlayProperty, keyPathColorsProperty, loopProperty, progressProperty, renderModeProperty, srcProperty, stretchProperty };
@@ -1,6 +0,0 @@
1
- //#region src/vendor/ui-lottie/src/lottie/utils.ts
2
- function clamp(val, min = 0, max = 1) {
3
- return val > max ? max : val < min ? min : val;
4
- }
5
- //#endregion
6
- export { clamp };
@@ -1,17 +0,0 @@
1
- //#region src/escape-props.web.ts
2
- /** Apply DOM escape props after the primitive's own props. Dash-named keys
3
- * are attributes; other keys use the DOM property where available. */
4
- function applyEscapeProps(element, props) {
5
- if (!element || !props.web) return;
6
- for (const [key, value] of Object.entries(props.web)) if (key.includes("-")) {
7
- if (value == null || value === false) element.removeAttribute(key);
8
- else element.setAttribute(key, value === true ? "" : String(value));
9
- } else if (key in element) try {
10
- element[key] = value;
11
- } catch {
12
- element.setAttribute(key, String(value));
13
- }
14
- else if (value != null) element.setAttribute(key, String(value));
15
- }
16
- //#endregion
17
- export { applyEscapeProps };