@design.estate/dees-catalog 3.35.1 → 3.36.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "3.35.1",
3
+ "version": "3.36.0",
4
4
  "private": false,
5
5
  "description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
6
6
  "main": "dist_ts_web/index.js",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '3.35.1',
6
+ version: '3.36.0',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -1,16 +1,18 @@
1
- import { html } from '@design.estate/dees-element';
1
+ import { html, css, cssManager } from '@design.estate/dees-element';
2
2
  import type { DeesChartLog } from '../dees-chart-log/dees-chart-log.js';
3
3
  import '@design.estate/dees-wcctools/demotools';
4
4
 
5
5
  export const demoFunc = () => {
6
6
  return html`
7
7
  <dees-demowrapper .runAfterRender=${async (elementArg: HTMLElement) => {
8
- // Get the log element
9
- const logElement = elementArg.querySelector('dees-chart-log') as DeesChartLog;
10
- let intervalId: number;
8
+ // Get the log elements
9
+ const structuredLog = elementArg.querySelector('#structured-log') as DeesChartLog;
10
+ const rawLog = elementArg.querySelector('#raw-log') as DeesChartLog;
11
+ let structuredIntervalId: number;
12
+ let rawIntervalId: number;
11
13
 
12
14
  const serverSources = ['Server', 'Database', 'API', 'Auth', 'Cache', 'Queue', 'WebSocket', 'Scheduler'];
13
-
15
+
14
16
  const logTemplates = {
15
17
  debug: [
16
18
  'Loading module: {{module}}',
@@ -49,14 +51,30 @@ export const demoFunc = () => {
49
51
  ],
50
52
  };
51
53
 
54
+ // Docker-like raw log lines with ANSI colors
55
+ const dockerLogTemplates = [
56
+ '\x1b[90m2024-01-15T10:23:45.123Z\x1b[0m \x1b[36mINFO\x1b[0m [nginx] GET /api/health 200 - 2ms',
57
+ '\x1b[90m2024-01-15T10:23:45.456Z\x1b[0m \x1b[33mWARN\x1b[0m [redis] Connection pool running low: 3/10',
58
+ '\x1b[90m2024-01-15T10:23:45.789Z\x1b[0m \x1b[31mERROR\x1b[0m [mongodb] Query timeout after 30000ms',
59
+ '\x1b[90m2024-01-15T10:23:46.012Z\x1b[0m \x1b[36mINFO\x1b[0m [app] Processing batch job #{{jobId}}',
60
+ '\x1b[90m2024-01-15T10:23:46.345Z\x1b[0m \x1b[32mOK\x1b[0m [health] All services healthy',
61
+ '\x1b[90m2024-01-15T10:23:46.678Z\x1b[0m \x1b[36mINFO\x1b[0m [kafka] Message consumed from topic: events',
62
+ '\x1b[90m2024-01-15T10:23:47.001Z\x1b[0m \x1b[35mDEBUG\x1b[0m [grpc] Request received: GetUser(id={{userId}})',
63
+ '\x1b[90m2024-01-15T10:23:47.234Z\x1b[0m \x1b[31mERROR\x1b[0m [auth] Token validation failed: expired',
64
+ '\x1b[90m2024-01-15T10:23:47.567Z\x1b[0m \x1b[33mWARN\x1b[0m [rate-limit] IP {{ip}} approaching rate limit',
65
+ '\x1b[90m2024-01-15T10:23:47.890Z\x1b[0m \x1b[36mINFO\x1b[0m [websocket] Client connected: session={{session}}',
66
+ // Multi-line log entry like stack traces
67
+ '\x1b[31mError: Connection refused\x1b[0m\n at TcpConnection.connect (/app/node_modules/pg/lib/connection.js:12:15)\n at Pool.connect (/app/node_modules/pg/lib/pool.js:45:23)\n at async DatabaseService.query (/app/src/db/service.ts:89:12)',
68
+ ];
69
+
52
70
  const generateRandomLog = () => {
53
71
  const levels: Array<'debug' | 'info' | 'warn' | 'error' | 'success'> = ['debug', 'info', 'warn', 'error', 'success'];
54
- const weights = [0.2, 0.5, 0.15, 0.1, 0.05]; // Weighted probability
55
-
72
+ const weights = [0.2, 0.5, 0.15, 0.1, 0.05];
73
+
56
74
  const random = Math.random();
57
75
  let cumulative = 0;
58
76
  let level: typeof levels[0] = 'info';
59
-
77
+
60
78
  for (let i = 0; i < weights.length; i++) {
61
79
  cumulative += weights[i];
62
80
  if (random < cumulative) {
@@ -68,7 +86,7 @@ export const demoFunc = () => {
68
86
  const source = serverSources[Math.floor(Math.random() * serverSources.length)];
69
87
  const templates = logTemplates[level];
70
88
  const template = templates[Math.floor(Math.random() * templates.length)];
71
-
89
+
72
90
  // Replace placeholders with random values
73
91
  const message = template
74
92
  .replace('{{module}}', ['express', 'mongoose', 'redis', 'socket.io'][Math.floor(Math.random() * 4)])
@@ -92,17 +110,52 @@ export const demoFunc = () => {
92
110
  .replace('{{port}}', String(3000 + Math.floor(Math.random() * 10)))
93
111
  .replace('{{size}}', String(Math.floor(Math.random() * 500) + 100));
94
112
 
95
- logElement.addLog(level, message, source);
113
+ structuredLog.addLog(level, message, source);
114
+ };
115
+
116
+ const generateDockerLog = () => {
117
+ const template = dockerLogTemplates[Math.floor(Math.random() * dockerLogTemplates.length)];
118
+ const now = new Date().toISOString();
119
+
120
+ const logLine = template
121
+ .replace(/2024-01-15T10:23:\d{2}\.\d{3}Z/g, now)
122
+ .replace('{{jobId}}', String(Math.floor(Math.random() * 10000)))
123
+ .replace('{{userId}}', String(Math.floor(Math.random() * 10000)))
124
+ .replace('{{ip}}', `192.168.1.${Math.floor(Math.random() * 255)}`)
125
+ .replace('{{session}}', Math.random().toString(36).substring(2, 11));
126
+
127
+ rawLog.writelnRaw(logLine);
96
128
  };
97
129
 
98
- const startSimulation = () => {
99
- if (!intervalId) {
100
- // Generate logs at random intervals between 500ms and 2500ms
130
+ const startStructuredSimulation = () => {
131
+ if (!structuredIntervalId) {
101
132
  const scheduleNext = () => {
102
133
  generateRandomLog();
103
134
  const nextDelay = Math.random() * 2000 + 500;
104
- intervalId = window.setTimeout(() => {
105
- if (intervalId) {
135
+ structuredIntervalId = window.setTimeout(() => {
136
+ if (structuredIntervalId) {
137
+ scheduleNext();
138
+ }
139
+ }, nextDelay);
140
+ };
141
+ scheduleNext();
142
+ }
143
+ };
144
+
145
+ const stopStructuredSimulation = () => {
146
+ if (structuredIntervalId) {
147
+ window.clearTimeout(structuredIntervalId);
148
+ structuredIntervalId = null;
149
+ }
150
+ };
151
+
152
+ const startRawSimulation = () => {
153
+ if (!rawIntervalId) {
154
+ const scheduleNext = () => {
155
+ generateDockerLog();
156
+ const nextDelay = Math.random() * 1000 + 200;
157
+ rawIntervalId = window.setTimeout(() => {
158
+ if (rawIntervalId) {
106
159
  scheduleNext();
107
160
  }
108
161
  }, nextDelay);
@@ -111,10 +164,10 @@ export const demoFunc = () => {
111
164
  }
112
165
  };
113
166
 
114
- const stopSimulation = () => {
115
- if (intervalId) {
116
- window.clearTimeout(intervalId);
117
- intervalId = null;
167
+ const stopRawSimulation = () => {
168
+ if (rawIntervalId) {
169
+ window.clearTimeout(rawIntervalId);
170
+ rawIntervalId = null;
118
171
  }
119
172
  };
120
173
 
@@ -122,49 +175,103 @@ export const demoFunc = () => {
122
175
  const buttons = elementArg.querySelectorAll('dees-button');
123
176
  buttons.forEach(button => {
124
177
  const text = button.textContent?.trim();
125
- if (text === 'Add Single Log') {
126
- button.addEventListener('click', () => generateRandomLog());
127
- } else if (text === 'Start Simulation') {
128
- button.addEventListener('click', () => startSimulation());
129
- } else if (text === 'Stop Simulation') {
130
- button.addEventListener('click', () => stopSimulation());
178
+ switch (text) {
179
+ case 'Add Structured Log':
180
+ button.addEventListener('click', () => generateRandomLog());
181
+ break;
182
+ case 'Start Structured':
183
+ button.addEventListener('click', () => startStructuredSimulation());
184
+ break;
185
+ case 'Stop Structured':
186
+ button.addEventListener('click', () => stopStructuredSimulation());
187
+ break;
188
+ case 'Add Docker Log':
189
+ button.addEventListener('click', () => generateDockerLog());
190
+ break;
191
+ case 'Start Docker':
192
+ button.addEventListener('click', () => startRawSimulation());
193
+ break;
194
+ case 'Stop Docker':
195
+ button.addEventListener('click', () => stopRawSimulation());
196
+ break;
131
197
  }
132
198
  });
133
199
  }}>
134
200
  <style>
135
- .demoBox {
136
- position: relative;
137
- background: #000000;
138
- height: 100%;
139
- width: 100%;
140
- padding: 40px;
141
- box-sizing: border-box;
142
- display: flex;
143
- flex-direction: column;
144
- gap: 20px;
145
- }
146
- .controls {
147
- display: flex;
148
- gap: 10px;
149
- flex-wrap: wrap;
150
- }
151
- .info {
152
- color: #888;
153
- font-size: 12px;
154
- font-family: 'Geist Sans', sans-serif;
155
- }
156
- </style>
201
+ ${css`
202
+ .demoBox {
203
+ position: relative;
204
+ background: ${cssManager.bdTheme('hsl(0 0% 95%)', 'hsl(0 0% 5%)')};
205
+ height: 100%;
206
+ width: 100%;
207
+ padding: 40px;
208
+ box-sizing: border-box;
209
+ display: flex;
210
+ flex-direction: column;
211
+ gap: 24px;
212
+ }
213
+ .section {
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: 12px;
217
+ }
218
+ .section-title {
219
+ color: ${cssManager.bdTheme('hsl(0 0% 9%)', 'hsl(0 0% 95%)')};
220
+ font-size: 14px;
221
+ font-weight: 600;
222
+ font-family: 'Geist Sans', sans-serif;
223
+ }
224
+ .section-description {
225
+ color: ${cssManager.bdTheme('hsl(215.4 16.3% 46.9%)', 'hsl(215 20.2% 65.1%)')};
226
+ font-size: 12px;
227
+ font-family: 'Geist Sans', sans-serif;
228
+ }
229
+ .controls {
230
+ display: flex;
231
+ gap: 10px;
232
+ flex-wrap: wrap;
233
+ }
234
+ `}
235
+ </style>
157
236
  <div class="demoBox">
158
- <div class="controls">
159
- <dees-button>Add Single Log</dees-button>
160
- <dees-button>Start Simulation</dees-button>
161
- <dees-button>Stop Simulation</dees-button>
237
+ <!-- Structured Logs Section -->
238
+ <div class="section">
239
+ <div class="section-title">Structured Logs (ILogEntry)</div>
240
+ <div class="section-description">
241
+ Structured log entries with level, message, and source. Supports search and keyword highlighting.
242
+ </div>
243
+ <div class="controls">
244
+ <dees-button>Add Structured Log</dees-button>
245
+ <dees-button>Start Structured</dees-button>
246
+ <dees-button>Stop Structured</dees-button>
247
+ </div>
248
+ <dees-chart-log
249
+ id="structured-log"
250
+ .label=${'Production Server Logs'}
251
+ .highlightKeywords=${['error', 'failed', 'timeout']}
252
+ .showMetrics=${true}
253
+ ></dees-chart-log>
254
+ </div>
255
+
256
+ <!-- Raw Logs Section -->
257
+ <div class="section">
258
+ <div class="section-title">Raw Logs (Docker/Container Style)</div>
259
+ <div class="section-description">
260
+ Raw log output with ANSI escape sequences for real Docker/container logs.
261
+ </div>
262
+ <div class="controls">
263
+ <dees-button>Add Docker Log</dees-button>
264
+ <dees-button>Start Docker</dees-button>
265
+ <dees-button>Stop Docker</dees-button>
266
+ </div>
267
+ <dees-chart-log
268
+ id="raw-log"
269
+ .label=${'Docker Container Logs'}
270
+ .mode=${'raw'}
271
+ .showMetrics=${false}
272
+ ></dees-chart-log>
162
273
  </div>
163
- <div class="info">Simulating realistic server logs with various levels and sources</div>
164
- <dees-chart-log
165
- .label=${'Production Server Logs'}
166
- ></dees-chart-log>
167
274
  </div>
168
275
  </dees-demowrapper>
169
276
  `;
170
- };
277
+ };