@cripty2001/utils 0.0.259 → 0.0.261
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/dist/Appserver/client/react.d.ts +52 -0
- package/dist/Appserver/client/react.js +143 -0
- package/dist/Appserver/server.d.ts +4 -2
- package/dist/Appserver/server.js +40 -40
- package/dist/Appstorage.d.ts +1 -1
- package/dist/Appstorage.js +6 -10
- package/dist/Dispatcher.js +9 -13
- package/dist/Logger/Logger.js +5 -7
- package/dist/Searcher/index.js +1 -5
- package/dist/index.js +38 -70
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -5
- package/dist/react/logger-display.js +12 -18
- package/dist/react-ui/button.js +9 -12
- package/dist/react-ui/copiable.js +11 -14
- package/dist/react-ui/form.d.ts +2 -2
- package/dist/react-ui/form.js +13 -19
- package/dist/react-ui/index.d.ts +8 -8
- package/dist/react-ui/index.js +9 -22
- package/dist/react-ui/input.js +11 -14
- package/dist/react-ui/loader.d.ts +1 -1
- package/dist/react-ui/loader.js +9 -12
- package/dist/react-ui/modal.js +9 -12
- package/dist/react-ui/table.js +6 -9
- package/dist/react-ui/textButton.d.ts +1 -1
- package/dist/react-ui/textButton.js +4 -10
- package/dist/react-whispr.d.ts +3 -3
- package/dist/react-whispr.js +60 -76
- package/package.json +9 -2
- package/dist/Appserver/client.d.ts +0 -1
- package/dist/Appserver/client.js +0 -147
- package/dist/Appserver/common.d.ts +0 -3
- package/dist/Appserver/common.js +0 -2
- package/dist/MailTemplate/image.d.ts +0 -10
- package/dist/MailTemplate/image.js +0 -37
- package/dist/MailTemplate/index.d.ts +0 -31
- package/dist/MailTemplate/index.js +0 -90
- package/dist/MailTemplate/raw.d.ts +0 -7
- package/dist/MailTemplate/raw.js +0 -12
- package/dist/MailTemplate/text.d.ts +0 -13
- package/dist/MailTemplate/text.js +0 -28
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Static } from "@sinclair/typebox";
|
|
2
|
-
export declare const SCHEMA: import("@sinclair/typebox").TObject<{
|
|
3
|
-
type: import("@sinclair/typebox").TLiteral<"image">;
|
|
4
|
-
mobile: import("@sinclair/typebox").TString;
|
|
5
|
-
desktop: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
6
|
-
link: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
7
|
-
alt: import("@sinclair/typebox").TString;
|
|
8
|
-
}>;
|
|
9
|
-
export type T = Static<typeof SCHEMA>;
|
|
10
|
-
export declare function build(config: T): string;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SCHEMA = void 0;
|
|
4
|
-
exports.build = build;
|
|
5
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
6
|
-
exports.SCHEMA = typebox_1.Type.Object({
|
|
7
|
-
type: typebox_1.Type.Literal("image"),
|
|
8
|
-
mobile: typebox_1.Type.String(),
|
|
9
|
-
desktop: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
|
|
10
|
-
link: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Null()]),
|
|
11
|
-
alt: typebox_1.Type.String()
|
|
12
|
-
});
|
|
13
|
-
function build(config) {
|
|
14
|
-
const img = (breakpoint, url) => `
|
|
15
|
-
<mj-image
|
|
16
|
-
css-class="${breakpoint ?? ''}"
|
|
17
|
-
src="${url}"
|
|
18
|
-
alt="${config.alt}"
|
|
19
|
-
${config.link ? `href="${config.link}"` : ''}
|
|
20
|
-
padding="0"
|
|
21
|
-
/>
|
|
22
|
-
`;
|
|
23
|
-
const imgs = config.desktop === null ?
|
|
24
|
-
img(null, config.mobile) :
|
|
25
|
-
[
|
|
26
|
-
img("onlyDesktop", config.desktop),
|
|
27
|
-
img("onlyMobile", config.mobile)
|
|
28
|
-
].join('\n');
|
|
29
|
-
const toReturn = `
|
|
30
|
-
<mj-section padding="0">
|
|
31
|
-
<mj-column padding="0">
|
|
32
|
-
${imgs}
|
|
33
|
-
</mj-column>
|
|
34
|
-
</mj-section>
|
|
35
|
-
`;
|
|
36
|
-
return toReturn;
|
|
37
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type Static } from "@sinclair/typebox";
|
|
2
|
-
export declare const TEMPLATE_SCHEMA: import("@sinclair/typebox").TObject<{
|
|
3
|
-
style: import("@sinclair/typebox").TObject<{
|
|
4
|
-
font: import("@sinclair/typebox").TString;
|
|
5
|
-
backgroundColor: import("@sinclair/typebox").TString;
|
|
6
|
-
textColor: import("@sinclair/typebox").TString;
|
|
7
|
-
}>;
|
|
8
|
-
content: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
9
|
-
type: import("@sinclair/typebox").TLiteral<"image">;
|
|
10
|
-
mobile: import("@sinclair/typebox").TString;
|
|
11
|
-
desktop: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
12
|
-
link: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
13
|
-
alt: import("@sinclair/typebox").TString;
|
|
14
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
15
|
-
type: import("@sinclair/typebox").TLiteral<"text">;
|
|
16
|
-
size: import("@sinclair/typebox").TNumber;
|
|
17
|
-
weight: import("@sinclair/typebox").TNumber;
|
|
18
|
-
color: import("@sinclair/typebox").TString;
|
|
19
|
-
padding: import("@sinclair/typebox").TObject<{
|
|
20
|
-
top: import("@sinclair/typebox").TNumber;
|
|
21
|
-
}>;
|
|
22
|
-
content: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
23
|
-
}>, import("@sinclair/typebox").TObject<{
|
|
24
|
-
type: import("@sinclair/typebox").TLiteral<"raw">;
|
|
25
|
-
data: import("@sinclair/typebox").TString;
|
|
26
|
-
}>]>>;
|
|
27
|
-
}>;
|
|
28
|
-
export type Template = Static<typeof TEMPLATE_SCHEMA>;
|
|
29
|
-
export declare function genBuilder<T extends any>(config: Template): (params: T) => {
|
|
30
|
-
html: string;
|
|
31
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TEMPLATE_SCHEMA = void 0;
|
|
7
|
-
exports.genBuilder = genBuilder;
|
|
8
|
-
const handlebars_1 = __importDefault(require("handlebars"));
|
|
9
|
-
const mjml_1 = __importDefault(require("mjml"));
|
|
10
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
11
|
-
const image_1 = require("./image");
|
|
12
|
-
const raw_1 = require("./raw");
|
|
13
|
-
const text_1 = require("./text");
|
|
14
|
-
exports.TEMPLATE_SCHEMA = typebox_1.Type.Object({
|
|
15
|
-
style: typebox_1.Type.Object({
|
|
16
|
-
font: typebox_1.Type.String(),
|
|
17
|
-
backgroundColor: typebox_1.Type.String(),
|
|
18
|
-
textColor: typebox_1.Type.String()
|
|
19
|
-
}),
|
|
20
|
-
content: typebox_1.Type.Array(typebox_1.Type.Union([
|
|
21
|
-
image_1.SCHEMA,
|
|
22
|
-
text_1.SCHEMA,
|
|
23
|
-
raw_1.SCHEMA
|
|
24
|
-
]))
|
|
25
|
-
});
|
|
26
|
-
function genBuilder(config) {
|
|
27
|
-
const mappedContent = config.content
|
|
28
|
-
.map(item => {
|
|
29
|
-
switch (item.type) {
|
|
30
|
-
case "image":
|
|
31
|
-
return (0, image_1.build)(item);
|
|
32
|
-
case "raw":
|
|
33
|
-
return (0, raw_1.build)(item);
|
|
34
|
-
case "text":
|
|
35
|
-
return (0, text_1.build)(item);
|
|
36
|
-
default:
|
|
37
|
-
// @ts-expect-error Should never happen
|
|
38
|
-
throw new Error(`Invalid type ${item.type}`);
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
.join('\n');
|
|
42
|
-
const builder = handlebars_1.default.compile(`
|
|
43
|
-
<mjml>
|
|
44
|
-
<mj-head>
|
|
45
|
-
<mj-style>
|
|
46
|
-
.onlyMobile {
|
|
47
|
-
display: none !important;
|
|
48
|
-
}
|
|
49
|
-
.onlyDesktop {
|
|
50
|
-
display: block !important;
|
|
51
|
-
}
|
|
52
|
-
@media only screen and (max-width: 500px) {
|
|
53
|
-
.onlyMobile {
|
|
54
|
-
display: block !important;
|
|
55
|
-
}
|
|
56
|
-
.onlyDesktop {
|
|
57
|
-
display: none !important;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
</mj-style>
|
|
61
|
-
|
|
62
|
-
<mj-attributes>
|
|
63
|
-
<mj-all
|
|
64
|
-
font-family="${config.style.font}, Arial, Helvetica, sans-serif"
|
|
65
|
-
/>
|
|
66
|
-
<mj-text
|
|
67
|
-
font-size="18px"
|
|
68
|
-
line-height="1.5"
|
|
69
|
-
color="${config.style.textColor}"
|
|
70
|
-
/>
|
|
71
|
-
<mj-body width="700px" />
|
|
72
|
-
</mj-attributes>
|
|
73
|
-
</mj-head>
|
|
74
|
-
|
|
75
|
-
<mj-body background-color="${config.style.backgroundColor}">
|
|
76
|
-
${mappedContent}
|
|
77
|
-
</mj-body>
|
|
78
|
-
</mjml>
|
|
79
|
-
`);
|
|
80
|
-
return (data) => {
|
|
81
|
-
let { html, errors } = (0, mjml_1.default)(builder(data), {
|
|
82
|
-
validationLevel: 'soft'
|
|
83
|
-
});
|
|
84
|
-
if (errors.length > 0)
|
|
85
|
-
throw new Error(`Invalid template: ${errors.map(e => e.message).join(', ')}`);
|
|
86
|
-
return {
|
|
87
|
-
html: html,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type Static } from "@sinclair/typebox";
|
|
2
|
-
export declare const SCHEMA: import("@sinclair/typebox").TObject<{
|
|
3
|
-
type: import("@sinclair/typebox").TLiteral<"raw">;
|
|
4
|
-
data: import("@sinclair/typebox").TString;
|
|
5
|
-
}>;
|
|
6
|
-
export type T = Static<typeof SCHEMA>;
|
|
7
|
-
export declare function build(config: T): string;
|
package/dist/MailTemplate/raw.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SCHEMA = void 0;
|
|
4
|
-
exports.build = build;
|
|
5
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
6
|
-
exports.SCHEMA = typebox_1.Type.Object({
|
|
7
|
-
type: typebox_1.Type.Literal("raw"),
|
|
8
|
-
data: typebox_1.Type.String()
|
|
9
|
-
});
|
|
10
|
-
function build(config) {
|
|
11
|
-
return config.data;
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type Static } from "@sinclair/typebox";
|
|
2
|
-
export declare const SCHEMA: import("@sinclair/typebox").TObject<{
|
|
3
|
-
type: import("@sinclair/typebox").TLiteral<"text">;
|
|
4
|
-
size: import("@sinclair/typebox").TNumber;
|
|
5
|
-
weight: import("@sinclair/typebox").TNumber;
|
|
6
|
-
color: import("@sinclair/typebox").TString;
|
|
7
|
-
padding: import("@sinclair/typebox").TObject<{
|
|
8
|
-
top: import("@sinclair/typebox").TNumber;
|
|
9
|
-
}>;
|
|
10
|
-
content: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
11
|
-
}>;
|
|
12
|
-
export type T = Static<typeof SCHEMA>;
|
|
13
|
-
export declare function build(config: T): string;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SCHEMA = void 0;
|
|
4
|
-
exports.build = build;
|
|
5
|
-
const typebox_1 = require("@sinclair/typebox");
|
|
6
|
-
exports.SCHEMA = typebox_1.Type.Object({
|
|
7
|
-
type: typebox_1.Type.Literal("text"),
|
|
8
|
-
size: typebox_1.Type.Number(),
|
|
9
|
-
weight: typebox_1.Type.Number(),
|
|
10
|
-
color: typebox_1.Type.String(),
|
|
11
|
-
padding: typebox_1.Type.Object({
|
|
12
|
-
top: typebox_1.Type.Number()
|
|
13
|
-
}),
|
|
14
|
-
content: typebox_1.Type.Array(typebox_1.Type.String())
|
|
15
|
-
});
|
|
16
|
-
function build(config) {
|
|
17
|
-
return `
|
|
18
|
-
<mj-section padding="0">
|
|
19
|
-
<mj-column padding-top="${config.padding.top}px">
|
|
20
|
-
${config.content.map(item => `
|
|
21
|
-
<mj-text font-size="${config.size}px" font-weight="${config.weight}" color="${config.color}">
|
|
22
|
-
${item}
|
|
23
|
-
</mj-text>
|
|
24
|
-
`).join('')}
|
|
25
|
-
</mj-column>
|
|
26
|
-
</mj-section>
|
|
27
|
-
`;
|
|
28
|
-
}
|