@sharpee/helpers 2.1.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builders/room.d.ts +16 -2
- package/builders/room.d.ts.map +1 -1
- package/builders/room.js +19 -1
- package/builders/room.js.map +1 -1
- package/package.json +2 -2
package/builders/room.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RoomBuilder — fluent builder for room entities.
|
|
3
3
|
*
|
|
4
|
-
* Public interface: description,
|
|
4
|
+
* Public interface: description, initialDescription, snippets, aliases,
|
|
5
|
+
* addTrait, dark, build.
|
|
5
6
|
*
|
|
6
7
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
7
8
|
*/
|
|
8
9
|
import { IFEntity } from '@sharpee/world-model';
|
|
9
|
-
import type { IWorldModel, ITrait } from '@sharpee/world-model';
|
|
10
|
+
import type { IWorldModel, ITrait, SnippetMap } from '@sharpee/world-model';
|
|
10
11
|
/**
|
|
11
12
|
* Fluent builder for creating room entities.
|
|
12
13
|
*
|
|
@@ -22,6 +23,7 @@ export declare class RoomBuilder {
|
|
|
22
23
|
private name;
|
|
23
24
|
private _description?;
|
|
24
25
|
private _initialDescription?;
|
|
26
|
+
private _snippets?;
|
|
25
27
|
private _aliases?;
|
|
26
28
|
private _isDark;
|
|
27
29
|
private _traits;
|
|
@@ -43,6 +45,18 @@ export declare class RoomBuilder {
|
|
|
43
45
|
* @returns this (for chaining)
|
|
44
46
|
*/
|
|
45
47
|
initialDescription(desc: string): this;
|
|
48
|
+
/**
|
|
49
|
+
* Set the room's marker→snippet table (ADR-209).
|
|
50
|
+
*
|
|
51
|
+
* `{snippet:name}` markers in the room's `description` /
|
|
52
|
+
* `initialDescription` are spliced from these entries at render time.
|
|
53
|
+
* Populates `RoomTrait.snippets`; a room without a snippet map is never
|
|
54
|
+
* scanned for markers.
|
|
55
|
+
*
|
|
56
|
+
* @param map - Marker name → snippet entry table
|
|
57
|
+
* @returns this (for chaining)
|
|
58
|
+
*/
|
|
59
|
+
snippets(map: SnippetMap): this;
|
|
46
60
|
/**
|
|
47
61
|
* Add name aliases for the room.
|
|
48
62
|
*
|
package/builders/room.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/helpers/src/builders/room.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/helpers/src/builders/room.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,QAAQ,EAGT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;;;;;;;;GASG;AACH,qBAAa,WAAW;IASpB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,IAAI;IATd,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,mBAAmB,CAAC,CAAS;IACrC,OAAO,CAAC,SAAS,CAAC,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAgB;gBAGrB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM;IAGtB;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;;;;OAQG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKtC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAK/B;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAKZ;;;;OAIG;IACH,KAAK,IAAI,QAAQ;CAiBlB"}
|
package/builders/room.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* RoomBuilder — fluent builder for room entities.
|
|
4
4
|
*
|
|
5
|
-
* Public interface: description,
|
|
5
|
+
* Public interface: description, initialDescription, snippets, aliases,
|
|
6
|
+
* addTrait, dark, build.
|
|
6
7
|
*
|
|
7
8
|
* Owner context: @sharpee/helpers (ADR-140)
|
|
8
9
|
*/
|
|
@@ -24,6 +25,7 @@ class RoomBuilder {
|
|
|
24
25
|
name;
|
|
25
26
|
_description;
|
|
26
27
|
_initialDescription;
|
|
28
|
+
_snippets;
|
|
27
29
|
_aliases;
|
|
28
30
|
_isDark = false;
|
|
29
31
|
_traits = [];
|
|
@@ -54,6 +56,21 @@ class RoomBuilder {
|
|
|
54
56
|
this._initialDescription = desc;
|
|
55
57
|
return this;
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Set the room's marker→snippet table (ADR-209).
|
|
61
|
+
*
|
|
62
|
+
* `{snippet:name}` markers in the room's `description` /
|
|
63
|
+
* `initialDescription` are spliced from these entries at render time.
|
|
64
|
+
* Populates `RoomTrait.snippets`; a room without a snippet map is never
|
|
65
|
+
* scanned for markers.
|
|
66
|
+
*
|
|
67
|
+
* @param map - Marker name → snippet entry table
|
|
68
|
+
* @returns this (for chaining)
|
|
69
|
+
*/
|
|
70
|
+
snippets(map) {
|
|
71
|
+
this._snippets = map;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
57
74
|
/**
|
|
58
75
|
* Add name aliases for the room.
|
|
59
76
|
*
|
|
@@ -93,6 +110,7 @@ class RoomBuilder {
|
|
|
93
110
|
entity.add(new world_model_1.RoomTrait({
|
|
94
111
|
isDark: this._isDark,
|
|
95
112
|
initialDescription: this._initialDescription,
|
|
113
|
+
snippets: this._snippets,
|
|
96
114
|
}));
|
|
97
115
|
entity.add(new world_model_1.IdentityTrait({
|
|
98
116
|
name: this.name,
|
package/builders/room.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/helpers/src/builders/room.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"room.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/helpers/src/builders/room.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,sDAI8B;AAG9B;;;;;;;;;GASG;AACH,MAAa,WAAW;IASZ;IACA;IATF,YAAY,CAAU;IACtB,mBAAmB,CAAU;IAC7B,SAAS,CAAc;IACvB,QAAQ,CAAY;IACpB,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAa,EAAE,CAAC;IAE/B,YACU,KAAkB,EAClB,IAAY;QADZ,UAAK,GAAL,KAAK,CAAa;QAClB,SAAI,GAAJ,IAAI,CAAQ;IACnB,CAAC;IAEJ;;;;;OAKG;IACH,WAAW,CAAC,IAAY;QACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;OAQG;IACH,kBAAkB,CAAC,IAAY;QAC7B,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,GAAe;QACtB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,GAAG,KAAe;QACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,MAAM,CAAC,GAAG,CAAC,IAAI,uBAAS,CAAC;YACvB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,kBAAkB,EAAE,IAAI,CAAC,mBAAmB;YAC5C,QAAQ,EAAE,IAAI,CAAC,SAAS;SACzB,CAAC,CAAC,CAAC;QACJ,MAAM,CAAC,GAAG,CAAC,IAAI,2BAAa,CAAC;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,YAAY;YAC9B,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC,CAAC;QACJ,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5GD,kCA4GC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/helpers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Fluent entity builder helpers for Sharpee Interactive Fiction Platform",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/world-model": "^
|
|
15
|
+
"@sharpee/world-model": "^3.0.0"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"interactive-fiction",
|