@sharpee/lang-en-us 1.5.0 → 2.1.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.
Files changed (259) hide show
  1. package/actions/about.d.ts +1 -0
  2. package/actions/about.d.ts.map +1 -1
  3. package/actions/about.js +15 -8
  4. package/actions/about.js.map +1 -1
  5. package/actions/again.d.ts.map +1 -1
  6. package/actions/again.js.map +1 -1
  7. package/actions/answering.d.ts.map +1 -1
  8. package/actions/answering.js.map +1 -1
  9. package/actions/asking.d.ts.map +1 -1
  10. package/actions/asking.js +14 -14
  11. package/actions/asking.js.map +1 -1
  12. package/actions/attacking.d.ts.map +1 -1
  13. package/actions/attacking.js +51 -51
  14. package/actions/attacking.js.map +1 -1
  15. package/actions/climbing.d.ts.map +1 -1
  16. package/actions/climbing.js +4 -4
  17. package/actions/climbing.js.map +1 -1
  18. package/actions/closing.d.ts.map +1 -1
  19. package/actions/closing.js +5 -5
  20. package/actions/closing.js.map +1 -1
  21. package/actions/drinking.d.ts.map +1 -1
  22. package/actions/drinking.js +20 -20
  23. package/actions/drinking.js.map +1 -1
  24. package/actions/dropping.d.ts.map +1 -1
  25. package/actions/dropping.js +3 -3
  26. package/actions/dropping.js.map +1 -1
  27. package/actions/eating.d.ts.map +1 -1
  28. package/actions/eating.js +20 -20
  29. package/actions/eating.js.map +1 -1
  30. package/actions/entering.d.ts.map +1 -1
  31. package/actions/entering.js +10 -10
  32. package/actions/entering.js.map +1 -1
  33. package/actions/examining.d.ts.map +1 -1
  34. package/actions/examining.js +28 -23
  35. package/actions/examining.js.map +1 -1
  36. package/actions/exiting.d.ts.map +1 -1
  37. package/actions/exiting.js +4 -4
  38. package/actions/exiting.js.map +1 -1
  39. package/actions/giving.d.ts.map +1 -1
  40. package/actions/giving.js +12 -12
  41. package/actions/giving.js.map +1 -1
  42. package/actions/going.d.ts.map +1 -1
  43. package/actions/going.js +7 -7
  44. package/actions/going.js.map +1 -1
  45. package/actions/help.d.ts +3 -3
  46. package/actions/help.d.ts.map +1 -1
  47. package/actions/help.js +9 -7
  48. package/actions/help.js.map +1 -1
  49. package/actions/hiding.d.ts.map +1 -1
  50. package/actions/hiding.js.map +1 -1
  51. package/actions/index.d.ts +5 -3
  52. package/actions/index.d.ts.map +1 -1
  53. package/actions/index.js.map +1 -1
  54. package/actions/inserting.d.ts.map +1 -1
  55. package/actions/inserting.js +8 -8
  56. package/actions/inserting.js.map +1 -1
  57. package/actions/inventory.d.ts.map +1 -1
  58. package/actions/inventory.js.map +1 -1
  59. package/actions/listening.d.ts.map +1 -1
  60. package/actions/listening.js +7 -7
  61. package/actions/listening.js.map +1 -1
  62. package/actions/locking.d.ts.map +1 -1
  63. package/actions/locking.js +8 -8
  64. package/actions/locking.js.map +1 -1
  65. package/actions/looking.d.ts.map +1 -1
  66. package/actions/looking.js +5 -5
  67. package/actions/looking.js.map +1 -1
  68. package/actions/lowering.d.ts.map +1 -1
  69. package/actions/lowering.js +2 -2
  70. package/actions/lowering.js.map +1 -1
  71. package/actions/opening.d.ts.map +1 -1
  72. package/actions/opening.js +7 -7
  73. package/actions/opening.js.map +1 -1
  74. package/actions/pulling.d.ts.map +1 -1
  75. package/actions/pulling.js +19 -19
  76. package/actions/pulling.js.map +1 -1
  77. package/actions/pushing.d.ts.map +1 -1
  78. package/actions/pushing.js +14 -14
  79. package/actions/pushing.js.map +1 -1
  80. package/actions/putting.d.ts.map +1 -1
  81. package/actions/putting.js +12 -12
  82. package/actions/putting.js.map +1 -1
  83. package/actions/quitting.d.ts.map +1 -1
  84. package/actions/quitting.js.map +1 -1
  85. package/actions/raising.d.ts.map +1 -1
  86. package/actions/raising.js +2 -2
  87. package/actions/raising.js.map +1 -1
  88. package/actions/reading.d.ts.map +1 -1
  89. package/actions/reading.js +10 -8
  90. package/actions/reading.js.map +1 -1
  91. package/actions/removing.d.ts.map +1 -1
  92. package/actions/removing.js +8 -8
  93. package/actions/removing.js.map +1 -1
  94. package/actions/restoring.d.ts.map +1 -1
  95. package/actions/restoring.js +6 -6
  96. package/actions/restoring.js.map +1 -1
  97. package/actions/saving.d.ts.map +1 -1
  98. package/actions/saving.js +6 -6
  99. package/actions/saving.js.map +1 -1
  100. package/actions/scoring.d.ts.map +1 -1
  101. package/actions/scoring.js.map +1 -1
  102. package/actions/searching.d.ts.map +1 -1
  103. package/actions/searching.js +7 -7
  104. package/actions/searching.js.map +1 -1
  105. package/actions/showing.d.ts.map +1 -1
  106. package/actions/showing.js +11 -11
  107. package/actions/showing.js.map +1 -1
  108. package/actions/sleeping.d.ts.map +1 -1
  109. package/actions/sleeping.js.map +1 -1
  110. package/actions/smelling.d.ts.map +1 -1
  111. package/actions/smelling.js +10 -10
  112. package/actions/smelling.js.map +1 -1
  113. package/actions/switching-off.d.ts.map +1 -1
  114. package/actions/switching-off.js +12 -12
  115. package/actions/switching-off.js.map +1 -1
  116. package/actions/switching-on.d.ts.map +1 -1
  117. package/actions/switching-on.js +12 -12
  118. package/actions/switching-on.js.map +1 -1
  119. package/actions/taking-off.d.ts.map +1 -1
  120. package/actions/taking-off.js +4 -4
  121. package/actions/taking-off.js.map +1 -1
  122. package/actions/taking.d.ts +1 -0
  123. package/actions/taking.d.ts.map +1 -1
  124. package/actions/taking.js +7 -5
  125. package/actions/taking.js.map +1 -1
  126. package/actions/talking.d.ts.map +1 -1
  127. package/actions/talking.js +15 -15
  128. package/actions/talking.js.map +1 -1
  129. package/actions/telling.d.ts.map +1 -1
  130. package/actions/telling.js +13 -13
  131. package/actions/telling.js.map +1 -1
  132. package/actions/throwing.d.ts.map +1 -1
  133. package/actions/throwing.js +21 -21
  134. package/actions/throwing.js.map +1 -1
  135. package/actions/touching.d.ts.map +1 -1
  136. package/actions/touching.js +20 -20
  137. package/actions/touching.js.map +1 -1
  138. package/actions/turning.d.ts.map +1 -1
  139. package/actions/turning.js +24 -24
  140. package/actions/turning.js.map +1 -1
  141. package/actions/undoing.d.ts.map +1 -1
  142. package/actions/undoing.js.map +1 -1
  143. package/actions/unlocking.d.ts.map +1 -1
  144. package/actions/unlocking.js +8 -8
  145. package/actions/unlocking.js.map +1 -1
  146. package/actions/version.d.ts.map +1 -1
  147. package/actions/version.js +3 -3
  148. package/actions/version.js.map +1 -1
  149. package/actions/waiting.d.ts.map +1 -1
  150. package/actions/waiting.js +1 -1
  151. package/actions/waiting.js.map +1 -1
  152. package/actions/wearing.d.ts.map +1 -1
  153. package/actions/wearing.js +5 -5
  154. package/actions/wearing.js.map +1 -1
  155. package/assembler/english-assembler.d.ts +66 -0
  156. package/assembler/english-assembler.d.ts.map +1 -0
  157. package/assembler/english-assembler.js +806 -0
  158. package/assembler/english-assembler.js.map +1 -0
  159. package/assembler/errors.d.ts +23 -0
  160. package/assembler/errors.d.ts.map +1 -0
  161. package/assembler/errors.js +35 -0
  162. package/assembler/errors.js.map +1 -0
  163. package/assembler/index.d.ts +10 -0
  164. package/assembler/index.d.ts.map +1 -0
  165. package/assembler/index.js +17 -0
  166. package/assembler/index.js.map +1 -0
  167. package/data/events.d.ts.map +1 -1
  168. package/data/events.js +11 -11
  169. package/data/events.js.map +1 -1
  170. package/data/messages.d.ts.map +1 -1
  171. package/data/messages.js +1 -1
  172. package/data/messages.js.map +1 -1
  173. package/data/verbs.d.ts.map +1 -1
  174. package/data/verbs.js.map +1 -1
  175. package/data/words.d.ts.map +1 -1
  176. package/data/words.js.map +1 -1
  177. package/grammar.d.ts.map +1 -1
  178. package/grammar.js.map +1 -1
  179. package/index.d.ts +2 -1
  180. package/index.d.ts.map +1 -1
  181. package/index.js +4 -1
  182. package/index.js.map +1 -1
  183. package/language-provider.d.ts +50 -24
  184. package/language-provider.d.ts.map +1 -1
  185. package/language-provider.js +96 -40
  186. package/language-provider.js.map +1 -1
  187. package/npc/conversation.d.ts +5 -0
  188. package/npc/conversation.d.ts.map +1 -1
  189. package/npc/conversation.js +24 -19
  190. package/npc/conversation.js.map +1 -1
  191. package/npc/index.d.ts.map +1 -1
  192. package/npc/index.js.map +1 -1
  193. package/npc/influence.d.ts.map +1 -1
  194. package/npc/influence.js +4 -4
  195. package/npc/influence.js.map +1 -1
  196. package/npc/npc.d.ts +6 -0
  197. package/npc/npc.d.ts.map +1 -1
  198. package/npc/npc.js +39 -33
  199. package/npc/npc.js.map +1 -1
  200. package/npc/propagation.d.ts.map +1 -1
  201. package/npc/propagation.js +6 -6
  202. package/npc/propagation.js.map +1 -1
  203. package/number-words.d.ts +18 -0
  204. package/number-words.d.ts.map +1 -1
  205. package/number-words.js +77 -0
  206. package/number-words.js.map +1 -1
  207. package/package.json +3 -3
  208. package/parser/index.d.ts +8 -0
  209. package/parser/index.d.ts.map +1 -0
  210. package/parser/index.js +13 -0
  211. package/parser/index.js.map +1 -0
  212. package/parser/parse-phrase-template.d.ts +62 -0
  213. package/parser/parse-phrase-template.d.ts.map +1 -0
  214. package/parser/parse-phrase-template.js +384 -0
  215. package/parser/parse-phrase-template.js.map +1 -0
  216. package/perspective/index.d.ts.map +1 -1
  217. package/perspective/index.js.map +1 -1
  218. package/perspective/placeholder-resolver.d.ts +1 -1
  219. package/perspective/placeholder-resolver.d.ts.map +1 -1
  220. package/perspective/placeholder-resolver.js +12 -1
  221. package/perspective/placeholder-resolver.js.map +1 -1
  222. package/platform-messages.d.ts +26 -0
  223. package/platform-messages.d.ts.map +1 -0
  224. package/platform-messages.js +31 -0
  225. package/platform-messages.js.map +1 -0
  226. package/pluralize.d.ts.map +1 -1
  227. package/pluralize.js.map +1 -1
  228. package/sound-messages.d.ts +8 -8
  229. package/sound-messages.d.ts.map +1 -1
  230. package/sound-messages.js +8 -8
  231. package/sound-messages.js.map +1 -1
  232. package/formatters/article.d.ts +0 -41
  233. package/formatters/article.d.ts.map +0 -1
  234. package/formatters/article.js +0 -143
  235. package/formatters/article.js.map +0 -1
  236. package/formatters/index.d.ts +0 -19
  237. package/formatters/index.d.ts.map +0 -1
  238. package/formatters/index.js +0 -42
  239. package/formatters/index.js.map +0 -1
  240. package/formatters/list.d.ts +0 -56
  241. package/formatters/list.d.ts.map +0 -1
  242. package/formatters/list.js +0 -178
  243. package/formatters/list.js.map +0 -1
  244. package/formatters/registry.d.ts +0 -49
  245. package/formatters/registry.d.ts.map +0 -1
  246. package/formatters/registry.js +0 -136
  247. package/formatters/registry.js.map +0 -1
  248. package/formatters/text.d.ts +0 -33
  249. package/formatters/text.d.ts.map +0 -1
  250. package/formatters/text.js +0 -80
  251. package/formatters/text.js.map +0 -1
  252. package/formatters/types.d.ts +0 -52
  253. package/formatters/types.d.ts.map +0 -1
  254. package/formatters/types.js +0 -14
  255. package/formatters/types.js.map +0 -1
  256. package/formatters/verb.d.ts +0 -30
  257. package/formatters/verb.d.ts.map +0 -1
  258. package/formatters/verb.js +0 -59
  259. package/formatters/verb.js.map +0 -1
@@ -1,136 +0,0 @@
1
- "use strict";
2
- /**
3
- * Formatter Registry
4
- *
5
- * Central registry of all formatters, with support for story extensions.
6
- *
7
- * @see ADR-095 Message Templates with Formatters
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createFormatterRegistry = createFormatterRegistry;
11
- exports.parsePlaceholder = parsePlaceholder;
12
- exports.applyFormatters = applyFormatters;
13
- exports.formatMessage = formatMessage;
14
- const article_js_1 = require("./article.js");
15
- const list_js_1 = require("./list.js");
16
- const text_js_1 = require("./text.js");
17
- const verb_js_1 = require("./verb.js");
18
- /**
19
- * Create the default formatter registry with all built-in formatters
20
- */
21
- function createFormatterRegistry() {
22
- const registry = new Map();
23
- // Article formatters
24
- registry.set('a', article_js_1.aFormatter);
25
- registry.set('an', article_js_1.aFormatter); // Alias
26
- registry.set('the', article_js_1.theFormatter);
27
- registry.set('some', article_js_1.someFormatter);
28
- registry.set('your', article_js_1.yourFormatter);
29
- // List formatters
30
- registry.set('list', list_js_1.listFormatter);
31
- registry.set('the-list', list_js_1.theListFormatter);
32
- registry.set('names', list_js_1.namesFormatter);
33
- registry.set('or-list', list_js_1.orListFormatter);
34
- registry.set('comma-list', list_js_1.commaListFormatter);
35
- registry.set('count', list_js_1.countFormatter);
36
- // Text formatters
37
- registry.set('cap', text_js_1.capFormatter);
38
- registry.set('upper', text_js_1.upperFormatter);
39
- registry.set('lower', text_js_1.lowerFormatter);
40
- registry.set('title', text_js_1.titleFormatter);
41
- // Verb-agreement formatters (keyed to a placeholder's grammatical number)
42
- registry.set('is', verb_js_1.isFormatter);
43
- registry.set('was', verb_js_1.wasFormatter);
44
- registry.set('has', verb_js_1.hasFormatter);
45
- return registry;
46
- }
47
- /**
48
- * Parse a placeholder with formatters
49
- *
50
- * Syntax: {formatter:formatter:...:placeholder}
51
- *
52
- * @returns Object with formatters array and final placeholder name
53
- */
54
- function parsePlaceholder(placeholder) {
55
- const parts = placeholder.split(':');
56
- if (parts.length === 1) {
57
- return { formatters: [], name: parts[0] };
58
- }
59
- // Last part is the placeholder name, everything before is formatters
60
- const name = parts[parts.length - 1];
61
- const formatters = parts.slice(0, -1);
62
- return { formatters, name };
63
- }
64
- /**
65
- * Apply formatters to a value in sequence
66
- *
67
- * @param value - The value to format
68
- * @param formatters - Array of formatter names to apply in order
69
- * @param registry - The formatter registry
70
- * @param context - Formatting context
71
- * @returns Formatted string
72
- */
73
- function applyFormatters(value, formatters, registry, context) {
74
- // Convert numbers/booleans to strings first
75
- let result = (typeof value === 'number' || typeof value === 'boolean') ? String(value) : value;
76
- for (const formatterName of formatters) {
77
- const formatter = registry.get(formatterName);
78
- if (formatter) {
79
- // Apply formatter - result becomes a string
80
- const formatted = formatter(result, context);
81
- result = formatted;
82
- }
83
- // If formatter not found, skip it (could log warning)
84
- }
85
- // Ensure we return a string
86
- if (Array.isArray(result)) {
87
- return result.map((v) => (typeof v === 'string' ? v : v.name)).join(', ');
88
- }
89
- if (typeof result === 'string') {
90
- return result;
91
- }
92
- return result.name;
93
- }
94
- /**
95
- * Format a message template with placeholders
96
- *
97
- * Supports both:
98
- * - Simple placeholders: {item}
99
- * - Formatted placeholders: {a:item}, {list:items}, {the:cap:item}
100
- * (the placeholder is the last colon segment)
101
- *
102
- * @param template - Message template with {placeholder} syntax
103
- * @param params - Values for placeholders
104
- * @param registry - Formatter registry
105
- * @param context - Formatting context
106
- * @returns Formatted message
107
- */
108
- function formatMessage(template, params, registry, context = {}) {
109
- // Match {anything} placeholders
110
- return template.replace(/\{([^}]+)\}/g, (match, placeholder) => {
111
- const { formatters, name } = parsePlaceholder(placeholder);
112
- // Get the value for this placeholder
113
- const value = params[name];
114
- if (value === undefined) {
115
- // Placeholder not found in params - leave it as is
116
- // (might be a perspective placeholder like {You})
117
- return match;
118
- }
119
- // Apply formatters
120
- if (formatters.length > 0) {
121
- return applyFormatters(value, formatters, registry, context);
122
- }
123
- // No formatters - just convert to string
124
- if (Array.isArray(value)) {
125
- return value.map((v) => (typeof v === 'string' ? v : v.name)).join(', ');
126
- }
127
- if (typeof value === 'string') {
128
- return value;
129
- }
130
- if (typeof value === 'number' || typeof value === 'boolean') {
131
- return String(value);
132
- }
133
- return value.name;
134
- });
135
- }
136
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/registry.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAWH,0DA8BC;AASD,4CAeC;AAWD,0CA4BC;AAgBD,sCAmCC;AAxJD,6CAAsF;AACtF,uCAAiI;AACjI,uCAAyF;AACzF,uCAAoE;AAEpE;;GAEG;AACH,SAAgB,uBAAuB;IACrC,MAAM,QAAQ,GAAsB,IAAI,GAAG,EAAE,CAAC;IAE9C,qBAAqB;IACrB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,uBAAU,CAAC,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,uBAAU,CAAC,CAAC,CAAC,QAAQ;IACxC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,yBAAY,CAAC,CAAC;IAClC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,0BAAa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
@@ -1,33 +0,0 @@
1
- /**
2
- * Text Formatters
3
- *
4
- * Formatters for case transformation and text manipulation.
5
- *
6
- * @see ADR-095 Message Templates with Formatters
7
- */
8
- import type { Formatter } from './types.js';
9
- /**
10
- * "cap" formatter - capitalize first letter
11
- *
12
- * "sword" → "Sword"
13
- */
14
- export declare const capFormatter: Formatter;
15
- /**
16
- * "upper" formatter - all uppercase
17
- *
18
- * "sword" → "SWORD"
19
- */
20
- export declare const upperFormatter: Formatter;
21
- /**
22
- * "lower" formatter - all lowercase
23
- *
24
- * "SWORD" → "sword"
25
- */
26
- export declare const lowerFormatter: Formatter;
27
- /**
28
- * "title" formatter - title case (capitalize each word)
29
- *
30
- * "brass lantern" → "Brass Lantern"
31
- */
32
- export declare const titleFormatter: Formatter;
33
- //# sourceMappingURL=text.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AASxD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,SAU1B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,SAQ5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,SAQ5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,SAa5B,CAAC"}
@@ -1,80 +0,0 @@
1
- "use strict";
2
- /**
3
- * Text Formatters
4
- *
5
- * Formatters for case transformation and text manipulation.
6
- *
7
- * @see ADR-095 Message Templates with Formatters
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.titleFormatter = exports.lowerFormatter = exports.upperFormatter = exports.capFormatter = void 0;
11
- /**
12
- * Extract name from value (string or EntityInfo)
13
- */
14
- function getName(value) {
15
- return typeof value === 'string' ? value : value.name;
16
- }
17
- /**
18
- * "cap" formatter - capitalize first letter
19
- *
20
- * "sword" → "Sword"
21
- */
22
- const capFormatter = (value, _context) => {
23
- // Handle arrays
24
- if (Array.isArray(value)) {
25
- return value.map((v) => (0, exports.capFormatter)(v, _context)).join(', ');
26
- }
27
- const text = getName(value);
28
- if (!text)
29
- return '';
30
- return text.charAt(0).toUpperCase() + text.slice(1);
31
- };
32
- exports.capFormatter = capFormatter;
33
- /**
34
- * "upper" formatter - all uppercase
35
- *
36
- * "sword" → "SWORD"
37
- */
38
- const upperFormatter = (value, _context) => {
39
- // Handle arrays
40
- if (Array.isArray(value)) {
41
- return value.map((v) => (0, exports.upperFormatter)(v, _context)).join(', ');
42
- }
43
- const text = getName(value);
44
- return text.toUpperCase();
45
- };
46
- exports.upperFormatter = upperFormatter;
47
- /**
48
- * "lower" formatter - all lowercase
49
- *
50
- * "SWORD" → "sword"
51
- */
52
- const lowerFormatter = (value, _context) => {
53
- // Handle arrays
54
- if (Array.isArray(value)) {
55
- return value.map((v) => (0, exports.lowerFormatter)(v, _context)).join(', ');
56
- }
57
- const text = getName(value);
58
- return text.toLowerCase();
59
- };
60
- exports.lowerFormatter = lowerFormatter;
61
- /**
62
- * "title" formatter - title case (capitalize each word)
63
- *
64
- * "brass lantern" → "Brass Lantern"
65
- */
66
- const titleFormatter = (value, _context) => {
67
- // Handle arrays
68
- if (Array.isArray(value)) {
69
- return value.map((v) => (0, exports.titleFormatter)(v, _context)).join(', ');
70
- }
71
- const text = getName(value);
72
- if (!text)
73
- return '';
74
- return text
75
- .split(' ')
76
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
77
- .join(' ');
78
- };
79
- exports.titleFormatter = titleFormatter;
80
- //# sourceMappingURL=text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/text.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH;;GAEG;AACH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AAQ,EAAE,EAAE;IAC3D,gBAAgB;IAChB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEF;;;;GAIG;AACI,MAAM,cAAc,GAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC3D,gBAAgB;IAChB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,sBAAc,EAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACzE,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AAbW,QAAA,cAAc,kBAazB"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Formatter Types
3
- *
4
- * Formatters transform placeholder values in message templates.
5
- *
6
- * Syntax: {formatter:formatter:...:placeholder} (the placeholder is the last segment)
7
- * Example: {a:item} → "a sword"
8
- * Example: {list:items} → "a sword, a key, and a coin"
9
- *
10
- * @see ADR-095 Message Templates with Formatters
11
- */
12
- /**
13
- * Context passed to formatters
14
- */
15
- export interface FormatterContext {
16
- /** Get entity by ID for nounType/article lookup */
17
- getEntity?: (id: string) => EntityInfo | undefined;
18
- /** Render-time settings the language layer reads (ADR-190). */
19
- settings?: {
20
- /** Serial (Oxford) comma in lists. Default true when absent. */
21
- serialComma?: boolean;
22
- };
23
- }
24
- /**
25
- * Minimal entity info for formatting
26
- */
27
- export interface EntityInfo {
28
- name: string;
29
- nounType?: 'common' | 'proper' | 'mass' | 'unique' | 'plural';
30
- properName?: boolean;
31
- article?: string;
32
- grammaticalNumber?: 'singular' | 'plural';
33
- /**
34
- * Author-supplied plural form for irregular nouns (ADR-190). Populated from
35
- * `IdentityTrait.plural` by `entityInfoFrom`. The `list`/`count` formatters use
36
- * it when present, else fall back to the `pluralize()` heuristic.
37
- */
38
- plural?: string;
39
- }
40
- /**
41
- * Formatter function signature
42
- *
43
- * @param value - The value to format (string, array, or EntityInfo)
44
- * @param context - Formatting context with entity lookup
45
- * @returns Formatted string
46
- */
47
- export type Formatter = (value: string | string[] | EntityInfo | EntityInfo[], context: FormatterContext) => string;
48
- /**
49
- * Formatter registry - maps formatter names to functions
50
- */
51
- export type FormatterRegistry = Map<string, Formatter>;
52
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IACnD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE;QACT,gEAAgE;QAChE,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,GAAG,UAAU,EAAE,EACpD,OAAO,EAAE,gBAAgB,KACtB,MAAM,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- /**
3
- * Formatter Types
4
- *
5
- * Formatters transform placeholder values in message templates.
6
- *
7
- * Syntax: {formatter:formatter:...:placeholder} (the placeholder is the last segment)
8
- * Example: {a:item} → "a sword"
9
- * Example: {list:items} → "a sword, a key, and a coin"
10
- *
11
- * @see ADR-095 Message Templates with Formatters
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Verb-Agreement Formatters
3
- *
4
- * Formatters that emit a verb form agreeing in number with the entity they
5
- * are keyed to, so templates need not hardcode a singular verb. The verb is
6
- * chosen from the entity's grammatical number, mirroring how the article
7
- * formatters choose articles from `nounType`.
8
- *
9
- * Syntax keys the formatter to a placeholder, e.g. `{is:item}` resolves the
10
- * `item` value and emits the agreeing copula:
11
- *
12
- * "{the:cap:item} {is:item} fixed in place."
13
- * → "The white house is fixed in place." (singular)
14
- * → "The pygmy goats are fixed in place." (plural)
15
- *
16
- * An entity is treated as plural when its `nounType` is `'plural'` or its
17
- * `grammaticalNumber` is `'plural'`. A bare string (no EntityInfo metadata)
18
- * or a missing value falls back to the singular form.
19
- *
20
- * @see ADR-095 Message Templates with Formatters
21
- * @see ADR-089 Grammatical Number
22
- */
23
- import type { Formatter } from './types.js';
24
- /** "is" formatter — emits "is" (singular) or "are" (plural). */
25
- export declare const isFormatter: Formatter;
26
- /** "was" formatter — emits "was" (singular) or "were" (plural). */
27
- export declare const wasFormatter: Formatter;
28
- /** "has" formatter — emits "has" (singular) or "have" (plural). */
29
- export declare const hasFormatter: Formatter;
30
- //# sourceMappingURL=verb.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verb.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/verb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AA+BxD,gEAAgE;AAChE,eAAO,MAAM,WAAW,EAAE,SAA+C,CAAC;AAE1E,mEAAmE;AACnE,eAAO,MAAM,YAAY,EAAE,SAAiD,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,YAAY,EAAE,SAAiD,CAAC"}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- /**
3
- * Verb-Agreement Formatters
4
- *
5
- * Formatters that emit a verb form agreeing in number with the entity they
6
- * are keyed to, so templates need not hardcode a singular verb. The verb is
7
- * chosen from the entity's grammatical number, mirroring how the article
8
- * formatters choose articles from `nounType`.
9
- *
10
- * Syntax keys the formatter to a placeholder, e.g. `{is:item}` resolves the
11
- * `item` value and emits the agreeing copula:
12
- *
13
- * "{the:cap:item} {is:item} fixed in place."
14
- * → "The white house is fixed in place." (singular)
15
- * → "The pygmy goats are fixed in place." (plural)
16
- *
17
- * An entity is treated as plural when its `nounType` is `'plural'` or its
18
- * `grammaticalNumber` is `'plural'`. A bare string (no EntityInfo metadata)
19
- * or a missing value falls back to the singular form.
20
- *
21
- * @see ADR-095 Message Templates with Formatters
22
- * @see ADR-089 Grammatical Number
23
- */
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.hasFormatter = exports.wasFormatter = exports.isFormatter = void 0;
26
- /**
27
- * Decide whether a formatter value should take a plural verb.
28
- *
29
- * @param value - The placeholder value (EntityInfo, string, or array thereof).
30
- * @returns true when the value is grammatically plural.
31
- */
32
- function isPlural(value) {
33
- // An array of values reads as plural unless it holds exactly one item.
34
- if (Array.isArray(value)) {
35
- return value.length !== 1;
36
- }
37
- if (typeof value === 'string') {
38
- return false; // No metadata on a bare string — default to singular.
39
- }
40
- return value.nounType === 'plural' || value.grammaticalNumber === 'plural';
41
- }
42
- /**
43
- * Build a copula/auxiliary formatter that emits `singular` or `plural`
44
- * depending on the value's grammatical number.
45
- *
46
- * @param singular - Verb form for singular subjects (e.g. "is").
47
- * @param plural - Verb form for plural subjects (e.g. "are").
48
- * @returns A Formatter that returns the agreeing form.
49
- */
50
- function makeAgreementFormatter(singular, plural) {
51
- return (value, _context) => (isPlural(value) ? plural : singular);
52
- }
53
- /** "is" formatter — emits "is" (singular) or "are" (plural). */
54
- exports.isFormatter = makeAgreementFormatter('is', 'are');
55
- /** "was" formatter — emits "was" (singular) or "were" (plural). */
56
- exports.wasFormatter = makeAgreementFormatter('was', 'were');
57
- /** "has" formatter — emits "has" (singular) or "have" (plural). */
58
- exports.hasFormatter = makeAgreementFormatter('has', 'have');
59
- //# sourceMappingURL=verb.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verb.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/formatters/verb.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAIH;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAoD;IACpE,uEAAuE;IACvE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,sDAAsD;IACtE,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,iBAAiB,KAAK,QAAQ,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAAC,QAAgB,EAAE,MAAc;IAC9D,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACpE,CAAC;AAED,gEAAgE;AACnD,QAAA,WAAW,GAAc,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAE1E,mEAAmE;AACtD,QAAA,YAAY,GAAc,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE7E,mEAAmE;AACtD,QAAA,YAAY,GAAc,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC"}