@gravito/signal 1.0.0 → 2.0.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/CHANGELOG.md +16 -0
- package/dist/index.js +25 -0
- package/dist/index.mjs +25 -0
- package/package.json +1 -1
- package/src/dev/DevServer.ts +3 -0
- package/src/dev/ui/preview.ts +35 -0
- package/src/dev/ui/shared.ts +1 -0
- package/tests/dev-server.test.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @gravito/signal
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @gravito/core@1.1.0
|
|
10
|
+
- @gravito/prism@2.0.0
|
|
11
|
+
- @gravito/stream@1.0.1
|
|
12
|
+
|
|
13
|
+
## 1.0.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Refactored all scaffold generators (Enterprise MVC, Clean Architecture, Action Domain, DDD) to adopt the Service Provider pattern and a modern 4-step bootstrap lifecycle. Fixed a missing mock in @gravito/signal tests.
|
|
18
|
+
|
|
3
19
|
## 1.0.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -37662,6 +37662,7 @@ var layout = (title, content) => `
|
|
|
37662
37662
|
<!DOCTYPE html>
|
|
37663
37663
|
<html>
|
|
37664
37664
|
<head>
|
|
37665
|
+
<meta charset="utf-8">
|
|
37665
37666
|
<title>${title} - Gravito Mailbox</title>
|
|
37666
37667
|
<style>${styles}</style>
|
|
37667
37668
|
</head>
|
|
@@ -37748,7 +37749,28 @@ function getPreviewHtml(entry, prefix) {
|
|
|
37748
37749
|
<div style="font-size: 18px; font-weight: bold; margin-bottom: 10px;">${entry.envelope.subject || "(No Subject)"}</div>
|
|
37749
37750
|
<div class="meta" style="margin-bottom: 5px;">From: ${from}</div>
|
|
37750
37751
|
<div class="meta" style="margin-bottom: 5px;">To: ${to}</div>
|
|
37752
|
+
${entry.envelope.cc ? `<div class="meta" style="margin-bottom: 5px;">CC: ${entry.envelope.cc.map((t) => t.address).join(", ")}</div>` : ""}
|
|
37753
|
+
${entry.envelope.bcc ? `<div class="meta" style="margin-bottom: 5px;">BCC: ${entry.envelope.bcc.map((t) => t.address).join(", ")}</div>` : ""}
|
|
37754
|
+
${entry.envelope.priority ? `<div class="meta" style="margin-bottom: 5px;">Priority: ${entry.envelope.priority}</div>` : ""}
|
|
37751
37755
|
<div class="meta">Date: ${entry.sentAt.toLocaleString()}</div>
|
|
37756
|
+
${entry.envelope.attachments && entry.envelope.attachments.length > 0 ? `
|
|
37757
|
+
<div style="margin-top: 15px; border-top: 1px solid var(--border); padding-top: 10px;">
|
|
37758
|
+
<div style="font-size: 14px; font-weight: bold; margin-bottom: 5px; color: var(--text-muted);">Attachments (${entry.envelope.attachments.length})</div>
|
|
37759
|
+
<div style="display: flex; gap: 10px; flex-wrap: wrap;">
|
|
37760
|
+
${entry.envelope.attachments.map(
|
|
37761
|
+
(att) => `
|
|
37762
|
+
<div style="background: var(--bg-dark); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border); display: flex; align-items: center; gap: 8px;">
|
|
37763
|
+
<span style="font-size: 20px;">\u{1F4CE}</span>
|
|
37764
|
+
<div>
|
|
37765
|
+
<div style="font-size: 14px; font-weight: 500;">${att.filename || "untitled"}</div>
|
|
37766
|
+
<div style="font-size: 12px; color: var(--text-muted);">${att.contentType || "application/octet-stream"}</div>
|
|
37767
|
+
</div>
|
|
37768
|
+
</div>
|
|
37769
|
+
`
|
|
37770
|
+
).join("")}
|
|
37771
|
+
</div>
|
|
37772
|
+
</div>
|
|
37773
|
+
` : ""}
|
|
37752
37774
|
</div>
|
|
37753
37775
|
|
|
37754
37776
|
<div style="margin-bottom: 10px;">
|
|
@@ -37825,6 +37847,7 @@ var DevServer = class {
|
|
|
37825
37847
|
prefix,
|
|
37826
37848
|
wrap((ctx) => {
|
|
37827
37849
|
const entries = this.mailbox.list();
|
|
37850
|
+
ctx.header("Content-Type", "text/html; charset=utf-8");
|
|
37828
37851
|
return ctx.html(getMailboxHtml(entries, prefix));
|
|
37829
37852
|
})
|
|
37830
37853
|
);
|
|
@@ -37839,6 +37862,7 @@ var DevServer = class {
|
|
|
37839
37862
|
if (!entry) {
|
|
37840
37863
|
return ctx.text("Email not found", 404);
|
|
37841
37864
|
}
|
|
37865
|
+
ctx.header("Content-Type", "text/html; charset=utf-8");
|
|
37842
37866
|
return ctx.html(getPreviewHtml(entry, prefix));
|
|
37843
37867
|
})
|
|
37844
37868
|
);
|
|
@@ -37853,6 +37877,7 @@ var DevServer = class {
|
|
|
37853
37877
|
if (!entry) {
|
|
37854
37878
|
return ctx.text("Not found", 404);
|
|
37855
37879
|
}
|
|
37880
|
+
ctx.header("Content-Type", "text/html; charset=utf-8");
|
|
37856
37881
|
return ctx.html(entry.html);
|
|
37857
37882
|
})
|
|
37858
37883
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -319,6 +319,7 @@ var layout = (title, content) => `
|
|
|
319
319
|
<!DOCTYPE html>
|
|
320
320
|
<html>
|
|
321
321
|
<head>
|
|
322
|
+
<meta charset="utf-8">
|
|
322
323
|
<title>${title} - Gravito Mailbox</title>
|
|
323
324
|
<style>${styles}</style>
|
|
324
325
|
</head>
|
|
@@ -405,7 +406,28 @@ function getPreviewHtml(entry, prefix) {
|
|
|
405
406
|
<div style="font-size: 18px; font-weight: bold; margin-bottom: 10px;">${entry.envelope.subject || "(No Subject)"}</div>
|
|
406
407
|
<div class="meta" style="margin-bottom: 5px;">From: ${from}</div>
|
|
407
408
|
<div class="meta" style="margin-bottom: 5px;">To: ${to}</div>
|
|
409
|
+
${entry.envelope.cc ? `<div class="meta" style="margin-bottom: 5px;">CC: ${entry.envelope.cc.map((t) => t.address).join(", ")}</div>` : ""}
|
|
410
|
+
${entry.envelope.bcc ? `<div class="meta" style="margin-bottom: 5px;">BCC: ${entry.envelope.bcc.map((t) => t.address).join(", ")}</div>` : ""}
|
|
411
|
+
${entry.envelope.priority ? `<div class="meta" style="margin-bottom: 5px;">Priority: ${entry.envelope.priority}</div>` : ""}
|
|
408
412
|
<div class="meta">Date: ${entry.sentAt.toLocaleString()}</div>
|
|
413
|
+
${entry.envelope.attachments && entry.envelope.attachments.length > 0 ? `
|
|
414
|
+
<div style="margin-top: 15px; border-top: 1px solid var(--border); padding-top: 10px;">
|
|
415
|
+
<div style="font-size: 14px; font-weight: bold; margin-bottom: 5px; color: var(--text-muted);">Attachments (${entry.envelope.attachments.length})</div>
|
|
416
|
+
<div style="display: flex; gap: 10px; flex-wrap: wrap;">
|
|
417
|
+
${entry.envelope.attachments.map(
|
|
418
|
+
(att) => `
|
|
419
|
+
<div style="background: var(--bg-dark); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border); display: flex; align-items: center; gap: 8px;">
|
|
420
|
+
<span style="font-size: 20px;">\u{1F4CE}</span>
|
|
421
|
+
<div>
|
|
422
|
+
<div style="font-size: 14px; font-weight: 500;">${att.filename || "untitled"}</div>
|
|
423
|
+
<div style="font-size: 12px; color: var(--text-muted);">${att.contentType || "application/octet-stream"}</div>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
`
|
|
427
|
+
).join("")}
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
` : ""}
|
|
409
431
|
</div>
|
|
410
432
|
|
|
411
433
|
<div style="margin-bottom: 10px;">
|
|
@@ -482,6 +504,7 @@ var DevServer = class {
|
|
|
482
504
|
prefix,
|
|
483
505
|
wrap((ctx) => {
|
|
484
506
|
const entries = this.mailbox.list();
|
|
507
|
+
ctx.header("Content-Type", "text/html; charset=utf-8");
|
|
485
508
|
return ctx.html(getMailboxHtml(entries, prefix));
|
|
486
509
|
})
|
|
487
510
|
);
|
|
@@ -496,6 +519,7 @@ var DevServer = class {
|
|
|
496
519
|
if (!entry) {
|
|
497
520
|
return ctx.text("Email not found", 404);
|
|
498
521
|
}
|
|
522
|
+
ctx.header("Content-Type", "text/html; charset=utf-8");
|
|
499
523
|
return ctx.html(getPreviewHtml(entry, prefix));
|
|
500
524
|
})
|
|
501
525
|
);
|
|
@@ -510,6 +534,7 @@ var DevServer = class {
|
|
|
510
534
|
if (!entry) {
|
|
511
535
|
return ctx.text("Not found", 404);
|
|
512
536
|
}
|
|
537
|
+
ctx.header("Content-Type", "text/html; charset=utf-8");
|
|
513
538
|
return ctx.html(entry.html);
|
|
514
539
|
})
|
|
515
540
|
);
|
package/package.json
CHANGED
package/src/dev/DevServer.ts
CHANGED
|
@@ -55,6 +55,7 @@ export class DevServer {
|
|
|
55
55
|
prefix,
|
|
56
56
|
wrap((ctx) => {
|
|
57
57
|
const entries = this.mailbox.list()
|
|
58
|
+
ctx.header('Content-Type', 'text/html; charset=utf-8')
|
|
58
59
|
return ctx.html(getMailboxHtml(entries, prefix))
|
|
59
60
|
})
|
|
60
61
|
)
|
|
@@ -72,6 +73,7 @@ export class DevServer {
|
|
|
72
73
|
if (!entry) {
|
|
73
74
|
return ctx.text('Email not found', 404)
|
|
74
75
|
}
|
|
76
|
+
ctx.header('Content-Type', 'text/html; charset=utf-8')
|
|
75
77
|
return ctx.html(getPreviewHtml(entry, prefix))
|
|
76
78
|
})
|
|
77
79
|
)
|
|
@@ -89,6 +91,7 @@ export class DevServer {
|
|
|
89
91
|
if (!entry) {
|
|
90
92
|
return ctx.text('Not found', 404)
|
|
91
93
|
}
|
|
94
|
+
ctx.header('Content-Type', 'text/html; charset=utf-8')
|
|
92
95
|
return ctx.html(entry.html)
|
|
93
96
|
})
|
|
94
97
|
)
|
package/src/dev/ui/preview.ts
CHANGED
|
@@ -20,7 +20,42 @@ export function getPreviewHtml(entry: MailboxEntry, prefix: string): string {
|
|
|
20
20
|
<div style="font-size: 18px; font-weight: bold; margin-bottom: 10px;">${entry.envelope.subject || '(No Subject)'}</div>
|
|
21
21
|
<div class="meta" style="margin-bottom: 5px;">From: ${from}</div>
|
|
22
22
|
<div class="meta" style="margin-bottom: 5px;">To: ${to}</div>
|
|
23
|
+
${
|
|
24
|
+
entry.envelope.cc
|
|
25
|
+
? `<div class="meta" style="margin-bottom: 5px;">CC: ${entry.envelope.cc.map((t) => t.address).join(', ')}</div>`
|
|
26
|
+
: ''
|
|
27
|
+
}
|
|
28
|
+
${
|
|
29
|
+
entry.envelope.bcc
|
|
30
|
+
? `<div class="meta" style="margin-bottom: 5px;">BCC: ${entry.envelope.bcc.map((t) => t.address).join(', ')}</div>`
|
|
31
|
+
: ''
|
|
32
|
+
}
|
|
33
|
+
${entry.envelope.priority ? `<div class="meta" style="margin-bottom: 5px;">Priority: ${entry.envelope.priority}</div>` : ''}
|
|
23
34
|
<div class="meta">Date: ${entry.sentAt.toLocaleString()}</div>
|
|
35
|
+
${
|
|
36
|
+
entry.envelope.attachments && entry.envelope.attachments.length > 0
|
|
37
|
+
? `
|
|
38
|
+
<div style="margin-top: 15px; border-top: 1px solid var(--border); padding-top: 10px;">
|
|
39
|
+
<div style="font-size: 14px; font-weight: bold; margin-bottom: 5px; color: var(--text-muted);">Attachments (${entry.envelope.attachments.length})</div>
|
|
40
|
+
<div style="display: flex; gap: 10px; flex-wrap: wrap;">
|
|
41
|
+
${entry.envelope.attachments
|
|
42
|
+
.map(
|
|
43
|
+
(att) => `
|
|
44
|
+
<div style="background: var(--bg-dark); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border); display: flex; align-items: center; gap: 8px;">
|
|
45
|
+
<span style="font-size: 20px;">📎</span>
|
|
46
|
+
<div>
|
|
47
|
+
<div style="font-size: 14px; font-weight: 500;">${att.filename || 'untitled'}</div>
|
|
48
|
+
<div style="font-size: 12px; color: var(--text-muted);">${att.contentType || 'application/octet-stream'}</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
`
|
|
52
|
+
)
|
|
53
|
+
.join('')}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
`
|
|
57
|
+
: ''
|
|
58
|
+
}
|
|
24
59
|
</div>
|
|
25
60
|
|
|
26
61
|
<div style="margin-bottom: 10px;">
|
package/src/dev/ui/shared.ts
CHANGED
package/tests/dev-server.test.ts
CHANGED
|
@@ -34,6 +34,7 @@ describe('DevServer', () => {
|
|
|
34
34
|
|
|
35
35
|
const list = await core.routes.get('/__mail')?.({
|
|
36
36
|
html: (body: string) => body,
|
|
37
|
+
header: () => {},
|
|
37
38
|
})
|
|
38
39
|
expect(list).toContain('Hello')
|
|
39
40
|
|
|
@@ -41,6 +42,7 @@ describe('DevServer', () => {
|
|
|
41
42
|
req: { param: () => entry.id },
|
|
42
43
|
html: (body: string) => body,
|
|
43
44
|
text: () => '',
|
|
45
|
+
header: () => {},
|
|
44
46
|
})
|
|
45
47
|
expect(preview).toContain('Email Preview')
|
|
46
48
|
|