@mks2508/better-logger 0.14.0-alpha.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/dist/Logger.d.ts +12 -16
  3. package/dist/Logger.d.ts.map +1 -1
  4. package/dist/ScopedLogger.d.ts +1 -9
  5. package/dist/chunks/{Logger-D_p3xnbq.js → Logger-C9zTFYBh.js} +2 -2
  6. package/dist/chunks/Logger-C9zTFYBh.js.map +1 -0
  7. package/dist/chunks/{Logger-Crw1woqR.js → Logger-Th9SfADL.js} +50 -17
  8. package/dist/chunks/Logger-Th9SfADL.js.map +1 -0
  9. package/dist/chunks/ScopedLogger-HgV_J-ug.js +2 -0
  10. package/dist/chunks/ScopedLogger-HgV_J-ug.js.map +1 -0
  11. package/dist/chunks/ScopedLogger-uAAeJkfA.js +361 -0
  12. package/dist/chunks/ScopedLogger-uAAeJkfA.js.map +1 -0
  13. package/dist/chunks/environment-5I5unY89.js +4 -0
  14. package/dist/chunks/environment-5I5unY89.js.map +1 -0
  15. package/dist/chunks/{environment-Bxbnw4pd.js → environment-wXLQvk5g.js} +103 -11
  16. package/dist/chunks/environment-wXLQvk5g.js.map +1 -0
  17. package/dist/chunks/formatting-CiFnwe1I.js +2 -0
  18. package/dist/chunks/formatting-CiFnwe1I.js.map +1 -0
  19. package/dist/chunks/formatting-DIhpRCCk.js +380 -0
  20. package/dist/chunks/formatting-DIhpRCCk.js.map +1 -0
  21. package/dist/cli/CommandProcessor.d.ts +1 -4
  22. package/dist/cli/commands/ConfigCommand.d.ts +2 -5
  23. package/dist/cli/commands/ExportCommand.d.ts +2 -5
  24. package/dist/cli/commands/HistoryCommand.d.ts +2 -5
  25. package/dist/cli/commands/StatusCommand.d.ts +2 -5
  26. package/dist/cli/commands/ThemeCommand.d.ts +2 -5
  27. package/dist/cli/help.d.ts +2 -5
  28. package/dist/cli/index.d.ts +1 -1
  29. package/dist/constants.d.ts +110 -5
  30. package/dist/constants.d.ts.map +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.cjs.map +1 -1
  33. package/dist/core.d.ts +1 -8
  34. package/dist/core.d.ts.map +1 -1
  35. package/dist/core.js +281 -307
  36. package/dist/core.js.map +1 -1
  37. package/dist/exports-module.d.ts +1 -8
  38. package/dist/exports.cjs +1 -1
  39. package/dist/exports.js +2 -2
  40. package/dist/handlers/AnalyticsLogHandler.d.ts +1 -4
  41. package/dist/handlers/ExportLogHandler.d.ts +1 -4
  42. package/dist/handlers/ExportLogHandler.d.ts.map +1 -1
  43. package/dist/handlers/FileLogHandler.d.ts +1 -4
  44. package/dist/handlers/RemoteLogHandler.d.ts +1 -4
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.ts +8 -41
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +246 -159
  50. package/dist/index.js.map +1 -1
  51. package/dist/styling/LogStyleBuilder.d.ts +2 -5
  52. package/dist/styling/SemanticStyles.d.ts +0 -3
  53. package/dist/styling/SmartPresets.d.ts +1 -4
  54. package/dist/styling/banners.d.ts +1 -4
  55. package/dist/styling/themes.d.ts +2 -5
  56. package/dist/styling-module.d.ts +1 -8
  57. package/dist/styling.cjs +1 -1
  58. package/dist/styling.js +3 -3
  59. package/dist/types/core.d.ts +13 -0
  60. package/dist/types/core.d.ts.map +1 -1
  61. package/dist/types/handlers.d.ts +1 -4
  62. package/dist/types/index.d.ts +1 -1
  63. package/dist/types/index.d.ts.map +1 -1
  64. package/dist/utils/ansi-colors.d.ts +156 -0
  65. package/dist/utils/ansi-colors.d.ts.map +1 -0
  66. package/dist/utils/formatting.d.ts +20 -2
  67. package/dist/utils/formatting.d.ts.map +1 -1
  68. package/dist/utils/index.d.ts +1 -0
  69. package/dist/utils/index.d.ts.map +1 -1
  70. package/dist/utils/output.d.ts +1 -4
  71. package/dist/utils/stackTrace.d.ts +1 -4
  72. package/package.json +2 -1
  73. package/src/Logger.ts +102 -64
  74. package/src/constants.ts +131 -1
  75. package/src/core.ts +11 -7
  76. package/src/handlers/ExportLogHandler.ts +2 -1
  77. package/src/index.ts +62 -27
  78. package/src/styling/SemanticStyles.ts +1 -1
  79. package/src/types/core.ts +15 -1
  80. package/src/types/index.ts +1 -0
  81. package/src/utils/ansi-colors.ts +333 -0
  82. package/src/utils/formatting.ts +196 -6
  83. package/src/utils/index.ts +23 -11
  84. package/vite.config.ts +1 -1
  85. package/dist/.tsbuildinfo +0 -1
  86. package/dist/Logger.js +0 -1124
  87. package/dist/ScopedLogger.js +0 -426
  88. package/dist/chunks/Logger-Crw1woqR.js.map +0 -1
  89. package/dist/chunks/Logger-D_p3xnbq.js.map +0 -1
  90. package/dist/chunks/environment-Bxbnw4pd.js.map +0 -1
  91. package/dist/chunks/environment-Dm66zOML.js +0 -4
  92. package/dist/chunks/environment-Dm66zOML.js.map +0 -1
  93. package/dist/chunks/formatting-C0riPC5_.js +0 -95
  94. package/dist/chunks/formatting-C0riPC5_.js.map +0 -1
  95. package/dist/chunks/formatting-DNCAV66-.js +0 -2
  96. package/dist/chunks/formatting-DNCAV66-.js.map +0 -1
  97. package/dist/cli/CommandProcessor.js +0 -184
  98. package/dist/cli/commands/ConfigCommand.js +0 -88
  99. package/dist/cli/commands/ExportCommand.js +0 -243
  100. package/dist/cli/commands/HistoryCommand.js +0 -96
  101. package/dist/cli/commands/StatusCommand.js +0 -93
  102. package/dist/cli/commands/ThemeCommand.js +0 -79
  103. package/dist/cli/help.js +0 -118
  104. package/dist/cli/index.js +0 -46
  105. package/dist/constants.js +0 -159
  106. package/dist/example.js +0 -154
  107. package/dist/exports-module.js +0 -260
  108. package/dist/handlers/AnalyticsLogHandler.js +0 -19
  109. package/dist/handlers/ExportLogHandler.js +0 -516
  110. package/dist/handlers/FileLogHandler.js +0 -156
  111. package/dist/handlers/RemoteLogHandler.js +0 -37
  112. package/dist/handlers/index.js +0 -7
  113. package/dist/main.js +0 -139
  114. package/dist/styling/LogStyleBuilder.js +0 -289
  115. package/dist/styling/SemanticStyles.js +0 -339
  116. package/dist/styling/SmartPresets.js +0 -276
  117. package/dist/styling/StyleBuilder.js +0 -280
  118. package/dist/styling/banners.js +0 -155
  119. package/dist/styling/index.js +0 -9
  120. package/dist/styling/themes.js +0 -231
  121. package/dist/styling-module.js +0 -199
  122. package/dist/types/Logger.d.ts +0 -700
  123. package/dist/types/Logger.d.ts.map +0 -1
  124. package/dist/types/ScopedLogger.d.ts +0 -310
  125. package/dist/types/ScopedLogger.d.ts.map +0 -1
  126. package/dist/types/cli/CommandProcessor.d.ts +0 -100
  127. package/dist/types/cli/CommandProcessor.d.ts.map +0 -1
  128. package/dist/types/cli/commands/ConfigCommand.d.ts +0 -14
  129. package/dist/types/cli/commands/ConfigCommand.d.ts.map +0 -1
  130. package/dist/types/cli/commands/ExportCommand.d.ts +0 -48
  131. package/dist/types/cli/commands/ExportCommand.d.ts.map +0 -1
  132. package/dist/types/cli/commands/HistoryCommand.d.ts +0 -47
  133. package/dist/types/cli/commands/HistoryCommand.d.ts.map +0 -1
  134. package/dist/types/cli/commands/StatusCommand.d.ts +0 -30
  135. package/dist/types/cli/commands/StatusCommand.d.ts.map +0 -1
  136. package/dist/types/cli/commands/ThemeCommand.d.ts +0 -30
  137. package/dist/types/cli/commands/ThemeCommand.d.ts.map +0 -1
  138. package/dist/types/cli/help.d.ts +0 -12
  139. package/dist/types/cli/help.d.ts.map +0 -1
  140. package/dist/types/cli/index.d.ts +0 -15
  141. package/dist/types/cli/index.d.ts.map +0 -1
  142. package/dist/types/constants.d.ts +0 -119
  143. package/dist/types/constants.d.ts.map +0 -1
  144. package/dist/types/core.js +0 -28
  145. package/dist/types/example.d.ts +0 -18
  146. package/dist/types/example.d.ts.map +0 -1
  147. package/dist/types/exports-module.d.ts +0 -196
  148. package/dist/types/exports-module.d.ts.map +0 -1
  149. package/dist/types/handlers/AnalyticsLogHandler.d.ts +0 -8
  150. package/dist/types/handlers/AnalyticsLogHandler.d.ts.map +0 -1
  151. package/dist/types/handlers/ExportLogHandler.d.ts +0 -100
  152. package/dist/types/handlers/ExportLogHandler.d.ts.map +0 -1
  153. package/dist/types/handlers/FileLogHandler.d.ts +0 -33
  154. package/dist/types/handlers/FileLogHandler.d.ts.map +0 -1
  155. package/dist/types/handlers/RemoteLogHandler.d.ts +0 -11
  156. package/dist/types/handlers/RemoteLogHandler.d.ts.map +0 -1
  157. package/dist/types/handlers/index.d.ts +0 -8
  158. package/dist/types/handlers/index.d.ts.map +0 -1
  159. package/dist/types/handlers.js +0 -4
  160. package/dist/types/index.js +0 -4
  161. package/dist/types/main.d.ts +0 -2
  162. package/dist/types/main.d.ts.map +0 -1
  163. package/dist/types/styling/LogStyleBuilder.d.ts +0 -146
  164. package/dist/types/styling/LogStyleBuilder.d.ts.map +0 -1
  165. package/dist/types/styling/SemanticStyles.d.ts +0 -178
  166. package/dist/types/styling/SemanticStyles.d.ts.map +0 -1
  167. package/dist/types/styling/SmartPresets.d.ts +0 -22
  168. package/dist/types/styling/SmartPresets.d.ts.map +0 -1
  169. package/dist/types/styling/StyleBuilder.d.ts +0 -140
  170. package/dist/types/styling/StyleBuilder.d.ts.map +0 -1
  171. package/dist/types/styling/banners.d.ts +0 -42
  172. package/dist/types/styling/banners.d.ts.map +0 -1
  173. package/dist/types/styling/index.d.ts +0 -10
  174. package/dist/types/styling/index.d.ts.map +0 -1
  175. package/dist/types/styling/themes.d.ts +0 -7
  176. package/dist/types/styling/themes.d.ts.map +0 -1
  177. package/dist/types/styling-module.d.ts +0 -178
  178. package/dist/types/styling-module.d.ts.map +0 -1
  179. package/dist/types/types/core.d.ts +0 -221
  180. package/dist/types/types/core.d.ts.map +0 -1
  181. package/dist/types/types/handlers.d.ts +0 -85
  182. package/dist/types/types/handlers.d.ts.map +0 -1
  183. package/dist/types/types/index.d.ts +0 -7
  184. package/dist/types/types/index.d.ts.map +0 -1
  185. package/dist/types/utils/environment.d.ts +0 -47
  186. package/dist/types/utils/environment.d.ts.map +0 -1
  187. package/dist/types/utils/formatting.d.ts +0 -37
  188. package/dist/types/utils/formatting.d.ts.map +0 -1
  189. package/dist/types/utils/index.d.ts +0 -7
  190. package/dist/types/utils/index.d.ts.map +0 -1
  191. package/dist/types/utils/opentui-detection.d.ts +0 -34
  192. package/dist/types/utils/opentui-detection.d.ts.map +0 -1
  193. package/dist/types/utils/output.d.ts +0 -41
  194. package/dist/types/utils/output.d.ts.map +0 -1
  195. package/dist/types/utils/stackTrace.d.ts +0 -6
  196. package/dist/types/utils/stackTrace.d.ts.map +0 -1
  197. package/dist/types/utils/timestamps.d.ts +0 -20
  198. package/dist/types/utils/timestamps.d.ts.map +0 -1
  199. package/dist/utils/environment.js +0 -85
  200. package/dist/utils/formatting.js +0 -117
  201. package/dist/utils/index.js +0 -6
  202. package/dist/utils/opentui-detection.js +0 -116
  203. package/dist/utils/output.js +0 -150
  204. package/dist/utils/stackTrace.js +0 -81
  205. package/dist/utils/timestamps.js +0 -71
@@ -1,37 +0,0 @@
1
- /**
2
- * @fileoverview Remote log handler for Advanced Logger
3
- */
4
- /**
5
- * Remote log handler for sending logs to external services
6
- */
7
- export class RemoteLogHandler {
8
- endpoint;
9
- apiKey;
10
- constructor(endpoint, apiKey) {
11
- this.endpoint = endpoint;
12
- this.apiKey = apiKey;
13
- }
14
- async handle(level, message, args, metadata) {
15
- try {
16
- const payload = {
17
- timestamp: metadata.timestamp,
18
- level,
19
- message,
20
- prefix: metadata.prefix,
21
- location: metadata.stackInfo,
22
- additional: args.slice(1),
23
- };
24
- await fetch(this.endpoint, {
25
- method: 'POST',
26
- headers: {
27
- 'Content-Type': 'application/json',
28
- ...(this.apiKey && { 'Authorization': `Bearer ${this.apiKey}` }),
29
- },
30
- body: JSON.stringify(payload),
31
- });
32
- }
33
- catch (error) {
34
- // Silently fail to avoid infinite logging loops
35
- }
36
- }
37
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * @fileoverview Log handlers exports for Advanced Logger
3
- */
4
- export { FileLogHandler } from './FileLogHandler.js';
5
- export { RemoteLogHandler } from './RemoteLogHandler.js';
6
- export { AnalyticsLogHandler } from './AnalyticsLogHandler.js';
7
- export { ExportLogHandler } from './ExportLogHandler.js';
package/dist/main.js DELETED
@@ -1,139 +0,0 @@
1
- import { debug, info, warn, error, success, critical, table, group, groupEnd, time, timeEnd, trace, scope, cli, setTheme, setBannerType, showBanner, logWithSVG, logAnimated, createStyle, stylePresets } from './index.js';
2
- import { demonstrateBanners, demonstrateThemes, demonstrateSVG, demonstrateAnimations, demonstrateCLI, demonstrateExports, demonstrateAllFeatures as demoAllFeatures } from './example.js';
3
- console.log('%cBetter Logger Demo Ready! 🚀', 'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 10px 20px; border-radius: 8px; font-weight: bold; font-size: 14px;');
4
- console.log('📋 Available test functions: testDebug(), testBanners(), testThemes(), and more!');
5
- console.log('💻 CLI Available: cli("/help") for commands');
6
- function testDebug() {
7
- debug("This is a debug message.", { user: "test", id: 123 });
8
- }
9
- function testInfo() {
10
- info("This is an info message with an object.", { data: "payload" });
11
- }
12
- function testWarn() {
13
- warn("This is a warning message about a deprecated API.");
14
- }
15
- function testError() {
16
- error("This is an error message.", new Error("Failed to fetch resource."));
17
- }
18
- function testSuccess() {
19
- success("Operation completed successfully.");
20
- }
21
- function testCritical() {
22
- critical("This is a CRITICAL message. System integrity compromised!");
23
- }
24
- function testTable() {
25
- table([
26
- { feature: "Debug Log", status: "Implemented", priority: "Low" },
27
- { feature: "Info Log", status: "Implemented", priority: "Medium" },
28
- { feature: "Warning Log", status: "Implemented", priority: "High" },
29
- ]);
30
- }
31
- function testGrouping() {
32
- group("User Authentication Flow", true); // Start collapsed
33
- info("User 'testuser' attempting to log in...");
34
- warn("Password nearing expiration.");
35
- success("Login successful.");
36
- groupEnd();
37
- }
38
- function testTiming() {
39
- time("dataProcessing");
40
- setTimeout(() => {
41
- timeEnd("dataProcessing");
42
- }, 750); // Simulate a 750ms operation
43
- }
44
- function testScopedLogger() {
45
- info("Demonstrating scoped loggers...");
46
- const apiLogger = scope("API");
47
- apiLogger.info("Fetching user data...");
48
- const uiLogger = scope("UI");
49
- uiLogger.debug("Rendering user profile component.");
50
- apiLogger.success("User data fetched successfully.");
51
- apiLogger.error("Failed to update settings.");
52
- }
53
- function testTrace() {
54
- function innerFunction() {
55
- function deepFunction() {
56
- trace("Trace from a deeply nested function.");
57
- }
58
- deepFunction();
59
- }
60
- innerFunction();
61
- }
62
- // Visual feature tests
63
- function testBanners() {
64
- demonstrateBanners();
65
- }
66
- function testThemes() {
67
- demonstrateThemes();
68
- }
69
- function testSVG() {
70
- demonstrateSVG();
71
- }
72
- function testAnimations() {
73
- demonstrateAnimations();
74
- }
75
- function testCLI() {
76
- demonstrateCLI();
77
- }
78
- function testExports() {
79
- demonstrateExports();
80
- }
81
- function testAllFeatures() {
82
- group("🌟 Demonstrating Core Logger Features");
83
- testDebug();
84
- testInfo();
85
- testWarn();
86
- testError();
87
- testSuccess();
88
- testCritical();
89
- testTable();
90
- testGrouping();
91
- testTiming();
92
- testScopedLogger();
93
- testTrace();
94
- groupEnd();
95
- setTimeout(() => {
96
- info('🎨 Running visual features demo...');
97
- demoAllFeatures();
98
- }, 2000);
99
- }
100
- // Expose functions to global scope for onclick attributes in index.html
101
- if (typeof window !== 'undefined') {
102
- // Core logging tests
103
- window.testDebug = testDebug;
104
- window.testInfo = testInfo;
105
- window.testWarn = testWarn;
106
- window.testError = testError;
107
- window.testSuccess = testSuccess;
108
- window.testCritical = testCritical;
109
- window.testTable = testTable;
110
- window.testGrouping = testGrouping;
111
- window.testTiming = testTiming;
112
- window.testScopedLogger = testScopedLogger;
113
- window.testTrace = testTrace;
114
- window.testAllFeatures = testAllFeatures;
115
- // Visual feature tests
116
- window.testBanners = testBanners;
117
- window.testThemes = testThemes;
118
- window.testSVG = testSVG;
119
- window.testAnimations = testAnimations;
120
- window.testCLI = testCLI;
121
- window.testExports = testExports;
122
- // Direct access to library functions
123
- window.cli = cli;
124
- window.setTheme = setTheme;
125
- window.setBannerType = setBannerType;
126
- window.showBanner = showBanner;
127
- window.logWithSVG = logWithSVG;
128
- window.logAnimated = logAnimated;
129
- window.createStyle = createStyle;
130
- window.stylePresets = stylePresets;
131
- // Display welcome info
132
- setTimeout(() => {
133
- console.log('%c💡 Quick Start Guide', stylePresets.info);
134
- console.log('🎨 Visual: testBanners(), testThemes(), testSVG(), testAnimations()');
135
- console.log('📊 Core: testTable(), testGrouping(), testTiming(), testTrace()');
136
- console.log('💻 CLI: cli("/help") - Try commands like "/theme neon", "/banner ascii"');
137
- console.log('🌟 Full Demo: testAllFeatures()');
138
- }, 1000);
139
- }
@@ -1,289 +0,0 @@
1
- /**
2
- * @fileoverview LogStyleBuilder for fluent log styling API
3
- */
4
- import { TimestampStyler, LevelStyler, PrefixStyler, MessageStyler, LocationStyler } from './SemanticStyles.js';
5
- /**
6
- * Fluent API builder for log styling with semantic methods
7
- */
8
- export class LogStyleBuilder {
9
- logStyles = {};
10
- logger;
11
- constructor(logger) {
12
- this.logger = logger;
13
- }
14
- /**
15
- * Configure timestamp styling
16
- */
17
- timestamp() {
18
- return new TimestampStyleBuilderProxy(this);
19
- }
20
- /**
21
- * Configure level badge styling
22
- */
23
- level() {
24
- return new LevelStyleBuilderProxy(this);
25
- }
26
- /**
27
- * Configure prefix styling
28
- */
29
- prefix() {
30
- return new PrefixStyleBuilderProxy(this);
31
- }
32
- /**
33
- * Configure message text styling
34
- */
35
- message() {
36
- return new MessageStyleBuilderProxy(this);
37
- }
38
- /**
39
- * Configure location info styling
40
- */
41
- location() {
42
- return new LocationStyleBuilderProxy(this);
43
- }
44
- /**
45
- * Use a predefined preset
46
- */
47
- usePreset(presetName) {
48
- // Will be implemented when we create the presets
49
- console.warn(`Preset '${presetName}' will be available in next implementation phase`);
50
- return this;
51
- }
52
- /**
53
- * Customize with partial configuration
54
- */
55
- customize(overrides) {
56
- this.logStyles = { ...this.logStyles, ...overrides };
57
- return this;
58
- }
59
- /**
60
- * Set layout spacing
61
- */
62
- spacing(type) {
63
- if (!this.logStyles.layout) {
64
- this.logStyles.layout = { spacing: type };
65
- }
66
- else {
67
- this.logStyles.layout.spacing = type;
68
- }
69
- // Apply spacing-specific configurations
70
- switch (type) {
71
- case 'compact':
72
- this.logStyles.layout.innerPadding = '1px';
73
- this.logStyles.layout.outerMargin = '0px';
74
- break;
75
- case 'spacious':
76
- this.logStyles.layout.innerPadding = '4px';
77
- this.logStyles.layout.outerMargin = '2px';
78
- break;
79
- default: // normal
80
- this.logStyles.layout.innerPadding = '2px';
81
- this.logStyles.layout.outerMargin = '1px';
82
- }
83
- return this;
84
- }
85
- /**
86
- * Set backdrop filter for glassmorphism effects
87
- */
88
- backdrop(filter) {
89
- this.logStyles.backdrop = filter;
90
- return this;
91
- }
92
- /**
93
- * Set overall transparency
94
- */
95
- transparency(value) {
96
- this.logStyles.transparency = Math.max(0, Math.min(1, value));
97
- return this;
98
- }
99
- /**
100
- * Apply the configured styles to the logger
101
- */
102
- apply() {
103
- // Store the configuration in the logger
104
- // This will be implemented when we integrate with the main Logger
105
- this.logger._customLogStyles = this.logStyles;
106
- console.log('Applied log styles:', this.logStyles);
107
- }
108
- /**
109
- * Get current configuration (for debugging)
110
- */
111
- getConfig() {
112
- return { ...this.logStyles };
113
- }
114
- /**
115
- * Internal method to update part configuration
116
- */
117
- _updatePartConfig(part, styles) {
118
- if (part === 'layout' || part === 'backdrop' || part === 'transparency') {
119
- return; // Skip these non-part configs
120
- }
121
- if (!this.logStyles[part]) {
122
- this.logStyles[part] = {};
123
- }
124
- // Parse basic CSS styles into config
125
- // This is a simplified approach - in production might want more sophisticated parsing
126
- this.logStyles[part].style = styles;
127
- }
128
- }
129
- /**
130
- * Base proxy class for part-specific styling
131
- */
132
- class PartStyleBuilderProxy {
133
- parentBuilder;
134
- partName;
135
- constructor(parentBuilder, partName) {
136
- this.parentBuilder = parentBuilder;
137
- this.partName = partName;
138
- }
139
- /**
140
- * Return to the main builder for chaining other parts
141
- */
142
- and() {
143
- return this.parentBuilder;
144
- }
145
- /**
146
- * Apply styles and finish configuration
147
- */
148
- apply() {
149
- this.parentBuilder.apply();
150
- }
151
- /**
152
- * Helper to apply styles to the parent builder
153
- */
154
- applyStyles(styler) {
155
- const styles = styler.build();
156
- this.parentBuilder._updatePartConfig(this.partName, styles);
157
- return this;
158
- }
159
- }
160
- /**
161
- * Timestamp styling proxy with fluent API
162
- */
163
- class TimestampStyleBuilderProxy extends PartStyleBuilderProxy {
164
- constructor(parentBuilder) {
165
- super(parentBuilder, 'timestamp');
166
- }
167
- default() {
168
- return this.applyStyles(new TimestampStyler().default());
169
- }
170
- hidden() {
171
- return this.applyStyles(new TimestampStyler().hidden());
172
- }
173
- minimal() {
174
- return this.applyStyles(new TimestampStyler().minimal());
175
- }
176
- muted() {
177
- return this.applyStyles(new TimestampStyler().muted());
178
- }
179
- mono() {
180
- return this.applyStyles(new TimestampStyler().mono());
181
- }
182
- compact() {
183
- return this.applyStyles(new TimestampStyler().compact());
184
- }
185
- }
186
- /**
187
- * Level badge styling proxy with fluent API
188
- */
189
- class LevelStyleBuilderProxy extends PartStyleBuilderProxy {
190
- constructor(parentBuilder) {
191
- super(parentBuilder, 'level');
192
- }
193
- badge() {
194
- return this.applyStyles(new LevelStyler().badge());
195
- }
196
- gradient(from, to) {
197
- return this.applyStyles(new LevelStyler().gradient(from, to));
198
- }
199
- glowing() {
200
- return this.applyStyles(new LevelStyler().glowing());
201
- }
202
- flat() {
203
- return this.applyStyles(new LevelStyler().flat());
204
- }
205
- bold() {
206
- return this.applyStyles(new LevelStyler().bold());
207
- }
208
- uppercase() {
209
- return this.applyStyles(new LevelStyler().uppercase());
210
- }
211
- neon() {
212
- return this.applyStyles(new LevelStyler().neon());
213
- }
214
- }
215
- /**
216
- * Prefix styling proxy with fluent API
217
- */
218
- class PrefixStyleBuilderProxy extends PartStyleBuilderProxy {
219
- constructor(parentBuilder) {
220
- super(parentBuilder, 'prefix');
221
- }
222
- dark() {
223
- return this.applyStyles(new PrefixStyler().dark());
224
- }
225
- light() {
226
- return this.applyStyles(new PrefixStyler().light());
227
- }
228
- compact() {
229
- return this.applyStyles(new PrefixStyler().compact());
230
- }
231
- muted() {
232
- return this.applyStyles(new PrefixStyler().muted());
233
- }
234
- mono() {
235
- return this.applyStyles(new PrefixStyler().mono());
236
- }
237
- }
238
- /**
239
- * Message styling proxy with fluent API
240
- */
241
- class MessageStyleBuilderProxy extends PartStyleBuilderProxy {
242
- constructor(parentBuilder) {
243
- super(parentBuilder, 'message');
244
- }
245
- readable() {
246
- return this.applyStyles(new MessageStyler().readable());
247
- }
248
- code() {
249
- return this.applyStyles(new MessageStyler().code());
250
- }
251
- large() {
252
- return this.applyStyles(new MessageStyler().large());
253
- }
254
- system() {
255
- return this.applyStyles(new MessageStyler().system());
256
- }
257
- mono() {
258
- return this.applyStyles(new MessageStyler().mono());
259
- }
260
- }
261
- /**
262
- * Location styling proxy with fluent API
263
- */
264
- class LocationStyleBuilderProxy extends PartStyleBuilderProxy {
265
- constructor(parentBuilder) {
266
- super(parentBuilder, 'location');
267
- }
268
- subtle() {
269
- return this.applyStyles(new LocationStyler().subtle());
270
- }
271
- hidden() {
272
- return this.applyStyles(new LocationStyler().hidden());
273
- }
274
- clickable() {
275
- return this.applyStyles(new LocationStyler().clickable());
276
- }
277
- muted() {
278
- return this.applyStyles(new LocationStyler().muted());
279
- }
280
- mono() {
281
- return this.applyStyles(new LocationStyler().mono());
282
- }
283
- }
284
- /**
285
- * Create a new LogStyleBuilder instance
286
- */
287
- export function createLogStyleBuilder(logger) {
288
- return new LogStyleBuilder(logger);
289
- }