Skip to content

Commit

Permalink
Update dependencies and refactor interface imports for improved struc…
Browse files Browse the repository at this point in the history
…ture
  • Loading branch information
BlackRam-oss committed Jan 29, 2025
1 parent 2e6aeab commit 48d2c16
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 143 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@
"dependencies": {
"@pixi/devtools": "^2.0.1",
"@pixi/sound": "^6.0.1",
"pixi.js": "^8.6.6"
"pixi.js": "^8.7.2"
},
"devDependencies": {
"@drincs/pixi-vn": "^0.10.1",
"@types/crypto-js": "^4.2.2",
"@types/deep-diff": "^1.0.5",
"crypto-js": "^4.2.0",
"deep-diff": "^1.0.2",
"jsdom": "^26.0.0",
"ts-node": "^10.9.2",
"tsup": "^8.3.5",
"tsup": "^8.3.6",
"typescript": "^5.7.3",
"vitest": "^2.1.8"
"vitest": "^3.0.4"
},
"keywords": [
"engine",
Expand Down
4 changes: 2 additions & 2 deletions src/interface/CharacterInterface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CharacterInterface } from "@drincs/pixi-vn/dist/override";
import { CharacterInterface } from "@drincs/pixi-vn";

export default interface CharacterBaseInterface extends CharacterInterface {
id: string
id: string;
}
82 changes: 0 additions & 82 deletions src/override/CharacterInterface.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/override/StepLabelProps.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src/override/StepLabelResult.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/override/index.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/override/package.json

This file was deleted.

117 changes: 117 additions & 0 deletions src/pixi-vn.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
declare module "@drincs/pixi-vn" {
/**
* CharacterInterface is the interface that character must implement or extend.
* So if you want to create your own Character, you must override this interface, implement or extend it and extend the {@link CharacterStoredClass} class.
* You can override this interface to add your own props.
* @example
* ```typescript
* // pixi-vn.d.ts
* declare module '@drincs/pixi-vn' {
* interface CharacterInterface {
* name: string
* surname?: string
* age?: number
* icon?: string
* color?: string
* }
* }
* // You Character class
* export class Character extends CharacterStoredClass implements CharacterInterface {
* constructor(id: string, props: CharacterProps) {
* super(id)
* this.defaultName = props.name
* this.defaultSurname = props.surname
* this.defaultAge = props.age
* this._icon = props.icon
* this._color = props.color
* }
* private defaultName: string = ""
* get name(): string {
* return this.getStorageProperty<string>("name") || this.defaultName
* }
* set name(value: string | undefined) {
* this.setStorageProperty<string>("name", value)
* }
* private defaultSurname?: string
* get surname(): string | undefined {
* return this.getStorageProperty<string>("surname") || this.defaultSurname
* }
* set surname(value: string | undefined) {
* this.setStorageProperty<string>("surname", value)
* }
* private defaultAge?: number | undefined
* get age(): number | undefined {
* return this.getStorageProperty<number>("age") || this.defaultAge
* }
* set age(value: number | undefined) {
* this.setStorageProperty<number>("age", value)
* }
* private _icon?: string
* get icon(): string | undefined {
* return this._icon
* }
* private _color?: string | undefined
* get color(): string | undefined {
* return this._color
* }
* }
* ```
*/
interface CharacterInterface {
/**
* The name of the character.
*/
name: string;
/**
* The surname of the character.
*/
surname?: string;
/**
* The age of the character.
*/
age?: number;
/**
* The icon of the character.
*/
readonly icon?: string;
/**
* The color of the character.
*/
readonly color?: string;
}
/**
* StepLabelPropsType is the type of the props that will be passed to the StepLabel.
* You can override this interface to add your own props.
* @example
* ```typescript
* // pixi-vn.d.ts
* declare module '@drincs/pixi-vn' {
* interface StepLabelProps {
* navigate: (route: string) => void,
* [key: string]: any
* }
* }
* ```
*/
interface StepLabelProps {
[key: string]: any;
}
/**
* StepLabelResultType is the return type of the StepLabel function.
* It can be useful for returning to the information calling function to perform other operations that cannot be performed within the StepLabel.
* You can override this interface to add your own return types.
* @example
* ```typescript
* // pixi-vn.d.ts
* declare module '@drincs/pixi-vn' {
* interface StepLabelResult {
* newRoute?: string,
* [key: string]: any
* }
* }
* ```
*/
interface StepLabelResult {
[key: string]: any;
}
}
21 changes: 12 additions & 9 deletions src/types/StepLabelType.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { StepLabelProps, StepLabelResult } from '@drincs/pixi-vn/dist/override';
import { StepLabelProps, StepLabelResult } from "@drincs/pixi-vn";

export type StepLabelResultType = StepLabelResult | void
export type StepLabelPropsType<T extends {} = {}> = StepLabelProps & T
export type StepLabelResultType = StepLabelResult | void;
export type StepLabelPropsType<T extends {} = {}> = StepLabelProps & T;

/**
* StepLabel is a function that will be executed as the game continues.
*/
export type StepLabelType<T extends {} = {}> = ((props: StepLabelPropsType<T>, info: {
/**
* The id of the label.
*/
labelId: string
}) => StepLabelResultType | Promise<StepLabelResultType>)
export type StepLabelType<T extends {} = {}> = (
props: StepLabelPropsType<T>,
info: {
/**
* The id of the label.
*/
labelId: string;
}
) => StepLabelResultType | Promise<StepLabelResultType>;
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */

/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
Expand Down

0 comments on commit 48d2c16

Please sign in to comment.