@palmyit/elements 0.1.7 → 0.1.8
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/definitions.d.ts +23 -20
- package/dist/definitions.js +692 -686
- package/dist/elements/button/definition.d.ts +38 -0
- package/dist/elements/button/template.d.ts +2 -0
- package/dist/elements/checkbox/definition.d.ts +10 -0
- package/dist/elements/checkbox/template.d.ts +2 -0
- package/dist/elements/container/definition.d.ts +39 -0
- package/dist/elements/container/template.d.ts +2 -0
- package/dist/elements/divider/definition.d.ts +10 -0
- package/dist/elements/divider/template.d.ts +2 -0
- package/dist/elements/icon/definition.d.ts +18 -0
- package/dist/elements/icon/template.d.ts +2 -0
- package/dist/{schema/PImage/pImage.definition.d.ts → elements/image/definition.d.ts} +8 -8
- package/dist/elements/image/template.d.ts +2 -0
- package/dist/elements/list/definition.d.ts +11 -0
- package/dist/elements/list/template.d.ts +2 -0
- package/dist/elements/page/definition.d.ts +22 -0
- package/dist/elements/page/template.d.ts +2 -0
- package/dist/elements/radio/definition.d.ts +13 -0
- package/dist/elements/radio/template.d.ts +2 -0
- package/dist/elements/rich-text/definition.d.ts +8 -0
- package/dist/elements/rich-text/template.d.ts +2 -0
- package/dist/elements/section/definition.d.ts +39 -0
- package/dist/elements/section/template.d.ts +2 -0
- package/dist/elements/select/definition.d.ts +13 -0
- package/dist/elements/select/template.d.ts +2 -0
- package/dist/{schema/PTable/pTable.definition.d.ts → elements/table/definition.d.ts} +2 -2
- package/dist/elements/table/template.d.ts +2 -0
- package/dist/{schema/PText/pText.definition.d.ts → elements/text/definition.d.ts} +9 -9
- package/dist/elements/text/template.d.ts +2 -0
- package/dist/elements/text-area/definition.d.ts +10 -0
- package/dist/elements/text-area/template.d.ts +2 -0
- package/dist/elements/text-field/definition.d.ts +10 -0
- package/dist/elements/text-field/template.d.ts +2 -0
- package/dist/elements/video/definition.d.ts +10 -0
- package/dist/elements/video/template.d.ts +2 -0
- package/dist/manifest.json +2 -2
- package/dist/plmt-elements.css +2 -1
- package/dist/render/styleToClasses.d.ts +35 -0
- package/dist/render/styleTokens.d.ts +57 -0
- package/dist/render/types.d.ts +6 -0
- package/dist/schema/Fields/BackgroundField/backgroundValue.d.ts +4 -3
- package/dist/schema/backgroundStyleDefinitions.d.ts +1 -6
- package/dist/schema/elementRegistry.d.ts +14 -14
- package/dist/schema/elementStyleDefinitions.d.ts +1 -1
- package/dist/schema/style/elementStyle.d.ts +2 -2
- package/dist/schema/style/page-styles.d.ts +2 -2
- package/dist/schema/styleTokensSchema.d.ts +274 -0
- package/dist/styleToClasses-CZSWp6Ez.js +683 -0
- package/dist/templates/elementSpec.d.ts +2 -7
- package/dist/templates/helpers.d.ts +9 -1
- package/dist/templates.d.ts +3 -1
- package/dist/templates.js +252 -172
- package/package.json +3 -1
- package/dist/schema/PButton/pButton.definition.d.ts +0 -38
- package/dist/schema/PCheckbox/pCheckbox.definition.d.ts +0 -10
- package/dist/schema/PContainer/pContainer.definition.d.ts +0 -39
- package/dist/schema/PDivider/pDivider.definition.d.ts +0 -10
- package/dist/schema/PIcon/pIcon.definition.d.ts +0 -18
- package/dist/schema/PList/pList.definition.d.ts +0 -11
- package/dist/schema/PPage/pPage.definition.d.ts +0 -22
- package/dist/schema/PRadio/pRadio.definition.d.ts +0 -13
- package/dist/schema/PRichText/pRichText.definition.d.ts +0 -8
- package/dist/schema/PSection/pSection.definition.d.ts +0 -39
- package/dist/schema/PSelect/pSelect.definition.d.ts +0 -13
- package/dist/schema/PTextArea/pTextArea.definition.d.ts +0 -10
- package/dist/schema/PTextField/pTextField.definition.d.ts +0 -10
- package/dist/schema/PVideo/pVideo.definition.d.ts +0 -10
- /package/dist/{schema/PRichText → elements/rich-text}/richTextMarks.d.ts +0 -0
- /package/dist/{schema/PRichText → elements/rich-text}/richTextOptions.d.ts +0 -0
package/dist/definitions.js
CHANGED
|
@@ -1,52 +1,245 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, o as u, p as ee, r as te, s as ne, t as re, u as ie } from "./styleToClasses-CZSWp6Ez.js";
|
|
2
|
+
import { z as d } from "zod";
|
|
2
3
|
// src/schema/elementConfiguration.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
4
|
+
var f = d.string().trim().min(1);
|
|
5
|
+
function p(e) {
|
|
5
6
|
return e;
|
|
6
7
|
}
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var ae = /^[#0-9a-z%.,\s()-]+$/i, oe = /url|var|image|expression|attr/i;
|
|
9
|
+
function m(e) {
|
|
9
10
|
let t = e.trim();
|
|
10
|
-
return t !== "" && t.length <= 200 &&
|
|
11
|
-
}
|
|
12
|
-
function
|
|
13
|
-
if (
|
|
14
|
-
}
|
|
15
|
-
// src/schema/
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
return t !== "" && t.length <= 200 && ae.test(t) && !oe.test(t);
|
|
12
|
+
}
|
|
13
|
+
function se(e) {
|
|
14
|
+
if (m(e.value)) return `${e.kind}-gradient(${e.value.trim()})`;
|
|
15
|
+
}
|
|
16
|
+
// src/schema/style/page-styles.ts
|
|
17
|
+
var ce = /^#[0-9A-Fa-f]{6}$/;
|
|
18
|
+
function le(e) {
|
|
19
|
+
return ce.test(e) ? [
|
|
20
|
+
Number.parseInt(e.slice(1, 3), 16),
|
|
21
|
+
Number.parseInt(e.slice(3, 5), 16),
|
|
22
|
+
Number.parseInt(e.slice(5, 7), 16)
|
|
23
|
+
] : null;
|
|
24
|
+
}
|
|
25
|
+
function ue(e) {
|
|
26
|
+
if (ee(e)) return l(e);
|
|
27
|
+
let t = le(e.hex);
|
|
28
|
+
if (!t || !Number.isFinite(e.opacity)) return;
|
|
29
|
+
if (e.opacity === 100) return e.hex.toUpperCase();
|
|
30
|
+
let n = Math.min(100, Math.max(0, e.opacity)) / 100, [r, i, a] = t;
|
|
31
|
+
return `rgba(${r}, ${i}, ${a}, ${n})`;
|
|
32
|
+
}
|
|
33
|
+
function de(e) {
|
|
34
|
+
if (!(!Number.isFinite(e) || e <= 0)) return `${e}px`;
|
|
35
|
+
}
|
|
36
|
+
// src/schema/style/backgroundStyle.ts
|
|
37
|
+
function fe(e) {
|
|
38
|
+
if (e.backgroundType === "gradient") return "transparent";
|
|
39
|
+
if (e.backgroundColor) return ee(e.backgroundColor) ? l(e.backgroundColor) : ue(e.backgroundColor);
|
|
40
|
+
}
|
|
41
|
+
function pe(e) {
|
|
42
|
+
if (e.backgroundType !== "gradient") return "none";
|
|
43
|
+
if (e.backgroundGradient) return se(e.backgroundGradient);
|
|
44
|
+
}
|
|
45
|
+
function me(e, t) {
|
|
46
|
+
return e.backgroundType ? {
|
|
47
|
+
[`${t}-background-color`]: fe(e),
|
|
48
|
+
[`${t}-background-image`]: pe(e)
|
|
49
|
+
} : {};
|
|
50
|
+
}
|
|
51
|
+
// src/schema/style/elementStyle.ts
|
|
52
|
+
var h = [
|
|
53
|
+
"none",
|
|
54
|
+
"solid",
|
|
55
|
+
"dashed",
|
|
56
|
+
"dotted",
|
|
57
|
+
"double"
|
|
58
|
+
], he = [
|
|
59
|
+
"row",
|
|
60
|
+
"column",
|
|
61
|
+
"row-reverse",
|
|
62
|
+
"column-reverse"
|
|
63
|
+
], ge = [
|
|
64
|
+
"nowrap",
|
|
65
|
+
"wrap",
|
|
66
|
+
"wrap-reverse"
|
|
67
|
+
], _e = [
|
|
68
|
+
"flex-start",
|
|
69
|
+
"center",
|
|
70
|
+
"flex-end",
|
|
71
|
+
"space-between",
|
|
72
|
+
"space-around",
|
|
73
|
+
"space-evenly"
|
|
74
|
+
], ve = [
|
|
75
|
+
"stretch",
|
|
76
|
+
"flex-start",
|
|
77
|
+
"center",
|
|
78
|
+
"flex-end",
|
|
79
|
+
"baseline"
|
|
80
|
+
], ye = ["stretch", ..._e], g = {
|
|
81
|
+
layout: "block",
|
|
82
|
+
flexDirection: "row",
|
|
83
|
+
flexWrap: "nowrap",
|
|
84
|
+
justifyContent: "flex-start",
|
|
85
|
+
alignItems: "stretch",
|
|
86
|
+
alignContent: "stretch",
|
|
87
|
+
rowGap: "0",
|
|
88
|
+
columnGap: "0",
|
|
89
|
+
backgroundType: "color",
|
|
90
|
+
backgroundColor: {
|
|
91
|
+
hex: "#FFFFFF",
|
|
92
|
+
opacity: 0
|
|
93
|
+
},
|
|
94
|
+
overflow: "show",
|
|
95
|
+
overflowVertical: !0,
|
|
96
|
+
overflowHorizontal: !0,
|
|
97
|
+
width: "auto",
|
|
98
|
+
height: "auto",
|
|
99
|
+
minWidth: "auto",
|
|
100
|
+
minHeight: "auto",
|
|
101
|
+
maxWidth: "auto",
|
|
102
|
+
maxHeight: "auto",
|
|
103
|
+
paddingTop: "auto",
|
|
104
|
+
paddingBottom: "auto",
|
|
105
|
+
paddingLeft: "auto",
|
|
106
|
+
paddingRight: "auto",
|
|
107
|
+
marginTop: "0",
|
|
108
|
+
marginBottom: "0",
|
|
109
|
+
marginLeft: "0",
|
|
110
|
+
marginRight: "0",
|
|
111
|
+
borderRadiusTopLeft: "0",
|
|
112
|
+
borderRadiusTopRight: "0",
|
|
113
|
+
borderRadiusBottomRight: "0",
|
|
114
|
+
borderRadiusBottomLeft: "0",
|
|
115
|
+
borderWidth: "0",
|
|
116
|
+
borderStyle: "solid",
|
|
117
|
+
borderColor: {
|
|
118
|
+
hex: "#000000",
|
|
119
|
+
opacity: 100
|
|
120
|
+
}
|
|
121
|
+
}, _ = /^(auto|0|-?\d+(\.\d+)?(px|rem|em|%))$/i, be = /^(0|\d+(\.\d+)?(px|rem|em))$/i;
|
|
122
|
+
function v(e) {
|
|
123
|
+
let t = e.trim();
|
|
124
|
+
if (_.test(t)) return t;
|
|
125
|
+
}
|
|
126
|
+
function y(e) {
|
|
127
|
+
let t = v(e);
|
|
128
|
+
if (t != null) return t.toLowerCase() === "auto" ? "0" : t;
|
|
129
|
+
}
|
|
130
|
+
function xe(e) {
|
|
131
|
+
let t = v(e);
|
|
132
|
+
return t?.toLowerCase() === "auto" ? "none" : t;
|
|
133
|
+
}
|
|
134
|
+
function Se(e) {
|
|
135
|
+
let t = e.trim();
|
|
136
|
+
return be.test(t) ? t : void 0;
|
|
137
|
+
}
|
|
138
|
+
function Ce(e, t) {
|
|
139
|
+
return e === "hide" ? "hidden" : t ? "auto" : "hidden";
|
|
140
|
+
}
|
|
141
|
+
var we = [
|
|
142
|
+
"marginTop",
|
|
143
|
+
"marginBottom",
|
|
144
|
+
"marginLeft",
|
|
145
|
+
"marginRight"
|
|
146
|
+
];
|
|
147
|
+
function Te(e) {
|
|
148
|
+
return e.trim().toLowerCase() === "auto";
|
|
149
|
+
}
|
|
150
|
+
function b(e, t) {
|
|
151
|
+
return we.every((t) => Te(e[t])) ? "0" : v(e[t]);
|
|
152
|
+
}
|
|
153
|
+
function Ee(e) {
|
|
154
|
+
return e.layout !== "grid" || e.gridColumns == null ? "none" : `repeat(${e.gridColumns}, minmax(0, 1fr))`;
|
|
155
|
+
}
|
|
156
|
+
function De(e, t) {
|
|
157
|
+
let n = {
|
|
158
|
+
...g,
|
|
159
|
+
...e
|
|
160
|
+
}, r = `--palmyit-${t}`;
|
|
161
|
+
return {
|
|
162
|
+
[`${r}-display`]: n.layout,
|
|
163
|
+
[`${r}-grid-template-columns`]: Ee(n),
|
|
164
|
+
[`${r}-flex-direction`]: n.flexDirection,
|
|
165
|
+
[`${r}-flex-wrap`]: n.flexWrap,
|
|
166
|
+
[`${r}-justify-content`]: n.justifyContent,
|
|
167
|
+
[`${r}-align-items`]: n.alignItems,
|
|
168
|
+
[`${r}-align-content`]: n.alignContent,
|
|
169
|
+
[`${r}-row-gap`]: y(n.rowGap),
|
|
170
|
+
[`${r}-column-gap`]: y(n.columnGap),
|
|
171
|
+
[`${r}-overflow-x`]: Ce(n.overflow, n.overflowHorizontal),
|
|
172
|
+
[`${r}-overflow-y`]: Ce(n.overflow, n.overflowVertical),
|
|
173
|
+
[`${r}-width`]: v(n.width),
|
|
174
|
+
[`${r}-height`]: v(n.height),
|
|
175
|
+
[`${r}-min-width`]: v(n.minWidth),
|
|
176
|
+
[`${r}-min-height`]: v(n.minHeight),
|
|
177
|
+
[`${r}-max-width`]: xe(n.maxWidth),
|
|
178
|
+
[`${r}-max-height`]: xe(n.maxHeight),
|
|
179
|
+
[`${r}-padding-top`]: y(n.paddingTop),
|
|
180
|
+
[`${r}-padding-bottom`]: y(n.paddingBottom),
|
|
181
|
+
[`${r}-padding-left`]: y(n.paddingLeft),
|
|
182
|
+
[`${r}-padding-right`]: y(n.paddingRight),
|
|
183
|
+
[`${r}-margin-top`]: b(n, "marginTop"),
|
|
184
|
+
[`${r}-margin-bottom`]: b(n, "marginBottom"),
|
|
185
|
+
[`${r}-margin-left`]: b(n, "marginLeft"),
|
|
186
|
+
[`${r}-margin-right`]: b(n, "marginRight"),
|
|
187
|
+
[`${r}-border-top-left-radius`]: y(n.borderRadiusTopLeft),
|
|
188
|
+
[`${r}-border-top-right-radius`]: y(n.borderRadiusTopRight),
|
|
189
|
+
[`${r}-border-bottom-right-radius`]: y(n.borderRadiusBottomRight),
|
|
190
|
+
[`${r}-border-bottom-left-radius`]: y(n.borderRadiusBottomLeft),
|
|
191
|
+
[`${r}-border-width`]: Se(n.borderWidth),
|
|
192
|
+
[`${r}-border-style`]: n.borderStyle,
|
|
193
|
+
[`${r}-border-color`]: ue(n.borderColor),
|
|
194
|
+
...me(n, r)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
// src/schema/styleTokensSchema.ts
|
|
198
|
+
var Oe = d.enum(ie), ke = d.enum(t), Ae = d.enum(c), je = d.enum(r), Me = d.enum(ne), Ne = d.enum(i), x = d.string().trim().regex(_, "Expected auto, 0, or a px, rem, em, or % length"), S = d.union([
|
|
199
|
+
Oe,
|
|
200
|
+
Ae,
|
|
201
|
+
x
|
|
202
|
+
]), Pe = d.union([ke, x]), Fe = d.union([
|
|
203
|
+
je,
|
|
204
|
+
d.number().min(1).max(200),
|
|
205
|
+
x
|
|
206
|
+
]), Ie = d.union([Me, x]), Le = d.union([Ne, x]), Re = d.strictObject({
|
|
207
|
+
hex: d.string().regex(/^#[0-9A-Fa-f]{6}$/, "Expected a #RRGGBB color"),
|
|
208
|
+
opacity: d.number().int().min(0).max(100)
|
|
209
|
+
}), ze = new Set(n), Be = d.strictObject({
|
|
210
|
+
name: d.enum(u),
|
|
211
|
+
opacity: d.number().int().refine((e) => ze.has(e), "Expected a Tailwind opacity step such as 0, 10, 50, or 100")
|
|
212
|
+
}), C = d.union([Be, Re]), Ve = d.strictObject({
|
|
213
|
+
kind: d.enum(["linear", "radial"]),
|
|
214
|
+
value: d.string().refine(m, "Expected gradient arguments such as 135deg, #2563EB, #7C3AED")
|
|
22
215
|
});
|
|
23
|
-
function
|
|
216
|
+
function w(e, { defaults: t, typeAttribute: n } = {}) {
|
|
24
217
|
return [
|
|
25
218
|
{
|
|
26
219
|
key: "backgroundType",
|
|
27
|
-
...
|
|
28
|
-
value:
|
|
29
|
-
defaultValue:
|
|
220
|
+
...n ? { attribute: n } : {},
|
|
221
|
+
value: d.enum(["color", "gradient"]),
|
|
222
|
+
defaultValue: t?.backgroundType,
|
|
30
223
|
label: "Background type"
|
|
31
224
|
},
|
|
32
225
|
{
|
|
33
226
|
key: "backgroundColor",
|
|
34
|
-
variable: `${
|
|
35
|
-
value:
|
|
36
|
-
defaultValue:
|
|
227
|
+
variable: `${e}-background-color`,
|
|
228
|
+
value: C,
|
|
229
|
+
defaultValue: t?.backgroundColor,
|
|
37
230
|
label: "Background color"
|
|
38
231
|
},
|
|
39
232
|
{
|
|
40
233
|
key: "backgroundGradient",
|
|
41
|
-
variable: `${
|
|
42
|
-
value:
|
|
43
|
-
defaultValue:
|
|
234
|
+
variable: `${e}-background-image`,
|
|
235
|
+
value: Ve,
|
|
236
|
+
defaultValue: t?.backgroundGradient,
|
|
44
237
|
label: "Background gradient"
|
|
45
238
|
}
|
|
46
239
|
];
|
|
47
240
|
}
|
|
48
241
|
// src/schema/device/devices.ts
|
|
49
|
-
var
|
|
242
|
+
var T = [
|
|
50
243
|
{
|
|
51
244
|
name: "Desktop",
|
|
52
245
|
icon: "Monitor",
|
|
@@ -79,26 +272,26 @@ var u = [
|
|
|
79
272
|
height: 360
|
|
80
273
|
}
|
|
81
274
|
}
|
|
82
|
-
],
|
|
275
|
+
], He = T.map(({ portrait: e, icon: t, name: n }) => ({
|
|
83
276
|
...e,
|
|
84
277
|
icon: t,
|
|
85
278
|
label: n
|
|
86
279
|
}));
|
|
87
|
-
function
|
|
88
|
-
return
|
|
280
|
+
function Ue(e) {
|
|
281
|
+
return T.find((t) => t.portrait.width === e || t.landscape?.width === e) ?? T[0];
|
|
89
282
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
283
|
+
function We(e) {
|
|
284
|
+
return Ue(e).landscape?.width === e ? "landscape" : "portrait";
|
|
92
285
|
}
|
|
93
286
|
// src/schema/deviceVisibility.ts
|
|
94
|
-
var
|
|
287
|
+
var E = {
|
|
95
288
|
Desktop: "showOnDesktop",
|
|
96
289
|
Tablet: "showOnTablet",
|
|
97
290
|
Mobile: "showOnMobile"
|
|
98
|
-
},
|
|
291
|
+
}, Ge = {
|
|
99
292
|
Tablet: "showOnTabletLandscape",
|
|
100
293
|
Mobile: "showOnMobileLandscape"
|
|
101
|
-
},
|
|
294
|
+
}, Ke = [...Object.values(E), ...Object.values(Ge)], qe = T.flatMap(({ name: e, landscape: t }) => t ? [{
|
|
102
295
|
device: e,
|
|
103
296
|
orientation: "portrait"
|
|
104
297
|
}, {
|
|
@@ -108,37 +301,37 @@ var d = {
|
|
|
108
301
|
device: e,
|
|
109
302
|
orientation: "portrait"
|
|
110
303
|
}]);
|
|
111
|
-
function
|
|
112
|
-
return (t === "landscape" ?
|
|
304
|
+
function Je(e, t) {
|
|
305
|
+
return (t === "landscape" ? Ge[e] : void 0) ?? E[e];
|
|
113
306
|
}
|
|
114
|
-
function
|
|
115
|
-
let r = e[
|
|
116
|
-
return r === void 0 ? e[
|
|
307
|
+
function D(e, t, n = "portrait") {
|
|
308
|
+
let r = e[Je(t, n)];
|
|
309
|
+
return r === void 0 ? e[E[t]] !== !1 : r;
|
|
117
310
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
311
|
+
function Ye(e) {
|
|
312
|
+
return qe.filter(({ device: t, orientation: n }) => D(e, t, n)).length;
|
|
120
313
|
}
|
|
121
314
|
// src/schema/styleItems.ts
|
|
122
|
-
var
|
|
123
|
-
key:
|
|
124
|
-
variable:
|
|
125
|
-
variables:
|
|
126
|
-
attribute:
|
|
127
|
-
value:
|
|
128
|
-
}),
|
|
315
|
+
var Xe = d.strictObject({
|
|
316
|
+
key: d.string(),
|
|
317
|
+
variable: d.string().optional(),
|
|
318
|
+
variables: d.record(d.string(), d.string()).optional(),
|
|
319
|
+
attribute: d.string().optional(),
|
|
320
|
+
value: d.unknown()
|
|
321
|
+
}), Ze = [
|
|
129
322
|
"variable",
|
|
130
323
|
"variables",
|
|
131
324
|
"attribute"
|
|
132
325
|
];
|
|
133
|
-
function
|
|
326
|
+
function Qe(e) {
|
|
134
327
|
let t = {};
|
|
135
328
|
for (let n of e) n.defaultValue !== void 0 && (t[n.key] = n.defaultValue);
|
|
136
329
|
return t;
|
|
137
330
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
331
|
+
function $e(e, t) {
|
|
332
|
+
return Ze.find((n) => JSON.stringify(e[n]) !== JSON.stringify(t[n]));
|
|
140
333
|
}
|
|
141
|
-
function
|
|
334
|
+
function et(e, t, n) {
|
|
142
335
|
if (!t) return {
|
|
143
336
|
field: "key",
|
|
144
337
|
message: `Unknown style key "${e.key}"`
|
|
@@ -147,28 +340,28 @@ function le(e, t, n) {
|
|
|
147
340
|
field: "key",
|
|
148
341
|
message: `Style key "${e.key}" appears twice`
|
|
149
342
|
};
|
|
150
|
-
let r =
|
|
343
|
+
let r = $e(e, t);
|
|
151
344
|
if (r) return {
|
|
152
345
|
field: r,
|
|
153
346
|
message: `Style "${e.key}" ${r} does not match the element configuration`
|
|
154
347
|
};
|
|
155
348
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
349
|
+
function O(e) {
|
|
350
|
+
return nt(e, () => Qe(e));
|
|
158
351
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
function
|
|
163
|
-
let
|
|
164
|
-
return
|
|
165
|
-
let i =
|
|
166
|
-
return e.forEach((e,
|
|
167
|
-
let o =
|
|
352
|
+
function tt(e) {
|
|
353
|
+
return nt(e, () => ({}));
|
|
354
|
+
}
|
|
355
|
+
function nt(e, t) {
|
|
356
|
+
let n = new Map(e.map((e) => [e.key, e]));
|
|
357
|
+
return d.array(Xe).default([]).transform((e, r) => {
|
|
358
|
+
let i = t(), a = /* @__PURE__ */ new Set();
|
|
359
|
+
return e.forEach((e, t) => {
|
|
360
|
+
let o = n.get(e.key), s = et(e, o, a);
|
|
168
361
|
if (s || !o) {
|
|
169
|
-
|
|
362
|
+
r.addIssue({
|
|
170
363
|
code: "custom",
|
|
171
|
-
path: [
|
|
364
|
+
path: [t, s?.field ?? "key"],
|
|
172
365
|
message: s?.message ?? ""
|
|
173
366
|
});
|
|
174
367
|
return;
|
|
@@ -178,40 +371,40 @@ function de(t, n) {
|
|
|
178
371
|
if (c.success) i[e.key] = c.data;
|
|
179
372
|
else {
|
|
180
373
|
let e = c.error.issues[0]?.message ?? "Invalid value";
|
|
181
|
-
|
|
374
|
+
r.addIssue({
|
|
182
375
|
code: "custom",
|
|
183
|
-
path: [
|
|
376
|
+
path: [t, "value"],
|
|
184
377
|
message: e
|
|
185
378
|
});
|
|
186
379
|
}
|
|
187
380
|
}), i;
|
|
188
381
|
});
|
|
189
382
|
}
|
|
190
|
-
function
|
|
191
|
-
let n = Object.fromEntries(
|
|
383
|
+
function rt(e, t) {
|
|
384
|
+
let n = Object.fromEntries(Ze.filter((t) => e[t] !== void 0).map((t) => [t, e[t]]));
|
|
192
385
|
return {
|
|
193
386
|
key: e.key,
|
|
194
387
|
...n,
|
|
195
388
|
value: t
|
|
196
389
|
};
|
|
197
390
|
}
|
|
198
|
-
function
|
|
391
|
+
function k(e, t = "") {
|
|
199
392
|
return Object.fromEntries(e.flatMap(({ key: e, label: n }) => n === void 0 ? [] : [[`${t}${e}`, n]]));
|
|
200
393
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
203
|
-
...
|
|
394
|
+
function A(e, t) {
|
|
395
|
+
return at({
|
|
396
|
+
...Qe(t),
|
|
204
397
|
...e
|
|
205
398
|
}, t);
|
|
206
399
|
}
|
|
207
|
-
function
|
|
208
|
-
return
|
|
400
|
+
function it(e, t) {
|
|
401
|
+
return at(e ?? {}, t);
|
|
209
402
|
}
|
|
210
|
-
function
|
|
211
|
-
return t.filter((t) => e[t.key] !== void 0).map((t) =>
|
|
403
|
+
function at(e, t) {
|
|
404
|
+
return t.filter((t) => e[t.key] !== void 0).map((t) => rt(t, e[t.key]));
|
|
212
405
|
}
|
|
213
406
|
// src/schema/deviceSettings.ts
|
|
214
|
-
var
|
|
407
|
+
var j = [
|
|
215
408
|
{
|
|
216
409
|
prop: "tabletStyle",
|
|
217
410
|
device: "Tablet"
|
|
@@ -228,87 +421,87 @@ var y = [
|
|
|
228
421
|
prop: "mobileLandscapeStyle",
|
|
229
422
|
device: "Landscape mobile"
|
|
230
423
|
}
|
|
231
|
-
],
|
|
424
|
+
], ot = {
|
|
232
425
|
showOnDesktop: "Show on desktop",
|
|
233
426
|
showOnTablet: "Show on portrait tablet",
|
|
234
427
|
showOnTabletLandscape: "Show on landscape tablet",
|
|
235
428
|
showOnMobile: "Show on portrait mobile",
|
|
236
429
|
showOnMobileLandscape: "Show on landscape mobile"
|
|
237
|
-
},
|
|
238
|
-
function
|
|
239
|
-
let
|
|
240
|
-
return
|
|
241
|
-
...
|
|
242
|
-
...
|
|
243
|
-
}).refine((e) =>
|
|
430
|
+
}, st = Object.fromEntries(Ke.map((e) => [e, d.boolean().optional()]));
|
|
431
|
+
function ct(e) {
|
|
432
|
+
let t = e ? Object.fromEntries(j.map(({ prop: t }) => [t, tt(e).optional()])) : {};
|
|
433
|
+
return d.strictObject({
|
|
434
|
+
...st,
|
|
435
|
+
...t
|
|
436
|
+
}).refine((e) => Ye(e) > 0, {
|
|
244
437
|
path: ["showOnDesktop"],
|
|
245
438
|
message: "Show the element on at least one device"
|
|
246
439
|
});
|
|
247
440
|
}
|
|
248
|
-
function
|
|
441
|
+
function lt(e, t, n) {
|
|
249
442
|
return Object.fromEntries(Object.entries(e).filter(([e]) => t.has(e) === n));
|
|
250
443
|
}
|
|
251
|
-
function
|
|
252
|
-
let
|
|
253
|
-
return
|
|
254
|
-
let
|
|
255
|
-
for (let e of [...
|
|
444
|
+
function ut(e, t) {
|
|
445
|
+
let n = new Set(Object.keys(t.shape));
|
|
446
|
+
return d.record(d.string(), d.unknown()).transform((r, i) => {
|
|
447
|
+
let a = e.safeParse(lt(r, n, !1)), o = t.safeParse(lt(r, n, !0));
|
|
448
|
+
for (let e of [...a.error?.issues ?? [], ...o.error?.issues ?? []]) i.addIssue({
|
|
256
449
|
code: "custom",
|
|
257
450
|
path: e.path,
|
|
258
451
|
message: e.message
|
|
259
452
|
});
|
|
260
|
-
return !
|
|
261
|
-
...
|
|
262
|
-
...
|
|
453
|
+
return !a.success || !o.success ? d.NEVER : {
|
|
454
|
+
...a.data,
|
|
455
|
+
...dt(o.data)
|
|
263
456
|
};
|
|
264
457
|
});
|
|
265
458
|
}
|
|
266
|
-
function
|
|
267
|
-
return Object.fromEntries(Object.entries(e).filter(([, e]) => !
|
|
459
|
+
function dt(e) {
|
|
460
|
+
return Object.fromEntries(Object.entries(e).filter(([, e]) => !ft(e)));
|
|
268
461
|
}
|
|
269
|
-
function
|
|
462
|
+
function ft(e) {
|
|
270
463
|
return e === void 0 || typeof e == "object" && !!e && Object.keys(e).length === 0;
|
|
271
464
|
}
|
|
272
|
-
function
|
|
273
|
-
return Object.fromEntries(
|
|
274
|
-
let r =
|
|
275
|
-
return (n === "portrait" ? !r : r !==
|
|
465
|
+
function pt(e) {
|
|
466
|
+
return Object.fromEntries(qe.flatMap(({ device: t, orientation: n }) => {
|
|
467
|
+
let r = D(e, t, n);
|
|
468
|
+
return (n === "portrait" ? !r : r !== D(e, t, "portrait")) ? [[Je(t, n), r]] : [];
|
|
276
469
|
}));
|
|
277
470
|
}
|
|
278
|
-
function
|
|
279
|
-
return Object.fromEntries(
|
|
280
|
-
let r =
|
|
471
|
+
function mt(e, t) {
|
|
472
|
+
return Object.fromEntries(j.flatMap(({ prop: n }) => {
|
|
473
|
+
let r = it(e[n], t);
|
|
281
474
|
return r.length > 0 ? [[n, r]] : [];
|
|
282
475
|
}));
|
|
283
476
|
}
|
|
284
|
-
function
|
|
477
|
+
function ht(e) {
|
|
285
478
|
return `${e.charAt(0).toLowerCase()}${e.slice(1)}`;
|
|
286
479
|
}
|
|
287
|
-
function
|
|
288
|
-
return Object.fromEntries(
|
|
480
|
+
function gt(e) {
|
|
481
|
+
return Object.fromEntries(j.flatMap(({ prop: t, device: n }) => Object.entries(k(e, `${t}.`)).map(([e, t]) => [e, `${n} ${ht(t)}`])));
|
|
289
482
|
}
|
|
290
|
-
function
|
|
483
|
+
function M(e, t) {
|
|
291
484
|
return {
|
|
292
485
|
...e,
|
|
293
|
-
attributes:
|
|
486
|
+
attributes: ut(e.attributes, ct(t)),
|
|
294
487
|
toDocumentAttributes: (n) => ({
|
|
295
488
|
...e.toDocumentAttributes(n),
|
|
296
|
-
...
|
|
297
|
-
...t ?
|
|
489
|
+
...pt(n),
|
|
490
|
+
...t ? mt(n, t) : {}
|
|
298
491
|
}),
|
|
299
492
|
history: {
|
|
300
493
|
summary: e.history.summary,
|
|
301
494
|
attributes: {
|
|
302
495
|
...e.history.attributes,
|
|
303
|
-
...
|
|
304
|
-
...t ?
|
|
496
|
+
...ot,
|
|
497
|
+
...t ? gt(t) : {}
|
|
305
498
|
}
|
|
306
499
|
}
|
|
307
500
|
};
|
|
308
501
|
}
|
|
309
502
|
// src/schema/addressSchema.ts
|
|
310
|
-
var
|
|
311
|
-
function
|
|
503
|
+
var _t = "Enter an https:// address or a path that starts with /";
|
|
504
|
+
function vt(e) {
|
|
312
505
|
if (e.startsWith("/")) return !e.startsWith("//") && !e.startsWith("/\\");
|
|
313
506
|
try {
|
|
314
507
|
let { protocol: t } = new URL(e);
|
|
@@ -317,217 +510,33 @@ function De(e) {
|
|
|
317
510
|
return !1;
|
|
318
511
|
}
|
|
319
512
|
}
|
|
320
|
-
var
|
|
513
|
+
var N = d.string().trim().min(1, _t).refine(vt, _t), yt = ["_self", "_blank"], P = {
|
|
321
514
|
href: "",
|
|
322
515
|
target: "_self",
|
|
323
516
|
description: ""
|
|
324
|
-
},
|
|
325
|
-
href:
|
|
326
|
-
target:
|
|
327
|
-
description:
|
|
328
|
-
},
|
|
517
|
+
}, F = {
|
|
518
|
+
href: d.string().trim().pipe(d.union([d.literal(""), N])).default(P.href),
|
|
519
|
+
target: d.enum(yt).default(P.target),
|
|
520
|
+
description: d.string().trim().default(P.description)
|
|
521
|
+
}, I = {
|
|
329
522
|
href: "Link address",
|
|
330
523
|
target: "Link target",
|
|
331
524
|
description: "Link description"
|
|
332
525
|
};
|
|
333
|
-
function
|
|
526
|
+
function L({ href: e, target: t, description: n }) {
|
|
334
527
|
return e === "" ? {} : {
|
|
335
528
|
href: e,
|
|
336
|
-
...t ===
|
|
529
|
+
...t === P.target ? {} : { target: t },
|
|
337
530
|
...n === "" ? {} : { description: n }
|
|
338
531
|
};
|
|
339
532
|
}
|
|
340
|
-
// src/
|
|
341
|
-
var
|
|
342
|
-
function
|
|
343
|
-
return typeof e == "string" &&
|
|
344
|
-
}
|
|
345
|
-
// src/schema/style/page-styles.ts
|
|
346
|
-
var Ae = /^#[0-9A-Fa-f]{6}$/;
|
|
347
|
-
function je(e) {
|
|
348
|
-
return Ae.test(e) ? [
|
|
349
|
-
Number.parseInt(e.slice(1, 3), 16),
|
|
350
|
-
Number.parseInt(e.slice(3, 5), 16),
|
|
351
|
-
Number.parseInt(e.slice(5, 7), 16)
|
|
352
|
-
] : null;
|
|
353
|
-
}
|
|
354
|
-
function D(e) {
|
|
355
|
-
let t = je(e.hex);
|
|
356
|
-
if (!t || !Number.isFinite(e.opacity)) return;
|
|
357
|
-
if (e.opacity === 100) return e.hex.toUpperCase();
|
|
358
|
-
let n = Math.min(100, Math.max(0, e.opacity)) / 100, [r, i, a] = t;
|
|
359
|
-
return `rgba(${r}, ${i}, ${a}, ${n})`;
|
|
360
|
-
}
|
|
361
|
-
function Me(e) {
|
|
362
|
-
if (!(!Number.isFinite(e) || e <= 0)) return `${e}px`;
|
|
363
|
-
}
|
|
364
|
-
// src/schema/style/backgroundStyle.ts
|
|
365
|
-
function Ne(e) {
|
|
366
|
-
if (e.backgroundType === "gradient") return "transparent";
|
|
367
|
-
if (e.backgroundColor) return D(e.backgroundColor);
|
|
368
|
-
}
|
|
369
|
-
function Pe(e) {
|
|
370
|
-
if (e.backgroundType !== "gradient") return "none";
|
|
371
|
-
if (e.backgroundGradient) return o(e.backgroundGradient);
|
|
372
|
-
}
|
|
373
|
-
function Fe(e, t) {
|
|
374
|
-
return e.backgroundType ? {
|
|
375
|
-
[`${t}-background-color`]: Ne(e),
|
|
376
|
-
[`${t}-background-image`]: Pe(e)
|
|
377
|
-
} : {};
|
|
378
|
-
}
|
|
379
|
-
// src/schema/style/elementStyle.ts
|
|
380
|
-
var O = [
|
|
381
|
-
"none",
|
|
382
|
-
"solid",
|
|
383
|
-
"dashed",
|
|
384
|
-
"dotted",
|
|
385
|
-
"double"
|
|
386
|
-
], Ie = [
|
|
387
|
-
"row",
|
|
388
|
-
"column",
|
|
389
|
-
"row-reverse",
|
|
390
|
-
"column-reverse"
|
|
391
|
-
], Le = [
|
|
392
|
-
"nowrap",
|
|
393
|
-
"wrap",
|
|
394
|
-
"wrap-reverse"
|
|
395
|
-
], k = [
|
|
396
|
-
"flex-start",
|
|
397
|
-
"center",
|
|
398
|
-
"flex-end",
|
|
399
|
-
"space-between",
|
|
400
|
-
"space-around",
|
|
401
|
-
"space-evenly"
|
|
402
|
-
], Re = [
|
|
403
|
-
"stretch",
|
|
404
|
-
"flex-start",
|
|
405
|
-
"center",
|
|
406
|
-
"flex-end",
|
|
407
|
-
"baseline"
|
|
408
|
-
], ze = ["stretch", ...k], A = {
|
|
409
|
-
layout: "block",
|
|
410
|
-
flexDirection: "row",
|
|
411
|
-
flexWrap: "nowrap",
|
|
412
|
-
justifyContent: "flex-start",
|
|
413
|
-
alignItems: "stretch",
|
|
414
|
-
alignContent: "stretch",
|
|
415
|
-
rowGap: "0",
|
|
416
|
-
columnGap: "0",
|
|
417
|
-
backgroundType: "color",
|
|
418
|
-
backgroundColor: {
|
|
419
|
-
hex: "#FFFFFF",
|
|
420
|
-
opacity: 0
|
|
421
|
-
},
|
|
422
|
-
backgroundGradient: {
|
|
423
|
-
kind: "linear",
|
|
424
|
-
value: "135deg, #2563EB, #7C3AED"
|
|
425
|
-
},
|
|
426
|
-
overflow: "show",
|
|
427
|
-
overflowVertical: !0,
|
|
428
|
-
overflowHorizontal: !0,
|
|
429
|
-
width: "auto",
|
|
430
|
-
height: "auto",
|
|
431
|
-
minWidth: "auto",
|
|
432
|
-
minHeight: "auto",
|
|
433
|
-
maxWidth: "auto",
|
|
434
|
-
maxHeight: "auto",
|
|
435
|
-
paddingTop: "auto",
|
|
436
|
-
paddingBottom: "auto",
|
|
437
|
-
paddingLeft: "auto",
|
|
438
|
-
paddingRight: "auto",
|
|
439
|
-
marginTop: "0",
|
|
440
|
-
marginBottom: "0",
|
|
441
|
-
marginLeft: "0",
|
|
442
|
-
marginRight: "0",
|
|
443
|
-
borderRadiusTopLeft: "0",
|
|
444
|
-
borderRadiusTopRight: "0",
|
|
445
|
-
borderRadiusBottomRight: "0",
|
|
446
|
-
borderRadiusBottomLeft: "0",
|
|
447
|
-
borderWidth: "0",
|
|
448
|
-
borderStyle: "solid",
|
|
449
|
-
borderColor: {
|
|
450
|
-
hex: "#000000",
|
|
451
|
-
opacity: 100
|
|
452
|
-
}
|
|
453
|
-
}, Be = /^(auto|0|-?\d+(\.\d+)?(px|rem|em|%))$/i, Ve = /^(0|\d+(\.\d+)?(px|rem|em))$/i;
|
|
454
|
-
function j(e) {
|
|
455
|
-
let t = e.trim();
|
|
456
|
-
if (Be.test(t)) return t;
|
|
457
|
-
}
|
|
458
|
-
function M(e) {
|
|
459
|
-
let t = j(e);
|
|
460
|
-
if (t != null) return t.toLowerCase() === "auto" ? "0" : t;
|
|
461
|
-
}
|
|
462
|
-
function N(e) {
|
|
463
|
-
let t = j(e);
|
|
464
|
-
return t?.toLowerCase() === "auto" ? "none" : t;
|
|
465
|
-
}
|
|
466
|
-
function He(e) {
|
|
467
|
-
let t = e.trim();
|
|
468
|
-
return Ve.test(t) ? t : void 0;
|
|
469
|
-
}
|
|
470
|
-
function Ue(e, t) {
|
|
471
|
-
return e === "hide" ? "hidden" : t ? "auto" : "hidden";
|
|
472
|
-
}
|
|
473
|
-
var We = [
|
|
474
|
-
"marginTop",
|
|
475
|
-
"marginBottom",
|
|
476
|
-
"marginLeft",
|
|
477
|
-
"marginRight"
|
|
478
|
-
];
|
|
479
|
-
function Ge(e) {
|
|
480
|
-
return e.trim().toLowerCase() === "auto";
|
|
481
|
-
}
|
|
482
|
-
function P(e, t) {
|
|
483
|
-
return We.every((t) => Ge(e[t])) ? "0" : j(e[t]);
|
|
484
|
-
}
|
|
485
|
-
function Ke(e) {
|
|
486
|
-
return e.layout !== "grid" || e.gridColumns == null ? "none" : `repeat(${e.gridColumns}, minmax(0, 1fr))`;
|
|
487
|
-
}
|
|
488
|
-
function qe(e, t) {
|
|
489
|
-
let n = {
|
|
490
|
-
...A,
|
|
491
|
-
...e
|
|
492
|
-
}, r = `--palmyit-${t}`;
|
|
493
|
-
return {
|
|
494
|
-
[`${r}-display`]: n.layout,
|
|
495
|
-
[`${r}-grid-template-columns`]: Ke(n),
|
|
496
|
-
[`${r}-flex-direction`]: n.flexDirection,
|
|
497
|
-
[`${r}-flex-wrap`]: n.flexWrap,
|
|
498
|
-
[`${r}-justify-content`]: n.justifyContent,
|
|
499
|
-
[`${r}-align-items`]: n.alignItems,
|
|
500
|
-
[`${r}-align-content`]: n.alignContent,
|
|
501
|
-
[`${r}-row-gap`]: M(n.rowGap),
|
|
502
|
-
[`${r}-column-gap`]: M(n.columnGap),
|
|
503
|
-
[`${r}-overflow-x`]: Ue(n.overflow, n.overflowHorizontal),
|
|
504
|
-
[`${r}-overflow-y`]: Ue(n.overflow, n.overflowVertical),
|
|
505
|
-
[`${r}-width`]: j(n.width),
|
|
506
|
-
[`${r}-height`]: j(n.height),
|
|
507
|
-
[`${r}-min-width`]: j(n.minWidth),
|
|
508
|
-
[`${r}-min-height`]: j(n.minHeight),
|
|
509
|
-
[`${r}-max-width`]: N(n.maxWidth),
|
|
510
|
-
[`${r}-max-height`]: N(n.maxHeight),
|
|
511
|
-
[`${r}-padding-top`]: M(n.paddingTop),
|
|
512
|
-
[`${r}-padding-bottom`]: M(n.paddingBottom),
|
|
513
|
-
[`${r}-padding-left`]: M(n.paddingLeft),
|
|
514
|
-
[`${r}-padding-right`]: M(n.paddingRight),
|
|
515
|
-
[`${r}-margin-top`]: P(n, "marginTop"),
|
|
516
|
-
[`${r}-margin-bottom`]: P(n, "marginBottom"),
|
|
517
|
-
[`${r}-margin-left`]: P(n, "marginLeft"),
|
|
518
|
-
[`${r}-margin-right`]: P(n, "marginRight"),
|
|
519
|
-
[`${r}-border-top-left-radius`]: M(n.borderRadiusTopLeft),
|
|
520
|
-
[`${r}-border-top-right-radius`]: M(n.borderRadiusTopRight),
|
|
521
|
-
[`${r}-border-bottom-right-radius`]: M(n.borderRadiusBottomRight),
|
|
522
|
-
[`${r}-border-bottom-left-radius`]: M(n.borderRadiusBottomLeft),
|
|
523
|
-
[`${r}-border-width`]: He(n.borderWidth),
|
|
524
|
-
[`${r}-border-style`]: n.borderStyle,
|
|
525
|
-
[`${r}-border-color`]: D(n.borderColor),
|
|
526
|
-
...Fe(n, r)
|
|
527
|
-
};
|
|
533
|
+
// src/elements/rich-text/richTextMarks.ts
|
|
534
|
+
var bt = /^[A-Za-z0-9][A-Za-z0-9 ]*$/;
|
|
535
|
+
function xt(e) {
|
|
536
|
+
return typeof e == "string" && bt.test(e);
|
|
528
537
|
}
|
|
529
538
|
// src/schema/elementStyleDefinitions.ts
|
|
530
|
-
var
|
|
539
|
+
var R = [
|
|
531
540
|
[
|
|
532
541
|
"width",
|
|
533
542
|
"width",
|
|
@@ -619,23 +628,23 @@ var F = e.string().trim().regex(Be, "Expected auto, 0, or a px, rem, em, or % le
|
|
|
619
628
|
"Radius bottom left"
|
|
620
629
|
]
|
|
621
630
|
];
|
|
622
|
-
function
|
|
623
|
-
let
|
|
631
|
+
function St(e) {
|
|
632
|
+
let t = `--palmyit-${e}`, n = {
|
|
624
633
|
key: "gridColumns",
|
|
625
|
-
variable: `${
|
|
626
|
-
value:
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
634
|
+
variable: `${t}-grid-template-columns`,
|
|
635
|
+
value: d.union([
|
|
636
|
+
d.literal(2),
|
|
637
|
+
d.literal(3),
|
|
638
|
+
d.literal(4)
|
|
630
639
|
]),
|
|
631
640
|
label: "Grid columns"
|
|
632
641
|
};
|
|
633
642
|
return [
|
|
634
643
|
{
|
|
635
644
|
key: "layout",
|
|
636
|
-
variable: `${
|
|
645
|
+
variable: `${t}-display`,
|
|
637
646
|
attribute: "data-layout",
|
|
638
|
-
value:
|
|
647
|
+
value: d.enum([
|
|
639
648
|
"block",
|
|
640
649
|
"flex",
|
|
641
650
|
"grid"
|
|
@@ -643,139 +652,139 @@ function Je(t) {
|
|
|
643
652
|
defaultValue: "block",
|
|
644
653
|
label: "Layout"
|
|
645
654
|
},
|
|
646
|
-
|
|
647
|
-
...
|
|
655
|
+
n,
|
|
656
|
+
...Ct(e)
|
|
648
657
|
];
|
|
649
658
|
}
|
|
650
|
-
function
|
|
651
|
-
let
|
|
659
|
+
function Ct(e) {
|
|
660
|
+
let t = `--palmyit-${e}`;
|
|
652
661
|
return [
|
|
653
662
|
{
|
|
654
663
|
key: "flexDirection",
|
|
655
|
-
variable: `${
|
|
656
|
-
value:
|
|
657
|
-
defaultValue:
|
|
664
|
+
variable: `${t}-flex-direction`,
|
|
665
|
+
value: d.enum(he),
|
|
666
|
+
defaultValue: g.flexDirection,
|
|
658
667
|
label: "Direction"
|
|
659
668
|
},
|
|
660
669
|
{
|
|
661
670
|
key: "flexWrap",
|
|
662
|
-
variable: `${
|
|
663
|
-
value:
|
|
664
|
-
defaultValue:
|
|
671
|
+
variable: `${t}-flex-wrap`,
|
|
672
|
+
value: d.enum(ge),
|
|
673
|
+
defaultValue: g.flexWrap,
|
|
665
674
|
label: "Wrap"
|
|
666
675
|
},
|
|
667
676
|
{
|
|
668
677
|
key: "justifyContent",
|
|
669
|
-
variable: `${
|
|
670
|
-
value:
|
|
671
|
-
defaultValue:
|
|
678
|
+
variable: `${t}-justify-content`,
|
|
679
|
+
value: d.enum(_e),
|
|
680
|
+
defaultValue: g.justifyContent,
|
|
672
681
|
label: "Justify"
|
|
673
682
|
},
|
|
674
683
|
{
|
|
675
684
|
key: "alignItems",
|
|
676
|
-
variable: `${
|
|
677
|
-
value:
|
|
678
|
-
defaultValue:
|
|
685
|
+
variable: `${t}-align-items`,
|
|
686
|
+
value: d.enum(ve),
|
|
687
|
+
defaultValue: g.alignItems,
|
|
679
688
|
label: "Align items"
|
|
680
689
|
},
|
|
681
690
|
{
|
|
682
691
|
key: "alignContent",
|
|
683
|
-
variable: `${
|
|
684
|
-
value:
|
|
685
|
-
defaultValue:
|
|
692
|
+
variable: `${t}-align-content`,
|
|
693
|
+
value: d.enum(ye),
|
|
694
|
+
defaultValue: g.alignContent,
|
|
686
695
|
label: "Align content"
|
|
687
696
|
},
|
|
688
697
|
{
|
|
689
698
|
key: "rowGap",
|
|
690
|
-
variable: `${
|
|
691
|
-
value:
|
|
692
|
-
defaultValue:
|
|
699
|
+
variable: `${t}-row-gap`,
|
|
700
|
+
value: S,
|
|
701
|
+
defaultValue: g.rowGap,
|
|
693
702
|
label: "Row gap"
|
|
694
703
|
},
|
|
695
704
|
{
|
|
696
705
|
key: "columnGap",
|
|
697
|
-
variable: `${
|
|
698
|
-
value:
|
|
699
|
-
defaultValue:
|
|
706
|
+
variable: `${t}-column-gap`,
|
|
707
|
+
value: S,
|
|
708
|
+
defaultValue: g.columnGap,
|
|
700
709
|
label: "Column gap"
|
|
701
710
|
}
|
|
702
711
|
];
|
|
703
712
|
}
|
|
704
|
-
function
|
|
705
|
-
let
|
|
713
|
+
function wt(e, t) {
|
|
714
|
+
let n = `--palmyit-${e}`;
|
|
706
715
|
return [
|
|
707
716
|
{
|
|
708
717
|
key: "overflow",
|
|
709
718
|
variables: {
|
|
710
|
-
x: `${
|
|
711
|
-
y: `${
|
|
719
|
+
x: `${n}-overflow-x`,
|
|
720
|
+
y: `${n}-overflow-y`
|
|
712
721
|
},
|
|
713
|
-
value:
|
|
714
|
-
defaultValue:
|
|
722
|
+
value: d.enum(["show", "hide"]),
|
|
723
|
+
defaultValue: t.overflow,
|
|
715
724
|
label: "Overflowing contents"
|
|
716
725
|
},
|
|
717
726
|
{
|
|
718
727
|
key: "overflowHorizontal",
|
|
719
|
-
variable: `${
|
|
720
|
-
value:
|
|
721
|
-
defaultValue:
|
|
728
|
+
variable: `${n}-overflow-x`,
|
|
729
|
+
value: d.boolean(),
|
|
730
|
+
defaultValue: t.overflowHorizontal,
|
|
722
731
|
label: "Horizontal overflow"
|
|
723
732
|
},
|
|
724
733
|
{
|
|
725
734
|
key: "overflowVertical",
|
|
726
|
-
variable: `${
|
|
727
|
-
value:
|
|
728
|
-
defaultValue:
|
|
735
|
+
variable: `${n}-overflow-y`,
|
|
736
|
+
value: d.boolean(),
|
|
737
|
+
defaultValue: t.overflowVertical,
|
|
729
738
|
label: "Vertical overflow"
|
|
730
739
|
}
|
|
731
740
|
];
|
|
732
741
|
}
|
|
733
|
-
function
|
|
734
|
-
return
|
|
742
|
+
function Tt(e, t) {
|
|
743
|
+
return R.map(([n, r, i]) => ({
|
|
735
744
|
key: n,
|
|
736
745
|
variable: `--palmyit-${e}-${r}`,
|
|
737
|
-
value:
|
|
746
|
+
value: S,
|
|
738
747
|
defaultValue: t[n],
|
|
739
748
|
label: i
|
|
740
749
|
}));
|
|
741
750
|
}
|
|
742
|
-
function
|
|
743
|
-
let
|
|
751
|
+
function Et(e, t) {
|
|
752
|
+
let n = `--palmyit-${e}`;
|
|
744
753
|
return [
|
|
745
754
|
{
|
|
746
755
|
key: "borderWidth",
|
|
747
|
-
variable: `${
|
|
748
|
-
value:
|
|
749
|
-
defaultValue:
|
|
756
|
+
variable: `${n}-border-width`,
|
|
757
|
+
value: Pe,
|
|
758
|
+
defaultValue: t.borderWidth,
|
|
750
759
|
label: "Border width"
|
|
751
760
|
},
|
|
752
761
|
{
|
|
753
762
|
key: "borderStyle",
|
|
754
|
-
variable: `${
|
|
755
|
-
value:
|
|
756
|
-
defaultValue:
|
|
763
|
+
variable: `${n}-border-style`,
|
|
764
|
+
value: d.enum(h),
|
|
765
|
+
defaultValue: t.borderStyle,
|
|
757
766
|
label: "Border style"
|
|
758
767
|
},
|
|
759
768
|
{
|
|
760
769
|
key: "borderColor",
|
|
761
|
-
variable: `${
|
|
762
|
-
value:
|
|
763
|
-
defaultValue:
|
|
770
|
+
variable: `${n}-border-color`,
|
|
771
|
+
value: C,
|
|
772
|
+
defaultValue: t.borderColor,
|
|
764
773
|
label: "Border color"
|
|
765
774
|
}
|
|
766
775
|
];
|
|
767
776
|
}
|
|
768
|
-
function
|
|
777
|
+
function Dt(e, t) {
|
|
769
778
|
return [
|
|
770
|
-
...
|
|
771
|
-
...
|
|
772
|
-
...
|
|
773
|
-
...
|
|
774
|
-
...
|
|
779
|
+
...St(e),
|
|
780
|
+
...wt(e, t),
|
|
781
|
+
...Tt(e, t),
|
|
782
|
+
...Et(e, t),
|
|
783
|
+
...w(`--palmyit-${e}`, { defaults: t })
|
|
775
784
|
];
|
|
776
785
|
}
|
|
777
|
-
function
|
|
778
|
-
return
|
|
786
|
+
function Ot(e, t) {
|
|
787
|
+
return O(e).transform((e) => ({
|
|
779
788
|
...t,
|
|
780
789
|
...e
|
|
781
790
|
})).superRefine((e, t) => {
|
|
@@ -787,98 +796,98 @@ function et(e, t) {
|
|
|
787
796
|
});
|
|
788
797
|
}
|
|
789
798
|
// src/schema/Fields/IconPicker/iconCatalog.ts
|
|
790
|
-
var
|
|
791
|
-
function
|
|
792
|
-
return
|
|
799
|
+
var kt = /^MdOutline[A-Z0-9]/, At = "";
|
|
800
|
+
function z(e) {
|
|
801
|
+
return kt.test(e);
|
|
793
802
|
}
|
|
794
|
-
function
|
|
803
|
+
function jt(e) {
|
|
795
804
|
return e.replace(/^MdOutline/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2");
|
|
796
805
|
}
|
|
797
|
-
// src/
|
|
798
|
-
var
|
|
806
|
+
// src/elements/button/definition.ts
|
|
807
|
+
var Mt = {
|
|
799
808
|
name: "Button",
|
|
800
809
|
startIcon: "",
|
|
801
810
|
endIcon: "",
|
|
802
|
-
...
|
|
811
|
+
...P,
|
|
803
812
|
style: {}
|
|
804
|
-
},
|
|
805
|
-
function
|
|
813
|
+
}, Nt = d.string().refine((e) => e === "" || z(e), "Expected an outlined Material icon name such as MdOutlineHome").default("");
|
|
814
|
+
function Pt(e, t) {
|
|
806
815
|
return t === "" ? {} : { [e]: t };
|
|
807
816
|
}
|
|
808
|
-
var
|
|
809
|
-
...
|
|
817
|
+
var B = "--palmyit-button", V = [
|
|
818
|
+
...w(B, { typeAttribute: "data-background" }),
|
|
810
819
|
{
|
|
811
820
|
key: "borderWidth",
|
|
812
|
-
variable: `${
|
|
813
|
-
value:
|
|
821
|
+
variable: `${B}-border-width`,
|
|
822
|
+
value: Pe,
|
|
814
823
|
label: "Border width"
|
|
815
824
|
},
|
|
816
825
|
{
|
|
817
826
|
key: "borderStyle",
|
|
818
|
-
variable: `${
|
|
819
|
-
value:
|
|
827
|
+
variable: `${B}-border-style`,
|
|
828
|
+
value: d.enum(h),
|
|
820
829
|
label: "Border style"
|
|
821
830
|
},
|
|
822
831
|
{
|
|
823
832
|
key: "borderColor",
|
|
824
|
-
variable: `${
|
|
825
|
-
value:
|
|
833
|
+
variable: `${B}-border-color`,
|
|
834
|
+
value: C,
|
|
826
835
|
label: "Border color"
|
|
827
836
|
},
|
|
828
|
-
...
|
|
837
|
+
...R.map(([e, t, n]) => ({
|
|
829
838
|
key: e,
|
|
830
|
-
variable: `${
|
|
831
|
-
value:
|
|
839
|
+
variable: `${B}-${t}`,
|
|
840
|
+
value: S,
|
|
832
841
|
label: n
|
|
833
842
|
})),
|
|
834
843
|
{
|
|
835
844
|
key: "textColor",
|
|
836
|
-
variable: `${
|
|
837
|
-
value:
|
|
845
|
+
variable: `${B}-text-color`,
|
|
846
|
+
value: C,
|
|
838
847
|
label: "Text color"
|
|
839
848
|
},
|
|
840
849
|
{
|
|
841
850
|
key: "textFont",
|
|
842
|
-
variable: `${
|
|
843
|
-
value:
|
|
851
|
+
variable: `${B}-font-family`,
|
|
852
|
+
value: d.string().refine(xt, "Expected a Google Fonts family name"),
|
|
844
853
|
label: "Font"
|
|
845
854
|
},
|
|
846
855
|
{
|
|
847
856
|
key: "textSize",
|
|
848
|
-
variable: `${
|
|
849
|
-
value:
|
|
857
|
+
variable: `${B}-font-size`,
|
|
858
|
+
value: Fe,
|
|
850
859
|
label: "Text size"
|
|
851
860
|
},
|
|
852
861
|
{
|
|
853
862
|
key: "iconGap",
|
|
854
|
-
variable: `${
|
|
855
|
-
value:
|
|
863
|
+
variable: `${B}-gap`,
|
|
864
|
+
value: S,
|
|
856
865
|
label: "Icon gap"
|
|
857
866
|
}
|
|
858
|
-
],
|
|
867
|
+
], Ft = M(p({
|
|
859
868
|
type: "PButton",
|
|
860
869
|
label: "Button",
|
|
861
870
|
allowedChildren: [],
|
|
862
871
|
templates: [],
|
|
863
|
-
attributes:
|
|
864
|
-
id:
|
|
865
|
-
name:
|
|
866
|
-
startIcon:
|
|
867
|
-
endIcon:
|
|
868
|
-
...
|
|
869
|
-
style:
|
|
872
|
+
attributes: d.strictObject({
|
|
873
|
+
id: f,
|
|
874
|
+
name: d.string().trim().min(1, "Enter a button label").default(Mt.name),
|
|
875
|
+
startIcon: Nt,
|
|
876
|
+
endIcon: Nt,
|
|
877
|
+
...F,
|
|
878
|
+
style: O(V).transform((e) => e)
|
|
870
879
|
}),
|
|
871
880
|
toDocumentAttributes: ({ id: e, name: t, startIcon: n, endIcon: r, href: i, target: a, description: o, style: s }) => ({
|
|
872
881
|
id: e,
|
|
873
882
|
name: t,
|
|
874
|
-
...
|
|
875
|
-
...
|
|
876
|
-
...
|
|
883
|
+
...Pt("startIcon", n),
|
|
884
|
+
...Pt("endIcon", r),
|
|
885
|
+
...L({
|
|
877
886
|
href: i,
|
|
878
887
|
target: a,
|
|
879
888
|
description: o
|
|
880
889
|
}),
|
|
881
|
-
style:
|
|
890
|
+
style: A(s, V)
|
|
882
891
|
}),
|
|
883
892
|
history: {
|
|
884
893
|
summary: ({ name: e }) => e,
|
|
@@ -886,22 +895,22 @@ var R = "--palmyit-button", z = [
|
|
|
886
895
|
name: "Label",
|
|
887
896
|
startIcon: "Start icon",
|
|
888
897
|
endIcon: "End icon",
|
|
889
|
-
...
|
|
890
|
-
...
|
|
898
|
+
...I,
|
|
899
|
+
...k(V, "style.")
|
|
891
900
|
}
|
|
892
901
|
}
|
|
893
|
-
}),
|
|
902
|
+
}), V), H = {
|
|
894
903
|
label: "Checkbox",
|
|
895
904
|
checked: !1
|
|
896
|
-
},
|
|
905
|
+
}, It = M(p({
|
|
897
906
|
type: "PCheckbox",
|
|
898
907
|
label: "Checkbox input",
|
|
899
908
|
allowedChildren: [],
|
|
900
909
|
templates: [],
|
|
901
|
-
attributes:
|
|
902
|
-
id:
|
|
903
|
-
label:
|
|
904
|
-
checked:
|
|
910
|
+
attributes: d.strictObject({
|
|
911
|
+
id: f,
|
|
912
|
+
label: d.string().trim().min(1, "Enter a label").default(H.label),
|
|
913
|
+
checked: d.boolean().default(H.checked)
|
|
905
914
|
}),
|
|
906
915
|
toDocumentAttributes: ({ id: e, label: t, checked: n }) => ({
|
|
907
916
|
id: e,
|
|
@@ -917,29 +926,29 @@ var R = "--palmyit-button", z = [
|
|
|
917
926
|
}
|
|
918
927
|
}));
|
|
919
928
|
// src/schema/layoutElementConfiguration.ts
|
|
920
|
-
function
|
|
921
|
-
let
|
|
922
|
-
return
|
|
923
|
-
type:
|
|
924
|
-
label:
|
|
925
|
-
allowedChildren:
|
|
926
|
-
templates:
|
|
927
|
-
attributes:
|
|
928
|
-
id:
|
|
929
|
-
style:
|
|
929
|
+
function U({ type: e, label: t, kind: n, defaultStyle: r, allowedChildren: i, templates: a }) {
|
|
930
|
+
let o = Dt(n, r);
|
|
931
|
+
return M(p({
|
|
932
|
+
type: e,
|
|
933
|
+
label: t,
|
|
934
|
+
allowedChildren: i,
|
|
935
|
+
templates: a,
|
|
936
|
+
attributes: d.strictObject({
|
|
937
|
+
id: f,
|
|
938
|
+
style: Ot(o, r)
|
|
930
939
|
}),
|
|
931
940
|
toDocumentAttributes: ({ id: e, style: t }) => ({
|
|
932
941
|
id: e,
|
|
933
|
-
style:
|
|
942
|
+
style: A(t, o)
|
|
934
943
|
}),
|
|
935
944
|
history: {
|
|
936
|
-
summary: () =>
|
|
937
|
-
attributes:
|
|
945
|
+
summary: () => t,
|
|
946
|
+
attributes: k(o, "style.")
|
|
938
947
|
}
|
|
939
|
-
}),
|
|
948
|
+
}), o);
|
|
940
949
|
}
|
|
941
950
|
// src/schema/layoutChildren.ts
|
|
942
|
-
var
|
|
951
|
+
var W = [
|
|
943
952
|
"PContainer",
|
|
944
953
|
"PButton",
|
|
945
954
|
"PText",
|
|
@@ -955,26 +964,26 @@ var H = [
|
|
|
955
964
|
"PCheckbox",
|
|
956
965
|
"PRadio",
|
|
957
966
|
"PSelect"
|
|
958
|
-
],
|
|
967
|
+
], Lt = { ...g }, Rt = U({
|
|
959
968
|
type: "PContainer",
|
|
960
969
|
label: "Container",
|
|
961
970
|
kind: "container",
|
|
962
|
-
defaultStyle:
|
|
963
|
-
allowedChildren:
|
|
971
|
+
defaultStyle: Lt,
|
|
972
|
+
allowedChildren: W,
|
|
964
973
|
templates: []
|
|
965
|
-
}),
|
|
974
|
+
}), zt = [
|
|
966
975
|
"1",
|
|
967
976
|
"2",
|
|
968
977
|
"3",
|
|
969
978
|
"4"
|
|
970
|
-
],
|
|
979
|
+
], Bt = { size: "4" }, Vt = M(p({
|
|
971
980
|
type: "PDivider",
|
|
972
981
|
label: "Divider",
|
|
973
982
|
allowedChildren: [],
|
|
974
983
|
templates: [],
|
|
975
|
-
attributes:
|
|
976
|
-
id:
|
|
977
|
-
size:
|
|
984
|
+
attributes: d.strictObject({
|
|
985
|
+
id: f,
|
|
986
|
+
size: d.enum(zt).default(Bt.size)
|
|
978
987
|
}),
|
|
979
988
|
toDocumentAttributes: ({ id: e, size: t }) => ({
|
|
980
989
|
id: e,
|
|
@@ -984,20 +993,20 @@ var H = [
|
|
|
984
993
|
summary: () => "",
|
|
985
994
|
attributes: { size: "Width" }
|
|
986
995
|
}
|
|
987
|
-
})),
|
|
996
|
+
})), G = {
|
|
988
997
|
icon: "MdOutlineStarBorder",
|
|
989
998
|
label: "Icon",
|
|
990
|
-
...
|
|
991
|
-
},
|
|
999
|
+
...P
|
|
1000
|
+
}, Ht = M(p({
|
|
992
1001
|
type: "PIcon",
|
|
993
1002
|
label: "Icon",
|
|
994
1003
|
allowedChildren: [],
|
|
995
1004
|
templates: [],
|
|
996
|
-
attributes:
|
|
997
|
-
id:
|
|
998
|
-
icon:
|
|
999
|
-
label:
|
|
1000
|
-
...
|
|
1005
|
+
attributes: d.strictObject({
|
|
1006
|
+
id: f,
|
|
1007
|
+
icon: d.string().refine(z, "Choose an outlined Material icon such as MdOutlineHome").default(G.icon),
|
|
1008
|
+
label: d.string().trim().default(G.label),
|
|
1009
|
+
...F
|
|
1001
1010
|
}).refine(({ href: e, label: t }) => e === "" || t !== "", {
|
|
1002
1011
|
path: ["label"],
|
|
1003
1012
|
message: "Describe a linked icon so the link has a name"
|
|
@@ -1006,79 +1015,79 @@ var H = [
|
|
|
1006
1015
|
id: e,
|
|
1007
1016
|
icon: t,
|
|
1008
1017
|
label: n,
|
|
1009
|
-
...
|
|
1018
|
+
...L({
|
|
1010
1019
|
href: r,
|
|
1011
1020
|
target: i,
|
|
1012
1021
|
description: a
|
|
1013
1022
|
})
|
|
1014
1023
|
}),
|
|
1015
1024
|
history: {
|
|
1016
|
-
summary: ({ icon: e, label: t }) => t ||
|
|
1025
|
+
summary: ({ icon: e, label: t }) => t || jt(e),
|
|
1017
1026
|
attributes: {
|
|
1018
1027
|
icon: "Icon",
|
|
1019
1028
|
label: "Description",
|
|
1020
|
-
...
|
|
1029
|
+
...I
|
|
1021
1030
|
}
|
|
1022
1031
|
}
|
|
1023
|
-
})),
|
|
1032
|
+
})), Ut = [
|
|
1024
1033
|
"width",
|
|
1025
1034
|
"height",
|
|
1026
1035
|
"minWidth",
|
|
1027
1036
|
"minHeight",
|
|
1028
1037
|
"maxWidth",
|
|
1029
1038
|
"maxHeight"
|
|
1030
|
-
],
|
|
1039
|
+
], Wt = [
|
|
1031
1040
|
"borderRadiusTopLeft",
|
|
1032
1041
|
"borderRadiusTopRight",
|
|
1033
1042
|
"borderRadiusBottomRight",
|
|
1034
1043
|
"borderRadiusBottomLeft"
|
|
1035
|
-
],
|
|
1044
|
+
], Gt = [...Ut, ...Wt], Kt = {
|
|
1036
1045
|
src: "/image-placeholder.svg",
|
|
1037
1046
|
alt: "Image",
|
|
1038
1047
|
style: {},
|
|
1039
|
-
...
|
|
1040
|
-
},
|
|
1041
|
-
function
|
|
1042
|
-
return
|
|
1048
|
+
...P
|
|
1049
|
+
}, K = "--palmyit-image";
|
|
1050
|
+
function qt(e) {
|
|
1051
|
+
return R.filter(([t]) => e.includes(t)).map(([e, t, n]) => ({
|
|
1043
1052
|
key: e,
|
|
1044
|
-
variable: `${
|
|
1045
|
-
value:
|
|
1053
|
+
variable: `${K}-${t}`,
|
|
1054
|
+
value: S,
|
|
1046
1055
|
label: n
|
|
1047
1056
|
}));
|
|
1048
1057
|
}
|
|
1049
|
-
var
|
|
1050
|
-
...
|
|
1051
|
-
...
|
|
1058
|
+
var q = [
|
|
1059
|
+
...qt(Ut),
|
|
1060
|
+
...w(K, { typeAttribute: "data-background" }),
|
|
1052
1061
|
{
|
|
1053
1062
|
key: "borderWidth",
|
|
1054
|
-
variable: `${
|
|
1055
|
-
value:
|
|
1063
|
+
variable: `${K}-border-width`,
|
|
1064
|
+
value: Pe,
|
|
1056
1065
|
label: "Border width"
|
|
1057
1066
|
},
|
|
1058
1067
|
{
|
|
1059
1068
|
key: "borderStyle",
|
|
1060
|
-
variable: `${
|
|
1061
|
-
value:
|
|
1069
|
+
variable: `${K}-border-style`,
|
|
1070
|
+
value: d.enum(h),
|
|
1062
1071
|
label: "Border style"
|
|
1063
1072
|
},
|
|
1064
1073
|
{
|
|
1065
1074
|
key: "borderColor",
|
|
1066
|
-
variable: `${
|
|
1067
|
-
value:
|
|
1075
|
+
variable: `${K}-border-color`,
|
|
1076
|
+
value: C,
|
|
1068
1077
|
label: "Border color"
|
|
1069
1078
|
},
|
|
1070
|
-
...
|
|
1071
|
-
],
|
|
1079
|
+
...qt(Wt)
|
|
1080
|
+
], Jt = M(p({
|
|
1072
1081
|
type: "PImage",
|
|
1073
1082
|
label: "Image",
|
|
1074
1083
|
allowedChildren: [],
|
|
1075
1084
|
templates: [],
|
|
1076
|
-
attributes:
|
|
1077
|
-
id:
|
|
1078
|
-
src:
|
|
1079
|
-
alt:
|
|
1080
|
-
style:
|
|
1081
|
-
...
|
|
1085
|
+
attributes: d.strictObject({
|
|
1086
|
+
id: f,
|
|
1087
|
+
src: N.default(Kt.src),
|
|
1088
|
+
alt: d.string().trim().default(Kt.alt),
|
|
1089
|
+
style: O(q).transform((e) => e),
|
|
1090
|
+
...F
|
|
1082
1091
|
}).refine(({ href: e, alt: t }) => e === "" || t !== "", {
|
|
1083
1092
|
path: ["alt"],
|
|
1084
1093
|
message: "Describe a linked image so the link has a name"
|
|
@@ -1087,8 +1096,8 @@ var K = [
|
|
|
1087
1096
|
id: e,
|
|
1088
1097
|
src: t,
|
|
1089
1098
|
alt: n,
|
|
1090
|
-
style:
|
|
1091
|
-
...
|
|
1099
|
+
style: A(r, q),
|
|
1100
|
+
...L({
|
|
1092
1101
|
href: i,
|
|
1093
1102
|
target: a,
|
|
1094
1103
|
description: o
|
|
@@ -1099,85 +1108,82 @@ var K = [
|
|
|
1099
1108
|
attributes: {
|
|
1100
1109
|
src: "Image address",
|
|
1101
1110
|
alt: "Description",
|
|
1102
|
-
...
|
|
1103
|
-
...
|
|
1111
|
+
...I,
|
|
1112
|
+
...k(q, "style.")
|
|
1104
1113
|
}
|
|
1105
1114
|
}
|
|
1106
|
-
}),
|
|
1115
|
+
}), q);
|
|
1107
1116
|
// src/schema/textItems.ts
|
|
1108
|
-
function
|
|
1109
|
-
return
|
|
1117
|
+
function J(e, t) {
|
|
1118
|
+
return d.array(d.strictObject({ text: d.string().trim().min(1, t) })).min(1, e);
|
|
1110
1119
|
}
|
|
1111
|
-
function
|
|
1120
|
+
function Y(e) {
|
|
1112
1121
|
return e.map(({ text: e }) => ({ text: e }));
|
|
1113
1122
|
}
|
|
1114
|
-
// src/
|
|
1115
|
-
var
|
|
1123
|
+
// src/elements/list/definition.ts
|
|
1124
|
+
var Yt = { items: [
|
|
1116
1125
|
{ text: "First item" },
|
|
1117
1126
|
{ text: "Second item" },
|
|
1118
1127
|
{ text: "Third item" }
|
|
1119
|
-
] },
|
|
1128
|
+
] }, Xt = M(p({
|
|
1120
1129
|
type: "PList",
|
|
1121
1130
|
label: "List",
|
|
1122
1131
|
allowedChildren: [],
|
|
1123
1132
|
templates: [],
|
|
1124
|
-
attributes:
|
|
1125
|
-
id:
|
|
1126
|
-
items:
|
|
1133
|
+
attributes: d.strictObject({
|
|
1134
|
+
id: f,
|
|
1135
|
+
items: J("Add a list item", "Enter item text").default(Yt.items)
|
|
1127
1136
|
}),
|
|
1128
1137
|
toDocumentAttributes: ({ id: e, items: t }) => ({
|
|
1129
1138
|
id: e,
|
|
1130
|
-
items:
|
|
1139
|
+
items: Y(t)
|
|
1131
1140
|
}),
|
|
1132
1141
|
history: {
|
|
1133
1142
|
summary: ({ items: e }) => e[0]?.text ?? "",
|
|
1134
1143
|
attributes: { items: "Items" }
|
|
1135
1144
|
}
|
|
1136
|
-
})),
|
|
1137
|
-
hex: e.string().regex(/^#[0-9A-Fa-f]{6}$/, "Expected a #RRGGBB color"),
|
|
1138
|
-
opacity: e.number().int().min(0).max(100)
|
|
1139
|
-
}), Y = {
|
|
1145
|
+
})), Zt = /^\/([a-z0-9]+(-[a-z0-9]+)*)?$/, X = {
|
|
1140
1146
|
backgroundColor: {
|
|
1141
|
-
|
|
1147
|
+
name: "white",
|
|
1142
1148
|
opacity: 100
|
|
1143
1149
|
},
|
|
1144
1150
|
textColor: {
|
|
1145
|
-
|
|
1151
|
+
name: "slate-900",
|
|
1146
1152
|
opacity: 100
|
|
1147
1153
|
},
|
|
1148
|
-
textSize:
|
|
1149
|
-
},
|
|
1154
|
+
textSize: "sm"
|
|
1155
|
+
}, Z = [
|
|
1150
1156
|
{
|
|
1151
1157
|
key: "backgroundColor",
|
|
1152
1158
|
variable: "--palmyit-page-background-color",
|
|
1153
|
-
value:
|
|
1154
|
-
defaultValue:
|
|
1159
|
+
value: C,
|
|
1160
|
+
defaultValue: X.backgroundColor,
|
|
1155
1161
|
label: "Background color"
|
|
1156
1162
|
},
|
|
1157
1163
|
{
|
|
1158
1164
|
key: "textColor",
|
|
1159
1165
|
variable: "--palmyit-page-text-color",
|
|
1160
|
-
value:
|
|
1161
|
-
defaultValue:
|
|
1166
|
+
value: C,
|
|
1167
|
+
defaultValue: X.textColor,
|
|
1162
1168
|
label: "Text color"
|
|
1163
1169
|
},
|
|
1164
1170
|
{
|
|
1165
1171
|
key: "textSize",
|
|
1166
1172
|
variable: "--palmyit-page-font-size",
|
|
1167
|
-
value:
|
|
1168
|
-
defaultValue:
|
|
1173
|
+
value: Fe,
|
|
1174
|
+
defaultValue: X.textSize,
|
|
1169
1175
|
label: "Text size"
|
|
1170
1176
|
}
|
|
1171
|
-
],
|
|
1177
|
+
], Qt = Z.map(({ key: e }) => e), $t = p({
|
|
1172
1178
|
type: "PPage",
|
|
1173
1179
|
label: "Page",
|
|
1174
1180
|
allowedChildren: ["PSection"],
|
|
1175
1181
|
templates: [],
|
|
1176
|
-
attributes:
|
|
1177
|
-
id:
|
|
1178
|
-
url:
|
|
1179
|
-
title:
|
|
1180
|
-
style:
|
|
1182
|
+
attributes: d.strictObject({
|
|
1183
|
+
id: f,
|
|
1184
|
+
url: d.string().regex(Zt, "Expected / or a lowercase path such as /about-us"),
|
|
1185
|
+
title: d.string().default(""),
|
|
1186
|
+
style: O(Z)
|
|
1181
1187
|
}).transform(({ id: e, url: t, title: n, style: r }) => ({
|
|
1182
1188
|
pageId: e,
|
|
1183
1189
|
url: t,
|
|
@@ -1188,33 +1194,33 @@ var bt = { items: [
|
|
|
1188
1194
|
id: e,
|
|
1189
1195
|
url: t,
|
|
1190
1196
|
title: n,
|
|
1191
|
-
style:
|
|
1197
|
+
style: A(r, Z)
|
|
1192
1198
|
}),
|
|
1193
1199
|
history: {
|
|
1194
1200
|
summary: ({ title: e, url: t }) => e || t,
|
|
1195
1201
|
attributes: {
|
|
1196
1202
|
title: "Title",
|
|
1197
1203
|
url: "URL",
|
|
1198
|
-
...
|
|
1204
|
+
...k(Z)
|
|
1199
1205
|
}
|
|
1200
1206
|
}
|
|
1201
|
-
}),
|
|
1207
|
+
}), en = {
|
|
1202
1208
|
legend: "Choose one",
|
|
1203
1209
|
options: [{ text: "Option 1" }, { text: "Option 2" }]
|
|
1204
|
-
},
|
|
1210
|
+
}, tn = M(p({
|
|
1205
1211
|
type: "PRadio",
|
|
1206
1212
|
label: "Radio input",
|
|
1207
1213
|
allowedChildren: [],
|
|
1208
1214
|
templates: [],
|
|
1209
|
-
attributes:
|
|
1210
|
-
id:
|
|
1211
|
-
legend:
|
|
1212
|
-
options:
|
|
1215
|
+
attributes: d.strictObject({
|
|
1216
|
+
id: f,
|
|
1217
|
+
legend: d.string().trim().min(1, "Enter a question").default(en.legend),
|
|
1218
|
+
options: J("Add an option", "Enter option text").default(en.options)
|
|
1213
1219
|
}),
|
|
1214
1220
|
toDocumentAttributes: ({ id: e, legend: t, options: n }) => ({
|
|
1215
1221
|
id: e,
|
|
1216
1222
|
legend: t,
|
|
1217
|
-
options:
|
|
1223
|
+
options: Y(n)
|
|
1218
1224
|
}),
|
|
1219
1225
|
history: {
|
|
1220
1226
|
summary: ({ legend: e }) => e,
|
|
@@ -1223,30 +1229,30 @@ var bt = { items: [
|
|
|
1223
1229
|
options: "Options"
|
|
1224
1230
|
}
|
|
1225
1231
|
}
|
|
1226
|
-
})),
|
|
1232
|
+
})), nn = { ...g }, rn = U({
|
|
1227
1233
|
type: "PSection",
|
|
1228
1234
|
label: "Section",
|
|
1229
1235
|
kind: "section",
|
|
1230
|
-
defaultStyle:
|
|
1231
|
-
allowedChildren:
|
|
1236
|
+
defaultStyle: nn,
|
|
1237
|
+
allowedChildren: W,
|
|
1232
1238
|
templates: []
|
|
1233
|
-
}),
|
|
1239
|
+
}), an = {
|
|
1234
1240
|
label: "Select",
|
|
1235
1241
|
options: [{ text: "Option 1" }, { text: "Option 2" }]
|
|
1236
|
-
},
|
|
1242
|
+
}, on = M(p({
|
|
1237
1243
|
type: "PSelect",
|
|
1238
1244
|
label: "Select",
|
|
1239
1245
|
allowedChildren: [],
|
|
1240
1246
|
templates: [],
|
|
1241
|
-
attributes:
|
|
1242
|
-
id:
|
|
1243
|
-
label:
|
|
1244
|
-
options:
|
|
1247
|
+
attributes: d.strictObject({
|
|
1248
|
+
id: f,
|
|
1249
|
+
label: d.string().trim().min(1, "Enter a label").default(an.label),
|
|
1250
|
+
options: J("Add an option", "Enter option text").default(an.options)
|
|
1245
1251
|
}),
|
|
1246
1252
|
toDocumentAttributes: ({ id: e, label: t, options: n }) => ({
|
|
1247
1253
|
id: e,
|
|
1248
1254
|
label: t,
|
|
1249
|
-
options:
|
|
1255
|
+
options: Y(n)
|
|
1250
1256
|
}),
|
|
1251
1257
|
history: {
|
|
1252
1258
|
summary: ({ label: e }) => e,
|
|
@@ -1255,7 +1261,7 @@ var bt = { items: [
|
|
|
1255
1261
|
options: "Options"
|
|
1256
1262
|
}
|
|
1257
1263
|
}
|
|
1258
|
-
})),
|
|
1264
|
+
})), sn = {
|
|
1259
1265
|
headers: [
|
|
1260
1266
|
{ text: "Column 1" },
|
|
1261
1267
|
{ text: "Column 2" },
|
|
@@ -1271,18 +1277,18 @@ var bt = { items: [
|
|
|
1271
1277
|
"Cell 6"
|
|
1272
1278
|
] }]
|
|
1273
1279
|
};
|
|
1274
|
-
function
|
|
1280
|
+
function cn(e, t) {
|
|
1275
1281
|
return t.map(({ cells: t }) => ({ cells: Array.from({ length: e }, (e, n) => t[n] ?? "") }));
|
|
1276
1282
|
}
|
|
1277
|
-
var
|
|
1283
|
+
var ln = d.strictObject({ cells: d.array(d.string()) }), un = M(p({
|
|
1278
1284
|
type: "PTable",
|
|
1279
1285
|
label: "Table",
|
|
1280
1286
|
allowedChildren: [],
|
|
1281
1287
|
templates: [],
|
|
1282
|
-
attributes:
|
|
1283
|
-
id:
|
|
1284
|
-
headers:
|
|
1285
|
-
rows:
|
|
1288
|
+
attributes: d.strictObject({
|
|
1289
|
+
id: f,
|
|
1290
|
+
headers: J("Add a column", "Enter a column heading").default(sn.headers),
|
|
1291
|
+
rows: d.array(ln).default(sn.rows)
|
|
1286
1292
|
}).superRefine(({ headers: e, rows: t }, n) => {
|
|
1287
1293
|
t.forEach(({ cells: t }, r) => {
|
|
1288
1294
|
t.length !== e.length && n.addIssue({
|
|
@@ -1298,7 +1304,7 @@ var Pt = e.strictObject({ cells: e.array(e.string()) }), Ft = b(n({
|
|
|
1298
1304
|
}),
|
|
1299
1305
|
toDocumentAttributes: ({ id: e, headers: t, rows: n }) => ({
|
|
1300
1306
|
id: e,
|
|
1301
|
-
headers:
|
|
1307
|
+
headers: Y(t),
|
|
1302
1308
|
rows: n.map(({ cells: e }) => ({ cells: [...e] }))
|
|
1303
1309
|
}),
|
|
1304
1310
|
history: {
|
|
@@ -1308,52 +1314,52 @@ var Pt = e.strictObject({ cells: e.array(e.string()) }), Ft = b(n({
|
|
|
1308
1314
|
rows: "Rows"
|
|
1309
1315
|
}
|
|
1310
1316
|
}
|
|
1311
|
-
})),
|
|
1312
|
-
function
|
|
1317
|
+
})), dn = /<[^>]*>/g;
|
|
1318
|
+
function fn(e) {
|
|
1313
1319
|
let t = e.trim();
|
|
1314
1320
|
return t.includes("<") ? t : `<p>${t}</p>`;
|
|
1315
1321
|
}
|
|
1316
|
-
function
|
|
1317
|
-
return e.replace(
|
|
1322
|
+
function pn(e) {
|
|
1323
|
+
return e.replace(dn, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/\s+/g, " ").trim();
|
|
1318
1324
|
}
|
|
1319
|
-
// src/
|
|
1320
|
-
var
|
|
1325
|
+
// src/elements/rich-text/definition.ts
|
|
1326
|
+
var mn = { text: "<p>Add your main text here. Double-click to edit and customize your content to make it selectable.</p>" }, hn = M(p({
|
|
1321
1327
|
type: "PRichText",
|
|
1322
1328
|
label: "Rich text",
|
|
1323
1329
|
allowedChildren: [],
|
|
1324
1330
|
templates: [],
|
|
1325
|
-
attributes:
|
|
1326
|
-
id:
|
|
1327
|
-
text:
|
|
1331
|
+
attributes: d.strictObject({
|
|
1332
|
+
id: f,
|
|
1333
|
+
text: d.string().transform(fn).refine((e) => pn(e).trim().length > 0, "Enter text").default(mn.text)
|
|
1328
1334
|
}),
|
|
1329
1335
|
toDocumentAttributes: ({ id: e, text: t }) => ({
|
|
1330
1336
|
id: e,
|
|
1331
|
-
text:
|
|
1337
|
+
text: fn(t)
|
|
1332
1338
|
}),
|
|
1333
1339
|
history: {
|
|
1334
|
-
summary: ({ text: e }) =>
|
|
1340
|
+
summary: ({ text: e }) => pn(e),
|
|
1335
1341
|
attributes: { text: "Text" }
|
|
1336
1342
|
}
|
|
1337
|
-
})),
|
|
1343
|
+
})), gn = [
|
|
1338
1344
|
"normal",
|
|
1339
1345
|
"italic",
|
|
1340
1346
|
"oblique"
|
|
1341
|
-
],
|
|
1347
|
+
], _n = [
|
|
1342
1348
|
"none",
|
|
1343
1349
|
"underline",
|
|
1344
1350
|
"overline",
|
|
1345
1351
|
"line-through"
|
|
1346
|
-
],
|
|
1352
|
+
], vn = [
|
|
1347
1353
|
"left",
|
|
1348
1354
|
"center",
|
|
1349
1355
|
"right",
|
|
1350
1356
|
"justify"
|
|
1351
|
-
],
|
|
1357
|
+
], yn = [
|
|
1352
1358
|
"none",
|
|
1353
1359
|
"capitalize",
|
|
1354
1360
|
"uppercase",
|
|
1355
1361
|
"lowercase"
|
|
1356
|
-
],
|
|
1362
|
+
], bn = [
|
|
1357
1363
|
"100",
|
|
1358
1364
|
"200",
|
|
1359
1365
|
"300",
|
|
@@ -1363,122 +1369,122 @@ var zt = { text: "<p>Add your main text here. Double-click to edit and customize
|
|
|
1363
1369
|
"700",
|
|
1364
1370
|
"800",
|
|
1365
1371
|
"900"
|
|
1366
|
-
],
|
|
1372
|
+
], xn = {
|
|
1367
1373
|
text: "Text",
|
|
1368
|
-
...
|
|
1374
|
+
...P,
|
|
1369
1375
|
style: {}
|
|
1370
|
-
},
|
|
1371
|
-
function
|
|
1376
|
+
}, Sn = "--palmyit-text";
|
|
1377
|
+
function Cn(e) {
|
|
1372
1378
|
return [
|
|
1373
1379
|
{
|
|
1374
1380
|
key: "textFont",
|
|
1375
|
-
variable: `${
|
|
1376
|
-
value:
|
|
1381
|
+
variable: `${e}-font-family`,
|
|
1382
|
+
value: d.string().refine(xt, "Expected a Google Fonts family name"),
|
|
1377
1383
|
label: "Font family"
|
|
1378
1384
|
},
|
|
1379
1385
|
{
|
|
1380
1386
|
key: "fontStyle",
|
|
1381
|
-
variable: `${
|
|
1382
|
-
value:
|
|
1387
|
+
variable: `${e}-font-style`,
|
|
1388
|
+
value: d.enum(gn),
|
|
1383
1389
|
label: "Text style"
|
|
1384
1390
|
},
|
|
1385
1391
|
{
|
|
1386
1392
|
key: "textSize",
|
|
1387
|
-
variable: `${
|
|
1388
|
-
value:
|
|
1393
|
+
variable: `${e}-font-size`,
|
|
1394
|
+
value: Fe,
|
|
1389
1395
|
label: "Text size"
|
|
1390
1396
|
},
|
|
1391
1397
|
{
|
|
1392
1398
|
key: "textColor",
|
|
1393
|
-
variable: `${
|
|
1394
|
-
value:
|
|
1399
|
+
variable: `${e}-color`,
|
|
1400
|
+
value: C,
|
|
1395
1401
|
label: "Text color"
|
|
1396
1402
|
},
|
|
1397
1403
|
{
|
|
1398
1404
|
key: "lineHeight",
|
|
1399
|
-
variable: `${
|
|
1400
|
-
value:
|
|
1405
|
+
variable: `${e}-line-height`,
|
|
1406
|
+
value: Ie,
|
|
1401
1407
|
label: "Height"
|
|
1402
1408
|
},
|
|
1403
1409
|
{
|
|
1404
1410
|
key: "letterSpacing",
|
|
1405
|
-
variable: `${
|
|
1406
|
-
value:
|
|
1411
|
+
variable: `${e}-letter-spacing`,
|
|
1412
|
+
value: Le,
|
|
1407
1413
|
label: "Letter spacing"
|
|
1408
1414
|
},
|
|
1409
1415
|
{
|
|
1410
1416
|
key: "wordSpacing",
|
|
1411
|
-
variable: `${
|
|
1412
|
-
value:
|
|
1417
|
+
variable: `${e}-word-spacing`,
|
|
1418
|
+
value: S,
|
|
1413
1419
|
label: "Word spacing"
|
|
1414
1420
|
},
|
|
1415
1421
|
{
|
|
1416
1422
|
key: "textDecoration",
|
|
1417
|
-
variable: `${
|
|
1418
|
-
value:
|
|
1423
|
+
variable: `${e}-text-decoration`,
|
|
1424
|
+
value: d.enum(_n),
|
|
1419
1425
|
label: "Text decoration"
|
|
1420
1426
|
},
|
|
1421
1427
|
{
|
|
1422
1428
|
key: "textAlign",
|
|
1423
|
-
variable: `${
|
|
1424
|
-
value:
|
|
1429
|
+
variable: `${e}-text-align`,
|
|
1430
|
+
value: d.enum(vn),
|
|
1425
1431
|
label: "Text align"
|
|
1426
1432
|
},
|
|
1427
1433
|
{
|
|
1428
1434
|
key: "textTransform",
|
|
1429
|
-
variable: `${
|
|
1430
|
-
value:
|
|
1435
|
+
variable: `${e}-text-transform`,
|
|
1436
|
+
value: d.enum(yn),
|
|
1431
1437
|
label: "Text transform"
|
|
1432
1438
|
},
|
|
1433
1439
|
{
|
|
1434
1440
|
key: "fontWeight",
|
|
1435
|
-
variable: `${
|
|
1436
|
-
value:
|
|
1441
|
+
variable: `${e}-font-weight`,
|
|
1442
|
+
value: d.enum(bn),
|
|
1437
1443
|
label: "Text weight"
|
|
1438
1444
|
}
|
|
1439
1445
|
];
|
|
1440
1446
|
}
|
|
1441
|
-
var
|
|
1447
|
+
var Q = Cn(Sn), wn = M(p({
|
|
1442
1448
|
type: "PText",
|
|
1443
1449
|
label: "Text",
|
|
1444
1450
|
allowedChildren: [],
|
|
1445
1451
|
templates: [],
|
|
1446
|
-
attributes:
|
|
1447
|
-
id:
|
|
1448
|
-
text:
|
|
1449
|
-
...
|
|
1450
|
-
style:
|
|
1452
|
+
attributes: d.strictObject({
|
|
1453
|
+
id: f,
|
|
1454
|
+
text: d.string().trim().min(1, "Enter text").default(xn.text),
|
|
1455
|
+
...F,
|
|
1456
|
+
style: O(Q).transform((e) => e)
|
|
1451
1457
|
}),
|
|
1452
1458
|
toDocumentAttributes: ({ id: e, text: t, href: n, target: r, description: i, style: a }) => ({
|
|
1453
1459
|
id: e,
|
|
1454
1460
|
text: t,
|
|
1455
|
-
...
|
|
1461
|
+
...L({
|
|
1456
1462
|
href: n,
|
|
1457
1463
|
target: r,
|
|
1458
1464
|
description: i
|
|
1459
1465
|
}),
|
|
1460
|
-
style:
|
|
1466
|
+
style: A(a, Q)
|
|
1461
1467
|
}),
|
|
1462
1468
|
history: {
|
|
1463
1469
|
summary: ({ text: e }) => e,
|
|
1464
1470
|
attributes: {
|
|
1465
1471
|
text: "Text",
|
|
1466
|
-
...
|
|
1467
|
-
...
|
|
1472
|
+
...I,
|
|
1473
|
+
...k(Q, "style.")
|
|
1468
1474
|
}
|
|
1469
1475
|
}
|
|
1470
|
-
}),
|
|
1476
|
+
}), Q), Tn = {
|
|
1471
1477
|
label: "Text area",
|
|
1472
1478
|
placeholder: ""
|
|
1473
|
-
},
|
|
1479
|
+
}, En = M(p({
|
|
1474
1480
|
type: "PTextArea",
|
|
1475
1481
|
label: "Text area",
|
|
1476
1482
|
allowedChildren: [],
|
|
1477
1483
|
templates: [],
|
|
1478
|
-
attributes:
|
|
1479
|
-
id:
|
|
1480
|
-
label:
|
|
1481
|
-
placeholder:
|
|
1484
|
+
attributes: d.strictObject({
|
|
1485
|
+
id: f,
|
|
1486
|
+
label: d.string().trim().min(1, "Enter a label").default(Tn.label),
|
|
1487
|
+
placeholder: d.string().default(Tn.placeholder)
|
|
1482
1488
|
}),
|
|
1483
1489
|
toDocumentAttributes: ({ id: e, label: t, placeholder: n }) => ({
|
|
1484
1490
|
id: e,
|
|
@@ -1492,18 +1498,18 @@ var Z = Jt(qt), Yt = b(n({
|
|
|
1492
1498
|
placeholder: "Placeholder"
|
|
1493
1499
|
}
|
|
1494
1500
|
}
|
|
1495
|
-
})),
|
|
1501
|
+
})), Dn = {
|
|
1496
1502
|
label: "Text field",
|
|
1497
1503
|
placeholder: ""
|
|
1498
|
-
},
|
|
1504
|
+
}, On = M(p({
|
|
1499
1505
|
type: "PTextField",
|
|
1500
1506
|
label: "Text field",
|
|
1501
1507
|
allowedChildren: [],
|
|
1502
1508
|
templates: [],
|
|
1503
|
-
attributes:
|
|
1504
|
-
id:
|
|
1505
|
-
label:
|
|
1506
|
-
placeholder:
|
|
1509
|
+
attributes: d.strictObject({
|
|
1510
|
+
id: f,
|
|
1511
|
+
label: d.string().trim().min(1, "Enter a label").default(Dn.label),
|
|
1512
|
+
placeholder: d.string().default(Dn.placeholder)
|
|
1507
1513
|
}),
|
|
1508
1514
|
toDocumentAttributes: ({ id: e, label: t, placeholder: n }) => ({
|
|
1509
1515
|
id: e,
|
|
@@ -1517,18 +1523,18 @@ var Z = Jt(qt), Yt = b(n({
|
|
|
1517
1523
|
placeholder: "Placeholder"
|
|
1518
1524
|
}
|
|
1519
1525
|
}
|
|
1520
|
-
})),
|
|
1526
|
+
})), kn = {
|
|
1521
1527
|
src: "",
|
|
1522
1528
|
title: "Video"
|
|
1523
|
-
},
|
|
1529
|
+
}, An = M(p({
|
|
1524
1530
|
type: "PVideo",
|
|
1525
1531
|
label: "Video",
|
|
1526
1532
|
allowedChildren: [],
|
|
1527
1533
|
templates: [],
|
|
1528
|
-
attributes:
|
|
1529
|
-
id:
|
|
1530
|
-
src:
|
|
1531
|
-
title:
|
|
1534
|
+
attributes: d.strictObject({
|
|
1535
|
+
id: f,
|
|
1536
|
+
src: d.union([d.literal(""), N]).default(kn.src),
|
|
1537
|
+
title: d.string().trim().min(1, "Enter a video title").default(kn.title)
|
|
1532
1538
|
}),
|
|
1533
1539
|
toDocumentAttributes: ({ id: e, src: t, title: n }) => ({
|
|
1534
1540
|
id: e,
|
|
@@ -1542,67 +1548,67 @@ var Z = Jt(qt), Yt = b(n({
|
|
|
1542
1548
|
title: "Title"
|
|
1543
1549
|
}
|
|
1544
1550
|
}
|
|
1545
|
-
})),
|
|
1546
|
-
PPage:
|
|
1547
|
-
PSection:
|
|
1548
|
-
PContainer:
|
|
1549
|
-
PButton:
|
|
1550
|
-
PText:
|
|
1551
|
-
PRichText:
|
|
1552
|
-
PImage:
|
|
1553
|
-
PVideo:
|
|
1554
|
-
PList:
|
|
1555
|
-
PIcon:
|
|
1556
|
-
PDivider:
|
|
1557
|
-
PTextField:
|
|
1558
|
-
PTextArea:
|
|
1559
|
-
PCheckbox:
|
|
1560
|
-
PRadio:
|
|
1561
|
-
PSelect:
|
|
1562
|
-
PTable:
|
|
1551
|
+
})), $ = {
|
|
1552
|
+
PPage: $t,
|
|
1553
|
+
PSection: rn,
|
|
1554
|
+
PContainer: Rt,
|
|
1555
|
+
PButton: Ft,
|
|
1556
|
+
PText: wn,
|
|
1557
|
+
PRichText: hn,
|
|
1558
|
+
PImage: Jt,
|
|
1559
|
+
PVideo: An,
|
|
1560
|
+
PList: Xt,
|
|
1561
|
+
PIcon: Ht,
|
|
1562
|
+
PDivider: Vt,
|
|
1563
|
+
PTextField: On,
|
|
1564
|
+
PTextArea: En,
|
|
1565
|
+
PCheckbox: It,
|
|
1566
|
+
PRadio: tn,
|
|
1567
|
+
PSelect: on,
|
|
1568
|
+
PTable: un
|
|
1563
1569
|
};
|
|
1564
|
-
function
|
|
1565
|
-
return typeof e == "string" && Object.hasOwn(
|
|
1570
|
+
function jn(e) {
|
|
1571
|
+
return typeof e == "string" && Object.hasOwn($, e);
|
|
1566
1572
|
}
|
|
1567
1573
|
// src/schema/elementTemplates.ts
|
|
1568
|
-
function
|
|
1574
|
+
function Mn(e) {
|
|
1569
1575
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1570
1576
|
}
|
|
1571
|
-
function
|
|
1577
|
+
function Nn(e) {
|
|
1572
1578
|
try {
|
|
1573
1579
|
let t = JSON.parse(e);
|
|
1574
|
-
return
|
|
1580
|
+
return Mn(t) ? t : void 0;
|
|
1575
1581
|
} catch {
|
|
1576
1582
|
return;
|
|
1577
1583
|
}
|
|
1578
1584
|
}
|
|
1579
|
-
function
|
|
1585
|
+
function Pn(e) {
|
|
1580
1586
|
return Array.isArray(e) ? e : [];
|
|
1581
1587
|
}
|
|
1582
|
-
function
|
|
1583
|
-
let n = new Map(
|
|
1584
|
-
for (let e of
|
|
1588
|
+
function Fn(e, t) {
|
|
1589
|
+
let n = new Map(Pn(e).map((e) => [e.key, e]));
|
|
1590
|
+
for (let e of Pn(t)) n.set(e.key, {
|
|
1585
1591
|
...n.get(e.key),
|
|
1586
1592
|
...e
|
|
1587
1593
|
});
|
|
1588
1594
|
return [...n.values()];
|
|
1589
1595
|
}
|
|
1590
|
-
function
|
|
1596
|
+
function In(e, t) {
|
|
1591
1597
|
let n = {
|
|
1592
1598
|
...e,
|
|
1593
1599
|
...t,
|
|
1594
1600
|
id: e.id
|
|
1595
1601
|
};
|
|
1596
|
-
return "style" in t && (n.style =
|
|
1602
|
+
return "style" in t && (n.style = Fn(e.style, t.style)), n;
|
|
1597
1603
|
}
|
|
1598
|
-
function
|
|
1604
|
+
function Ln(e, t) {
|
|
1599
1605
|
if (!Array.isArray(t)) return {
|
|
1600
1606
|
ok: !1,
|
|
1601
1607
|
message: "Expected a list of children"
|
|
1602
1608
|
};
|
|
1603
1609
|
let n = [];
|
|
1604
1610
|
for (let r of t) {
|
|
1605
|
-
let t =
|
|
1611
|
+
let t = Rn(e, r);
|
|
1606
1612
|
if (!t.ok) return t;
|
|
1607
1613
|
n.push(t.item);
|
|
1608
1614
|
}
|
|
@@ -1611,21 +1617,21 @@ function ln(e, t) {
|
|
|
1611
1617
|
content: n
|
|
1612
1618
|
};
|
|
1613
1619
|
}
|
|
1614
|
-
function
|
|
1615
|
-
if (!
|
|
1620
|
+
function Rn(e, t) {
|
|
1621
|
+
if (!Mn(t)) return {
|
|
1616
1622
|
ok: !1,
|
|
1617
1623
|
message: "Expected an element object"
|
|
1618
1624
|
};
|
|
1619
1625
|
let n = t.type;
|
|
1620
|
-
if (!
|
|
1626
|
+
if (!jn(n)) return {
|
|
1621
1627
|
ok: !1,
|
|
1622
1628
|
message: `Unknown element type "${String(n)}"`
|
|
1623
1629
|
};
|
|
1624
|
-
if (
|
|
1630
|
+
if (!$[e].allowedChildren.includes(n)) return {
|
|
1625
1631
|
ok: !1,
|
|
1626
1632
|
message: `${n} is not allowed inside ${e}`
|
|
1627
1633
|
};
|
|
1628
|
-
let { children: r, type: i, ...a } = t, o =
|
|
1634
|
+
let { children: r, type: i, ...a } = t, o = $[n];
|
|
1629
1635
|
if (r !== void 0 && o.allowedChildren.length === 0) return {
|
|
1630
1636
|
ok: !1,
|
|
1631
1637
|
message: `${n} cannot have children`
|
|
@@ -1646,7 +1652,7 @@ function un(e, t) {
|
|
|
1646
1652
|
let l = r === void 0 ? {
|
|
1647
1653
|
ok: !0,
|
|
1648
1654
|
content: []
|
|
1649
|
-
} :
|
|
1655
|
+
} : Ln(n, r);
|
|
1650
1656
|
return l.ok ? {
|
|
1651
1657
|
ok: !0,
|
|
1652
1658
|
item: {
|
|
@@ -1658,19 +1664,19 @@ function un(e, t) {
|
|
|
1658
1664
|
}
|
|
1659
1665
|
} : l;
|
|
1660
1666
|
}
|
|
1661
|
-
function
|
|
1667
|
+
function zn(e, t, n) {
|
|
1662
1668
|
let r = (e) => ({
|
|
1663
1669
|
ok: !1,
|
|
1664
1670
|
message: `Template "${n.name}": ${e}`
|
|
1665
|
-
}), i =
|
|
1671
|
+
}), i = Nn(n.shortcode);
|
|
1666
1672
|
if (!i) return r("Expected a JSON object");
|
|
1667
|
-
let { children: a, type: o, ...s } = i, c = e.toDocumentAttributes(t), l = e.attributes.safeParse(
|
|
1673
|
+
let { children: a, type: o, ...s } = i, c = e.toDocumentAttributes(t), l = e.attributes.safeParse(In(c, s));
|
|
1668
1674
|
if (!l.success) return r(l.error.issues[0]?.message ?? "Invalid template");
|
|
1669
1675
|
if (a === void 0) return {
|
|
1670
1676
|
ok: !0,
|
|
1671
1677
|
props: l.data
|
|
1672
1678
|
};
|
|
1673
|
-
let u =
|
|
1679
|
+
let u = Ln(e.type, a);
|
|
1674
1680
|
return u.ok ? {
|
|
1675
1681
|
ok: !0,
|
|
1676
1682
|
props: l.data,
|
|
@@ -1678,28 +1684,28 @@ function dn(e, t, n) {
|
|
|
1678
1684
|
} : r(u.message);
|
|
1679
1685
|
}
|
|
1680
1686
|
// src/schema/Fields/ColorField/color-value.ts
|
|
1681
|
-
var
|
|
1682
|
-
function
|
|
1687
|
+
var Bn = /^#[0-9A-Fa-f]{6}$/, Vn = /^#[0-9A-Fa-f]{8}$/;
|
|
1688
|
+
function Hn(e) {
|
|
1683
1689
|
return Math.min(100, Math.max(0, Math.round(e)));
|
|
1684
1690
|
}
|
|
1685
|
-
function
|
|
1691
|
+
function Un(e) {
|
|
1686
1692
|
let t = e.hex.toUpperCase();
|
|
1687
|
-
if (!
|
|
1688
|
-
let n =
|
|
1693
|
+
if (!Bn.test(t)) return "#000000FF";
|
|
1694
|
+
let n = Hn(e.opacity);
|
|
1689
1695
|
return `${t}${Math.round(n / 100 * 255).toString(16).padStart(2, "0").toUpperCase()}`;
|
|
1690
1696
|
}
|
|
1691
|
-
function
|
|
1697
|
+
function Wn(e) {
|
|
1692
1698
|
let t = e.trim().toUpperCase();
|
|
1693
|
-
return
|
|
1699
|
+
return Bn.test(t) ? {
|
|
1694
1700
|
hex: t,
|
|
1695
1701
|
opacity: 100
|
|
1696
|
-
} :
|
|
1702
|
+
} : Vn.test(t) ? {
|
|
1697
1703
|
hex: t.slice(0, 7),
|
|
1698
|
-
opacity:
|
|
1704
|
+
opacity: Hn(Number.parseInt(t.slice(7, 9), 16) / 255 * 100)
|
|
1699
1705
|
} : null;
|
|
1700
1706
|
}
|
|
1701
1707
|
// src/schema/device/deviceStyle.ts
|
|
1702
|
-
var
|
|
1708
|
+
var Gn = {
|
|
1703
1709
|
Desktop: {
|
|
1704
1710
|
portrait: "style",
|
|
1705
1711
|
landscape: "style"
|
|
@@ -1713,25 +1719,25 @@ var _n = {
|
|
|
1713
1719
|
landscape: "mobileLandscapeStyle"
|
|
1714
1720
|
}
|
|
1715
1721
|
};
|
|
1716
|
-
function
|
|
1717
|
-
return
|
|
1722
|
+
function Kn(e, t = "portrait") {
|
|
1723
|
+
return Gn[e][t];
|
|
1718
1724
|
}
|
|
1719
|
-
function
|
|
1720
|
-
let r =
|
|
1725
|
+
function qn(e, t, n = "portrait") {
|
|
1726
|
+
let r = Kn(t, n);
|
|
1721
1727
|
return r === "style" ? {} : e[r] ?? {};
|
|
1722
1728
|
}
|
|
1723
|
-
function
|
|
1729
|
+
function Jn(e, t) {
|
|
1724
1730
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
1725
1731
|
}
|
|
1726
|
-
function
|
|
1727
|
-
return Object.fromEntries(Object.entries(t).filter(([t, n]) => n !== void 0 && !
|
|
1732
|
+
function Yn(e, t) {
|
|
1733
|
+
return Object.fromEntries(Object.entries(t).filter(([t, n]) => n !== void 0 && !Jn(n, e[t])));
|
|
1728
1734
|
}
|
|
1729
|
-
function
|
|
1730
|
-
let r = n === "landscape" ?
|
|
1735
|
+
function Xn(e, t, n = "portrait") {
|
|
1736
|
+
let r = n === "landscape" ? qn(e, t, "landscape") : {};
|
|
1731
1737
|
return {
|
|
1732
1738
|
...e.style,
|
|
1733
|
-
|
|
1739
|
+
...qn(e, t, "portrait"),
|
|
1734
1740
|
...r
|
|
1735
1741
|
};
|
|
1736
1742
|
}
|
|
1737
|
-
export {
|
|
1743
|
+
export { h as BORDER_LINE_STYLES, u as COLOR_NAMES, qe as DEVICE_CHOICES, ye as FLEX_ALIGN_CONTENTS, ve as FLEX_ALIGN_ITEMS, he as FLEX_DIRECTIONS, _e as FLEX_JUSTIFY_CONTENTS, ge as FLEX_WRAPS, gn as FONT_STYLES, bn as FONT_WEIGHTS, Gt as IMAGE_LENGTH_KEYS, K as IMAGE_PREFIX, Ge as LANDSCAPE_VISIBILITY_PROP_BY_DEVICE, _ as LENGTH_PATTERN, At as NO_ICON, n as OPACITY_STEPS, ie as SPACING_TOKENS, vn as TEXT_ALIGNS, _n as TEXT_DECORATIONS, Sn as TEXT_PREFIX, r as TEXT_SIZE_TOKENS, yn as TEXT_TRANSFORMS, Ke as VISIBILITY_PROPS, E as VISIBILITY_PROP_BY_DEVICE, N as addressSchema, zn as applyElementTemplate, w as backgroundStyleDefinitions, me as backgroundStyleToCssVariables, T as builderDevices, He as builderViewports, Yn as changedStyle, C as colorValue, ue as colorValueToCss, Mt as defaultButtonProps, H as defaultCheckboxProps, Lt as defaultContainerStyle, Bt as defaultDividerProps, g as defaultElementStyle, G as defaultIconProps, Kt as defaultImageProps, P as defaultLinkSettings, Yt as defaultListProps, X as defaultPageStyle, en as defaultRadioProps, mn as defaultRichTextProps, nn as defaultSectionStyle, an as defaultSelectProps, sn as defaultTableProps, Tn as defaultTextAreaProps, Dn as defaultTextFieldProps, xn as defaultTextProps, kn as defaultVideoProps, p as defineElement, U as defineLayoutElement, Ue as deviceForWidth, qn as deviceOverride, Kn as deviceStyleProp, f as elementIdSchema, $ as elementRegistry, Dt as elementStyleDefinitions, Ot as elementStyleSchema, De as elementStyleToCssVariables, cn as fitRowsToHeaders, Wn as fromHexAlpha, se as gradientToCss, jn as isElementType, xt as isFontFamily, z as isOutlineIconName, ee as isPaletteColor, m as isSafeGradientArgs, D as isShownOn, jt as labelForIcon, W as layoutChildren, R as lengthKeys, S as lengthValue, I as linkHistoryLabels, F as linkSettingsShape, fn as normalizeRichText, We as orientationForWidth, Ft as pButtonDefinition, It as pCheckboxDefinition, Rt as pContainerDefinition, Vt as pDividerDefinition, Ht as pIconDefinition, Jt as pImageDefinition, Xt as pListDefinition, $t as pPageDefinition, tn as pRadioDefinition, hn as pRichTextDefinition, rn as pSectionDefinition, on as pSelectDefinition, un as pTableDefinition, En as pTextAreaDefinition, wn as pTextDefinition, On as pTextFieldDefinition, An as pVideoDefinition, Qt as pageStyleKeys, re as pageTokensToVarValues, Xn as resolveDeviceStyle, pn as richTextToPlainText, y as sanitizeAutoAsZero, Se as sanitizeBorderWidth, v as sanitizeLength, xe as sanitizeMaxLength, Ye as shownDeviceCount, O as styleItemsSchema, k as styleLabels, tt as styleOverrideItemsSchema, te as styleToClasses, J as textItemsSchema, de as textSizeToCss, Cn as textStyleDefinitions, Un as toHexAlpha, L as toLinkAttributes, o as toPaletteColor, a as toSpacingToken, A as toStyleItems, it as toStyleOverrideItems, Y as toTextItems, e as toTextSizeToken, s as unresolvedStyleForVars, Je as visibilityProp, M as withDeviceSettings };
|