@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.
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';
@@ -17048,82 +17049,6 @@ var TitleSizes = {
17048
17049
  lg: 64,
17049
17050
  xl: 72
17050
17051
  };
17051
- /**
17052
- * Responsive typography system that maps title sizes to responsive breakpoints
17053
- * Based on the Typography system with dynamic breakpoint sizing
17054
- */
17055
- var ResponsiveTypography = {
17056
- // xl maps to H1 - Largest heading
17057
- xl: {
17058
- media: {
17059
- mobile: {
17060
- fontSize: 60
17061
- },
17062
- tablet: {
17063
- fontSize: 60
17064
- },
17065
- desktop: {
17066
- fontSize: 96
17067
- }
17068
- }
17069
- },
17070
- // lg maps to H2 - Large heading
17071
- lg: {
17072
- media: {
17073
- mobile: {
17074
- fontSize: 48
17075
- },
17076
- tablet: {
17077
- fontSize: 48
17078
- },
17079
- desktop: {
17080
- fontSize: 70
17081
- }
17082
- }
17083
- },
17084
- // md maps to H3 - Medium heading
17085
- md: {
17086
- media: {
17087
- mobile: {
17088
- fontSize: 32
17089
- },
17090
- tablet: {
17091
- fontSize: 40
17092
- },
17093
- desktop: {
17094
- fontSize: 56
17095
- }
17096
- }
17097
- },
17098
- // sm maps to T1 - Title text
17099
- sm: {
17100
- media: {
17101
- mobile: {
17102
- fontSize: 20
17103
- },
17104
- tablet: {
17105
- fontSize: 24
17106
- },
17107
- desktop: {
17108
- fontSize: 32
17109
- }
17110
- }
17111
- },
17112
- // xs maps to S1 - Subtitle text
17113
- xs: {
17114
- media: {
17115
- mobile: {
17116
- fontSize: 14
17117
- },
17118
- tablet: {
17119
- fontSize: 18
17120
- },
17121
- desktop: {
17122
- fontSize: 20
17123
- }
17124
- }
17125
- }
17126
- };
17127
17052
  /**
17128
17053
  * Default styles for different highlight types
17129
17054
  */
@@ -17229,9 +17154,17 @@ var TypewriterEffect = _ref => {
17229
17154
  }, typingSpeed);
17230
17155
  return () => clearTimeout(timeout);
17231
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
+ };
17232
17165
  return /*#__PURE__*/React.createElement(React.Fragment, null, displayedText.map((text, index) => (/*#__PURE__*/React.createElement(React.Fragment, {
17233
17166
  key: index
17234
- }, text, showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17167
+ }, renderWithLineBreaks(text), showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17235
17168
  as: "span",
17236
17169
  display: "inline-block",
17237
17170
  width: "0.1em",
@@ -17282,20 +17215,30 @@ var SlideEffect = _ref => {
17282
17215
  }
17283
17216
  }, [text, displayedText, phase]);
17284
17217
  // Calculate animation durations
17285
- var words = useMemo(() => displayedText.split(' '), [displayedText]);
17286
- 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]);
17287
17230
  var totalEnterDuration = useMemo(() => {
17288
17231
  if (sequential) {
17289
- return wordCount * (duration + stagger);
17232
+ return totalWordCount * (duration + stagger);
17290
17233
  }
17291
- return (wordCount - 1) * stagger + duration;
17292
- }, [wordCount, duration, stagger, sequential]);
17234
+ return (totalWordCount - 1) * stagger + duration;
17235
+ }, [totalWordCount, duration, stagger, sequential]);
17293
17236
  var totalExitDuration = useMemo(() => {
17294
17237
  if (sequential) {
17295
- return wordCount * (duration + stagger);
17238
+ return totalWordCount * (duration + stagger);
17296
17239
  }
17297
- return (wordCount - 1) * stagger + duration;
17298
- }, [wordCount, duration, stagger, sequential]);
17240
+ return (totalWordCount - 1) * stagger + duration;
17241
+ }, [totalWordCount, duration, stagger, sequential]);
17299
17242
  // Handle phase transitions
17300
17243
  useEffect(() => {
17301
17244
  if (timeoutRef.current) {
@@ -17344,24 +17287,32 @@ var SlideEffect = _ref => {
17344
17287
  var containerStyle = useMemo(() => Object.assign({
17345
17288
  display: 'inline-block',
17346
17289
  position: 'relative',
17347
- overflow: 'hidden',
17348
17290
  verticalAlign: 'bottom',
17349
- whiteSpace: 'nowrap'
17291
+ whiteSpace: 'nowrap',
17292
+ lineHeight: 'normal'
17350
17293
  }, textStyle), [textStyle]);
17351
- // Word row container style
17352
- var wordRowStyle = useMemo(() => ({
17294
+ var linesContainerStyle = useMemo(() => ({
17353
17295
  display: 'inline-flex',
17354
- flexWrap: 'nowrap',
17296
+ flexDirection: 'column',
17297
+ alignItems: 'center'
17298
+ }), []);
17299
+ var lineStyle = useMemo(() => ({
17300
+ display: 'block',
17355
17301
  whiteSpace: 'nowrap'
17356
17302
  }), []);
17303
+ var globalWordIndex = 0;
17357
17304
  return /*#__PURE__*/React.createElement(Element, Object.assign({
17358
17305
  as: "span",
17359
17306
  style: containerStyle
17360
17307
  }, props), /*#__PURE__*/React.createElement("span", {
17361
- style: wordRowStyle
17362
- }, words.map((word, index) => {
17363
- var delay = getDelay(index);
17364
- 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;
17365
17316
  // Create animation based on phase and direction
17366
17317
  var wordAnimation;
17367
17318
  var durationStr = duration + "ms";
@@ -17380,7 +17331,7 @@ var SlideEffect = _ref => {
17380
17331
  fillMode: 'both'
17381
17332
  });
17382
17333
  } else if (phase === 'exiting') {
17383
- // Custom animation objects for exiting (slideOut not in app-studio yet)
17334
+ // Custom animation objects for exiting
17384
17335
  wordAnimation = isUp ? {
17385
17336
  from: {
17386
17337
  transform: 'translateY(0)',
@@ -17411,22 +17362,30 @@ var SlideEffect = _ref => {
17411
17362
  }
17412
17363
  var wordStyle = Object.assign({}, customWordStyle, {
17413
17364
  display: 'inline-block',
17414
- marginRight: isLast ? 0 : '0.25em',
17365
+ marginRight: isLastInLine ? 0 : '0.25em',
17415
17366
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
17416
17367
  opacity: phase === 'visible' ? 1 : undefined
17417
17368
  });
17418
17369
  return /*#__PURE__*/React.createElement(TextComponent, Object.assign({
17419
- key: animKey + "-" + index,
17370
+ key: animKey + "-" + lineIndex + "-" + wordIndex,
17420
17371
  as: "span",
17421
17372
  animate: wordAnimation
17422
17373
  }, restWordProps, wordStyle), word);
17423
- })));
17374
+ }))))));
17424
17375
  };
17425
17376
 
17426
- var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17377
+ var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17427
17378
  function escapeRegExp(string) {
17428
17379
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17429
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
+ };
17430
17389
  var TitleView = _ref => {
17431
17390
  var {
17432
17391
  children,
@@ -17435,7 +17394,6 @@ var TitleView = _ref => {
17435
17394
  highlightColor = 'theme.primary',
17436
17395
  highlightSecondaryColor,
17437
17396
  size = 'lg',
17438
- responsive = true,
17439
17397
  views,
17440
17398
  highlightAnimate,
17441
17399
  animate,
@@ -17503,10 +17461,7 @@ var TitleView = _ref => {
17503
17461
  highlightSlideSequential
17504
17462
  }, props));
17505
17463
  var TextComponent = textComponent || Text;
17506
- // Common style calculations
17507
- var useResponsive = responsive && !props.media;
17508
17464
  var fontSize = TitleSizes[size];
17509
- var responsiveStyles = useResponsive ? ResponsiveTypography[size] : null;
17510
17465
  // Highlight style props
17511
17466
  var highlightProps = HighlightStyles[highlightStyle](resolvedHighlightColor, resolvedHighlightSecondaryColor);
17512
17467
  // Apply loop control to animations
@@ -17531,8 +17486,7 @@ var TitleView = _ref => {
17531
17486
  animate: inView ? controlledAnimate : undefined
17532
17487
  }, !textComponent && {
17533
17488
  as: 'h1',
17534
- fontSize: useResponsive ? undefined : fontSize,
17535
- media: useResponsive ? responsiveStyles == null ? void 0 : responsiveStyles.media : undefined
17489
+ fontSize
17536
17490
  });
17537
17491
  // Render highlighted text content (typewriter, slide, or plain)
17538
17492
  var renderHighlightedContent = content => {
@@ -17560,12 +17514,12 @@ var TitleView = _ref => {
17560
17514
  stagger: stateHighlightSlideStagger,
17561
17515
  sequential: stateHighlightSlideSequential,
17562
17516
  direction: "up",
17563
- fontSize: useResponsive ? undefined : fontSize,
17517
+ fontSize: fontSize,
17564
17518
  wordProps: highlightProps,
17565
17519
  textComponent: TextComponent
17566
17520
  });
17567
17521
  }
17568
- return content;
17522
+ return renderWithLineBreaks(content);
17569
17523
  };
17570
17524
  // Case 1: Has highlight target - render with highlighted parts
17571
17525
  if (typeof text === 'string' && activeHighlightTarget) {
@@ -17583,12 +17537,12 @@ var TitleView = _ref => {
17583
17537
  }
17584
17538
  if (lastIndex < text.length) parts.push(text.substring(lastIndex));
17585
17539
  return /*#__PURE__*/React.createElement(Element, Object.assign({
17586
- fontSize: useResponsive ? undefined : fontSize
17540
+ fontSize: fontSize
17587
17541
  }, containerProps, views == null ? void 0 : views.container, props), parts.map((part, idx) => typeof part === 'string' ? (/*#__PURE__*/React.createElement(TextComponent, {
17588
17542
  key: "text-" + idx,
17589
17543
  as: "span",
17590
17544
  display: "inline"
17591
- }, part)) : (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17545
+ }, renderWithLineBreaks(part))) : (/*#__PURE__*/React.createElement(TextComponent, Object.assign({
17592
17546
  key: "highlight-" + idx,
17593
17547
  as: "span",
17594
17548
  display: "inline",
@@ -17606,7 +17560,7 @@ var TitleView = _ref => {
17606
17560
  }, !highlightSlide ? highlightProps : {}, views == null ? void 0 : views.highlight), renderHighlightedContent(text)));
17607
17561
  }
17608
17562
  // Case 3: Default - no highlighting
17609
- 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));
17610
17564
  };
17611
17565
 
17612
17566
  /**