@vnejs/uis.react.sprite 0.1.6 → 0.1.8
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/dist/Sprite.d.ts +2 -8
- package/dist/Sprite.d.ts.map +1 -1
- package/dist/Sprite.js +1 -1
- package/dist/Sprite.js.map +1 -1
- package/dist/Sprite.types.d.ts +49 -0
- package/dist/Sprite.types.d.ts.map +1 -0
- package/dist/Sprite.types.js +2 -0
- package/dist/Sprite.types.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Sprite.tsx +14 -3
- package/src/Sprite.types.tsx +46 -0
- package/src/index.ts +2 -1
- package/tsconfig.json +0 -1
package/dist/Sprite.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
indexSrc?: string;
|
|
4
|
-
boxProps?: {};
|
|
5
|
-
partsProps?: {};
|
|
6
|
-
transition?: any;
|
|
7
|
-
transitionBox?: any;
|
|
8
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { type SpriteProps } from "./Sprite.types.js";
|
|
2
|
+
export declare const Sprite: ({ parts, indexSrc, boxProps, partsProps, transition, transitionBox, }: SpriteProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
3
|
//# sourceMappingURL=Sprite.d.ts.map
|
package/dist/Sprite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sprite.d.ts","sourceRoot":"","sources":["../src/Sprite.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM,GAAI
|
|
1
|
+
{"version":3,"file":"Sprite.d.ts","sourceRoot":"","sources":["../src/Sprite.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,eAAO,MAAM,MAAM,GAAI,uEAOpB,WAAW,4CAyBb,CAAC"}
|
package/dist/Sprite.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Image, PositionBox } from "@vnejs/uis.react";
|
|
4
4
|
const POSE_STYLE = { opacity: 0, visibility: "hidden" };
|
|
5
|
-
export const Sprite = ({ parts = [], indexSrc = "", boxProps = {}, partsProps = {}, transition = null, transitionBox = null }) => {
|
|
5
|
+
export const Sprite = ({ parts = [], indexSrc = "", boxProps = {}, partsProps = {}, transition = null, transitionBox = null, }) => {
|
|
6
6
|
const realBoxProps = useMemo(() => {
|
|
7
7
|
const result = { ...boxProps };
|
|
8
8
|
if (transitionBox !== null)
|
package/dist/Sprite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sprite.js","sourceRoot":"","sources":["../src/Sprite.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Sprite.js","sourceRoot":"","sources":["../src/Sprite.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAItD,MAAM,UAAU,GAAkB,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAEvE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EACrB,KAAK,GAAG,EAAE,EACV,QAAQ,GAAG,EAAE,EACb,QAAQ,GAAG,EAAE,EACb,UAAU,GAAG,EAAE,EACf,UAAU,GAAG,IAAI,EACjB,aAAa,GAAG,IAAI,GACR,EAAE,EAAE;IAChB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE;QAChC,MAAM,MAAM,GAA4B,EAAE,GAAG,QAAQ,EAAE,CAAC;QAExD,IAAI,aAAa,KAAK,IAAI;YAAE,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC;QAE9D,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,MAAC,WAAW,OAAK,YAAY,aAC1B,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,KAAC,KAAK,OAEA,KAAK,KACL,UAAU,EACd,UAAU,EAAE,UAAU,IAHjB,CAAC,CAIN,CACH,CAAC,EACF,cACE,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,UAAU,GACjB,IACU,CACf,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CssInsertValue, CssInsertValueNumber, CssInsertValueString } from "@vnejs/uis.utils";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export type SpriteImagePartProps = {
|
|
4
|
+
translateX?: CssInsertValueNumber;
|
|
5
|
+
translateY?: CssInsertValueNumber;
|
|
6
|
+
scale?: CssInsertValueNumber;
|
|
7
|
+
transition?: CssInsertValueNumber;
|
|
8
|
+
opacity?: CssInsertValueNumber;
|
|
9
|
+
src?: string | Array<{
|
|
10
|
+
url: string;
|
|
11
|
+
duration: number;
|
|
12
|
+
transition: number;
|
|
13
|
+
randomDuration?: number;
|
|
14
|
+
}>;
|
|
15
|
+
className?: string;
|
|
16
|
+
filter?: CssInsertValueString;
|
|
17
|
+
withHover?: boolean;
|
|
18
|
+
isSwitchDisabled?: boolean;
|
|
19
|
+
isAllSrcRendered?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type SpriteBoxProps = {
|
|
22
|
+
top?: CssInsertValue;
|
|
23
|
+
right?: CssInsertValue;
|
|
24
|
+
bottom?: CssInsertValue;
|
|
25
|
+
left?: CssInsertValue;
|
|
26
|
+
translateX?: CssInsertValue;
|
|
27
|
+
translateY?: CssInsertValue;
|
|
28
|
+
transformOriginX?: CssInsertValue;
|
|
29
|
+
transformOriginY?: CssInsertValue;
|
|
30
|
+
scale?: CssInsertValueNumber;
|
|
31
|
+
transition?: CssInsertValueNumber;
|
|
32
|
+
zIndex?: CssInsertValueNumber;
|
|
33
|
+
opacity?: CssInsertValueNumber;
|
|
34
|
+
background?: CssInsertValueString;
|
|
35
|
+
clip?: CssInsertValueString;
|
|
36
|
+
mask?: CssInsertValueString;
|
|
37
|
+
filter?: CssInsertValueString;
|
|
38
|
+
className?: string;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
export type SpriteProps = {
|
|
42
|
+
parts?: SpriteImagePartProps[];
|
|
43
|
+
indexSrc?: string;
|
|
44
|
+
boxProps?: SpriteBoxProps;
|
|
45
|
+
partsProps?: Partial<SpriteImagePartProps>;
|
|
46
|
+
transition?: CssInsertValueNumber;
|
|
47
|
+
transitionBox?: CssInsertValueNumber;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=Sprite.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sprite.types.d.ts","sourceRoot":"","sources":["../src/Sprite.types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ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AAC,CAAC;IAC3C,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sprite.types.js","sourceRoot":"","sources":["../src/Sprite.types.tsx"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
package/package.json
CHANGED
package/src/Sprite.tsx
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
+
import type { CSSProperties } from "react";
|
|
3
|
+
|
|
2
4
|
import { Image, PositionBox } from "@vnejs/uis.react";
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
import { type SpriteProps } from "./Sprite.types.js";
|
|
7
|
+
|
|
8
|
+
const POSE_STYLE: CSSProperties = { opacity: 0, visibility: "hidden" };
|
|
5
9
|
|
|
6
|
-
export const Sprite = ({
|
|
10
|
+
export const Sprite = ({
|
|
11
|
+
parts = [],
|
|
12
|
+
indexSrc = "",
|
|
13
|
+
boxProps = {},
|
|
14
|
+
partsProps = {},
|
|
15
|
+
transition = null,
|
|
16
|
+
transitionBox = null,
|
|
17
|
+
}: SpriteProps) => {
|
|
7
18
|
const realBoxProps = useMemo(() => {
|
|
8
|
-
const result: Record<string,
|
|
19
|
+
const result: Record<string, unknown> = { ...boxProps };
|
|
9
20
|
|
|
10
21
|
if (transitionBox !== null) result.transition = transitionBox;
|
|
11
22
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CssInsertValue, CssInsertValueNumber, CssInsertValueString } from "@vnejs/uis.utils";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export type SpriteImagePartProps = {
|
|
5
|
+
translateX?: CssInsertValueNumber;
|
|
6
|
+
translateY?: CssInsertValueNumber;
|
|
7
|
+
scale?: CssInsertValueNumber;
|
|
8
|
+
transition?: CssInsertValueNumber;
|
|
9
|
+
opacity?: CssInsertValueNumber;
|
|
10
|
+
src?: string | Array<{ url: string; duration: number; transition: number; randomDuration?: number }>;
|
|
11
|
+
className?: string;
|
|
12
|
+
filter?: CssInsertValueString;
|
|
13
|
+
withHover?: boolean;
|
|
14
|
+
isSwitchDisabled?: boolean;
|
|
15
|
+
isAllSrcRendered?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type SpriteBoxProps = {
|
|
19
|
+
top?: CssInsertValue;
|
|
20
|
+
right?: CssInsertValue;
|
|
21
|
+
bottom?: CssInsertValue;
|
|
22
|
+
left?: CssInsertValue;
|
|
23
|
+
translateX?: CssInsertValue;
|
|
24
|
+
translateY?: CssInsertValue;
|
|
25
|
+
transformOriginX?: CssInsertValue;
|
|
26
|
+
transformOriginY?: CssInsertValue;
|
|
27
|
+
scale?: CssInsertValueNumber;
|
|
28
|
+
transition?: CssInsertValueNumber;
|
|
29
|
+
zIndex?: CssInsertValueNumber;
|
|
30
|
+
opacity?: CssInsertValueNumber;
|
|
31
|
+
background?: CssInsertValueString;
|
|
32
|
+
clip?: CssInsertValueString;
|
|
33
|
+
mask?: CssInsertValueString;
|
|
34
|
+
filter?: CssInsertValueString;
|
|
35
|
+
className?: string;
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type SpriteProps = {
|
|
40
|
+
parts?: SpriteImagePartProps[];
|
|
41
|
+
indexSrc?: string;
|
|
42
|
+
boxProps?: SpriteBoxProps;
|
|
43
|
+
partsProps?: Partial<SpriteImagePartProps>;
|
|
44
|
+
transition?: CssInsertValueNumber;
|
|
45
|
+
transitionBox?: CssInsertValueNumber;
|
|
46
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./Sprite";
|
|
1
|
+
export * from "./Sprite.types.js";
|
|
2
|
+
export * from "./Sprite.js";
|