@react-text-game/core 0.5.15 → 0.5.16
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/dist/passages/interactiveMap/interactiveMap.d.ts.map +1 -1
- package/dist/passages/interactiveMap/interactiveMap.js +3 -1
- package/dist/passages/interactiveMap/interactiveMap.js.map +1 -1
- package/dist/passages/passage.d.ts +32 -0
- package/dist/passages/passage.d.ts.map +1 -1
- package/dist/passages/passage.js +36 -0
- package/dist/passages/passage.js.map +1 -1
- package/dist/passages/story/story.d.ts.map +1 -1
- package/dist/passages/story/story.js +3 -1
- package/dist/passages/story/story.js.map +1 -1
- package/dist/passages/widget.d.ts.map +1 -1
- package/dist/passages/widget.js +3 -1
- package/dist/passages/widget.js.map +1 -1
- package/dist/tests/passageDisplayCache.test.d.ts +2 -0
- package/dist/tests/passageDisplayCache.test.d.ts.map +1 -0
- package/dist/tests/passageDisplayCache.test.js +348 -0
- package/dist/tests/passageDisplayCache.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactiveMap.d.ts","sourceRoot":"","sources":["../../../src/passages/interactiveMap/interactiveMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,cAAe,SAAQ,OAAO;IACvC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAEhD;;;;;OAKG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB;IAKtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,WAAW,EACxC,KAAK,GAAE,CAAW,GACnB,kBAAkB;
|
|
1
|
+
{"version":3,"file":"interactiveMap.d.ts","sourceRoot":"","sources":["../../../src/passages/interactiveMap/interactiveMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,cAAe,SAAQ,OAAO;IACvC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAEhD;;;;;OAKG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB;IAKtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,WAAW,EACxC,KAAK,GAAE,CAAW,GACnB,kBAAkB;CAmBxB"}
|
|
@@ -105,12 +105,14 @@ export class InteractiveMap extends Passage {
|
|
|
105
105
|
.filter((hotspot) => hotspot !== undefined);
|
|
106
106
|
const image = callIfFunction(this.options.image);
|
|
107
107
|
const bgImage = callIfFunction(this.options.bgImage);
|
|
108
|
-
|
|
108
|
+
const result = {
|
|
109
109
|
...this.options,
|
|
110
110
|
image,
|
|
111
111
|
bgImage,
|
|
112
112
|
hotspots,
|
|
113
113
|
};
|
|
114
|
+
this._lastDisplayResult = result;
|
|
115
|
+
return result;
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
//# sourceMappingURL=interactiveMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactiveMap.js","sourceRoot":"","sources":["../../../src/passages/interactiveMap/interactiveMap.ts"],"names":[],"mappings":"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;OAEG;IACc,OAAO,CAAwB;IAEhD;;;;;OAKG;IACH,YAAY,EAAU,EAAE,OAA8B;QAClD,KAAK,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,OAAO,CACH,QAAW,EAAO;QAElB,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,aAAa;aACzB,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;aAClD,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;QAEhD,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC;QAEtD,MAAM,MAAM,GAAuB;YAC/B,GAAG,IAAI,CAAC,OAAO;YACf,KAAK;YACL,OAAO;YACP,QAAQ;SACX,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
|
@@ -35,6 +35,12 @@ export declare class Passage {
|
|
|
35
35
|
* Determines how the passage should be rendered in the UI.
|
|
36
36
|
*/
|
|
37
37
|
readonly type: PassageType;
|
|
38
|
+
/**
|
|
39
|
+
* Cached result from the last display() call.
|
|
40
|
+
* Used to access display data without re-executing content functions.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
protected _lastDisplayResult: unknown;
|
|
38
44
|
/**
|
|
39
45
|
* Creates a new passage and automatically registers it with the Game.
|
|
40
46
|
*
|
|
@@ -53,5 +59,31 @@ export declare class Passage {
|
|
|
53
59
|
* @throws Error if not implemented by subclass
|
|
54
60
|
*/
|
|
55
61
|
display<T extends InitVarsType = EmptyObject>(_props?: T): void;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the cached result from the last display() call.
|
|
64
|
+
* Use this method to access passage data without re-executing content functions,
|
|
65
|
+
* which prevents unwanted side effects.
|
|
66
|
+
*
|
|
67
|
+
* @template T - Expected return type
|
|
68
|
+
* @returns The cached display result, or null if display() has never been called
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const story = newStory('test', () => [{ type: 'text', content: 'Hello' }]);
|
|
73
|
+
*
|
|
74
|
+
* // First call to display() - executes content function
|
|
75
|
+
* const result = story.display();
|
|
76
|
+
*
|
|
77
|
+
* // Get cached result - does NOT execute content function again
|
|
78
|
+
* const cached = story.getLastDisplayResult();
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getLastDisplayResult<T = unknown>(): T | null;
|
|
82
|
+
/**
|
|
83
|
+
* Checks if a cached display result exists.
|
|
84
|
+
*
|
|
85
|
+
* @returns true if display() has been called at least once, false otherwise
|
|
86
|
+
*/
|
|
87
|
+
hasDisplayCache(): boolean;
|
|
56
88
|
}
|
|
57
89
|
//# sourceMappingURL=passage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage.d.ts","sourceRoot":"","sources":["../../src/passages/passage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,OAAO;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;;;;OAKG;gBACS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;IAMzC;;;;;;;;;OASG;IAEH,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,WAAW,EAAE,MAAM,GAAE,CAAW;
|
|
1
|
+
{"version":3,"file":"passage.d.ts","sourceRoot":"","sources":["../../src/passages/passage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,OAAO;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,kBAAkB,EAAE,OAAO,CAAQ;IAE7C;;;;;OAKG;gBACS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;IAMzC;;;;;;;;;OASG;IAEH,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,WAAW,EAAE,MAAM,GAAE,CAAW;IAMjE;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAAoB,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,IAAI;IAI7C;;;;OAIG;IACH,eAAe,IAAI,OAAO;CAG7B"}
|
package/dist/passages/passage.js
CHANGED
|
@@ -35,6 +35,12 @@ export class Passage {
|
|
|
35
35
|
* Determines how the passage should be rendered in the UI.
|
|
36
36
|
*/
|
|
37
37
|
type;
|
|
38
|
+
/**
|
|
39
|
+
* Cached result from the last display() call.
|
|
40
|
+
* Used to access display data without re-executing content functions.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
_lastDisplayResult = null;
|
|
38
44
|
/**
|
|
39
45
|
* Creates a new passage and automatically registers it with the Game.
|
|
40
46
|
*
|
|
@@ -60,5 +66,35 @@ export class Passage {
|
|
|
60
66
|
display(_props = {}) {
|
|
61
67
|
throw new Error(`Display method not implemented for passage: ${this.id}`);
|
|
62
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns the cached result from the last display() call.
|
|
71
|
+
* Use this method to access passage data without re-executing content functions,
|
|
72
|
+
* which prevents unwanted side effects.
|
|
73
|
+
*
|
|
74
|
+
* @template T - Expected return type
|
|
75
|
+
* @returns The cached display result, or null if display() has never been called
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const story = newStory('test', () => [{ type: 'text', content: 'Hello' }]);
|
|
80
|
+
*
|
|
81
|
+
* // First call to display() - executes content function
|
|
82
|
+
* const result = story.display();
|
|
83
|
+
*
|
|
84
|
+
* // Get cached result - does NOT execute content function again
|
|
85
|
+
* const cached = story.getLastDisplayResult();
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
getLastDisplayResult() {
|
|
89
|
+
return this._lastDisplayResult;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Checks if a cached display result exists.
|
|
93
|
+
*
|
|
94
|
+
* @returns true if display() has been called at least once, false otherwise
|
|
95
|
+
*/
|
|
96
|
+
hasDisplayCache() {
|
|
97
|
+
return this._lastDisplayResult !== null;
|
|
98
|
+
}
|
|
63
99
|
}
|
|
64
100
|
//# sourceMappingURL=passage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage.js","sourceRoot":"","sources":["../../src/passages/passage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,OAAO;IAChB;;;OAGG;IACM,EAAE,CAAS;IAEpB;;;OAGG;IACM,IAAI,CAAc;IAE3B;;;;;OAKG;IACH,YAAY,EAAU,EAAE,IAAiB;QACrC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;OASG;IACH,6DAA6D;IAC7D,OAAO,CAAuC,SAAY,EAAO;QAC7D,MAAM,IAAI,KAAK,CACX,+CAA+C,IAAI,CAAC,EAAE,EAAE,CAC3D,CAAC;IACN,CAAC;CACJ"}
|
|
1
|
+
{"version":3,"file":"passage.js","sourceRoot":"","sources":["../../src/passages/passage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,OAAO;IAChB;;;OAGG;IACM,EAAE,CAAS;IAEpB;;;OAGG;IACM,IAAI,CAAc;IAE3B;;;;OAIG;IACO,kBAAkB,GAAY,IAAI,CAAC;IAE7C;;;;;OAKG;IACH,YAAY,EAAU,EAAE,IAAiB;QACrC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;;OASG;IACH,6DAA6D;IAC7D,OAAO,CAAuC,SAAY,EAAO;QAC7D,MAAM,IAAI,KAAK,CACX,+CAA+C,IAAI,CAAC,EAAE,EAAE,CAC3D,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,oBAAoB;QAChB,OAAO,IAAI,CAAC,kBAA8B,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,eAAe;QACX,OAAO,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC;IAC5C,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../src/passages/story/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,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AK,GAAE,CAAW,GACnB;QAAE,OAAO,CAAC,EAAE,YAAY,CAAC;QAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;KAAE;CAQ9D"}
|
|
@@ -79,10 +79,12 @@ export class Story extends Passage {
|
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
81
|
display(props = {}) {
|
|
82
|
-
|
|
82
|
+
const result = {
|
|
83
83
|
options: this.options,
|
|
84
84
|
components: this.content(props),
|
|
85
85
|
};
|
|
86
|
+
this._lastDisplayResult = result;
|
|
87
|
+
return result;
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
//# sourceMappingURL=story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../src/passages/story/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO;IAC9B;;OAEG;IACc,OAAO,CAAe;IAEvC;;OAEG;IACc,OAAO,CAAe;IAEvC;;;;;;OAMG;IACH,YAAY,EAAU,EAAE,OAAqB,EAAE,UAAwB,EAAE;QACrE,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CACH,QAAW,EAAO;QAElB,
|
|
1
|
+
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../src/passages/story/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO;IAC9B;;OAEG;IACc,OAAO,CAAe;IAEvC;;OAEG;IACc,OAAO,CAAe;IAEvC;;;;;;OAMG;IACH,YAAY,EAAU,EAAE,OAAqB,EAAE,UAAwB,EAAE;QACrE,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CACH,QAAW,EAAO;QAElB,MAAM,MAAM,GAAG;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;SAClC,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/passages/widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,MAAO,SAAQ,OAAO;IAC/B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IAExC;;;;;OAKG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAK9C;;;;;OAKG;IACH,OAAO;
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/passages/widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,MAAO,SAAQ,OAAO;IAC/B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IAExC;;;;;OAKG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAK9C;;;;;OAKG;IACH,OAAO,IAAI,SAAS;CAQvB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,EAAE,SAAS,aAAa,WACjC,CAAC"}
|
package/dist/passages/widget.js
CHANGED
|
@@ -55,9 +55,11 @@ export class Widget extends Passage {
|
|
|
55
55
|
* @returns The React content to be rendered
|
|
56
56
|
*/
|
|
57
57
|
display() {
|
|
58
|
-
|
|
58
|
+
const result = typeof this.content === "function"
|
|
59
59
|
? this.content()
|
|
60
60
|
: this.content;
|
|
61
|
+
this._lastDisplayResult = result;
|
|
62
|
+
return result;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/passages/widget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAiB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,MAAO,SAAQ,OAAO;IAC/B;;OAEG;IACc,OAAO,CAAgB;IAExC;;;;;OAKG;IACH,YAAY,EAAU,EAAE,OAAsB;QAC1C,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACH,OAAO;QACH,
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/passages/widget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAiB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,MAAO,SAAQ,OAAO;IAC/B;;OAEG;IACc,OAAO,CAAgB;IAExC;;;;;OAKG;IACH,YAAY,EAAU,EAAE,OAAsB;QAC1C,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACH,OAAO;QACH,MAAM,MAAM,GACR,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU;YAC9B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE;YAChB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAU,EAAE,OAAsB,EAAE,EAAE,CAC5D,IAAI,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passageDisplayCache.test.d.ts","sourceRoot":"","sources":["../../src/tests/passageDisplayCache.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import { Game } from "../game";
|
|
3
|
+
import { newInteractiveMap } from "../passages/interactiveMap/fabric";
|
|
4
|
+
import { newStory } from "../passages/story/fabric";
|
|
5
|
+
import { newWidget } from "../passages/widget";
|
|
6
|
+
import { Storage } from "../storage";
|
|
7
|
+
// Counter for unique IDs
|
|
8
|
+
let testCounter = 0;
|
|
9
|
+
function uniqueId(prefix) {
|
|
10
|
+
return `${prefix}-${testCounter++}`;
|
|
11
|
+
}
|
|
12
|
+
describe("Passage Display Cache - No Double Side Effects", () => {
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
Storage.setState({});
|
|
15
|
+
await Game.init({ gameName: "Test Game", isDevMode: true });
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
Game._resetForTesting();
|
|
19
|
+
});
|
|
20
|
+
describe("Story Cache", () => {
|
|
21
|
+
test("getLastDisplayResult returns null before first display", () => {
|
|
22
|
+
const story = newStory(uniqueId("story"), () => [
|
|
23
|
+
{ type: "text", content: "Hello" },
|
|
24
|
+
]);
|
|
25
|
+
expect(story.getLastDisplayResult()).toBeNull();
|
|
26
|
+
expect(story.hasDisplayCache()).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
test("getLastDisplayResult returns cached result after display", () => {
|
|
29
|
+
const story = newStory(uniqueId("story"), () => [
|
|
30
|
+
{ type: "text", content: "Hello" },
|
|
31
|
+
]);
|
|
32
|
+
const displayResult = story.display();
|
|
33
|
+
const cachedResult = story.getLastDisplayResult();
|
|
34
|
+
expect(cachedResult).toEqual(displayResult);
|
|
35
|
+
expect(story.hasDisplayCache()).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
test("getLastDisplayResult does NOT trigger content function (no side effects)", () => {
|
|
38
|
+
let callCount = 0;
|
|
39
|
+
const story = newStory(uniqueId("story"), () => {
|
|
40
|
+
callCount++;
|
|
41
|
+
return [{ type: "text", content: `Call ${callCount}` }];
|
|
42
|
+
});
|
|
43
|
+
// First display() call - triggers content function
|
|
44
|
+
story.display();
|
|
45
|
+
expect(callCount).toBe(1);
|
|
46
|
+
// Multiple getLastDisplayResult() calls - should NOT trigger content function
|
|
47
|
+
story.getLastDisplayResult();
|
|
48
|
+
story.getLastDisplayResult();
|
|
49
|
+
story.getLastDisplayResult();
|
|
50
|
+
expect(callCount).toBe(1); // Still 1, no additional calls
|
|
51
|
+
// Another display() call - SHOULD trigger content function
|
|
52
|
+
story.display();
|
|
53
|
+
expect(callCount).toBe(2);
|
|
54
|
+
});
|
|
55
|
+
test("cache updates correctly after each display call", () => {
|
|
56
|
+
let callCount = 0;
|
|
57
|
+
const story = newStory(uniqueId("story"), () => {
|
|
58
|
+
callCount++;
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
type: "text",
|
|
62
|
+
content: `Call ${callCount}`,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
});
|
|
66
|
+
story.display();
|
|
67
|
+
const cache1 = story.getLastDisplayResult();
|
|
68
|
+
expect((cache1?.components[0]).content).toBe("Call 1");
|
|
69
|
+
story.display();
|
|
70
|
+
const cache2 = story.getLastDisplayResult();
|
|
71
|
+
expect((cache2?.components[0]).content).toBe("Call 2");
|
|
72
|
+
});
|
|
73
|
+
test("simulates DevModeDrawer scenario - no side effects when reading passage data", () => {
|
|
74
|
+
let sideEffectCounter = 0;
|
|
75
|
+
const story = newStory(uniqueId("story"), () => {
|
|
76
|
+
sideEffectCounter++; // Simulates a side effect like incrementing a game counter
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
content: `Viewed ${sideEffectCounter} times`,
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
});
|
|
84
|
+
// User navigates to passage (display is called by UI)
|
|
85
|
+
Game.jumpTo(story.id);
|
|
86
|
+
story.display();
|
|
87
|
+
expect(sideEffectCounter).toBe(1);
|
|
88
|
+
// User opens DevModeDrawer - should NOT cause side effect
|
|
89
|
+
const cachedData = story.getLastDisplayResult();
|
|
90
|
+
expect(sideEffectCounter).toBe(1); // Still 1
|
|
91
|
+
expect(cachedData).not.toBeNull();
|
|
92
|
+
// User refreshes DevModeDrawer multiple times - still no side effects
|
|
93
|
+
story.getLastDisplayResult();
|
|
94
|
+
story.getLastDisplayResult();
|
|
95
|
+
expect(sideEffectCounter).toBe(1);
|
|
96
|
+
});
|
|
97
|
+
test("cached result has correct structure with options and components", () => {
|
|
98
|
+
const story = newStory(uniqueId("story"), () => [
|
|
99
|
+
{ type: "text", content: "Test" },
|
|
100
|
+
{ type: "header", content: "Header", props: { level: 1 } },
|
|
101
|
+
], { background: { image: "/bg.jpg" } });
|
|
102
|
+
story.display();
|
|
103
|
+
const cached = story.getLastDisplayResult();
|
|
104
|
+
expect(cached).not.toBeNull();
|
|
105
|
+
expect(cached?.options?.background?.image).toBe("/bg.jpg");
|
|
106
|
+
expect(cached?.components).toHaveLength(2);
|
|
107
|
+
expect(cached?.components[0]?.type).toBe("text");
|
|
108
|
+
expect(cached?.components[1]?.type).toBe("header");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe("InteractiveMap Cache", () => {
|
|
112
|
+
test("getLastDisplayResult returns null before first display", () => {
|
|
113
|
+
const map = newInteractiveMap(uniqueId("map"), {
|
|
114
|
+
image: "/map.jpg",
|
|
115
|
+
bgImage: "/bg.jpg",
|
|
116
|
+
hotspots: [],
|
|
117
|
+
});
|
|
118
|
+
expect(map.getLastDisplayResult()).toBeNull();
|
|
119
|
+
expect(map.hasDisplayCache()).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
test("getLastDisplayResult returns cached result after display", () => {
|
|
122
|
+
const map = newInteractiveMap(uniqueId("map"), {
|
|
123
|
+
image: "/map.jpg",
|
|
124
|
+
bgImage: "/bg.jpg",
|
|
125
|
+
hotspots: [
|
|
126
|
+
{
|
|
127
|
+
type: "label",
|
|
128
|
+
content: "Test",
|
|
129
|
+
position: { x: 50, y: 50 },
|
|
130
|
+
action: () => { },
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
const displayResult = map.display();
|
|
135
|
+
const cachedResult = map.getLastDisplayResult();
|
|
136
|
+
expect(cachedResult?.image).toBe(displayResult.image);
|
|
137
|
+
expect(cachedResult?.bgImage).toBe(displayResult.bgImage);
|
|
138
|
+
expect(cachedResult?.hotspots.length).toBe(displayResult.hotspots.length);
|
|
139
|
+
expect(map.hasDisplayCache()).toBe(true);
|
|
140
|
+
});
|
|
141
|
+
test("getLastDisplayResult does NOT trigger hotspot functions (no side effects)", () => {
|
|
142
|
+
let imageCallCount = 0;
|
|
143
|
+
let hotspotCallCount = 0;
|
|
144
|
+
const map = newInteractiveMap(uniqueId("map"), {
|
|
145
|
+
image: () => {
|
|
146
|
+
imageCallCount++;
|
|
147
|
+
return `/map-${imageCallCount}.jpg`;
|
|
148
|
+
},
|
|
149
|
+
bgImage: "/bg.jpg",
|
|
150
|
+
hotspots: [
|
|
151
|
+
() => {
|
|
152
|
+
hotspotCallCount++;
|
|
153
|
+
return {
|
|
154
|
+
type: "label",
|
|
155
|
+
content: `Hotspot ${hotspotCallCount}`,
|
|
156
|
+
position: { x: 50, y: 50 },
|
|
157
|
+
action: () => { },
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
// First display() - triggers all functions
|
|
163
|
+
map.display();
|
|
164
|
+
expect(imageCallCount).toBe(1);
|
|
165
|
+
expect(hotspotCallCount).toBe(1);
|
|
166
|
+
// getLastDisplayResult() should NOT trigger functions
|
|
167
|
+
map.getLastDisplayResult();
|
|
168
|
+
map.getLastDisplayResult();
|
|
169
|
+
expect(imageCallCount).toBe(1);
|
|
170
|
+
expect(hotspotCallCount).toBe(1);
|
|
171
|
+
});
|
|
172
|
+
test("cached result has resolved images and hotspots", () => {
|
|
173
|
+
const map = newInteractiveMap(uniqueId("map"), {
|
|
174
|
+
image: () => "/dynamic-map.jpg",
|
|
175
|
+
bgImage: () => "/dynamic-bg.jpg",
|
|
176
|
+
hotspots: [
|
|
177
|
+
() => ({
|
|
178
|
+
type: "label",
|
|
179
|
+
content: "Dynamic Hotspot",
|
|
180
|
+
position: { x: 25, y: 75 },
|
|
181
|
+
action: () => { },
|
|
182
|
+
}),
|
|
183
|
+
],
|
|
184
|
+
});
|
|
185
|
+
map.display();
|
|
186
|
+
const cached = map.getLastDisplayResult();
|
|
187
|
+
expect(cached).not.toBeNull();
|
|
188
|
+
expect(cached?.image).toBe("/dynamic-map.jpg");
|
|
189
|
+
expect(cached?.bgImage).toBe("/dynamic-bg.jpg");
|
|
190
|
+
expect(cached?.hotspots).toHaveLength(1);
|
|
191
|
+
const hotspot = cached?.hotspots[0];
|
|
192
|
+
if (hotspot && hotspot.type === "label") {
|
|
193
|
+
expect(hotspot.content).toBe("Dynamic Hotspot");
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
test("cache updates on each display call", () => {
|
|
197
|
+
let displayCount = 0;
|
|
198
|
+
const map = newInteractiveMap(uniqueId("map"), {
|
|
199
|
+
image: () => {
|
|
200
|
+
displayCount++;
|
|
201
|
+
return `/map-${displayCount}.jpg`;
|
|
202
|
+
},
|
|
203
|
+
bgImage: "/bg.jpg",
|
|
204
|
+
hotspots: [
|
|
205
|
+
{
|
|
206
|
+
type: "label",
|
|
207
|
+
content: "Test",
|
|
208
|
+
position: { x: 50, y: 50 },
|
|
209
|
+
action: () => { },
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
});
|
|
213
|
+
map.display();
|
|
214
|
+
expect(displayCount).toBe(1);
|
|
215
|
+
expect(map.getLastDisplayResult()?.image).toBe("/map-1.jpg");
|
|
216
|
+
map.display();
|
|
217
|
+
expect(displayCount).toBe(2);
|
|
218
|
+
expect(map.getLastDisplayResult()?.image).toBe("/map-2.jpg");
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
describe("Widget Cache", () => {
|
|
222
|
+
test("getLastDisplayResult returns null before first display", () => {
|
|
223
|
+
const widget = newWidget(uniqueId("widget"), () => "Content");
|
|
224
|
+
expect(widget.getLastDisplayResult()).toBeNull();
|
|
225
|
+
expect(widget.hasDisplayCache()).toBe(false);
|
|
226
|
+
});
|
|
227
|
+
test("getLastDisplayResult returns cached result after display", () => {
|
|
228
|
+
const widget = newWidget(uniqueId("widget"), () => "Widget Content");
|
|
229
|
+
const displayResult = widget.display();
|
|
230
|
+
const cachedResult = widget.getLastDisplayResult();
|
|
231
|
+
expect(cachedResult).toBe(displayResult);
|
|
232
|
+
expect(widget.hasDisplayCache()).toBe(true);
|
|
233
|
+
});
|
|
234
|
+
test("getLastDisplayResult does NOT trigger content function (no side effects)", () => {
|
|
235
|
+
let callCount = 0;
|
|
236
|
+
const widget = newWidget(uniqueId("widget"), () => {
|
|
237
|
+
callCount++;
|
|
238
|
+
return `Content ${callCount}`;
|
|
239
|
+
});
|
|
240
|
+
widget.display();
|
|
241
|
+
expect(callCount).toBe(1);
|
|
242
|
+
widget.getLastDisplayResult();
|
|
243
|
+
widget.getLastDisplayResult();
|
|
244
|
+
expect(callCount).toBe(1); // No additional calls
|
|
245
|
+
});
|
|
246
|
+
test("static content widget caches correctly", () => {
|
|
247
|
+
const staticContent = "Static Widget Content";
|
|
248
|
+
const widget = newWidget(uniqueId("widget"), staticContent);
|
|
249
|
+
const displayResult = widget.display();
|
|
250
|
+
const cachedResult = widget.getLastDisplayResult();
|
|
251
|
+
expect(cachedResult).toBe(staticContent);
|
|
252
|
+
expect(cachedResult).toBe(displayResult);
|
|
253
|
+
});
|
|
254
|
+
test("cache updates when display is called again", () => {
|
|
255
|
+
let callCount = 0;
|
|
256
|
+
const widget = newWidget(uniqueId("widget"), () => {
|
|
257
|
+
callCount++;
|
|
258
|
+
return `Content ${callCount}`;
|
|
259
|
+
});
|
|
260
|
+
widget.display();
|
|
261
|
+
expect(widget.getLastDisplayResult()).toBe("Content 1");
|
|
262
|
+
widget.display();
|
|
263
|
+
expect(widget.getLastDisplayResult()).toBe("Content 2");
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
describe("Base Passage Methods", () => {
|
|
267
|
+
test("hasDisplayCache returns false before display", () => {
|
|
268
|
+
const story = newStory(uniqueId("story"), () => [
|
|
269
|
+
{ type: "text", content: "Test" },
|
|
270
|
+
]);
|
|
271
|
+
expect(story.hasDisplayCache()).toBe(false);
|
|
272
|
+
});
|
|
273
|
+
test("hasDisplayCache returns true after display", () => {
|
|
274
|
+
const story = newStory(uniqueId("story"), () => [
|
|
275
|
+
{ type: "text", content: "Test" },
|
|
276
|
+
]);
|
|
277
|
+
story.display();
|
|
278
|
+
expect(story.hasDisplayCache()).toBe(true);
|
|
279
|
+
});
|
|
280
|
+
test("getLastDisplayResult returns properly typed result", () => {
|
|
281
|
+
const story = newStory(uniqueId("story"), () => [
|
|
282
|
+
{ type: "text", content: "Test" },
|
|
283
|
+
]);
|
|
284
|
+
story.display();
|
|
285
|
+
// Using the Story's typed getLastDisplayResult method
|
|
286
|
+
const result = story.getLastDisplayResult();
|
|
287
|
+
expect(result?.components[0]?.type).toBe("text");
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
describe("Practical Scenarios", () => {
|
|
291
|
+
test("simulates load game scenario - cache populated by first render", () => {
|
|
292
|
+
let stateChangeCount = 0;
|
|
293
|
+
const story = newStory(uniqueId("story"), () => {
|
|
294
|
+
stateChangeCount++; // Simulates state change during render
|
|
295
|
+
return [
|
|
296
|
+
{
|
|
297
|
+
type: "text",
|
|
298
|
+
content: `State changed ${stateChangeCount} times`,
|
|
299
|
+
},
|
|
300
|
+
];
|
|
301
|
+
});
|
|
302
|
+
// Simulate initial render after loading game
|
|
303
|
+
story.display();
|
|
304
|
+
expect(stateChangeCount).toBe(1);
|
|
305
|
+
// Simulate DevModeDrawer opening (should use cache)
|
|
306
|
+
const cachedData = story.getLastDisplayResult();
|
|
307
|
+
expect(stateChangeCount).toBe(1); // No additional state change
|
|
308
|
+
expect(cachedData).not.toBeNull();
|
|
309
|
+
// Simulate re-render (intentional)
|
|
310
|
+
story.display();
|
|
311
|
+
expect(stateChangeCount).toBe(2);
|
|
312
|
+
});
|
|
313
|
+
test("multiple passages maintain independent caches", () => {
|
|
314
|
+
let story1CallCount = 0;
|
|
315
|
+
let story2CallCount = 0;
|
|
316
|
+
const story1 = newStory(uniqueId("story1"), () => {
|
|
317
|
+
story1CallCount++;
|
|
318
|
+
return [
|
|
319
|
+
{
|
|
320
|
+
type: "text",
|
|
321
|
+
content: `Story 1 call ${story1CallCount}`,
|
|
322
|
+
},
|
|
323
|
+
];
|
|
324
|
+
});
|
|
325
|
+
const story2 = newStory(uniqueId("story2"), () => {
|
|
326
|
+
story2CallCount++;
|
|
327
|
+
return [
|
|
328
|
+
{
|
|
329
|
+
type: "text",
|
|
330
|
+
content: `Story 2 call ${story2CallCount}`,
|
|
331
|
+
},
|
|
332
|
+
];
|
|
333
|
+
});
|
|
334
|
+
story1.display();
|
|
335
|
+
expect(story1CallCount).toBe(1);
|
|
336
|
+
expect(story2CallCount).toBe(0);
|
|
337
|
+
story2.display();
|
|
338
|
+
expect(story1CallCount).toBe(1);
|
|
339
|
+
expect(story2CallCount).toBe(1);
|
|
340
|
+
// Getting cached results doesn't affect call counts
|
|
341
|
+
story1.getLastDisplayResult();
|
|
342
|
+
story2.getLastDisplayResult();
|
|
343
|
+
expect(story1CallCount).toBe(1);
|
|
344
|
+
expect(story2CallCount).toBe(1);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
//# sourceMappingURL=passageDisplayCache.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passageDisplayCache.test.js","sourceRoot":"","sources":["../../src/tests/passageDisplayCache.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAMlD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAOnC,yBAAyB;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AoB,EAAE,CAAC;YAC9B,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAC9B,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-text-game/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.16",
|
|
4
4
|
"description": "A powerful React-based text game engine with reactive state management, passage-based navigation, and persistent save system for building interactive narrative experiences",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|