@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.
Files changed (70) hide show
  1. package/dist/definitions.d.ts +23 -20
  2. package/dist/definitions.js +692 -686
  3. package/dist/elements/button/definition.d.ts +38 -0
  4. package/dist/elements/button/template.d.ts +2 -0
  5. package/dist/elements/checkbox/definition.d.ts +10 -0
  6. package/dist/elements/checkbox/template.d.ts +2 -0
  7. package/dist/elements/container/definition.d.ts +39 -0
  8. package/dist/elements/container/template.d.ts +2 -0
  9. package/dist/elements/divider/definition.d.ts +10 -0
  10. package/dist/elements/divider/template.d.ts +2 -0
  11. package/dist/elements/icon/definition.d.ts +18 -0
  12. package/dist/elements/icon/template.d.ts +2 -0
  13. package/dist/{schema/PImage/pImage.definition.d.ts → elements/image/definition.d.ts} +8 -8
  14. package/dist/elements/image/template.d.ts +2 -0
  15. package/dist/elements/list/definition.d.ts +11 -0
  16. package/dist/elements/list/template.d.ts +2 -0
  17. package/dist/elements/page/definition.d.ts +22 -0
  18. package/dist/elements/page/template.d.ts +2 -0
  19. package/dist/elements/radio/definition.d.ts +13 -0
  20. package/dist/elements/radio/template.d.ts +2 -0
  21. package/dist/elements/rich-text/definition.d.ts +8 -0
  22. package/dist/elements/rich-text/template.d.ts +2 -0
  23. package/dist/elements/section/definition.d.ts +39 -0
  24. package/dist/elements/section/template.d.ts +2 -0
  25. package/dist/elements/select/definition.d.ts +13 -0
  26. package/dist/elements/select/template.d.ts +2 -0
  27. package/dist/{schema/PTable/pTable.definition.d.ts → elements/table/definition.d.ts} +2 -2
  28. package/dist/elements/table/template.d.ts +2 -0
  29. package/dist/{schema/PText/pText.definition.d.ts → elements/text/definition.d.ts} +9 -9
  30. package/dist/elements/text/template.d.ts +2 -0
  31. package/dist/elements/text-area/definition.d.ts +10 -0
  32. package/dist/elements/text-area/template.d.ts +2 -0
  33. package/dist/elements/text-field/definition.d.ts +10 -0
  34. package/dist/elements/text-field/template.d.ts +2 -0
  35. package/dist/elements/video/definition.d.ts +10 -0
  36. package/dist/elements/video/template.d.ts +2 -0
  37. package/dist/manifest.json +2 -2
  38. package/dist/plmt-elements.css +2 -1
  39. package/dist/render/styleToClasses.d.ts +35 -0
  40. package/dist/render/styleTokens.d.ts +57 -0
  41. package/dist/render/types.d.ts +6 -0
  42. package/dist/schema/Fields/BackgroundField/backgroundValue.d.ts +4 -3
  43. package/dist/schema/backgroundStyleDefinitions.d.ts +1 -6
  44. package/dist/schema/elementRegistry.d.ts +14 -14
  45. package/dist/schema/elementStyleDefinitions.d.ts +1 -1
  46. package/dist/schema/style/elementStyle.d.ts +2 -2
  47. package/dist/schema/style/page-styles.d.ts +2 -2
  48. package/dist/schema/styleTokensSchema.d.ts +274 -0
  49. package/dist/styleToClasses-CZSWp6Ez.js +683 -0
  50. package/dist/templates/elementSpec.d.ts +2 -7
  51. package/dist/templates/helpers.d.ts +9 -1
  52. package/dist/templates.d.ts +3 -1
  53. package/dist/templates.js +252 -172
  54. package/package.json +3 -1
  55. package/dist/schema/PButton/pButton.definition.d.ts +0 -38
  56. package/dist/schema/PCheckbox/pCheckbox.definition.d.ts +0 -10
  57. package/dist/schema/PContainer/pContainer.definition.d.ts +0 -39
  58. package/dist/schema/PDivider/pDivider.definition.d.ts +0 -10
  59. package/dist/schema/PIcon/pIcon.definition.d.ts +0 -18
  60. package/dist/schema/PList/pList.definition.d.ts +0 -11
  61. package/dist/schema/PPage/pPage.definition.d.ts +0 -22
  62. package/dist/schema/PRadio/pRadio.definition.d.ts +0 -13
  63. package/dist/schema/PRichText/pRichText.definition.d.ts +0 -8
  64. package/dist/schema/PSection/pSection.definition.d.ts +0 -39
  65. package/dist/schema/PSelect/pSelect.definition.d.ts +0 -13
  66. package/dist/schema/PTextArea/pTextArea.definition.d.ts +0 -10
  67. package/dist/schema/PTextField/pTextField.definition.d.ts +0 -10
  68. package/dist/schema/PVideo/pVideo.definition.d.ts +0 -10
  69. /package/dist/{schema/PRichText → elements/rich-text}/richTextMarks.d.ts +0 -0
  70. /package/dist/{schema/PRichText → elements/rich-text}/richTextOptions.d.ts +0 -0
@@ -0,0 +1,683 @@
1
+ // src/render/styleTokens.ts
2
+ var e = /* @__PURE__ */ "0,px,0.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,auto".split(","), t = [
3
+ "0",
4
+ "1",
5
+ "2",
6
+ "4",
7
+ "8"
8
+ ], n = /* @__PURE__ */ "none,sm,md,lg,xl,2xl,3xl,full,0,px,0.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16".split(","), r = [
9
+ "xs",
10
+ "sm",
11
+ "base",
12
+ "lg",
13
+ "xl",
14
+ "2xl",
15
+ "3xl",
16
+ "4xl",
17
+ "5xl",
18
+ "6xl"
19
+ ], i = [
20
+ "none",
21
+ "tight",
22
+ "snug",
23
+ "normal",
24
+ "relaxed",
25
+ "loose",
26
+ "3",
27
+ "4",
28
+ "5",
29
+ "6",
30
+ "7",
31
+ "8",
32
+ "9",
33
+ "10"
34
+ ], a = [
35
+ "tighter",
36
+ "tight",
37
+ "normal",
38
+ "wide",
39
+ "wider",
40
+ "widest"
41
+ ], o = [
42
+ "accent",
43
+ "transparent",
44
+ "white",
45
+ "black",
46
+ "slate-50",
47
+ "slate-100",
48
+ "slate-200",
49
+ "slate-300",
50
+ "slate-400",
51
+ "slate-500",
52
+ "slate-600",
53
+ "slate-700",
54
+ "slate-800",
55
+ "slate-900",
56
+ "slate-950"
57
+ ], s = [
58
+ 0,
59
+ 5,
60
+ 10,
61
+ 15,
62
+ 20,
63
+ 25,
64
+ 30,
65
+ 40,
66
+ 50,
67
+ 60,
68
+ 70,
69
+ 75,
70
+ 80,
71
+ 90,
72
+ 95,
73
+ 100
74
+ ], c = new Set(e), l = new Set(t), u = new Set(n), d = new Set(r), f = new Set(i), p = new Set(a), m = new Set(o), ee = new Set(s), te = {
75
+ 0: "0",
76
+ "0px": "0",
77
+ "0rem": "0",
78
+ "0em": "0",
79
+ "1px": "px",
80
+ "0.125rem": "0.5",
81
+ "2px": "0.5",
82
+ "0.25rem": "1",
83
+ "4px": "1",
84
+ "0.375rem": "1.5",
85
+ "6px": "1.5",
86
+ "0.5rem": "2",
87
+ "8px": "2",
88
+ "0.625rem": "2.5",
89
+ "10px": "2.5",
90
+ "0.75rem": "3",
91
+ "12px": "3",
92
+ "0.875rem": "3.5",
93
+ "14px": "3.5",
94
+ "1rem": "4",
95
+ "16px": "4",
96
+ "1.25rem": "5",
97
+ "20px": "5",
98
+ "1.5rem": "6",
99
+ "24px": "6",
100
+ "1.75rem": "7",
101
+ "28px": "7",
102
+ "2rem": "8",
103
+ "32px": "8",
104
+ "2.25rem": "9",
105
+ "36px": "9",
106
+ "2.5rem": "10",
107
+ "40px": "10",
108
+ "2.75rem": "11",
109
+ "44px": "11",
110
+ "3rem": "12",
111
+ "48px": "12",
112
+ "3.5rem": "14",
113
+ "56px": "14",
114
+ "4rem": "16",
115
+ "64px": "16",
116
+ "5rem": "20",
117
+ "80px": "20",
118
+ "6rem": "24",
119
+ "96px": "24",
120
+ "7rem": "28",
121
+ "112px": "28",
122
+ "8rem": "32",
123
+ "128px": "32",
124
+ "9rem": "36",
125
+ "144px": "36",
126
+ "10rem": "40",
127
+ "160px": "40",
128
+ "11rem": "44",
129
+ "176px": "44",
130
+ "12rem": "48",
131
+ "192px": "48",
132
+ "13rem": "52",
133
+ "208px": "52",
134
+ "14rem": "56",
135
+ "224px": "56",
136
+ "15rem": "60",
137
+ "240px": "60",
138
+ "16rem": "64",
139
+ "256px": "64",
140
+ "18rem": "72",
141
+ "288px": "72",
142
+ "20rem": "80",
143
+ "320px": "80",
144
+ "24rem": "96",
145
+ "384px": "96",
146
+ auto: "auto"
147
+ }, h = {
148
+ 12: "xs",
149
+ 14: "sm",
150
+ 16: "base",
151
+ 18: "lg",
152
+ 20: "xl",
153
+ 24: "2xl",
154
+ 30: "3xl",
155
+ 36: "4xl",
156
+ 48: "5xl",
157
+ 60: "6xl"
158
+ }, g = {
159
+ "#0F766E": "accent",
160
+ "#0F172A": "slate-900",
161
+ "#1E293B": "slate-800",
162
+ "#334155": "slate-700",
163
+ "#475569": "slate-600",
164
+ "#64748B": "slate-500",
165
+ "#94A3B8": "slate-400",
166
+ "#CBD5E1": "slate-300",
167
+ "#E2E8F0": "slate-200",
168
+ "#F1F5F9": "slate-100",
169
+ "#F8FAFC": "slate-50",
170
+ "#020617": "slate-950",
171
+ "#FFFFFF": "white",
172
+ "#000000": "black"
173
+ }, ne = {
174
+ 100: "font-thin",
175
+ 200: "font-extralight",
176
+ 300: "font-light",
177
+ 400: "font-normal",
178
+ 500: "font-medium",
179
+ 600: "font-semibold",
180
+ 700: "font-bold",
181
+ 800: "font-extrabold",
182
+ 900: "font-black",
183
+ thin: "font-thin",
184
+ extralight: "font-extralight",
185
+ light: "font-light",
186
+ normal: "font-normal",
187
+ medium: "font-medium",
188
+ semibold: "font-semibold",
189
+ bold: "font-bold",
190
+ extrabold: "font-extrabold",
191
+ black: "font-black"
192
+ };
193
+ function _(e) {
194
+ return c.has(e);
195
+ }
196
+ function v(e) {
197
+ return l.has(e);
198
+ }
199
+ function y(e) {
200
+ return u.has(e);
201
+ }
202
+ function re(e) {
203
+ return d.has(e);
204
+ }
205
+ function b(e) {
206
+ return f.has(e);
207
+ }
208
+ function x(e) {
209
+ return p.has(e);
210
+ }
211
+ function S(e) {
212
+ if (!e || typeof e != "object") return !1;
213
+ let t = e;
214
+ return typeof t.name == "string" && m.has(t.name) && typeof t.opacity == "number" && ee.has(t.opacity);
215
+ }
216
+ function C(e) {
217
+ if (!e || typeof e != "object" || !("hex" in e) || !("opacity" in e)) return !1;
218
+ let t = e;
219
+ return typeof t.hex == "string" && typeof t.opacity == "number" && !("name" in e);
220
+ }
221
+ function w(e) {
222
+ if (typeof e != "string") return;
223
+ let t = e.trim();
224
+ return _(t) ? t : te[t.toLowerCase()];
225
+ }
226
+ function T(e) {
227
+ if (typeof e == "number" && l.has(String(e))) return String(e);
228
+ if (typeof e != "string") return;
229
+ let t = e.trim();
230
+ return v(t) ? t : {
231
+ 0: "0",
232
+ "0px": "0",
233
+ "1px": "1",
234
+ "2px": "2",
235
+ "4px": "4",
236
+ "8px": "8"
237
+ }[t.toLowerCase()];
238
+ }
239
+ function E(e) {
240
+ if (typeof e != "string") return;
241
+ let t = e.trim();
242
+ if (y(t)) return t;
243
+ let n = w(t);
244
+ return n && y(n) ? n : {
245
+ "0.125rem": "sm",
246
+ "2px": "sm",
247
+ "0.25rem": "md",
248
+ "4px": "md",
249
+ "0.375rem": "md",
250
+ "6px": "md",
251
+ "0.5rem": "lg",
252
+ "8px": "lg",
253
+ "0.75rem": "xl",
254
+ "12px": "xl",
255
+ "1rem": "2xl",
256
+ "16px": "2xl",
257
+ "1.5rem": "3xl",
258
+ "24px": "3xl",
259
+ "9999px": "full"
260
+ }[t.toLowerCase()];
261
+ }
262
+ function D(e) {
263
+ if (typeof e == "number") return h[e];
264
+ if (typeof e != "string") return;
265
+ let t = e.trim();
266
+ if (re(t)) return t;
267
+ let n = /^(\d+(?:\.\d+)?)px$/i.exec(t);
268
+ if (n) return h[Number(n[1])];
269
+ }
270
+ function O(e) {
271
+ if (typeof e != "string") return;
272
+ let t = e.trim();
273
+ return b(t) ? t : {
274
+ 1: "none",
275
+ "1.25": "tight",
276
+ "1.375": "snug",
277
+ "1.4": "snug",
278
+ "1.5": "normal",
279
+ "1.625": "relaxed",
280
+ 2: "loose"
281
+ }[t.toLowerCase()];
282
+ }
283
+ function k(e) {
284
+ if (typeof e != "string") return;
285
+ let t = e.trim();
286
+ if (x(t)) return t;
287
+ }
288
+ function A(e) {
289
+ if (S(e)) return e;
290
+ if (!C(e)) return;
291
+ let t = g[e.hex.toUpperCase()];
292
+ if (!t) return;
293
+ let n = s.reduce((t, n) => Math.abs(n - e.opacity) < Math.abs(t - e.opacity) ? n : t);
294
+ if (!(Math.abs(n - e.opacity) > 2 && e.opacity !== 100 && ![
295
+ 0,
296
+ 5,
297
+ 10,
298
+ 15,
299
+ 20,
300
+ 25,
301
+ 30,
302
+ 40,
303
+ 50,
304
+ 60,
305
+ 70,
306
+ 75,
307
+ 80,
308
+ 90,
309
+ 95,
310
+ 100
311
+ ].includes(e.opacity) && !s.find((t) => t === e.opacity))) return {
312
+ name: t,
313
+ opacity: s.includes(e.opacity) ? e.opacity : n
314
+ };
315
+ }
316
+ function j(e) {
317
+ if (typeof e == "string" || typeof e == "number") return ne[String(e)];
318
+ }
319
+ function M(e, t) {
320
+ return t.name === "transparent" ? `${e}-transparent` : t.opacity === 100 ? `${e}-${t.name}` : `${e}-${t.name}/${t.opacity}`;
321
+ }
322
+ function N(e, t) {
323
+ return `${e}-${t}`;
324
+ }
325
+ function P(e, t) {
326
+ return t === "none" ? e === "rounded" ? "rounded-none" : `${e}-none` : t === "md" && e === "rounded" ? "rounded-md" : `${e}-${t}`;
327
+ }
328
+ function F(e) {
329
+ return e === "1" ? "border" : `border-${e}`;
330
+ }
331
+ function I(e) {
332
+ return `text-${e}`;
333
+ }
334
+ function L(e) {
335
+ return `leading-${e}`;
336
+ }
337
+ function R(e) {
338
+ return `tracking-${e}`;
339
+ }
340
+ function z(e) {
341
+ return {
342
+ xs: "0.75rem",
343
+ sm: "0.875rem",
344
+ base: "1rem",
345
+ lg: "1.125rem",
346
+ xl: "1.25rem",
347
+ "2xl": "1.5rem",
348
+ "3xl": "1.875rem",
349
+ "4xl": "2.25rem",
350
+ "5xl": "3rem",
351
+ "6xl": "3.75rem"
352
+ }[e];
353
+ }
354
+ function B(e) {
355
+ if (e.name === "transparent") return "transparent";
356
+ let t = {
357
+ accent: "#0F766E",
358
+ white: "#FFFFFF",
359
+ black: "#000000",
360
+ "slate-50": "#F8FAFC",
361
+ "slate-100": "#F1F5F9",
362
+ "slate-200": "#E2E8F0",
363
+ "slate-300": "#CBD5E1",
364
+ "slate-400": "#94A3B8",
365
+ "slate-500": "#64748B",
366
+ "slate-600": "#475569",
367
+ "slate-700": "#334155",
368
+ "slate-800": "#1E293B",
369
+ "slate-900": "#0F172A",
370
+ "slate-950": "#020617"
371
+ }[e.name];
372
+ if (e.opacity === 100) return t;
373
+ let n = e.opacity / 100;
374
+ return `rgba(${Number.parseInt(t.slice(1, 3), 16)}, ${Number.parseInt(t.slice(3, 5), 16)}, ${Number.parseInt(t.slice(5, 7), 16)}, ${n})`;
375
+ }
376
+ // src/render/styleToClasses.ts
377
+ var V = {
378
+ tabletStyle: "tablet:",
379
+ mobileStyle: "mobile:",
380
+ tabletLandscapeStyle: "tablet-landscape:",
381
+ mobileLandscapeStyle: "mobile-landscape:"
382
+ }, H = {
383
+ PButton: [
384
+ "inline-flex",
385
+ "items-center",
386
+ "justify-center",
387
+ "h-10",
388
+ "px-3",
389
+ "rounded-md",
390
+ "bg-accent/10",
391
+ "text-accent"
392
+ ],
393
+ PSection: ["flex", "flex-col"],
394
+ PContainer: ["flex", "flex-col"],
395
+ PText: [
396
+ "text-sm",
397
+ "leading-snug",
398
+ "whitespace-pre-wrap",
399
+ "break-words"
400
+ ],
401
+ PRichText: ["text-sm", "leading-snug"],
402
+ PIcon: [
403
+ "inline-flex",
404
+ "items-center",
405
+ "justify-center"
406
+ ],
407
+ PImage: ["max-w-full"],
408
+ PVideo: [
409
+ "block",
410
+ "w-full",
411
+ "max-w-full",
412
+ "h-auto"
413
+ ],
414
+ PList: ["block"],
415
+ PDivider: ["block"],
416
+ PTable: ["block"],
417
+ PTextField: ["block"],
418
+ PTextArea: ["block"],
419
+ PCheckbox: ["block"],
420
+ PRadio: ["block"],
421
+ PSelect: ["block"]
422
+ }, ie = {
423
+ row: "flex-row",
424
+ column: "flex-col",
425
+ "row-reverse": "flex-row-reverse",
426
+ "column-reverse": "flex-col-reverse"
427
+ }, U = {
428
+ nowrap: "flex-nowrap",
429
+ wrap: "flex-wrap",
430
+ "wrap-reverse": "flex-wrap-reverse"
431
+ }, W = {
432
+ "flex-start": "justify-start",
433
+ center: "justify-center",
434
+ "flex-end": "justify-end",
435
+ "space-between": "justify-between",
436
+ "space-around": "justify-around",
437
+ "space-evenly": "justify-evenly"
438
+ }, G = {
439
+ stretch: "items-stretch",
440
+ "flex-start": "items-start",
441
+ center: "items-center",
442
+ "flex-end": "items-end",
443
+ baseline: "items-baseline"
444
+ }, K = {
445
+ stretch: "content-stretch",
446
+ "flex-start": "content-start",
447
+ center: "content-center",
448
+ "flex-end": "content-end",
449
+ "space-between": "content-between",
450
+ "space-around": "content-around",
451
+ "space-evenly": "content-evenly"
452
+ }, q = {
453
+ none: "no-underline",
454
+ underline: "underline",
455
+ overline: "overline",
456
+ "line-through": "line-through"
457
+ }, J = {
458
+ left: "text-left",
459
+ center: "text-center",
460
+ right: "text-right",
461
+ justify: "text-justify"
462
+ }, Y = {
463
+ none: "normal-case",
464
+ capitalize: "capitalize",
465
+ uppercase: "uppercase",
466
+ lowercase: "lowercase"
467
+ }, ae = {
468
+ none: "border-none",
469
+ solid: "border-solid",
470
+ dashed: "border-dashed",
471
+ dotted: "border-dotted",
472
+ double: "border-double"
473
+ }, oe = {
474
+ width: "w",
475
+ height: "h",
476
+ minWidth: "min-w",
477
+ minHeight: "min-h",
478
+ maxWidth: "max-w",
479
+ maxHeight: "max-h",
480
+ paddingTop: "pt",
481
+ paddingBottom: "pb",
482
+ paddingLeft: "pl",
483
+ paddingRight: "pr",
484
+ marginTop: "mt",
485
+ marginBottom: "mb",
486
+ marginLeft: "ml",
487
+ marginRight: "mr",
488
+ rowGap: "gap-y",
489
+ columnGap: "gap-x",
490
+ iconGap: "gap"
491
+ }, se = {
492
+ borderRadiusTopLeft: "rounded-tl",
493
+ borderRadiusTopRight: "rounded-tr",
494
+ borderRadiusBottomRight: "rounded-br",
495
+ borderRadiusBottomLeft: "rounded-bl"
496
+ }, ce = /* @__PURE__ */ new Set(["textFont", "wordSpacing"]);
497
+ function le(e, t) {
498
+ return e ? `${e}${t}` : t;
499
+ }
500
+ function X(e, t, n) {
501
+ n && e.push(le(t, n));
502
+ }
503
+ function ue(e, t, n, r) {
504
+ let i = e.layout;
505
+ if (i === "grid") X(t, n, "grid"), typeof e.gridColumns == "number" && X(t, n, `grid-cols-${e.gridColumns}`);
506
+ else if (i === "flex") X(t, n, "flex"), X(t, n, ie[String(e.flexDirection ?? "row")]), X(t, n, U[String(e.flexWrap ?? "nowrap")]), X(t, n, W[String(e.justifyContent ?? "flex-start")]), X(t, n, G[String(e.alignItems ?? "stretch")]), X(t, n, K[String(e.alignContent ?? "stretch")]);
507
+ else if (i === "block") {
508
+ if (r === "PSection" || r === "PContainer") {
509
+ if (!n) return;
510
+ X(t, n, "flex"), X(t, n, "flex-col");
511
+ return;
512
+ }
513
+ X(t, n, "block");
514
+ }
515
+ }
516
+ function de(e, t, n) {
517
+ if (e.overflow === "hide") X(t, n, "overflow-hidden");
518
+ else if (e.overflow === "show") {
519
+ let r = e.overflowHorizontal === !1 ? "overflow-x-hidden" : "overflow-x-auto", i = e.overflowVertical === !1 ? "overflow-y-hidden" : "overflow-y-auto";
520
+ X(t, n, r), X(t, n, i);
521
+ }
522
+ }
523
+ function fe(e, t, n, r) {
524
+ for (let [i, a] of Object.entries(oe)) {
525
+ if (e[i] === void 0) continue;
526
+ let o = w(e[i]);
527
+ o ? (i === "maxWidth" || i === "maxHeight") && o === "auto" ? X(t, n, `${a}-none`) : X(t, n, N(a, o)) : r[i] = e[i];
528
+ }
529
+ }
530
+ function pe(e, t, n, r) {
531
+ for (let [i, a] of Object.entries(se)) {
532
+ if (e[i] === void 0) continue;
533
+ let o = E(e[i]);
534
+ o ? X(t, n, P(a, o)) : r[i] = e[i];
535
+ }
536
+ }
537
+ function me(e, t, n, r) {
538
+ if (e.backgroundType === "gradient") r.backgroundType = e.backgroundType, e.backgroundGradient !== void 0 && (r.backgroundGradient = e.backgroundGradient), r.backgroundColor = {
539
+ hex: "#000000",
540
+ opacity: 0
541
+ };
542
+ else {
543
+ if (e.backgroundType === "color" || e.backgroundColor !== void 0) {
544
+ let i = A(e.backgroundColor);
545
+ i ? X(t, n, M("bg", i)) : e.backgroundColor !== void 0 && (r.backgroundColor = e.backgroundColor, e.backgroundType !== void 0 && (r.backgroundType = e.backgroundType));
546
+ }
547
+ if (e.textColor !== void 0) {
548
+ let i = A(e.textColor);
549
+ i ? X(t, n, M("text", i)) : r.textColor = e.textColor;
550
+ }
551
+ if (e.borderColor !== void 0) {
552
+ let i = A(e.borderColor);
553
+ i ? X(t, n, M("border", i)) : r.borderColor = e.borderColor;
554
+ }
555
+ }
556
+ }
557
+ function Z(e, t, n, r) {
558
+ if (e.borderWidth !== void 0) {
559
+ let i = T(e.borderWidth);
560
+ i ? X(t, n, F(i)) : r.borderWidth = e.borderWidth;
561
+ }
562
+ typeof e.borderStyle == "string" && X(t, n, ae[e.borderStyle]);
563
+ }
564
+ function he(e, t, n, r) {
565
+ if (e.textSize !== void 0) {
566
+ let i = D(e.textSize);
567
+ i ? X(t, n, I(i)) : r.textSize = e.textSize;
568
+ }
569
+ if (e.lineHeight !== void 0) {
570
+ let i = O(e.lineHeight);
571
+ i ? X(t, n, L(i)) : r.lineHeight = e.lineHeight;
572
+ }
573
+ if (e.letterSpacing !== void 0) {
574
+ let i = k(e.letterSpacing);
575
+ i ? X(t, n, R(i)) : r.letterSpacing = e.letterSpacing;
576
+ }
577
+ e.fontWeight !== void 0 && X(t, n, j(e.fontWeight)), typeof e.fontStyle == "string" && X(t, n, e.fontStyle === "italic" ? "italic" : "not-italic"), typeof e.textDecoration == "string" && X(t, n, q[e.textDecoration]), typeof e.textAlign == "string" && X(t, n, J[e.textAlign]), typeof e.textTransform == "string" && X(t, n, Y[e.textTransform]), e.textFont !== void 0 && (r.textFont = e.textFont), e.wordSpacing !== void 0 && (r.wordSpacing = e.wordSpacing);
578
+ }
579
+ function Q(e, t, n = "") {
580
+ let r = [], i = {};
581
+ if (!t) return {
582
+ classes: r,
583
+ unresolved: i
584
+ };
585
+ ue(t, r, n, e), de(t, r, n), fe(t, r, n, i), pe(t, r, n, i), Z(t, r, n, i), me(t, r, n, i), he(t, r, n, i);
586
+ for (let e of ce) t[e] !== void 0 && i[e] === void 0 && (i[e] = t[e]);
587
+ return {
588
+ classes: r.filter(Boolean),
589
+ unresolved: i
590
+ };
591
+ }
592
+ function ge(e, t) {
593
+ if (e === "PPage") return [];
594
+ let n = t.style?.layout, r = H[e] ?? [], i = (e === "PSection" || e === "PContainer") && (n === "flex" || n === "grid") ? r.filter((e) => e !== "flex" && e !== "flex-col") : [...r], a = Q(e, t.style, "");
595
+ i.push(...a.classes);
596
+ for (let [n, r] of Object.entries(V)) {
597
+ let a = t[n];
598
+ if (!a || Object.keys(a).length === 0) continue;
599
+ let { classes: o } = Q(e, a, r);
600
+ i.push(...o);
601
+ }
602
+ return i;
603
+ }
604
+ function _e(e, t) {
605
+ return e === "PPage" ? ve(t ?? {}) : Q(e, t).unresolved;
606
+ }
607
+ function ve(e) {
608
+ let t = {};
609
+ if (e.backgroundColor !== void 0 || e.backgroundColor === void 0) {
610
+ let n = e.backgroundColor === void 0 ? void 0 : e.backgroundColor;
611
+ if (n !== void 0) {
612
+ let e = A(n);
613
+ t.backgroundColor = e ? $(e, n) : n;
614
+ }
615
+ }
616
+ if (e.textColor !== void 0) {
617
+ let n = A(e.textColor);
618
+ t.textColor = n ? $(n, e.textColor) : e.textColor;
619
+ }
620
+ if (e.textSize !== void 0) {
621
+ let n = D(e.textSize);
622
+ t.textSize = n ? z(n) : e.textSize;
623
+ }
624
+ return t;
625
+ }
626
+ function $(e, t) {
627
+ let n = B(e);
628
+ if (n) {
629
+ if (C(t) && e.opacity === 100) return {
630
+ hex: n.startsWith("#") ? n : t.hex,
631
+ opacity: 100
632
+ };
633
+ if (n.startsWith("#")) return {
634
+ hex: n,
635
+ opacity: 100
636
+ };
637
+ if (n.startsWith("rgba")) return t;
638
+ }
639
+ return t;
640
+ }
641
+ function ye(e) {
642
+ let t = {};
643
+ if (e.backgroundColor !== void 0) {
644
+ let n = A(e.backgroundColor);
645
+ if (n) {
646
+ let r = B(n);
647
+ if (r?.startsWith("#")) t.backgroundColor = {
648
+ hex: r,
649
+ opacity: 100
650
+ };
651
+ else if (C(e.backgroundColor)) t.backgroundColor = e.backgroundColor;
652
+ else if (n.opacity < 100 && r?.startsWith("rgba")) {
653
+ let r = B({
654
+ ...n,
655
+ opacity: 100
656
+ });
657
+ t.backgroundColor = r?.startsWith("#") ? {
658
+ hex: r,
659
+ opacity: n.opacity
660
+ } : e.backgroundColor;
661
+ } else t.backgroundColor = e.backgroundColor;
662
+ } else t.backgroundColor = e.backgroundColor;
663
+ }
664
+ if (e.textColor !== void 0) {
665
+ let n = A(e.textColor);
666
+ if (n) {
667
+ let r = B({
668
+ ...n,
669
+ opacity: 100
670
+ });
671
+ t.textColor = r?.startsWith("#") ? {
672
+ hex: r,
673
+ opacity: n.opacity
674
+ } : e.textColor;
675
+ } else t.textColor = e.textColor;
676
+ }
677
+ if (e.textSize !== void 0) {
678
+ let n = D(e.textSize);
679
+ t.textSize = n ? z(n) : (e.textSize, e.textSize);
680
+ }
681
+ return t;
682
+ }
683
+ export { D as _, t as a, s as c, r as d, a as f, w as g, A as h, _e as i, n as l, B as m, Q as n, o, S as p, ge as r, i as s, ye as t, e as u };
@@ -1,10 +1,5 @@
1
- import { ElementType } from '../schema/elementConfiguration';
2
- import { ElementSpec, ElementSpecOptions } from '../render/types';
3
- export type ShortcodeNode = {
4
- type: ElementType;
5
- props: Record<string, unknown>;
6
- children?: ShortcodeNode[];
7
- };
1
+ import { ElementSpec, ElementSpecOptions, ShortcodeNode } from '../render/types';
2
+ export type { ShortcodeNode };
8
3
  /**
9
4
  * Convert one shortcode node into a semantic HTML element spec without recursing
10
5
  * into layout children. Pass `options.children` for slots (builder) or let
@@ -1,3 +1,4 @@
1
+ import { ElementType } from '../schema/elementConfiguration';
1
2
  import { ElementAttribute, CssVariables, ElementSpec } from '../render/types';
2
3
  import { tags, ShortcodeTag } from '../render/tags';
3
4
  export declare function spec(tag: string, attrs?: Record<string, ElementAttribute>, children?: ElementSpec['children'], styleVars?: CssVariables): ElementSpec;
@@ -5,5 +6,12 @@ export declare function withClass(className: ShortcodeTag, attrs?: Record<string
5
6
  export declare function linked(props: Record<string, unknown>, children: Array<ElementSpec | string>): Array<ElementSpec | string>;
6
7
  export declare function cssPrefix(type: string): string;
7
8
  export declare function nodeId(props: Record<string, unknown>): string;
8
- export declare function hostAttrs(props: Record<string, unknown>, className: ShortcodeTag): Record<string, ElementAttribute>;
9
+ export declare function hostAttrs(props: Record<string, unknown>, className: ShortcodeTag, type?: ElementType): Record<string, ElementAttribute>;
10
+ /** Host attributes plus CSS variables for style keys that are not Tailwind tokens. */
11
+ export declare function withStyle(type: ElementType, props: Record<string, unknown>): {
12
+ attrs: Record<string, ElementAttribute>;
13
+ vars: CssVariables;
14
+ };
15
+ /** Page theme variables (utilities nest under .plmt-page and do not style the root). */
16
+ export declare function pageStyleVars(props: Record<string, unknown>): CssVariables;
9
17
  export { tags };