narraleaf-react 0.9.0 → 0.9.1

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.
Files changed (41) hide show
  1. package/LICENSE +373 -373
  2. package/README.md +165 -147
  3. package/dist/built-in.d.ts +3 -0
  4. package/dist/built-in.js +1 -0
  5. package/dist/game/nlcore/action/action.d.ts +9 -5
  6. package/dist/game/nlcore/action/actionTypes.d.ts +10 -10
  7. package/dist/game/nlcore/action/actions/menuAction.d.ts +1 -4
  8. package/dist/game/nlcore/action/logicAction.d.ts +29 -29
  9. package/dist/game/nlcore/common/elements.d.ts +4 -2
  10. package/dist/game/nlcore/common/transition.d.ts +2 -1
  11. package/dist/game/nlcore/elements/built-in/DevTools.d.ts +2 -0
  12. package/dist/game/nlcore/elements/built-in/built-in.d.ts +2 -0
  13. package/dist/game/nlcore/elements/built-in/screenEffects.d.ts +31 -0
  14. package/dist/game/nlcore/elements/character/avatar.d.ts +35 -0
  15. package/dist/game/nlcore/elements/character/sentence.d.ts +14 -0
  16. package/dist/game/nlcore/elements/character.d.ts +30 -0
  17. package/dist/game/nlcore/elements/displayable/displayable.d.ts +84 -0
  18. package/dist/game/nlcore/elements/displayable/image.d.ts +2 -2
  19. package/dist/game/nlcore/elements/displayable/text.d.ts +2 -2
  20. package/dist/game/nlcore/elements/layer.d.ts +1 -2
  21. package/dist/game/nlcore/elements/scene.d.ts +2 -1
  22. package/dist/game/nlcore/elements/transform/transform.d.ts +26 -3
  23. package/dist/game/nlcore/elements/transform/type.d.ts +30 -2
  24. package/dist/game/nlcore/elements/transition/transitions/image/maskTransition.d.ts +38 -0
  25. package/dist/game/player/Tasks.d.ts +4 -1
  26. package/dist/game/player/elements/Player.d.ts +1 -1
  27. package/dist/game/player/elements/menu/type.d.ts +1 -0
  28. package/dist/game/player/elements/say/Avatar.d.ts +13 -0
  29. package/dist/game/player/elements/say/Sentence.d.ts +70 -1
  30. package/dist/game/player/elements/say/UIDialog.d.ts +6 -2
  31. package/dist/game/player/elements/say/type.d.ts +4 -2
  32. package/dist/game/player/elements/say/useDialog.d.ts +3 -0
  33. package/dist/game/player/elements/type.d.ts +6 -0
  34. package/dist/game/player/gameState.d.ts +3 -0
  35. package/dist/game/player/lib/AudioManager.d.ts +1 -0
  36. package/dist/game/player/lib/ErrorFallback.d.ts +5 -1
  37. package/dist/game/player/libElements.d.ts +5 -2
  38. package/dist/game/player/provider/game-state.d.ts +1 -0
  39. package/dist/main.js +42 -40
  40. package/dist/util/data.d.ts +15 -2
  41. package/package.json +114 -107
@@ -97,26 +97,39 @@ export declare class Awaitable<T = any, U = T> {
97
97
  result: T | undefined;
98
98
  solved: boolean;
99
99
  aborted: boolean;
100
+ failed: boolean;
101
+ error: unknown;
100
102
  skipController: SkipController<T, []> | undefined;
101
103
  private readonly listeners;
104
+ private readonly failListeners;
105
+ private readonly settledListeners;
102
106
  private readonly onRegisterSkipController;
107
+ private skipControllerAbortToken;
108
+ private settledNotified;
103
109
  private readonly __stack?;
104
110
  constructor(receiver?: (value: U) => T, skipController?: SkipController<T, []>);
105
111
  registerSkipController(skipController: SkipController<T, []>): this;
106
112
  resolve(value: U): void;
107
- then(callback: (value: T) => void): this;
113
+ fail(error: unknown): void;
114
+ then(callback: (value: T) => void, onRejected?: (reason: unknown) => void): this;
108
115
  onSettled(callback: () => void): EventToken;
116
+ onFailed(callback: (error: unknown) => void): EventToken;
109
117
  onSkipControllerRegister(callback: (skipController: SkipController<T, []>) => void): EventToken;
110
118
  offSkipControllerRegister(callback: (skipController: SkipController<T, []>) => void): this;
111
119
  /**
112
120
  * **Note**: Calling this method won't trigger the `then` callbacks.
113
121
  */
114
- abort(): void | T;
122
+ abort(): T | undefined;
115
123
  isSolved(): boolean;
116
124
  isAborted(): boolean;
125
+ isFailed(): boolean;
117
126
  isSettled(): boolean;
118
127
  private pushListener;
128
+ private pushFailListener;
119
129
  private offListener;
130
+ private offFailListener;
131
+ private offSettledListener;
132
+ private notifySettled;
120
133
  }
121
134
  export declare function safeClone<T>(obj: T): T;
122
135
  export type Values<T> = T[keyof T];
package/package.json CHANGED
@@ -1,107 +1,114 @@
1
- {
2
- "name": "narraleaf-react",
3
- "version": "0.9.0",
4
- "description": "A React visual novel player framework",
5
- "main": "./dist/main.js",
6
- "types": "./dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "import": "./dist/main.js",
10
- "require": "./dist/main.js",
11
- "types": "./dist/index.d.ts"
12
- }
13
- },
14
- "scripts": {
15
- "prebuild": "rimraf dist",
16
- "build": "cross-env NODE_ENV=production node esbuild.config.js",
17
- "build:dev": "rimraf dist && cross-env NODE_ENV=development node esbuild.config.js && tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json && node project/postbuild.js",
18
- "postbuild": "tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json",
19
- "lint": "eslint \"./src/**/*.{ts,tsx,js,jsx}\"",
20
- "lint:fix": "eslint --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
21
- "prepublishOnly": "npm run lint && rimraf dist && cross-env NODE_ENV=production node esbuild.config.js && tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json",
22
- "typedoc": "typedoc src/index.ts --out doc",
23
- "prepare": "husky",
24
- "test": "vitest"
25
- },
26
- "devDependencies": {
27
- "@eslint/eslintrc": "^3.1.0",
28
- "@eslint/js": "^9.10.0",
29
- "@tailwindcss/postcss": "^4.1.5",
30
- "@tailwindcss/postcss7-compat": "^2.2.17",
31
- "@types/fs-extra": "^11.0.4",
32
- "@types/howler": "^2.2.11",
33
- "@types/lodash": "^4.17.7",
34
- "@types/node": "^22.15.3",
35
- "@types/react": ">=19",
36
- "@types/react-dom": ">=19",
37
- "@typescript-eslint/eslint-plugin": "^8.5.0",
38
- "@typescript-eslint/parser": "^8.5.0",
39
- "autoprefixer": "^10.4.21",
40
- "cross-env": "^7.0.3",
41
- "cssnano": "^7.0.6",
42
- "esbuild": "^0.25.3",
43
- "esbuild-css-modules-plugin": "^3.1.4",
44
- "esbuild-plugin-alias": "^0.2.1",
45
- "esbuild-plugin-postcss2": "^0.1.2",
46
- "esbuild-postcss": "^0.0.4",
47
- "eslint": "^9.10.0",
48
- "eslint-plugin-react": "^7.35.2",
49
- "fs-extra": "^11.3.0",
50
- "globals": "^15.9.0",
51
- "husky": "^9.1.6",
52
- "motion": ">=11 <12",
53
- "postcss": "^8.5.3",
54
- "postcss-cli": "^11.0.1",
55
- "postcss-import": "^16.1.0",
56
- "postcss-loader": "^8.1.1",
57
- "postcss-preset-env": "^10.1.6",
58
- "react": "^19.0.0",
59
- "react-dom": "^19.0.0",
60
- "rimraf": "^6.0.1",
61
- "tailwindcss": "^4.1.5",
62
- "tsc-alias": "^1.8.10",
63
- "typedoc": "^0.26.7",
64
- "typescript": "5.7.2",
65
- "vitest": "^3.2.4"
66
- },
67
- "peerDependencies": {
68
- "@emotion/is-prop-valid": "*",
69
- "motion": ">=11 <12",
70
- "react": ">=19",
71
- "react-dom": ">=19"
72
- },
73
- "peerDependenciesMeta": {
74
- "react": {
75
- "optional": false
76
- },
77
- "react-dom": {
78
- "optional": false
79
- },
80
- "motion": {
81
- "optional": false
82
- }
83
- },
84
- "files": [
85
- "dist",
86
- "!dist/**/*.map"
87
- ],
88
- "keywords": [
89
- "react",
90
- "visual-novel",
91
- "typescript",
92
- "component",
93
- "narraleaf",
94
- "nvl"
95
- ],
96
- "author": "helloyork@icloud.com",
97
- "license": "MPL-2.0",
98
- "dependencies": {
99
- "@narraleaf/sound": "0.1.0",
100
- "client-only": "^0.0.1",
101
- "clsx": "^2.1.1",
102
- "howler": "^2.2.4",
103
- "html-to-image": "^1.11.11",
104
- "prop-types": "^15.8.1"
105
- },
106
- "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
107
- }
1
+ {
2
+ "name": "narraleaf-react",
3
+ "version": "0.9.1",
4
+ "description": "A React visual novel player framework",
5
+ "type": "module",
6
+ "main": "./dist/main.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/main.js",
12
+ "require": "./dist/main.js"
13
+ },
14
+ "./built-in": {
15
+ "types": "./dist/built-in.d.ts",
16
+ "import": "./dist/built-in.js",
17
+ "require": "./dist/built-in.js"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "prebuild": "rimraf dist",
22
+ "build": "cross-env NODE_ENV=production node esbuild.config.js",
23
+ "build:dev": "rimraf dist && cross-env NODE_ENV=development node esbuild.config.js && tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json && node project/postbuild.js",
24
+ "postbuild": "tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json",
25
+ "lint": "eslint \"./src/**/*.{ts,tsx,js,jsx}\"",
26
+ "lint:fix": "eslint --fix \"./src/**/*.{ts,tsx,js,jsx}\"",
27
+ "prepublishOnly": "npm run lint && rimraf dist && cross-env NODE_ENV=production node esbuild.config.js && tsc --emitDeclarationOnly && tsc-alias -p tsconfig.json",
28
+ "typedoc": "typedoc src/index.ts --out doc",
29
+ "prepare": "husky",
30
+ "test": "vitest"
31
+ },
32
+ "devDependencies": {
33
+ "@eslint/eslintrc": "^3.1.0",
34
+ "@eslint/js": "^9.10.0",
35
+ "@tailwindcss/postcss": "^4.1.5",
36
+ "@tailwindcss/postcss7-compat": "^2.2.17",
37
+ "@types/fs-extra": "^11.0.4",
38
+ "@types/howler": "^2.2.11",
39
+ "@types/lodash": "^4.17.7",
40
+ "@types/node": "^22.15.3",
41
+ "@types/react": ">=19",
42
+ "@types/react-dom": ">=19",
43
+ "@typescript-eslint/eslint-plugin": "^8.5.0",
44
+ "@typescript-eslint/parser": "^8.5.0",
45
+ "autoprefixer": "^10.4.21",
46
+ "cross-env": "^7.0.3",
47
+ "cssnano": "^7.0.6",
48
+ "esbuild": "^0.25.3",
49
+ "esbuild-css-modules-plugin": "^3.1.4",
50
+ "esbuild-plugin-alias": "^0.2.1",
51
+ "esbuild-plugin-postcss2": "^0.1.2",
52
+ "esbuild-postcss": "^0.0.4",
53
+ "eslint": "^9.10.0",
54
+ "eslint-plugin-react": "^7.35.2",
55
+ "fs-extra": "^11.3.0",
56
+ "globals": "^15.9.0",
57
+ "husky": "^9.1.6",
58
+ "motion": ">=11 <12",
59
+ "postcss": "^8.5.3",
60
+ "postcss-cli": "^11.0.1",
61
+ "postcss-import": "^16.1.0",
62
+ "postcss-loader": "^8.1.1",
63
+ "postcss-preset-env": "^10.1.6",
64
+ "react": "^19.0.0",
65
+ "react-dom": "^19.0.0",
66
+ "rimraf": "^6.0.1",
67
+ "tailwindcss": "^4.1.5",
68
+ "tsc-alias": "^1.8.10",
69
+ "typedoc": "^0.26.7",
70
+ "typescript": "5.7.2",
71
+ "vitest": "^3.2.4"
72
+ },
73
+ "peerDependencies": {
74
+ "@emotion/is-prop-valid": "*",
75
+ "motion": ">=11 <12",
76
+ "react": ">=19",
77
+ "react-dom": ">=19"
78
+ },
79
+ "peerDependenciesMeta": {
80
+ "react": {
81
+ "optional": false
82
+ },
83
+ "react-dom": {
84
+ "optional": false
85
+ },
86
+ "motion": {
87
+ "optional": false
88
+ }
89
+ },
90
+ "files": [
91
+ "dist",
92
+ "!dist/**/*.test.d.ts",
93
+ "!dist/**/*.map"
94
+ ],
95
+ "keywords": [
96
+ "react",
97
+ "visual-novel",
98
+ "typescript",
99
+ "component",
100
+ "narraleaf",
101
+ "nvl"
102
+ ],
103
+ "author": "helloyork@icloud.com",
104
+ "license": "MPL-2.0",
105
+ "dependencies": {
106
+ "@narraleaf/sound": "0.1.0",
107
+ "client-only": "^0.0.1",
108
+ "clsx": "^2.1.1",
109
+ "howler": "^2.2.4",
110
+ "html-to-image": "^1.11.11",
111
+ "prop-types": "^15.8.1"
112
+ },
113
+ "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447"
114
+ }