create-pixi-vn 2.0.2 → 2.0.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-pixi-vn",
3
3
  "description": "Create a new Pixi’VN project",
4
- "version": "2.0.2",
4
+ "version": "2.0.3",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0",
7
7
  "author": "DRincs-Productions",
@@ -52,9 +52,9 @@ export function SaveSlot({ saveId }: { saveId: number }) {
52
52
  >
53
53
  <Image
54
54
  src={saveData.image}
55
+ layout="fullWidth"
55
56
  alt={saveData.name}
56
- className="absolute inset-0 size-full object-contain rounded-lg"
57
- style={{ pointerEvents: "none", userSelect: "none" }}
57
+ className="absolute inset-0 size-full object-contain rounded-lg pointer-events-none select-none"
58
58
  />
59
59
  {/* top-left metadata */}
60
60
  <div className="absolute top-2.5 left-2.5 flex flex-col gap-0.5 pointer-events-none">
@@ -128,7 +128,7 @@ export function Text({ paragraphRef }: { paragraphRef: RefObject<HTMLDivElement
128
128
  export function CharacterIcon({ alt, icon }: { icon: string; alt: string }) {
129
129
  return (
130
130
  <AspectRatio ratio={16 / 9}>
131
- <Image src={icon} alt={alt} className="h-full w-full object-cover" />
131
+ <Image src={icon} layout="fullWidth" alt={alt} className="h-full w-full object-cover" />
132
132
  </AspectRatio>
133
133
  );
134
134
  }
@@ -1,50 +1,19 @@
1
- import { getPixiJSAsset } from "@/lib/utils/assets-utility";
2
- import { Image as UnpicImage } from "@unpic/react";
3
- import type * as React from "react";
4
- import { useMemo } from "react";
1
+ import { useImageSrc } from "@/lib/hooks/image-hooks";
2
+ import { Image as UnpicImage, type ImageProps } from "@unpic/react";
3
+ import { ImageOff } from "lucide-react";
5
4
 
6
5
  export function Image({
7
6
  src,
8
7
  loading = "lazy",
9
- width,
10
- height,
11
8
  ...props
12
- }: React.ComponentProps<"img">) {
13
- const resolvedSrc = useMemo(() => {
14
- if (!src) {
15
- return undefined;
16
- }
17
- return getPixiJSAsset(src);
18
- }, [src]);
9
+ }: Omit<ImageProps, "src"> & { src?: ImageProps["src"] | null }) {
10
+ const resolvedSrc = useImageSrc(src);
19
11
 
20
12
  if (!resolvedSrc) {
21
- return null;
22
- }
23
-
24
- const parsedWidth =
25
- typeof width === "number" ? width : width ? Number.parseFloat(width) : undefined;
26
- const parsedHeight =
27
- typeof height === "number" ? height : height ? Number.parseFloat(height) : undefined;
28
-
29
- if (
30
- parsedWidth !== undefined &&
31
- parsedHeight !== undefined &&
32
- Number.isFinite(parsedWidth) &&
33
- Number.isFinite(parsedHeight) &&
34
- parsedWidth > 0 &&
35
- parsedHeight > 0
36
- ) {
37
13
  return (
38
- <UnpicImage
39
- src={resolvedSrc}
40
- width={parsedWidth}
41
- height={parsedHeight}
42
- layout="constrained"
43
- loading={loading}
44
- {...props}
45
- />
14
+ <ImageOff aria-label={props.alt ?? "Image unavailable"} className={props.className} />
46
15
  );
47
16
  }
48
17
 
49
- return <UnpicImage src={resolvedSrc} layout="fullWidth" loading={loading} {...props} />;
18
+ return <UnpicImage {...({ src: resolvedSrc, loading, ...props } as ImageProps)} />;
50
19
  }
@@ -52,9 +52,9 @@ export function SaveSlot({ saveId }: { saveId: number }) {
52
52
  >
53
53
  <Image
54
54
  src={saveData.image}
55
+ layout="fullWidth"
55
56
  alt={saveData.name}
56
- className="absolute inset-0 size-full object-contain rounded-lg"
57
- style={{ pointerEvents: "none", userSelect: "none" }}
57
+ className="absolute inset-0 size-full object-contain rounded-lg pointer-events-none select-none"
58
58
  />
59
59
  {/* top-left metadata */}
60
60
  <div className="absolute top-2.5 left-2.5 flex flex-col gap-0.5 pointer-events-none">
@@ -128,7 +128,7 @@ export function Text({ paragraphRef }: { paragraphRef: RefObject<HTMLDivElement
128
128
  export function CharacterIcon({ alt, icon }: { icon: string; alt: string }) {
129
129
  return (
130
130
  <AspectRatio ratio={16 / 9}>
131
- <Image src={icon} alt={alt} className="h-full w-full object-cover" />
131
+ <Image src={icon} layout="fullWidth" alt={alt} className="h-full w-full object-cover" />
132
132
  </AspectRatio>
133
133
  );
134
134
  }
@@ -1,50 +1,19 @@
1
- import { getPixiJSAsset } from "@/lib/utils/assets-utility";
2
- import { Image as UnpicImage } from "@unpic/react";
3
- import type * as React from "react";
4
- import { useMemo } from "react";
1
+ import { useImageSrc } from "@/lib/hooks/image-hooks";
2
+ import { Image as UnpicImage, type ImageProps } from "@unpic/react";
3
+ import { ImageOff } from "lucide-react";
5
4
 
6
5
  export function Image({
7
6
  src,
8
7
  loading = "lazy",
9
- width,
10
- height,
11
8
  ...props
12
- }: React.ComponentProps<"img">) {
13
- const resolvedSrc = useMemo(() => {
14
- if (!src) {
15
- return undefined;
16
- }
17
- return getPixiJSAsset(src);
18
- }, [src]);
9
+ }: Omit<ImageProps, "src"> & { src?: ImageProps["src"] | null }) {
10
+ const resolvedSrc = useImageSrc(src);
19
11
 
20
12
  if (!resolvedSrc) {
21
- return null;
22
- }
23
-
24
- const parsedWidth =
25
- typeof width === "number" ? width : width ? Number.parseFloat(width) : undefined;
26
- const parsedHeight =
27
- typeof height === "number" ? height : height ? Number.parseFloat(height) : undefined;
28
-
29
- if (
30
- parsedWidth !== undefined &&
31
- parsedHeight !== undefined &&
32
- Number.isFinite(parsedWidth) &&
33
- Number.isFinite(parsedHeight) &&
34
- parsedWidth > 0 &&
35
- parsedHeight > 0
36
- ) {
37
13
  return (
38
- <UnpicImage
39
- src={resolvedSrc}
40
- width={parsedWidth}
41
- height={parsedHeight}
42
- layout="constrained"
43
- loading={loading}
44
- {...props}
45
- />
14
+ <ImageOff aria-label={props.alt ?? "Image unavailable"} className={props.className} />
46
15
  );
47
16
  }
48
17
 
49
- return <UnpicImage src={resolvedSrc} layout="fullWidth" loading={loading} {...props} />;
18
+ return <UnpicImage {...({ src: resolvedSrc, loading, ...props } as ImageProps)} />;
50
19
  }
@@ -52,9 +52,9 @@ export function SaveSlot({ saveId }: { saveId: number }) {
52
52
  >
53
53
  <Image
54
54
  src={saveData.image}
55
+ layout="fullWidth"
55
56
  alt={saveData.name}
56
- className="absolute inset-0 size-full object-contain rounded-lg"
57
- style={{ pointerEvents: "none", userSelect: "none" }}
57
+ className="absolute inset-0 size-full object-contain rounded-lg pointer-events-none select-none"
58
58
  />
59
59
  {/* top-left metadata */}
60
60
  <div className="absolute top-2.5 left-2.5 flex flex-col gap-0.5 pointer-events-none">
@@ -128,7 +128,7 @@ export function Text({ paragraphRef }: { paragraphRef: RefObject<HTMLDivElement
128
128
  export function CharacterIcon({ alt, icon }: { icon: string; alt: string }) {
129
129
  return (
130
130
  <AspectRatio ratio={16 / 9}>
131
- <Image src={icon} alt={alt} className="h-full w-full object-cover" />
131
+ <Image src={icon} layout="fullWidth" alt={alt} className="h-full w-full object-cover" />
132
132
  </AspectRatio>
133
133
  );
134
134
  }
@@ -1,50 +1,19 @@
1
- import { getPixiJSAsset } from "@/lib/utils/assets-utility";
2
- import { Image as UnpicImage } from "@unpic/react";
3
- import type * as React from "react";
4
- import { useMemo } from "react";
1
+ import { useImageSrc } from "@/lib/hooks/image-hooks";
2
+ import { Image as UnpicImage, type ImageProps } from "@unpic/react";
3
+ import { ImageOff } from "lucide-react";
5
4
 
6
5
  export function Image({
7
6
  src,
8
7
  loading = "lazy",
9
- width,
10
- height,
11
8
  ...props
12
- }: React.ComponentProps<"img">) {
13
- const resolvedSrc = useMemo(() => {
14
- if (!src) {
15
- return undefined;
16
- }
17
- return getPixiJSAsset(src);
18
- }, [src]);
9
+ }: Omit<ImageProps, "src"> & { src?: ImageProps["src"] | null }) {
10
+ const resolvedSrc = useImageSrc(src);
19
11
 
20
12
  if (!resolvedSrc) {
21
- return null;
22
- }
23
-
24
- const parsedWidth =
25
- typeof width === "number" ? width : width ? Number.parseFloat(width) : undefined;
26
- const parsedHeight =
27
- typeof height === "number" ? height : height ? Number.parseFloat(height) : undefined;
28
-
29
- if (
30
- parsedWidth !== undefined &&
31
- parsedHeight !== undefined &&
32
- Number.isFinite(parsedWidth) &&
33
- Number.isFinite(parsedHeight) &&
34
- parsedWidth > 0 &&
35
- parsedHeight > 0
36
- ) {
37
13
  return (
38
- <UnpicImage
39
- src={resolvedSrc}
40
- width={parsedWidth}
41
- height={parsedHeight}
42
- layout="constrained"
43
- loading={loading}
44
- {...props}
45
- />
14
+ <ImageOff aria-label={props.alt ?? "Image unavailable"} className={props.className} />
46
15
  );
47
16
  }
48
17
 
49
- return <UnpicImage src={resolvedSrc} layout="fullWidth" loading={loading} {...props} />;
18
+ return <UnpicImage {...({ src: resolvedSrc, loading, ...props } as ImageProps)} />;
50
19
  }
@@ -52,9 +52,9 @@ export function SaveSlot({ saveId }: { saveId: number }) {
52
52
  >
53
53
  <Image
54
54
  src={saveData.image}
55
+ layout="fullWidth"
55
56
  alt={saveData.name}
56
- className="absolute inset-0 size-full object-contain rounded-lg"
57
- style={{ pointerEvents: "none", userSelect: "none" }}
57
+ className="absolute inset-0 size-full object-contain rounded-lg pointer-events-none select-none"
58
58
  />
59
59
  {/* top-left metadata */}
60
60
  <div className="absolute top-2.5 left-2.5 flex flex-col gap-0.5 pointer-events-none">
@@ -128,7 +128,7 @@ export function Text({ paragraphRef }: { paragraphRef: RefObject<HTMLDivElement
128
128
  export function CharacterIcon({ alt, icon }: { icon: string; alt: string }) {
129
129
  return (
130
130
  <AspectRatio ratio={16 / 9}>
131
- <Image src={icon} alt={alt} className="h-full w-full object-cover" />
131
+ <Image src={icon} layout="fullWidth" alt={alt} className="h-full w-full object-cover" />
132
132
  </AspectRatio>
133
133
  );
134
134
  }
@@ -1,50 +1,19 @@
1
- import { getPixiJSAsset } from "@/lib/utils/assets-utility";
2
- import { Image as UnpicImage } from "@unpic/react";
3
- import type * as React from "react";
4
- import { useMemo } from "react";
1
+ import { useImageSrc } from "@/lib/hooks/image-hooks";
2
+ import { Image as UnpicImage, type ImageProps } from "@unpic/react";
3
+ import { ImageOff } from "lucide-react";
5
4
 
6
5
  export function Image({
7
6
  src,
8
7
  loading = "lazy",
9
- width,
10
- height,
11
8
  ...props
12
- }: React.ComponentProps<"img">) {
13
- const resolvedSrc = useMemo(() => {
14
- if (!src) {
15
- return undefined;
16
- }
17
- return getPixiJSAsset(src);
18
- }, [src]);
9
+ }: Omit<ImageProps, "src"> & { src?: ImageProps["src"] | null }) {
10
+ const resolvedSrc = useImageSrc(src);
19
11
 
20
12
  if (!resolvedSrc) {
21
- return null;
22
- }
23
-
24
- const parsedWidth =
25
- typeof width === "number" ? width : width ? Number.parseFloat(width) : undefined;
26
- const parsedHeight =
27
- typeof height === "number" ? height : height ? Number.parseFloat(height) : undefined;
28
-
29
- if (
30
- parsedWidth !== undefined &&
31
- parsedHeight !== undefined &&
32
- Number.isFinite(parsedWidth) &&
33
- Number.isFinite(parsedHeight) &&
34
- parsedWidth > 0 &&
35
- parsedHeight > 0
36
- ) {
37
13
  return (
38
- <UnpicImage
39
- src={resolvedSrc}
40
- width={parsedWidth}
41
- height={parsedHeight}
42
- layout="constrained"
43
- loading={loading}
44
- {...props}
45
- />
14
+ <ImageOff aria-label={props.alt ?? "Image unavailable"} className={props.className} />
46
15
  );
47
16
  }
48
17
 
49
- return <UnpicImage src={resolvedSrc} layout="fullWidth" loading={loading} {...props} />;
18
+ return <UnpicImage {...({ src: resolvedSrc, loading, ...props } as ImageProps)} />;
50
19
  }