@app-studio/web 0.9.76 → 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');
@@ -17160,9 +17161,17 @@ var TypewriterEffect = _ref => {
17160
17161
  }, typingSpeed);
17161
17162
  return () => clearTimeout(timeout);
17162
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
+ };
17163
17172
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, displayedText.map((text, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17164
17173
  key: index
17165
- }, 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({
17166
17175
  as: "span",
17167
17176
  display: "inline-block",
17168
17177
  width: "0.1em",
@@ -17213,20 +17222,30 @@ var SlideEffect = _ref => {
17213
17222
  }
17214
17223
  }, [text, displayedText, phase]);
17215
17224
  // Calculate animation durations
17216
- var words = React.useMemo(() => displayedText.split(' '), [displayedText]);
17217
- 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]);
17218
17237
  var totalEnterDuration = React.useMemo(() => {
17219
17238
  if (sequential) {
17220
- return wordCount * (duration + stagger);
17239
+ return totalWordCount * (duration + stagger);
17221
17240
  }
17222
- return (wordCount - 1) * stagger + duration;
17223
- }, [wordCount, duration, stagger, sequential]);
17241
+ return (totalWordCount - 1) * stagger + duration;
17242
+ }, [totalWordCount, duration, stagger, sequential]);
17224
17243
  var totalExitDuration = React.useMemo(() => {
17225
17244
  if (sequential) {
17226
- return wordCount * (duration + stagger);
17245
+ return totalWordCount * (duration + stagger);
17227
17246
  }
17228
- return (wordCount - 1) * stagger + duration;
17229
- }, [wordCount, duration, stagger, sequential]);
17247
+ return (totalWordCount - 1) * stagger + duration;
17248
+ }, [totalWordCount, duration, stagger, sequential]);
17230
17249
  // Handle phase transitions
17231
17250
  React.useEffect(() => {
17232
17251
  if (timeoutRef.current) {
@@ -17275,25 +17294,32 @@ var SlideEffect = _ref => {
17275
17294
  var containerStyle = React.useMemo(() => Object.assign({
17276
17295
  display: 'inline-block',
17277
17296
  position: 'relative',
17278
- overflow: 'hidden',
17279
17297
  verticalAlign: 'bottom',
17280
17298
  whiteSpace: 'nowrap',
17281
17299
  lineHeight: 'normal'
17282
17300
  }, textStyle), [textStyle]);
17283
- // Word row container style
17284
- var wordRowStyle = React.useMemo(() => ({
17301
+ var linesContainerStyle = React.useMemo(() => ({
17285
17302
  display: 'inline-flex',
17286
- flexWrap: 'nowrap',
17303
+ flexDirection: 'column',
17304
+ alignItems: 'center'
17305
+ }), []);
17306
+ var lineStyle = React.useMemo(() => ({
17307
+ display: 'block',
17287
17308
  whiteSpace: 'nowrap'
17288
17309
  }), []);
17310
+ var globalWordIndex = 0;
17289
17311
  return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
17290
17312
  as: "span",
17291
17313
  style: containerStyle
17292
17314
  }, props), /*#__PURE__*/React__default.createElement("span", {
17293
- style: wordRowStyle
17294
- }, words.map((word, index) => {
17295
- var delay = getDelay(index);
17296
- 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;
17297
17323
  // Create animation based on phase and direction
17298
17324
  var wordAnimation;
17299
17325
  var durationStr = duration + "ms";
@@ -17312,7 +17338,7 @@ var SlideEffect = _ref => {
17312
17338
  fillMode: 'both'
17313
17339
  });
17314
17340
  } else if (phase === 'exiting') {
17315
- // Custom animation objects for exiting (slideOut not in app-studio yet)
17341
+ // Custom animation objects for exiting
17316
17342
  wordAnimation = isUp ? {
17317
17343
  from: {
17318
17344
  transform: 'translateY(0)',
@@ -17343,22 +17369,30 @@ var SlideEffect = _ref => {
17343
17369
  }
17344
17370
  var wordStyle = Object.assign({}, customWordStyle, {
17345
17371
  display: 'inline-block',
17346
- marginRight: isLast ? 0 : '0.25em',
17372
+ marginRight: isLastInLine ? 0 : '0.25em',
17347
17373
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
17348
17374
  opacity: phase === 'visible' ? 1 : undefined
17349
17375
  });
17350
17376
  return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17351
- key: animKey + "-" + index,
17377
+ key: animKey + "-" + lineIndex + "-" + wordIndex,
17352
17378
  as: "span",
17353
17379
  animate: wordAnimation
17354
17380
  }, restWordProps, wordStyle), word);
17355
- })));
17381
+ }))))));
17356
17382
  };
17357
17383
 
17358
17384
  var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17359
17385
  function escapeRegExp(string) {
17360
17386
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17361
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
+ };
17362
17396
  var TitleView = _ref => {
17363
17397
  var {
17364
17398
  children,
@@ -17492,7 +17526,7 @@ var TitleView = _ref => {
17492
17526
  textComponent: TextComponent
17493
17527
  });
17494
17528
  }
17495
- return content;
17529
+ return renderWithLineBreaks(content);
17496
17530
  };
17497
17531
  // Case 1: Has highlight target - render with highlighted parts
17498
17532
  if (typeof text === 'string' && activeHighlightTarget) {
@@ -17515,7 +17549,7 @@ var TitleView = _ref => {
17515
17549
  key: "text-" + idx,
17516
17550
  as: "span",
17517
17551
  display: "inline"
17518
- }, part)) : (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17552
+ }, renderWithLineBreaks(part))) : (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17519
17553
  key: "highlight-" + idx,
17520
17554
  as: "span",
17521
17555
  display: "inline",
@@ -17533,7 +17567,7 @@ var TitleView = _ref => {
17533
17567
  }, !highlightSlide ? highlightProps : {}, views == null ? void 0 : views.highlight), renderHighlightedContent(text)));
17534
17568
  }
17535
17569
  // Case 3: Default - no highlighting
17536
- 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));
17537
17571
  };
17538
17572
 
17539
17573
  /**