effect 4.0.2 → 4.0.3

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 (243) hide show
  1. package/dist/Context.js +3 -3
  2. package/dist/Context.js.map +1 -1
  3. package/dist/Crypto.d.ts +33 -5
  4. package/dist/Crypto.d.ts.map +1 -1
  5. package/dist/Crypto.js +8 -2
  6. package/dist/Crypto.js.map +1 -1
  7. package/dist/DateTime.d.ts +9 -6
  8. package/dist/DateTime.d.ts.map +1 -1
  9. package/dist/DateTime.js +9 -6
  10. package/dist/DateTime.js.map +1 -1
  11. package/dist/Duration.d.ts +6 -6
  12. package/dist/Duration.d.ts.map +1 -1
  13. package/dist/Duration.js +27 -8
  14. package/dist/Duration.js.map +1 -1
  15. package/dist/FileSystem.d.ts +44 -2
  16. package/dist/FileSystem.d.ts.map +1 -1
  17. package/dist/FileSystem.js.map +1 -1
  18. package/dist/Schema.d.ts +473 -1
  19. package/dist/Schema.d.ts.map +1 -1
  20. package/dist/Schema.js +355 -4
  21. package/dist/Schema.js.map +1 -1
  22. package/dist/Stdio.d.ts +7 -1
  23. package/dist/Stdio.d.ts.map +1 -1
  24. package/dist/Stdio.js +1 -0
  25. package/dist/Stdio.js.map +1 -1
  26. package/dist/Stream.d.ts +11 -11
  27. package/dist/Stream.js +5 -5
  28. package/dist/ai/McpServer.d.ts +6 -0
  29. package/dist/ai/McpServer.d.ts.map +1 -1
  30. package/dist/ai/McpServer.js +65 -23
  31. package/dist/ai/McpServer.js.map +1 -1
  32. package/dist/ai/internal/mcpProtocol/v2026_07_28.js +5 -0
  33. package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
  34. package/dist/ai/internal/mcpProtocol.js.map +1 -1
  35. package/dist/ai/internal/mcpRuntime.js +1 -0
  36. package/dist/ai/internal/mcpRuntime.js.map +1 -1
  37. package/dist/cli/CliOutput.d.ts +27 -0
  38. package/dist/cli/CliOutput.d.ts.map +1 -1
  39. package/dist/cli/CliOutput.js +33 -10
  40. package/dist/cli/CliOutput.js.map +1 -1
  41. package/dist/cli/Command.d.ts.map +1 -1
  42. package/dist/cli/Command.js +6 -3
  43. package/dist/cli/Command.js.map +1 -1
  44. package/dist/cli/Completions.d.ts +3 -3
  45. package/dist/cli/Completions.d.ts.map +1 -1
  46. package/dist/cli/Completions.js +8 -5
  47. package/dist/cli/Completions.js.map +1 -1
  48. package/dist/cli/GlobalFlag.d.ts +5 -4
  49. package/dist/cli/GlobalFlag.d.ts.map +1 -1
  50. package/dist/cli/GlobalFlag.js +3 -3
  51. package/dist/cli/GlobalFlag.js.map +1 -1
  52. package/dist/cli/Prompt.d.ts +17 -1
  53. package/dist/cli/Prompt.d.ts.map +1 -1
  54. package/dist/cli/Prompt.js +119 -114
  55. package/dist/cli/Prompt.js.map +1 -1
  56. package/dist/cli/internal/ansi.d.ts +0 -1
  57. package/dist/cli/internal/ansi.d.ts.map +1 -1
  58. package/dist/cli/internal/ansi.js +20 -3
  59. package/dist/cli/internal/ansi.js.map +1 -1
  60. package/dist/cli/internal/completions/powershell.d.ts +2 -0
  61. package/dist/cli/internal/completions/powershell.d.ts.map +1 -0
  62. package/dist/cli/internal/completions/powershell.js +273 -0
  63. package/dist/cli/internal/completions/powershell.js.map +1 -0
  64. package/dist/cli/internal/completions/zsh.js +3 -2
  65. package/dist/cli/internal/completions/zsh.js.map +1 -1
  66. package/dist/cli/internal/wizard.d.ts +3 -3
  67. package/dist/cli/internal/wizard.d.ts.map +1 -1
  68. package/dist/cli/internal/wizard.js +21 -18
  69. package/dist/cli/internal/wizard.js.map +1 -1
  70. package/dist/cluster/ClusterSchema.d.ts +28 -0
  71. package/dist/cluster/ClusterSchema.d.ts.map +1 -1
  72. package/dist/cluster/ClusterSchema.js +30 -0
  73. package/dist/cluster/ClusterSchema.js.map +1 -1
  74. package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  75. package/dist/cluster/ClusterWorkflowEngine.js +10 -18
  76. package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
  77. package/dist/cluster/MessageStorage.d.ts +18 -3
  78. package/dist/cluster/MessageStorage.d.ts.map +1 -1
  79. package/dist/cluster/MessageStorage.js +31 -11
  80. package/dist/cluster/MessageStorage.js.map +1 -1
  81. package/dist/cluster/Runners.d.ts.map +1 -1
  82. package/dist/cluster/Runners.js +8 -2
  83. package/dist/cluster/Runners.js.map +1 -1
  84. package/dist/cluster/Sharding.d.ts.map +1 -1
  85. package/dist/cluster/Sharding.js +181 -62
  86. package/dist/cluster/Sharding.js.map +1 -1
  87. package/dist/cluster/SqlMessageStorage.d.ts +59 -19
  88. package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
  89. package/dist/cluster/SqlMessageStorage.js +84 -55
  90. package/dist/cluster/SqlMessageStorage.js.map +1 -1
  91. package/dist/cluster/SqlRunnerStorage.d.ts +68 -19
  92. package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
  93. package/dist/cluster/SqlRunnerStorage.js +191 -113
  94. package/dist/cluster/SqlRunnerStorage.js.map +1 -1
  95. package/dist/cluster/internal/entityManager.js +104 -37
  96. package/dist/cluster/internal/entityManager.js.map +1 -1
  97. package/dist/http/FindMyWay/internal/router.js +3 -6
  98. package/dist/http/FindMyWay/internal/router.js.map +1 -1
  99. package/dist/http/HttpClient.d.ts +6 -0
  100. package/dist/http/HttpClient.d.ts.map +1 -1
  101. package/dist/http/HttpClient.js +39 -2
  102. package/dist/http/HttpClient.js.map +1 -1
  103. package/dist/http/HttpTraceContext.d.ts.map +1 -1
  104. package/dist/http/HttpTraceContext.js +4 -2
  105. package/dist/http/HttpTraceContext.js.map +1 -1
  106. package/dist/internal/effect.js +12 -7
  107. package/dist/internal/effect.js.map +1 -1
  108. package/dist/internal/version.js +1 -1
  109. package/dist/net/AddressResolver.d.ts +145 -0
  110. package/dist/net/AddressResolver.d.ts.map +1 -0
  111. package/dist/net/AddressResolver.js +114 -0
  112. package/dist/net/AddressResolver.js.map +1 -0
  113. package/dist/net/Dns.d.ts +596 -0
  114. package/dist/net/Dns.d.ts.map +1 -0
  115. package/dist/net/Dns.js +549 -0
  116. package/dist/net/Dns.js.map +1 -0
  117. package/dist/net/Host.d.ts +320 -0
  118. package/dist/net/Host.d.ts.map +1 -0
  119. package/dist/net/Host.js +342 -0
  120. package/dist/net/Host.js.map +1 -0
  121. package/dist/net/IpInterface.d.ts +76 -3
  122. package/dist/net/IpInterface.d.ts.map +1 -1
  123. package/dist/net/IpInterface.js +53 -4
  124. package/dist/net/IpInterface.js.map +1 -1
  125. package/dist/net/IpNetwork.d.ts +82 -8
  126. package/dist/net/IpNetwork.d.ts.map +1 -1
  127. package/dist/net/IpNetwork.js +60 -4
  128. package/dist/net/IpNetwork.js.map +1 -1
  129. package/dist/net/NetAddress.d.ts +388 -35
  130. package/dist/net/NetAddress.d.ts.map +1 -1
  131. package/dist/net/NetAddress.js +350 -34
  132. package/dist/net/NetAddress.js.map +1 -1
  133. package/dist/net/index.d.ts +15 -0
  134. package/dist/net/index.d.ts.map +1 -1
  135. package/dist/net/index.js +15 -0
  136. package/dist/net/index.js.map +1 -1
  137. package/dist/observability/OtlpMetrics.d.ts.map +1 -1
  138. package/dist/observability/OtlpMetrics.js +15 -21
  139. package/dist/observability/OtlpMetrics.js.map +1 -1
  140. package/dist/observability/PrometheusMetrics.js +1 -0
  141. package/dist/observability/PrometheusMetrics.js.map +1 -1
  142. package/dist/persistence/PersistedQueue.d.ts +32 -3
  143. package/dist/persistence/PersistedQueue.d.ts.map +1 -1
  144. package/dist/persistence/PersistedQueue.js +75 -16
  145. package/dist/persistence/PersistedQueue.js.map +1 -1
  146. package/dist/rpc/RpcClient.d.ts +22 -6
  147. package/dist/rpc/RpcClient.d.ts.map +1 -1
  148. package/dist/rpc/RpcClient.js +12 -5
  149. package/dist/rpc/RpcClient.js.map +1 -1
  150. package/dist/rpc/RpcServer.d.ts +6 -0
  151. package/dist/rpc/RpcServer.d.ts.map +1 -1
  152. package/dist/rpc/RpcServer.js +42 -20
  153. package/dist/rpc/RpcServer.js.map +1 -1
  154. package/dist/socket/DatagramSocket.d.ts +456 -0
  155. package/dist/socket/DatagramSocket.d.ts.map +1 -0
  156. package/dist/socket/DatagramSocket.js +535 -0
  157. package/dist/socket/DatagramSocket.js.map +1 -0
  158. package/dist/socket/Socket.d.ts +14 -1
  159. package/dist/socket/Socket.d.ts.map +1 -1
  160. package/dist/socket/Socket.js +9 -1
  161. package/dist/socket/Socket.js.map +1 -1
  162. package/dist/socket/index.d.ts +5 -0
  163. package/dist/socket/index.d.ts.map +1 -1
  164. package/dist/socket/index.js +5 -0
  165. package/dist/socket/index.js.map +1 -1
  166. package/dist/sql/Migrator.d.ts.map +1 -1
  167. package/dist/sql/Migrator.js +7 -2
  168. package/dist/sql/Migrator.js.map +1 -1
  169. package/dist/sql/SqlClient.d.ts +7 -1
  170. package/dist/sql/SqlClient.d.ts.map +1 -1
  171. package/dist/sql/SqlClient.js +31 -6
  172. package/dist/sql/SqlClient.js.map +1 -1
  173. package/dist/testing/TestCrypto.d.ts +73 -0
  174. package/dist/testing/TestCrypto.d.ts.map +1 -0
  175. package/dist/testing/TestCrypto.js +87 -0
  176. package/dist/testing/TestCrypto.js.map +1 -0
  177. package/dist/testing/index.d.ts +5 -0
  178. package/dist/testing/index.d.ts.map +1 -1
  179. package/dist/testing/index.js +5 -0
  180. package/dist/testing/index.js.map +1 -1
  181. package/dist/workflow/DurableDeferred.d.ts +54 -0
  182. package/dist/workflow/DurableDeferred.d.ts.map +1 -1
  183. package/dist/workflow/DurableDeferred.js +78 -49
  184. package/dist/workflow/DurableDeferred.js.map +1 -1
  185. package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
  186. package/dist/workflow/WorkflowEngine.js +2 -1
  187. package/dist/workflow/WorkflowEngine.js.map +1 -1
  188. package/package.json +1 -1
  189. package/src/Context.ts +3 -3
  190. package/src/Crypto.ts +43 -9
  191. package/src/DateTime.ts +9 -6
  192. package/src/Duration.ts +36 -16
  193. package/src/FileSystem.ts +48 -2
  194. package/src/Schema.ts +669 -5
  195. package/src/Stdio.ts +9 -2
  196. package/src/Stream.ts +11 -11
  197. package/src/ai/McpServer.ts +63 -23
  198. package/src/ai/internal/mcpProtocol/v2026_07_28.ts +5 -0
  199. package/src/ai/internal/mcpProtocol.ts +3 -0
  200. package/src/ai/internal/mcpRuntime.ts +2 -0
  201. package/src/cli/CliOutput.ts +33 -16
  202. package/src/cli/Command.ts +4 -3
  203. package/src/cli/Completions.ts +9 -6
  204. package/src/cli/GlobalFlag.ts +19 -11
  205. package/src/cli/Prompt.ts +159 -149
  206. package/src/cli/internal/ansi.ts +26 -3
  207. package/src/cli/internal/completions/powershell.ts +322 -0
  208. package/src/cli/internal/completions/zsh.ts +4 -2
  209. package/src/cli/internal/wizard.ts +34 -26
  210. package/src/cluster/ClusterSchema.ts +32 -0
  211. package/src/cluster/ClusterWorkflowEngine.ts +13 -24
  212. package/src/cluster/MessageStorage.ts +45 -14
  213. package/src/cluster/Runners.ts +8 -2
  214. package/src/cluster/Sharding.ts +207 -49
  215. package/src/cluster/SqlMessageStorage.ts +118 -84
  216. package/src/cluster/SqlRunnerStorage.ts +224 -128
  217. package/src/cluster/internal/entityManager.ts +151 -55
  218. package/src/http/FindMyWay/internal/router.ts +4 -7
  219. package/src/http/HttpClient.ts +56 -2
  220. package/src/http/HttpTraceContext.ts +8 -2
  221. package/src/internal/effect.ts +15 -13
  222. package/src/internal/version.ts +1 -1
  223. package/src/net/AddressResolver.ts +222 -0
  224. package/src/net/Dns.ts +1035 -0
  225. package/src/net/Host.ts +472 -0
  226. package/src/net/IpInterface.ts +117 -7
  227. package/src/net/IpNetwork.ts +116 -17
  228. package/src/net/NetAddress.ts +611 -76
  229. package/src/net/index.ts +18 -0
  230. package/src/observability/OtlpMetrics.ts +12 -23
  231. package/src/observability/PrometheusMetrics.ts +1 -0
  232. package/src/persistence/PersistedQueue.ts +146 -53
  233. package/src/rpc/RpcClient.ts +41 -19
  234. package/src/rpc/RpcServer.ts +60 -25
  235. package/src/socket/DatagramSocket.ts +919 -0
  236. package/src/socket/Socket.ts +22 -2
  237. package/src/socket/index.ts +6 -0
  238. package/src/sql/Migrator.ts +21 -5
  239. package/src/sql/SqlClient.ts +39 -15
  240. package/src/testing/TestCrypto.ts +94 -0
  241. package/src/testing/index.ts +6 -0
  242. package/src/workflow/DurableDeferred.ts +123 -48
  243. package/src/workflow/WorkflowEngine.ts +2 -1
@@ -66,13 +66,19 @@ const windowsTheme = {
66
66
  /**
67
67
  * Creates a prompt theme using the current platform defaults.
68
68
  *
69
+ * **Details**
70
+ *
71
+ * Unless `colors` is provided, it is detected when the theme is created:
72
+ * colors are enabled when stdout is a TTY and `NO_COLOR` is unset or empty.
73
+ *
69
74
  * @stability unstable
70
75
  * @category constructors
71
76
  * @since 4.0.0
72
77
  */
73
78
  export const makeTheme = options => ({
74
79
  ...(process.platform === "win32" ? windowsTheme : defaultTheme),
75
- ...options
80
+ ...options,
81
+ colors: options?.colors ?? Ansi.detectColors()
76
82
  });
77
83
  /**
78
84
  * Context reference for the theme used by built-in prompts.
@@ -80,7 +86,13 @@ export const makeTheme = options => ({
80
86
  * **Details**
81
87
  *
82
88
  * Provide this reference once to theme every prompt in an application. A
83
- * prompt's `theme` option takes precedence over the context value.
89
+ * prompt's `theme` option takes precedence over the context value. The
90
+ * command wizard also reads `colors` from this reference, so provide a theme
91
+ * with `colors: false` to disable wizard styling.
92
+ *
93
+ * The default value is created with `makeTheme` the first time it is read,
94
+ * so color detection runs once per process. Changes to `NO_COLOR` after the
95
+ * first prompt do not affect the default theme.
84
96
  *
85
97
  * @stability unstable
86
98
  * @category services
@@ -165,9 +177,8 @@ export const all = function () {
165
177
  }
166
178
  return allTupled(arguments[0]);
167
179
  };
168
- const annotateLine = line => Ansi.annotate(line, Ansi.bold);
169
- const annotateErrorLine = (line, color) => Ansi.annotate(line, Ansi.combine(Ansi.italicized, color));
170
- const annotateSymbol = (symbol, ...styles) => symbol.length === 0 ? "" : Ansi.annotate(symbol, ...styles);
180
+ const annotateErrorLine = (theme, line) => Ansi.annotate(theme.colors, line, Ansi.combine(Ansi.italicized, theme.errorColor));
181
+ const annotateSymbol = (theme, symbol, ...styles) => symbol.length === 0 ? "" : Ansi.annotate(theme.colors, symbol, ...styles);
171
182
  const separateSymbol = (symbol, text) => symbol.length === 0 ? text : symbol + " " + text;
172
183
  const renderPagingPrefix = (theme, showArrowUp, showArrowDown) => {
173
184
  const width = Math.max(theme.arrowUp.length, theme.arrowDown.length);
@@ -512,7 +523,7 @@ export const Password = options => basePrompt(options, "password").pipe(map(Reda
512
523
  */
513
524
  export const run = /*#__PURE__*/Effect.fnUntraced(function* (self) {
514
525
  const terminal = yield* Terminal.Terminal;
515
- const input = yield* terminal.readInput;
526
+ const input = yield* Effect.cached(terminal.readInput);
516
527
  return yield* runWithInput(self, terminal, input);
517
528
  }, /*#__PURE__*/Effect.mapError(() => new Terminal.QuitError({})), Effect.scoped);
518
529
  const getSelectInitialIndex = choices => {
@@ -723,7 +734,7 @@ const runWithInput = (prompt, terminal, input) => Effect.suspend(() => {
723
734
  switch (op._tag) {
724
735
  case "Loop":
725
736
  {
726
- return runLoop(op, terminal, input);
737
+ return Effect.flatMap(input, queue => runLoop(op, terminal, queue));
727
738
  }
728
739
  case "OnSuccess":
729
740
  {
@@ -811,7 +822,7 @@ const handleConfirmClear = options => {
811
822
  const columns = yield* terminal.columns;
812
823
  const figures = yield* getTheme(options);
813
824
  const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;
814
- const promptText = renderConfirmOutput(confirmMessage, figures.prefix, figures.pointerSmall, options, {
825
+ const promptText = renderPrompt(confirmMessage, options.message, figures.prefix, figures.pointerSmall, figures, {
815
826
  plain: true
816
827
  });
817
828
  const clearOutput = eraseText(promptText, columns);
@@ -819,25 +830,24 @@ const handleConfirmClear = options => {
819
830
  return clearOutput + resetCurrentLine;
820
831
  });
821
832
  };
822
- const renderConfirmOutput = (confirm, leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, renderOptions);
823
833
  const renderConfirmNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
824
834
  const figures = yield* getTheme(options);
825
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
826
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
835
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
836
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
827
837
  // Marking these explicitly as present with `!` because they always will be
828
838
  // and there is really no value in adding a `DeepRequired` type helper just
829
839
  // for these internal cases
830
840
  const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;
831
- const confirm = Ansi.annotate(confirmMessage, figures.mutedColor);
832
- const promptMsg = renderConfirmOutput(confirm, leadingSymbol, trailingSymbol, options);
841
+ const confirm = Ansi.annotate(figures.colors, confirmMessage, figures.mutedColor);
842
+ const promptMsg = renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, figures);
833
843
  return Ansi.cursorHide + promptMsg;
834
844
  });
835
845
  const renderConfirmSubmission = /*#__PURE__*/Effect.fnUntraced(function* (value, options) {
836
846
  const figures = yield* getTheme(options);
837
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
838
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
847
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
848
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
839
849
  const confirmMessage = value ? options.label.confirm : options.label.deny;
840
- const promptMsg = renderConfirmOutput(confirmMessage, leadingSymbol, trailingSymbol, options);
850
+ const promptMsg = renderPrompt(confirmMessage, options.message, leadingSymbol, trailingSymbol, figures);
841
851
  return promptMsg + "\n";
842
852
  });
843
853
  const handleConfirmRender = options => {
@@ -881,7 +891,7 @@ const handleDateClear = options => {
881
891
  const figures = yield* getTheme(options);
882
892
  const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;
883
893
  const parts = Arr.reduce(state.dateParts, "", (doc, part) => doc + part.toString());
884
- const promptText = renderDateOutput(figures.prefix, figures.pointerSmall, parts, options, {
894
+ const promptText = renderPrompt(parts, options.message, figures.prefix, figures.pointerSmall, figures, {
885
895
  plain: true
886
896
  });
887
897
  const errorText = Option.isSome(state.error) ? Arr.match(state.error.value.split(NEWLINE_REGEXP), {
@@ -896,8 +906,8 @@ const renderDateError = (state, pointer, theme) => {
896
906
  if (Option.isSome(state.error)) {
897
907
  const errorLines = state.error.value.split(NEWLINE_REGEXP);
898
908
  if (Arr.isReadonlyArrayNonEmpty(errorLines)) {
899
- const prefix = annotateSymbol(pointer, theme.errorColor);
900
- const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
909
+ const prefix = annotateSymbol(theme, pointer, theme.errorColor);
910
+ const lines = Arr.map(errorLines, str => annotateErrorLine(theme, str));
901
911
  return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
902
912
  }
903
913
  }
@@ -908,27 +918,26 @@ const renderParts = (state, theme, submitted = false) => {
908
918
  const partDoc = part.toString();
909
919
  if (currentIndex === state.cursor && !submitted) {
910
920
  const annotation = Ansi.combine(Ansi.underlined, theme.primaryColor);
911
- return doc + Ansi.annotate(partDoc, annotation);
921
+ return doc + Ansi.annotate(theme.colors, partDoc, annotation);
912
922
  }
913
923
  return doc + partDoc;
914
924
  });
915
925
  };
916
- const renderDateOutput = (leadingSymbol, trailingSymbol, parts, options, renderOptions) => renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, renderOptions);
917
926
  const renderDateNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
918
927
  const figures = yield* getTheme(options);
919
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
920
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
928
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
929
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
921
930
  const parts = renderParts(state, figures);
922
- const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options);
931
+ const promptMsg = renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, figures);
923
932
  const errorMsg = renderDateError(state, figures.pointerSmall, figures);
924
933
  return Ansi.cursorHide + promptMsg + errorMsg;
925
934
  });
926
935
  const renderDateSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
927
936
  const figures = yield* getTheme(options);
928
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
929
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
937
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
938
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
930
939
  const parts = renderParts(state, figures, true);
931
- const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options);
940
+ const promptMsg = renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, figures);
932
941
  return promptMsg + "\n";
933
942
  });
934
943
  const processUp = state => {
@@ -1407,11 +1416,11 @@ const handleFileClear = options => {
1407
1416
  const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath);
1408
1417
  const resolvedPathText = separateSymbol(figures.pointerSmall, resolvedPath);
1409
1418
  const isConfirming = showConfirmation(state.confirm);
1410
- const promptText = isConfirming ? renderPrompt("(Y/n)", CONFIRM_MESSAGE, figures.prefix, figures.pointerSmall, {
1419
+ const promptText = isConfirming ? renderPrompt("(Y/n)", CONFIRM_MESSAGE, figures.prefix, figures.pointerSmall, figures, {
1411
1420
  plain: true
1412
1421
  }) : renderPrompt(renderFileFilter(state, figures, {
1413
1422
  plain: true
1414
- }), options.message, figures.tick, figures.ellipsis, {
1423
+ }), options.message, figures.tick, figures.ellipsis, figures, {
1415
1424
  plain: true
1416
1425
  });
1417
1426
  const filesText = isConfirming ? "" : renderFiles(state, state.files, figures, options, {
@@ -1423,7 +1432,7 @@ const handleFileClear = options => {
1423
1432
  return clearOutput + resetCurrentLine;
1424
1433
  });
1425
1434
  };
1426
- const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options) => {
1435
+ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, theme, options) => {
1427
1436
  const prefix = leadingSymbol.length === 0 ? "" : leadingSymbol + " ";
1428
1437
  const renderLine = line => {
1429
1438
  let output = prefix + line;
@@ -1437,11 +1446,10 @@ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options)
1437
1446
  }
1438
1447
  return output;
1439
1448
  };
1440
- const annotate = options?.plain === true ? line => line : annotateLine;
1441
1449
  return Arr.match(message.split(NEWLINE_REGEXP), {
1442
1450
  onEmpty: () => renderLine(""),
1443
1451
  onNonEmpty: promptLines => {
1444
- const lines = Arr.map(promptLines, line => annotate(line));
1452
+ const lines = options?.plain === true ? promptLines : Arr.map(promptLines, line => Ansi.annotate(theme.colors, line, Ansi.bold));
1445
1453
  return renderLine(lines.join("\n"));
1446
1454
  }
1447
1455
  });
@@ -1449,7 +1457,7 @@ const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options)
1449
1457
  const renderPrefix = (state, toDisplay, currentIndex, length, figures, renderOptions) => {
1450
1458
  const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length);
1451
1459
  if (state.cursor === currentIndex) {
1452
- return renderOptions?.plain === true ? figures.pointer + prefix : annotateSymbol(figures.pointer, figures.primaryColor) + prefix;
1460
+ return renderOptions?.plain === true ? figures.pointer + prefix : annotateSymbol(figures, figures.pointer, figures.primaryColor) + prefix;
1453
1461
  }
1454
1462
  return prefix + " ".repeat(figures.pointer.length);
1455
1463
  };
@@ -1457,16 +1465,16 @@ const renderFileName = (file, isSelected, theme, renderOptions) => {
1457
1465
  if (renderOptions?.plain === true) {
1458
1466
  return file;
1459
1467
  }
1460
- return isSelected ? Ansi.annotate(file, Ansi.combine(Ansi.underlined, theme.primaryColor)) : file;
1468
+ return isSelected ? Ansi.annotate(theme.colors, file, Ansi.combine(Ansi.underlined, theme.primaryColor)) : file;
1461
1469
  };
1462
1470
  const renderFileFilter = (state, theme, renderOptions) => {
1463
- const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? FILE_FILTER_PLACEHOLDER : Ansi.annotate(FILE_FILTER_PLACEHOLDER, theme.mutedColor) : renderOptions?.plain === true ? state.query : Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, theme.primaryColor));
1471
+ const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? FILE_FILTER_PLACEHOLDER : Ansi.annotate(theme.colors, FILE_FILTER_PLACEHOLDER, theme.mutedColor) : renderOptions?.plain === true ? state.query : Ansi.annotate(theme.colors, state.query, Ansi.combine(Ansi.underlined, theme.primaryColor));
1464
1472
  return `[${FILE_FILTER_LABEL}: ${filterValue}]`;
1465
1473
  };
1466
1474
  const renderFiles = (state, files, figures, options, renderOptions) => {
1467
1475
  const length = files.length;
1468
1476
  if (length === 0) {
1469
- return renderOptions?.plain === true ? FILE_EMPTY_MESSAGE : Ansi.annotate(FILE_EMPTY_MESSAGE, figures.mutedColor);
1477
+ return renderOptions?.plain === true ? FILE_EMPTY_MESSAGE : Ansi.annotate(figures.colors, FILE_EMPTY_MESSAGE, figures.mutedColor);
1470
1478
  }
1471
1479
  const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage);
1472
1480
  const documents = [];
@@ -1484,26 +1492,26 @@ const renderFileNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, opt
1484
1492
  const currentPath = yield* resolveCurrentPath(state.path, options);
1485
1493
  const selectedPath = state.files[state.cursor];
1486
1494
  const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath);
1487
- const resolvedPathMsg = Ansi.annotate(separateSymbol(figures.pointerSmall, resolvedPath), figures.mutedColor);
1495
+ const resolvedPathMsg = Ansi.annotate(figures.colors, separateSymbol(figures.pointerSmall, resolvedPath), figures.mutedColor);
1488
1496
  if (showConfirmation(state.confirm)) {
1489
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
1490
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
1491
- const confirm = Ansi.annotate("(Y/n)", figures.mutedColor);
1492
- const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol);
1497
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
1498
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
1499
+ const confirm = Ansi.annotate(figures.colors, "(Y/n)", figures.mutedColor);
1500
+ const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol, figures);
1493
1501
  return Ansi.cursorHide + promptMsg + "\n" + resolvedPathMsg;
1494
1502
  }
1495
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
1496
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
1497
- const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol);
1503
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
1504
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
1505
+ const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol, figures);
1498
1506
  const files = renderFiles(state, state.files, figures, options);
1499
1507
  return Ansi.cursorHide + promptMsg + "\n" + resolvedPathMsg + "\n" + files;
1500
1508
  });
1501
1509
  const renderFileSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, value, options) {
1502
1510
  const figures = yield* getTheme(options);
1503
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
1504
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
1505
- const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol);
1506
- return promptMsg + " " + Ansi.annotate(value, figures.submittedColor) + "\n";
1511
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
1512
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
1513
+ const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol, figures);
1514
+ return promptMsg + " " + Ansi.annotate(figures.colors, value, figures.submittedColor) + "\n";
1507
1515
  });
1508
1516
  const handleFileRender = options => {
1509
1517
  return (state, action) => {
@@ -1712,8 +1720,8 @@ const renderMultiSelectError = (state, pointer, theme, renderOptions) => {
1712
1720
  if (renderOptions?.plain === true) {
1713
1721
  return separateSymbol(pointer, errorLines.join("\n"));
1714
1722
  }
1715
- const prefix = annotateSymbol(pointer, theme.errorColor);
1716
- const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
1723
+ const prefix = annotateSymbol(theme, pointer, theme.errorColor);
1724
+ const lines = Arr.map(errorLines, str => annotateErrorLine(theme, str));
1717
1725
  return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
1718
1726
  }
1719
1727
  });
@@ -1723,7 +1731,7 @@ const renderMultiSelectError = (state, pointer, theme, renderOptions) => {
1723
1731
  const renderChoiceDescription = (choice, isActive, theme, renderOptions) => {
1724
1732
  if (!choice.disabled && choice.description && isActive) {
1725
1733
  const text = theme.descriptionSeparator + choice.description;
1726
- return renderOptions?.plain === true ? text : Ansi.annotate(text, theme.mutedColor);
1734
+ return renderOptions?.plain === true ? text : Ansi.annotate(theme.colors, text, theme.mutedColor);
1727
1735
  }
1728
1736
  return "";
1729
1737
  };
@@ -1732,7 +1740,7 @@ const renderMultiSelectTitle = (title, isHighlighted, theme, renderOptions) => {
1732
1740
  if (renderOptions?.plain === true || !isHighlighted) {
1733
1741
  return title;
1734
1742
  }
1735
- return Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.primaryColor));
1743
+ return Ansi.annotate(theme.colors, title, Ansi.combine(Ansi.underlined, theme.primaryColor));
1736
1744
  };
1737
1745
  const renderMultiSelectChoices = (state, options, figures, renderOptions) => {
1738
1746
  const choices = options.choices;
@@ -1763,7 +1771,7 @@ const renderMultiSelectChoices = (state, options, figures, renderOptions) => {
1763
1771
  const choiceIndex = index - metaOptions.length;
1764
1772
  const isSelected = state.selectedIndices.has(choiceIndex);
1765
1773
  const checkbox = isSelected ? figures.checkboxOn : figures.checkboxOff;
1766
- const annotatedCheckbox = isHighlighted && renderOptions?.plain !== true ? Ansi.annotate(checkbox, figures.primaryColor) : checkbox;
1774
+ const annotatedCheckbox = isHighlighted && renderOptions?.plain !== true ? Ansi.annotate(figures.colors, checkbox, figures.primaryColor) : checkbox;
1767
1775
  const selectChoice = choice;
1768
1776
  const title = renderChoiceTitle(selectChoice, isHighlighted, figures, renderOptions);
1769
1777
  const description = renderChoiceDescription(selectChoice, isHighlighted, figures, renderOptions);
@@ -1776,9 +1784,9 @@ const renderMultiSelectChoices = (state, options, figures, renderOptions) => {
1776
1784
  const renderMultiSelectNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
1777
1785
  const figures = yield* getTheme(options);
1778
1786
  const choices = renderMultiSelectChoices(state, options, figures);
1779
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
1780
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
1781
- const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
1787
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
1788
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
1789
+ const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options, figures);
1782
1790
  const error = renderMultiSelectError(state, figures.pointer, figures);
1783
1791
  return Ansi.cursorHide + withSelectHeader(promptMsg, choices) + error;
1784
1792
  });
@@ -1786,10 +1794,10 @@ const renderMultiSelectSubmission = /*#__PURE__*/Effect.fnUntraced(function* (st
1786
1794
  const figures = yield* getTheme(options);
1787
1795
  const selectedChoices = Array.from(state.selectedIndices).sort(EffectNumber.Order).map(index => options.choices[index].title);
1788
1796
  const selectedText = selectedChoices.join(", ");
1789
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
1790
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
1791
- const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options) ?? leadingSymbol;
1792
- return promptMsg + " " + Ansi.annotate(selectedText, figures.submittedColor) + "\n";
1797
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
1798
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
1799
+ const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options, figures) ?? leadingSymbol;
1800
+ return promptMsg + " " + Ansi.annotate(figures.colors, selectedText, figures.submittedColor) + "\n";
1793
1801
  });
1794
1802
  const processMultiSelectCursorUp = (state, totalChoices) => {
1795
1803
  const newIndex = state.index === 0 ? totalChoices - 1 : state.index - 1;
@@ -1853,7 +1861,7 @@ const handleMultiSelectClear = options => Effect.fnUntraced(function* (state, _)
1853
1861
  const columns = yield* terminal.columns;
1854
1862
  const figures = yield* getTheme(options);
1855
1863
  const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
1856
- const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, {
1864
+ const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, figures, {
1857
1865
  plain: true
1858
1866
  });
1859
1867
  const choicesText = renderMultiSelectChoices(state, options, figures, {
@@ -1956,7 +1964,7 @@ const renderNumberInput = (state, submitted, theme, renderOptions) => {
1956
1964
  return value;
1957
1965
  }
1958
1966
  const annotation = Option.isSome(state.error) ? theme.errorColor : Ansi.combine(Ansi.underlined, theme.primaryColor);
1959
- return Ansi.annotate(value, annotation);
1967
+ return Ansi.annotate(theme.colors, value, annotation);
1960
1968
  };
1961
1969
  const renderNumberError = (state, pointer, theme, renderOptions) => {
1962
1970
  if (Option.isSome(state.error)) {
@@ -1966,8 +1974,8 @@ const renderNumberError = (state, pointer, theme, renderOptions) => {
1966
1974
  if (renderOptions?.plain === true) {
1967
1975
  return separateSymbol(pointer, errorLines.join("\n"));
1968
1976
  }
1969
- const prefix = annotateSymbol(pointer, theme.errorColor);
1970
- const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
1977
+ const prefix = annotateSymbol(theme, pointer, theme.errorColor);
1978
+ const lines = Arr.map(errorLines, str => annotateErrorLine(theme, str));
1971
1979
  return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
1972
1980
  }
1973
1981
  });
@@ -1976,20 +1984,20 @@ const renderNumberError = (state, pointer, theme, renderOptions) => {
1976
1984
  };
1977
1985
  const renderNumberOutput = (state, leadingSymbol, trailingSymbol, options, theme, renderOptions, submitted = false) => {
1978
1986
  const value = renderNumberInput(state, submitted, theme, renderOptions);
1979
- return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);
1987
+ return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
1980
1988
  };
1981
1989
  const renderNumberNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
1982
1990
  const figures = yield* getTheme(options);
1983
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
1984
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
1991
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
1992
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
1985
1993
  const errorMsg = renderNumberError(state, figures.pointerSmall, figures);
1986
1994
  const promptMsg = renderNumberOutput(state, leadingSymbol, trailingSymbol, options, figures);
1987
1995
  return promptMsg + errorMsg;
1988
1996
  });
1989
1997
  const renderNumberSubmission = /*#__PURE__*/Effect.fnUntraced(function* (nextState, options) {
1990
1998
  const figures = yield* getTheme(options);
1991
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
1992
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
1999
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2000
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
1993
2001
  const promptMsg = renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, figures, undefined, true);
1994
2002
  return promptMsg + "\n";
1995
2003
  });
@@ -2248,15 +2256,15 @@ const updateAutoCompleteState = (state, options, query) => {
2248
2256
  };
2249
2257
  };
2250
2258
  const autoCompleteCursor = state => Option.getOrElse(Arr.findFirstIndex(state.filtered, index => index === state.index), () => 0);
2251
- const renderSelectOutput = (leadingSymbol, trailingSymbol, options, renderOptions) => options.message === undefined ? undefined : renderPrompt("", options.message, leadingSymbol, trailingSymbol, renderOptions);
2259
+ const renderSelectOutput = (leadingSymbol, trailingSymbol, options, theme, renderOptions) => options.message === undefined ? undefined : renderPrompt("", options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
2252
2260
  const withSelectHeader = (header, body) => header === undefined ? body : header + "\n" + body;
2253
2261
  const renderAutoCompleteFilter = (state, options, theme, renderOptions) => {
2254
- const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? options.filterPlaceholder : Ansi.annotate(options.filterPlaceholder, theme.mutedColor) : renderOptions?.plain === true ? state.query : Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, theme.primaryColor));
2262
+ const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? options.filterPlaceholder : Ansi.annotate(theme.colors, options.filterPlaceholder, theme.mutedColor) : renderOptions?.plain === true ? state.query : Ansi.annotate(theme.colors, state.query, Ansi.combine(Ansi.underlined, theme.primaryColor));
2255
2263
  return `[${options.filterLabel}: ${filterValue}]`;
2256
2264
  };
2257
2265
  const renderAutoCompleteOutput = (state, leadingSymbol, trailingSymbol, options, theme, renderOptions) => {
2258
2266
  const filter = renderAutoCompleteFilter(state, options, theme, renderOptions);
2259
- return renderPrompt(filter, options.message, leadingSymbol, trailingSymbol, renderOptions);
2267
+ return renderPrompt(filter, options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
2260
2268
  };
2261
2269
  const renderChoicePrefix = (state, choices, toDisplay, currentIndex, figures, renderOptions) => {
2262
2270
  const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length);
@@ -2265,9 +2273,9 @@ const renderChoicePrefix = (state, choices, toDisplay, currentIndex, figures, re
2265
2273
  }
2266
2274
  if (choices[currentIndex].disabled) {
2267
2275
  const annotation = Ansi.combine(Ansi.bold, figures.mutedColor);
2268
- return state === currentIndex ? annotateSymbol(figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
2276
+ return state === currentIndex ? annotateSymbol(figures, figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
2269
2277
  }
2270
- return state === currentIndex ? annotateSymbol(figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
2278
+ return state === currentIndex ? annotateSymbol(figures, figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
2271
2279
  };
2272
2280
  const renderAutoCompleteChoicePrefix = (state, options, toDisplay, currentIndex, figures, renderOptions) => {
2273
2281
  const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < state.filtered.length);
@@ -2278,9 +2286,9 @@ const renderAutoCompleteChoicePrefix = (state, options, toDisplay, currentIndex,
2278
2286
  const choice = options.choices[choiceIndex];
2279
2287
  if (choice.disabled) {
2280
2288
  const annotation = Ansi.combine(Ansi.bold, figures.mutedColor);
2281
- return state.index === choiceIndex ? annotateSymbol(figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
2289
+ return state.index === choiceIndex ? annotateSymbol(figures, figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
2282
2290
  }
2283
- return state.index === choiceIndex ? annotateSymbol(figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
2291
+ return state.index === choiceIndex ? annotateSymbol(figures, figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
2284
2292
  };
2285
2293
  const renderChoiceTitle = (choice, isSelected, theme, renderOptions) => {
2286
2294
  if (renderOptions?.plain === true) {
@@ -2288,9 +2296,9 @@ const renderChoiceTitle = (choice, isSelected, theme, renderOptions) => {
2288
2296
  }
2289
2297
  const title = choice.title;
2290
2298
  if (isSelected) {
2291
- return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.mutedColor)) : Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.primaryColor));
2299
+ return choice.disabled ? Ansi.annotate(theme.colors, title, Ansi.combine(Ansi.underlined, theme.mutedColor)) : Ansi.annotate(theme.colors, title, Ansi.combine(Ansi.underlined, theme.primaryColor));
2292
2300
  }
2293
- return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.strikethrough, theme.mutedColor)) : title;
2301
+ return choice.disabled ? Ansi.annotate(theme.colors, title, Ansi.combine(Ansi.strikethrough, theme.mutedColor)) : title;
2294
2302
  };
2295
2303
  const renderSelectChoices = (state, options, figures, renderOptions) => {
2296
2304
  const choices = options.choices;
@@ -2308,7 +2316,7 @@ const renderSelectChoices = (state, options, figures, renderOptions) => {
2308
2316
  };
2309
2317
  const renderAutoCompleteChoices = (state, options, figures, renderOptions) => {
2310
2318
  if (state.filtered.length === 0) {
2311
- return renderOptions?.plain === true ? options.emptyMessage : Ansi.annotate(options.emptyMessage, figures.mutedColor);
2319
+ return renderOptions?.plain === true ? options.emptyMessage : Ansi.annotate(figures.colors, options.emptyMessage, figures.mutedColor);
2312
2320
  }
2313
2321
  const cursor = autoCompleteCursor(state);
2314
2322
  const toDisplay = entriesToDisplay(cursor, state.filtered.length, options.maxPerPage);
@@ -2327,34 +2335,34 @@ const renderAutoCompleteChoices = (state, options, figures, renderOptions) => {
2327
2335
  const renderSelectNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2328
2336
  const figures = yield* getTheme(options);
2329
2337
  const choices = renderSelectChoices(state, options, figures);
2330
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
2331
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
2332
- const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
2338
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
2339
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
2340
+ const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options, figures);
2333
2341
  return Ansi.cursorHide + withSelectHeader(promptMsg, choices);
2334
2342
  });
2335
2343
  const renderAutoCompleteNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2336
2344
  const figures = yield* getTheme(options);
2337
2345
  const choices = renderAutoCompleteChoices(state, options, figures);
2338
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
2339
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
2346
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
2347
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
2340
2348
  const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options, figures);
2341
2349
  return Ansi.cursorHide + promptMsg + "\n" + choices;
2342
2350
  });
2343
2351
  const renderSelectSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2344
2352
  const figures = yield* getTheme(options);
2345
2353
  const selected = options.choices[state].title;
2346
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
2347
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
2348
- const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options) ?? leadingSymbol;
2349
- return promptMsg + " " + Ansi.annotate(selected, figures.submittedColor) + "\n";
2354
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2355
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
2356
+ const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options, figures) ?? leadingSymbol;
2357
+ return promptMsg + " " + Ansi.annotate(figures.colors, selected, figures.submittedColor) + "\n";
2350
2358
  });
2351
2359
  const renderAutoCompleteSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2352
2360
  const figures = yield* getTheme(options);
2353
2361
  const selected = options.choices[state.index].title;
2354
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
2355
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
2362
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2363
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
2356
2364
  const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options, figures);
2357
- return promptMsg + " " + Ansi.annotate(selected, figures.submittedColor) + "\n";
2365
+ return promptMsg + " " + Ansi.annotate(figures.colors, selected, figures.submittedColor) + "\n";
2358
2366
  });
2359
2367
  const processSelectCursorUp = (state, choices) => {
2360
2368
  if (state === 0) {
@@ -2456,7 +2464,7 @@ const handleSelectClear = options => Effect.fnUntraced(function* (state, _) {
2456
2464
  const columns = yield* terminal.columns;
2457
2465
  const figures = yield* getTheme(options);
2458
2466
  const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
2459
- const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, {
2467
+ const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, figures, {
2460
2468
  plain: true
2461
2469
  });
2462
2470
  const choicesText = renderSelectChoices(state, options, figures, {
@@ -2621,11 +2629,11 @@ const renderTextInput = (nextState, options, theme, submitted, renderOptions) =>
2621
2629
  }
2622
2630
  case "password":
2623
2631
  {
2624
- return annotateSymbol(theme.passwordMask.repeat(text.length), annotation);
2632
+ return annotateSymbol(theme, theme.passwordMask.repeat(text.length), annotation);
2625
2633
  }
2626
2634
  case "text":
2627
2635
  {
2628
- return Ansi.annotate(text, annotation);
2636
+ return Ansi.annotate(theme.colors, text, annotation);
2629
2637
  }
2630
2638
  }
2631
2639
  };
@@ -2637,8 +2645,8 @@ const renderTextError = (nextState, pointer, theme, renderOptions) => {
2637
2645
  if (renderOptions?.plain === true) {
2638
2646
  return separateSymbol(pointer, errorLines.join("\n"));
2639
2647
  }
2640
- const prefix = annotateSymbol(pointer, theme.errorColor);
2641
- const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
2648
+ const prefix = annotateSymbol(theme, pointer, theme.errorColor);
2649
+ const lines = Arr.map(errorLines, str => annotateErrorLine(theme, str));
2642
2650
  return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
2643
2651
  }
2644
2652
  });
@@ -2647,12 +2655,12 @@ const renderTextError = (nextState, pointer, theme, renderOptions) => {
2647
2655
  };
2648
2656
  const renderTextOutput = (nextState, leadingSymbol, trailingSymbol, options, theme, renderOptions, submitted = false) => {
2649
2657
  const value = renderTextInput(nextState, options, theme, submitted, renderOptions);
2650
- return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);
2658
+ return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, theme, renderOptions);
2651
2659
  };
2652
2660
  const renderTextNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2653
2661
  const figures = yield* getTheme(options);
2654
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
2655
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
2662
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
2663
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
2656
2664
  const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures);
2657
2665
  const errorMsg = renderTextError(state, figures.pointerSmall, figures);
2658
2666
  const cursorWidth = options.type === "password" ? figures.passwordMask.length : 1;
@@ -2661,8 +2669,8 @@ const renderTextNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, opt
2661
2669
  });
2662
2670
  const renderTextSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2663
2671
  const figures = yield* getTheme(options);
2664
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
2665
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
2672
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2673
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
2666
2674
  const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures, undefined, true);
2667
2675
  return promptMsg + "\n";
2668
2676
  });
@@ -2870,36 +2878,33 @@ const handleToggleClear = /*#__PURE__*/Effect.fnUntraced(function* (options) {
2870
2878
  const figures = yield* getTheme(options);
2871
2879
  const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
2872
2880
  const toggleText = options.active + " " + separateSymbol(figures.toggleSeparator, options.inactive);
2873
- const promptText = renderPrompt(toggleText, options.message, figures.prefix, figures.pointerSmall, {
2881
+ const promptText = renderPrompt(toggleText, options.message, figures.prefix, figures.pointerSmall, figures, {
2874
2882
  plain: true
2875
2883
  });
2876
2884
  const clearOutput = eraseText(promptText, columns);
2877
2885
  return clearOutput + clearPrompt;
2878
2886
  });
2879
2887
  const renderToggle = (value, options, theme, submitted = false) => {
2880
- const separator = annotateSymbol(theme.toggleSeparator, theme.mutedColor);
2888
+ const separator = annotateSymbol(theme, theme.toggleSeparator, theme.mutedColor);
2881
2889
  const selectedAnnotation = Ansi.combine(Ansi.underlined, submitted ? theme.submittedColor : theme.primaryColor);
2882
- const inactive = value ? options.inactive : Ansi.annotate(options.inactive, selectedAnnotation);
2883
- const active = value ? Ansi.annotate(options.active, selectedAnnotation) : options.active;
2890
+ const inactive = value ? options.inactive : Ansi.annotate(theme.colors, options.inactive, selectedAnnotation);
2891
+ const active = value ? Ansi.annotate(theme.colors, options.active, selectedAnnotation) : options.active;
2884
2892
  return active + " " + separateSymbol(separator, inactive);
2885
2893
  };
2886
- const renderToggleOutput = (toggle, leadingSymbol, trailingSymbol, options) => {
2887
- return renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol);
2888
- };
2889
2894
  const renderToggleNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
2890
2895
  const figures = yield* getTheme(options);
2891
- const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
2892
- const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
2896
+ const leadingSymbol = annotateSymbol(figures, figures.prefix, figures.primaryColor);
2897
+ const trailingSymbol = annotateSymbol(figures, figures.pointerSmall, figures.mutedColor);
2893
2898
  const toggle = renderToggle(state, options, figures);
2894
- const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options);
2899
+ const promptMsg = renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol, figures);
2895
2900
  return Ansi.cursorHide + promptMsg;
2896
2901
  });
2897
2902
  const renderToggleSubmission = /*#__PURE__*/Effect.fnUntraced(function* (value, options) {
2898
2903
  const figures = yield* getTheme(options);
2899
- const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
2900
- const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
2904
+ const leadingSymbol = annotateSymbol(figures, figures.tick, figures.successColor);
2905
+ const trailingSymbol = annotateSymbol(figures, figures.ellipsis, figures.mutedColor);
2901
2906
  const toggle = renderToggle(value, options, figures, true);
2902
- const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options);
2907
+ const promptMsg = renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol, figures);
2903
2908
  return promptMsg + "\n";
2904
2909
  });
2905
2910
  const activate = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Action.NextFrame({