@app-studio/web 0.9.51 → 0.9.54

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.
@@ -19270,16 +19270,6 @@
19270
19270
 
19271
19271
  var _excluded$_ = ["text", "duration", "direction", "stagger", "sequential", "textStyle", "as", "wordProps"],
19272
19272
  _excluded2$g = ["style"];
19273
- // CSS keyframes injection - done once
19274
- var KEYFRAMES_ID = 'slide-effect-keyframes';
19275
- var injectKeyframes = () => {
19276
- if (typeof document === 'undefined') return;
19277
- if (document.getElementById(KEYFRAMES_ID)) return;
19278
- var style = document.createElement('style');
19279
- style.id = KEYFRAMES_ID;
19280
- style.textContent = "\n @keyframes slideInUp {\n from { transform: translateY(100%); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n }\n @keyframes slideOutUp {\n from { transform: translateY(0); opacity: 1; }\n to { transform: translateY(-100%); opacity: 0; }\n }\n @keyframes slideInDown {\n from { transform: translateY(-100%); opacity: 0; }\n to { transform: translateY(0); opacity: 1; }\n }\n @keyframes slideOutDown {\n from { transform: translateY(0); opacity: 1; }\n to { transform: translateY(100%); opacity: 0; }\n }\n ";
19281
- document.head.appendChild(style);
19282
- };
19283
19273
  var SlideEffect = _ref => {
19284
19274
  var {
19285
19275
  text,
@@ -19296,10 +19286,6 @@
19296
19286
  var [animKey, setAnimKey] = React.useState(0);
19297
19287
  var pendingTextRef = React.useRef(null);
19298
19288
  var timeoutRef = React.useRef(null);
19299
- // Inject keyframes once on mount
19300
- React.useEffect(() => {
19301
- injectKeyframes();
19302
- }, []);
19303
19289
  // Handle text changes
19304
19290
  React.useEffect(() => {
19305
19291
  if (text === displayedText && phase === 'visible') {
@@ -19365,12 +19351,10 @@
19365
19351
  style: customWordStyle
19366
19352
  } = _ref2,
19367
19353
  restWordProps = _objectWithoutPropertiesLoose(_ref2, _excluded2$g);
19368
- // Get animation names based on direction
19354
+ // Get animation functions based on direction
19369
19355
  var isUp = direction === 'up';
19370
- var enterAnim = isUp ? 'slideInUp' : 'slideInDown';
19371
- var exitAnim = isUp ? 'slideOutUp' : 'slideOutDown';
19372
19356
  // Calculate delay for each word
19373
- var getDelay = (index, isExit) => {
19357
+ var getDelay = index => {
19374
19358
  if (sequential) {
19375
19359
  // Sequential: one word at a time
19376
19360
  return index * (duration + stagger);
@@ -19392,9 +19376,6 @@
19392
19376
  flexWrap: 'nowrap',
19393
19377
  whiteSpace: 'nowrap'
19394
19378
  }), []);
19395
- // Determine current animation
19396
- var currentAnim = phase === 'exiting' ? exitAnim : enterAnim;
19397
- var isAnimating = phase === 'entering' || phase === 'exiting';
19398
19379
  return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
19399
19380
  as: "span",
19400
19381
  style: containerStyle
@@ -19403,17 +19384,63 @@
19403
19384
  }, words.map((word, index) => {
19404
19385
  var delay = getDelay(index);
19405
19386
  var isLast = index === words.length - 1;
19387
+ // Create animation based on phase and direction
19388
+ var wordAnimation;
19389
+ var durationStr = duration + "ms";
19390
+ var delayStr = delay + "ms";
19391
+ if (phase === 'entering') {
19392
+ // Use app-studio animations for entering
19393
+ wordAnimation = isUp ? appStudio.Animation.slideInUp({
19394
+ duration: durationStr,
19395
+ delay: delayStr,
19396
+ timingFunction: 'ease-out',
19397
+ fillMode: 'both'
19398
+ }) : appStudio.Animation.slideInDown({
19399
+ duration: durationStr,
19400
+ delay: delayStr,
19401
+ timingFunction: 'ease-out',
19402
+ fillMode: 'both'
19403
+ });
19404
+ } else if (phase === 'exiting') {
19405
+ // Custom animation objects for exiting (slideOut not in app-studio yet)
19406
+ wordAnimation = isUp ? {
19407
+ from: {
19408
+ transform: 'translateY(0)',
19409
+ opacity: 1
19410
+ },
19411
+ to: {
19412
+ transform: 'translateY(-100%)',
19413
+ opacity: 0
19414
+ },
19415
+ duration: durationStr,
19416
+ delay: delayStr,
19417
+ timingFunction: 'ease-in',
19418
+ fillMode: 'both'
19419
+ } : {
19420
+ from: {
19421
+ transform: 'translateY(0)',
19422
+ opacity: 1
19423
+ },
19424
+ to: {
19425
+ transform: 'translateY(100%)',
19426
+ opacity: 0
19427
+ },
19428
+ duration: durationStr,
19429
+ delay: delayStr,
19430
+ timingFunction: 'ease-in',
19431
+ fillMode: 'both'
19432
+ };
19433
+ }
19406
19434
  var wordStyle = Object.assign({}, customWordStyle, {
19407
19435
  display: 'inline-block',
19408
19436
  marginRight: isLast ? 0 : '0.25em',
19409
- willChange: isAnimating ? 'transform, opacity' : 'auto',
19410
- animation: isAnimating ? currentAnim + " " + duration + "ms ease-out " + delay + "ms both" : 'none',
19411
19437
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
19412
19438
  opacity: phase === 'visible' ? 1 : undefined
19413
19439
  });
19414
19440
  return /*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
19415
19441
  key: animKey + "-" + index,
19416
- as: "span"
19442
+ as: "span",
19443
+ animate: wordAnimation
19417
19444
  }, restWordProps, {
19418
19445
  style: wordStyle
19419
19446
  }), word);
@@ -19422,7 +19449,7 @@
19422
19449
 
19423
19450
  var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "centered", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential"];
19424
19451
  function escapeRegExp(string) {
19425
- return string.replace(/[.*+?^${}()|[\\]\\/g, '\\$&');
19452
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
19426
19453
  }
19427
19454
  var TitleView = _ref => {
19428
19455
  var {
@@ -19518,7 +19545,13 @@
19518
19545
  // Get the text to display
19519
19546
  var text = typeof finalDisplayedText === 'string' ? finalDisplayedText : typeof children === 'string' ? children : '';
19520
19547
  if (typeof text === 'string' && activeHighlightTarget) {
19521
- var pattern = new RegExp("(" + escapeRegExp(Array.isArray(activeHighlightTarget) ? activeHighlightTarget.join('|') : activeHighlightTarget) + ")", 'gi');
19548
+ var pattern = (() => {
19549
+ if (Array.isArray(activeHighlightTarget)) {
19550
+ var escaped = activeHighlightTarget.map(t => escapeRegExp(String(t)));
19551
+ return new RegExp("(" + escaped.join('|') + ")", 'gi');
19552
+ }
19553
+ return new RegExp("(" + escapeRegExp(String(activeHighlightTarget)) + ")", 'gi');
19554
+ })();
19522
19555
  var parts = [];
19523
19556
  var lastIndex = 0;
19524
19557
  var match;