Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prod] narraleaf-react-0.0.1-beta.8 #9

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "narraleaf-react",
"version": "0.0.1-beta.6",
"version": "0.0.1-beta.8",
"description": "A React visual novel player framework",
"main": "./dist/index.js",
"main": "./dist/main.js",
"types": "./dist/index.d.ts",
"scripts": {
"prebuild": "rimraf dist",
Expand All @@ -13,6 +13,7 @@
"lint": "eslint \"./src/**/*.{ts,tsx,js,jsx}\"",
"lint:fix": "eslint --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
"prepublish": "npm run lint && rimraf dist && webpack --config webpack.config.js && tsc-alias -p tsconfig.json",
"publish": "npm publish",
"typedoc": "typedoc src/index.ts --out doc"
},
"devDependencies": {
Expand Down Expand Up @@ -70,6 +71,7 @@
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"@emotion/is-prop-valid": "^1.3.0",
"client-only": "^0.0.1",
"clsx": "^2.1.1",
"framer-motion": "^11.5.4",
Expand Down
2 changes: 2 additions & 0 deletions src/game/nlcore/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export class Game {
aspectRatio: 16 / 9,
minWidth: 800,
minHeight: 450,
width: "100%",
height: "100%",
},
elements: {
say: {
Expand Down
2 changes: 2 additions & 0 deletions src/game/nlcore/gameTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export type GameConfig = {
aspectRatio: number;
minWidth: number;
minHeight: number;
width: number | string;
height: number | string;
};
elements: {
say: {
Expand Down
7 changes: 5 additions & 2 deletions src/game/player/elements/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ export default function Player(
}
}

const playerWidth = width || game.config.player.width;
const playerHeight = height || game.config.player.height;

return (
<Motion>
<div style={{
width: typeof width === "number" ? `${width}px` : width,
height: typeof height === "number" ? `${height}px` : height,
width: typeof playerWidth === "number" ? `${playerWidth}px` : playerWidth,
height: typeof playerHeight === "number" ? `${playerHeight}px` : playerHeight,
}} className={clsx(className)}>
<AspectRatio className={clsx("flex-grow overflow-auto")}>
<Isolated className="relative">
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
main: ["./src/index.ts"]
},
output: {
filename: (!useAnalyzer) ? "index.js" : "[name].[contenthash].js",
filename: (!useAnalyzer) ? "main.js" : "[name].[contenthash].js",
path: path.resolve(__dirname, "dist"),
library: "NarraleafReact",
libraryTarget: "umd",
Expand Down