@kaijudo/react-game-types 0.1.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/.storybook/main.ts +43 -0
- package/.storybook/preview.ts +14 -0
- package/CHANGELOG.md +92 -0
- package/README.md +42 -0
- package/package.json +66 -0
- package/project.json +39 -0
- package/src/index.ts +3 -0
- package/src/types/civilization/civilization.test.ts +114 -0
- package/src/types/civilization/civilization.ts +50 -0
- package/src/types/civilization/index.ts +1 -0
- package/src/types/era/era.ts +33 -0
- package/src/types/era/index.ts +1 -0
- package/src/types/race/index.ts +1 -0
- package/src/types/race/race.ts +17 -0
- package/src/types/rarity/index.ts +1 -0
- package/src/types/rarity/rarity.ts +8 -0
- package/stories/index.stories.tsx +114 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +13 -0
- package/tsup.config.ts +21 -0
- package/vitest.config.ts +24 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
const config: StorybookConfig = {
|
|
5
|
+
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
6
|
+
addons: [
|
|
7
|
+
"@storybook/addon-links",
|
|
8
|
+
"@storybook/addon-essentials",
|
|
9
|
+
"@storybook/addon-interactions",
|
|
10
|
+
],
|
|
11
|
+
framework: {
|
|
12
|
+
name: "@storybook/react-vite",
|
|
13
|
+
options: {},
|
|
14
|
+
},
|
|
15
|
+
docs: {
|
|
16
|
+
autodocs: "tag",
|
|
17
|
+
},
|
|
18
|
+
async viteFinal(config) {
|
|
19
|
+
// Dynamic imports to avoid ESM/CommonJS conflicts
|
|
20
|
+
const { mergeConfig } = await import("vite");
|
|
21
|
+
const { default: tailwindcss } = await import("@tailwindcss/vite");
|
|
22
|
+
const viteTsConfigPaths = (await import("vite-tsconfig-paths")).default;
|
|
23
|
+
|
|
24
|
+
return mergeConfig(config, {
|
|
25
|
+
plugins: [
|
|
26
|
+
tailwindcss(),
|
|
27
|
+
viteTsConfigPaths({
|
|
28
|
+
projects: [path.resolve(__dirname, "../tsconfig.json")],
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
resolve: {
|
|
32
|
+
alias: {
|
|
33
|
+
"@kaijudo/creature-images": path.resolve(
|
|
34
|
+
__dirname,
|
|
35
|
+
"../../creature-images/src"
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default config;
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
## 0.4.0 (2025-12-25)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Package rename and deployment preparation. ([ee2e8fd](https://github.com/vreddi/kaijudo/commit/ee2e8fd))
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
|
|
9
|
+
- Renamed package from `@kaijudo/types` to `@kaijudo/react-game-types`
|
|
10
|
+
- Updated package name and all internal references
|
|
11
|
+
- Maintains all existing functionality and type definitions
|
|
12
|
+
- Ready for initial public release under new package name
|
|
13
|
+
|
|
14
|
+
## Package Contents
|
|
15
|
+
|
|
16
|
+
- Type definitions for core game entities:
|
|
17
|
+
- `Era` - Game era enumeration
|
|
18
|
+
- `Rarity` - Card rarity types
|
|
19
|
+
- `Race` - Creature race definitions
|
|
20
|
+
- `Civilization` - Civilization types
|
|
21
|
+
- Full TypeScript support with type exports
|
|
22
|
+
- ESM and CommonJS module support
|
|
23
|
+
|
|
24
|
+
## Publishing
|
|
25
|
+
|
|
26
|
+
- Configured for npm publishing with public access
|
|
27
|
+
- GitHub Actions workflow ready for automated publishing
|
|
28
|
+
- Project-level changelog enabled
|
|
29
|
+
|
|
30
|
+
### ❤️ Thank You
|
|
31
|
+
|
|
32
|
+
- Vishrut Reddi @vreddi
|
|
33
|
+
|
|
34
|
+
# Changelog
|
|
35
|
+
|
|
36
|
+
This file contains all notable changes to the `@kaijudo/types` package.
|
|
37
|
+
|
|
38
|
+
## 0.2.0 (2025-12-25)
|
|
39
|
+
|
|
40
|
+
### 🚀 Features
|
|
41
|
+
|
|
42
|
+
- Initial release of @kaijudo/types package. ([73bc579](https://github.com/vreddi/kaijudo/commit/73bc579))
|
|
43
|
+
|
|
44
|
+
This is the first public release of the types package, providing core type definitions for the Kaijudo project.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- Type definitions for core game entities:
|
|
49
|
+
- `Era` - Game era enumeration
|
|
50
|
+
- `Rarity` - Card rarity types
|
|
51
|
+
- `Race` - Creature race definitions
|
|
52
|
+
- Full TypeScript support with type exports
|
|
53
|
+
- ESM and CommonJS module support
|
|
54
|
+
- Comprehensive type definitions for game mechanics
|
|
55
|
+
|
|
56
|
+
## Package Setup
|
|
57
|
+
|
|
58
|
+
- Configured for publishing to npm
|
|
59
|
+
- Version plans workflow enabled
|
|
60
|
+
- GitHub Actions publishing pipeline ready
|
|
61
|
+
|
|
62
|
+
### ❤️ Thank You
|
|
63
|
+
|
|
64
|
+
- Vishrut Reddi @vreddi
|
|
65
|
+
|
|
66
|
+
## 0.1.0 (2025-12-25)
|
|
67
|
+
|
|
68
|
+
### 🚀 Features
|
|
69
|
+
|
|
70
|
+
- Initial release of @kaijudo/types package. ([73bc579](https://github.com/vreddi/kaijudo/commit/73bc579))
|
|
71
|
+
|
|
72
|
+
This is the first public release of the types package, providing core type definitions for the Kaijudo project.
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- Type definitions for core game entities:
|
|
77
|
+
- `Era` - Game era enumeration
|
|
78
|
+
- `Rarity` - Card rarity types
|
|
79
|
+
- `Race` - Creature race definitions
|
|
80
|
+
- Full TypeScript support with type exports
|
|
81
|
+
- ESM and CommonJS module support
|
|
82
|
+
- Comprehensive type definitions for game mechanics
|
|
83
|
+
|
|
84
|
+
## Package Setup
|
|
85
|
+
|
|
86
|
+
- Configured for publishing to npm
|
|
87
|
+
- Version plans workflow enabled
|
|
88
|
+
- GitHub Actions publishing pipeline ready
|
|
89
|
+
|
|
90
|
+
### ❤️ Thank You
|
|
91
|
+
|
|
92
|
+
- Vishrut Reddi @vreddi
|
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @kaijudo/create-types
|
|
2
|
+
|
|
3
|
+
A React component package.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @kaijudo/create-types
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { CreateTypes } from '@kaijudo/create-types';
|
|
15
|
+
|
|
16
|
+
function App() {
|
|
17
|
+
return <CreateTypes>Hello World</CreateTypes>;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Development
|
|
22
|
+
|
|
23
|
+
### Build
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Storybook
|
|
30
|
+
|
|
31
|
+
Run Storybook to view and test the component:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm storybook
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Build static Storybook:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm build-storybook
|
|
41
|
+
```
|
|
42
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kaijudo/react-game-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"clsx": "^2.1.1",
|
|
19
|
+
"tailwind-merge": "^3.0.2",
|
|
20
|
+
"class-variance-authority": "^0.7.1",
|
|
21
|
+
"react": "^19.2.0",
|
|
22
|
+
"react-dom": "^19.2.0",
|
|
23
|
+
"@kaijudo/react-storybook": "0.0.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@storybook/addon-essentials": "*",
|
|
27
|
+
"@storybook/addon-interactions": "*",
|
|
28
|
+
"@storybook/addon-links": "*",
|
|
29
|
+
"@storybook/blocks": "*",
|
|
30
|
+
"@storybook/react": "*",
|
|
31
|
+
"@storybook/react-vite": "*",
|
|
32
|
+
"@storybook/test": "*",
|
|
33
|
+
"@types/react": "^19.2.0",
|
|
34
|
+
"@types/react-dom": "^19.2.0",
|
|
35
|
+
"storybook": "*",
|
|
36
|
+
"tsup": "^8.5.1",
|
|
37
|
+
"typescript": "~5.9.2",
|
|
38
|
+
"vite": "^7.1.7",
|
|
39
|
+
"vitest": "^3.0.5",
|
|
40
|
+
"@testing-library/react": "^16.2.0",
|
|
41
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
42
|
+
"jsdom": "^27.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": "^19.2.0",
|
|
46
|
+
"react-dom": "^19.2.0",
|
|
47
|
+
"tailwindcss": "^4.0.0",
|
|
48
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
49
|
+
"motion": "^12.0.0"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/vreddi/kaijudo.git"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch",
|
|
61
|
+
"test": "vitest run",
|
|
62
|
+
"test:watch": "vitest",
|
|
63
|
+
"storybook": "storybook dev -p 6006",
|
|
64
|
+
"build-storybook": "storybook build"
|
|
65
|
+
}
|
|
66
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kaijudo/react-game-types",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"projectType": "library",
|
|
5
|
+
"sourceRoot": "src",
|
|
6
|
+
"tags": ["publishable"],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "nx:run-commands",
|
|
10
|
+
"options": {
|
|
11
|
+
"command": "tsup",
|
|
12
|
+
"cwd": "{projectRoot}"
|
|
13
|
+
},
|
|
14
|
+
"outputs": ["{projectRoot}/dist"]
|
|
15
|
+
},
|
|
16
|
+
"storybook": {
|
|
17
|
+
"executor": "nx:run-commands",
|
|
18
|
+
"options": {
|
|
19
|
+
"command": "storybook dev -p 6006 --config-dir .storybook",
|
|
20
|
+
"cwd": "{projectRoot}"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"build-storybook": {
|
|
24
|
+
"executor": "nx:run-commands",
|
|
25
|
+
"options": {
|
|
26
|
+
"command": "storybook build --config-dir .storybook",
|
|
27
|
+
"cwd": "{projectRoot}"
|
|
28
|
+
},
|
|
29
|
+
"outputs": ["{workspaceRoot}/storybook-static"]
|
|
30
|
+
},
|
|
31
|
+
"test": {
|
|
32
|
+
"executor": "nx:run-commands",
|
|
33
|
+
"options": {
|
|
34
|
+
"command": "vitest run",
|
|
35
|
+
"cwd": "."
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { Civilization } from "./civilization";
|
|
3
|
+
|
|
4
|
+
describe("Civilization", () => {
|
|
5
|
+
describe("enum values", () => {
|
|
6
|
+
it("should have all expected civilization values", () => {
|
|
7
|
+
expect(Civilization.Light).toBe("light");
|
|
8
|
+
expect(Civilization.Water).toBe("water");
|
|
9
|
+
expect(Civilization.Darkness).toBe("darkness");
|
|
10
|
+
expect(Civilization.Fire).toBe("fire");
|
|
11
|
+
expect(Civilization.Nature).toBe("nature");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should have exactly 5 civilizations", () => {
|
|
15
|
+
const values = Object.values(Civilization);
|
|
16
|
+
expect(values).toHaveLength(5);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should have unique values", () => {
|
|
20
|
+
const values = Object.values(Civilization);
|
|
21
|
+
const uniqueValues = new Set(values);
|
|
22
|
+
expect(uniqueValues.size).toBe(values.length);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should have all values as strings", () => {
|
|
26
|
+
const values = Object.values(Civilization);
|
|
27
|
+
values.forEach((value) => {
|
|
28
|
+
expect(typeof value).toBe("string");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("enum keys", () => {
|
|
34
|
+
it("should have correct key names", () => {
|
|
35
|
+
expect(Civilization.Light).toBeDefined();
|
|
36
|
+
expect(Civilization.Water).toBeDefined();
|
|
37
|
+
expect(Civilization.Darkness).toBeDefined();
|
|
38
|
+
expect(Civilization.Fire).toBeDefined();
|
|
39
|
+
expect(Civilization.Nature).toBeDefined();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should have all keys as expected", () => {
|
|
43
|
+
const keys = Object.keys(Civilization);
|
|
44
|
+
const expectedKeys = ["Light", "Water", "Darkness", "Fire", "Nature"];
|
|
45
|
+
expect(keys.sort()).toEqual(expectedKeys.sort());
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe("enum usage", () => {
|
|
50
|
+
it("should be usable in comparisons", () => {
|
|
51
|
+
expect(Civilization.Light === "light").toBe(true);
|
|
52
|
+
expect(Civilization.Water === "water").toBe(true);
|
|
53
|
+
expect(Civilization.Darkness === "darkness").toBe(true);
|
|
54
|
+
expect(Civilization.Fire === "fire").toBe(true);
|
|
55
|
+
expect(Civilization.Nature === "nature").toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should be iterable", () => {
|
|
59
|
+
const values = Object.values(Civilization);
|
|
60
|
+
expect(values).toContain("light");
|
|
61
|
+
expect(values).toContain("water");
|
|
62
|
+
expect(values).toContain("darkness");
|
|
63
|
+
expect(values).toContain("fire");
|
|
64
|
+
expect(values).toContain("nature");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should be usable in switch statements", () => {
|
|
68
|
+
const getCivilizationType = (civilization: Civilization): string => {
|
|
69
|
+
switch (civilization) {
|
|
70
|
+
case Civilization.Light:
|
|
71
|
+
return "defensive";
|
|
72
|
+
case Civilization.Water:
|
|
73
|
+
return "control";
|
|
74
|
+
case Civilization.Darkness:
|
|
75
|
+
return "aggressive";
|
|
76
|
+
case Civilization.Fire:
|
|
77
|
+
return "rush";
|
|
78
|
+
case Civilization.Nature:
|
|
79
|
+
return "ramp";
|
|
80
|
+
default:
|
|
81
|
+
return "unknown";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
expect(getCivilizationType(Civilization.Light)).toBe("defensive");
|
|
86
|
+
expect(getCivilizationType(Civilization.Water)).toBe("control");
|
|
87
|
+
expect(getCivilizationType(Civilization.Darkness)).toBe("aggressive");
|
|
88
|
+
expect(getCivilizationType(Civilization.Fire)).toBe("rush");
|
|
89
|
+
expect(getCivilizationType(Civilization.Nature)).toBe("ramp");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("specific civilization values", () => {
|
|
94
|
+
it("should have Light civilization with correct value", () => {
|
|
95
|
+
expect(Civilization.Light).toBe("light");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("should have Water civilization with correct value", () => {
|
|
99
|
+
expect(Civilization.Water).toBe("water");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("should have Darkness civilization with correct value", () => {
|
|
103
|
+
expect(Civilization.Darkness).toBe("darkness");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("should have Fire civilization with correct value", () => {
|
|
107
|
+
expect(Civilization.Fire).toBe("fire");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("should have Nature civilization with correct value", () => {
|
|
111
|
+
expect(Civilization.Nature).toBe("nature");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Civilization is a gameplay characteristic
|
|
3
|
+
* indicating the powers.
|
|
4
|
+
*/
|
|
5
|
+
export enum Civilization {
|
|
6
|
+
/**
|
|
7
|
+
* Defense, control, and order -
|
|
8
|
+
* blockers, shields, tapping/stun effects,
|
|
9
|
+
* and defensive utility; stabilizes the
|
|
10
|
+
* game and wins through inevitability.
|
|
11
|
+
* @docs https://duelmasters.fandom.com/wiki/Light_Civilization
|
|
12
|
+
*/
|
|
13
|
+
Light = "light",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Card advantage and tempo - draws cards,
|
|
17
|
+
* bounces threats, manipulates hand/board,
|
|
18
|
+
* and wins by out-resourcing and out-positioning
|
|
19
|
+
* opponents.
|
|
20
|
+
* @docs https://duelmasters.fandom.com/wiki/Water_Civilization
|
|
21
|
+
*/
|
|
22
|
+
Water = "water",
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Discard and sacrifice - graveyard synergy,
|
|
26
|
+
* removal via destruction, hand disruption,
|
|
27
|
+
* and risky power plays; trades life/board
|
|
28
|
+
* for brutal advantage.
|
|
29
|
+
* @docs https://duelmasters.fandom.com/wiki/Darkness_Civilization
|
|
30
|
+
*/
|
|
31
|
+
Darkness = "darkness",
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Fast, aggressive, and explosive -
|
|
35
|
+
* rush creatures, speed attacker, power
|
|
36
|
+
* spikes, and burn-style removal; wins
|
|
37
|
+
* by pressuring early and finishing hard.
|
|
38
|
+
* @docs https://duelmasters.fandom.com/wiki/Fire_Civilization
|
|
39
|
+
*/
|
|
40
|
+
Fire = "fire",
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Mana acceleration and big bodies - ramps
|
|
44
|
+
* resources quickly, cheats out large creatures,
|
|
45
|
+
* and overwhelms with efficient stats and
|
|
46
|
+
* board presence.
|
|
47
|
+
* @docs https://duelmasters.fandom.com/wiki/Nature_Civilization
|
|
48
|
+
*/
|
|
49
|
+
Nature = "nature",
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Civilization } from "./civilization";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export enum Era {
|
|
2
|
+
/**
|
|
3
|
+
* Shobu Era is a period of time in the production and
|
|
4
|
+
* media development of the Duel Masters franchise where
|
|
5
|
+
* Shobu Kirifuda was the lead character.
|
|
6
|
+
* @docs https://duelmasters.fandom.com/wiki/Shobu_Era
|
|
7
|
+
*/
|
|
8
|
+
Shobu = "shobu",
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Katta Era is a period of time in the production and
|
|
12
|
+
* media development of the Duel Masters franchise where
|
|
13
|
+
* Katta was the lead character.
|
|
14
|
+
* @docs https://duelmasters.fandom.com/wiki/Katta_Era
|
|
15
|
+
*/
|
|
16
|
+
Katta = "katta",
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The Joe Era is a period of time in the production and
|
|
20
|
+
* media development of the Duel Masters franchise where
|
|
21
|
+
* Joe Kirifuda is the lead character.
|
|
22
|
+
* @docs https://duelmasters.fandom.com/wiki/Joe_Era
|
|
23
|
+
*/
|
|
24
|
+
Joe = "joe",
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Win Era is a period of time in the production and
|
|
28
|
+
* media development of the Duel Masters franchise where
|
|
29
|
+
* Win Kirifuda was the lead character.
|
|
30
|
+
* @docs https://duelmasters.fandom.com/wiki/Win_Era
|
|
31
|
+
*/
|
|
32
|
+
Win = "win",
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Era } from "./era";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Race } from "./race";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export enum Race {
|
|
2
|
+
AngelCommand = "angelCommand",
|
|
3
|
+
ApolloniaDragon = "apolloniaDragon",
|
|
4
|
+
ArcSeraphim = "arcSeraphim",
|
|
5
|
+
ArmoredDragon = "armoredDragon",
|
|
6
|
+
ArmoredWyvern = "armoredWyvern",
|
|
7
|
+
Armorloid = "armorloid",
|
|
8
|
+
BalloonMushroom = "balloonMushroom",
|
|
9
|
+
BeastFolk = "beastFolk",
|
|
10
|
+
Berserker = "berserker",
|
|
11
|
+
BigMuscle = "bigMuscle",
|
|
12
|
+
BlueMonster = "blueMonster",
|
|
13
|
+
BrainJacker = "brainJacker",
|
|
14
|
+
BraveSpirit = "braveSpirit",
|
|
15
|
+
LiquidPeople = "liquidPeople",
|
|
16
|
+
LightBringer = "lightBringer",
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Rarity } from "./rarity";
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { UtilityPage } from "@kaijudo/react-storybook";
|
|
3
|
+
import { Era, Rarity, Race } from "../src/index.js";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Utilities/Game Types",
|
|
7
|
+
component: UtilityPage,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "fullscreen",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
} satisfies Meta<typeof UtilityPage>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const TypesDocumentation: Story = {
|
|
18
|
+
render: () => (
|
|
19
|
+
<UtilityPage
|
|
20
|
+
name="Game Types"
|
|
21
|
+
description="TypeScript type definitions for Kaijudo game entities including eras, rarities, and races."
|
|
22
|
+
>
|
|
23
|
+
<div className="min-h-screen bg-white">
|
|
24
|
+
<div className="max-w-7xl mx-auto px-8 py-8">
|
|
25
|
+
<div className="space-y-12">
|
|
26
|
+
{/* Era Section */}
|
|
27
|
+
<section>
|
|
28
|
+
<h2 className="text-3xl font-bold mb-4">Era</h2>
|
|
29
|
+
<p className="text-gray-600 mb-6">
|
|
30
|
+
Represents different periods in the Duel Masters franchise
|
|
31
|
+
timeline.
|
|
32
|
+
</p>
|
|
33
|
+
<div className="bg-gray-50 rounded-lg p-6">
|
|
34
|
+
<div className="space-y-4">
|
|
35
|
+
{Object.entries(Era).map(([key, value]) => (
|
|
36
|
+
<div
|
|
37
|
+
key={key}
|
|
38
|
+
className="border-b border-gray-200 pb-4 last:border-0"
|
|
39
|
+
>
|
|
40
|
+
<div className="flex items-center gap-4">
|
|
41
|
+
<code className="text-sm font-mono bg-white px-3 py-1 rounded border">
|
|
42
|
+
{key}
|
|
43
|
+
</code>
|
|
44
|
+
<span className="text-gray-500">=</span>
|
|
45
|
+
<code className="text-sm font-mono bg-white px-3 py-1 rounded border text-blue-600">
|
|
46
|
+
"{String(value)}"
|
|
47
|
+
</code>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
{/* Rarity Section */}
|
|
56
|
+
<section>
|
|
57
|
+
<h2 className="text-3xl font-bold mb-4">Rarity</h2>
|
|
58
|
+
<p className="text-gray-600 mb-6">
|
|
59
|
+
Card rarity levels in the game.
|
|
60
|
+
</p>
|
|
61
|
+
<div className="bg-gray-50 rounded-lg p-6">
|
|
62
|
+
<div className="space-y-4">
|
|
63
|
+
{Object.entries(Rarity).map(([key, value]) => (
|
|
64
|
+
<div
|
|
65
|
+
key={key}
|
|
66
|
+
className="border-b border-gray-200 pb-4 last:border-0"
|
|
67
|
+
>
|
|
68
|
+
<div className="flex items-center gap-4">
|
|
69
|
+
<code className="text-sm font-mono bg-white px-3 py-1 rounded border">
|
|
70
|
+
{key}
|
|
71
|
+
</code>
|
|
72
|
+
<span className="text-gray-500">=</span>
|
|
73
|
+
<code className="text-sm font-mono bg-white px-3 py-1 rounded border text-blue-600">
|
|
74
|
+
"{String(value)}"
|
|
75
|
+
</code>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</section>
|
|
82
|
+
|
|
83
|
+
{/* Race Section */}
|
|
84
|
+
<section>
|
|
85
|
+
<h2 className="text-3xl font-bold mb-4">Race</h2>
|
|
86
|
+
<p className="text-gray-600 mb-6">
|
|
87
|
+
Creature race types in the game.
|
|
88
|
+
</p>
|
|
89
|
+
<div className="bg-gray-50 rounded-lg p-6">
|
|
90
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
91
|
+
{Object.entries(Race).map(([key, value]) => (
|
|
92
|
+
<div
|
|
93
|
+
key={key}
|
|
94
|
+
className="border border-gray-200 rounded p-4 bg-white"
|
|
95
|
+
>
|
|
96
|
+
<div className="flex flex-col gap-2">
|
|
97
|
+
<code className="text-sm font-mono font-semibold">
|
|
98
|
+
{key}
|
|
99
|
+
</code>
|
|
100
|
+
<code className="text-xs font-mono text-blue-600">
|
|
101
|
+
"{String(value)}"
|
|
102
|
+
</code>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
))}
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</section>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</UtilityPage>
|
|
113
|
+
),
|
|
114
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"lib": ["es2022", "dom", "dom.iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"skipLibCheck": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["src/**/*", "*.config.ts", ".storybook/**/*"],
|
|
12
|
+
"exclude": ["node_modules", "dist", "storybook-static"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": true,
|
|
7
|
+
"emitDeclarationOnly": false,
|
|
8
|
+
"noEmit": false
|
|
9
|
+
},
|
|
10
|
+
"include": ["src/**/*"],
|
|
11
|
+
"exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.stories.ts", ".storybook"]
|
|
12
|
+
}
|
|
13
|
+
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['esm', 'cjs'],
|
|
6
|
+
dts: {
|
|
7
|
+
resolve: true,
|
|
8
|
+
},
|
|
9
|
+
splitting: false,
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
clean: true,
|
|
12
|
+
external: ['react', 'react-dom', 'tailwindcss'],
|
|
13
|
+
// Copy CSS files to dist
|
|
14
|
+
loader: {
|
|
15
|
+
'.css': 'copy',
|
|
16
|
+
},
|
|
17
|
+
// Include CSS in the bundle output
|
|
18
|
+
publicDir: false,
|
|
19
|
+
tsconfig: './tsconfig.lib.json',
|
|
20
|
+
});
|
|
21
|
+
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true,
|
|
6
|
+
environment: 'jsdom',
|
|
7
|
+
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
8
|
+
exclude: ['node_modules', 'dist', 'storybook-static'],
|
|
9
|
+
coverage: {
|
|
10
|
+
provider: 'v8',
|
|
11
|
+
reporter: ['text', 'json', 'html'],
|
|
12
|
+
exclude: [
|
|
13
|
+
'node_modules',
|
|
14
|
+
'dist',
|
|
15
|
+
'storybook-static',
|
|
16
|
+
'**/*.config.{js,ts}',
|
|
17
|
+
'**/*.spec.{js,ts}',
|
|
18
|
+
'**/*.test.{js,ts}',
|
|
19
|
+
'**/*.stories.{js,ts,tsx}',
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|