@sharpee/engine 0.9.111 → 1.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.
Files changed (146) hide show
  1. package/action-context-factory.d.ts +10 -2
  2. package/action-context-factory.d.ts.map +1 -1
  3. package/action-context-factory.js +29 -5
  4. package/action-context-factory.js.map +1 -1
  5. package/command-executor.d.ts +2 -1
  6. package/command-executor.d.ts.map +1 -1
  7. package/command-executor.js +3 -3
  8. package/command-executor.js.map +1 -1
  9. package/game-engine.d.ts +87 -4
  10. package/game-engine.d.ts.map +1 -1
  11. package/game-engine.js +250 -9
  12. package/game-engine.js.map +1 -1
  13. package/index.d.ts +1 -0
  14. package/index.d.ts.map +1 -1
  15. package/index.js +2 -0
  16. package/index.js.map +1 -1
  17. package/package.json +13 -12
  18. package/prose-pipeline/assemble.d.ts +77 -0
  19. package/prose-pipeline/assemble.d.ts.map +1 -0
  20. package/prose-pipeline/assemble.js +96 -0
  21. package/prose-pipeline/assemble.js.map +1 -0
  22. package/prose-pipeline/decorations/index.d.ts +18 -0
  23. package/prose-pipeline/decorations/index.d.ts.map +1 -0
  24. package/prose-pipeline/decorations/index.js +24 -0
  25. package/prose-pipeline/decorations/index.js.map +1 -0
  26. package/prose-pipeline/decorations/parser.d.ts +34 -0
  27. package/prose-pipeline/decorations/parser.d.ts.map +1 -0
  28. package/prose-pipeline/decorations/parser.js +177 -0
  29. package/prose-pipeline/decorations/parser.js.map +1 -0
  30. package/prose-pipeline/decorations/platform-vocabulary.d.ts +27 -0
  31. package/prose-pipeline/decorations/platform-vocabulary.d.ts.map +1 -0
  32. package/prose-pipeline/decorations/platform-vocabulary.js +65 -0
  33. package/prose-pipeline/decorations/platform-vocabulary.js.map +1 -0
  34. package/prose-pipeline/decorations/resolver.d.ts +28 -0
  35. package/prose-pipeline/decorations/resolver.d.ts.map +1 -0
  36. package/prose-pipeline/decorations/resolver.js +39 -0
  37. package/prose-pipeline/decorations/resolver.js.map +1 -0
  38. package/prose-pipeline/decorations/types.d.ts +16 -0
  39. package/prose-pipeline/decorations/types.d.ts.map +1 -0
  40. package/prose-pipeline/decorations/types.js +17 -0
  41. package/prose-pipeline/decorations/types.js.map +1 -0
  42. package/prose-pipeline/handlers/about.d.ts +31 -0
  43. package/prose-pipeline/handlers/about.d.ts.map +1 -0
  44. package/prose-pipeline/handlers/about.js +50 -0
  45. package/prose-pipeline/handlers/about.js.map +1 -0
  46. package/prose-pipeline/handlers/audibility.d.ts +46 -0
  47. package/prose-pipeline/handlers/audibility.d.ts.map +1 -0
  48. package/prose-pipeline/handlers/audibility.js +79 -0
  49. package/prose-pipeline/handlers/audibility.js.map +1 -0
  50. package/prose-pipeline/handlers/banner.d.ts +44 -0
  51. package/prose-pipeline/handlers/banner.d.ts.map +1 -0
  52. package/prose-pipeline/handlers/banner.js +88 -0
  53. package/prose-pipeline/handlers/banner.js.map +1 -0
  54. package/prose-pipeline/handlers/client-query.d.ts +22 -0
  55. package/prose-pipeline/handlers/client-query.d.ts.map +1 -0
  56. package/prose-pipeline/handlers/client-query.js +55 -0
  57. package/prose-pipeline/handlers/client-query.js.map +1 -0
  58. package/prose-pipeline/handlers/command-failed.d.ts +24 -0
  59. package/prose-pipeline/handlers/command-failed.d.ts.map +1 -0
  60. package/prose-pipeline/handlers/command-failed.js +46 -0
  61. package/prose-pipeline/handlers/command-failed.js.map +1 -0
  62. package/prose-pipeline/handlers/domain-message.d.ts +31 -0
  63. package/prose-pipeline/handlers/domain-message.d.ts.map +1 -0
  64. package/prose-pipeline/handlers/domain-message.js +66 -0
  65. package/prose-pipeline/handlers/domain-message.js.map +1 -0
  66. package/prose-pipeline/handlers/game.d.ts +31 -0
  67. package/prose-pipeline/handlers/game.d.ts.map +1 -0
  68. package/prose-pipeline/handlers/game.js +35 -0
  69. package/prose-pipeline/handlers/game.js.map +1 -0
  70. package/prose-pipeline/handlers/generic.d.ts +27 -0
  71. package/prose-pipeline/handlers/generic.d.ts.map +1 -0
  72. package/prose-pipeline/handlers/generic.js +67 -0
  73. package/prose-pipeline/handlers/generic.js.map +1 -0
  74. package/prose-pipeline/handlers/help.d.ts +21 -0
  75. package/prose-pipeline/handlers/help.d.ts.map +1 -0
  76. package/prose-pipeline/handlers/help.js +68 -0
  77. package/prose-pipeline/handlers/help.js.map +1 -0
  78. package/prose-pipeline/handlers/implicit-take.d.ts +20 -0
  79. package/prose-pipeline/handlers/implicit-take.d.ts.map +1 -0
  80. package/prose-pipeline/handlers/implicit-take.js +26 -0
  81. package/prose-pipeline/handlers/implicit-take.js.map +1 -0
  82. package/prose-pipeline/handlers/index.d.ts +24 -0
  83. package/prose-pipeline/handlers/index.d.ts.map +1 -0
  84. package/prose-pipeline/handlers/index.js +40 -0
  85. package/prose-pipeline/handlers/index.js.map +1 -0
  86. package/prose-pipeline/handlers/revealed.d.ts +24 -0
  87. package/prose-pipeline/handlers/revealed.d.ts.map +1 -0
  88. package/prose-pipeline/handlers/revealed.js +54 -0
  89. package/prose-pipeline/handlers/revealed.js.map +1 -0
  90. package/prose-pipeline/handlers/room.d.ts +25 -0
  91. package/prose-pipeline/handlers/room.d.ts.map +1 -0
  92. package/prose-pipeline/handlers/room.js +78 -0
  93. package/prose-pipeline/handlers/room.js.map +1 -0
  94. package/prose-pipeline/handlers/types.d.ts +47 -0
  95. package/prose-pipeline/handlers/types.d.ts.map +1 -0
  96. package/prose-pipeline/handlers/types.js +15 -0
  97. package/prose-pipeline/handlers/types.js.map +1 -0
  98. package/prose-pipeline/index.d.ts +20 -0
  99. package/prose-pipeline/index.d.ts.map +1 -0
  100. package/prose-pipeline/index.js +50 -0
  101. package/prose-pipeline/index.js.map +1 -0
  102. package/prose-pipeline/pipeline.d.ts +58 -0
  103. package/prose-pipeline/pipeline.d.ts.map +1 -0
  104. package/prose-pipeline/pipeline.js +120 -0
  105. package/prose-pipeline/pipeline.js.map +1 -0
  106. package/prose-pipeline/stages/filter.d.ts +26 -0
  107. package/prose-pipeline/stages/filter.d.ts.map +1 -0
  108. package/prose-pipeline/stages/filter.js +38 -0
  109. package/prose-pipeline/stages/filter.js.map +1 -0
  110. package/prose-pipeline/stages/index.d.ts +13 -0
  111. package/prose-pipeline/stages/index.d.ts.map +1 -0
  112. package/prose-pipeline/stages/index.js +19 -0
  113. package/prose-pipeline/stages/index.js.map +1 -0
  114. package/prose-pipeline/stages/sort.d.ts +38 -0
  115. package/prose-pipeline/stages/sort.d.ts.map +1 -0
  116. package/prose-pipeline/stages/sort.js +94 -0
  117. package/prose-pipeline/stages/sort.js.map +1 -0
  118. package/prose-pipeline/types.d.ts +45 -0
  119. package/prose-pipeline/types.d.ts.map +1 -0
  120. package/prose-pipeline/types.js +23 -0
  121. package/prose-pipeline/types.js.map +1 -0
  122. package/save-restore-service.d.ts +17 -23
  123. package/save-restore-service.d.ts.map +1 -1
  124. package/save-restore-service.js +79 -138
  125. package/save-restore-service.js.map +1 -1
  126. package/sound/dispatcher.d.ts +75 -0
  127. package/sound/dispatcher.d.ts.map +1 -0
  128. package/sound/dispatcher.js +122 -0
  129. package/sound/dispatcher.js.map +1 -0
  130. package/sound/index.d.ts +26 -0
  131. package/sound/index.d.ts.map +1 -0
  132. package/sound/index.js +34 -0
  133. package/sound/index.js.map +1 -0
  134. package/sound/propagation.d.ts +69 -0
  135. package/sound/propagation.d.ts.map +1 -0
  136. package/sound/propagation.js +219 -0
  137. package/sound/propagation.js.map +1 -0
  138. package/story.d.ts +28 -1
  139. package/story.d.ts.map +1 -1
  140. package/story.js.map +1 -1
  141. package/test-helpers/mock-prose-pipeline.d.ts +22 -0
  142. package/test-helpers/mock-prose-pipeline.d.ts.map +1 -0
  143. package/test-helpers/mock-prose-pipeline.js +56 -0
  144. package/test-helpers/mock-prose-pipeline.js.map +1 -0
  145. package/types.d.ts +14 -0
  146. package/types.d.ts.map +1 -1
package/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export * from './vocabulary-manager';
20
20
  export * from './save-restore-service';
21
21
  export * from './turn-event-processor';
22
22
  export * from './platform-operations';
23
+ export * from './sound';
23
24
  export { GameEngine } from './game-engine';
24
25
  export { CommandExecutor, createCommandExecutor } from './command-executor';
25
26
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/engine/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC;AAG5B,cAAc,SAAS,CAAC;AAGxB,cAAc,oBAAoB,CAAC;AAGnC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACtB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/engine/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC;AAG5B,cAAc,SAAS,CAAC;AAGxB,cAAc,oBAAoB,CAAC;AAGnC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACtB,MAAM,oBAAoB,CAAC"}
package/index.js CHANGED
@@ -50,6 +50,8 @@ __exportStar(require("./vocabulary-manager"), exports);
50
50
  __exportStar(require("./save-restore-service"), exports);
51
51
  __exportStar(require("./turn-event-processor"), exports);
52
52
  __exportStar(require("./platform-operations"), exports);
53
+ // Spatial sound propagation (ADR-172)
54
+ __exportStar(require("./sound"), exports);
53
55
  // Re-export commonly used items
54
56
  var game_engine_1 = require("./game-engine");
55
57
  Object.defineProperty(exports, "GameEngine", { enumerable: true, get: function () { return game_engine_1.GameEngine; } });
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,QAAQ;AACR,0CAAwB;AAExB,+BAA+B;AAC/B,8CAA4B;AAE5B,kBAAkB;AAClB,0CAAwB;AAExB,oBAAoB;AACpB,qDAAmC;AAEnC,oDAAoD;AACpD,+DAA6C;AAE7C,0CAA0C;AAC1C,qDAAmC;AAEnC,kDAAkD;AAClD,qDAAmC;AAEnC,cAAc;AACd,gDAA8B;AAE9B,0BAA0B;AAC1B,4CAAiF;AAAxE,yGAAA,cAAc,OAAA;AAEvB,6BAA6B;AAC7B,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAE9B,qBAAqB;AACrB,uDAAqC;AACrC,yDAAuC;AACvC,yDAAuC;AACvC,wDAAsC;AAEtC,gCAAgC;AAChC,6CAEuB;AADrB,yGAAA,UAAU,OAAA;AAGZ,uDAG4B;AAF1B,mHAAA,eAAe,OAAA;AACf,yHAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,QAAQ;AACR,0CAAwB;AAExB,+BAA+B;AAC/B,8CAA4B;AAE5B,kBAAkB;AAClB,0CAAwB;AAExB,oBAAoB;AACpB,qDAAmC;AAEnC,oDAAoD;AACpD,+DAA6C;AAE7C,0CAA0C;AAC1C,qDAAmC;AAEnC,kDAAkD;AAClD,qDAAmC;AAEnC,cAAc;AACd,gDAA8B;AAE9B,0BAA0B;AAC1B,4CAAiF;AAAxE,yGAAA,cAAc,OAAA;AAEvB,6BAA6B;AAC7B,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAE9B,qBAAqB;AACrB,uDAAqC;AACrC,yDAAuC;AACvC,yDAAuC;AACvC,wDAAsC;AAEtC,sCAAsC;AACtC,0CAAwB;AAExB,gCAAgC;AAChC,6CAEuB;AADrB,yGAAA,UAAU,OAAA;AAGZ,uDAG4B;AAF1B,mHAAA,eAAe,OAAA;AACf,yHAAA,qBAAqB,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/engine",
3
- "version": "0.9.111",
3
+ "version": "1.0.0",
4
4
  "description": "Runtime engine for Sharpee IF Platform - game loop, command execution, and turn management",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,17 +12,18 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^0.9.111",
16
- "@sharpee/event-processor": "^0.9.111",
17
- "@sharpee/plugins": "^0.9.111",
18
- "@sharpee/if-domain": "^0.9.111",
19
- "@sharpee/if-services": "^0.9.111",
20
- "@sharpee/lang-en-us": "^0.9.111",
21
- "@sharpee/parser-en-us": "^0.9.111",
22
- "@sharpee/stdlib": "^0.9.111",
23
- "@sharpee/text-blocks": "^0.9.111",
24
- "@sharpee/text-service": "^0.9.111",
25
- "@sharpee/world-model": "^0.9.111"
15
+ "@sharpee/channel-service": "^1.0.0",
16
+ "@sharpee/core": "^1.0.0",
17
+ "@sharpee/event-processor": "^1.0.0",
18
+ "@sharpee/plugins": "^1.0.0",
19
+ "@sharpee/if-domain": "^1.0.0",
20
+ "@sharpee/if-services": "^1.0.0",
21
+ "@sharpee/lang-en-us": "^1.0.0",
22
+ "@sharpee/parser-en-us": "^1.0.0",
23
+ "@sharpee/stdlib": "^1.0.0",
24
+ "@sharpee/text-blocks": "^1.0.0",
25
+ "@sharpee/world-model": "^1.0.0",
26
+ "fflate": "^0.8.2"
26
27
  },
27
28
  "keywords": [
28
29
  "interactive-fiction",
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Block assembly stage — wraps a resolved template string into an
3
+ * `ITextBlock`, parsing decorations along the way.
4
+ *
5
+ * Public interface: `createBlock`, `extractValue`. Used internally
6
+ * by handler families and the pipeline orchestration.
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline. Lives
9
+ * at `prose-pipeline/assemble.ts` (not under `stages/`) per ADR-174
10
+ * §Engine-internal prose pipeline layout.
11
+ *
12
+ * @see ADR-174 §Markup syntax (decoration parsing)
13
+ * @see ADR-133 (preserved): blocks have keys and structured content.
14
+ */
15
+ import type { ITextBlock } from "../../text-blocks/index";
16
+ /**
17
+ * Options for `createBlock`.
18
+ */
19
+ export interface CreateBlockOptions {
20
+ /**
21
+ * Mark the block as a visual continuation of its predecessor — the
22
+ * renderer collapses the paragraph margin so the two lines stack
23
+ * flush. Used by handlers that split former multi-line content into
24
+ * multiple single-line blocks. See `ITextBlock.tight` for the
25
+ * invariant that a tight block must not appear first in a packet.
26
+ */
27
+ tight?: boolean;
28
+ /**
29
+ * Optional semantic CSS class the browser renderer applies to the
30
+ * rendered element in addition to `main-entry`. See
31
+ * `ITextBlock.className`.
32
+ */
33
+ className?: string;
34
+ }
35
+ /**
36
+ * Create an `ITextBlock` from a key and a resolved template string.
37
+ *
38
+ * The template is fed through the bracket-decoration parser; templates
39
+ * with no markers produce a single-string `content` array, matching
40
+ * the existing no-op-decoration shape.
41
+ *
42
+ * Pass `{ tight: true }` to mark this block as a continuation of the
43
+ * preceding block (renderer collapses inter-block margin).
44
+ *
45
+ * Callers that may receive text containing `\n` should use
46
+ * `createBlocks` instead, which lifts newlines to block boundaries.
47
+ */
48
+ export declare function createBlock(key: string, text: string, opts?: CreateBlockOptions): ITextBlock;
49
+ /**
50
+ * Create one or more `ITextBlock`s from a key and a (possibly
51
+ * multi-line) resolved template string.
52
+ *
53
+ * Newlines in the text are *lifted* to block boundaries — no block's
54
+ * `content` ever carries `\n` (the precondition for removing
55
+ * `white-space: pre-line` from the prose pane). Splitting policy:
56
+ *
57
+ * - `\n\n+` (one or more blank lines) → next block is a fresh
58
+ * paragraph (no `tight` flag); the renderer applies the prose
59
+ * pane's paragraph margin.
60
+ * - `\n` (single newline) → next block carries `tight: true`; the
61
+ * renderer collapses the inter-block margin so the lines stack
62
+ * flush, matching the legacy `pre-line` line-break behavior.
63
+ *
64
+ * Edge cases: leading/trailing whitespace is trimmed; empty
65
+ * paragraphs (between `\n\n\n` etc.) are dropped; empty input
66
+ * returns a single empty block.
67
+ */
68
+ export declare function createBlocks(key: string, text: string): ITextBlock[];
69
+ /**
70
+ * Extract a string value from a direct primitive or a function wrapper.
71
+ *
72
+ * Returns null for falsy values, function returns, or thrown errors.
73
+ * Used by handlers that pull data out of event payloads with mixed
74
+ * shapes (string, number, () => string, etc.).
75
+ */
76
+ export declare function extractValue(value: unknown): string | null;
77
+ //# sourceMappingURL=assemble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,sBAAsB,CAAC;AAGpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,kBAAkB,GACxB,UAAU,CASZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAcpE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAW1D"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ /**
3
+ * Block assembly stage — wraps a resolved template string into an
4
+ * `ITextBlock`, parsing decorations along the way.
5
+ *
6
+ * Public interface: `createBlock`, `extractValue`. Used internally
7
+ * by handler families and the pipeline orchestration.
8
+ *
9
+ * Owner context: `@sharpee/engine` — internal prose pipeline. Lives
10
+ * at `prose-pipeline/assemble.ts` (not under `stages/`) per ADR-174
11
+ * §Engine-internal prose pipeline layout.
12
+ *
13
+ * @see ADR-174 §Markup syntax (decoration parsing)
14
+ * @see ADR-133 (preserved): blocks have keys and structured content.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createBlock = createBlock;
18
+ exports.createBlocks = createBlocks;
19
+ exports.extractValue = extractValue;
20
+ const parser_1 = require("./decorations/parser");
21
+ /**
22
+ * Create an `ITextBlock` from a key and a resolved template string.
23
+ *
24
+ * The template is fed through the bracket-decoration parser; templates
25
+ * with no markers produce a single-string `content` array, matching
26
+ * the existing no-op-decoration shape.
27
+ *
28
+ * Pass `{ tight: true }` to mark this block as a continuation of the
29
+ * preceding block (renderer collapses inter-block margin).
30
+ *
31
+ * Callers that may receive text containing `\n` should use
32
+ * `createBlocks` instead, which lifts newlines to block boundaries.
33
+ */
34
+ function createBlock(key, text, opts) {
35
+ const content = (0, parser_1.parseDecorations)(text);
36
+ const block = {
37
+ key,
38
+ content: content.length === 0 ? [''] : content,
39
+ ...(opts?.tight ? { tight: true } : {}),
40
+ ...(opts?.className ? { className: opts.className } : {}),
41
+ };
42
+ return block;
43
+ }
44
+ /**
45
+ * Create one or more `ITextBlock`s from a key and a (possibly
46
+ * multi-line) resolved template string.
47
+ *
48
+ * Newlines in the text are *lifted* to block boundaries — no block's
49
+ * `content` ever carries `\n` (the precondition for removing
50
+ * `white-space: pre-line` from the prose pane). Splitting policy:
51
+ *
52
+ * - `\n\n+` (one or more blank lines) → next block is a fresh
53
+ * paragraph (no `tight` flag); the renderer applies the prose
54
+ * pane's paragraph margin.
55
+ * - `\n` (single newline) → next block carries `tight: true`; the
56
+ * renderer collapses the inter-block margin so the lines stack
57
+ * flush, matching the legacy `pre-line` line-break behavior.
58
+ *
59
+ * Edge cases: leading/trailing whitespace is trimmed; empty
60
+ * paragraphs (between `\n\n\n` etc.) are dropped; empty input
61
+ * returns a single empty block.
62
+ */
63
+ function createBlocks(key, text) {
64
+ const trimmed = text.trim();
65
+ if (!trimmed)
66
+ return [createBlock(key, '')];
67
+ const paragraphs = trimmed.split(/\n\n+/).filter((p) => p.length > 0);
68
+ const blocks = [];
69
+ for (const para of paragraphs) {
70
+ const lines = para.split('\n');
71
+ for (let i = 0; i < lines.length; i++) {
72
+ blocks.push(createBlock(key, lines[i], i > 0 ? { tight: true } : undefined));
73
+ }
74
+ }
75
+ return blocks;
76
+ }
77
+ /**
78
+ * Extract a string value from a direct primitive or a function wrapper.
79
+ *
80
+ * Returns null for falsy values, function returns, or thrown errors.
81
+ * Used by handlers that pull data out of event payloads with mixed
82
+ * shapes (string, number, () => string, etc.).
83
+ */
84
+ function extractValue(value) {
85
+ if (typeof value === 'function') {
86
+ try {
87
+ const result = value();
88
+ return result ? String(result) : null;
89
+ }
90
+ catch {
91
+ return null;
92
+ }
93
+ }
94
+ return value ? String(value) : null;
95
+ }
96
+ //# sourceMappingURL=assemble.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/assemble.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAuCH,kCAaC;AAqBD,oCAcC;AASD,oCAWC;AAxGD,iDAAwD;AAuBxD;;;;;;;;;;;;GAYG;AACH,SAAgB,WAAW,CACzB,GAAW,EACX,IAAY,EACZ,IAAyB;IAEzB,MAAM,OAAO,GAAkB,IAAA,yBAAgB,EAAC,IAAI,CAAC,CAAC;IACtD,MAAM,KAAK,GAAe;QACxB,GAAG;QACH,OAAO,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO;QAC9C,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1D,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,IAAY;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO;QAAE,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CACT,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAChE,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACtC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Decorations — internal barrel for the prose pipeline's bracket
3
+ * markup primitives.
4
+ *
5
+ * Public interface: re-exports from `parser`, `resolver`,
6
+ * `platform-vocabulary`, `types`. No external package imports this;
7
+ * the prose pipeline assembles its own consumers under
8
+ * `packages/engine/src/prose-pipeline/`.
9
+ *
10
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
11
+ *
12
+ * @see ADR-174 §Engine-internal prose pipeline
13
+ */
14
+ export { parseDecorations } from './parser';
15
+ export { resolveClassName } from './resolver';
16
+ export { PLATFORM_VOCABULARY, PLATFORM_VOCABULARY_NAMES, type PlatformVocabularyName, } from './platform-vocabulary';
17
+ export type { IDecoration, TextContent } from './types';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Decorations — internal barrel for the prose pipeline's bracket
4
+ * markup primitives.
5
+ *
6
+ * Public interface: re-exports from `parser`, `resolver`,
7
+ * `platform-vocabulary`, `types`. No external package imports this;
8
+ * the prose pipeline assembles its own consumers under
9
+ * `packages/engine/src/prose-pipeline/`.
10
+ *
11
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
12
+ *
13
+ * @see ADR-174 §Engine-internal prose pipeline
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.PLATFORM_VOCABULARY_NAMES = exports.PLATFORM_VOCABULARY = exports.resolveClassName = exports.parseDecorations = void 0;
17
+ var parser_1 = require("./parser");
18
+ Object.defineProperty(exports, "parseDecorations", { enumerable: true, get: function () { return parser_1.parseDecorations; } });
19
+ var resolver_1 = require("./resolver");
20
+ Object.defineProperty(exports, "resolveClassName", { enumerable: true, get: function () { return resolver_1.resolveClassName; } });
21
+ var platform_vocabulary_1 = require("./platform-vocabulary");
22
+ Object.defineProperty(exports, "PLATFORM_VOCABULARY", { enumerable: true, get: function () { return platform_vocabulary_1.PLATFORM_VOCABULARY; } });
23
+ Object.defineProperty(exports, "PLATFORM_VOCABULARY_NAMES", { enumerable: true, get: function () { return platform_vocabulary_1.PLATFORM_VOCABULARY_NAMES; } });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,mCAA4C;AAAnC,0GAAA,gBAAgB,OAAA;AACzB,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,6DAI+B;AAH7B,0HAAA,mBAAmB,OAAA;AACnB,gIAAA,yBAAyB,OAAA"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Bracket parser — markup string → structured `TextContent[]` tree.
3
+ *
4
+ * Public interface: `parseDecorations(template) → TextContent[]`.
5
+ * Pure function; same input always yields same output.
6
+ *
7
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
8
+ *
9
+ * @see ADR-174 §Markup syntax
10
+ * @see ADR-174 §Internal interfaces
11
+ * @see ADR-174 acceptance criteria AC-1..AC-5, AC-10..AC-12
12
+ */
13
+ import type { TextContent } from './types';
14
+ /**
15
+ * Parse a template string into a `TextContent[]` tree.
16
+ *
17
+ * Bracket markup `[name:content]` becomes an `IDecoration` whose
18
+ * `className` is the result of `resolveClassName(name)`. Plain runs
19
+ * stay as strings. Nesting recurses. Escape sequences `\[`, `\]`,
20
+ * `\\` produce literal characters.
21
+ *
22
+ * Forgiving rules (ADR-174 AC-10..AC-12):
23
+ * - An unclosed `[` is treated as a literal character; the tail of
24
+ * the string remains unparsed text.
25
+ * - A bracket without `:` (e.g., `[em world]`) is emitted as literal
26
+ * `[em world]` — no decoration created.
27
+ * - A bracket with empty class name (e.g., `[:world]`) yields the
28
+ * parsed inner content directly, with no decoration wrapper.
29
+ *
30
+ * @param template Raw template string, post message-id resolution.
31
+ * @returns Flat array of strings and decorations.
32
+ */
33
+ export declare function parseDecorations(template: string): TextContent[];
34
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAgDhE"}
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ /**
3
+ * Bracket parser — markup string → structured `TextContent[]` tree.
4
+ *
5
+ * Public interface: `parseDecorations(template) → TextContent[]`.
6
+ * Pure function; same input always yields same output.
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
9
+ *
10
+ * @see ADR-174 §Markup syntax
11
+ * @see ADR-174 §Internal interfaces
12
+ * @see ADR-174 acceptance criteria AC-1..AC-5, AC-10..AC-12
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.parseDecorations = parseDecorations;
16
+ const resolver_1 = require("./resolver");
17
+ /**
18
+ * Parse a template string into a `TextContent[]` tree.
19
+ *
20
+ * Bracket markup `[name:content]` becomes an `IDecoration` whose
21
+ * `className` is the result of `resolveClassName(name)`. Plain runs
22
+ * stay as strings. Nesting recurses. Escape sequences `\[`, `\]`,
23
+ * `\\` produce literal characters.
24
+ *
25
+ * Forgiving rules (ADR-174 AC-10..AC-12):
26
+ * - An unclosed `[` is treated as a literal character; the tail of
27
+ * the string remains unparsed text.
28
+ * - A bracket without `:` (e.g., `[em world]`) is emitted as literal
29
+ * `[em world]` — no decoration created.
30
+ * - A bracket with empty class name (e.g., `[:world]`) yields the
31
+ * parsed inner content directly, with no decoration wrapper.
32
+ *
33
+ * @param template Raw template string, post message-id resolution.
34
+ * @returns Flat array of strings and decorations.
35
+ */
36
+ function parseDecorations(template) {
37
+ if (!template)
38
+ return [];
39
+ const result = [];
40
+ let current = '';
41
+ let i = 0;
42
+ const flush = () => {
43
+ if (current.length > 0) {
44
+ result.push(current);
45
+ current = '';
46
+ }
47
+ };
48
+ while (i < template.length) {
49
+ const char = template[i];
50
+ const escapeChar = consumeEscape(template, i);
51
+ if (escapeChar !== null) {
52
+ current += escapeChar;
53
+ i += 2;
54
+ continue;
55
+ }
56
+ if (char === '[') {
57
+ const bracket = parseBracketAt(template, i);
58
+ if (bracket.kind === 'literal') {
59
+ current += bracket.text;
60
+ i = bracket.nextIndex;
61
+ continue;
62
+ }
63
+ flush();
64
+ if (bracket.kind === 'children') {
65
+ result.push(...bracket.children);
66
+ }
67
+ else {
68
+ result.push(bracket.decoration);
69
+ }
70
+ i = bracket.nextIndex;
71
+ continue;
72
+ }
73
+ current += char;
74
+ i++;
75
+ }
76
+ flush();
77
+ return result;
78
+ }
79
+ /**
80
+ * Inspect `template[i..i+1]` for an escape sequence (`\[`, `\]`,
81
+ * `\\`). Returns the literal character to emit, or null if no escape
82
+ * applies.
83
+ */
84
+ function consumeEscape(template, i) {
85
+ if (template[i] !== '\\' || i + 1 >= template.length)
86
+ return null;
87
+ const next = template[i + 1];
88
+ if (next !== '[' && next !== ']' && next !== '\\')
89
+ return null;
90
+ return next;
91
+ }
92
+ /**
93
+ * Parse the `[...]` segment starting at `openIndex`. Caller has
94
+ * already verified `template[openIndex] === '['`.
95
+ *
96
+ * Outcomes (per ADR-174 AC-10..AC-12):
97
+ * - `literal` — unclosed bracket or bracket without `:` (the whole
98
+ * segment is treated as plain text).
99
+ * - `children` — empty class name (`[:content]`); inner content is
100
+ * parsed and inlined without a wrapping decoration.
101
+ * - `decoration` — well-formed `[name:content]`; produces a
102
+ * structured `IDecoration`.
103
+ */
104
+ function parseBracketAt(template, openIndex) {
105
+ const closeIndex = findMatchingBracket(template, openIndex);
106
+ if (closeIndex === -1) {
107
+ // AC-10: unclosed bracket → emit the `[` literal, advance one char.
108
+ return { kind: 'literal', text: template[openIndex], nextIndex: openIndex + 1 };
109
+ }
110
+ const inner = template.slice(openIndex + 1, closeIndex);
111
+ const colonIndex = indexOfUnescapedColon(inner);
112
+ const nextIndex = closeIndex + 1;
113
+ if (colonIndex === -1) {
114
+ // AC-11: no colon → whole `[...]` segment is literal text.
115
+ return { kind: 'literal', text: template.slice(openIndex, nextIndex), nextIndex };
116
+ }
117
+ const rawName = inner.slice(0, colonIndex);
118
+ const innerContent = inner.slice(colonIndex + 1);
119
+ if (rawName === '') {
120
+ // AC-12: empty class name → emit inner content as plain entries.
121
+ return { kind: 'children', children: parseDecorations(innerContent), nextIndex };
122
+ }
123
+ return {
124
+ kind: 'decoration',
125
+ decoration: { className: (0, resolver_1.resolveClassName)(rawName), content: parseDecorations(innerContent) },
126
+ nextIndex,
127
+ };
128
+ }
129
+ /**
130
+ * Find the matching `]` for the `[` at `openIndex`, respecting
131
+ * nested brackets and `\\[` / `\\]` escapes. Returns -1 if no match
132
+ * exists (string ends mid-bracket).
133
+ */
134
+ function findMatchingBracket(text, openIndex) {
135
+ let depth = 1;
136
+ let i = openIndex + 1;
137
+ while (i < text.length) {
138
+ const char = text[i];
139
+ if (char === '\\' && i + 1 < text.length) {
140
+ i += 2;
141
+ continue;
142
+ }
143
+ if (char === '[') {
144
+ depth++;
145
+ }
146
+ else if (char === ']') {
147
+ depth--;
148
+ if (depth === 0)
149
+ return i;
150
+ }
151
+ i++;
152
+ }
153
+ return -1;
154
+ }
155
+ /**
156
+ * Find the first unescaped `:` in `inner`. Returns -1 if none.
157
+ *
158
+ * Inside the `name:content` payload of a bracket, `\\:` is treated as
159
+ * a literal colon — although there's no current need to escape colons
160
+ * (they're not part of the platform vocabulary), the safer parse rule
161
+ * is to treat backslash as a one-character escape uniformly.
162
+ */
163
+ function indexOfUnescapedColon(inner) {
164
+ let i = 0;
165
+ while (i < inner.length) {
166
+ const char = inner[i];
167
+ if (char === '\\' && i + 1 < inner.length) {
168
+ i += 2;
169
+ continue;
170
+ }
171
+ if (char === ':')
172
+ return i;
173
+ i++;
174
+ }
175
+ return -1;
176
+ }
177
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/parser.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Platform decoration vocabulary — closed enumeration of names the
3
+ * platform recognises and prefixes with `sharpee-` when emitting class
4
+ * names on the wire.
5
+ *
6
+ * Public interface: `PLATFORM_VOCABULARY` (frozen Set), consumed by
7
+ * the resolver in this directory. No external package imports this.
8
+ *
9
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
10
+ *
11
+ * @see ADR-174 §Closed platform vocabulary
12
+ */
13
+ declare const VOCABULARY_NAMES: readonly ["em", "strong", "u", "st", "code", "super", "sub", "item", "npc", "room", "direction", "command", "quote", "color-red", "color-blue", "color-green", "color-yellow", "color-magenta", "color-cyan", "color-white", "color-grey", "color-black", "bgcolor-red", "bgcolor-blue", "bgcolor-green", "bgcolor-yellow", "bgcolor-magenta", "bgcolor-cyan", "bgcolor-white", "bgcolor-grey", "bgcolor-black", "size-small", "size-large", "font-mono"];
14
+ /**
15
+ * Frozen set of every name the platform reserves under the `sharpee-`
16
+ * namespace. Adding a new entry requires both updating this list and
17
+ * shipping a corresponding `.sharpee-{name}` rule in the platform CSS.
18
+ */
19
+ export declare const PLATFORM_VOCABULARY: ReadonlySet<string>;
20
+ /**
21
+ * Type-level export of every recognised name; useful for tests that
22
+ * iterate the closed enumeration.
23
+ */
24
+ export type PlatformVocabularyName = (typeof VOCABULARY_NAMES)[number];
25
+ export declare const PLATFORM_VOCABULARY_NAMES: ReadonlyArray<PlatformVocabularyName>;
26
+ export {};
27
+ //# sourceMappingURL=platform-vocabulary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-vocabulary.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/platform-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,gBAAgB,2bA8CZ,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAEnD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,sBAAsB,CACtC,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /**
3
+ * Platform decoration vocabulary — closed enumeration of names the
4
+ * platform recognises and prefixes with `sharpee-` when emitting class
5
+ * names on the wire.
6
+ *
7
+ * Public interface: `PLATFORM_VOCABULARY` (frozen Set), consumed by
8
+ * the resolver in this directory. No external package imports this.
9
+ *
10
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
11
+ *
12
+ * @see ADR-174 §Closed platform vocabulary
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.PLATFORM_VOCABULARY_NAMES = exports.PLATFORM_VOCABULARY = void 0;
16
+ const VOCABULARY_NAMES = [
17
+ // Switches — apply on/off, no parameter.
18
+ 'em',
19
+ 'strong',
20
+ 'u',
21
+ 'st',
22
+ 'code',
23
+ 'super',
24
+ 'sub',
25
+ // IF-semantic — entity classifiers retained from ADR-091.
26
+ 'item',
27
+ 'npc',
28
+ 'room',
29
+ 'direction',
30
+ 'command',
31
+ 'quote',
32
+ // Class vocabulary — color-* starter palette.
33
+ 'color-red',
34
+ 'color-blue',
35
+ 'color-green',
36
+ 'color-yellow',
37
+ 'color-magenta',
38
+ 'color-cyan',
39
+ 'color-white',
40
+ 'color-grey',
41
+ 'color-black',
42
+ // Class vocabulary — bgcolor-* matching set.
43
+ 'bgcolor-red',
44
+ 'bgcolor-blue',
45
+ 'bgcolor-green',
46
+ 'bgcolor-yellow',
47
+ 'bgcolor-magenta',
48
+ 'bgcolor-cyan',
49
+ 'bgcolor-white',
50
+ 'bgcolor-grey',
51
+ 'bgcolor-black',
52
+ // Class vocabulary — size-*.
53
+ 'size-small',
54
+ 'size-large',
55
+ // Class vocabulary — font-*.
56
+ 'font-mono',
57
+ ];
58
+ /**
59
+ * Frozen set of every name the platform reserves under the `sharpee-`
60
+ * namespace. Adding a new entry requires both updating this list and
61
+ * shipping a corresponding `.sharpee-{name}` rule in the platform CSS.
62
+ */
63
+ exports.PLATFORM_VOCABULARY = Object.freeze(new Set(VOCABULARY_NAMES));
64
+ exports.PLATFORM_VOCABULARY_NAMES = Object.freeze([...VOCABULARY_NAMES]);
65
+ //# sourceMappingURL=platform-vocabulary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-vocabulary.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/platform-vocabulary.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,MAAM,gBAAgB,GAAG;IACvB,yCAAyC;IACzC,IAAI;IACJ,QAAQ;IACR,GAAG;IACH,IAAI;IACJ,MAAM;IACN,OAAO;IACP,KAAK;IAEL,0DAA0D;IAC1D,MAAM;IACN,KAAK;IACL,MAAM;IACN,WAAW;IACX,SAAS;IACT,OAAO;IAEP,8CAA8C;IAC9C,WAAW;IACX,YAAY;IACZ,aAAa;IACb,cAAc;IACd,eAAe;IACf,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,aAAa;IAEb,6CAA6C;IAC7C,aAAa;IACb,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IAEf,6BAA6B;IAC7B,YAAY;IACZ,YAAY;IAEZ,6BAA6B;IAC7B,WAAW;CACH,CAAC;AAEX;;;;GAIG;AACU,QAAA,mBAAmB,GAAwB,MAAM,CAAC,MAAM,CACnE,IAAI,GAAG,CAAS,gBAAgB,CAAC,CAClC,CAAC;AAQW,QAAA,yBAAyB,GACpC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC"}