diff --git a/symbols.js b/symbols.js index ee15945..4f2b442 100644 --- a/symbols.js +++ b/symbols.js @@ -26,6 +26,7 @@ const common = { pilcrow2: '❡', pilcrow: '¶', plusMinus: '±', + question: '?', section: '§', starsOff: '☆', starsOn: '★', @@ -38,7 +39,6 @@ const windows = Object.assign({}, common, { ellipsisLarge: '...', ellipsis: '...', info: 'i', - question: '?', questionSmall: '?', pointer: '>', pointerSmall: '»', @@ -54,7 +54,6 @@ const other = Object.assign({}, common, { ellipsisLarge: '⋯', ellipsis: '…', info: 'ℹ', - question: '?', questionFull: '?', questionSmall: '﹖', pointer: isLinux ? '▸' : '❯', diff --git a/types/index.d.ts b/types/index.d.ts index ca2d24a..933b141 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -4,14 +4,81 @@ // Integrated by: Jordan Mele interface SymbolsType { - check: string; - cross: string; - info: string; - line: string; - pointer: string; - pointerSmall: string; - question: string; - warning: string; + /** + * `undefined` on windows, `✘` on other platforms. + */ + ballotCross?: "✘"; + ballotDisabled: "☒"; + ballotOff: "☐"; + ballotOn: "☑"; + bullet: "•"; + bulletWhite: "◦"; + /** + * `√` on windows, `✔` on other platforms. + */ + check: "√" | "✔"; + /** + * `×` on windows, `✖` on other platforms. + */ + cross: "×" | "✖"; + /** + * `...` on windows, `⋯` on other platforms. + */ + ellipsisLarge: "..." | "⋯"; + /** + * `...` on windows, `…` on other platforms. + */ + ellipsis: "..." | "…"; + fullBlock: "█"; + heart: "❤"; + identicalTo: "≡"; + info: "i" | "ℹ"; + line: "─"; + mark: "※"; + middot: "·"; + minus: "-"; + multiplication: "×"; + obelus: "÷"; + pencilDownRight: "✎"; + pencilRight: "✏"; + pencilUpRight: "✐"; + percent: "%"; + pilcrow2: "❡"; + pilcrow: "¶"; + plusMinus: "±"; + /** + * `>` on windows, `▸` on linux, and `❯` on other platforms. + */ + pointer: ">" | "▸" | "❯"; + /** + * `»` on windows, `‣` on linux, and `›` on other platforms. + */ + pointerSmall: "»" | "‣" | "›"; + question: "?"; + /** + * `undefined` on windows, `?` on other platforms. + */ + questionFull?: "?"; + /** + * `?` on windows, `﹖` on other platforms. + */ + questionSmall: "?" | "﹖"; + /** + * `( )` on windows, `◯` on other platforms. + */ + radioOff: "( )" | "◯"; + /** + * `(*)` on windows, `◉` on other platforms. + */ + radioOn: "(*)" | "◉"; + section: "§"; + starsOff: "☆"; + starsOn: "★"; + upDownArrow: "↕"; + /** + * `‼` on windows, `⚠` on other platforms. + */ + warning: "‼" | "⚠"; } type StyleArrayStructure = [number, number]; diff --git a/types/test.ts b/types/test.ts index 48bb3ea..873f623 100644 --- a/types/test.ts +++ b/types/test.ts @@ -60,3 +60,49 @@ s = colors.unstyle(colors.red("hello")); s = colors.strip(colors.red("hello")); s = colors.ok("deployment succeeded!"); + +// common symbols +s = colors.symbols.ballotDisabled; +s = colors.symbols.ballotOff; +s = colors.symbols.ballotOn; +s = colors.symbols.bullet; +s = colors.symbols.bulletWhite; +s = colors.symbols.fullBlock; +s = colors.symbols.heart; +s = colors.symbols.identicalTo; +s = colors.symbols.line; +s = colors.symbols.mark; +s = colors.symbols.middot; +s = colors.symbols.minus; +s = colors.symbols.multiplication; +s = colors.symbols.obelus; +s = colors.symbols.pencilDownRight; +s = colors.symbols.pencilRight; +s = colors.symbols.pencilUpRight; +s = colors.symbols.percent; +s = colors.symbols.pilcrow2; +s = colors.symbols.pilcrow; +s = colors.symbols.plusMinus; +s = colors.symbols.section; +s = colors.symbols.starsOff; +s = colors.symbols.starsOn; +s = colors.symbols.upDownArrow; + +// conditional symbols (differ across platforms) +s = colors.symbols.check; +s = colors.symbols.cross; +s = colors.symbols.ellipsisLarge; +s = colors.symbols.ellipsis; +s = colors.symbols.info; +s = colors.symbols.question; +s = colors.symbols.questionSmall; +s = colors.symbols.pointer; +s = colors.symbols.pointerSmall; +s = colors.symbols.radioOff; +s = colors.symbols.radioOn; +s = colors.symbols.warning; + +let maybeString: string | undefined; +// unmatched other symbols (may be undefined) +maybeString = colors.symbols.ballotCross; +maybeString = colors.symbols.questionFull;