@composy/log-viewer-core 0.0.1

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 (105) hide show
  1. package/README.md +37 -0
  2. package/dist/index.js +961 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.min.js +1 -0
  5. package/es/core/EventEmitter.d.ts +11 -0
  6. package/es/core/EventEmitter.d.ts.map +1 -0
  7. package/es/core/EventEmitter.js +40 -0
  8. package/es/core/EventEmitter.js.map +1 -0
  9. package/es/core/LogViewer.d.ts +46 -0
  10. package/es/core/LogViewer.d.ts.map +1 -0
  11. package/es/core/LogViewer.js +186 -0
  12. package/es/core/LogViewer.js.map +1 -0
  13. package/es/filters/FilterEngine.d.ts +26 -0
  14. package/es/filters/FilterEngine.d.ts.map +1 -0
  15. package/es/filters/FilterEngine.js +79 -0
  16. package/es/filters/FilterEngine.js.map +1 -0
  17. package/es/index.d.ts +26 -0
  18. package/es/index.d.ts.map +1 -0
  19. package/es/index.js +26 -0
  20. package/es/index.js.map +1 -0
  21. package/es/renderers/DiffRenderer.d.ts +18 -0
  22. package/es/renderers/DiffRenderer.d.ts.map +1 -0
  23. package/es/renderers/DiffRenderer.js +60 -0
  24. package/es/renderers/DiffRenderer.js.map +1 -0
  25. package/es/renderers/TimelineRenderer.d.ts +22 -0
  26. package/es/renderers/TimelineRenderer.d.ts.map +1 -0
  27. package/es/renderers/TimelineRenderer.js +135 -0
  28. package/es/renderers/TimelineRenderer.js.map +1 -0
  29. package/es/styles/index.d.ts +9 -0
  30. package/es/styles/index.d.ts.map +1 -0
  31. package/es/styles/index.js +414 -0
  32. package/es/styles/index.js.map +1 -0
  33. package/es/types/index.d.ts +113 -0
  34. package/es/types/index.d.ts.map +1 -0
  35. package/es/types/index.js +40 -0
  36. package/es/types/index.js.map +1 -0
  37. package/es/utils/index.d.ts +18 -0
  38. package/es/utils/index.d.ts.map +1 -0
  39. package/es/utils/index.js +73 -0
  40. package/es/utils/index.js.map +1 -0
  41. package/esm/core/EventEmitter.d.ts +11 -0
  42. package/esm/core/EventEmitter.d.ts.map +1 -0
  43. package/esm/core/EventEmitter.js +40 -0
  44. package/esm/core/EventEmitter.js.map +1 -0
  45. package/esm/core/LogViewer.d.ts +46 -0
  46. package/esm/core/LogViewer.d.ts.map +1 -0
  47. package/esm/core/LogViewer.js +186 -0
  48. package/esm/core/LogViewer.js.map +1 -0
  49. package/esm/filters/FilterEngine.d.ts +26 -0
  50. package/esm/filters/FilterEngine.d.ts.map +1 -0
  51. package/esm/filters/FilterEngine.js +79 -0
  52. package/esm/filters/FilterEngine.js.map +1 -0
  53. package/esm/index.d.ts +26 -0
  54. package/esm/index.d.ts.map +1 -0
  55. package/esm/index.js +26 -0
  56. package/esm/index.js.map +1 -0
  57. package/esm/renderers/DiffRenderer.d.ts +18 -0
  58. package/esm/renderers/DiffRenderer.d.ts.map +1 -0
  59. package/esm/renderers/DiffRenderer.js +60 -0
  60. package/esm/renderers/DiffRenderer.js.map +1 -0
  61. package/esm/renderers/TimelineRenderer.d.ts +22 -0
  62. package/esm/renderers/TimelineRenderer.d.ts.map +1 -0
  63. package/esm/renderers/TimelineRenderer.js +135 -0
  64. package/esm/renderers/TimelineRenderer.js.map +1 -0
  65. package/esm/styles/index.d.ts +9 -0
  66. package/esm/styles/index.d.ts.map +1 -0
  67. package/esm/styles/index.js +414 -0
  68. package/esm/styles/index.js.map +1 -0
  69. package/esm/types/index.d.ts +113 -0
  70. package/esm/types/index.d.ts.map +1 -0
  71. package/esm/types/index.js +40 -0
  72. package/esm/types/index.js.map +1 -0
  73. package/esm/utils/index.d.ts +18 -0
  74. package/esm/utils/index.d.ts.map +1 -0
  75. package/esm/utils/index.js +73 -0
  76. package/esm/utils/index.js.map +1 -0
  77. package/lib/core/EventEmitter.cjs +41 -0
  78. package/lib/core/EventEmitter.cjs.map +1 -0
  79. package/lib/core/EventEmitter.d.ts +11 -0
  80. package/lib/core/LogViewer.cjs +187 -0
  81. package/lib/core/LogViewer.cjs.map +1 -0
  82. package/lib/core/LogViewer.d.ts +46 -0
  83. package/lib/filters/FilterEngine.cjs +80 -0
  84. package/lib/filters/FilterEngine.cjs.map +1 -0
  85. package/lib/filters/FilterEngine.d.ts +26 -0
  86. package/lib/index.cjs +43 -0
  87. package/lib/index.cjs.map +1 -0
  88. package/lib/index.d.ts +26 -0
  89. package/lib/package.json +3 -0
  90. package/lib/renderers/DiffRenderer.cjs +61 -0
  91. package/lib/renderers/DiffRenderer.cjs.map +1 -0
  92. package/lib/renderers/DiffRenderer.d.ts +18 -0
  93. package/lib/renderers/TimelineRenderer.cjs +136 -0
  94. package/lib/renderers/TimelineRenderer.cjs.map +1 -0
  95. package/lib/renderers/TimelineRenderer.d.ts +22 -0
  96. package/lib/styles/index.cjs +415 -0
  97. package/lib/styles/index.cjs.map +1 -0
  98. package/lib/styles/index.d.ts +9 -0
  99. package/lib/types/index.cjs +42 -0
  100. package/lib/types/index.cjs.map +1 -0
  101. package/lib/types/index.d.ts +113 -0
  102. package/lib/utils/index.cjs +80 -0
  103. package/lib/utils/index.cjs.map +1 -0
  104. package/lib/utils/index.d.ts +18 -0
  105. package/package.json +119 -0
@@ -0,0 +1,414 @@
1
+ /*!
2
+ * ***********************************
3
+ * @composy/log-viewer-core v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-08-17 11:33:32 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ //#region src/styles/index.ts
11
+ const STYLE_ID = "ldesign-log-viewer-styles";
12
+ function injectStyles() {
13
+ if (typeof document === "undefined") return;
14
+ if (document.getElementById(STYLE_ID)) return;
15
+ const style = document.createElement("style");
16
+ style.id = STYLE_ID;
17
+ style.textContent = CSS_TEXT;
18
+ document.head.appendChild(style);
19
+ }
20
+ const CSS_TEXT = `
21
+ /* ===== CSS Variables ===== */
22
+ .lv-root {
23
+ --lv-bg: #ffffff;
24
+ --lv-bg-secondary: #f7f8fa;
25
+ --lv-bg-hover: #f0f3ff;
26
+ --lv-border: #ebedf0;
27
+ --lv-text: #1a1a2e;
28
+ --lv-text-secondary: #666;
29
+ --lv-text-muted: #999;
30
+ --lv-primary: #4f6ef7;
31
+ --lv-primary-light: #edf0ff;
32
+ --lv-shadow: rgba(0, 0, 0, 0.04);
33
+ --lv-timeline-line: #e0e0e0;
34
+ --lv-timeline-dot: #4f6ef7;
35
+ --lv-diff-add-bg: #f0fff4;
36
+ --lv-diff-add-text: #22863a;
37
+ --lv-diff-del-bg: #fff5f5;
38
+ --lv-diff-del-text: #cb2431;
39
+ --lv-anomaly-bg: #fff2e8;
40
+ --lv-anomaly-border: #ffbb96;
41
+ --lv-radius: 8px;
42
+ --lv-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
43
+ --lv-font-mono: 'Fira Code', 'SF Mono', Consolas, monospace;
44
+ }
45
+
46
+ .lv-root[data-theme="dark"] {
47
+ --lv-bg: #1a1a2e;
48
+ --lv-bg-secondary: #16213e;
49
+ --lv-bg-hover: #1e2a4a;
50
+ --lv-border: #2a2a4a;
51
+ --lv-text: #e0e0e0;
52
+ --lv-text-secondary: #a0a0b0;
53
+ --lv-text-muted: #666680;
54
+ --lv-primary: #6b85f9;
55
+ --lv-primary-light: #252545;
56
+ --lv-shadow: rgba(0, 0, 0, 0.2);
57
+ --lv-timeline-line: #333355;
58
+ --lv-timeline-dot: #6b85f9;
59
+ --lv-diff-add-bg: #0d2818;
60
+ --lv-diff-add-text: #85e89d;
61
+ --lv-diff-del-bg: #2d1214;
62
+ --lv-diff-del-text: #f97583;
63
+ --lv-anomaly-bg: #2d1a0a;
64
+ --lv-anomaly-border: #8b5e3c;
65
+ }
66
+
67
+ /* ===== Root ===== */
68
+ .lv-root {
69
+ font-family: var(--lv-font);
70
+ font-size: 14px;
71
+ color: var(--lv-text);
72
+ background: var(--lv-bg);
73
+ line-height: 1.6;
74
+ }
75
+
76
+ /* ===== Filter Bar ===== */
77
+ .lv-filter {
78
+ display: flex;
79
+ flex-wrap: wrap;
80
+ gap: 10px;
81
+ padding: 16px;
82
+ background: var(--lv-bg);
83
+ border: 1px solid var(--lv-border);
84
+ border-radius: var(--lv-radius);
85
+ margin-bottom: 16px;
86
+ align-items: center;
87
+ }
88
+
89
+ .lv-filter-item {
90
+ display: flex;
91
+ align-items: center;
92
+ gap: 6px;
93
+ font-size: 13px;
94
+ }
95
+
96
+ .lv-filter-label {
97
+ color: var(--lv-text-secondary);
98
+ font-size: 12px;
99
+ white-space: nowrap;
100
+ }
101
+
102
+ .lv-filter-input {
103
+ padding: 5px 10px;
104
+ border: 1px solid var(--lv-border);
105
+ border-radius: 6px;
106
+ font-size: 13px;
107
+ background: var(--lv-bg);
108
+ color: var(--lv-text);
109
+ outline: none;
110
+ transition: border-color 0.2s;
111
+ min-width: 120px;
112
+ }
113
+
114
+ .lv-filter-input:focus {
115
+ border-color: var(--lv-primary);
116
+ }
117
+
118
+ .lv-filter-select {
119
+ padding: 5px 10px;
120
+ border: 1px solid var(--lv-border);
121
+ border-radius: 6px;
122
+ font-size: 13px;
123
+ background: var(--lv-bg);
124
+ color: var(--lv-text);
125
+ outline: none;
126
+ cursor: pointer;
127
+ }
128
+
129
+ .lv-filter-btn {
130
+ display: inline-flex;
131
+ align-items: center;
132
+ gap: 4px;
133
+ padding: 5px 14px;
134
+ font-size: 13px;
135
+ border: 1px solid var(--lv-border);
136
+ border-radius: 6px;
137
+ background: var(--lv-bg);
138
+ color: var(--lv-text);
139
+ cursor: pointer;
140
+ transition: all 0.15s;
141
+ }
142
+
143
+ .lv-filter-btn:hover {
144
+ border-color: var(--lv-primary);
145
+ color: var(--lv-primary);
146
+ }
147
+
148
+ .lv-filter-btn--primary {
149
+ background: var(--lv-primary);
150
+ border-color: var(--lv-primary);
151
+ color: #fff;
152
+ }
153
+
154
+ .lv-filter-btn--primary:hover {
155
+ opacity: 0.85;
156
+ }
157
+
158
+ /* ===== Timeline ===== */
159
+ .lv-timeline {
160
+ position: relative;
161
+ padding-left: 28px;
162
+ }
163
+
164
+ .lv-timeline::before {
165
+ content: '';
166
+ position: absolute;
167
+ left: 9px;
168
+ top: 0;
169
+ bottom: 0;
170
+ width: 2px;
171
+ background: var(--lv-timeline-line);
172
+ }
173
+
174
+ .lv-timeline-item {
175
+ position: relative;
176
+ padding: 0 0 20px 0;
177
+ }
178
+
179
+ .lv-timeline-dot {
180
+ position: absolute;
181
+ left: -25px;
182
+ top: 6px;
183
+ width: 12px;
184
+ height: 12px;
185
+ border-radius: 50%;
186
+ background: var(--lv-bg);
187
+ border: 2px solid var(--lv-timeline-dot);
188
+ z-index: 1;
189
+ }
190
+
191
+ .lv-timeline-dot--anomaly {
192
+ border-color: #ff4d4f;
193
+ background: #fff1f0;
194
+ }
195
+
196
+ .lv-timeline-card {
197
+ background: var(--lv-bg);
198
+ border: 1px solid var(--lv-border);
199
+ border-radius: var(--lv-radius);
200
+ padding: 14px 18px;
201
+ cursor: pointer;
202
+ transition: all 0.2s;
203
+ box-shadow: 0 1px 3px var(--lv-shadow);
204
+ }
205
+
206
+ .lv-timeline-card:hover {
207
+ border-color: var(--lv-primary);
208
+ box-shadow: 0 2px 8px var(--lv-shadow);
209
+ }
210
+
211
+ .lv-timeline-card--anomaly {
212
+ border-left: 3px solid var(--lv-anomaly-border);
213
+ background: var(--lv-anomaly-bg);
214
+ }
215
+
216
+ .lv-timeline-header {
217
+ display: flex;
218
+ align-items: center;
219
+ gap: 10px;
220
+ flex-wrap: wrap;
221
+ margin-bottom: 4px;
222
+ }
223
+
224
+ .lv-timeline-time {
225
+ font-size: 12px;
226
+ color: var(--lv-text-muted);
227
+ font-family: var(--lv-font-mono);
228
+ }
229
+
230
+ .lv-timeline-user {
231
+ font-weight: 600;
232
+ font-size: 14px;
233
+ }
234
+
235
+ .lv-action-tag {
236
+ display: inline-block;
237
+ padding: 1px 8px;
238
+ font-size: 12px;
239
+ border-radius: 4px;
240
+ font-weight: 500;
241
+ color: #fff;
242
+ }
243
+
244
+ .lv-timeline-module {
245
+ font-size: 12px;
246
+ color: var(--lv-text-secondary);
247
+ background: var(--lv-bg-secondary);
248
+ padding: 1px 8px;
249
+ border-radius: 4px;
250
+ }
251
+
252
+ .lv-timeline-ip {
253
+ font-size: 12px;
254
+ color: var(--lv-text-muted);
255
+ font-family: var(--lv-font-mono);
256
+ }
257
+
258
+ .lv-anomaly-badge {
259
+ font-size: 11px;
260
+ padding: 1px 6px;
261
+ border-radius: 3px;
262
+ background: #fff2e8;
263
+ color: #d46b08;
264
+ border: 1px solid #ffd591;
265
+ }
266
+
267
+ .lv-timeline-detail {
268
+ font-size: 13px;
269
+ color: var(--lv-text-secondary);
270
+ margin-top: 6px;
271
+ }
272
+
273
+ .lv-timeline-expand-hint {
274
+ font-size: 12px;
275
+ color: var(--lv-primary);
276
+ margin-top: 6px;
277
+ cursor: pointer;
278
+ }
279
+
280
+ /* ===== Detail Panel ===== */
281
+ .lv-detail {
282
+ margin-top: 12px;
283
+ padding-top: 12px;
284
+ border-top: 1px dashed var(--lv-border);
285
+ animation: lv-slide-down 0.2s ease;
286
+ }
287
+
288
+ @keyframes lv-slide-down {
289
+ from { opacity: 0; transform: translateY(-8px); }
290
+ to { opacity: 1; transform: translateY(0); }
291
+ }
292
+
293
+ /* ===== Diff Table ===== */
294
+ .lv-diff-table {
295
+ width: 100%;
296
+ border-collapse: collapse;
297
+ font-size: 13px;
298
+ border: 1px solid var(--lv-border);
299
+ border-radius: 6px;
300
+ overflow: hidden;
301
+ }
302
+
303
+ .lv-diff-table th {
304
+ background: var(--lv-bg-secondary);
305
+ padding: 8px 12px;
306
+ text-align: left;
307
+ font-weight: 600;
308
+ font-size: 12px;
309
+ color: var(--lv-text-secondary);
310
+ border-bottom: 1px solid var(--lv-border);
311
+ }
312
+
313
+ .lv-diff-table td {
314
+ padding: 8px 12px;
315
+ border-bottom: 1px solid var(--lv-border);
316
+ vertical-align: top;
317
+ }
318
+
319
+ .lv-diff-table tr:last-child td {
320
+ border-bottom: none;
321
+ }
322
+
323
+ .lv-diff-old {
324
+ background: var(--lv-diff-del-bg);
325
+ color: var(--lv-diff-del-text);
326
+ text-decoration: line-through;
327
+ font-family: var(--lv-font-mono);
328
+ font-size: 12px;
329
+ }
330
+
331
+ .lv-diff-new {
332
+ background: var(--lv-diff-add-bg);
333
+ color: var(--lv-diff-add-text);
334
+ font-family: var(--lv-font-mono);
335
+ font-size: 12px;
336
+ }
337
+
338
+ /* ===== Metadata ===== */
339
+ .lv-metadata {
340
+ margin-top: 10px;
341
+ background: var(--lv-bg-secondary);
342
+ border-radius: 6px;
343
+ padding: 10px 14px;
344
+ font-size: 12px;
345
+ font-family: var(--lv-font-mono);
346
+ white-space: pre-wrap;
347
+ word-break: break-all;
348
+ color: var(--lv-text-secondary);
349
+ }
350
+
351
+ /* ===== Pagination ===== */
352
+ .lv-pagination {
353
+ display: flex;
354
+ align-items: center;
355
+ justify-content: center;
356
+ gap: 6px;
357
+ padding: 16px 0;
358
+ }
359
+
360
+ .lv-pagination-btn {
361
+ display: inline-flex;
362
+ align-items: center;
363
+ justify-content: center;
364
+ width: 32px;
365
+ height: 32px;
366
+ border: 1px solid var(--lv-border);
367
+ border-radius: 6px;
368
+ background: var(--lv-bg);
369
+ color: var(--lv-text);
370
+ font-size: 13px;
371
+ cursor: pointer;
372
+ transition: all 0.15s;
373
+ }
374
+
375
+ .lv-pagination-btn:hover {
376
+ border-color: var(--lv-primary);
377
+ color: var(--lv-primary);
378
+ }
379
+
380
+ .lv-pagination-btn--active {
381
+ background: var(--lv-primary);
382
+ border-color: var(--lv-primary);
383
+ color: #fff;
384
+ }
385
+
386
+ .lv-pagination-btn:disabled {
387
+ opacity: 0.4;
388
+ cursor: not-allowed;
389
+ }
390
+
391
+ .lv-pagination-info {
392
+ font-size: 13px;
393
+ color: var(--lv-text-secondary);
394
+ margin: 0 8px;
395
+ }
396
+
397
+ /* ===== Empty state ===== */
398
+ .lv-empty {
399
+ text-align: center;
400
+ padding: 48px 16px;
401
+ color: var(--lv-text-muted);
402
+ font-size: 14px;
403
+ }
404
+
405
+ .lv-empty-icon {
406
+ font-size: 48px;
407
+ margin-bottom: 12px;
408
+ opacity: 0.3;
409
+ }
410
+ `;
411
+ //#endregion
412
+ export { injectStyles };
413
+ /*! End of @composy/log-viewer-core | Powered by @composy/builder */
414
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/styles/index.ts"],"sourcesContent":["/**\n * 样式注入 - 通过 CSS 变量支持亮色/暗色主题\n */\n\nconst STYLE_ID = 'ldesign-log-viewer-styles'\n\n/**\n * injectStyles - inject Styles function\n * @returns 返回值说明\n */\nexport function injectStyles(): void {\n if (typeof document === 'undefined') return\n if (document.getElementById(STYLE_ID)) return\n\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = CSS_TEXT\n document.head.appendChild(style)\n}\n\nconst CSS_TEXT = /* css */ `\n/* ===== CSS Variables ===== */\n.lv-root {\n --lv-bg: #ffffff;\n --lv-bg-secondary: #f7f8fa;\n --lv-bg-hover: #f0f3ff;\n --lv-border: #ebedf0;\n --lv-text: #1a1a2e;\n --lv-text-secondary: #666;\n --lv-text-muted: #999;\n --lv-primary: #4f6ef7;\n --lv-primary-light: #edf0ff;\n --lv-shadow: rgba(0, 0, 0, 0.04);\n --lv-timeline-line: #e0e0e0;\n --lv-timeline-dot: #4f6ef7;\n --lv-diff-add-bg: #f0fff4;\n --lv-diff-add-text: #22863a;\n --lv-diff-del-bg: #fff5f5;\n --lv-diff-del-text: #cb2431;\n --lv-anomaly-bg: #fff2e8;\n --lv-anomaly-border: #ffbb96;\n --lv-radius: 8px;\n --lv-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;\n --lv-font-mono: 'Fira Code', 'SF Mono', Consolas, monospace;\n}\n\n.lv-root[data-theme=\"dark\"] {\n --lv-bg: #1a1a2e;\n --lv-bg-secondary: #16213e;\n --lv-bg-hover: #1e2a4a;\n --lv-border: #2a2a4a;\n --lv-text: #e0e0e0;\n --lv-text-secondary: #a0a0b0;\n --lv-text-muted: #666680;\n --lv-primary: #6b85f9;\n --lv-primary-light: #252545;\n --lv-shadow: rgba(0, 0, 0, 0.2);\n --lv-timeline-line: #333355;\n --lv-timeline-dot: #6b85f9;\n --lv-diff-add-bg: #0d2818;\n --lv-diff-add-text: #85e89d;\n --lv-diff-del-bg: #2d1214;\n --lv-diff-del-text: #f97583;\n --lv-anomaly-bg: #2d1a0a;\n --lv-anomaly-border: #8b5e3c;\n}\n\n/* ===== Root ===== */\n.lv-root {\n font-family: var(--lv-font);\n font-size: 14px;\n color: var(--lv-text);\n background: var(--lv-bg);\n line-height: 1.6;\n}\n\n/* ===== Filter Bar ===== */\n.lv-filter {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n padding: 16px;\n background: var(--lv-bg);\n border: 1px solid var(--lv-border);\n border-radius: var(--lv-radius);\n margin-bottom: 16px;\n align-items: center;\n}\n\n.lv-filter-item {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n}\n\n.lv-filter-label {\n color: var(--lv-text-secondary);\n font-size: 12px;\n white-space: nowrap;\n}\n\n.lv-filter-input {\n padding: 5px 10px;\n border: 1px solid var(--lv-border);\n border-radius: 6px;\n font-size: 13px;\n background: var(--lv-bg);\n color: var(--lv-text);\n outline: none;\n transition: border-color 0.2s;\n min-width: 120px;\n}\n\n.lv-filter-input:focus {\n border-color: var(--lv-primary);\n}\n\n.lv-filter-select {\n padding: 5px 10px;\n border: 1px solid var(--lv-border);\n border-radius: 6px;\n font-size: 13px;\n background: var(--lv-bg);\n color: var(--lv-text);\n outline: none;\n cursor: pointer;\n}\n\n.lv-filter-btn {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 5px 14px;\n font-size: 13px;\n border: 1px solid var(--lv-border);\n border-radius: 6px;\n background: var(--lv-bg);\n color: var(--lv-text);\n cursor: pointer;\n transition: all 0.15s;\n}\n\n.lv-filter-btn:hover {\n border-color: var(--lv-primary);\n color: var(--lv-primary);\n}\n\n.lv-filter-btn--primary {\n background: var(--lv-primary);\n border-color: var(--lv-primary);\n color: #fff;\n}\n\n.lv-filter-btn--primary:hover {\n opacity: 0.85;\n}\n\n/* ===== Timeline ===== */\n.lv-timeline {\n position: relative;\n padding-left: 28px;\n}\n\n.lv-timeline::before {\n content: '';\n position: absolute;\n left: 9px;\n top: 0;\n bottom: 0;\n width: 2px;\n background: var(--lv-timeline-line);\n}\n\n.lv-timeline-item {\n position: relative;\n padding: 0 0 20px 0;\n}\n\n.lv-timeline-dot {\n position: absolute;\n left: -25px;\n top: 6px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background: var(--lv-bg);\n border: 2px solid var(--lv-timeline-dot);\n z-index: 1;\n}\n\n.lv-timeline-dot--anomaly {\n border-color: #ff4d4f;\n background: #fff1f0;\n}\n\n.lv-timeline-card {\n background: var(--lv-bg);\n border: 1px solid var(--lv-border);\n border-radius: var(--lv-radius);\n padding: 14px 18px;\n cursor: pointer;\n transition: all 0.2s;\n box-shadow: 0 1px 3px var(--lv-shadow);\n}\n\n.lv-timeline-card:hover {\n border-color: var(--lv-primary);\n box-shadow: 0 2px 8px var(--lv-shadow);\n}\n\n.lv-timeline-card--anomaly {\n border-left: 3px solid var(--lv-anomaly-border);\n background: var(--lv-anomaly-bg);\n}\n\n.lv-timeline-header {\n display: flex;\n align-items: center;\n gap: 10px;\n flex-wrap: wrap;\n margin-bottom: 4px;\n}\n\n.lv-timeline-time {\n font-size: 12px;\n color: var(--lv-text-muted);\n font-family: var(--lv-font-mono);\n}\n\n.lv-timeline-user {\n font-weight: 600;\n font-size: 14px;\n}\n\n.lv-action-tag {\n display: inline-block;\n padding: 1px 8px;\n font-size: 12px;\n border-radius: 4px;\n font-weight: 500;\n color: #fff;\n}\n\n.lv-timeline-module {\n font-size: 12px;\n color: var(--lv-text-secondary);\n background: var(--lv-bg-secondary);\n padding: 1px 8px;\n border-radius: 4px;\n}\n\n.lv-timeline-ip {\n font-size: 12px;\n color: var(--lv-text-muted);\n font-family: var(--lv-font-mono);\n}\n\n.lv-anomaly-badge {\n font-size: 11px;\n padding: 1px 6px;\n border-radius: 3px;\n background: #fff2e8;\n color: #d46b08;\n border: 1px solid #ffd591;\n}\n\n.lv-timeline-detail {\n font-size: 13px;\n color: var(--lv-text-secondary);\n margin-top: 6px;\n}\n\n.lv-timeline-expand-hint {\n font-size: 12px;\n color: var(--lv-primary);\n margin-top: 6px;\n cursor: pointer;\n}\n\n/* ===== Detail Panel ===== */\n.lv-detail {\n margin-top: 12px;\n padding-top: 12px;\n border-top: 1px dashed var(--lv-border);\n animation: lv-slide-down 0.2s ease;\n}\n\n@keyframes lv-slide-down {\n from { opacity: 0; transform: translateY(-8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n/* ===== Diff Table ===== */\n.lv-diff-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 13px;\n border: 1px solid var(--lv-border);\n border-radius: 6px;\n overflow: hidden;\n}\n\n.lv-diff-table th {\n background: var(--lv-bg-secondary);\n padding: 8px 12px;\n text-align: left;\n font-weight: 600;\n font-size: 12px;\n color: var(--lv-text-secondary);\n border-bottom: 1px solid var(--lv-border);\n}\n\n.lv-diff-table td {\n padding: 8px 12px;\n border-bottom: 1px solid var(--lv-border);\n vertical-align: top;\n}\n\n.lv-diff-table tr:last-child td {\n border-bottom: none;\n}\n\n.lv-diff-old {\n background: var(--lv-diff-del-bg);\n color: var(--lv-diff-del-text);\n text-decoration: line-through;\n font-family: var(--lv-font-mono);\n font-size: 12px;\n}\n\n.lv-diff-new {\n background: var(--lv-diff-add-bg);\n color: var(--lv-diff-add-text);\n font-family: var(--lv-font-mono);\n font-size: 12px;\n}\n\n/* ===== Metadata ===== */\n.lv-metadata {\n margin-top: 10px;\n background: var(--lv-bg-secondary);\n border-radius: 6px;\n padding: 10px 14px;\n font-size: 12px;\n font-family: var(--lv-font-mono);\n white-space: pre-wrap;\n word-break: break-all;\n color: var(--lv-text-secondary);\n}\n\n/* ===== Pagination ===== */\n.lv-pagination {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n padding: 16px 0;\n}\n\n.lv-pagination-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n border: 1px solid var(--lv-border);\n border-radius: 6px;\n background: var(--lv-bg);\n color: var(--lv-text);\n font-size: 13px;\n cursor: pointer;\n transition: all 0.15s;\n}\n\n.lv-pagination-btn:hover {\n border-color: var(--lv-primary);\n color: var(--lv-primary);\n}\n\n.lv-pagination-btn--active {\n background: var(--lv-primary);\n border-color: var(--lv-primary);\n color: #fff;\n}\n\n.lv-pagination-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.lv-pagination-info {\n font-size: 13px;\n color: var(--lv-text-secondary);\n margin: 0 8px;\n}\n\n/* ===== Empty state ===== */\n.lv-empty {\n text-align: center;\n padding: 48px 16px;\n color: var(--lv-text-muted);\n font-size: 14px;\n}\n\n.lv-empty-icon {\n font-size: 48px;\n margin-bottom: 12px;\n opacity: 0.3;\n}\n`\n"],"mappings":";;;;;;;;;;AAIA,MAAM,WAAW;AAMV,SAAS,eAAqB;CACnC,IAAI,OAAO,aAAa,aAAa;CACrC,IAAI,SAAS,eAAe,QAAQ,GAAG;CAEvC,MAAM,QAAQ,SAAS,cAAc,OAAO;CAC5C,MAAM,KAAK;CACX,MAAM,cAAc;CACpB,SAAS,KAAK,YAAY,KAAK;AACjC;AAEA,MAAM,WAAqB"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @composy/log-viewer-core 类型定义
3
+ */
4
+ /** 操作类型 */
5
+ export type ActionType = 'create' | 'update' | 'delete' | 'query' | 'login' | 'logout' | 'export' | 'import' | 'approve' | 'reject' | 'other';
6
+ /** 主题模式 */
7
+ export type ThemeMode = 'light' | 'dark';
8
+ /** 异常标记类型 */
9
+ export type AnomalyType = 'off-hours' | 'sensitive' | 'high-frequency' | 'none';
10
+ /** 字段变更条目 */
11
+ export interface DiffEntry {
12
+ field: string;
13
+ label?: string;
14
+ oldValue: unknown;
15
+ newValue: unknown;
16
+ }
17
+ /** 日志条目 */
18
+ export interface LogEntry {
19
+ id: string;
20
+ timestamp: string | number | Date;
21
+ user: string;
22
+ userId?: string;
23
+ action: ActionType;
24
+ module: string;
25
+ detail?: string;
26
+ ip?: string;
27
+ changes?: DiffEntry[];
28
+ metadata?: Record<string, unknown>;
29
+ anomaly?: AnomalyType;
30
+ }
31
+ /** 筛选配置 */
32
+ export interface FilterConfig {
33
+ user?: string;
34
+ action?: ActionType | ActionType[];
35
+ module?: string;
36
+ ip?: string;
37
+ timeRange?: [Date | string | number, Date | string | number];
38
+ keyword?: string;
39
+ }
40
+ /** 分页配置 */
41
+ export interface PaginationConfig {
42
+ page: number;
43
+ pageSize: number;
44
+ total?: number;
45
+ }
46
+ /** LogViewer 配置 */
47
+ export interface LogViewerConfig {
48
+ container: string | HTMLElement;
49
+ data?: LogEntry[];
50
+ dataSource?: string | (() => Promise<LogEntry[]>);
51
+ columns?: string[];
52
+ filter?: FilterConfig;
53
+ pagination?: Partial<PaginationConfig>;
54
+ theme?: ThemeMode;
55
+ locale?: 'zh-CN' | 'en-US';
56
+ showFilter?: boolean;
57
+ showDiff?: boolean;
58
+ showAnomalyBadge?: boolean;
59
+ pageSize?: number;
60
+ onEntryClick?: (entry: LogEntry) => void;
61
+ onFilterChange?: (filter: FilterConfig) => void;
62
+ onThemeChange?: (theme: ThemeMode) => void;
63
+ }
64
+ /** LogViewer 实例接口 */
65
+ export interface LogViewerInstance {
66
+ /** 获取当前数据 */
67
+ getData(): LogEntry[];
68
+ /** 设置数据 */
69
+ setData(entries: LogEntry[]): void;
70
+ /** 追加数据 */
71
+ appendData(entries: LogEntry[]): void;
72
+ /** 获取当前筛选条件 */
73
+ getFilter(): FilterConfig;
74
+ /** 设置筛选条件 */
75
+ setFilter(filter: FilterConfig): void;
76
+ /** 重置筛选 */
77
+ resetFilter(): void;
78
+ /** 获取当前主题 */
79
+ getTheme(): ThemeMode;
80
+ /** 设置主题 */
81
+ setTheme(theme: ThemeMode): void;
82
+ /** 展开指定条目详情 */
83
+ expandEntry(id: string): void;
84
+ /** 折叠指定条目详情 */
85
+ collapseEntry(id: string): void;
86
+ /** 折叠所有详情 */
87
+ collapseAll(): void;
88
+ /** 跳转分页 */
89
+ goToPage(page: number): void;
90
+ /** 获取分页信息 */
91
+ getPagination(): PaginationConfig;
92
+ /** 注册事件监听 */
93
+ on(event: string, callback: (...args: unknown[]) => void): () => void;
94
+ /** 刷新渲染 */
95
+ refresh(): void;
96
+ /** 销毁实例 */
97
+ destroy(): void;
98
+ }
99
+ /** 事件映射 */
100
+ export interface LogViewerEvents {
101
+ 'filter:change': (filter: FilterConfig) => void;
102
+ 'entry:click': (entry: LogEntry) => void;
103
+ 'entry:expand': (entry: LogEntry) => void;
104
+ 'entry:collapse': (entry: LogEntry) => void;
105
+ 'theme:change': (theme: ThemeMode) => void;
106
+ 'page:change': (page: number) => void;
107
+ 'data:change': (entries: LogEntry[]) => void;
108
+ }
109
+ /** 操作类型标签映射 */
110
+ export declare const ACTION_LABELS: Record<ActionType, string>;
111
+ /** 操作类型颜色映射 */
112
+ export declare const ACTION_COLORS: Record<ActionType, string>;
113
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,WAAW;AACX,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,CAAA;AAEX,WAAW;AACX,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAExC,aAAa;A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v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-08-17 11:33:32 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ //#region src/types/index.ts
11
+ const ACTION_LABELS = {
12
+ create: "新增",
13
+ update: "修改",
14
+ delete: "删除",
15
+ query: "查询",
16
+ login: "登录",
17
+ logout: "登出",
18
+ export: "导出",
19
+ import: "导入",
20
+ approve: "审批",
21
+ reject: "驳回",
22
+ other: "其他"
23
+ };
24
+ const ACTION_COLORS = {
25
+ create: "#52c41a",
26
+ update: "#1890ff",
27
+ delete: "#ff4d4f",
28
+ query: "#8c8c8c",
29
+ login: "#722ed1",
30
+ logout: "#eb2f96",
31
+ export: "#fa8c16",
32
+ import: "#13c2c2",
33
+ approve: "#52c41a",
34
+ reject: "#ff4d4f",
35
+ other: "#d9d9d9"
36
+ };
37
+ //#endregion
38
+ export { ACTION_COLORS, ACTION_LABELS };
39
+ /*! End of @composy/log-viewer-core | Powered by @composy/builder */
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["/**\n * @composy/log-viewer-core 类型定义\n */\n\n/** 操作类型 */\nexport type ActionType =\n | 'create'\n | 'update'\n | 'delete'\n | 'query'\n | 'login'\n | 'logout'\n | 'export'\n | 'import'\n | 'approve'\n | 'reject'\n | 'other'\n\n/** 主题模式 */\nexport type ThemeMode = 'light' | 'dark'\n\n/** 异常标记类型 */\nexport type AnomalyType = 'off-hours' | 'sensitive' | 'high-frequency' | 'none'\n\n/** 字段变更条目 */\nexport interface DiffEntry {\n field: string\n label?: string\n oldValue: unknown\n newValue: unknown\n}\n\n/** 日志条目 */\nexport interface LogEntry {\n id: string\n timestamp: string | number | Date\n user: string\n userId?: string\n action: ActionType\n module: string\n detail?: string\n ip?: string\n changes?: DiffEntry[]\n metadata?: Record<string, unknown>\n anomaly?: AnomalyType\n}\n\n/** 筛选配置 */\nexport interface FilterConfig {\n user?: string\n action?: ActionType | ActionType[]\n module?: string\n ip?: string\n timeRange?: [Date | string | number, Date | string | number]\n keyword?: string\n}\n\n/** 分页配置 */\nexport interface PaginationConfig {\n page: number\n pageSize: number\n total?: number\n}\n\n/** LogViewer 配置 */\nexport interface LogViewerConfig {\n container: string | HTMLElement\n data?: LogEntry[]\n dataSource?: string | (() => Promise<LogEntry[]>)\n columns?: string[]\n filter?: FilterConfig\n pagination?: Partial<PaginationConfig>\n theme?: ThemeMode\n locale?: 'zh-CN' | 'en-US'\n showFilter?: boolean\n showDiff?: boolean\n showAnomalyBadge?: boolean\n pageSize?: number\n onEntryClick?: (entry: LogEntry) => void\n onFilterChange?: (filter: FilterConfig) => void\n onThemeChange?: (theme: ThemeMode) => void\n}\n\n/** LogViewer 实例接口 */\nexport interface LogViewerInstance {\n /** 获取当前数据 */\n getData(): LogEntry[]\n /** 设置数据 */\n setData(entries: LogEntry[]): void\n /** 追加数据 */\n appendData(entries: LogEntry[]): void\n /** 获取当前筛选条件 */\n getFilter(): FilterConfig\n /** 设置筛选条件 */\n setFilter(filter: FilterConfig): void\n /** 重置筛选 */\n resetFilter(): void\n /** 获取当前主题 */\n getTheme(): ThemeMode\n /** 设置主题 */\n setTheme(theme: ThemeMode): void\n /** 展开指定条目详情 */\n expandEntry(id: string): void\n /** 折叠指定条目详情 */\n collapseEntry(id: string): void\n /** 折叠所有详情 */\n collapseAll(): void\n /** 跳转分页 */\n goToPage(page: number): void\n /** 获取分页信息 */\n getPagination(): PaginationConfig\n /** 注册事件监听 */\n on(event: string, callback: (...args: unknown[]) => void): () => void\n /** 刷新渲染 */\n refresh(): void\n /** 销毁实例 */\n destroy(): void\n}\n\n/** 事件映射 */\nexport interface LogViewerEvents {\n 'filter:change': (filter: FilterConfig) => void\n 'entry:click': (entry: LogEntry) => void\n 'entry:expand': (entry: LogEntry) => void\n 'entry:collapse': (entry: LogEntry) => void\n 'theme:change': (theme: ThemeMode) => void\n 'page:change': (page: number) => void\n 'data:change': (entries: LogEntry[]) => void\n}\n\n/** 操作类型标签映射 */\nexport const ACTION_LABELS: Record<ActionType, string> = {\n create: '新增',\n update: '修改',\n delete: '删除',\n query: '查询',\n login: '登录',\n logout: '登出',\n export: '导出',\n import: '导入',\n approve: '审批',\n reject: '驳回',\n other: '其他',\n}\n\n/** 操作类型颜色映射 */\nexport const ACTION_COLORS: Record<ActionType, string> = {\n create: '#52c41a',\n update: '#1890ff',\n delete: '#ff4d4f',\n query: '#8c8c8c',\n login: '#722ed1',\n logout: '#eb2f96',\n export: '#fa8c16',\n import: '#13c2c2',\n approve: '#52c41a',\n reject: '#ff4d4f',\n other: '#d9d9d9',\n}\n"],"mappings":";;;;;;;;;;AAmIO,MAAM,gBAA4C;CACvD,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,OAAO;AACT;AAGO,MAAM,gBAA4C;CACvD,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,OAAO;AACT"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 工具函数
3
+ */
4
+ /** 生成唯一 ID */
5
+ export declare function uid(prefix?: string): string;
6
+ /** 格式化日期 */
7
+ export declare function formatDate(value: string | number | Date, fmt?: string): string;
8
+ /** 格式化相对时间 */
9
+ export declare function formatRelativeTime(value: string | number | Date): string;
10
+ /** HTML 转义 */
11
+ export declare function escapeHtml(str: string): string;
12
+ /** 防抖 */
13
+ export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): T;
14
+ /** 深拷贝简易实现 */
15
+ export declare function deepClone<T>(obj: T): T;
16
+ /** 将值格式化为可展示的字符串 */
17
+ export declare function formatValue(val: unknown): string;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,cAAc;AACd,wBAAgB,GAAG,CAAC,MAAM,SAAO,GAAG,MAAM,CAEzC;AAED,YAAY;AACZ,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,GAAG,SAAwB,GAAG,MAAM,CAmB7F;AAED,cAAc;AACd,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAUxE;AAED,cAAc;AACd,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS9C;AAED,SAAS;AACT,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAMxF;AAED,cAAc;AACd,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAOtC;AAED,oBAAoB;AACpB,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAUhD"}