@doodle-engine/react 0.0.8 → 0.0.9
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/CHANGELOG.md +8 -0
- package/dist/GameProvider.d.ts +13 -3
- package/dist/GameProvider.d.ts.map +1 -1
- package/dist/GameShell.d.ts +11 -1
- package/dist/GameShell.d.ts.map +1 -1
- package/dist/components/LoadingScreen.d.ts +14 -0
- package/dist/components/LoadingScreen.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/react.cjs +4 -4
- package/dist/react.js +531 -519
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/GameProvider.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Holds the engine instance and current snapshot state.
|
|
5
5
|
* Provides action methods that update the snapshot when called.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
8
|
import { Engine } from '@doodle-engine/core';
|
|
9
9
|
import type { Snapshot, SaveData } from '@doodle-engine/core';
|
|
10
10
|
export interface GameContextValue {
|
|
@@ -21,7 +21,7 @@ export interface GameContextValue {
|
|
|
21
21
|
loadGame: (saveData: SaveData) => void;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
export declare const GameContext:
|
|
24
|
+
export declare const GameContext: import("react").Context<GameContextValue | null>;
|
|
25
25
|
export interface GameProviderProps {
|
|
26
26
|
/** Engine instance (already initialized with registry) */
|
|
27
27
|
engine: Engine;
|
|
@@ -29,10 +29,20 @@ export interface GameProviderProps {
|
|
|
29
29
|
initialSnapshot: Snapshot;
|
|
30
30
|
/** Children components */
|
|
31
31
|
children: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Enable the browser console debugging API (window.doodle).
|
|
34
|
+
* When true, you can type doodle.setFlag(), doodle.teleport(), etc.
|
|
35
|
+
* in the browser DevTools console while testing your game.
|
|
36
|
+
*
|
|
37
|
+
* Pass import.meta.env.DEV to automatically enable in development
|
|
38
|
+
* and disable in production builds:
|
|
39
|
+
* <GameProvider devTools={import.meta.env.DEV} ...>
|
|
40
|
+
*/
|
|
41
|
+
devTools?: boolean;
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
44
|
* Provider component that wraps the game UI
|
|
35
45
|
* Manages engine state and provides actions to child components
|
|
36
46
|
*/
|
|
37
|
-
export declare function GameProvider({ engine, initialSnapshot, children }: GameProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare function GameProvider({ engine, initialSnapshot, children, devTools }: GameProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
38
48
|
//# sourceMappingURL=GameProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameProvider.d.ts","sourceRoot":"","sources":["../src/GameProvider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"GameProvider.d.ts","sourceRoot":"","sources":["../src/GameProvider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACvF,OAAO,EAAE,MAAM,EAAkB,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;QACxC,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;QACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QAClC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;QACtC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;QAChD,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QACpC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;QACnC,QAAQ,EAAE,MAAM,QAAQ,CAAA;QACxB,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;KACvC,CAAA;CACF;AAED,eAAO,MAAM,WAAW,kDAA+C,CAAA;AAEvE,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,eAAe,EAAE,QAAQ,CAAA;IACzB,0BAA0B;IAC1B,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,iBAAiB,2CAyGtG"}
|
package/dist/GameShell.d.ts
CHANGED
|
@@ -36,6 +36,16 @@ export interface GameShellProps {
|
|
|
36
36
|
videoBasePath?: string;
|
|
37
37
|
/** CSS class */
|
|
38
38
|
className?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Enable the browser console debugging API (window.doodle).
|
|
41
|
+
* When true, you can type doodle.setFlag(), doodle.teleport(), etc.
|
|
42
|
+
* in the browser DevTools console while testing your game.
|
|
43
|
+
*
|
|
44
|
+
* Pass import.meta.env.DEV to automatically enable in development
|
|
45
|
+
* and disable in production builds:
|
|
46
|
+
* <GameShell devTools={import.meta.env.DEV} ...>
|
|
47
|
+
*/
|
|
48
|
+
devTools?: boolean;
|
|
39
49
|
}
|
|
40
|
-
export declare function GameShell({ registry, config, title, subtitle, logoSrc, splashDuration, uiSounds: uiSoundsConfig, audioOptions, storageKey, availableLocales, videoBasePath, className, }: GameShellProps): import("react/jsx-runtime").JSX.Element | null;
|
|
50
|
+
export declare function GameShell({ registry, config, title, subtitle, logoSrc, splashDuration, uiSounds: uiSoundsConfig, audioOptions, storageKey, availableLocales, videoBasePath, className, devTools, }: GameShellProps): import("react/jsx-runtime").JSX.Element | null;
|
|
41
51
|
//# sourceMappingURL=GameShell.d.ts.map
|
package/dist/GameShell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameShell.d.ts","sourceRoot":"","sources":["../src/GameShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAiC,MAAM,qBAAqB,CAAA;AAKrG,OAAO,KAAK,EAAE,aAAa,EAAmB,MAAM,qBAAqB,CAAA;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AASlE,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,EAAE,eAAe,CAAA;IACzB,sCAAsC;IACtC,MAAM,EAAE,UAAU,CAAA;IAClB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,aAAa,GAAG,KAAK,CAAA;IAChC,4BAA4B;IAC5B,YAAY,CAAC,EAAE,mBAAmB,CAAA;IAClC,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACpD,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB;IACh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;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,MAAM,EACN,KAAuB,EACvB,QAAQ,EACR,OAAO,EACP,cAAqB,EACrB,QAAQ,EAAE,cAAc,EACxB,YAAY,EACZ,UAAiC,EACjC,gBAAgB,EAChB,aAAwB,EACxB,SAAc,EACd,QAAgB,GACjB,EAAE,cAAc,kDA0MhB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoadingScreen - Displayed while game content is loading
|
|
3
|
+
*
|
|
4
|
+
* Simple default loading state. Replace with your own component or
|
|
5
|
+
* style it with CSS using the className prop.
|
|
6
|
+
*/
|
|
7
|
+
export interface LoadingScreenProps {
|
|
8
|
+
/** Optional message to display */
|
|
9
|
+
message?: string;
|
|
10
|
+
/** CSS class for custom styling */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function LoadingScreen({ message, className }: LoadingScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=LoadingScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingScreen.d.ts","sourceRoot":"","sources":["../../src/components/LoadingScreen.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,aAAa,CAAC,EAAE,OAAsB,EAAE,SAAc,EAAE,EAAE,kBAAkB,2CAS3F"}
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export { SaveLoadPanel } from './components/SaveLoadPanel';
|
|
|
35
35
|
export type { SaveLoadPanelProps } from './components/SaveLoadPanel';
|
|
36
36
|
export { VideoPlayer } from './components/VideoPlayer';
|
|
37
37
|
export type { VideoPlayerProps } from './components/VideoPlayer';
|
|
38
|
+
export { LoadingScreen } from './components/LoadingScreen';
|
|
39
|
+
export type { LoadingScreenProps } from './components/LoadingScreen';
|
|
38
40
|
export { SplashScreen } from './components/SplashScreen';
|
|
39
41
|
export type { SplashScreenProps } from './components/SplashScreen';
|
|
40
42
|
export { TitleScreen } from './components/TitleScreen';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC1D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAGzE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CA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use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("@doodle-engine/core"),o=require("react");var Q={exports:{}},U={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var ne;function ke(){if(ne)return U;ne=1;var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,c,i){var m=null;if(i!==void 0&&(m=""+i),c.key!==void 0&&(m=""+c.key),"key"in c){i={};for(var f in c)f!=="key"&&(i[f]=c[f])}else i=c;return c=i.ref,{$$typeof:t,type:a,key:m,ref:c!==void 0?c:null,props:i}}return U.Fragment=n,U.jsx=r,U.jsxs=r,U}var q={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var ae;function Ee(){return ae||(ae=1,process.env.NODE_ENV!=="production"&&(function(){function t(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===b?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case d:return"Fragment";case O:return"Profiler";case h:return"StrictMode";case J:return"Suspense";case R:return"SuspenseList";case p:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case S:return"Portal";case Y:return s.displayName||"Context";case $:return(s._context.displayName||"Context")+".Consumer";case G:var u=s.render;return s=s.displayName,s||(s=u.displayName||u.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case M:return u=s.displayName||null,u!==null?u:t(s.type)||"Memo";case l:u=s._payload,s=s._init;try{return t(s(u))}catch{}}return null}function n(s){return""+s}function r(s){try{n(s);var u=!1}catch{u=!0}if(u){u=console;var x=u.error,k=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return x.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",k),n(s)}}function a(s){if(s===d)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===l)return"<...>";try{var u=t(s);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function c(){var s=_.A;return s===null?null:s.getOwner()}function i(){return Error("react-stack-top-frame")}function m(s){if(V.call(s,"key")){var u=Object.getOwnPropertyDescriptor(s,"key").get;if(u&&u.isReactWarning)return!1}return s.key!==void 0}function f(s,u){function x(){A||(A=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}x.isReactWarning=!0,Object.defineProperty(s,"key",{get:x,configurable:!0})}function v(){var s=t(this.type);return I[s]||(I[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function g(s,u,x,k,z,X){var E=x.ref;return s={$$typeof:C,type:s,key:u,props:x,_owner:k},(E!==void 0?E:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:v}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function j(s,u,x,k,z,X){var E=u.children;if(E!==void 0)if(k)if(L(E)){for(k=0;k<E.length;k++)w(E[k]);Object.freeze&&Object.freeze(E)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(E);if(V.call(u,"key")){E=t(s);var F=Object.keys(u).filter(function(Se){return Se!=="key"});k=0<F.length?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}",N[E+k]||(F=0<F.length?"{"+F.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,S,k,Y,k),V[k+S]=!0)}if(k=null,b!==void 0&&(r(b),k=""+b),f(i)&&(r(i.key),k=""+i.key),"key"in i){b={};for(var H in i)H!=="key"&&(b[H]=i[H])}else b=i;return k&&h(b,typeof s=="function"?s.displayName||s.name||"Unknown":s),g(s,k,b,l(),z,X)}function R(s){C(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===m&&(s._payload.status==="fulfilled"?C(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function C(s){return typeof s=="object"&&s!==null&&s.$$typeof===T}var y=o,T=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),J=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),E=Symbol.for("react.client.reference"),P=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,G=Array.isArray,O=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(s){return s()}};var A,M={},B=y.react_stack_bottom_frame.bind(y,c)(),N=O(a(c)),V={};q.Fragment=d,q.jsx=function(s,i,b){var S=1e4>P.recentlyCreatedOwnerStacks++;return j(s,i,b,!1,S?Error("react-stack-top-frame"):B,S?O(a(s)):N)},q.jsxs=function(s,i,b){var S=1e4>P.recentlyCreatedOwnerStacks++;return j(s,i,b,!0,S?Error("react-stack-top-frame"):B,S?O(a(s)):N)}})()),q}var ae;function ye(){return ae||(ae=1,process.env.NODE_ENV==="production"?Q.exports=ke():Q.exports=Ee()),Q.exports}var e=ye();const Z=o.createContext(null);function le({engine:t,initialSnapshot:n,children:r}){const[a,l]=o.useState(n);o.useEffect(()=>{},[t]);const c=o.useCallback(u=>{const d=t.selectChoice(u);l(d)},[t]),f=o.useCallback(u=>{const d=t.talkTo(u);l(d)},[t]),h=o.useCallback(u=>{const d=t.takeItem(u);l(d)},[t]),x=o.useCallback(u=>{const d=t.travelTo(u);l(d)},[t]),g=o.useCallback((u,d)=>{const w=t.writeNote(u,d);l(w)},[t]),j=o.useCallback(u=>{const d=t.deleteNote(u);l(d)},[t]),R=o.useCallback(u=>{const d=t.setLocale(u);l(d)},[t]),C=o.useCallback(()=>t.saveGame(),[t]),y=o.useCallback(u=>{const d=t.loadGame(u);l(d)},[t]),T={snapshot:a,actions:{selectChoice:c,talkTo:f,takeItem:h,travelTo:x,writeNote:g,deleteNote:j,setLocale:R,saveGame:C,loadGame:y}};return e.jsx(Z.Provider,{value:T,children:r})}function K(){const t=o.useContext(Z);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function ee(t,n={}){var p;const{audioBasePath:r="/audio",masterVolume:a=1,musicVolume:l=.7,soundVolume:c=.8,voiceVolume:f=1,crossfadeDuration:h=1e3}=n,[x,g]=o.useState(a),[j,R]=o.useState(l),[C,y]=o.useState(c),[T,u]=o.useState(f),d=o.useRef(null),w=o.useRef(null),L=o.useRef(null),I=o.useRef(null);o.useEffect(()=>{const m=new Audio;m.loop=!0,d.current=m;const v=new Audio;return w.current=v,()=>{I.current&&clearInterval(I.current),m.pause(),v.pause(),m.src="",v.src=""}},[]),o.useEffect(()=>{const m=d.current;if(!m)return;const v=t.music;if(v!==L.current)if(L.current=v,!v)F(m,h);else{const E=`${r}/music/${v}`;J(m,E,h)}m.volume=x*j},[t.music,x,j,r,h]),o.useEffect(()=>{var E;const m=w.current;if(!m)return;const v=(E=t.dialogue)==null?void 0:E.voice;v&&(m.pause(),m.currentTime=0,m.src=`${r}/voice/${v}`,m.volume=x*T,m.play().catch(P=>{console.warn("Voice playback failed:",P)}))},[(p=t.dialogue)==null?void 0:p.voice,x,T,r]),o.useEffect(()=>{t.pendingSounds.length!==0&&t.pendingSounds.forEach(m=>{const v=new Audio(`${r}/sfx/${m}`);v.volume=x*C,v.play().catch(E=>{console.warn("Sound playback failed:",E)})})},[t.pendingSounds,x,C,r]);const J=(m,v,E)=>{F(m,E/2).then(()=>{m.src=v,m.load(),m.volume=0,m.play().then(()=>{_(m,E/2,x*j)}).catch(P=>{console.warn("Music playback failed:",P)})})},F=(m,v)=>new Promise(E=>{const P=m.volume,$=20,G=v/$,O=P/$;let A=0;const M=setInterval(()=>{A++,m.volume=Math.max(0,P-O*A),A>=$&&(clearInterval(M),m.pause(),m.currentTime=0,E())},G);I.current=M}),_=(m,v,E)=>{const $=v/20,G=E/20;let O=0;const A=setInterval(()=>{O++,m.volume=Math.min(E,G*O),O>=20&&clearInterval(A)},$);I.current=A};return{setMasterVolume:g,setMusicVolume:R,setSoundVolume:y,setVoiceVolume:u,stopAll:()=>{d.current&&(d.current.pause(),d.current.currentTime=0),w.current&&(w.current.pause(),w.current.currentTime=0)}}}const Ce={click:"click.ogg",menuOpen:"menu_open.ogg",menuClose:"menu_close.ogg"};function oe(t={}){const{enabled:n=!0,basePath:r="/audio/ui",volume:a=.5,sounds:l={}}=t,[c,f]=o.useState(n),[h,x]=o.useState(a),g=o.useRef({...Ce,...l}),j=o.useCallback(u=>{if(!c||!u)return;const d=new Audio(`${r}/${u}`);d.volume=h,d.play().catch(()=>{})},[c,h,r]),R=o.useCallback(u=>{const d=g.current[u];d&&j(d)},[j]),C=o.useCallback(()=>j(g.current.click),[j]),y=o.useCallback(()=>j(g.current.menuOpen),[j]),T=o.useCallback(()=>j(g.current.menuClose),[j]);return{playClick:C,playMenuOpen:y,playMenuClose:T,playSound:R,setEnabled:f,setVolume:x,enabled:c,volume:h}}function ce({dialogue:t,className:n=""}){return e.jsxs("div",{className:`dialogue-box ${n}`,children:[t.portrait&&e.jsx("div",{className:"dialogue-portrait",children:e.jsx("img",{src:t.portrait,alt:t.speakerName})}),e.jsxs("div",{className:"dialogue-content",children:[e.jsx("div",{className:"dialogue-speaker",children:t.speakerName}),e.jsx("div",{className:"dialogue-text",children:t.text})]})]})}function ie({choices:t,onSelectChoice:n,className:r=""}){return t.length===0?null:e.jsx("div",{className:`choice-list ${r}`,children:t.map(a=>e.jsx("button",{className:"choice-button",onClick:()=>n(a.id),children:a.text},a.id))})}function ue({location:t,className:n=""}){return e.jsxs("div",{className:`location-view ${n}`,children:[t.banner&&e.jsx("div",{className:"location-banner",children:e.jsx("img",{src:t.banner,alt:t.name})}),e.jsxs("div",{className:"location-content",children:[e.jsx("h1",{className:"location-name",children:t.name}),e.jsx("p",{className:"location-description",children:t.description})]})]})}function de({characters:t,onTalkTo:n,className:r=""}){return t.length===0?null:e.jsxs("div",{className:`character-list ${r}`,children:[e.jsx("h2",{children:"Characters"}),e.jsx("div",{className:"character-grid",children:t.map(a=>e.jsxs("button",{className:"character-card",onClick:()=>n(a.id),children:[a.portrait&&e.jsx("img",{src:a.portrait,alt:a.name,className:"character-portrait"}),e.jsx("div",{className:"character-name",children:a.name})]},a.id))})]})}function me({items:t,className:n=""}){const[r,a]=o.useState(null);return e.jsxs("div",{className:`inventory ${n}`,children:[e.jsx("h2",{children:"Inventory"}),t.length===0?e.jsx("p",{className:"inventory-empty",children:"No items"}):e.jsx("div",{className:"inventory-grid",children:t.map(l=>e.jsxs("div",{className:"inventory-item",onClick:()=>a(l),children:[l.icon&&e.jsx("img",{src:l.icon,alt:l.name,className:"item-icon"}),e.jsx("div",{className:"item-name",children:l.name})]},l.id))}),r&&e.jsx("div",{className:"item-modal-overlay",onClick:()=>a(null),children:e.jsxs("div",{className:"item-modal",onClick:l=>l.stopPropagation(),children:[r.image&&e.jsx("img",{src:r.image,alt:r.name,className:"item-modal-image"}),e.jsx("h3",{className:"item-modal-name",children:r.name}),e.jsx("p",{className:"item-modal-description",children:r.description}),e.jsx("button",{className:"item-modal-close",onClick:()=>a(null),children:"Close"})]})})]})}function fe({quests:t,entries:n,className:r=""}){return e.jsxs("div",{className:`journal ${r}`,children:[e.jsx("h2",{children:"Journal"}),t.length>0&&e.jsxs("div",{className:"journal-quests",children:[e.jsx("h3",{children:"Active Quests"}),t.map(a=>e.jsxs("div",{className:"quest-entry",children:[e.jsx("div",{className:"quest-name",children:a.name}),e.jsx("div",{className:"quest-description",children:a.description}),e.jsx("div",{className:"quest-stage",children:a.currentStageDescription})]},a.id))]}),n.length>0&&e.jsxs("div",{className:"journal-entries",children:[e.jsx("h3",{children:"Entries"}),n.map(a=>e.jsxs("div",{className:`journal-entry journal-category-${a.category}`,children:[e.jsx("div",{className:"entry-title",children:a.title}),e.jsx("div",{className:"entry-text",children:a.text})]},a.id))]}),t.length===0&&n.length===0&&e.jsx("p",{className:"journal-empty",children:"No entries yet"})]})}function he({map:t,onTravelTo:n,className:r=""}){return t?e.jsxs("div",{className:`map-view ${r}`,children:[e.jsx("h2",{children:t.name}),e.jsxs("div",{className:"map-container",style:{position:"relative"},children:[t.image&&e.jsx("img",{src:t.image,alt:t.name,className:"map-image"}),t.locations.map(a=>e.jsx("button",{className:`map-marker ${a.isCurrent?"current":""}`,style:{position:"absolute",left:`${a.x}px`,top:`${a.y}px`},onClick:()=>!a.isCurrent&&n(a.id),disabled:a.isCurrent,title:a.name,children:a.name},a.id))]})]}):null}function ve({notifications:t,className:n=""}){return t.length===0?null:e.jsx("div",{className:`notification-area ${n}`,children:t.map((r,a)=>e.jsx("div",{className:"notification",children:r},a))})}function pe({onSave:t,onLoad:n,storageKey:r="doodle-engine-save",className:a=""}){const[l,c]=o.useState(""),f=()=>{const g=t();localStorage.setItem(r,JSON.stringify(g)),c("Saved!"),setTimeout(()=>c(""),2e3)},h=()=>{const g=localStorage.getItem(r);if(!g){c("No save found"),setTimeout(()=>c(""),2e3);return}const j=JSON.parse(g);n(j),c("Loaded!"),setTimeout(()=>c(""),2e3)},x=localStorage.getItem(r)!==null;return e.jsxs("div",{className:`save-load-panel ${a}`,children:[e.jsx("button",{className:"save-button",onClick:f,children:"Save"}),e.jsx("button",{className:"load-button",onClick:h,disabled:!x,children:"Load"}),l&&e.jsx("span",{className:"save-load-message",children:l})]})}function xe({className:t=""}){const{snapshot:n,actions:r}=K();ee(n);const a=Object.entries(n.variables).filter(([l])=>!l.startsWith("_"));return e.jsxs("div",{className:`game-renderer ${t}`,children:[e.jsx(ve,{notifications:n.notifications}),e.jsxs("div",{className:"game-main",children:[e.jsx(ue,{location:n.location}),n.dialogue&&e.jsxs("div",{className:"dialogue-container",children:[e.jsx(ce,{dialogue:n.dialogue}),e.jsx(ie,{choices:n.choices,onSelectChoice:r.selectChoice})]}),!n.dialogue&&e.jsx(de,{characters:n.charactersHere,onTalkTo:r.talkTo})]}),e.jsxs("div",{className:"game-sidebar",children:[e.jsx(pe,{onSave:r.saveGame,onLoad:r.loadGame}),a.length>0&&e.jsxs("div",{className:"resources",children:[e.jsx("h2",{children:"Resources"}),e.jsx("ul",{className:"resources-list",children:a.map(([l,c])=>e.jsxs("li",{className:"resource-entry",children:[e.jsx("span",{className:"resource-name",children:l}),e.jsx("span",{className:"resource-value",children:c})]},l))})]}),n.party.length>0&&e.jsxs("div",{className:"party",children:[e.jsx("h2",{children:"Party"}),e.jsx("ul",{className:"party-list",children:n.party.map(l=>e.jsx("li",{className:"party-member",children:e.jsx("span",{className:"party-member-name",children:l.name})},l.id))})]}),e.jsx(me,{items:n.inventory}),e.jsx(fe,{quests:n.quests,entries:n.journal}),n.map&&e.jsx(he,{map:n.map,onTravelTo:r.travelTo})]})]})}function je({logoSrc:t,title:n,onComplete:r,duration:a=2e3,className:l=""}){return o.useEffect(()=>{const c=setTimeout(r,a);return()=>clearTimeout(c)},[r,a]),e.jsxs("div",{className:`splash-screen ${l}`,onClick:r,children:[t&&e.jsx("img",{src:t,alt:n||"",className:"splash-logo"}),n&&e.jsx("h1",{className:"splash-title",children:n}),e.jsx("div",{className:"splash-loading",children:"Loading..."})]})}function be({title:t="Doodle Engine",subtitle:n,logoSrc:r,hasSaveData:a,onNewGame:l,onContinue:c,onSettings:f,className:h=""}){return e.jsxs("div",{className:`title-screen ${h}`,children:[r&&e.jsx("img",{src:r,alt:t,className:"title-logo"}),e.jsx("h1",{className:"title-heading",children:t}),n&&e.jsx("p",{className:"title-subtitle",children:n}),e.jsxs("div",{className:"title-menu",children:[e.jsx("button",{className:"title-button",onClick:l,children:"New Game"}),a&&e.jsx("button",{className:"title-button",onClick:c,children:"Continue"}),e.jsx("button",{className:"title-button",onClick:f,children:"Settings"})]})]})}function Ne({onResume:t,onSave:n,onLoad:r,onSettings:a,onQuitToTitle:l,className:c=""}){return e.jsx("div",{className:`pause-menu-overlay ${c}`,children:e.jsxs("div",{className:"pause-menu",children:[e.jsx("h2",{className:"pause-title",children:"Paused"}),e.jsxs("div",{className:"pause-buttons",children:[e.jsx("button",{className:"pause-button",onClick:t,children:"Resume"}),e.jsx("button",{className:"pause-button",onClick:n,children:"Save"}),e.jsx("button",{className:"pause-button",onClick:r,children:"Load"}),e.jsx("button",{className:"pause-button",onClick:a,children:"Settings"}),e.jsx("button",{className:"pause-button pause-button-quit",onClick:l,children:"Quit to Title"})]})]})})}function se({audioControls:t,uiSoundControls:n,availableLocales:r,currentLocale:a,onLocaleChange:l,onBack:c,className:f=""}){return e.jsxs("div",{className:`settings-panel ${f}`,children:[e.jsx("h2",{className:"settings-title",children:"Settings"}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Audio"}),e.jsx(W,{label:"Master",value:1,onChange:t.setMasterVolume}),e.jsx(W,{label:"Music",value:.7,onChange:t.setMusicVolume}),e.jsx(W,{label:"Sound Effects",value:.8,onChange:t.setSoundVolume}),e.jsx(W,{label:"Voice",value:1,onChange:t.setVoiceVolume}),n&&e.jsx(W,{label:"UI Sounds",value:n.volume,onChange:n.setVolume})]}),r&&r.length>1&&l&&e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Language"}),e.jsx("select",{className:"settings-locale-select",value:a,onChange:h=>l(h.target.value),children:r.map(h=>e.jsx("option",{value:h.code,children:h.label},h.code))})]}),e.jsx("button",{className:"settings-back-button",onClick:c,children:"Back"})]})}function W({label:t,value:n,onChange:r}){return e.jsxs("div",{className:"volume-slider",children:[e.jsx("label",{className:"volume-label",children:t}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",defaultValue:n,onChange:a=>r(parseFloat(a.target.value)),className:"volume-input"})]})}function ge({src:t,basePath:n="/video",onComplete:r,className:a=""}){const l=o.useRef(null);return o.useEffect(()=>{const c=f=>{(f.key==="Escape"||f.key===" "||f.key==="Enter")&&(f.preventDefault(),r())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),e.jsxs("div",{className:`video-player-overlay ${a}`,children:[e.jsx("video",{ref:l,src:`${n}/${t}`,autoPlay:!0,onEnded:r,className:"video-player-video"}),e.jsx("button",{className:"video-player-skip-button",onClick:r,children:"Skip"})]})}function Te({registry:t,config:n,title:r="Doodle Engine",subtitle:a,logoSrc:l,splashDuration:c=2e3,uiSounds:f,audioOptions:h,storageKey:x="doodle-engine-save",availableLocales:g,videoBasePath:j="/video",className:R=""}){const[C,y]=o.useState(c>0?"splash":"title"),[T,u]=o.useState(!1),[d,w]=o.useState(!1),[L,I]=o.useState("title"),[J,F]=o.useState(null),[_,D]=o.useState(null),p=oe(f===!1?{enabled:!1}:f),m=localStorage.getItem(x)!==null,v=o.useCallback(()=>{const N={currentLocation:n.startLocation,currentTime:{...n.startTime},flags:{...n.startFlags},variables:{...n.startVariables},inventory:[...n.startInventory],questProgress:{},unlockedJournalEntries:[],playerNotes:[],dialogueState:null,characterState:{},itemLocations:{},mapEnabled:!0,notifications:[],pendingSounds:[],pendingVideo:null,currentLocale:"en"};return new re.Engine(t,N)},[t,n]),E=o.useCallback(()=>{p.playClick();const N=v(),V=N.newGame(n);D({engine:N,snapshot:V}),y("playing")},[v,n,p]),P=o.useCallback(()=>{p.playClick();const N=localStorage.getItem(x);if(!N)return;const V=JSON.parse(N),s=v(),i=s.loadGame(V);D({engine:s,snapshot:i}),y("playing")},[v,x,p]),$=o.useCallback(()=>{if(!_)return;p.playClick();const N=_.engine.saveGame();localStorage.setItem(x,JSON.stringify(N)),u(!1)},[_,x,p]),G=o.useCallback(()=>{const N=localStorage.getItem(x);if(!N||!_)return;p.playClick();const V=JSON.parse(N),s=_.engine.loadGame(V);D({engine:_.engine,snapshot:s}),u(!1)},[_,x,p]),O=o.useCallback(()=>{p.playClick(),u(!1),w(!1),D(null),y("title")},[p]),A=o.useCallback(N=>{p.playMenuOpen(),I(N),w(!0),N==="pause"&&u(!1)},[p]),M=o.useCallback(()=>{p.playMenuClose(),w(!1),L==="pause"&&u(!0)},[L,p]);o.useEffect(()=>{if(C!=="playing")return;const N=V=>{V.key==="Escape"&&(V.preventDefault(),d?M():(T?p.playMenuClose():p.playMenuOpen(),u(s=>!s)))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[C,T,d,M,p]);const B={setMasterVolume:()=>{},setMusicVolume:()=>{},setSoundVolume:()=>{},setVoiceVolume:()=>{},stopAll:()=>{}};return C==="splash"?e.jsx("div",{className:`game-shell ${R}`,children:e.jsx(je,{logoSrc:l,title:r,onComplete:()=>y("title"),duration:c})}):C==="title"?e.jsx("div",{className:`game-shell ${R}`,children:d?e.jsx(se,{audioControls:B,uiSoundControls:f!==!1?p:void 0,availableLocales:g,onBack:M}):e.jsx(be,{title:r,subtitle:a,logoSrc:l,hasSaveData:m,onNewGame:E,onContinue:P,onSettings:()=>A("title")})}):_?e.jsx("div",{className:`game-shell ${R}`,children:e.jsx(le,{engine:_.engine,initialSnapshot:_.snapshot,children:e.jsx(we,{audioOptions:h,uiSoundControls:f!==!1?p:void 0,showPauseMenu:T,showSettings:d,availableLocales:g,videoBasePath:j,pendingVideo:J,setPendingVideo:F,onPause:()=>{p.playMenuOpen(),u(!0)},onResume:()=>{p.playMenuClose(),u(!1)},onSave:$,onLoad:G,onSettings:()=>A("pause"),onQuitToTitle:O,onCloseSettings:M})})}):null}function we({audioOptions:t,uiSoundControls:n,showPauseMenu:r,showSettings:a,availableLocales:l,videoBasePath:c,pendingVideo:f,setPendingVideo:h,onPause:x,onResume:g,onSave:j,onLoad:R,onSettings:C,onQuitToTitle:y,onCloseSettings:T}){const{snapshot:u,actions:d}=K(),w=ee(u,t);return o.useEffect(()=>{u.pendingVideo&&h(u.pendingVideo)},[u.pendingVideo,h]),e.jsxs(e.Fragment,{children:[f&&e.jsx(ge,{src:f,basePath:c,onComplete:()=>h(null)}),e.jsx(xe,{}),!r&&!a&&!f&&e.jsx("button",{className:"game-shell-menu-button",onClick:x,"aria-label":"Menu",children:"Menu"}),r&&e.jsx(Ne,{onResume:g,onSave:j,onLoad:R,onSettings:C,onQuitToTitle:y}),a&&e.jsx(se,{audioControls:w,uiSoundControls:n,availableLocales:l,currentLocale:(u.time,void 0),onLocaleChange:d.setLocale,onBack:T})]})}Object.defineProperty(exports,"VERSION",{enumerable:!0,get:()=>re.VERSION});exports.CharacterList=de;exports.ChoiceList=ie;exports.DialogueBox=ce;exports.GameContext=Z;exports.GameProvider=le;exports.GameRenderer=xe;exports.GameShell=Te;exports.Inventory=me;exports.Journal=fe;exports.LocationView=ue;exports.MapView=he;exports.NotificationArea=ve;exports.PauseMenu=Ne;exports.SaveLoadPanel=pe;exports.SettingsPanel=se;exports.SplashScreen=je;exports.TitleScreen=be;exports.VideoPlayer=ge;exports.useAudioManager=ee;exports.useGame=K;exports.useUISounds=oe;
|
|
22
|
+
<%s key={someKey} {...props} />`,k,E,F,E),N[E+k]=!0)}if(E=null,x!==void 0&&(r(x),E=""+x),m(u)&&(r(u.key),E=""+u.key),"key"in u){x={};for(var H in u)H!=="key"&&(x[H]=u[H])}else x=u;return E&&f(x,typeof s=="function"?s.displayName||s.name||"Unknown":s),g(s,E,x,c(),z,X)}function w(s){T(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===l&&(s._payload.status==="fulfilled"?T(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function T(s){return typeof s=="object"&&s!==null&&s.$$typeof===C}var y=o,C=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.for("react.client.reference"),_=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,L=Array.isArray,P=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(s){return s()}};var A,I={},D=y.react_stack_bottom_frame.bind(y,i)(),B=P(a(i)),N={};q.Fragment=d,q.jsx=function(s,u,x){var k=1e4>_.recentlyCreatedOwnerStacks++;return j(s,u,x,!1,k?Error("react-stack-top-frame"):D,k?P(a(s)):B)},q.jsxs=function(s,u,x){var k=1e4>_.recentlyCreatedOwnerStacks++;return j(s,u,x,!0,k?Error("react-stack-top-frame"):D,k?P(a(s)):B)}})()),q}var re;function ye(){return re||(re=1,process.env.NODE_ENV==="production"?Q.exports=ke():Q.exports=Ee()),Q.exports}var e=ye();const K=o.createContext(null);function le({engine:t,initialSnapshot:n,children:r,devTools:a=!1}){const[c,i]=o.useState(n);o.useEffect(()=>{if(a)return Z.enableDevTools(t,()=>i(t.getSnapshot())),()=>{delete window.doodle}},[t,a]);const m=o.useCallback(d=>{const h=t.selectChoice(d);i(h)},[t]),f=o.useCallback(d=>{const h=t.talkTo(d);i(h)},[t]),v=o.useCallback(d=>{const h=t.takeItem(d);i(h)},[t]),g=o.useCallback(d=>{const h=t.travelTo(d);i(h)},[t]),j=o.useCallback((d,h)=>{const O=t.writeNote(d,h);i(O)},[t]),w=o.useCallback(d=>{const h=t.deleteNote(d);i(h)},[t]),T=o.useCallback(d=>{const h=t.setLocale(d);i(h)},[t]),y=o.useCallback(()=>t.saveGame(),[t]),C=o.useCallback(d=>{const h=t.loadGame(d);i(h)},[t]),S={snapshot:c,actions:{selectChoice:m,talkTo:f,takeItem:v,travelTo:g,writeNote:j,deleteNote:w,setLocale:T,saveGame:y,loadGame:C}};return e.jsx(K.Provider,{value:S,children:r})}function ee(){const t=o.useContext(K);if(!t)throw new Error("useGame must be used within a GameProvider");return t}function se(t,n={}){var M;const{audioBasePath:r="/audio",masterVolume:a=1,musicVolume:c=.7,soundVolume:i=.8,voiceVolume:m=1,crossfadeDuration:f=1e3}=n,[v,g]=o.useState(a),[j,w]=o.useState(c),[T,y]=o.useState(i),[C,S]=o.useState(m),d=o.useRef(null),h=o.useRef(null),O=o.useRef(null),$=o.useRef(null);o.useEffect(()=>{const l=new Audio;l.loop=!0,d.current=l;const p=new Audio;return h.current=p,()=>{$.current&&clearInterval($.current),l.pause(),p.pause(),l.src="",p.src=""}},[]),o.useEffect(()=>{const l=d.current;if(!l)return;const p=t.music;if(p!==O.current)if(O.current=p,!p)G(l,f);else{const b=`${r}/music/${p}`;Y(l,b,f)}l.volume=v*j},[t.music,v,j,r,f]),o.useEffect(()=>{var b;const l=h.current;if(!l)return;const p=(b=t.dialogue)==null?void 0:b.voice;p&&(l.pause(),l.currentTime=0,l.src=`${r}/voice/${p}`,l.volume=v*C,l.play().catch(_=>{console.warn("Voice playback failed:",_)}))},[(M=t.dialogue)==null?void 0:M.voice,v,C,r]),o.useEffect(()=>{t.pendingSounds.length!==0&&t.pendingSounds.forEach(l=>{const p=new Audio(`${r}/sfx/${l}`);p.volume=v*T,p.play().catch(b=>{console.warn("Sound playback failed:",b)})})},[t.pendingSounds,v,T,r]);const Y=(l,p,b)=>{G(l,b/2).then(()=>{l.src=p,l.load(),l.volume=0,l.play().then(()=>{J(l,b/2,v*j)}).catch(_=>{console.warn("Music playback failed:",_)})})},G=(l,p)=>new Promise(b=>{const _=l.volume,V=20,L=p/V,P=_/V;let A=0;const I=setInterval(()=>{A++,l.volume=Math.max(0,_-P*A),A>=V&&(clearInterval(I),l.pause(),l.currentTime=0,b())},L);$.current=I}),J=(l,p,b)=>{const V=p/20,L=b/20;let P=0;const A=setInterval(()=>{P++,l.volume=Math.min(b,L*P),P>=20&&clearInterval(A)},V);$.current=A};return{setMasterVolume:g,setMusicVolume:w,setSoundVolume:y,setVoiceVolume:S,stopAll:()=>{d.current&&(d.current.pause(),d.current.currentTime=0),h.current&&(h.current.pause(),h.current.currentTime=0)}}}const Ce={click:"click.ogg",menuOpen:"menu_open.ogg",menuClose:"menu_close.ogg"};function oe(t={}){const{enabled:n=!0,basePath:r="/audio/ui",volume:a=.5,sounds:c={}}=t,[i,m]=o.useState(n),[f,v]=o.useState(a),g=o.useRef({...Ce,...c}),j=o.useCallback(S=>{if(!i||!S)return;const d=new Audio(`${r}/${S}`);d.volume=f,d.play().catch(()=>{})},[i,f,r]),w=o.useCallback(S=>{const d=g.current[S];d&&j(d)},[j]),T=o.useCallback(()=>j(g.current.click),[j]),y=o.useCallback(()=>j(g.current.menuOpen),[j]),C=o.useCallback(()=>j(g.current.menuClose),[j]);return{playClick:T,playMenuOpen:y,playMenuClose:C,playSound:w,setEnabled:m,setVolume:v,enabled:i,volume:f}}function ce({dialogue:t,className:n=""}){return e.jsxs("div",{className:`dialogue-box ${n}`,children:[t.portrait&&e.jsx("div",{className:"dialogue-portrait",children:e.jsx("img",{src:t.portrait,alt:t.speakerName})}),e.jsxs("div",{className:"dialogue-content",children:[e.jsx("div",{className:"dialogue-speaker",children:t.speakerName}),e.jsx("div",{className:"dialogue-text",children:t.text})]})]})}function ie({choices:t,onSelectChoice:n,className:r=""}){return t.length===0?null:e.jsx("div",{className:`choice-list ${r}`,children:t.map(a=>e.jsx("button",{className:"choice-button",onClick:()=>n(a.id),children:a.text},a.id))})}function ue({location:t,className:n=""}){return e.jsxs("div",{className:`location-view ${n}`,children:[t.banner&&e.jsx("div",{className:"location-banner",children:e.jsx("img",{src:t.banner,alt:t.name})}),e.jsxs("div",{className:"location-content",children:[e.jsx("h1",{className:"location-name",children:t.name}),e.jsx("p",{className:"location-description",children:t.description})]})]})}function de({characters:t,onTalkTo:n,className:r=""}){return t.length===0?null:e.jsxs("div",{className:`character-list ${r}`,children:[e.jsx("h2",{children:"Characters"}),e.jsx("div",{className:"character-grid",children:t.map(a=>e.jsxs("button",{className:"character-card",onClick:()=>n(a.id),children:[a.portrait&&e.jsx("img",{src:a.portrait,alt:a.name,className:"character-portrait"}),e.jsx("div",{className:"character-name",children:a.name})]},a.id))})]})}function me({items:t,className:n=""}){const[r,a]=o.useState(null);return e.jsxs("div",{className:`inventory ${n}`,children:[e.jsx("h2",{children:"Inventory"}),t.length===0?e.jsx("p",{className:"inventory-empty",children:"No items"}):e.jsx("div",{className:"inventory-grid",children:t.map(c=>e.jsxs("div",{className:"inventory-item",onClick:()=>a(c),children:[c.icon&&e.jsx("img",{src:c.icon,alt:c.name,className:"item-icon"}),e.jsx("div",{className:"item-name",children:c.name})]},c.id))}),r&&e.jsx("div",{className:"item-modal-overlay",onClick:()=>a(null),children:e.jsxs("div",{className:"item-modal",onClick:c=>c.stopPropagation(),children:[r.image&&e.jsx("img",{src:r.image,alt:r.name,className:"item-modal-image"}),e.jsx("h3",{className:"item-modal-name",children:r.name}),e.jsx("p",{className:"item-modal-description",children:r.description}),e.jsx("button",{className:"item-modal-close",onClick:()=>a(null),children:"Close"})]})})]})}function fe({quests:t,entries:n,className:r=""}){return e.jsxs("div",{className:`journal ${r}`,children:[e.jsx("h2",{children:"Journal"}),t.length>0&&e.jsxs("div",{className:"journal-quests",children:[e.jsx("h3",{children:"Active Quests"}),t.map(a=>e.jsxs("div",{className:"quest-entry",children:[e.jsx("div",{className:"quest-name",children:a.name}),e.jsx("div",{className:"quest-description",children:a.description}),e.jsx("div",{className:"quest-stage",children:a.currentStageDescription})]},a.id))]}),n.length>0&&e.jsxs("div",{className:"journal-entries",children:[e.jsx("h3",{children:"Entries"}),n.map(a=>e.jsxs("div",{className:`journal-entry journal-category-${a.category}`,children:[e.jsx("div",{className:"entry-title",children:a.title}),e.jsx("div",{className:"entry-text",children:a.text})]},a.id))]}),t.length===0&&n.length===0&&e.jsx("p",{className:"journal-empty",children:"No entries yet"})]})}function he({map:t,onTravelTo:n,className:r=""}){return t?e.jsxs("div",{className:`map-view ${r}`,children:[e.jsx("h2",{children:t.name}),e.jsxs("div",{className:"map-container",style:{position:"relative"},children:[t.image&&e.jsx("img",{src:t.image,alt:t.name,className:"map-image"}),t.locations.map(a=>e.jsx("button",{className:`map-marker ${a.isCurrent?"current":""}`,style:{position:"absolute",left:`${a.x}px`,top:`${a.y}px`},onClick:()=>!a.isCurrent&&n(a.id),disabled:a.isCurrent,title:a.name,children:a.name},a.id))]})]}):null}function ve({notifications:t,className:n=""}){return t.length===0?null:e.jsx("div",{className:`notification-area ${n}`,children:t.map((r,a)=>e.jsx("div",{className:"notification",children:r},a))})}function pe({onSave:t,onLoad:n,storageKey:r="doodle-engine-save",className:a=""}){const[c,i]=o.useState(""),m=()=>{const g=t();localStorage.setItem(r,JSON.stringify(g)),i("Saved!"),setTimeout(()=>i(""),2e3)},f=()=>{const g=localStorage.getItem(r);if(!g){i("No save found"),setTimeout(()=>i(""),2e3);return}const j=JSON.parse(g);n(j),i("Loaded!"),setTimeout(()=>i(""),2e3)},v=localStorage.getItem(r)!==null;return e.jsxs("div",{className:`save-load-panel ${a}`,children:[e.jsx("button",{className:"save-button",onClick:m,children:"Save"}),e.jsx("button",{className:"load-button",onClick:f,disabled:!v,children:"Load"}),c&&e.jsx("span",{className:"save-load-message",children:c})]})}function xe({className:t=""}){const{snapshot:n,actions:r}=ee();se(n);const a=Object.entries(n.variables).filter(([c])=>!c.startsWith("_"));return e.jsxs("div",{className:`game-renderer ${t}`,children:[e.jsx(ve,{notifications:n.notifications}),e.jsxs("div",{className:"game-main",children:[e.jsx(ue,{location:n.location}),n.dialogue&&e.jsxs("div",{className:"dialogue-container",children:[e.jsx(ce,{dialogue:n.dialogue}),e.jsx(ie,{choices:n.choices,onSelectChoice:r.selectChoice})]}),!n.dialogue&&e.jsx(de,{characters:n.charactersHere,onTalkTo:r.talkTo})]}),e.jsxs("div",{className:"game-sidebar",children:[e.jsx(pe,{onSave:r.saveGame,onLoad:r.loadGame}),a.length>0&&e.jsxs("div",{className:"resources",children:[e.jsx("h2",{children:"Resources"}),e.jsx("ul",{className:"resources-list",children:a.map(([c,i])=>e.jsxs("li",{className:"resource-entry",children:[e.jsx("span",{className:"resource-name",children:c}),e.jsx("span",{className:"resource-value",children:i})]},c))})]}),n.party.length>0&&e.jsxs("div",{className:"party",children:[e.jsx("h2",{children:"Party"}),e.jsx("ul",{className:"party-list",children:n.party.map(c=>e.jsx("li",{className:"party-member",children:e.jsx("span",{className:"party-member-name",children:c.name})},c.id))})]}),e.jsx(me,{items:n.inventory}),e.jsx(fe,{quests:n.quests,entries:n.journal}),n.map&&e.jsx(he,{map:n.map,onTravelTo:r.travelTo})]})]})}function je({logoSrc:t,title:n,onComplete:r,duration:a=2e3,className:c=""}){return o.useEffect(()=>{const i=setTimeout(r,a);return()=>clearTimeout(i)},[r,a]),e.jsxs("div",{className:`splash-screen ${c}`,onClick:r,children:[t&&e.jsx("img",{src:t,alt:n||"",className:"splash-logo"}),n&&e.jsx("h1",{className:"splash-title",children:n}),e.jsx("div",{className:"splash-loading",children:"Loading..."})]})}function be({title:t="Doodle Engine",subtitle:n,logoSrc:r,hasSaveData:a,onNewGame:c,onContinue:i,onSettings:m,className:f=""}){return e.jsxs("div",{className:`title-screen ${f}`,children:[r&&e.jsx("img",{src:r,alt:t,className:"title-logo"}),e.jsx("h1",{className:"title-heading",children:t}),n&&e.jsx("p",{className:"title-subtitle",children:n}),e.jsxs("div",{className:"title-menu",children:[e.jsx("button",{className:"title-button",onClick:c,children:"New Game"}),a&&e.jsx("button",{className:"title-button",onClick:i,children:"Continue"}),e.jsx("button",{className:"title-button",onClick:m,children:"Settings"})]})]})}function Ne({onResume:t,onSave:n,onLoad:r,onSettings:a,onQuitToTitle:c,className:i=""}){return e.jsx("div",{className:`pause-menu-overlay ${i}`,children:e.jsxs("div",{className:"pause-menu",children:[e.jsx("h2",{className:"pause-title",children:"Paused"}),e.jsxs("div",{className:"pause-buttons",children:[e.jsx("button",{className:"pause-button",onClick:t,children:"Resume"}),e.jsx("button",{className:"pause-button",onClick:n,children:"Save"}),e.jsx("button",{className:"pause-button",onClick:r,children:"Load"}),e.jsx("button",{className:"pause-button",onClick:a,children:"Settings"}),e.jsx("button",{className:"pause-button pause-button-quit",onClick:c,children:"Quit to Title"})]})]})})}function te({audioControls:t,uiSoundControls:n,availableLocales:r,currentLocale:a,onLocaleChange:c,onBack:i,className:m=""}){return e.jsxs("div",{className:`settings-panel ${m}`,children:[e.jsx("h2",{className:"settings-title",children:"Settings"}),e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Audio"}),e.jsx(W,{label:"Master",value:1,onChange:t.setMasterVolume}),e.jsx(W,{label:"Music",value:.7,onChange:t.setMusicVolume}),e.jsx(W,{label:"Sound Effects",value:.8,onChange:t.setSoundVolume}),e.jsx(W,{label:"Voice",value:1,onChange:t.setVoiceVolume}),n&&e.jsx(W,{label:"UI Sounds",value:n.volume,onChange:n.setVolume})]}),r&&r.length>1&&c&&e.jsxs("div",{className:"settings-section",children:[e.jsx("h3",{children:"Language"}),e.jsx("select",{className:"settings-locale-select",value:a,onChange:f=>c(f.target.value),children:r.map(f=>e.jsx("option",{value:f.code,children:f.label},f.code))})]}),e.jsx("button",{className:"settings-back-button",onClick:i,children:"Back"})]})}function W({label:t,value:n,onChange:r}){return e.jsxs("div",{className:"volume-slider",children:[e.jsx("label",{className:"volume-label",children:t}),e.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",defaultValue:n,onChange:a=>r(parseFloat(a.target.value)),className:"volume-input"})]})}function ge({src:t,basePath:n="/video",onComplete:r,className:a=""}){const c=o.useRef(null);return o.useEffect(()=>{const i=m=>{(m.key==="Escape"||m.key===" "||m.key==="Enter")&&(m.preventDefault(),r())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r]),e.jsxs("div",{className:`video-player-overlay ${a}`,children:[e.jsx("video",{ref:c,src:`${n}/${t}`,autoPlay:!0,onEnded:r,className:"video-player-video"}),e.jsx("button",{className:"video-player-skip-button",onClick:r,children:"Skip"})]})}function we({registry:t,config:n,title:r="Doodle Engine",subtitle:a,logoSrc:c,splashDuration:i=2e3,uiSounds:m,audioOptions:f,storageKey:v="doodle-engine-save",availableLocales:g,videoBasePath:j="/video",className:w="",devTools:T=!1}){const[y,C]=o.useState(i>0?"splash":"title"),[S,d]=o.useState(!1),[h,O]=o.useState(!1),[$,Y]=o.useState("title"),[G,J]=o.useState(null),[R,M]=o.useState(null),l=oe(m===!1?{enabled:!1}:m),p=localStorage.getItem(v)!==null,b=o.useCallback(()=>{const N={currentLocation:n.startLocation,currentTime:{...n.startTime},flags:{...n.startFlags},variables:{...n.startVariables},inventory:[...n.startInventory],questProgress:{},unlockedJournalEntries:[],playerNotes:[],dialogueState:null,characterState:{},itemLocations:{},mapEnabled:!0,notifications:[],pendingSounds:[],pendingVideo:null,currentLocale:"en"};return new Z.Engine(t,N)},[t,n]),_=o.useCallback(()=>{l.playClick();const N=b(),s=N.newGame(n);M({engine:N,snapshot:s}),C("playing")},[b,n,l]),V=o.useCallback(()=>{l.playClick();const N=localStorage.getItem(v);if(!N)return;const s=JSON.parse(N),u=b(),x=u.loadGame(s);M({engine:u,snapshot:x}),C("playing")},[b,v,l]),L=o.useCallback(()=>{if(!R)return;l.playClick();const N=R.engine.saveGame();localStorage.setItem(v,JSON.stringify(N)),d(!1)},[R,v,l]),P=o.useCallback(()=>{const N=localStorage.getItem(v);if(!N||!R)return;l.playClick();const s=JSON.parse(N),u=R.engine.loadGame(s);M({engine:R.engine,snapshot:u}),d(!1)},[R,v,l]),A=o.useCallback(()=>{l.playClick(),d(!1),O(!1),M(null),C("title")},[l]),I=o.useCallback(N=>{l.playMenuOpen(),Y(N),O(!0),N==="pause"&&d(!1)},[l]),D=o.useCallback(()=>{l.playMenuClose(),O(!1),$==="pause"&&d(!0)},[$,l]);o.useEffect(()=>{if(y!=="playing")return;const N=s=>{s.key==="Escape"&&(s.preventDefault(),h?D():(S?l.playMenuClose():l.playMenuOpen(),d(u=>!u)))};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[y,S,h,D,l]);const B={setMasterVolume:()=>{},setMusicVolume:()=>{},setSoundVolume:()=>{},setVoiceVolume:()=>{},stopAll:()=>{}};return y==="splash"?e.jsx("div",{className:`game-shell ${w}`,children:e.jsx(je,{logoSrc:c,title:r,onComplete:()=>C("title"),duration:i})}):y==="title"?e.jsx("div",{className:`game-shell ${w}`,children:h?e.jsx(te,{audioControls:B,uiSoundControls:m!==!1?l:void 0,availableLocales:g,onBack:D}):e.jsx(be,{title:r,subtitle:a,logoSrc:c,hasSaveData:p,onNewGame:_,onContinue:V,onSettings:()=>I("title")})}):R?e.jsx("div",{className:`game-shell ${w}`,children:e.jsx(le,{engine:R.engine,initialSnapshot:R.snapshot,devTools:T,children:e.jsx(Te,{audioOptions:f,uiSoundControls:m!==!1?l:void 0,showPauseMenu:S,showSettings:h,availableLocales:g,videoBasePath:j,pendingVideo:G,setPendingVideo:J,onPause:()=>{l.playMenuOpen(),d(!0)},onResume:()=>{l.playMenuClose(),d(!1)},onSave:L,onLoad:P,onSettings:()=>I("pause"),onQuitToTitle:A,onCloseSettings:D})})}):null}function Te({audioOptions:t,uiSoundControls:n,showPauseMenu:r,showSettings:a,availableLocales:c,videoBasePath:i,pendingVideo:m,setPendingVideo:f,onPause:v,onResume:g,onSave:j,onLoad:w,onSettings:T,onQuitToTitle:y,onCloseSettings:C}){const{snapshot:S,actions:d}=ee(),h=se(S,t);return o.useEffect(()=>{S.pendingVideo&&f(S.pendingVideo)},[S.pendingVideo,f]),e.jsxs(e.Fragment,{children:[m&&e.jsx(ge,{src:m,basePath:i,onComplete:()=>f(null)}),e.jsx(xe,{}),!r&&!a&&!m&&e.jsx("button",{className:"game-shell-menu-button",onClick:v,"aria-label":"Menu",children:"Menu"}),r&&e.jsx(Ne,{onResume:g,onSave:j,onLoad:w,onSettings:T,onQuitToTitle:y}),a&&e.jsx(te,{audioControls:h,uiSoundControls:n,availableLocales:c,currentLocale:(S.time,void 0),onLocaleChange:d.setLocale,onBack:C})]})}function Re({message:t="Loading...",className:n=""}){return e.jsx("div",{className:`loading-screen ${n}`,children:e.jsxs("div",{className:"loading-screen-content",children:[e.jsx("div",{className:"loading-screen-spinner"}),e.jsx("p",{className:"loading-screen-message",children:t})]})})}Object.defineProperty(exports,"VERSION",{enumerable:!0,get:()=>Z.VERSION});exports.CharacterList=de;exports.ChoiceList=ie;exports.DialogueBox=ce;exports.GameContext=K;exports.GameProvider=le;exports.GameRenderer=xe;exports.GameShell=we;exports.Inventory=me;exports.Journal=fe;exports.LoadingScreen=Re;exports.LocationView=ue;exports.MapView=he;exports.NotificationArea=ve;exports.PauseMenu=Ne;exports.SaveLoadPanel=pe;exports.SettingsPanel=te;exports.SplashScreen=je;exports.TitleScreen=be;exports.VideoPlayer=ge;exports.useAudioManager=se;exports.useGame=ee;exports.useUISounds=oe;
|