zextra-plus 0.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ZAKARIA ELALAOUI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # ziko-lottie ⚠️ (Deprecated)
2
+
3
+ > This package is deprecated and no longer maintained.
4
+
5
+ Lottie player element for zikojs is now part of **zextra-plus**.
6
+
7
+ ---
8
+
9
+ ## 🚨 Deprecation Notice
10
+
11
+ `ziko-lottie` has been moved and merged into a larger utilities package:
12
+
13
+ 👉 Please use **zextra-plus** instead.
14
+
15
+ ---
16
+
17
+ ## 📦 New Installation
18
+
19
+ ```bash
20
+ npm install zextra-plus
21
+ ```
22
+ ## Usage
23
+ ```js
24
+ import { LottiePlayer } from "zextra-plus/lottie";
25
+
26
+ const Lottie = LottiePlayer(
27
+ "https://assets1.lottiefiles.com/private_files/lf30_q2okh8lh.json"
28
+ )
29
+ .size("300px", "300px")
30
+ .style({
31
+ border: "1px darkblue solid"
32
+ });
33
+
34
+ Lottie.useControls();
35
+ ```
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "zextra-plus",
3
+ "version": "0.0.0",
4
+ "description": "Extra built in zikojs components built on the top of 3rd party libraries",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js",
10
+ "watch": "cross-env NODE_ENV=development rollup --config rollup.config.js -w",
11
+ "build": "cross-env NODE_ENV=production rollup --config rollup.config.js"
12
+ },
13
+ "author": "zakaria elaloui",
14
+ "keywords": [
15
+ "zikojs",
16
+ "zikojs-addons",
17
+ "lottiefiles",
18
+ "lottie-web",
19
+ "animation"
20
+ ],
21
+ "exports": {
22
+ "./*" : {
23
+ "import" : "./src/*/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "src",
28
+ "dist",
29
+ "LICENCE"
30
+ ],
31
+ "license": "MIT",
32
+ "devDependencies": {
33
+ "@rollup/plugin-commonjs": "^29.0.2",
34
+ "@rollup/plugin-node-resolve": "^16.0.3",
35
+ "@rollup/plugin-terser": "^1.0.0",
36
+ "cross-env": "^10.1.0",
37
+ "rollup": "^4.60.0"
38
+ },
39
+ "dependencies": {
40
+ "@lottiefiles/lottie-player": "^2.0.12",
41
+ "zextra": "^1.1.0",
42
+ "ziko": "^1.0.0"
43
+ }
44
+ }
@@ -0,0 +1,52 @@
1
+ import { UIElement } from "ziko/dom";
2
+ import "@lottiefiles/lottie-player";
3
+
4
+ export interface UILottiePlayerOptions {
5
+ src: string;
6
+ width?: number | string;
7
+ height?: number | string;
8
+ }
9
+
10
+ export declare class UILottiePlayer extends UIElement {
11
+ element: HTMLLottiePlayerElement;
12
+
13
+ constructor(
14
+ src: string,
15
+ width?: number | string,
16
+ height?: number | string
17
+ );
18
+
19
+ play(): this;
20
+ pause(): this;
21
+
22
+ useControls(use?: boolean): this;
23
+ useLoop(use?: boolean): this;
24
+
25
+ toggleControls(): this;
26
+
27
+ setMode(mode?: string): this;
28
+ }
29
+
30
+ export interface LottiePlayerProps {
31
+ src?: string;
32
+ width?: number | string;
33
+ height?: number | string;
34
+ }
35
+
36
+ export declare const LottiePlayer: (
37
+ props?: LottiePlayerProps
38
+ ) => UILottiePlayer;
39
+
40
+ /**
41
+ * Lottie Player element interface (from @lottiefiles/lottie-player)
42
+ */
43
+ export interface HTMLLottiePlayerElement extends HTMLElement {
44
+ src: string;
45
+ autoplay: boolean;
46
+ loop: boolean;
47
+ controls: boolean;
48
+ mode: string;
49
+
50
+ play(): void;
51
+ pause(): void;
52
+ }
@@ -0,0 +1,40 @@
1
+ import {UIElement} from "ziko/dom"
2
+ import "@lottiefiles/lottie-player"
3
+ class UILottiePlayer extends UIElement{
4
+ constructor(src,width,height = width){
5
+ super({element : "lottie-player", name : "LottiePlayer"});
6
+ this.element.src=src;
7
+ if(width) this.size(width,height);
8
+ this.setAttr("aria-label","Lottie animation");
9
+ this.setAttr("aria-describedby",`lottie-player-description-id`);
10
+ }
11
+ play(){
12
+ this.element.play();
13
+ return this;
14
+ }
15
+ pause(){
16
+ this.element.pause();
17
+ return this;
18
+ }
19
+ useControls(use=true){
20
+ this.element.controls=use;
21
+ return this;
22
+ }
23
+ useLoop(use = true){
24
+ this.element.loop=use;
25
+ return this;
26
+ }
27
+ toggleControls(){
28
+ this.element.controls=!this.element.controls;
29
+ return this;
30
+ }
31
+ setMode(mode="normal"){
32
+ this.element.mode=mode;
33
+ return this;
34
+ }
35
+ }
36
+ export const LottiePlayer=({
37
+ src = "https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json",
38
+ width,
39
+ height
40
+ } = {})=>new UILottiePlayer(src,width,height);