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