funuicss 3.7.1 → 3.7.3

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/ui/theme/theme.js CHANGED
@@ -70,7 +70,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
70
70
  }
71
71
  };
72
72
  Object.defineProperty(exports, "__esModule", { value: true });
73
- exports.useVariable = exports.useVariables = exports.useComponentVariant = exports.useTypographyValue = exports.useColor = exports.useProjectData = exports.useThemeConfig = exports.useTypography = exports.useColors = exports.useComponentConfig = exports.useThemeValue = exports.getAllVariables = exports.getVariable = exports.useVariant = exports.useTheme = void 0;
73
+ exports.useDocumentAssets = exports.useAudioAssets = exports.useVideoAssets = exports.useImageAssets = exports.useAssetsByType = exports.useAssetInfo = exports.useAssetType = exports.useAssetValue = exports.useAsset = exports.useAssets = exports.getAssetInfo = exports.getAssetType = exports.getAssetValue = exports.getAllAssets = exports.getAsset = exports.useVariable = exports.useVariables = exports.useComponentVariant = exports.useTypographyValue = exports.useColor = exports.useProjectData = exports.useThemeConfig = exports.useTypography = exports.useColors = exports.useComponentConfig = exports.useThemeValue = exports.getAllVariables = exports.getVariable = exports.useVariant = exports.useTheme = void 0;
74
74
  var react_1 = __importStar(require("react"));
75
75
  var themes_1 = require("./themes");
76
76
  var darkenUtils_1 = require("./darkenUtils");
@@ -97,10 +97,70 @@ var useVariant = function () {
97
97
  };
98
98
  exports.useVariant = useVariant;
99
99
  /* -------------------------------------------------------------------------- */
100
+ /* ORIGIN VALIDATION */
101
+ /* -------------------------------------------------------------------------- */
102
+ var getCurrentOrigin = function () {
103
+ if (typeof window === 'undefined')
104
+ return '';
105
+ // For local development, return localhost
106
+ if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
107
+ return 'localhost';
108
+ }
109
+ // For production, return the domain without protocol and www
110
+ var domain = window.location.hostname;
111
+ domain = domain.replace(/^www\./, '');
112
+ return domain;
113
+ };
114
+ var validateOriginAccess = function (projectId) { return __awaiter(void 0, void 0, void 0, function () {
115
+ var currentOrigin, projectData, trustedDomains, hasAccess, error_1;
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0:
119
+ if (!projectId) {
120
+ console.error('❌ No project ID provided');
121
+ return [2 /*return*/, false];
122
+ }
123
+ currentOrigin = getCurrentOrigin();
124
+ console.log("\uD83D\uDD0D Validating origin access for: ".concat(currentOrigin));
125
+ _a.label = 1;
126
+ case 1:
127
+ _a.trys.push([1, 3, , 4]);
128
+ return [4 /*yield*/, loadThemeFromCDN(projectId)];
129
+ case 2:
130
+ projectData = _a.sent();
131
+ if (!projectData) {
132
+ console.error('❌ Project not found or inaccessible');
133
+ return [2 /*return*/, false];
134
+ }
135
+ trustedDomains = projectData.trustedDomains || [];
136
+ hasAccess = trustedDomains.some(function (domain) {
137
+ var trustedDomain = domain.domain.toLowerCase();
138
+ var currentDomain = currentOrigin.toLowerCase();
139
+ // Exact match or subdomain match
140
+ return currentDomain === trustedDomain ||
141
+ currentDomain.endsWith('.' + trustedDomain) ||
142
+ (trustedDomain === 'localhost' && currentOrigin === 'localhost');
143
+ });
144
+ if (!hasAccess) {
145
+ console.error("\u274C Access denied: Origin \"".concat(currentOrigin, "\" is not in trusted domains"));
146
+ console.log('📋 Trusted domains:', trustedDomains.map(function (d) { return d.domain; }));
147
+ return [2 /*return*/, false];
148
+ }
149
+ console.log('✅ Origin validation passed');
150
+ return [2 /*return*/, true];
151
+ case 3:
152
+ error_1 = _a.sent();
153
+ console.error('❌ Error during origin validation:', error_1);
154
+ return [2 /*return*/, false];
155
+ case 4: return [2 /*return*/];
156
+ }
157
+ });
158
+ }); };
159
+ /* -------------------------------------------------------------------------- */
100
160
  /* LOCAL FILE MANAGEMENT */
101
161
  /* -------------------------------------------------------------------------- */
102
162
  var loadLocalTheme = function () { return __awaiter(void 0, void 0, void 0, function () {
103
- var response, data, error_1;
163
+ var response, data, error_2;
104
164
  return __generator(this, function (_a) {
105
165
  switch (_a.label) {
106
166
  case 0:
@@ -118,7 +178,7 @@ var loadLocalTheme = function () { return __awaiter(void 0, void 0, void 0, func
118
178
  return [2 /*return*/, data];
119
179
  case 3: return [3 /*break*/, 5];
120
180
  case 4:
121
- error_1 = _a.sent();
181
+ error_2 = _a.sent();
122
182
  console.log('No local theme file found');
123
183
  return [3 /*break*/, 5];
124
184
  case 5: return [2 /*return*/, null];
@@ -129,7 +189,7 @@ var loadLocalTheme = function () { return __awaiter(void 0, void 0, void 0, func
129
189
  /* CDN THEME LOADER */
130
190
  /* -------------------------------------------------------------------------- */
131
191
  var loadThemeFromCDN = function (projectId) { return __awaiter(void 0, void 0, void 0, function () {
132
- var publicUrl, response, data, error_2;
192
+ var publicUrl, response, data, error_3;
133
193
  return __generator(this, function (_a) {
134
194
  switch (_a.label) {
135
195
  case 0:
@@ -151,8 +211,8 @@ var loadThemeFromCDN = function (projectId) { return __awaiter(void 0, void 0, v
151
211
  _a.label = 4;
152
212
  case 4: return [3 /*break*/, 6];
153
213
  case 5:
154
- error_2 = _a.sent();
155
- console.error('Error loading from Firebase Storage:', error_2);
214
+ error_3 = _a.sent();
215
+ console.error('Error loading from Firebase Storage:', error_3);
156
216
  return [3 /*break*/, 6];
157
217
  case 6: return [2 /*return*/, null];
158
218
  }
@@ -246,9 +306,16 @@ var ThemeProvider = function (_a) {
246
306
  });
247
307
  }
248
308
  }, [theme]);
249
- /* ---------------------- CDN Theme Sync with Local File ----------------------- */
309
+ /* ---------------------- CDN Theme Sync with Origin Validation ----------------------- */
250
310
  (0, react_1.useEffect)(function () {
251
- if (typeof window === 'undefined' || !projectId) {
311
+ if (typeof window === 'undefined') {
312
+ setIsLoading(false);
313
+ setIsInitialLoad(false);
314
+ return;
315
+ }
316
+ if (!projectId) {
317
+ console.error('❌ ThemeProvider: No projectId provided');
318
+ setError('Project ID is required');
252
319
  setIsLoading(false);
253
320
  setIsInitialLoad(false);
254
321
  return;
@@ -256,17 +323,27 @@ var ThemeProvider = function (_a) {
256
323
  var root = document.documentElement;
257
324
  var pollTimer;
258
325
  var syncTheme = function () { return __awaiter(void 0, void 0, void 0, function () {
259
- var localTheme, localVersion, cdnTheme, cdnVersion, err_1;
326
+ var hasAccess, localTheme, localVersion, cdnTheme, cdnVersion, err_1;
260
327
  return __generator(this, function (_a) {
261
328
  switch (_a.label) {
262
329
  case 0:
263
- _a.trys.push([0, 3, 4, 5]);
264
- return [4 /*yield*/, loadLocalTheme()];
330
+ _a.trys.push([0, 4, 5, 6]);
331
+ console.log('🔄 Starting theme sync with origin validation...');
332
+ return [4 /*yield*/, validateOriginAccess(projectId)];
265
333
  case 1:
334
+ hasAccess = _a.sent();
335
+ if (!hasAccess) {
336
+ setError('Access denied: This domain is not authorized to use this theme');
337
+ setIsLoading(false);
338
+ setIsInitialLoad(false);
339
+ return [2 /*return*/];
340
+ }
341
+ return [4 /*yield*/, loadLocalTheme()];
342
+ case 2:
266
343
  localTheme = _a.sent();
267
344
  localVersion = (localTheme === null || localTheme === void 0 ? void 0 : localTheme.version) || 0;
268
345
  return [4 /*yield*/, loadThemeFromCDN(projectId)];
269
- case 2:
346
+ case 3:
270
347
  cdnTheme = _a.sent();
271
348
  cdnVersion = (cdnTheme === null || cdnTheme === void 0 ? void 0 : cdnTheme.version) || 0;
272
349
  if (cdnTheme) {
@@ -298,17 +375,17 @@ var ThemeProvider = function (_a) {
298
375
  console.warn('⚠️ No theme found');
299
376
  setError('Theme not found');
300
377
  }
301
- return [3 /*break*/, 5];
302
- case 3:
378
+ return [3 /*break*/, 6];
379
+ case 4:
303
380
  err_1 = _a.sent();
304
- console.error('Error syncing theme:', err_1);
381
+ console.error('Error syncing theme:', err_1);
305
382
  setError('Failed to sync theme');
306
- return [3 /*break*/, 5];
307
- case 4:
383
+ return [3 /*break*/, 6];
384
+ case 5:
308
385
  setIsLoading(false);
309
386
  setIsInitialLoad(false);
310
387
  return [7 /*endfinally*/];
311
- case 5: return [2 /*return*/];
388
+ case 6: return [2 /*return*/];
312
389
  }
313
390
  });
314
391
  }); };
@@ -331,6 +408,8 @@ var ThemeProvider = function (_a) {
331
408
  setProjectData(data);
332
409
  // Cache for variable access
333
410
  cachedProjectData = data;
411
+ // Cache for asset access
412
+ cachedAssets = data.assets || [];
334
413
  // Apply all theme config to CSS variables
335
414
  applyThemeConfig(themeConfig, root);
336
415
  };
@@ -417,3 +496,104 @@ var useVariable = function (name) {
417
496
  return variable === null || variable === void 0 ? void 0 : variable.value;
418
497
  };
419
498
  exports.useVariable = useVariable;
499
+ var cachedAssets = [];
500
+ var getAsset = function (name) {
501
+ if (!cachedAssets.length) {
502
+ console.warn('No assets available. Make sure ThemeProvider is mounted and assets are loaded.');
503
+ return undefined;
504
+ }
505
+ var asset = cachedAssets.find(function (a) { return a.name === name; });
506
+ return asset;
507
+ };
508
+ exports.getAsset = getAsset;
509
+ var getAllAssets = function () {
510
+ return cachedAssets;
511
+ };
512
+ exports.getAllAssets = getAllAssets;
513
+ var getAssetValue = function (name) {
514
+ var asset = (0, exports.getAsset)(name);
515
+ return asset === null || asset === void 0 ? void 0 : asset.url;
516
+ };
517
+ exports.getAssetValue = getAssetValue;
518
+ var getAssetType = function (name) {
519
+ var asset = (0, exports.getAsset)(name);
520
+ return asset === null || asset === void 0 ? void 0 : asset.file_type;
521
+ };
522
+ exports.getAssetType = getAssetType;
523
+ var getAssetInfo = function (name) {
524
+ var asset = (0, exports.getAsset)(name);
525
+ if (!asset)
526
+ return undefined;
527
+ return {
528
+ value: asset.url,
529
+ type: asset.file_type,
530
+ name: asset.name
531
+ };
532
+ };
533
+ exports.getAssetInfo = getAssetInfo;
534
+ /* -------------------------------------------------------------------------- */
535
+ /* ASSETS HOOKS */
536
+ /* -------------------------------------------------------------------------- */
537
+ // Hook to access all assets
538
+ var useAssets = function () {
539
+ var projectData = (0, exports.useTheme)().projectData;
540
+ return (projectData === null || projectData === void 0 ? void 0 : projectData.assets) || [];
541
+ };
542
+ exports.useAssets = useAssets;
543
+ // Hook to get a specific asset
544
+ var useAsset = function (name) {
545
+ var assets = (0, exports.useAssets)();
546
+ var asset = assets.find(function (a) { return a.name === name; });
547
+ return asset;
548
+ };
549
+ exports.useAsset = useAsset;
550
+ // Hook to get asset URL (most common use case)
551
+ var useAssetValue = function (name) {
552
+ var asset = (0, exports.useAsset)(name);
553
+ return asset === null || asset === void 0 ? void 0 : asset.url;
554
+ };
555
+ exports.useAssetValue = useAssetValue;
556
+ // Hook to get asset type
557
+ var useAssetType = function (name) {
558
+ var asset = (0, exports.useAsset)(name);
559
+ return asset === null || asset === void 0 ? void 0 : asset.file_type;
560
+ };
561
+ exports.useAssetType = useAssetType;
562
+ // Hook to get complete asset info
563
+ var useAssetInfo = function (name) {
564
+ var asset = (0, exports.useAsset)(name);
565
+ if (!asset)
566
+ return undefined;
567
+ return {
568
+ value: asset.url,
569
+ type: asset.file_type,
570
+ name: asset.name
571
+ };
572
+ };
573
+ exports.useAssetInfo = useAssetInfo;
574
+ // Hook to filter assets by type
575
+ var useAssetsByType = function (type) {
576
+ var assets = (0, exports.useAssets)();
577
+ return assets.filter(function (asset) { return asset.file_type === type; });
578
+ };
579
+ exports.useAssetsByType = useAssetsByType;
580
+ // Hook to get image assets
581
+ var useImageAssets = function () {
582
+ return (0, exports.useAssetsByType)('image');
583
+ };
584
+ exports.useImageAssets = useImageAssets;
585
+ // Hook to get video assets
586
+ var useVideoAssets = function () {
587
+ return (0, exports.useAssetsByType)('video');
588
+ };
589
+ exports.useVideoAssets = useVideoAssets;
590
+ // Hook to get audio assets
591
+ var useAudioAssets = function () {
592
+ return (0, exports.useAssetsByType)('audio');
593
+ };
594
+ exports.useAudioAssets = useAudioAssets;
595
+ // Hook to get document assets
596
+ var useDocumentAssets = function () {
597
+ return (0, exports.useAssetsByType)('document');
598
+ };
599
+ exports.useDocumentAssets = useDocumentAssets;
package/ui/vista/Vista.js CHANGED
@@ -21,134 +21,51 @@ var getCssVariable_1 = require("../../utils/getCssVariable");
21
21
  var componentUtils_1 = require("../../utils/componentUtils");
22
22
  var Text_1 = __importDefault(require("../text/Text"));
23
23
  var Col_1 = __importDefault(require("../grid/Col"));
24
- var Button_1 = __importDefault(require("../button/Button")); // Import your Button component
25
- var Flex_1 = __importDefault(require("../flex/Flex")); // Import your Flex component
26
- var Vista = function (_a) {
27
- var _b = _a.layout, layout = _b === void 0 ? 'imageRight' : _b, _c = _a.reverse, reverse = _c === void 0 ? false : _c, _d = _a.bg, bg = _d === void 0 ? '' : _d, _e = _a.padding, padding = _e === void 0 ? 'padding-lg' : _e, _f = _a.textAlign, textAlign = _f === void 0 ? 'left' : _f, _g = _a.imgPosition, imgPosition = _g === void 0 ? 'top' : _g, _h = _a.funcss, funcss = _h === void 0 ? '' : _h, _j = _a.pattern, pattern = _j === void 0 ? '' : _j, _k = _a.patternOpacity, patternOpacity = _k === void 0 ? pattern === 'grid' ? 0.15 : pattern === 'dots' ? 0.4 : pattern === 'diagonal' ? 0.2 : pattern === 'checkerboard' ? 0.2 : pattern === 'horizontal' ? 0.2 : pattern === 'vertical' ? 0.2 : 0.1 : _k,
28
- // Enhanced Content
29
- heading = _a.heading, _l = _a.headingSize, headingSize = _l === void 0 ? '5xl' : _l, _m = _a.headingWeight, headingWeight = _m === void 0 ? 700 : _m, _o = _a.headingColor, headingColor = _o === void 0 ? '' : _o, _p = _a.headingClass, headingClass = _p === void 0 ? '' : _p, subheading = _a.subheading, _q = _a.subheadingSize, subheadingSize = _q === void 0 ? 'lg' : _q, _r = _a.subheadingWeight, subheadingWeight = _r === void 0 ? 400 : _r, _s = _a.subheadingColor, subheadingColor = _s === void 0 ? 'light' : _s, _t = _a.subheadingClass, subheadingClass = _t === void 0 ? '' : _t, content = _a.content, _u = _a.contentSize, contentSize = _u === void 0 ? 'base' : _u, _v = _a.contentWeight, contentWeight = _v === void 0 ? 400 : _v, _w = _a.contentColor, contentColor = _w === void 0 ? '' : _w, _x = _a.contentClass, contentClass = _x === void 0 ? '' : _x, image = _a.image, _y = _a.imageUrl, imageUrl = _y === void 0 ? '' : _y, _z = _a.imageAlt, imageAlt = _z === void 0 ? '' : _z, _0 = _a.imageClass, imageClass = _0 === void 0 ? '' : _0, _1 = _a.imageSize, imageSize = _1 === void 0 ? '100%' : _1, cta = _a.cta, _2 = _a.ctaClass, ctaClass = _2 === void 0 ? '' : _2, _3 = _a.sectionClass, sectionClass = _3 === void 0 ? '' : _3, _4 = _a.containerClass, containerClass = _4 === void 0 ? '' : _4, _5 = _a.textWrapperClass, textWrapperClass = _5 === void 0 ? '' : _5, _6 = _a.gap, gap = _6 === void 0 ? '2rem' : _6, _7 = _a.imageWrapperClass, imageWrapperClass = _7 === void 0 ? '' : _7, children = _a.children,
30
- // Gradient Props
31
- _8 = _a.showGradient,
32
- // Gradient Props
33
- showGradient = _8 === void 0 ? false : _8, _9 = _a.gradientPosition, gradientPosition = _9 === void 0 ? 'bottom-right' : _9, _10 = _a.gradientSize, gradientSize = _10 === void 0 ? '300px' : _10, _11 = _a.blurry, blurry = _11 === void 0 ? 100 : _11, _12 = _a.opacity, opacity = _12 === void 0 ? 0.4 : _12, gradientColors = _a.gradientColors, _13 = _a.fade, fade = _13 === void 0 ? false : _13, _14 = _a.fadeDirection, fadeDirection = _14 === void 0 ? 'bottom' : _14, _15 = _a.fadeRadial, fadeRadial = _15 === void 0 ? false : _15, _16 = _a.fadeOverlayDarken, fadeOverlayDarken = _16 === void 0 ? 0.5 : _16, _17 = _a.backgroundImage, backgroundImage = _17 === void 0 ? '' : _17, _18 = _a.variant, variant = _18 === void 0 ? '' : _18,
34
- // New CTA Button Props
35
- _19 = _a.showPrimaryCTA,
36
- // New CTA Button Props
37
- showPrimaryCTA = _19 === void 0 ? false : _19, _20 = _a.showSecondaryCTA, showSecondaryCTA = _20 === void 0 ? false : _20, _21 = _a.showAccentCTA, showAccentCTA = _21 === void 0 ? false : _21, _22 = _a.primaryButtonOutlined, primaryButtonOutlined = _22 === void 0 ? false : _22, _23 = _a.secondaryButtonOutlined, secondaryButtonOutlined = _23 === void 0 ? false : _23, _24 = _a.accentButtonOutlined, accentButtonOutlined = _24 === void 0 ? false : _24, _25 = _a.ctaPrimaryUrl, ctaPrimaryUrl = _25 === void 0 ? '' : _25, _26 = _a.ctaSecondaryUrl, ctaSecondaryUrl = _26 === void 0 ? '' : _26, _27 = _a.ctaAccentUrl, ctaAccentUrl = _27 === void 0 ? '' : _27, _28 = _a.ctaPrimaryText, ctaPrimaryText = _28 === void 0 ? 'Primary Action' : _28, _29 = _a.ctaSecondaryText, ctaSecondaryText = _29 === void 0 ? 'Secondary Action' : _29, _30 = _a.ctaAccentText, ctaAccentText = _30 === void 0 ? 'Accent Action' : _30, _31 = _a.ctaGap, ctaGap = _31 === void 0 ? 1 : _31, _32 = _a.ctaFlexJustify, ctaFlexJustify = _32 === void 0 ? 'center' : _32, _33 = _a.ctaPrimaryRounded, ctaPrimaryRounded = _33 === void 0 ? false : _33, _34 = _a.ctaPrimaryFlat, ctaPrimaryFlat = _34 === void 0 ? false : _34, _35 = _a.ctaPrimaryPrefix, ctaPrimaryPrefix = _35 === void 0 ? '' : _35, _36 = _a.ctaPrimarySuffix, ctaPrimarySuffix = _36 === void 0 ? '' : _36, _37 = _a.ctaSecondaryRounded, ctaSecondaryRounded = _37 === void 0 ? false : _37, _38 = _a.ctaSecondaryFlat, ctaSecondaryFlat = _38 === void 0 ? false : _38, _39 = _a.ctaSecondaryPrefix, ctaSecondaryPrefix = _39 === void 0 ? '' : _39, _40 = _a.ctaSecondarySuffix, ctaSecondarySuffix = _40 === void 0 ? '' : _40, _41 = _a.ctaAccentRounded, ctaAccentRounded = _41 === void 0 ? false : _41, _42 = _a.ctaAccentFlat, ctaAccentFlat = _42 === void 0 ? false : _42, _43 = _a.ctaAccentPrefix, ctaAccentPrefix = _43 === void 0 ? '' : _43, _44 = _a.ctaAccentSuffix, ctaAccentSuffix = _44 === void 0 ? '' : _44, primaryIconSize = _a.primaryIconSize, secondaryIconSize = _a.secondaryIconSize, accentIconSize = _a.accentIconSize;
38
- // Use the component config hook
39
- var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Vista', variant).mergeWithLocal;
40
- // Merge config with local props - local props should override config
41
- var mergedProps = mergeWithLocal({
42
- layout: layout,
43
- reverse: reverse,
44
- bg: bg,
45
- padding: padding,
46
- textAlign: textAlign,
47
- imgPosition: imgPosition,
48
- funcss: funcss,
49
- pattern: pattern,
50
- patternOpacity: patternOpacity,
51
- showGradient: showGradient,
52
- gradientPosition: gradientPosition,
53
- gradientSize: gradientSize,
54
- blurry: blurry,
55
- opacity: opacity,
56
- gradientColors: gradientColors,
57
- fade: fade,
58
- fadeDirection: fadeDirection,
59
- fadeRadial: fadeRadial,
60
- fadeOverlayDarken: fadeOverlayDarken,
61
- backgroundImage: backgroundImage,
62
- sectionClass: sectionClass,
63
- containerClass: containerClass,
64
- textWrapperClass: textWrapperClass,
65
- imageWrapperClass: imageWrapperClass,
66
- gap: gap,
67
- // Enhanced content props
68
- heading: heading,
69
- headingSize: headingSize,
70
- headingWeight: headingWeight,
71
- headingColor: headingColor,
72
- headingClass: headingClass,
73
- subheading: subheading,
74
- subheadingSize: subheadingSize,
75
- subheadingWeight: subheadingWeight,
76
- subheadingColor: subheadingColor,
77
- subheadingClass: subheadingClass,
78
- content: content,
79
- contentSize: contentSize,
80
- contentWeight: contentWeight,
81
- contentColor: contentColor,
82
- contentClass: contentClass,
83
- image: image,
84
- imageUrl: imageUrl,
85
- imageSize: imageSize,
86
- imageAlt: imageAlt,
87
- imageClass: imageClass,
88
- cta: cta,
89
- ctaClass: ctaClass,
90
- // CTA Button props
91
- showPrimaryCTA: showPrimaryCTA,
92
- showSecondaryCTA: showSecondaryCTA,
93
- showAccentCTA: showAccentCTA,
94
- primaryButtonOutlined: primaryButtonOutlined,
95
- secondaryButtonOutlined: secondaryButtonOutlined,
96
- accentButtonOutlined: accentButtonOutlined,
97
- ctaPrimaryUrl: ctaPrimaryUrl,
98
- ctaSecondaryUrl: ctaSecondaryUrl,
99
- ctaAccentUrl: ctaAccentUrl,
100
- ctaPrimaryText: ctaPrimaryText,
101
- ctaSecondaryText: ctaSecondaryText,
102
- ctaAccentText: ctaAccentText,
103
- ctaGap: ctaGap,
104
- ctaFlexJustify: ctaFlexJustify,
105
- ctaPrimaryRounded: ctaPrimaryRounded,
106
- ctaPrimaryFlat: ctaPrimaryFlat,
107
- ctaPrimaryPrefix: ctaPrimaryPrefix,
108
- ctaPrimarySuffix: ctaPrimarySuffix,
109
- ctaSecondaryRounded: ctaSecondaryRounded,
110
- ctaSecondaryFlat: ctaSecondaryFlat,
111
- ctaSecondaryPrefix: ctaSecondaryPrefix,
112
- ctaSecondarySuffix: ctaSecondarySuffix,
113
- ctaAccentRounded: ctaAccentRounded,
114
- ctaAccentFlat: ctaAccentFlat,
115
- ctaAccentPrefix: ctaAccentPrefix,
116
- ctaAccentSuffix: ctaAccentSuffix,
117
- primaryIconSize: primaryIconSize,
118
- secondaryIconSize: secondaryIconSize,
119
- accentIconSize: accentIconSize,
120
- }).props;
24
+ var Button_1 = __importDefault(require("../button/Button"));
25
+ var Flex_1 = __importDefault(require("../flex/Flex"));
26
+ var Vista = function (localProps) {
27
+ // Use the component config hook with the variant from localProps
28
+ var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Vista', localProps.variant).mergeWithLocal;
29
+ // Merge config with local props - local props override config
30
+ var mergedProps = mergeWithLocal(localProps).props;
31
+ // Use mergedProps directly - they already have the correct merge logic applied
32
+ var final = mergedProps;
33
+ // Debug: Log what props are actually coming through
34
+ react_1.default.useEffect(function () {
35
+ console.log('Vista merged props:', mergedProps);
36
+ console.log('Vista config available:', Object.keys(mergedProps).length > 0);
37
+ }, [mergedProps]);
121
38
  var layoutClass = [
122
- mergedProps.layout,
123
- mergedProps.reverse ? 'reverse' : '',
124
- "text-".concat(mergedProps.textAlign),
39
+ final.layout,
40
+ final.reverse ? 'reverse' : '',
41
+ "text-".concat(final.textAlign),
125
42
  ]
126
43
  .filter(Boolean)
127
44
  .join(' ');
128
45
  // CTA Buttons Component
129
46
  var CTAButtons = function () {
130
- var hasCTAs = mergedProps.showPrimaryCTA || mergedProps.showSecondaryCTA || mergedProps.showAccentCTA;
47
+ var hasCTAs = final.showPrimaryCTA || final.showSecondaryCTA || final.showAccentCTA;
131
48
  if (!hasCTAs)
132
49
  return null;
133
- return (react_1.default.createElement(Flex_1.default, { gap: mergedProps.ctaGap, justify: mergedProps.ctaFlexJustify, className: "mt-6 ".concat(mergedProps.ctaClass), wrap: "wrap", width: '100%' },
134
- mergedProps.showPrimaryCTA && (react_1.default.createElement(Button_1.default, { bg: "primary", outlined: mergedProps.primaryButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaPrimaryUrl; }, rounded: mergedProps.ctaPrimaryRounded, flat: mergedProps.ctaPrimaryFlat, stringPrefix: mergedProps.ctaPrimaryPrefix, stringSuffix: mergedProps.ctaPrimarySuffix, iconSize: mergedProps.primaryIconSize }, mergedProps.ctaPrimaryText)),
135
- mergedProps.showSecondaryCTA && (react_1.default.createElement(Button_1.default, { bg: "secondary", outlined: mergedProps.secondaryButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaSecondaryUrl; }, rounded: mergedProps.ctaSecondaryRounded, flat: mergedProps.ctaSecondaryFlat, stringPrefix: mergedProps.ctaSecondaryPrefix, stringSuffix: mergedProps.ctaSecondarySuffix, iconSize: mergedProps.secondaryIconSize }, mergedProps.ctaSecondaryText)),
136
- mergedProps.showAccentCTA && (react_1.default.createElement(Button_1.default, { bg: "accent", outlined: mergedProps.accentButtonOutlined, onClick: function () { return window.location.href = mergedProps.ctaAccentUrl; }, rounded: mergedProps.ctaAccentRounded, flat: mergedProps.ctaAccentFlat, stringPrefix: mergedProps.ctaAccentPrefix, stringSuffix: mergedProps.ctaAccentSuffix, iconSize: mergedProps.accentIconSize }, mergedProps.ctaAccentText))));
50
+ return (react_1.default.createElement(Flex_1.default, { gap: final.ctaGap, justify: final.ctaFlexJustify, className: "mt-6 ".concat(final.ctaClass), wrap: "wrap", width: '100%' },
51
+ final.showPrimaryCTA && (react_1.default.createElement(Button_1.default, { bg: "primary", outlined: final.primaryButtonOutlined, onClick: function () { return final.ctaPrimaryUrl && (window.location.href = final.ctaPrimaryUrl); }, rounded: final.ctaPrimaryRounded, flat: final.ctaPrimaryFlat, stringPrefix: final.ctaPrimaryPrefix, stringSuffix: final.ctaPrimarySuffix, iconSize: final.primaryIconSize }, final.ctaPrimaryText)),
52
+ final.showSecondaryCTA && (react_1.default.createElement(Button_1.default, { bg: "secondary", outlined: final.secondaryButtonOutlined, onClick: function () { return final.ctaSecondaryUrl && (window.location.href = final.ctaSecondaryUrl); }, rounded: final.ctaSecondaryRounded, flat: final.ctaSecondaryFlat, stringPrefix: final.ctaSecondaryPrefix, stringSuffix: final.ctaSecondarySuffix, iconSize: final.secondaryIconSize }, final.ctaSecondaryText)),
53
+ final.showAccentCTA && (react_1.default.createElement(Button_1.default, { bg: "accent", outlined: final.accentButtonOutlined, onClick: function () { return final.ctaAccentUrl && (window.location.href = final.ctaAccentUrl); }, rounded: final.ctaAccentRounded, flat: final.ctaAccentFlat, stringPrefix: final.ctaAccentPrefix, stringSuffix: final.ctaAccentSuffix, iconSize: final.accentIconSize }, final.ctaAccentText))));
137
54
  };
138
55
  // Enhanced Text Content with flexible styling
139
- var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(mergedProps.layout === 'centered' ? "text-center" : "", " ").concat(mergedProps.textWrapperClass) },
140
- mergedProps.heading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.headingSize, weight: mergedProps.headingWeight, color: mergedProps.headingColor, funcss: mergedProps.headingClass }, mergedProps.heading)),
141
- mergedProps.subheading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.subheadingSize, weight: mergedProps.subheadingWeight, color: mergedProps.subheadingColor, funcss: "mt-2 ".concat(mergedProps.subheadingClass) }, mergedProps.subheading)),
142
- mergedProps.content && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.contentSize, weight: mergedProps.contentWeight, color: mergedProps.contentColor, funcss: "mt-4 ".concat(mergedProps.contentClass), article: true }, children || (typeof mergedProps.content === 'string' ? react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: mergedProps.content } }) : mergedProps.content))),
143
- mergedProps.cta ? (react_1.default.createElement("div", { className: "mt-6 ".concat(mergedProps.ctaClass) }, mergedProps.cta)) : (react_1.default.createElement(CTAButtons, null))));
56
+ var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(final.layout === 'centered' ? "text-center" : "", " ").concat(final.textWrapperClass) },
57
+ final.heading && (react_1.default.createElement(Text_1.default, { block: true, size: final.headingSize, weight: final.headingWeight, color: final.headingColor, funcss: final.headingClass }, final.heading)),
58
+ final.subheading && (react_1.default.createElement(Text_1.default, { block: true, size: final.subheadingSize, weight: final.subheadingWeight, color: final.subheadingColor, funcss: "mt-2 ".concat(final.subheadingClass) }, final.subheading)),
59
+ final.content && (react_1.default.createElement(Text_1.default, { block: true, size: final.contentSize, weight: final.contentWeight, color: final.contentColor, funcss: "mt-4 ".concat(final.contentClass), article: true }, localProps.children || (typeof final.content === 'string' ? react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: final.content } }) : final.content))),
60
+ final.cta ? (react_1.default.createElement("div", { className: "mt-6 ".concat(final.ctaClass) }, final.cta)) : (react_1.default.createElement(CTAButtons, null))));
144
61
  // Enhanced Image Content - uses imageUrl if no image component provided
145
- var ImageContent = (mergedProps.image || mergedProps.imageUrl) && (react_1.default.createElement("div", { className: "vista-image ".concat(mergedProps.imageWrapperClass) }, mergedProps.image ? (mergedProps.image) : (react_1.default.createElement("img", { src: mergedProps.imageUrl, alt: mergedProps.imageAlt || 'Vista image', className: "".concat(mergedProps.imageClass), style: {
62
+ var ImageContent = (final.image || final.imageUrl) && (react_1.default.createElement("div", { className: "vista-image ".concat(final.imageWrapperClass) }, final.image ? (final.image) : (react_1.default.createElement("img", { src: final.imageUrl, alt: final.imageAlt || 'Vista image', className: "".concat(final.imageClass), style: {
146
63
  objectFit: 'cover',
147
- maxWidth: mergedProps.imageSize,
64
+ maxWidth: final.imageSize,
148
65
  borderRadius: 'inherit'
149
66
  } }))));
150
- var isCentered = mergedProps.layout === 'centered';
151
- var isStacked = mergedProps.layout === 'stacked';
67
+ var isCentered = final.layout === 'centered';
68
+ var isStacked = final.layout === 'stacked';
152
69
  var positionStyles = {
153
70
  'top-left': { top: '-100px', left: '-100px' },
154
71
  'top-right': { top: '-100px', right: '-100px' },
@@ -158,61 +75,61 @@ var Vista = function (_a) {
158
75
  };
159
76
  var primaryColor = (0, getCssVariable_1.getCssVariableValue)('primary');
160
77
  var secondaryColor = (0, getCssVariable_1.getCssVariableValue)('secondary');
161
- var gradientStyle = __assign({ position: 'absolute', width: mergedProps.gradientSize, height: mergedProps.gradientSize, background: mergedProps.gradientColors || "radial-gradient(circle, ".concat(primaryColor, ", ").concat(secondaryColor, ")"), opacity: mergedProps.opacity, filter: "blur(".concat(mergedProps.blurry, "px)"), pointerEvents: 'none', zIndex: 0 }, positionStyles[mergedProps.gradientPosition]);
78
+ var gradientStyle = __assign({ position: 'absolute', width: final.gradientSize || "200px", height: final.gradientSize || "200px", background: final.gradientColors || "radial-gradient(circle, ".concat(primaryColor, ", ").concat(secondaryColor, ")"), opacity: final.opacity, filter: "blur(".concat(final.blurry || 4, "rem)"), pointerEvents: 'none', zIndex: 0 }, positionStyles[final.gradientPosition]);
162
79
  return (react_1.default.createElement(ScrollInView_1.default, null,
163
- react_1.default.createElement("div", { className: "vista \n ".concat(mergedProps.pattern === 'grid' ? 'grid-bg' :
164
- mergedProps.pattern === 'dots' ? 'bg-pattern-dots' :
165
- mergedProps.pattern === 'diagonal' ? 'bg-pattern-diagonal' :
166
- mergedProps.pattern === 'checkerboard' ? 'bg-pattern-checkerboard' :
167
- mergedProps.pattern === 'horizontal' ? 'bg-pattern-horizontal' :
168
- mergedProps.pattern === 'vertical' ? 'bg-pattern-vertical' : '', " \n ").concat(mergedProps.bg, " p-").concat(mergedProps.padding, " ").concat(layoutClass, " ").concat(mergedProps.sectionClass, " ").concat(mergedProps.funcss), style: {
80
+ react_1.default.createElement("div", { className: "vista \n ".concat(final.pattern === 'grid' ? 'grid-bg' :
81
+ final.pattern === 'dots' ? 'bg-pattern-dots' :
82
+ final.pattern === 'diagonal' ? 'bg-pattern-diagonal' :
83
+ final.pattern === 'checkerboard' ? 'bg-pattern-checkerboard' :
84
+ final.pattern === 'horizontal' ? 'bg-pattern-horizontal' :
85
+ final.pattern === 'vertical' ? 'bg-pattern-vertical' : '', " \n ").concat(final.bg, " p-").concat(final.padding, " ").concat(layoutClass, " ").concat(final.sectionClass, " ").concat(final.funcss), style: {
169
86
  position: 'relative',
170
87
  overflow: 'hidden',
171
88
  minHeight: "90vh",
172
- backgroundImage: mergedProps.pattern === 'grid' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(mergedProps.patternOpacity, ") 1px, transparent 1px),\n linear-gradient(to bottom, rgba(var(--borderRgb), ").concat(mergedProps.patternOpacity, ") 1px, transparent 1px)") :
173
- mergedProps.pattern === 'dots' ? "radial-gradient(rgba(var(--borderRgb), ".concat(mergedProps.patternOpacity, ") 1px, transparent 1px)") :
174
- mergedProps.pattern === 'diagonal' ? "repeating-linear-gradient(45deg, rgba(var(--borderRgb), ".concat(mergedProps.patternOpacity, "), rgba(var(--borderRgb), ").concat(mergedProps.patternOpacity, ") 1px, transparent 1px, transparent 10px)") :
175
- mergedProps.pattern === 'checkerboard' ? "linear-gradient(45deg, rgba(var(--borderRgb), ".concat(mergedProps.patternOpacity, ") 25%, transparent 25%), linear-gradient(-45deg, rgba(var(--borderRgb), ").concat(mergedProps.patternOpacity, ") 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(var(--borderRgb), ").concat(mergedProps.patternOpacity, ") 75%), linear-gradient(-45deg, transparent 75%, rgba(var(--borderRgb), ").concat(mergedProps.patternOpacity, ") 75%)") :
176
- mergedProps.pattern === 'horizontal' ? "linear-gradient(to bottom, rgba(var(--borderRgb), ".concat(mergedProps.patternOpacity, ") 1px, transparent 1px)") :
177
- mergedProps.pattern === 'vertical' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(mergedProps.patternOpacity, ") 1px, transparent 1px)") : ''
89
+ backgroundImage: final.pattern === 'grid' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px),\n linear-gradient(to bottom, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 1px, transparent 1px)") :
90
+ final.pattern === 'dots' ? "radial-gradient(rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") :
91
+ final.pattern === 'diagonal' ? "repeating-linear-gradient(45deg, rgba(var(--borderRgb), ".concat(final.patternOpacity, "), rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 1px, transparent 1px, transparent 10px)") :
92
+ final.pattern === 'checkerboard' ? "linear-gradient(45deg, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 25%, transparent 25%), linear-gradient(-45deg, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 75%), linear-gradient(-45deg, transparent 75%, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 75%)") :
93
+ final.pattern === 'horizontal' ? "linear-gradient(to bottom, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") :
94
+ final.pattern === 'vertical' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") : ''
178
95
  } },
179
- mergedProps.showGradient && react_1.default.createElement("div", { style: gradientStyle }),
180
- react_1.default.createElement("div", { className: "vista-container ".concat(mergedProps.containerClass), style: { position: 'relative', zIndex: 1, gap: mergedProps.gap || "2rem" } }, isCentered || isStacked ? (react_1.default.createElement(react_1.default.Fragment, null,
181
- (mergedProps.imgPosition === 'top') && ImageContent,
96
+ final.showGradient && react_1.default.createElement("div", { style: gradientStyle }),
97
+ react_1.default.createElement("div", { className: "vista-container ".concat(final.containerClass), style: { position: 'relative', zIndex: 1, gap: final.gap || "2rem" } }, isCentered || isStacked ? (react_1.default.createElement(react_1.default.Fragment, null,
98
+ (final.imgPosition === 'top') && ImageContent,
182
99
  TextContent,
183
- (mergedProps.imgPosition === 'bottom') && ImageContent)) : mergedProps.reverse ? (react_1.default.createElement(react_1.default.Fragment, null,
100
+ (final.imgPosition === 'bottom') && ImageContent)) : final.reverse ? (react_1.default.createElement(react_1.default.Fragment, null,
184
101
  ImageContent,
185
102
  TextContent)) : (react_1.default.createElement(react_1.default.Fragment, null,
186
- (mergedProps.layout === 'imageLeft') && react_1.default.createElement(Col_1.default, null, ImageContent),
103
+ (final.layout === 'imageLeft') && react_1.default.createElement(Col_1.default, null, ImageContent),
187
104
  TextContent,
188
- (mergedProps.layout === 'imageRight') && react_1.default.createElement(Col_1.default, null, ImageContent)))),
189
- mergedProps.fade && (react_1.default.createElement("div", { style: {
105
+ (final.layout === 'imageRight') && react_1.default.createElement(Col_1.default, null, ImageContent)))),
106
+ final.fade && (react_1.default.createElement("div", { style: {
190
107
  position: 'absolute',
191
108
  inset: 0,
192
109
  width: '100%',
193
110
  height: '100%',
194
- background: mergedProps.fadeRadial
195
- ? "radial-gradient(circle, transparent 0%, ".concat((0, getCssVariable_1.getCssVariableValue)(mergedProps.bg || 'page-bg'), " 100%)")
196
- : "linear-gradient(to ".concat(mergedProps.fadeDirection || 'bottom', ", ").concat((0, getCssVariable_1.getCssVariableValue)(mergedProps.bg || 'page-bg'), " 0%, transparent 100%)"),
111
+ background: final.fadeRadial
112
+ ? "radial-gradient(circle, transparent 0%, ".concat((0, getCssVariable_1.getCssVariableValue)(final.bg || 'page-bg'), " 100%)")
113
+ : "linear-gradient(to ".concat(final.fadeDirection || 'bottom', ", ").concat((0, getCssVariable_1.getCssVariableValue)(final.bg || 'page-bg'), " 0%, transparent 100%)"),
197
114
  zIndex: 0,
198
115
  pointerEvents: 'none'
199
116
  } })),
200
- mergedProps.backgroundImage && (react_1.default.createElement("div", { style: {
117
+ final.backgroundImage && (react_1.default.createElement("div", { style: {
201
118
  position: 'absolute',
202
119
  inset: 0,
203
- backgroundImage: "url(".concat(mergedProps.backgroundImage, ")"),
120
+ backgroundImage: "url(".concat(final.backgroundImage, ")"),
204
121
  backgroundSize: 'cover',
205
122
  backgroundPosition: 'center',
206
123
  zIndex: -1,
207
124
  width: '100%',
208
125
  height: '100%',
209
126
  } })),
210
- mergedProps.backgroundImage && mergedProps.fadeOverlayDarken !== undefined && (react_1.default.createElement("div", { style: {
127
+ final.backgroundImage && final.fadeOverlayDarken !== undefined && (react_1.default.createElement("div", { style: {
211
128
  position: 'absolute',
212
129
  width: '100%',
213
130
  height: '100%',
214
131
  inset: 0,
215
- backgroundColor: "rgba(0, 0, 0, ".concat(mergedProps.fadeOverlayDarken, ")"),
132
+ backgroundColor: "rgba(0, 0, 0, ".concat(final.fadeOverlayDarken, ")"),
216
133
  zIndex: -1,
217
134
  } })))));
218
135
  };
@@ -14,6 +14,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.getAvailableVariants = exports.hasComponentVariant = exports.useComponentProps = exports.useComponentConfiguration = exports.mergeComponentConfig = exports.getComponentConfig = void 0;
15
15
  var theme_1 = require("../ui/theme/theme");
16
16
  var react_1 = require("react");
17
+ /**
18
+ * Check if a variant name is valid (not empty or whitespace only)
19
+ */
20
+ var isValidVariantName = function (variantName) {
21
+ return !!variantName && variantName.trim() !== '';
22
+ };
23
+ /**
24
+ * Filter out empty string and undefined values from component props
25
+ */
26
+ var filterEmptyProps = function (props) {
27
+ var filtered = {};
28
+ for (var key in props) {
29
+ var value = props[key];
30
+ // Only include props that are not undefined and not empty strings
31
+ if (value !== undefined && value !== '') {
32
+ filtered[key] = value;
33
+ }
34
+ }
35
+ return filtered;
36
+ };
17
37
  /**
18
38
  * Universal component config getter
19
39
  *
@@ -61,8 +81,10 @@ var getComponentConfig = function (projectData, componentName, variantName) {
61
81
  }
62
82
  }
63
83
  var variantData = component[targetVariant];
84
+ // Filter out empty string and undefined props from config
85
+ var filteredComponentProps = filterEmptyProps((variantData === null || variantData === void 0 ? void 0 : variantData.componentProps) || {});
64
86
  return {
65
- componentProps: (variantData === null || variantData === void 0 ? void 0 : variantData.componentProps) || {},
87
+ componentProps: filteredComponentProps,
66
88
  variantExists: variantExists,
67
89
  actualVariant: targetVariant,
68
90
  availableVariants: availableVariants,
@@ -135,7 +157,8 @@ var useComponentConfiguration = function (componentName, variantName) {
135
157
  var projectData = (0, theme_1.useTheme)().projectData;
136
158
  // Memoize config computation - only recompute when dependencies change
137
159
  var config = (0, react_1.useMemo)(function () {
138
- if (!variantName) {
160
+ // Check for valid variant name (not empty or whitespace only)
161
+ if (!isValidVariantName(variantName)) {
139
162
  return {
140
163
  componentProps: {},
141
164
  variantExists: false,
@@ -150,8 +173,8 @@ var useComponentConfiguration = function (componentName, variantName) {
150
173
  var mergeWithLocal = (0, react_1.useMemo)(function () {
151
174
  return function (localProps) {
152
175
  if (localProps === void 0) { localProps = {}; }
153
- // If no variant name was provided, return local props as-is
154
- if (!variantName) {
176
+ // If no valid variant name was provided, return local props as-is
177
+ if (!isValidVariantName(variantName)) {
155
178
  return {
156
179
  props: localProps,
157
180
  variant: '',