@adityabheke/renderer-package 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,898 @@
1
+ // src/renderer/PageRenderer.tsx
2
+ import React2, { useEffect } from "react";
3
+
4
+ // src/renderer/utils/utils.ts
5
+ import { clsx } from "clsx";
6
+ import { twMerge } from "tailwind-merge";
7
+ function cn(...inputs) {
8
+ return twMerge(clsx(inputs));
9
+ }
10
+
11
+ // src/renderer/utils/responsive.ts
12
+ var ANIMATION_VARIANTS = {
13
+ none: "",
14
+ fadeIn: "animate-in fade-in duration-700 fill-mode-both",
15
+ fromBottom: "animate-in fade-in slide-in-from-bottom-5 duration-700 fill-mode-both",
16
+ fromTop: "animate-in fade-in slide-in-from-top-5 duration-700 fill-mode-both",
17
+ fromLeft: "animate-in fade-in slide-in-from-left-5 duration-700 fill-mode-both",
18
+ fromRight: "animate-in fade-in slide-in-from-right-5 duration-700 fill-mode-both"
19
+ };
20
+ var FONT_SCALE_MAP = {
21
+ XS: "12px",
22
+ SM: "16px",
23
+ MD: "20px",
24
+ LG: "34px",
25
+ XL: "48px"
26
+ };
27
+ function buildFontWeightVars(fontWeight) {
28
+ return {
29
+ "--fw-base": fontWeight?.mobile || "400",
30
+ "--fw-sm": fontWeight?.mobile || "400",
31
+ "--fw-md": fontWeight?.tablet || "400",
32
+ "--fw-lg": fontWeight?.tablet || "400",
33
+ "--fw-xl": fontWeight?.desktop || "400",
34
+ "--fw-2xl": fontWeight?.desktop || "400"
35
+ };
36
+ }
37
+ function buildTextAlignVars(textAlign) {
38
+ return {
39
+ "--ta-base": textAlign?.mobile || "left",
40
+ "--ta-sm": textAlign?.mobile || "left",
41
+ "--ta-md": textAlign?.tablet || "left",
42
+ "--ta-lg": textAlign?.tablet || "left",
43
+ "--ta-xl": textAlign?.desktop || "left",
44
+ "--ta-2xl": textAlign?.desktop || "left"
45
+ };
46
+ }
47
+ function buildFontSizeVars(fontScale) {
48
+ return {
49
+ "--fs-base": FONT_SCALE_MAP[fontScale?.mobile || "XS"],
50
+ "--fs-sm": FONT_SCALE_MAP[fontScale?.mobile || "SM"],
51
+ "--fs-md": FONT_SCALE_MAP[fontScale?.tablet || "MD"],
52
+ "--fs-lg": FONT_SCALE_MAP[fontScale?.tablet || "LG"],
53
+ "--fs-xl": FONT_SCALE_MAP[fontScale?.desktop || "XL"],
54
+ "--fs-2xl": FONT_SCALE_MAP[fontScale?.desktop || "XL"]
55
+ };
56
+ }
57
+ function buildPaddingVars(padding) {
58
+ return {
59
+ "--p-base": `${padding?.mobile || 0}px`,
60
+ "--p-sm": `${padding?.mobile || 0}px`,
61
+ "--p-md": `${padding?.tablet || 0}px`,
62
+ "--p-lg": `${padding?.tablet || 0}px`,
63
+ "--p-xl": `${padding?.desktop || 0}px`,
64
+ "--p-2xl": `${padding?.desktop || 0}px`
65
+ };
66
+ }
67
+ var LEVEL_TO_SCALE = {
68
+ h1: "XL",
69
+ h2: "LG",
70
+ h3: "MD",
71
+ h4: "SM",
72
+ h5: "XS",
73
+ h6: "XS"
74
+ };
75
+ function buildHeadingFontSizeVars(level) {
76
+ return {
77
+ "--fs-base": FONT_SCALE_MAP[LEVEL_TO_SCALE[level?.mobile || "h1"]],
78
+ "--fs-sm": FONT_SCALE_MAP[LEVEL_TO_SCALE[level?.mobile || "h1"]],
79
+ "--fs-md": FONT_SCALE_MAP[LEVEL_TO_SCALE[level?.tablet || "h1"]],
80
+ "--fs-lg": FONT_SCALE_MAP[LEVEL_TO_SCALE[level?.tablet || "h1"]],
81
+ "--fs-xl": FONT_SCALE_MAP[LEVEL_TO_SCALE[level?.desktop || "h1"]],
82
+ "--fs-2xl": FONT_SCALE_MAP[LEVEL_TO_SCALE[level?.desktop || "h1"]]
83
+ };
84
+ }
85
+ function buildButtonFontSizeVars(fontSize) {
86
+ return {
87
+ "--btns-base": `${fontSize?.mobile || 16}px`,
88
+ "--btns-sm": `${fontSize?.mobile || 16}px`,
89
+ "--btns-md": `${fontSize?.tablet || 16}px`,
90
+ "--btns-lg": `${fontSize?.tablet || 16}px`,
91
+ "--btns-xl": `${fontSize?.desktop || 16}px`,
92
+ "--btns-2xl": `${fontSize?.desktop || 16}px`
93
+ };
94
+ }
95
+ function buildButtonPaddingVars(paddingX, paddingY) {
96
+ return {
97
+ "--btnpx-base": `${paddingX?.mobile || 20}px`,
98
+ "--btnpy-base": `${paddingY?.mobile || 10}px`,
99
+ "--btnpx-sm": `${paddingX?.mobile || 20}px`,
100
+ "--btnpy-sm": `${paddingY?.mobile || 10}px`,
101
+ "--btnpx-md": `${paddingX?.tablet || 20}px`,
102
+ "--btnpy-md": `${paddingY?.tablet || 10}px`,
103
+ "--btnpx-lg": `${paddingX?.tablet || 20}px`,
104
+ "--btnpy-lg": `${paddingY?.tablet || 10}px`,
105
+ "--btnpx-xl": `${paddingX?.desktop || 20}px`,
106
+ "--btnpy-xl": `${paddingY?.desktop || 10}px`,
107
+ "--btnpx-2xl": `${paddingX?.desktop || 20}px`,
108
+ "--btnpy-2xl": `${paddingY?.desktop || 10}px`
109
+ };
110
+ }
111
+ function buildButtonRadiusVars(borderRadius) {
112
+ return {
113
+ "--btnr-base": `${borderRadius?.mobile || 4}px`,
114
+ "--btnr-sm": `${borderRadius?.mobile || 4}px`,
115
+ "--btnr-md": `${borderRadius?.tablet || 4}px`,
116
+ "--btnr-lg": `${borderRadius?.tablet || 4}px`,
117
+ "--btnr-xl": `${borderRadius?.desktop || 4}px`,
118
+ "--btnr-2xl": `${borderRadius?.desktop || 4}px`
119
+ };
120
+ }
121
+ function buildWidthHeightVars(width, height) {
122
+ return {
123
+ "--w-base": width?.mobile || "auto",
124
+ "--h-base": height?.mobile || "auto",
125
+ "--w-sm": width?.mobile || "auto",
126
+ "--h-sm": height?.mobile || "auto",
127
+ "--w-md": width?.tablet || "auto",
128
+ "--h-md": height?.tablet || "auto",
129
+ "--w-lg": width?.tablet || "auto",
130
+ "--h-lg": height?.tablet || "auto",
131
+ "--w-xl": width?.desktop || "auto",
132
+ "--h-xl": height?.desktop || "auto",
133
+ "--w-2xl": width?.desktop || "auto",
134
+ "--h-2xl": height?.desktop || "auto"
135
+ };
136
+ }
137
+ function buildBorderRadiusVars(borderRadius) {
138
+ return {
139
+ "--r-base": `${borderRadius?.mobile || 0}px`,
140
+ "--r-sm": `${borderRadius?.mobile || 0}px`,
141
+ "--r-md": `${borderRadius?.tablet || 0}px`,
142
+ "--r-lg": `${borderRadius?.tablet || 0}px`,
143
+ "--r-xl": `${borderRadius?.desktop || 0}px`,
144
+ "--r-2xl": `${borderRadius?.desktop || 0}px`
145
+ };
146
+ }
147
+ function buildMarginVars(margin) {
148
+ return {
149
+ "--m-base": `${margin?.mobile || 0}px`,
150
+ "--m-sm": `${margin?.mobile || 0}px`,
151
+ "--m-md": `${margin?.tablet || 0}px`,
152
+ "--m-lg": `${margin?.tablet || 0}px`,
153
+ "--m-xl": `${margin?.desktop || 0}px`,
154
+ "--m-2xl": `${margin?.desktop || 0}px`
155
+ };
156
+ }
157
+ function buildFlexDirectionVars(direction) {
158
+ return {
159
+ "--fd-base": direction?.mobile || "column",
160
+ "--fd-sm": direction?.mobile || "column",
161
+ "--fd-md": direction?.tablet || "column",
162
+ "--fd-lg": direction?.tablet || "column",
163
+ "--fd-xl": direction?.desktop || "column",
164
+ "--fd-2xl": direction?.desktop || "column"
165
+ };
166
+ }
167
+ function buildAlignItemsVars(align) {
168
+ return {
169
+ "--ai-base": align?.mobile || "stretch",
170
+ "--ai-sm": align?.mobile || "stretch",
171
+ "--ai-md": align?.tablet || "stretch",
172
+ "--ai-lg": align?.tablet || "stretch",
173
+ "--ai-xl": align?.desktop || "stretch",
174
+ "--ai-2xl": align?.desktop || "stretch"
175
+ };
176
+ }
177
+ function buildJustifyContentVars(justify) {
178
+ return {
179
+ "--jc-base": justify?.mobile || "flex-start",
180
+ "--jc-sm": justify?.mobile || "flex-start",
181
+ "--jc-md": justify?.tablet || "flex-start",
182
+ "--jc-lg": justify?.tablet || "flex-start",
183
+ "--jc-xl": justify?.desktop || "flex-start",
184
+ "--jc-2xl": justify?.desktop || "flex-start"
185
+ };
186
+ }
187
+ function buildGapVars(gap) {
188
+ return {
189
+ "--g-base": `${gap?.mobile || 0}px`,
190
+ "--g-sm": `${gap?.mobile || 0}px`,
191
+ "--g-md": `${gap?.tablet || 0}px`,
192
+ "--g-lg": `${gap?.tablet || 0}px`,
193
+ "--g-xl": `${gap?.desktop || 0}px`,
194
+ "--g-2xl": `${gap?.desktop || 0}px`
195
+ };
196
+ }
197
+ function buildFlexWrapVars(wrap) {
198
+ const getWrap = (val) => val ? "wrap" : "nowrap";
199
+ return {
200
+ "--fw-base": getWrap(wrap?.mobile),
201
+ "--fw-sm": getWrap(wrap?.mobile),
202
+ "--fw-md": getWrap(wrap?.tablet),
203
+ "--fw-lg": getWrap(wrap?.tablet),
204
+ "--fw-xl": getWrap(wrap?.desktop),
205
+ "--fw-2xl": getWrap(wrap?.desktop)
206
+ };
207
+ }
208
+
209
+ // src/renderer/components/core/Button.tsx
210
+ import { jsx } from "react/jsx-runtime";
211
+ var Button = ({
212
+ text,
213
+ fontSize,
214
+ backgroundColor,
215
+ isBackgroundTransparent,
216
+ color,
217
+ paddingX,
218
+ paddingY,
219
+ borderRadius,
220
+ variant,
221
+ shadowBlur,
222
+ shadowColor,
223
+ className,
224
+ animationType = "none"
225
+ }) => {
226
+ const styles = {
227
+ backgroundColor: variant === "solid" ? isBackgroundTransparent ? "transparent" : backgroundColor : "transparent",
228
+ color: variant === "solid" ? color : backgroundColor,
229
+ border: variant === "outline" ? `2px solid ${backgroundColor}` : "none",
230
+ cursor: "pointer",
231
+ transition: "all 0.2s",
232
+ fontWeight: "600",
233
+ display: "inline-block",
234
+ boxShadow: `0 0 ${shadowBlur}px 0px ${shadowColor}`,
235
+ ...buildButtonFontSizeVars(fontSize),
236
+ ...buildButtonPaddingVars(paddingX, paddingY),
237
+ ...buildButtonRadiusVars(borderRadius)
238
+ };
239
+ const animationClass = ANIMATION_VARIANTS[animationType] || "";
240
+ return /* @__PURE__ */ jsx(
241
+ "div",
242
+ {
243
+ className: cn(
244
+ "inline-block transition-all duration-200",
245
+ animationClass,
246
+ className
247
+ ),
248
+ children: /* @__PURE__ */ jsx(
249
+ "button",
250
+ {
251
+ className: cn(
252
+ "transition-all duration-200",
253
+ "[font-size:var(--btns-base)] @sm:[font-size:var(--btns-sm)] @md:[font-size:var(--btns-md)] @lg:[font-size:var(--btns-lg)] @xl:[font-size:var(--btns-xl)] @2xl:[font-size:var(--btns-2xl)]",
254
+ "[padding:var(--btnpy-base)_var(--btnpx-base)] @sm:[padding:var(--btnpy-sm)_var(--btnpx-sm)] @md:[padding:var(--btnpy-md)_var(--btnpx-md)] @lg:[padding:var(--btnpy-lg)_var(--btnpx-lg)] @xl:[padding:var(--btnpy-xl)_var(--btnpx-xl)] @2xl:[padding:var(--btnpy-2xl)_var(--btnpx-2xl)]",
255
+ "[border-radius:var(--btnr-base)] @sm:[border-radius:var(--btnr-sm)] @md:[border-radius:var(--btnr-md)] @lg:[border-radius:var(--btnr-lg)] @xl:[border-radius:var(--btnr-xl)] @2xl:[border-radius:var(--btnr-2xl)]"
256
+ ),
257
+ style: {
258
+ ...styles,
259
+ "--shadow-color": shadowColor
260
+ },
261
+ children: text
262
+ }
263
+ )
264
+ },
265
+ animationType
266
+ );
267
+ };
268
+
269
+ // src/renderer/components/core/Heading.tsx
270
+ import { jsx as jsx2 } from "react/jsx-runtime";
271
+ var Heading = ({
272
+ text,
273
+ level,
274
+ textAlign,
275
+ fontWeight,
276
+ color,
277
+ textShadowBlur,
278
+ textShadowColor,
279
+ className,
280
+ animationType = "none"
281
+ }) => {
282
+ const Component = level?.desktop || level?.tablet || level?.mobile || "h1";
283
+ const animationClass = ANIMATION_VARIANTS[animationType] || "";
284
+ const currentLevel = level?.desktop || "h1";
285
+ const trackingClass = currentLevel === "h1" || currentLevel === "h2" ? "tracking-tight" : "tracking-normal";
286
+ return /* @__PURE__ */ jsx2(
287
+ "div",
288
+ {
289
+ className: cn(
290
+ "transition-all duration-300 w-full",
291
+ animationClass,
292
+ className
293
+ ),
294
+ children: /* @__PURE__ */ jsx2(
295
+ Component,
296
+ {
297
+ className: cn(
298
+ trackingClass,
299
+ "[text-align:var(--ta-base)] @sm:[text-align:var(--ta-sm)] @md:[text-align:var(--ta-md)] @lg:[text-align:var(--ta-lg)] @xl:[text-align:var(--ta-xl)] @2xl:[text-align:var(--ta-2xl)]",
300
+ "[font-size:var(--fs-base)] @sm:[font-size:var(--fs-sm)] @md:[font-size:var(--fs-md)] @lg:[font-size:var(--fs-lg)] @xl:[font-size:var(--fs-xl)] @2xl:[font-size:var(--fs-2xl)]",
301
+ "[font-weight:var(--fw-base)] @sm:[font-weight:var(--fw-sm)] @md:[font-weight:var(--fw-md)] @lg:[font-weight:var(--fw-lg)] @xl:[font-weight:var(--fw-xl)] @2xl:[font-weight:var(--fw-2xl)]",
302
+ "transition-all duration-300"
303
+ ),
304
+ style: {
305
+ ...buildHeadingFontSizeVars(level),
306
+ ...buildFontWeightVars(fontWeight),
307
+ ...buildTextAlignVars(textAlign),
308
+ color,
309
+ outline: "none",
310
+ lineHeight: "1.2",
311
+ textShadow: `0 0 ${textShadowBlur}px ${textShadowColor}`
312
+ },
313
+ children: text
314
+ }
315
+ )
316
+ },
317
+ `${animationType}-${level?.mobile || ""}-${level?.desktop || ""}`
318
+ );
319
+ };
320
+
321
+ // src/renderer/components/core/Image.tsx
322
+ import { jsx as jsx3 } from "react/jsx-runtime";
323
+ var Image = ({
324
+ src,
325
+ alt,
326
+ width,
327
+ height,
328
+ objectFit,
329
+ borderRadius,
330
+ shadowBlur,
331
+ shadowColor,
332
+ animationType = "none"
333
+ }) => {
334
+ const animationClass = ANIMATION_VARIANTS[animationType] || "";
335
+ return /* @__PURE__ */ jsx3(
336
+ "div",
337
+ {
338
+ className: cn(
339
+ "transition-all duration-200 inline-block overflow-hidden",
340
+ animationClass,
341
+ "[width:var(--w-base)] @sm:[width:var(--w-sm)] @md:[width:var(--w-md)] @lg:[width:var(--w-lg)] @xl:[width:var(--w-xl)] @2xl:[width:var(--w-2xl)]",
342
+ "[height:var(--h-base)] @sm:[height:var(--h-sm)] @md:[height:var(--h-md)] @lg:[height:var(--h-lg)] @xl:[height:var(--h-xl)] @2xl:[height:var(--h-2xl)]",
343
+ "[border-radius:var(--r-base)] @sm:[border-radius:var(--r-sm)] @md:[border-radius:var(--r-md)] @lg:[border-radius:var(--r-lg)] @xl:[border-radius:var(--r-xl)] @2xl:[border-radius:var(--r-2xl)]"
344
+ ),
345
+ style: {
346
+ ...buildWidthHeightVars(width, height),
347
+ ...buildBorderRadiusVars(borderRadius),
348
+ boxShadow: `0 0 ${shadowBlur}px 0px ${shadowColor}`
349
+ },
350
+ children: /* @__PURE__ */ jsx3(
351
+ "img",
352
+ {
353
+ src: src || "https://via.placeholder.com/150",
354
+ alt,
355
+ className: "w-full h-full",
356
+ style: { objectFit }
357
+ }
358
+ )
359
+ },
360
+ animationType
361
+ );
362
+ };
363
+
364
+ // src/renderer/components/core/Text.tsx
365
+ import { jsx as jsx4 } from "react/jsx-runtime";
366
+ var Text = ({
367
+ text,
368
+ fontScale,
369
+ textAlign,
370
+ fontWeight,
371
+ color,
372
+ padding,
373
+ textShadowBlur,
374
+ textShadowColor,
375
+ className,
376
+ animationType = "none"
377
+ }) => {
378
+ const animationClass = ANIMATION_VARIANTS[animationType] || "";
379
+ return /* @__PURE__ */ jsx4(
380
+ "div",
381
+ {
382
+ className: cn(
383
+ "transition-all duration-300",
384
+ animationClass,
385
+ "[padding:var(--p-base)] @sm:[padding:var(--p-sm)] @md:[padding:var(--p-md)] @lg:[padding:var(--p-lg)] @xl:[padding:var(--p-xl)] @2xl:[padding:var(--p-2xl)]",
386
+ className
387
+ ),
388
+ style: {
389
+ ...buildPaddingVars(padding)
390
+ },
391
+ children: /* @__PURE__ */ jsx4(
392
+ "p",
393
+ {
394
+ className: cn("[text-align:var(--ta-base)] @sm:[text-align:var(--ta-sm)] @md:[text-align:var(--ta-md)] @lg:[text-align:var(--ta-lg)] @xl:[text-align:var(--ta-xl)] @2xl:[text-align:var(--ta-2xl)] [font-size:var(--fs-base)] @sm:[font-size:var(--fs-sm)] @md:[font-size:var(--fs-md)] @lg:[font-size:var(--fs-lg)] @xl:[font-size:var(--fs-xl)] @2xl:[font-size:var(--fs-2xl)] [font-weight:var(--fw-base)] @sm:[font-weight:var(--fw-sm)] @md:[font-weight:var(--fw-md)] @lg:[font-weight:var(--fw-lg)] @xl:[font-weight:var(--fw-xl)] @2xl:[font-weight:var(--fw-2xl)] transition-all duration-300"),
395
+ style: {
396
+ ...buildFontSizeVars(fontScale),
397
+ ...buildFontWeightVars(fontWeight),
398
+ ...buildTextAlignVars(textAlign),
399
+ color,
400
+ outline: "none",
401
+ whiteSpace: "pre-wrap",
402
+ textShadow: `0 0 ${textShadowBlur}px ${textShadowColor}`
403
+ },
404
+ children: text
405
+ }
406
+ )
407
+ },
408
+ `${animationType}-${fontScale}`
409
+ );
410
+ };
411
+
412
+ // src/renderer/components/core/Divider.tsx
413
+ import { jsx as jsx5 } from "react/jsx-runtime";
414
+ var Divider = ({
415
+ height,
416
+ color,
417
+ backgroundColor,
418
+ marginY
419
+ }) => {
420
+ return /* @__PURE__ */ jsx5(
421
+ "div",
422
+ {
423
+ className: cn(
424
+ "transition-all duration-200 w-full"
425
+ ),
426
+ style: {
427
+ paddingTop: `${marginY}px`,
428
+ paddingBottom: `${marginY}px`,
429
+ backgroundColor
430
+ },
431
+ children: /* @__PURE__ */ jsx5(
432
+ "div",
433
+ {
434
+ style: {
435
+ height: `${height}px`,
436
+ backgroundColor: color,
437
+ width: "100%"
438
+ }
439
+ }
440
+ )
441
+ }
442
+ );
443
+ };
444
+
445
+ // src/renderer/components/core/Video.tsx
446
+ import { jsx as jsx6 } from "react/jsx-runtime";
447
+ var Video = ({
448
+ url,
449
+ width,
450
+ aspectRatio,
451
+ borderRadius,
452
+ animationType = "none"
453
+ }) => {
454
+ const getEmbedUrl = (url2) => {
455
+ if (url2.includes("youtube.com/watch?v=")) {
456
+ return url2.replace("watch?v=", "embed/");
457
+ }
458
+ if (url2.includes("youtu.be/")) {
459
+ return url2.replace("youtu.be/", "youtube.com/embed/");
460
+ }
461
+ return url2;
462
+ };
463
+ const animationClass = ANIMATION_VARIANTS[animationType] || "";
464
+ return /* @__PURE__ */ jsx6(
465
+ "div",
466
+ {
467
+ className: cn(
468
+ "transition-all duration-200 p-2 overflow-hidden",
469
+ animationClass
470
+ ),
471
+ style: {
472
+ width: width || "100%",
473
+ aspectRatio,
474
+ borderRadius: `${borderRadius}px`
475
+ },
476
+ children: /* @__PURE__ */ jsx6(
477
+ "iframe",
478
+ {
479
+ src: getEmbedUrl(url),
480
+ className: "w-full h-full border-none",
481
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
482
+ allowFullScreen: true
483
+ }
484
+ )
485
+ },
486
+ animationType
487
+ );
488
+ };
489
+
490
+ // src/renderer/components/core/Icon.tsx
491
+ import * as LucideIcons from "lucide-react";
492
+ import { jsx as jsx7 } from "react/jsx-runtime";
493
+ var Icon = ({
494
+ name,
495
+ size,
496
+ color
497
+ }) => {
498
+ const LucideIcon = LucideIcons[name];
499
+ return /* @__PURE__ */ jsx7(
500
+ "div",
501
+ {
502
+ className: cn(
503
+ "transition-all duration-200 inline-block p-1"
504
+ ),
505
+ children: LucideIcon ? /* @__PURE__ */ jsx7(LucideIcon, { size, color }) : /* @__PURE__ */ jsx7("span", { children: "Icon not found" })
506
+ }
507
+ );
508
+ };
509
+
510
+ // src/renderer/components/layout/Section.tsx
511
+ import { jsx as jsx8 } from "react/jsx-runtime";
512
+ var Section = ({
513
+ children,
514
+ padding = { mobile: 20, tablet: 28, desktop: 40 },
515
+ backgroundColor = "#ffffff",
516
+ alignItems = "center",
517
+ justifyContent = "center",
518
+ className,
519
+ style
520
+ }) => {
521
+ return /* @__PURE__ */ jsx8(
522
+ "section",
523
+ {
524
+ className: cn(
525
+ "@container",
526
+ "flex flex-col cursor-pointer transition-all duration-200",
527
+ "[padding:var(--p-base)] @sm:[padding:var(--p-sm)] @md:[padding:var(--p-md)] @lg:[padding:var(--p-lg)] @xl:[padding:var(--p-xl)] @2xl:[padding:var(--p-2xl)]",
528
+ "w-full min-h-screen",
529
+ className
530
+ ),
531
+ style: {
532
+ ...buildPaddingVars(padding),
533
+ backgroundColor,
534
+ alignItems,
535
+ justifyContent,
536
+ ...style
537
+ },
538
+ children
539
+ }
540
+ );
541
+ };
542
+
543
+ // src/renderer/components/layout/Box.tsx
544
+ import { jsx as jsx9 } from "react/jsx-runtime";
545
+ var Box = ({
546
+ children,
547
+ padding,
548
+ margin,
549
+ backgroundColor,
550
+ isBackgroundTransparent,
551
+ borderRadius,
552
+ width,
553
+ height,
554
+ flexDirection,
555
+ alignItems,
556
+ justifyContent,
557
+ gap,
558
+ borderWidth,
559
+ borderColor,
560
+ shadowBlur,
561
+ shadowColor,
562
+ className,
563
+ style,
564
+ animationType = "none",
565
+ flexWrap = { mobile: false, tablet: false, desktop: false }
566
+ }) => {
567
+ const animationClass = ANIMATION_VARIANTS[animationType] || "";
568
+ return /* @__PURE__ */ jsx9(
569
+ "div",
570
+ {
571
+ className: cn(
572
+ "transition-all min-h-10 min-w-10 duration-200 flex",
573
+ animationClass,
574
+ "[padding:var(--p-base)] @sm:[padding:var(--p-sm)] @md:[padding:var(--p-md)] @lg:[padding:var(--p-lg)] @xl:[padding:var(--p-xl)] @2xl:[padding:var(--p-2xl)]",
575
+ "[margin:var(--m-base)] @sm:[margin:var(--m-sm)] @md:[margin:var(--m-md)] @lg:[margin:var(--m-lg)] @xl:[margin:var(--m-xl)] @2xl:[margin:var(--m-2xl)]",
576
+ "[border-radius:var(--r-base)] @sm:[border-radius:var(--r-sm)] @md:[border-radius:var(--r-md)] @lg:[border-radius:var(--r-lg)] @xl:[border-radius:var(--r-xl)] @2xl:[border-radius:var(--r-2xl)]",
577
+ "[width:var(--w-base)] @sm:[width:var(--w-sm)] @md:[width:var(--w-md)] @lg:[width:var(--w-lg)] @xl:[width:var(--w-xl)] @2xl:[width:var(--w-2xl)]",
578
+ "[height:var(--h-base)] @sm:[height:var(--h-sm)] @md:[height:var(--h-md)] @lg:[height:var(--h-lg)] @xl:[height:var(--h-xl)] @2xl:[height:var(--h-2xl)]",
579
+ "[flex-direction:var(--fd-base)] @sm:[flex-direction:var(--fd-sm)] @md:[flex-direction:var(--fd-md)] @lg:[flex-direction:var(--fd-lg)] @xl:[flex-direction:var(--fd-xl)] @2xl:[flex-direction:var(--fd-2xl)]",
580
+ "[align-items:var(--ai-base)] @sm:[align-items:var(--ai-sm)] @md:[align-items:var(--ai-md)] @lg:[align-items:var(--ai-lg)] @xl:[align-items:var(--ai-xl)] @2xl:[align-items:var(--ai-2xl)]",
581
+ "[justify-content:var(--jc-base)] @sm:[justify-content:var(--jc-sm)] @md:[justify-content:var(--jc-md)] @lg:[justify-content:var(--jc-lg)] @xl:[justify-content:var(--jc-xl)] @2xl:[justify-content:var(--jc-2xl)]",
582
+ "[flex-wrap:var(--fw-base)] @sm:[flex-wrap:var(--fw-sm)] @md:[flex-wrap:var(--fw-md)] @lg:[flex-wrap:var(--fw-lg)] @xl:[flex-wrap:var(--fw-xl)] @2xl:[flex-wrap:var(--fw-2xl)]",
583
+ "[gap:var(--g-base)] @sm:[gap:var(--g-sm)] @md:[gap:var(--g-md)] @lg:[gap:var(--g-lg)] @xl:[gap:var(--g-xl)] @2xl:[gap:var(--g-2xl)]",
584
+ className
585
+ ),
586
+ style: {
587
+ backgroundColor: isBackgroundTransparent ? "transparent" : backgroundColor,
588
+ border: borderWidth ? `${borderWidth}px solid ${borderColor}` : "none",
589
+ boxShadow: `0 0 ${shadowBlur}px 0px ${shadowColor}`,
590
+ ...buildPaddingVars(padding),
591
+ ...buildMarginVars(margin),
592
+ ...buildBorderRadiusVars(borderRadius),
593
+ ...buildWidthHeightVars(width, height),
594
+ ...buildFlexDirectionVars(flexDirection),
595
+ ...buildAlignItemsVars(alignItems),
596
+ ...buildJustifyContentVars(justifyContent),
597
+ ...buildGapVars(gap),
598
+ ...buildFlexWrapVars(flexWrap),
599
+ ...style
600
+ },
601
+ children
602
+ },
603
+ animationType
604
+ );
605
+ };
606
+
607
+ // src/renderer/components/layout/ColumnLayouts.tsx
608
+ import { jsxs } from "react/jsx-runtime";
609
+ var TwoColumnLayout = ({ gap = 16, slots, children }) => {
610
+ return /* @__PURE__ */ jsxs(
611
+ "div",
612
+ {
613
+ style: { gap },
614
+ className: cn(
615
+ "w-full transition-all flex flex-row duration-200"
616
+ ),
617
+ children: [
618
+ slots?.["left-col"],
619
+ slots?.["right-col"],
620
+ children
621
+ ]
622
+ }
623
+ );
624
+ };
625
+ var ThreeColumnLayout = ({ gap = 16, slots, children }) => {
626
+ return /* @__PURE__ */ jsxs(
627
+ "div",
628
+ {
629
+ style: { gap },
630
+ className: cn(
631
+ "w-full transition-all flex flex-row duration-200"
632
+ ),
633
+ children: [
634
+ slots?.["left-col"],
635
+ slots?.["center-col"],
636
+ slots?.["right-col"],
637
+ children
638
+ ]
639
+ }
640
+ );
641
+ };
642
+
643
+ // src/renderer/components/layout/Grid.tsx
644
+ import React from "react";
645
+ import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
646
+ var Grid = ({ children, slots, columns = 3, rows = 1, gap = 16 }) => {
647
+ return /* @__PURE__ */ jsxs2(
648
+ "div",
649
+ {
650
+ className: cn(
651
+ "w-full grid transition-all duration-200"
652
+ ),
653
+ style: {
654
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
655
+ gridTemplateRows: `repeat(${rows}, auto)`,
656
+ gap: `${gap}px`
657
+ },
658
+ children: [
659
+ children,
660
+ slots && Object.values(slots).map((slot, i) => /* @__PURE__ */ jsx10(React.Fragment, { children: slot }, i))
661
+ ]
662
+ }
663
+ );
664
+ };
665
+
666
+ // src/renderer/components/prebuilt/Hero.tsx
667
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
668
+ var Hero = ({
669
+ children,
670
+ slots,
671
+ className,
672
+ padding = { mobile: 40, tablet: 50, desktop: 60 },
673
+ backgroundColor,
674
+ bgImage,
675
+ showOverlay = false,
676
+ overlayColor = "#000000",
677
+ overlayOpacity = 0.5
678
+ }) => {
679
+ return /* @__PURE__ */ jsxs3(
680
+ Section,
681
+ {
682
+ alignItems: "center",
683
+ justifyContent: "center",
684
+ padding,
685
+ backgroundColor,
686
+ className,
687
+ style: {
688
+ backgroundImage: bgImage ? `url(${bgImage})` : void 0,
689
+ backgroundSize: "cover",
690
+ backgroundPosition: "center",
691
+ position: "relative"
692
+ },
693
+ children: [
694
+ showOverlay && /* @__PURE__ */ jsx11(
695
+ "div",
696
+ {
697
+ style: {
698
+ position: "absolute",
699
+ top: 0,
700
+ left: 0,
701
+ right: 0,
702
+ bottom: 0,
703
+ backgroundColor: overlayColor,
704
+ opacity: overlayOpacity,
705
+ zIndex: 1
706
+ }
707
+ }
708
+ ),
709
+ /* @__PURE__ */ jsxs3("div", { style: { position: "relative", zIndex: 2, width: "100%", height: "100%", display: "flex", justifyContent: "center", alignItems: "center" }, children: [
710
+ slots?.["hero-box"],
711
+ children
712
+ ] })
713
+ ]
714
+ }
715
+ );
716
+ };
717
+
718
+ // src/renderer/components/prebuilt/ContentSections.tsx
719
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
720
+ var FAQItem = ({ slots, children }) => {
721
+ return /* @__PURE__ */ jsxs4(
722
+ "div",
723
+ {
724
+ className: cn(
725
+ "transition-all duration-200 p-6 bg-white border border-gray-100 rounded-xl w-full",
726
+ "shadow-sm hover:shadow-md"
727
+ ),
728
+ children: [
729
+ slots?.["question"],
730
+ /* @__PURE__ */ jsx12("div", { className: "mt-2 pt-2 border-t border-gray-50", children: slots?.["answer"] }),
731
+ children
732
+ ]
733
+ }
734
+ );
735
+ };
736
+ var FAQ = ({ children, slots, className, padding = { mobile: 40, tablet: 50, desktop: 60 }, backgroundColor = "transparent" }) => {
737
+ return /* @__PURE__ */ jsx12(Section, { alignItems: "center", justifyContent: "center", padding, backgroundColor, className, children: /* @__PURE__ */ jsxs4("div", { className: "w-full flex flex-col items-center", children: [
738
+ slots?.["faq-header"],
739
+ slots?.["faq-description"],
740
+ slots?.["faq-list"],
741
+ children
742
+ ] }) });
743
+ };
744
+ var PricingCard = ({ children, slots, isPopular = false }) => {
745
+ return /* @__PURE__ */ jsxs4(
746
+ "div",
747
+ {
748
+ className: cn(
749
+ "transition-all flex flex-col items-center justify-start p-8 bg-white border border-gray-100 rounded-xl w-full min-w-1/4 max-w-sm mx-auto",
750
+ "shadow-lg",
751
+ isPopular && "border-blue-500 scale-105 z-10"
752
+ ),
753
+ children: [
754
+ isPopular && /* @__PURE__ */ jsx12("span", { className: "bg-blue-600 text-white text-xs font-bold px-3 py-1 rounded-full -mt-12 mb-6", children: " MOST POPULAR" }),
755
+ slots?.["plan-name"],
756
+ slots?.["plan-price"],
757
+ slots?.["plan-features"],
758
+ slots?.["plan-button"],
759
+ children
760
+ ]
761
+ }
762
+ );
763
+ };
764
+ var PricingTable = ({ children, slots, className, padding = { mobile: 40, tablet: 50, desktop: 60 }, backgroundColor = "transparent" }) => {
765
+ return /* @__PURE__ */ jsx12(
766
+ Section,
767
+ {
768
+ alignItems: "center",
769
+ justifyContent: "center",
770
+ padding,
771
+ backgroundColor,
772
+ className,
773
+ children: /* @__PURE__ */ jsxs4("div", { className: "w-full flex flex-col items-center", children: [
774
+ slots?.["pricing-header"],
775
+ slots?.["pricing-subtext"],
776
+ slots?.["pricing-container"],
777
+ children
778
+ ] })
779
+ }
780
+ );
781
+ };
782
+
783
+ // src/renderer/components/prebuilt/Footer.tsx
784
+ import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
785
+ var FooterSimple = ({
786
+ children,
787
+ slots,
788
+ backgroundColor = "#ffffff",
789
+ className
790
+ }) => {
791
+ return /* @__PURE__ */ jsx13(
792
+ "footer",
793
+ {
794
+ className: cn(
795
+ "w-full py-8 border-t border-gray-200 transition-all duration-200",
796
+ className
797
+ ),
798
+ style: { backgroundColor },
799
+ children: /* @__PURE__ */ jsxs5("div", { className: "max-w-6xl mx-auto px-4 flex flex-col md:flex-row justify-between items-center gap-4", children: [
800
+ slots?.["footer-logo"],
801
+ slots?.["footer-copy"],
802
+ slots?.["f-link-1"],
803
+ slots?.["f-link-2"],
804
+ children
805
+ ] })
806
+ }
807
+ );
808
+ };
809
+
810
+ // src/renderer/ComponentRegistry.ts
811
+ var componentRegistry = {
812
+ Button,
813
+ Heading,
814
+ Image,
815
+ Text,
816
+ Divider,
817
+ Video,
818
+ Icon,
819
+ Section,
820
+ Box,
821
+ TwoColumnLayout,
822
+ ThreeColumnLayout,
823
+ Grid,
824
+ Hero,
825
+ FAQ,
826
+ FAQItem,
827
+ PricingTable,
828
+ PricingCard,
829
+ FooterSimple
830
+ };
831
+
832
+ // src/renderer/RenderNode.tsx
833
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
834
+ var RenderNode = ({ id, data }) => {
835
+ const node = data[id];
836
+ if (!node || node.hidden) return null;
837
+ const { type, props = {}, nodes = [], linkedNodes } = node;
838
+ if (typeof type === "string") {
839
+ const Tag = type;
840
+ return /* @__PURE__ */ jsxs6(Tag, { id, ...props, children: [
841
+ nodes.map((childId) => /* @__PURE__ */ jsx14(RenderNode, { id: childId, data }, childId)),
842
+ linkedNodes && Object.values(linkedNodes).map((linkedId) => /* @__PURE__ */ jsx14(RenderNode, { id: linkedId, data }, linkedId))
843
+ ] });
844
+ }
845
+ const componentName = type?.resolvedName;
846
+ const Component = componentRegistry[componentName];
847
+ if (!Component) {
848
+ console.log(`Component not found in registry: ${componentName}`);
849
+ return null;
850
+ }
851
+ const slots = {};
852
+ if (linkedNodes) {
853
+ Object.entries(linkedNodes).forEach(([key, linkedId]) => {
854
+ slots[key] = /* @__PURE__ */ jsx14(RenderNode, { id: linkedId, data }, linkedId);
855
+ });
856
+ }
857
+ return /* @__PURE__ */ jsx14(Component, { id, ...props, slots, children: nodes.map((childId) => /* @__PURE__ */ jsx14(RenderNode, { id: childId, data }, childId)) });
858
+ };
859
+
860
+ // src/renderer/PageRenderer.tsx
861
+ import { useLocation } from "react-router-dom";
862
+ import { jsx as jsx15 } from "react/jsx-runtime";
863
+ var PageRenderer = ({ url }) => {
864
+ const { pathname } = useLocation();
865
+ const [json, setJson] = React2.useState(null);
866
+ const [ready, setReady] = React2.useState(false);
867
+ const fetchPageSchema = async (slug) => {
868
+ const response = await fetch(`${url}?slug=${slug}`);
869
+ const data = await response.json();
870
+ if (data.success) {
871
+ setJson(data.data.schema);
872
+ }
873
+ };
874
+ useEffect(() => {
875
+ const slug = pathname.startsWith("/") ? pathname.slice(1) : pathname;
876
+ console.log("SLug:", slug);
877
+ fetchPageSchema(slug);
878
+ }, [pathname]);
879
+ useEffect(() => {
880
+ if (json) {
881
+ requestAnimationFrame(() => {
882
+ setReady(true);
883
+ });
884
+ }
885
+ }, [json]);
886
+ if (!json || !json.ROOT) {
887
+ console.log("Invalid Craft JSON");
888
+ return null;
889
+ }
890
+ if (!ready) {
891
+ return /* @__PURE__ */ jsx15("div", { className: "h-screen flex items-center justify-center", children: /* @__PURE__ */ jsx15("div", { className: "animate-spin h-10 w-10 border-4 border-blue-500 border-t-transparent rounded-full" }) });
892
+ }
893
+ return /* @__PURE__ */ jsx15(RenderNode, { id: "ROOT", data: json });
894
+ };
895
+ export {
896
+ PageRenderer,
897
+ componentRegistry
898
+ };