@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.
package/dist/web.esm.js CHANGED
@@ -5,7 +5,7 @@ import 'core-js/modules/es.array.iterator.js';
5
5
  import 'core-js/modules/es.string.includes.js';
6
6
  import 'core-js/modules/web.dom-collections.iterator.js';
7
7
  import 'core-js/modules/es.regexp.to-string.js';
8
- import { View, Horizontal, Vertical, Center, useTheme, Text, Image, Element, useHover, useElementPosition, Typography, Input, Form, Button as Button$1, useInView, useResponsive } from 'app-studio';
8
+ import { View, Horizontal, Vertical, Center, useTheme, Text, Image, Element, useHover, useElementPosition, Typography, Input, Form, Button as Button$1, Animation, useInView, useResponsive } from 'app-studio';
9
9
  import 'core-js/modules/es.symbol.description.js';
10
10
  import 'core-js/modules/es.array-buffer.constructor.js';
11
11
  import 'core-js/modules/es.array-buffer.slice.js';
@@ -19302,16 +19302,6 @@ var TypewriterEffect = _ref => {
19302
19302
 
19303
19303
  var _excluded$_ = ["text", "duration", "direction", "stagger", "sequential", "textStyle", "as", "wordProps"],
19304
19304
  _excluded2$g = ["style"];
19305
- // CSS keyframes injection - done once
19306
- var KEYFRAMES_ID = 'slide-effect-keyframes';
19307
- var injectKeyframes = () => {
19308
- if (typeof document === 'undefined') return;
19309
- if (document.getElementById(KEYFRAMES_ID)) return;
19310
- var style = document.createElement('style');
19311
- style.id = KEYFRAMES_ID;
19312
- 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 ";
19313
- document.head.appendChild(style);
19314
- };
19315
19305
  var SlideEffect = _ref => {
19316
19306
  var {
19317
19307
  text,
@@ -19328,10 +19318,6 @@ var SlideEffect = _ref => {
19328
19318
  var [animKey, setAnimKey] = useState(0);
19329
19319
  var pendingTextRef = useRef(null);
19330
19320
  var timeoutRef = useRef(null);
19331
- // Inject keyframes once on mount
19332
- useEffect(() => {
19333
- injectKeyframes();
19334
- }, []);
19335
19321
  // Handle text changes
19336
19322
  useEffect(() => {
19337
19323
  if (text === displayedText && phase === 'visible') {
@@ -19397,12 +19383,10 @@ var SlideEffect = _ref => {
19397
19383
  style: customWordStyle
19398
19384
  } = _ref2,
19399
19385
  restWordProps = _objectWithoutPropertiesLoose(_ref2, _excluded2$g);
19400
- // Get animation names based on direction
19386
+ // Get animation functions based on direction
19401
19387
  var isUp = direction === 'up';
19402
- var enterAnim = isUp ? 'slideInUp' : 'slideInDown';
19403
- var exitAnim = isUp ? 'slideOutUp' : 'slideOutDown';
19404
19388
  // Calculate delay for each word
19405
- var getDelay = (index, isExit) => {
19389
+ var getDelay = index => {
19406
19390
  if (sequential) {
19407
19391
  // Sequential: one word at a time
19408
19392
  return index * (duration + stagger);
@@ -19424,9 +19408,6 @@ var SlideEffect = _ref => {
19424
19408
  flexWrap: 'nowrap',
19425
19409
  whiteSpace: 'nowrap'
19426
19410
  }), []);
19427
- // Determine current animation
19428
- var currentAnim = phase === 'exiting' ? exitAnim : enterAnim;
19429
- var isAnimating = phase === 'entering' || phase === 'exiting';
19430
19411
  return /*#__PURE__*/React.createElement(Element, Object.assign({
19431
19412
  as: "span",
19432
19413
  style: containerStyle
@@ -19435,17 +19416,63 @@ var SlideEffect = _ref => {
19435
19416
  }, words.map((word, index) => {
19436
19417
  var delay = getDelay(index);
19437
19418
  var isLast = index === words.length - 1;
19419
+ // Create animation based on phase and direction
19420
+ var wordAnimation;
19421
+ var durationStr = duration + "ms";
19422
+ var delayStr = delay + "ms";
19423
+ if (phase === 'entering') {
19424
+ // Use app-studio animations for entering
19425
+ wordAnimation = isUp ? Animation.slideInUp({
19426
+ duration: durationStr,
19427
+ delay: delayStr,
19428
+ timingFunction: 'ease-out',
19429
+ fillMode: 'both'
19430
+ }) : Animation.slideInDown({
19431
+ duration: durationStr,
19432
+ delay: delayStr,
19433
+ timingFunction: 'ease-out',
19434
+ fillMode: 'both'
19435
+ });
19436
+ } else if (phase === 'exiting') {
19437
+ // Custom animation objects for exiting (slideOut not in app-studio yet)
19438
+ wordAnimation = isUp ? {
19439
+ from: {
19440
+ transform: 'translateY(0)',
19441
+ opacity: 1
19442
+ },
19443
+ to: {
19444
+ transform: 'translateY(-100%)',
19445
+ opacity: 0
19446
+ },
19447
+ duration: durationStr,
19448
+ delay: delayStr,
19449
+ timingFunction: 'ease-in',
19450
+ fillMode: 'both'
19451
+ } : {
19452
+ from: {
19453
+ transform: 'translateY(0)',
19454
+ opacity: 1
19455
+ },
19456
+ to: {
19457
+ transform: 'translateY(100%)',
19458
+ opacity: 0
19459
+ },
19460
+ duration: durationStr,
19461
+ delay: delayStr,
19462
+ timingFunction: 'ease-in',
19463
+ fillMode: 'both'
19464
+ };
19465
+ }
19438
19466
  var wordStyle = Object.assign({}, customWordStyle, {
19439
19467
  display: 'inline-block',
19440
19468
  marginRight: isLast ? 0 : '0.25em',
19441
- willChange: isAnimating ? 'transform, opacity' : 'auto',
19442
- animation: isAnimating ? currentAnim + " " + duration + "ms ease-out " + delay + "ms both" : 'none',
19443
19469
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
19444
19470
  opacity: phase === 'visible' ? 1 : undefined
19445
19471
  });
19446
19472
  return /*#__PURE__*/React.createElement(Text, Object.assign({
19447
19473
  key: animKey + "-" + index,
19448
- as: "span"
19474
+ as: "span",
19475
+ animate: wordAnimation
19449
19476
  }, restWordProps, {
19450
19477
  style: wordStyle
19451
19478
  }), word);
@@ -19454,7 +19481,7 @@ var SlideEffect = _ref => {
19454
19481
 
19455
19482
  var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "responsive", "centered", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential"];
19456
19483
  function escapeRegExp(string) {
19457
- return string.replace(/[.*+?^${}()|[\\]\\/g, '\\$&');
19484
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
19458
19485
  }
19459
19486
  var TitleView = _ref => {
19460
19487
  var {
@@ -19550,7 +19577,13 @@ var TitleView = _ref => {
19550
19577
  // Get the text to display
19551
19578
  var text = typeof finalDisplayedText === 'string' ? finalDisplayedText : typeof children === 'string' ? children : '';
19552
19579
  if (typeof text === 'string' && activeHighlightTarget) {
19553
- var pattern = new RegExp("(" + escapeRegExp(Array.isArray(activeHighlightTarget) ? activeHighlightTarget.join('|') : activeHighlightTarget) + ")", 'gi');
19580
+ var pattern = (() => {
19581
+ if (Array.isArray(activeHighlightTarget)) {
19582
+ var escaped = activeHighlightTarget.map(t => escapeRegExp(String(t)));
19583
+ return new RegExp("(" + escaped.join('|') + ")", 'gi');
19584
+ }
19585
+ return new RegExp("(" + escapeRegExp(String(activeHighlightTarget)) + ")", 'gi');
19586
+ })();
19554
19587
  var parts = [];
19555
19588
  var lastIndex = 0;
19556
19589
  var match;