diy-template-components 5.0.0 → 5.1.2

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/build/index.es.js CHANGED
@@ -18,7 +18,7 @@ function insertStyle(css) {
18
18
  return css;
19
19
  }
20
20
 
21
- insertStyle("/* Brush stroke underline - for rich text content (color via --brush-color inline style) */\n.brush-stroke {\n position: relative;\n display: inline-block;\n white-space: pre-wrap;\n}\n\n.brush-stroke::after {\n content: \"\";\n position: absolute;\n top: 90%;\n left: 0;\n height: 0.5em;\n width: 100%;\n z-index: -1;\n border: solid var(--brush-width, 0.15em) var(--brush-color, #FFFFFF);\n border-color: var(--brush-color, #FFFFFF) transparent transparent transparent;\n border-radius: 100%;\n}\n\n/* Font size classes for rich text editor - Desktop (default) */\n.font-size-extra-small {\n font-size: 12px;\n line-height: 16px;\n}\n\n.font-size-small {\n font-size: 16px;\n line-height: 20px;\n}\n\n.font-size-medium {\n font-size: 20px;\n line-height: 24px;\n}\n\n.font-size-large {\n font-size: 24px;\n line-height: 28px;\n}\n\n.font-size-very-large {\n font-size: 32px;\n line-height: 36px;\n}\n\n.font-size-extra-large {\n font-size: 56px;\n line-height: 64px;\n}\n\n.font-size-huge {\n font-size: 72px;\n line-height: 80px;\n}\n\n/* Font size classes - Mobile */\n@media (max-width: 768px) {\n .font-size-extra-small {\n font-size: 10px;\n line-height: 14px;\n }\n .font-size-small {\n font-size: 14px;\n line-height: 18px;\n }\n .font-size-medium {\n font-size: 16px;\n line-height: 20px;\n }\n .font-size-large {\n font-size: 18px;\n line-height: 20px;\n }\n .font-size-very-large {\n font-size: 24px;\n line-height: 36px;\n }\n .font-size-extra-large {\n font-size: 40px;\n line-height: 48px;\n }\n .font-size-huge {\n font-size: 56px;\n line-height: 64px;\n }\n}");
21
+ insertStyle("/* Brush stroke underline - for rich text content (color via --brush-color inline style) */\n.brush-stroke {\n position: relative;\n display: inline-block;\n white-space: pre-wrap;\n}\n\n.brush-stroke::after {\n content: \"\";\n position: absolute;\n top: 90%;\n left: 0;\n height: 0.5em;\n width: 100%;\n z-index: 1;\n border: solid var(--brush-width, 0.15em) var(--brush-color, #FFFFFF);\n border-color: var(--brush-color, #FFFFFF) transparent transparent transparent;\n border-radius: 100%;\n}\n\n/* Font size classes for rich text editor - Desktop (default) */\n.font-size-extra-small {\n font-size: 12px;\n line-height: 16px;\n}\n\n.font-size-small {\n font-size: 16px;\n line-height: 20px;\n}\n\n.font-size-medium {\n font-size: 20px;\n line-height: 24px;\n}\n\n.font-size-large {\n font-size: 24px;\n line-height: 28px;\n}\n\n.font-size-very-large {\n font-size: 32px;\n line-height: 36px;\n}\n\n.font-size-extra-large {\n font-size: 56px;\n line-height: 64px;\n}\n\n.font-size-huge {\n font-size: 72px;\n line-height: 80px;\n}\n\n/* Font size classes - Mobile */\n@media (max-width: 768px) {\n .font-size-extra-small {\n font-size: 10px;\n line-height: 14px;\n }\n .font-size-small {\n font-size: 14px;\n line-height: 18px;\n }\n .font-size-medium {\n font-size: 16px;\n line-height: 20px;\n }\n .font-size-large {\n font-size: 18px;\n line-height: 20px;\n }\n .font-size-very-large {\n font-size: 24px;\n line-height: 36px;\n }\n .font-size-extra-large {\n font-size: 40px;\n line-height: 48px;\n }\n .font-size-huge {\n font-size: 56px;\n line-height: 64px;\n }\n}");
22
22
 
23
23
  function _extends() {
24
24
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -2452,6 +2452,25 @@ const fontWeight = {
2452
2452
  superBold: 900
2453
2453
  };
2454
2454
 
2455
+ /**
2456
+ * Central font name resolver.
2457
+ * Maps legacy/display names to canonical Google Fonts family names.
2458
+ */
2459
+ const FONT_NAME_ALIASES = {
2460
+ 'Ibm Plex Sans': 'IBM Plex Sans'
2461
+ };
2462
+
2463
+ /**
2464
+ * Resolves a font family name to its canonical form for loading/rendering.
2465
+ * @param {string} fontFamily - Raw font name (e.g. from metadata or user selection)
2466
+ * @returns {string} Resolved font name for CSS/Google Fonts URL
2467
+ */
2468
+ function resolveFont(fontFamily) {
2469
+ if (!fontFamily || typeof fontFamily !== 'string') return fontFamily;
2470
+ const normalized = fontFamily.trim();
2471
+ return FONT_NAME_ALIASES[normalized] || normalized;
2472
+ }
2473
+
2455
2474
  const getBorderRadius = roundness => {
2456
2475
  const mapping = {
2457
2476
  sharp: {
@@ -2488,8 +2507,9 @@ const getBorderRadius = roundness => {
2488
2507
  };
2489
2508
  function getTheme(colorTheme = 'blue', fontFamily = 'Arial', isMobile, roundness = 'rounded') {
2490
2509
  const palette = palettes[colorTheme] || palettes['blue'];
2510
+ const resolvedFont = resolveFont(fontFamily);
2491
2511
  const typography = {
2492
- fontFamily: `"${fontFamily}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
2512
+ fontFamily: `"${resolvedFont}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
2493
2513
  fontSize: isMobile ? fontSizeMob : fontSize,
2494
2514
  fontWeight
2495
2515
  };
@@ -2506,62 +2526,29 @@ function getTheme(colorTheme = 'blue', fontFamily = 'Arial', isMobile, roundness
2506
2526
  };
2507
2527
  }
2508
2528
 
2509
- const fontComponents = {
2510
- Rubik,
2511
- 'Ibm Plex Sans': IbmPlexSans,
2512
- 'Merriweather Sans': MerriweatherSans,
2513
- 'Arima Madurai': ArimaMadurai,
2514
- 'Nanum Square': NanumSquare
2515
- };
2516
- const getFontComponent = font => fontComponents[font] || (() => null);
2529
+ const NANUM_SQUARE_URL = 'https://cdn.jsdelivr.net/gh/moonspam/NanumSquare@2.0/nanumsquare.css';
2530
+ const FONT_LINK_ID_PREFIX = 'diy-font-seeder-';
2531
+ const getGoogleFontsUrl = fontFamily => `https://fonts.googleapis.com/css2?family=${fontFamily.replace(/ /g, '+')}:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap`;
2517
2532
  function FontSeeder({
2518
2533
  fontFamily
2519
2534
  }) {
2520
- const Comp = getFontComponent(fontFamily);
2521
- return /*#__PURE__*/React.createElement(Comp, null);
2522
- }
2523
- const useRubikFont = createUseStyles$1({
2524
- '@import': `url('https://fonts.googleapis.com/css2?family=Lato&family=Rubik:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap')`
2525
- });
2526
- function Rubik() {
2527
- // to import "Rubik" font css
2528
- useRubikFont();
2529
- return null;
2530
- }
2531
- const useIbmPlexSansFont = createUseStyles$1({
2532
- '@import': 'url(https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap)'
2533
- });
2534
- function IbmPlexSans() {
2535
- // to import "Ibm Plex Sans" font css
2536
- useIbmPlexSansFont();
2537
- return null;
2538
- }
2539
- const useMerriweatherSansFont = createUseStyles$1({
2540
- '@import': 'url(https://fonts.googleapis.com/css2?family=Merriweather+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap)'
2541
- });
2542
- function MerriweatherSans() {
2543
- // to import "Merriweather Sans" font css
2544
- useMerriweatherSansFont();
2545
- return null;
2546
- }
2547
- const useArimaMaduraiFont = createUseStyles$1({
2548
- '@import': 'url(https://fonts.googleapis.com/css2?family=Arima+Madurai:wght@400;500;700&display=swap)'
2549
- });
2550
- function ArimaMadurai() {
2551
- // to import "Arima Madurai" font css
2552
- useArimaMaduraiFont();
2553
- return null;
2554
- }
2555
- const useNanumSqaureFont = createUseStyles$1({
2556
- '@import': 'url(https://cdn.jsdelivr.net/gh/moonspam/NanumSquare@2.0/nanumsquare.css)'
2557
- });
2558
- function NanumSquare() {
2559
- // to import "Nanum Square" font css
2560
- useNanumSqaureFont();
2535
+ useEffect(() => {
2536
+ if (!fontFamily || typeof document === 'undefined') return;
2537
+ const normalizedName = String(fontFamily).trim();
2538
+ const fontForUrl = resolveFont(normalizedName);
2539
+ const url = normalizedName.toLowerCase() === 'nanum square' ? NANUM_SQUARE_URL : getGoogleFontsUrl(fontForUrl);
2540
+ const linkId = `${FONT_LINK_ID_PREFIX}${normalizedName.replace(/\s+/g, '-')}`;
2541
+ if (document.getElementById(linkId)) return;
2542
+ const link = document.createElement('link');
2543
+ link.id = linkId;
2544
+ link.rel = 'stylesheet';
2545
+ link.href = url;
2546
+ document.head.appendChild(link);
2547
+ }, [fontFamily]);
2561
2548
  return null;
2562
2549
  }
2563
2550
 
2564
- insertStyle("@charset \"UTF-8\";\n/* Wrapper: no height/min-height – height comes only from section content, not from HOC */\n.sectionBackgroundWrapper {\n position: relative;\n width: 100%;\n overflow: hidden;\n}\n\n/* Section root transparent so background (image/color/gradient/video) shows through */\n.sectionBackgroundWrapper > .sectionBackgroundContent > * {\n background: transparent !important;\n}\n\n/* Video: absolute so it does not affect wrapper height; height follows section */\n.sectionBackgroundVideo {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 0;\n pointer-events: none;\n}\n\n/* YouTube embed: cover background, no UI interaction, minimal branding via URL params */\n.sectionBackgroundYoutube {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100vw;\n min-width: 100%;\n min-height: 100%;\n height: 56.25vw; /* 16:9 */\n min-height: 100vh;\n transform: translate(-50%, -50%);\n border: none;\n z-index: 0;\n pointer-events: none;\n}\n\n@media (min-aspect-ratio: 16/9) {\n .sectionBackgroundYoutube {\n width: 177.78vh;\n height: 100vh;\n min-width: 100%;\n min-height: 100%;\n }\n}\n/* Blur overlay: frosted glass so content stays readable over video/image/gradient */\n.sectionBackgroundBlur {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n pointer-events: none;\n backdrop-filter: blur(2px);\n -webkit-backdrop-filter: blur(2px);\n /* background: rgba(255, 255, 255, 0.08); */\n}\n\n/* Content wrapper: above blur so component items are clear */\n.sectionBackgroundContent {\n position: relative;\n z-index: 2;\n}\n\n/* Background layer: fills wrapper only (absolute), does not affect wrapper height */\n.sectionBackgroundLayer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 0;\n pointer-events: none;\n}\n\n.sectionBackgroundLayer.sectionBackgroundImage {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n}");
2551
+ insertStyle("@charset \"UTF-8\";\n/* Wrapper: no height/min-height – height comes only from section content, not from HOC */\n.sectionBackgroundWrapper {\n position: relative;\n width: 100%;\n overflow: hidden;\n}\n\n/* Section root transparent so background (image/color/gradient/video) shows through */\n.sectionBackgroundWrapper > .sectionBackgroundContent > * {\n background: transparent !important;\n}\n\n/* Video: absolute so it does not affect wrapper height; height follows section */\n.sectionBackgroundVideo {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 0;\n pointer-events: none;\n}\n\n/* YouTube embed: cover background, no UI interaction, minimal branding via URL params */\n.sectionBackgroundYoutube {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100vw;\n min-width: 100%;\n min-height: 100%;\n height: 56.25vw; /* 16:9 */\n min-height: 100vh;\n transform: translate(-50%, -50%);\n border: none;\n z-index: 0;\n pointer-events: none;\n}\n\n@media (min-aspect-ratio: 16/9) {\n .sectionBackgroundYoutube {\n width: 177.78vh;\n height: 100vh;\n min-width: 100%;\n min-height: 100%;\n }\n}\n/* Blur overlay: frosted glass so content stays readable over video/image/gradient */\n.sectionBackgroundBlur {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n pointer-events: none;\n /* backdrop-filter: blur(2px);\n -webkit-backdrop-filter: blur(2px); */\n /* background: rgba(255, 255, 255, 0.08); */\n}\n\n/* Content wrapper: above blur so component items are clear */\n.sectionBackgroundContent {\n position: relative;\n z-index: 2;\n}\n\n/* Background layer: fills wrapper only (absolute), does not affect wrapper height */\n.sectionBackgroundLayer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 0;\n pointer-events: none;\n}\n\n.sectionBackgroundLayer.sectionBackgroundImage {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n}");
2565
2552
 
2566
2553
  /**
2567
2554
  * Extracts YouTube video ID from various YouTube URL formats.
@@ -2666,7 +2653,7 @@ function withSectionBackground(WrappedSectionRenderer) {
2666
2653
  switch (type) {
2667
2654
  case 'color':
2668
2655
  return {
2669
- backgroundColor: value
2656
+ background: value
2670
2657
  };
2671
2658
  case 'image':
2672
2659
  return {
@@ -3026,8 +3013,9 @@ const generateTheme = (theme = 'blue', fontFamily = 'Arial', isMobile, roundness
3026
3013
  headerText: allColors[color],
3027
3014
  headerHover: allColors['tertiary' + color]
3028
3015
  };
3016
+ const resolvedFont = resolveFont(fontFamily);
3029
3017
  const typography = {
3030
- fontFamily: `"${fontFamily}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
3018
+ fontFamily: `"${resolvedFont}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
3031
3019
  fontSize: isMobile ? fontSizeMob : fontSize,
3032
3020
  fontWeight
3033
3021
  };
@@ -12476,10 +12464,10 @@ const useTimerCallPageStyles = createUseStyles(theme => ({
12476
12464
  }
12477
12465
  },
12478
12466
  timerAndCallContainer: {
12479
- padding: '72px',
12480
- background: '#F4F9FF',
12481
- borderRadius: '8px',
12482
- boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)'
12467
+ // padding: '72px',
12468
+ // background: '#F4F9FF',
12469
+ // borderRadius: '8px',
12470
+ // boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)'
12483
12471
  },
12484
12472
  timerAndCallBox: {
12485
12473
  display: 'flex',
@@ -12609,7 +12597,7 @@ const TimerAndCall = ({
12609
12597
  }
12610
12598
  })) : null, nodeData?.timerButton?.metadata?.value ? /*#__PURE__*/React.createElement(Button, {
12611
12599
  style: {
12612
- width: '100%',
12600
+ width: 'fit-content',
12613
12601
  fontWeight: '700',
12614
12602
  fontSize: '14px'
12615
12603
  },