@lamppost/create-ink-player 1.0.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/LICENSE +7 -0
- package/README.md +7 -0
- package/index.js +134 -0
- package/package.json +33 -0
- package/template/README.md +16 -0
- package/template/package.json +30 -0
- package/template/patches/@restart__ui.patch +26 -0
- package/template/pnpm-lock.yaml +2266 -0
- package/template/rsbuild.config.ts +38 -0
- package/template/src/About.tsx +45 -0
- package/template/src/env.d.ts +17 -0
- package/template/src/index.ts +100 -0
- package/template/src/styles.scss +1 -0
- package/template/story/game.ink +13 -0
- package/template/tsconfig.json +30 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineConfig } from "@rsbuild/core";
|
|
2
|
+
import { pluginImageCompress } from "@rsbuild/plugin-image-compress";
|
|
3
|
+
import { pluginPreact } from "@rsbuild/plugin-preact";
|
|
4
|
+
import { pluginSass } from "@rsbuild/plugin-sass";
|
|
5
|
+
import { pluginSvgr } from "@rsbuild/plugin-svgr";
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
output: {
|
|
9
|
+
assetPrefix: "./",
|
|
10
|
+
},
|
|
11
|
+
dev: {
|
|
12
|
+
hmr: false,
|
|
13
|
+
},
|
|
14
|
+
tools: {
|
|
15
|
+
rspack(_config, { addRules }) {
|
|
16
|
+
addRules([
|
|
17
|
+
{
|
|
18
|
+
test: /\.ink$/,
|
|
19
|
+
use: ["@lamppost/ink-player/ink-loader"],
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
resolve: {
|
|
25
|
+
alias: {
|
|
26
|
+
react: "preact/compat",
|
|
27
|
+
"react-dom/test-utils": "preact/test-utils",
|
|
28
|
+
"react-dom": "preact/compat",
|
|
29
|
+
"react/jsx-runtime": "preact/jsx-runtime",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
plugins: [
|
|
33
|
+
pluginPreact(),
|
|
34
|
+
pluginSass(),
|
|
35
|
+
pluginSvgr(),
|
|
36
|
+
pluginImageCompress(),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ScreenProps } from "@lamppost/ink-player";
|
|
2
|
+
import Button from "react-bootstrap/Button";
|
|
3
|
+
import Card from "react-bootstrap/Card";
|
|
4
|
+
import Spinner from "react-bootstrap/Spinner";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The component is provided with the following props:
|
|
8
|
+
* - setPage: A function to navigate to a different screen
|
|
9
|
+
* - loading: A boolean indicating if the game is loading
|
|
10
|
+
*
|
|
11
|
+
* Use setPage("game") to navigate to the game screen.
|
|
12
|
+
*/
|
|
13
|
+
export function About({ setPage, loading }: ScreenProps) {
|
|
14
|
+
return (
|
|
15
|
+
<Card>
|
|
16
|
+
{/*
|
|
17
|
+
// You can add an image here and it'll display at the
|
|
18
|
+
// top of the page.
|
|
19
|
+
// import topImage from "./assets/images/top-image.jpg";
|
|
20
|
+
<Card.Img
|
|
21
|
+
variant="top"
|
|
22
|
+
src={topImage}
|
|
23
|
+
alt="LampPost Player top image"
|
|
24
|
+
/>
|
|
25
|
+
*/}
|
|
26
|
+
<Card.Body>
|
|
27
|
+
{/* You can put anything else you want in here! */}
|
|
28
|
+
<Button
|
|
29
|
+
variant="primary"
|
|
30
|
+
size="lg"
|
|
31
|
+
onClick={() => setPage("game")}
|
|
32
|
+
disabled={loading}
|
|
33
|
+
>
|
|
34
|
+
{loading ? (
|
|
35
|
+
<>
|
|
36
|
+
<Spinner animation="border" size="sm" /> Loading...
|
|
37
|
+
</>
|
|
38
|
+
) : (
|
|
39
|
+
"Start Playing"
|
|
40
|
+
)}
|
|
41
|
+
</Button>
|
|
42
|
+
</Card.Body>
|
|
43
|
+
</Card>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="@rsbuild/core/types" />
|
|
2
|
+
|
|
3
|
+
declare module "*.svg" {
|
|
4
|
+
const content: string;
|
|
5
|
+
export default content;
|
|
6
|
+
}
|
|
7
|
+
declare module "*.svg?react" {
|
|
8
|
+
const ReactComponent: React.FunctionComponent<
|
|
9
|
+
React.SVGProps<SVGSVGElement>
|
|
10
|
+
>;
|
|
11
|
+
export default ReactComponent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module "*.ink" {
|
|
15
|
+
const content: { inkVersion: number };
|
|
16
|
+
export default content;
|
|
17
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { init } from "@lamppost/ink-player";
|
|
2
|
+
import locationPlugin from "@lamppost/ink-player/plugins/location";
|
|
3
|
+
import textInputPlugin from "@lamppost/ink-player/plugins/text-input";
|
|
4
|
+
|
|
5
|
+
import "@lamppost/ink-player/styles.css";
|
|
6
|
+
import "./styles.scss";
|
|
7
|
+
|
|
8
|
+
import { About } from "./About";
|
|
9
|
+
|
|
10
|
+
init({
|
|
11
|
+
/**
|
|
12
|
+
* The name of the game. It will be used in the following ways:
|
|
13
|
+
* - As the title of the browser tab
|
|
14
|
+
* - As the name of the game in the header (if no shortGameName is provided)
|
|
15
|
+
* - As the ID for storing the saved games in the browser's local storage
|
|
16
|
+
*/
|
|
17
|
+
gameName: "Lamp Post Player",
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Load the Ink story. Change this to point to your own story file.
|
|
21
|
+
*/
|
|
22
|
+
loadStory: () => import("../story/game.ink"),
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The short name of the game. It will be used as the name of the game
|
|
26
|
+
* in the header. If not provided, the gameName will be used.
|
|
27
|
+
*/
|
|
28
|
+
// shortGameName: "LampPost Player",
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Whether to enable dark mode. If not provided, dark mode will not be
|
|
32
|
+
* enabled. If enabled, it will turn on the toggle in the header,
|
|
33
|
+
* load the user's preference from their computer, and store the result
|
|
34
|
+
* in the browser's local storage.
|
|
35
|
+
*/
|
|
36
|
+
// enableDarkMode: false,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The default theme to use. If not provided, the default theme will be
|
|
40
|
+
* "light".
|
|
41
|
+
*/
|
|
42
|
+
// defaultTheme: "light",
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The favicon of the game. If not provided, no favicon will be used.
|
|
46
|
+
* This should point to a favicon image file. The import would look
|
|
47
|
+
* something like:
|
|
48
|
+
* import Favicon from "./assets/images/icon.svg";
|
|
49
|
+
*/
|
|
50
|
+
// favicon: Favicon,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The default name of the save file. If not provided, the save file
|
|
54
|
+
* will be named "Untitled Save". This should be a function that takes
|
|
55
|
+
* the current state of the game and returns a string.
|
|
56
|
+
*/
|
|
57
|
+
// defaultSaveName: (currentState) =>
|
|
58
|
+
// `${currentState.tags["Chapter Title"] ?? "Untitled Chapter"}: ${currentState.tags.Location ?? "Unknown Location"}`,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Any tags that should persist between knots. Providing a tag here will
|
|
62
|
+
* ensure that things like portraits (for example) will still be visible
|
|
63
|
+
* even if they are not explicitly mentioned in the knot.
|
|
64
|
+
* You can stop a sticky tag from persisting by setting it to "None" in
|
|
65
|
+
* your Ink story.
|
|
66
|
+
*/
|
|
67
|
+
// stickyTags: ["Portrait", "Location", "BackgroundMusic"],
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The screens to display in the game. The only required screen is "Game".
|
|
71
|
+
*/
|
|
72
|
+
screens: [
|
|
73
|
+
{
|
|
74
|
+
id: "home",
|
|
75
|
+
title: "Home",
|
|
76
|
+
component: About,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "game",
|
|
80
|
+
title: "Story",
|
|
81
|
+
component: "Game",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "history",
|
|
85
|
+
title: "History",
|
|
86
|
+
component: "History",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The plugins to use in the game.
|
|
92
|
+
*
|
|
93
|
+
* You can add more plugins by importing them from the @lamppost/ink-player package.
|
|
94
|
+
*
|
|
95
|
+
* For example, to add the location plugin, you would do:
|
|
96
|
+
* import locationPlugin from "@lamppost/ink-player/plugins/location";
|
|
97
|
+
* plugins: [textInputPlugin({}), locationPlugin({})],
|
|
98
|
+
*/
|
|
99
|
+
plugins: [textInputPlugin({}), locationPlugin({})],
|
|
100
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Put any custom styles you want here!
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["DOM", "ES2020"],
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"noEmit": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"jsxImportSource": "preact",
|
|
9
|
+
"useDefineForClassFields": true,
|
|
10
|
+
|
|
11
|
+
/* modules */
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"moduleResolution": "bundler",
|
|
15
|
+
"verbatimModuleSyntax": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"allowImportingTsExtensions": true,
|
|
18
|
+
"noUncheckedSideEffectImports": true,
|
|
19
|
+
"paths": {
|
|
20
|
+
"react": ["./node_modules/preact/compat/"],
|
|
21
|
+
"react-dom": ["./node_modules/preact/compat/"]
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/* type checking */
|
|
25
|
+
"strict": true,
|
|
26
|
+
"noUnusedLocals": true,
|
|
27
|
+
"noUnusedParameters": true
|
|
28
|
+
},
|
|
29
|
+
"include": ["src", "src/env.d.ts", "rsbuild.config.ts"]
|
|
30
|
+
}
|