@csg-org/block-html 0.0.4-alpha.3 → 0.0.4-alpha.4
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/index.d.mts +97 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +114 -0
- package/dist/index.mjs +78 -0
- package/package.json +1 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const HtmlPropsSchema: z.ZodObject<{
|
|
5
|
+
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
6
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
backgroundColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
9
|
+
fontSize: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
10
|
+
textAlign: z.ZodNullable<z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>>;
|
|
11
|
+
padding: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
12
|
+
top: z.ZodNumber;
|
|
13
|
+
bottom: z.ZodNumber;
|
|
14
|
+
right: z.ZodNumber;
|
|
15
|
+
left: z.ZodNumber;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
top: number;
|
|
18
|
+
bottom: number;
|
|
19
|
+
right: number;
|
|
20
|
+
left: number;
|
|
21
|
+
}, {
|
|
22
|
+
top: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
right: number;
|
|
25
|
+
left: number;
|
|
26
|
+
}>>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
color?: string | null | undefined;
|
|
29
|
+
backgroundColor?: string | null | undefined;
|
|
30
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
31
|
+
fontSize?: number | null | undefined;
|
|
32
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
33
|
+
padding?: {
|
|
34
|
+
top: number;
|
|
35
|
+
bottom: number;
|
|
36
|
+
right: number;
|
|
37
|
+
left: number;
|
|
38
|
+
} | null | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
color?: string | null | undefined;
|
|
41
|
+
backgroundColor?: string | null | undefined;
|
|
42
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
43
|
+
fontSize?: number | null | undefined;
|
|
44
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
45
|
+
padding?: {
|
|
46
|
+
top: number;
|
|
47
|
+
bottom: number;
|
|
48
|
+
right: number;
|
|
49
|
+
left: number;
|
|
50
|
+
} | null | undefined;
|
|
51
|
+
}>>>;
|
|
52
|
+
props: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
53
|
+
contents: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
contents?: string | null | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
contents?: string | null | undefined;
|
|
58
|
+
}>>>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
style?: {
|
|
61
|
+
color?: string | null | undefined;
|
|
62
|
+
backgroundColor?: string | null | undefined;
|
|
63
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
64
|
+
fontSize?: number | null | undefined;
|
|
65
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
66
|
+
padding?: {
|
|
67
|
+
top: number;
|
|
68
|
+
bottom: number;
|
|
69
|
+
right: number;
|
|
70
|
+
left: number;
|
|
71
|
+
} | null | undefined;
|
|
72
|
+
} | null | undefined;
|
|
73
|
+
props?: {
|
|
74
|
+
contents?: string | null | undefined;
|
|
75
|
+
} | null | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
style?: {
|
|
78
|
+
color?: string | null | undefined;
|
|
79
|
+
backgroundColor?: string | null | undefined;
|
|
80
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
81
|
+
fontSize?: number | null | undefined;
|
|
82
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
83
|
+
padding?: {
|
|
84
|
+
top: number;
|
|
85
|
+
bottom: number;
|
|
86
|
+
right: number;
|
|
87
|
+
left: number;
|
|
88
|
+
} | null | undefined;
|
|
89
|
+
} | null | undefined;
|
|
90
|
+
props?: {
|
|
91
|
+
contents?: string | null | undefined;
|
|
92
|
+
} | null | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
type HtmlProps = z.infer<typeof HtmlPropsSchema>;
|
|
95
|
+
declare function Html({ style, props }: HtmlProps): React.JSX.Element;
|
|
96
|
+
|
|
97
|
+
export { Html, type HtmlProps, HtmlPropsSchema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const HtmlPropsSchema: z.ZodObject<{
|
|
5
|
+
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
6
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
backgroundColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
9
|
+
fontSize: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
10
|
+
textAlign: z.ZodNullable<z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>>;
|
|
11
|
+
padding: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
12
|
+
top: z.ZodNumber;
|
|
13
|
+
bottom: z.ZodNumber;
|
|
14
|
+
right: z.ZodNumber;
|
|
15
|
+
left: z.ZodNumber;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
top: number;
|
|
18
|
+
bottom: number;
|
|
19
|
+
right: number;
|
|
20
|
+
left: number;
|
|
21
|
+
}, {
|
|
22
|
+
top: number;
|
|
23
|
+
bottom: number;
|
|
24
|
+
right: number;
|
|
25
|
+
left: number;
|
|
26
|
+
}>>>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
color?: string | null | undefined;
|
|
29
|
+
backgroundColor?: string | null | undefined;
|
|
30
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
31
|
+
fontSize?: number | null | undefined;
|
|
32
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
33
|
+
padding?: {
|
|
34
|
+
top: number;
|
|
35
|
+
bottom: number;
|
|
36
|
+
right: number;
|
|
37
|
+
left: number;
|
|
38
|
+
} | null | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
color?: string | null | undefined;
|
|
41
|
+
backgroundColor?: string | null | undefined;
|
|
42
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
43
|
+
fontSize?: number | null | undefined;
|
|
44
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
45
|
+
padding?: {
|
|
46
|
+
top: number;
|
|
47
|
+
bottom: number;
|
|
48
|
+
right: number;
|
|
49
|
+
left: number;
|
|
50
|
+
} | null | undefined;
|
|
51
|
+
}>>>;
|
|
52
|
+
props: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
53
|
+
contents: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
contents?: string | null | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
contents?: string | null | undefined;
|
|
58
|
+
}>>>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
style?: {
|
|
61
|
+
color?: string | null | undefined;
|
|
62
|
+
backgroundColor?: string | null | undefined;
|
|
63
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
64
|
+
fontSize?: number | null | undefined;
|
|
65
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
66
|
+
padding?: {
|
|
67
|
+
top: number;
|
|
68
|
+
bottom: number;
|
|
69
|
+
right: number;
|
|
70
|
+
left: number;
|
|
71
|
+
} | null | undefined;
|
|
72
|
+
} | null | undefined;
|
|
73
|
+
props?: {
|
|
74
|
+
contents?: string | null | undefined;
|
|
75
|
+
} | null | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
style?: {
|
|
78
|
+
color?: string | null | undefined;
|
|
79
|
+
backgroundColor?: string | null | undefined;
|
|
80
|
+
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
81
|
+
fontSize?: number | null | undefined;
|
|
82
|
+
textAlign?: "right" | "left" | "center" | null | undefined;
|
|
83
|
+
padding?: {
|
|
84
|
+
top: number;
|
|
85
|
+
bottom: number;
|
|
86
|
+
right: number;
|
|
87
|
+
left: number;
|
|
88
|
+
} | null | undefined;
|
|
89
|
+
} | null | undefined;
|
|
90
|
+
props?: {
|
|
91
|
+
contents?: string | null | undefined;
|
|
92
|
+
} | null | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
type HtmlProps = z.infer<typeof HtmlPropsSchema>;
|
|
95
|
+
declare function Html({ style, props }: HtmlProps): React.JSX.Element;
|
|
96
|
+
|
|
97
|
+
export { Html, type HtmlProps, HtmlPropsSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.tsx
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
Html: () => Html,
|
|
34
|
+
HtmlPropsSchema: () => HtmlPropsSchema
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_zod = require("zod");
|
|
39
|
+
var FONT_FAMILY_SCHEMA = import_zod.z.enum([
|
|
40
|
+
"MODERN_SANS",
|
|
41
|
+
"BOOK_SANS",
|
|
42
|
+
"ORGANIC_SANS",
|
|
43
|
+
"GEOMETRIC_SANS",
|
|
44
|
+
"HEAVY_SANS",
|
|
45
|
+
"ROUNDED_SANS",
|
|
46
|
+
"MODERN_SERIF",
|
|
47
|
+
"BOOK_SERIF",
|
|
48
|
+
"MONOSPACE"
|
|
49
|
+
]).nullable().optional();
|
|
50
|
+
function getFontFamily(fontFamily) {
|
|
51
|
+
switch (fontFamily) {
|
|
52
|
+
case "MODERN_SANS":
|
|
53
|
+
return '"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif';
|
|
54
|
+
case "BOOK_SANS":
|
|
55
|
+
return 'Optima, Candara, "Noto Sans", source-sans-pro, sans-serif';
|
|
56
|
+
case "ORGANIC_SANS":
|
|
57
|
+
return 'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif';
|
|
58
|
+
case "GEOMETRIC_SANS":
|
|
59
|
+
return 'Avenir, "Avenir Next LT Pro", Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif';
|
|
60
|
+
case "HEAVY_SANS":
|
|
61
|
+
return 'Bahnschrift, "DIN Alternate", "Franklin Gothic Medium", "Nimbus Sans Narrow", sans-serif-condensed, sans-serif';
|
|
62
|
+
case "ROUNDED_SANS":
|
|
63
|
+
return 'ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, Manjari, "Arial Rounded MT Bold", Calibri, source-sans-pro, sans-serif';
|
|
64
|
+
case "MODERN_SERIF":
|
|
65
|
+
return 'Charter, "Bitstream Charter", "Sitka Text", Cambria, serif';
|
|
66
|
+
case "BOOK_SERIF":
|
|
67
|
+
return '"Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif';
|
|
68
|
+
case "MONOSPACE":
|
|
69
|
+
return '"Nimbus Mono PS", "Courier New", "Cutive Mono", monospace';
|
|
70
|
+
}
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
var COLOR_SCHEMA = import_zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
74
|
+
var PADDING_SCHEMA = import_zod.z.object({
|
|
75
|
+
top: import_zod.z.number(),
|
|
76
|
+
bottom: import_zod.z.number(),
|
|
77
|
+
right: import_zod.z.number(),
|
|
78
|
+
left: import_zod.z.number()
|
|
79
|
+
}).optional().nullable();
|
|
80
|
+
var getPadding = (padding) => padding ? `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px` : void 0;
|
|
81
|
+
var HtmlPropsSchema = import_zod.z.object({
|
|
82
|
+
style: import_zod.z.object({
|
|
83
|
+
color: COLOR_SCHEMA,
|
|
84
|
+
backgroundColor: COLOR_SCHEMA,
|
|
85
|
+
fontFamily: FONT_FAMILY_SCHEMA,
|
|
86
|
+
fontSize: import_zod.z.number().min(0).optional().nullable(),
|
|
87
|
+
textAlign: import_zod.z.enum(["left", "right", "center"]).optional().nullable(),
|
|
88
|
+
padding: PADDING_SCHEMA
|
|
89
|
+
}).optional().nullable(),
|
|
90
|
+
props: import_zod.z.object({
|
|
91
|
+
contents: import_zod.z.string().optional().nullable()
|
|
92
|
+
}).optional().nullable()
|
|
93
|
+
});
|
|
94
|
+
function Html({ style, props }) {
|
|
95
|
+
var _a, _b, _c, _d;
|
|
96
|
+
const children = props == null ? void 0 : props.contents;
|
|
97
|
+
const cssStyle = {
|
|
98
|
+
color: (_a = style == null ? void 0 : style.color) != null ? _a : void 0,
|
|
99
|
+
backgroundColor: (_b = style == null ? void 0 : style.backgroundColor) != null ? _b : void 0,
|
|
100
|
+
fontFamily: getFontFamily(style == null ? void 0 : style.fontFamily),
|
|
101
|
+
fontSize: (_c = style == null ? void 0 : style.fontSize) != null ? _c : void 0,
|
|
102
|
+
textAlign: (_d = style == null ? void 0 : style.textAlign) != null ? _d : void 0,
|
|
103
|
+
padding: getPadding(style == null ? void 0 : style.padding)
|
|
104
|
+
};
|
|
105
|
+
if (!children) {
|
|
106
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { style: cssStyle });
|
|
107
|
+
}
|
|
108
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
109
|
+
}
|
|
110
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
111
|
+
0 && (module.exports = {
|
|
112
|
+
Html,
|
|
113
|
+
HtmlPropsSchema
|
|
114
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// src/index.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
var FONT_FAMILY_SCHEMA = z.enum([
|
|
5
|
+
"MODERN_SANS",
|
|
6
|
+
"BOOK_SANS",
|
|
7
|
+
"ORGANIC_SANS",
|
|
8
|
+
"GEOMETRIC_SANS",
|
|
9
|
+
"HEAVY_SANS",
|
|
10
|
+
"ROUNDED_SANS",
|
|
11
|
+
"MODERN_SERIF",
|
|
12
|
+
"BOOK_SERIF",
|
|
13
|
+
"MONOSPACE"
|
|
14
|
+
]).nullable().optional();
|
|
15
|
+
function getFontFamily(fontFamily) {
|
|
16
|
+
switch (fontFamily) {
|
|
17
|
+
case "MODERN_SANS":
|
|
18
|
+
return '"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif';
|
|
19
|
+
case "BOOK_SANS":
|
|
20
|
+
return 'Optima, Candara, "Noto Sans", source-sans-pro, sans-serif';
|
|
21
|
+
case "ORGANIC_SANS":
|
|
22
|
+
return 'Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", source-sans-pro, sans-serif';
|
|
23
|
+
case "GEOMETRIC_SANS":
|
|
24
|
+
return 'Avenir, "Avenir Next LT Pro", Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif';
|
|
25
|
+
case "HEAVY_SANS":
|
|
26
|
+
return 'Bahnschrift, "DIN Alternate", "Franklin Gothic Medium", "Nimbus Sans Narrow", sans-serif-condensed, sans-serif';
|
|
27
|
+
case "ROUNDED_SANS":
|
|
28
|
+
return 'ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, Manjari, "Arial Rounded MT Bold", Calibri, source-sans-pro, sans-serif';
|
|
29
|
+
case "MODERN_SERIF":
|
|
30
|
+
return 'Charter, "Bitstream Charter", "Sitka Text", Cambria, serif';
|
|
31
|
+
case "BOOK_SERIF":
|
|
32
|
+
return '"Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif';
|
|
33
|
+
case "MONOSPACE":
|
|
34
|
+
return '"Nimbus Mono PS", "Courier New", "Cutive Mono", monospace';
|
|
35
|
+
}
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
var COLOR_SCHEMA = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
39
|
+
var PADDING_SCHEMA = z.object({
|
|
40
|
+
top: z.number(),
|
|
41
|
+
bottom: z.number(),
|
|
42
|
+
right: z.number(),
|
|
43
|
+
left: z.number()
|
|
44
|
+
}).optional().nullable();
|
|
45
|
+
var getPadding = (padding) => padding ? `${padding.top}px ${padding.right}px ${padding.bottom}px ${padding.left}px` : void 0;
|
|
46
|
+
var HtmlPropsSchema = z.object({
|
|
47
|
+
style: z.object({
|
|
48
|
+
color: COLOR_SCHEMA,
|
|
49
|
+
backgroundColor: COLOR_SCHEMA,
|
|
50
|
+
fontFamily: FONT_FAMILY_SCHEMA,
|
|
51
|
+
fontSize: z.number().min(0).optional().nullable(),
|
|
52
|
+
textAlign: z.enum(["left", "right", "center"]).optional().nullable(),
|
|
53
|
+
padding: PADDING_SCHEMA
|
|
54
|
+
}).optional().nullable(),
|
|
55
|
+
props: z.object({
|
|
56
|
+
contents: z.string().optional().nullable()
|
|
57
|
+
}).optional().nullable()
|
|
58
|
+
});
|
|
59
|
+
function Html({ style, props }) {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
const children = props == null ? void 0 : props.contents;
|
|
62
|
+
const cssStyle = {
|
|
63
|
+
color: (_a = style == null ? void 0 : style.color) != null ? _a : void 0,
|
|
64
|
+
backgroundColor: (_b = style == null ? void 0 : style.backgroundColor) != null ? _b : void 0,
|
|
65
|
+
fontFamily: getFontFamily(style == null ? void 0 : style.fontFamily),
|
|
66
|
+
fontSize: (_c = style == null ? void 0 : style.fontSize) != null ? _c : void 0,
|
|
67
|
+
textAlign: (_d = style == null ? void 0 : style.textAlign) != null ? _d : void 0,
|
|
68
|
+
padding: getPadding(style == null ? void 0 : style.padding)
|
|
69
|
+
};
|
|
70
|
+
if (!children) {
|
|
71
|
+
return /* @__PURE__ */ React.createElement("div", { style: cssStyle });
|
|
72
|
+
}
|
|
73
|
+
return /* @__PURE__ */ React.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
Html,
|
|
77
|
+
HtmlPropsSchema
|
|
78
|
+
};
|