@app-studio/web 0.9.75 → 0.9.77

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.
@@ -41,6 +41,7 @@ require('core-js/modules/es.regexp.constructor.js');
41
41
  require('core-js/modules/es.regexp.exec.js');
42
42
  var formik = require('formik');
43
43
  require('core-js/modules/es.string.replace.js');
44
+ require('core-js/modules/es.string.split.js');
44
45
  require('core-js/modules/es.promise.finally.js');
45
46
  require('core-js/modules/es.string.match.js');
46
47
  require('core-js/modules/es.string.search.js');
@@ -17055,82 +17056,6 @@ var TitleSizes = {
17055
17056
  lg: 64,
17056
17057
  xl: 72
17057
17058
  };
17058
- /**
17059
- * Responsive typography system that maps title sizes to responsive breakpoints
17060
- * Based on the Typography system with dynamic breakpoint sizing
17061
- */
17062
- var ResponsiveTypography = {
17063
- // xl maps to H1 - Largest heading
17064
- xl: {
17065
- media: {
17066
- mobile: {
17067
- fontSize: 60
17068
- },
17069
- tablet: {
17070
- fontSize: 60
17071
- },
17072
- desktop: {
17073
- fontSize: 96
17074
- }
17075
- }
17076
- },
17077
- // lg maps to H2 - Large heading
17078
- lg: {
17079
- media: {
17080
- mobile: {
17081
- fontSize: 48
17082
- },
17083
- tablet: {
17084
- fontSize: 48
17085
- },
17086
- desktop: {
17087
- fontSize: 70
17088
- }
17089
- }
17090
- },
17091
- // md maps to H3 - Medium heading
17092
- md: {
17093
- media: {
17094
- mobile: {
17095
- fontSize: 32
17096
- },
17097
- tablet: {
17098
- fontSize: 40
17099
- },
17100
- desktop: {
17101
- fontSize: 56
17102
- }
17103
- }
17104
- },
17105
- // sm maps to T1 - Title text
17106
- sm: {
17107
- media: {
17108
- mobile: {
17109
- fontSize: 20
17110
- },
17111
- tablet: {
17112
- fontSize: 24
17113
- },
17114
- desktop: {
17115
- fontSize: 32
17116
- }
17117
- }
17118
- },
17119
- // xs maps to S1 - Subtitle text
17120
- xs: {
17121
- media: {
17122
- mobile: {
17123
- fontSize: 14
17124
- },
17125
- tablet: {
17126
- fontSize: 18
17127
- },
17128
- desktop: {
17129
- fontSize: 20
17130
- }
17131
- }
17132
- }
17133
- };
17134
17059
  /**
17135
17060
  * Default styles for different highlight types
17136
17061
  */
@@ -17236,9 +17161,17 @@ var TypewriterEffect = _ref => {
17236
17161
  }, typingSpeed);
17237
17162
  return () => clearTimeout(timeout);
17238
17163
  }, [textArray, currentTextIndex, charIndex, isComplete, onComplete, pauseTime, typingSpeed]);
17164
+ var renderWithLineBreaks = text => {
17165
+ if (!text || typeof text !== 'string') return text;
17166
+ var parts = text.split('|');
17167
+ if (parts.length === 1) return text;
17168
+ return parts.map((part, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17169
+ key: index
17170
+ }, part, index < parts.length - 1 && /*#__PURE__*/React__default.createElement("br", null))));
17171
+ };
17239
17172
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, displayedText.map((text, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17240
17173
  key: index
17241
- }, text, showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17174
+ }, renderWithLineBreaks(text), showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17242
17175
  as: "span",
17243
17176
  display: "inline-block",
17244
17177
  width: "0.1em",
@@ -17289,20 +17222,30 @@ var SlideEffect = _ref => {
17289
17222
  }
17290
17223
  }, [text, displayedText, phase]);
17291
17224
  // Calculate animation durations
17292
- var words = React.useMemo(() => displayedText.split(' '), [displayedText]);
17293
- var wordCount = words.length;
17225
+ var {
17226
+ lines,
17227
+ totalWordCount
17228
+ } = React.useMemo(() => {
17229
+ var rawLines = displayedText.split('|');
17230
+ var processedLines = rawLines.map(line => line.trim().split(/\s+/).filter(w => w.length > 0));
17231
+ var count = processedLines.reduce((acc, line) => acc + line.length, 0);
17232
+ return {
17233
+ lines: processedLines,
17234
+ totalWordCount: count
17235
+ };
17236
+ }, [displayedText]);
17294
17237
  var totalEnterDuration = React.useMemo(() => {
17295
17238
  if (sequential) {
17296
- return wordCount * (duration + stagger);
17239
+ return totalWordCount * (duration + stagger);
17297
17240
  }
17298
- return (wordCount - 1) * stagger + duration;
17299
- }, [wordCount, duration, stagger, sequential]);
17241
+ return (totalWordCount - 1) * stagger + duration;
17242
+ }, [totalWordCount, duration, stagger, sequential]);
17300
17243
  var totalExitDuration = React.useMemo(() => {
17301
17244
  if (sequential) {
17302
- return wordCount * (duration + stagger);
17245
+ return totalWordCount * (duration + stagger);
17303
17246
  }
17304
- return (wordCount - 1) * stagger + duration;
17305
- }, [wordCount, duration, stagger, sequential]);
17247
+ return (totalWordCount - 1) * stagger + duration;
17248
+ }, [totalWordCount, duration, stagger, sequential]);
17306
17249
  // Handle phase transitions
17307
17250
  React.useEffect(() => {
17308
17251
  if (timeoutRef.current) {
@@ -17351,24 +17294,32 @@ var SlideEffect = _ref => {
17351
17294
  var containerStyle = React.useMemo(() => Object.assign({
17352
17295
  display: 'inline-block',
17353
17296
  position: 'relative',
17354
- overflow: 'hidden',
17355
17297
  verticalAlign: 'bottom',
17356
- whiteSpace: 'nowrap'
17298
+ whiteSpace: 'nowrap',
17299
+ lineHeight: 'normal'
17357
17300
  }, textStyle), [textStyle]);
17358
- // Word row container style
17359
- var wordRowStyle = React.useMemo(() => ({
17301
+ var linesContainerStyle = React.useMemo(() => ({
17360
17302
  display: 'inline-flex',
17361
- flexWrap: 'nowrap',
17303
+ flexDirection: 'column',
17304
+ alignItems: 'center'
17305
+ }), []);
17306
+ var lineStyle = React.useMemo(() => ({
17307
+ display: 'block',
17362
17308
  whiteSpace: 'nowrap'
17363
17309
  }), []);
17310
+ var globalWordIndex = 0;
17364
17311
  return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
17365
17312
  as: "span",
17366
17313
  style: containerStyle
17367
17314
  }, props), /*#__PURE__*/React__default.createElement("span", {
17368
- style: wordRowStyle
17369
- }, words.map((word, index) => {
17370
- var delay = getDelay(index);
17371
- var isLast = index === words.length - 1;
17315
+ style: linesContainerStyle
17316
+ }, lines.map((lineWords, lineIndex) => (/*#__PURE__*/React__default.createElement("span", {
17317
+ key: "line-" + lineIndex,
17318
+ style: lineStyle
17319
+ }, lineWords.map((word, wordIndex) => {
17320
+ var currentGlobalIndex = globalWordIndex++;
17321
+ var delay = getDelay(currentGlobalIndex);
17322
+ var isLastInLine = wordIndex === lineWords.length - 1;
17372
17323
  // Create animation based on phase and direction
17373
17324
  var wordAnimation;
17374
17325
  var durationStr = duration + "ms";
@@ -17387,7 +17338,7 @@ var SlideEffect = _ref => {
17387
17338
  fillMode: 'both'
17388
17339
  });
17389
17340
  } else if (phase === 'exiting') {
17390
- // Custom animation objects for exiting (slideOut not in app-studio yet)
17341
+ // Custom animation objects for exiting
17391
17342
  wordAnimation = isUp ? {
17392
17343
  from: {
17393
17344
  transform: 'translateY(0)',
@@ -17418,22 +17369,30 @@ var SlideEffect = _ref => {
17418
17369
  }
17419
17370
  var wordStyle = Object.assign({}, customWordStyle, {
17420
17371
  display: 'inline-block',
17421
- marginRight: isLast ? 0 : '0.25em',
17372
+ marginRight: isLastInLine ? 0 : '0.25em',
17422
17373
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
17423
17374
  opacity: phase === 'visible' ? 1 : undefined
17424
17375
  });
17425
17376
  return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17426
- key: animKey + "-" + index,
17377
+ key: animKey + "-" + lineIndex + "-" + wordIndex,
17427
17378
  as: "span",
17428
17379
  animate: wordAnimation
17429
17380
  }, restWordProps, wordStyle), word);
17430
- })));
17381
+ }))))));
17431
17382
  };
17432
17383
 
17433
- var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17384
+ var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17434
17385
  function escapeRegExp(string) {
17435
17386
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17436
17387
  }
17388
+ var renderWithLineBreaks = text => {
17389
+ if (!text || typeof text !== 'string') return text;
17390
+ var parts = text.split('|');
17391
+ if (parts.length === 1) return text;
17392
+ return parts.map((part, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17393
+ key: index
17394
+ }, part, index < parts.length - 1 && /*#__PURE__*/React__default.createElement("br", null))));
17395
+ };
17437
17396
  var TitleView = _ref => {
17438
17397
  var {
17439
17398
  children,
@@ -17442,7 +17401,6 @@ var TitleView = _ref => {
17442
17401
  highlightColor = 'theme.primary',
17443
17402
  highlightSecondaryColor,
17444
17403
  size = 'lg',
17445
- responsive = true,
17446
17404
  views,
17447
17405
  highlightAnimate,
17448
17406
  animate,
@@ -17510,10 +17468,7 @@ var TitleView = _ref => {
17510
17468
  highlightSlideSequential
17511
17469
  }, props));
17512
17470
  var TextComponent = textComponent || appStudio.Text;
17513
- // Common style calculations
17514
- var useResponsive = responsive && !props.media;
17515
17471
  var fontSize = TitleSizes[size];
17516
- var responsiveStyles = useResponsive ? ResponsiveTypography[size] : null;
17517
17472
  // Highlight style props
17518
17473
  var highlightProps = HighlightStyles[highlightStyle](resolvedHighlightColor, resolvedHighlightSecondaryColor);
17519
17474
  // Apply loop control to animations
@@ -17538,8 +17493,7 @@ var TitleView = _ref => {
17538
17493
  animate: inView ? controlledAnimate : undefined
17539
17494
  }, !textComponent && {
17540
17495
  as: 'h1',
17541
- fontSize: useResponsive ? undefined : fontSize,
17542
- media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
17496
+ fontSize
17543
17497
  });
17544
17498
  // Render highlighted text content (typewriter, slide, or plain)
17545
17499
  var renderHighlightedContent = content => {
@@ -17567,12 +17521,12 @@ var TitleView = _ref => {
17567
17521
  stagger: stateHighlightSlideStagger,
17568
17522
  sequential: stateHighlightSlideSequential,
17569
17523
  direction: "up",
17570
- fontSize: useResponsive ? undefined : fontSize,
17524
+ fontSize: fontSize,
17571
17525
  wordProps: highlightProps,
17572
17526
  textComponent: TextComponent
17573
17527
  });
17574
17528
  }
17575
- return content;
17529
+ return renderWithLineBreaks(content);
17576
17530
  };
17577
17531
  // Case 1: Has highlight target - render with highlighted parts
17578
17532
  if (typeof text === 'string' && activeHighlightTarget) {
@@ -17590,12 +17544,12 @@ var TitleView = _ref => {
17590
17544
  }
17591
17545
  if (lastIndex < text.length) parts.push(text.substring(lastIndex));
17592
17546
  return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
17593
- fontSize: useResponsive ? undefined : fontSize
17547
+ fontSize: fontSize
17594
17548
  }, containerProps, views == null ? void 0 : views.container, props), parts.map((part, idx) => typeof part === 'string' ? (/*#__PURE__*/React__default.createElement(TextComponent, {
17595
17549
  key: "text-" + idx,
17596
17550
  as: "span",
17597
17551
  display: "inline"
17598
- }, part)) : (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17552
+ }, renderWithLineBreaks(part))) : (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17599
17553
  key: "highlight-" + idx,
17600
17554
  as: "span",
17601
17555
  display: "inline",
@@ -17613,7 +17567,7 @@ var TitleView = _ref => {
17613
17567
  }, !highlightSlide ? highlightProps : {}, views == null ? void 0 : views.highlight), renderHighlightedContent(text)));
17614
17568
  }
17615
17569
  // Case 3: Default - no highlighting
17616
- return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({}, containerProps, props, views == null ? void 0 : views.container), text);
17570
+ return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({}, containerProps, props, views == null ? void 0 : views.container), renderWithLineBreaks(text));
17617
17571
  };
17618
17572
 
17619
17573
  /**