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.js CHANGED
@@ -32,7 +32,7 @@ function insertStyle(css) {
32
32
  return css;
33
33
  }
34
34
 
35
- 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}");
35
+ 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}");
36
36
 
37
37
  function _extends() {
38
38
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -2466,6 +2466,25 @@ const fontWeight = {
2466
2466
  superBold: 900
2467
2467
  };
2468
2468
 
2469
+ /**
2470
+ * Central font name resolver.
2471
+ * Maps legacy/display names to canonical Google Fonts family names.
2472
+ */
2473
+ const FONT_NAME_ALIASES = {
2474
+ 'Ibm Plex Sans': 'IBM Plex Sans'
2475
+ };
2476
+
2477
+ /**
2478
+ * Resolves a font family name to its canonical form for loading/rendering.
2479
+ * @param {string} fontFamily - Raw font name (e.g. from metadata or user selection)
2480
+ * @returns {string} Resolved font name for CSS/Google Fonts URL
2481
+ */
2482
+ function resolveFont(fontFamily) {
2483
+ if (!fontFamily || typeof fontFamily !== 'string') return fontFamily;
2484
+ const normalized = fontFamily.trim();
2485
+ return FONT_NAME_ALIASES[normalized] || normalized;
2486
+ }
2487
+
2469
2488
  const getBorderRadius = roundness => {
2470
2489
  const mapping = {
2471
2490
  sharp: {
@@ -2502,8 +2521,9 @@ const getBorderRadius = roundness => {
2502
2521
  };
2503
2522
  function getTheme(colorTheme = 'blue', fontFamily = 'Arial', isMobile, roundness = 'rounded') {
2504
2523
  const palette = palettes[colorTheme] || palettes['blue'];
2524
+ const resolvedFont = resolveFont(fontFamily);
2505
2525
  const typography = {
2506
- fontFamily: `"${fontFamily}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
2526
+ fontFamily: `"${resolvedFont}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
2507
2527
  fontSize: isMobile ? fontSizeMob : fontSize,
2508
2528
  fontWeight
2509
2529
  };
@@ -2520,62 +2540,29 @@ function getTheme(colorTheme = 'blue', fontFamily = 'Arial', isMobile, roundness
2520
2540
  };
2521
2541
  }
2522
2542
 
2523
- const fontComponents = {
2524
- Rubik,
2525
- 'Ibm Plex Sans': IbmPlexSans,
2526
- 'Merriweather Sans': MerriweatherSans,
2527
- 'Arima Madurai': ArimaMadurai,
2528
- 'Nanum Square': NanumSquare
2529
- };
2530
- const getFontComponent = font => fontComponents[font] || (() => null);
2543
+ const NANUM_SQUARE_URL = 'https://cdn.jsdelivr.net/gh/moonspam/NanumSquare@2.0/nanumsquare.css';
2544
+ const FONT_LINK_ID_PREFIX = 'diy-font-seeder-';
2545
+ 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`;
2531
2546
  function FontSeeder({
2532
2547
  fontFamily
2533
2548
  }) {
2534
- const Comp = getFontComponent(fontFamily);
2535
- return /*#__PURE__*/React__default["default"].createElement(Comp, null);
2536
- }
2537
- const useRubikFont = reactJss.createUseStyles({
2538
- '@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')`
2539
- });
2540
- function Rubik() {
2541
- // to import "Rubik" font css
2542
- useRubikFont();
2543
- return null;
2544
- }
2545
- const useIbmPlexSansFont = reactJss.createUseStyles({
2546
- '@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)'
2547
- });
2548
- function IbmPlexSans() {
2549
- // to import "Ibm Plex Sans" font css
2550
- useIbmPlexSansFont();
2551
- return null;
2552
- }
2553
- const useMerriweatherSansFont = reactJss.createUseStyles({
2554
- '@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)'
2555
- });
2556
- function MerriweatherSans() {
2557
- // to import "Merriweather Sans" font css
2558
- useMerriweatherSansFont();
2559
- return null;
2560
- }
2561
- const useArimaMaduraiFont = reactJss.createUseStyles({
2562
- '@import': 'url(https://fonts.googleapis.com/css2?family=Arima+Madurai:wght@400;500;700&display=swap)'
2563
- });
2564
- function ArimaMadurai() {
2565
- // to import "Arima Madurai" font css
2566
- useArimaMaduraiFont();
2567
- return null;
2568
- }
2569
- const useNanumSqaureFont = reactJss.createUseStyles({
2570
- '@import': 'url(https://cdn.jsdelivr.net/gh/moonspam/NanumSquare@2.0/nanumsquare.css)'
2571
- });
2572
- function NanumSquare() {
2573
- // to import "Nanum Square" font css
2574
- useNanumSqaureFont();
2549
+ React.useEffect(() => {
2550
+ if (!fontFamily || typeof document === 'undefined') return;
2551
+ const normalizedName = String(fontFamily).trim();
2552
+ const fontForUrl = resolveFont(normalizedName);
2553
+ const url = normalizedName.toLowerCase() === 'nanum square' ? NANUM_SQUARE_URL : getGoogleFontsUrl(fontForUrl);
2554
+ const linkId = `${FONT_LINK_ID_PREFIX}${normalizedName.replace(/\s+/g, '-')}`;
2555
+ if (document.getElementById(linkId)) return;
2556
+ const link = document.createElement('link');
2557
+ link.id = linkId;
2558
+ link.rel = 'stylesheet';
2559
+ link.href = url;
2560
+ document.head.appendChild(link);
2561
+ }, [fontFamily]);
2575
2562
  return null;
2576
2563
  }
2577
2564
 
2578
- 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
+ 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}");
2579
2566
 
2580
2567
  /**
2581
2568
  * Extracts YouTube video ID from various YouTube URL formats.
@@ -2680,7 +2667,7 @@ function withSectionBackground(WrappedSectionRenderer) {
2680
2667
  switch (type) {
2681
2668
  case 'color':
2682
2669
  return {
2683
- backgroundColor: value
2670
+ background: value
2684
2671
  };
2685
2672
  case 'image':
2686
2673
  return {
@@ -3040,8 +3027,9 @@ const generateTheme = (theme = 'blue', fontFamily = 'Arial', isMobile, roundness
3040
3027
  headerText: allColors[color],
3041
3028
  headerHover: allColors['tertiary' + color]
3042
3029
  };
3030
+ const resolvedFont = resolveFont(fontFamily);
3043
3031
  const typography = {
3044
- fontFamily: `"${fontFamily}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
3032
+ fontFamily: `"${resolvedFont}", "Roboto", "Helvetica", "Arial", "sans-serif"`,
3045
3033
  fontSize: isMobile ? fontSizeMob : fontSize,
3046
3034
  fontWeight
3047
3035
  };
@@ -12490,10 +12478,10 @@ const useTimerCallPageStyles = createUseStyles(theme => ({
12490
12478
  }
12491
12479
  },
12492
12480
  timerAndCallContainer: {
12493
- padding: '72px',
12494
- background: '#F4F9FF',
12495
- borderRadius: '8px',
12496
- boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)'
12481
+ // padding: '72px',
12482
+ // background: '#F4F9FF',
12483
+ // borderRadius: '8px',
12484
+ // boxShadow: '0px 4px 10px rgba(0, 0, 0, 0.16)'
12497
12485
  },
12498
12486
  timerAndCallBox: {
12499
12487
  display: 'flex',
@@ -12623,7 +12611,7 @@ const TimerAndCall = ({
12623
12611
  }
12624
12612
  })) : null, nodeData?.timerButton?.metadata?.value ? /*#__PURE__*/React__default["default"].createElement(Button, {
12625
12613
  style: {
12626
- width: '100%',
12614
+ width: 'fit-content',
12627
12615
  fontWeight: '700',
12628
12616
  fontSize: '14px'
12629
12617
  },