@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.
package/dist/web.esm.js CHANGED
@@ -34,6 +34,7 @@ import 'core-js/modules/es.regexp.constructor.js';
34
34
  import 'core-js/modules/es.regexp.exec.js';
35
35
  import { useFormikContext, getIn } from 'formik';
36
36
  import 'core-js/modules/es.string.replace.js';
37
+ import 'core-js/modules/es.string.split.js';
37
38
  import 'core-js/modules/es.promise.finally.js';
38
39
  import 'core-js/modules/es.string.match.js';
39
40
  import 'core-js/modules/es.string.search.js';
@@ -17153,9 +17154,17 @@ var TypewriterEffect = _ref => {
17153
17154
  }, typingSpeed);
17154
17155
  return () => clearTimeout(timeout);
17155
17156
  }, [textArray, currentTextIndex, charIndex, isComplete, onComplete, pauseTime, typingSpeed]);
17157
+ var renderWithLineBreaks = text => {
17158
+ if (!text || typeof text !== 'string') return text;
17159
+ var parts = text.split('|');
17160
+ if (parts.length === 1) return text;
17161
+ return parts.map((part, index) => (/*#__PURE__*/React.createElement(React.Fragment, {
17162
+ key: index
17163
+ }, part, index < parts.length - 1 && /*#__PURE__*/React.createElement("br", null))));
17164
+ };
17156
17165
  return /*#__PURE__*/React.createElement(React.Fragment, null, displayedText.map((text, index) => (/*#__PURE__*/React.createElement(React.Fragment, {
17157
17166
  key: index
17158
- }, text, showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17167
+ }, renderWithLineBreaks(text), showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17159
17168
  as: "span",
17160
17169
  display: "inline-block",
17161
17170
  width: "0.1em",
@@ -17206,20 +17215,30 @@ var SlideEffect = _ref => {
17206
17215
  }
17207
17216
  }, [text, displayedText, phase]);
17208
17217
  // Calculate animation durations
17209
- var words = useMemo(() => displayedText.split(' '), [displayedText]);
17210
- var wordCount = words.length;
17218
+ var {
17219
+ lines,
17220
+ totalWordCount
17221
+ } = useMemo(() => {
17222
+ var rawLines = displayedText.split('|');
17223
+ var processedLines = rawLines.map(line => line.trim().split(/\s+/).filter(w => w.length > 0));
17224
+ var count = processedLines.reduce((acc, line) => acc + line.length, 0);
17225
+ return {
17226
+ lines: processedLines,
17227
+ totalWordCount: count
17228
+ };
17229
+ }, [displayedText]);
17211
17230
  var totalEnterDuration = useMemo(() => {
17212
17231
  if (sequential) {
17213
- return wordCount * (duration + stagger);
17232
+ return totalWordCount * (duration + stagger);
17214
17233
  }
17215
- return (wordCount - 1) * stagger + duration;
17216
- }, [wordCount, duration, stagger, sequential]);
17234
+ return (totalWordCount - 1) * stagger + duration;
17235
+ }, [totalWordCount, duration, stagger, sequential]);
17217
17236
  var totalExitDuration = useMemo(() => {
17218
17237
  if (sequential) {
17219
- return wordCount * (duration + stagger);
17238
+ return totalWordCount * (duration + stagger);
17220
17239
  }
17221
- return (wordCount - 1) * stagger + duration;
17222
- }, [wordCount, duration, stagger, sequential]);
17240
+ return (totalWordCount - 1) * stagger + duration;
17241
+ }, [totalWordCount, duration, stagger, sequential]);
17223
17242
  // Handle phase transitions
17224
17243
  useEffect(() => {
17225
17244
  if (timeoutRef.current) {
@@ -17268,25 +17287,32 @@ var SlideEffect = _ref => {
17268
17287
  var containerStyle = useMemo(() => Object.assign({
17269
17288
  display: 'inline-block',
17270
17289
  position: 'relative',
17271
- overflow: 'hidden',
17272
17290
  verticalAlign: 'bottom',
17273
17291
  whiteSpace: 'nowrap',
17274
17292
  lineHeight: 'normal'
17275
17293
  }, textStyle), [textStyle]);
17276
- // Word row container style
17277
- var wordRowStyle = useMemo(() => ({
17294
+ var linesContainerStyle = useMemo(() => ({
17278
17295
  display: 'inline-flex',
17279
- flexWrap: 'nowrap',
17296
+ flexDirection: 'column',
17297
+ alignItems: 'center'
17298
+ }), []);
17299
+ var lineStyle = useMemo(() => ({
17300
+ display: 'block',
17280
17301
  whiteSpace: 'nowrap'
17281
17302
  }), []);
17303
+ var globalWordIndex = 0;
17282
17304
  return /*#__PURE__*/React.createElement(Element, Object.assign({
17283
17305
  as: "span",
17284
17306
  style: containerStyle
17285
17307
  }, props), /*#__PURE__*/React.createElement("span", {
17286
- style: wordRowStyle
17287
- }, words.map((word, index) => {
17288
- var delay = getDelay(index);
17289
- var isLast = index === words.length - 1;
17308
+ style: linesContainerStyle
17309
+ }, lines.map((lineWords, lineIndex) => (/*#__PURE__*/React.createElement("span", {
17310
+ key: "line-" + lineIndex,
17311
+ style: lineStyle
17312
+ }, lineWords.map((word, wordIndex) => {
17313
+ var currentGlobalIndex = globalWordIndex++;
17314
+ var delay = getDelay(currentGlobalIndex);
17315
+ var isLastInLine = wordIndex === lineWords.length - 1;
17290
17316
  // Create animation based on phase and direction
17291
17317
  var wordAnimation;
17292
17318
  var durationStr = duration + "ms";
@@ -17305,7 +17331,7 @@ var SlideEffect = _ref => {
17305
17331
  fillMode: 'both'
17306
17332
  });
17307
17333
  } else if (phase === 'exiting') {
17308
- // Custom animation objects for exiting (slideOut not in app-studio yet)
17334
+ // Custom animation objects for exiting
17309
17335
  wordAnimation = isUp ? {
17310
17336
  from: {
17311
17337
  transform: 'translateY(0)',
@@ -17336,22 +17362,30 @@ var SlideEffect = _ref => {
17336
17362
  }
17337
17363
  var wordStyle = Object.assign({}, customWordStyle, {
17338
17364
  display: 'inline-block',
17339
- marginRight: isLast ? 0 : '0.25em',
17365
+ marginRight: isLastInLine ? 0 : '0.25em',
17340
17366
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
17341
17367
  opacity: phase === 'visible' ? 1 : undefined
17342
17368
  });
17343
17369
  return /*#__PURE__*/React.createElement(TextComponent, Object.assign({
17344
- key: animKey + "-" + index,
17370
+ key: animKey + "-" + lineIndex + "-" + wordIndex,
17345
17371
  as: "span",
17346
17372
  animate: wordAnimation
17347
17373
  }, restWordProps, wordStyle), word);
17348
- })));
17374
+ }))))));
17349
17375
  };
17350
17376
 
17351
17377
  var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17352
17378
  function escapeRegExp(string) {
17353
17379
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17354
17380
  }
17381
+ var renderWithLineBreaks = text => {
17382
+ if (!text || typeof text !== 'string') return text;
17383
+ var parts = text.split('|');
17384
+ if (parts.length === 1) return text;
17385
+ return parts.map((part, index) => (/*#__PURE__*/React.createElement(React.Fragment, {
17386
+ key: index
17387
+ }, part, index < parts.length - 1 && /*#__PURE__*/React.createElement("br", null))));
17388
+ };
17355
17389
  var TitleView = _ref => {
17356
17390
  var {
17357
17391
  children,
@@ -17485,7 +17519,7 @@ var TitleView = _ref => {
17485
17519
  textComponent: TextComponent
17486
17520
  });
17487
17521
  }
17488
- return content;
17522
+ return renderWithLineBreaks(content);
17489
17523
  };
17490
17524
  // Case 1: Has highlight target - render with highlighted parts
17491
17525
  if (typeof text === 'string' && activeHighlightTarget) {
@@ -17508,7 +17542,7 @@ var TitleView = _ref => {
17508
17542
  key: "text-" + idx,
17509
17543
  as: "span",
17510
17544
  display: "inline"
17511
- }, part)) : (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17545
+ }, renderWithLineBreaks(part))) : (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17512
17546
  key: "highlight-" + idx,
17513
17547
  as: "span",
17514
17548
  display: "inline",
@@ -17526,7 +17560,7 @@ var TitleView = _ref => {
17526
17560
  }, !highlightSlide ? highlightProps : {}, views == null ? void 0 : views.highlight), renderHighlightedContent(text)));
17527
17561
  }
17528
17562
  // Case 3: Default - no highlighting
17529
- return /*#__PURE__*/React.createElement(TextComponent, Object.assign({}, containerProps, props, views == null ? void 0 : views.container), text);
17563
+ return /*#__PURE__*/React.createElement(TextComponent, Object.assign({}, containerProps, props, views == null ? void 0 : views.container), renderWithLineBreaks(text));
17530
17564
  };
17531
17565
 
17532
17566
  /**