@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.
@@ -1,6 +1,6 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.object.assign.js'), require('react'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('core-js/modules/es.regexp.to-string.js'), require('app-studio'), require('core-js/modules/es.symbol.description.js'), require('lucide-react/dynamic'), require('core-js/modules/es.array-buffer.constructor.js'), require('core-js/modules/es.array-buffer.slice.js'), require('core-js/modules/es.typed-array.uint8-array.js'), require('core-js/modules/es.typed-array.fill.js'), require('core-js/modules/es.typed-array.set.js'), require('core-js/modules/es.typed-array.sort.js'), require('core-js/modules/es.typed-array.to-locale-string.js'), require('core-js/modules/es.string.starts-with.js'), require('core-js/modules/web.url.js'), require('core-js/modules/web.url.to-json.js'), require('core-js/modules/web.url-search-params.js'), require('zustand'), require('core-js/modules/es.parse-int.js'), require('react-router-dom'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.string.ends-with.js'), require('contrast'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.number.to-fixed.js'), require('date-fns/format'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/es.regexp.constructor.js'), require('core-js/modules/es.regexp.exec.js'), require('formik'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.promise.finally.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.search.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.unscopables.flat-map.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.object.assign.js', 'react', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/web.dom-collections.iterator.js', 'core-js/modules/es.regexp.to-string.js', 'app-studio', 'core-js/modules/es.symbol.description.js', 'lucide-react/dynamic', 'core-js/modules/es.array-buffer.constructor.js', 'core-js/modules/es.array-buffer.slice.js', 'core-js/modules/es.typed-array.uint8-array.js', 'core-js/modules/es.typed-array.fill.js', 'core-js/modules/es.typed-array.set.js', 'core-js/modules/es.typed-array.sort.js', 'core-js/modules/es.typed-array.to-locale-string.js', 'core-js/modules/es.string.starts-with.js', 'core-js/modules/web.url.js', 'core-js/modules/web.url.to-json.js', 'core-js/modules/web.url-search-params.js', 'zustand', 'core-js/modules/es.parse-int.js', 'react-router-dom', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.string.ends-with.js', 'contrast', 'core-js/modules/es.promise.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.number.to-fixed.js', 'date-fns/format', 'core-js/modules/es.string.trim.js', 'core-js/modules/es.regexp.constructor.js', 'core-js/modules/es.regexp.exec.js', 'formik', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.promise.finally.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.search.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.unscopables.flat-map.js'], factory) :
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.object.assign.js'), require('react'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('core-js/modules/es.regexp.to-string.js'), require('app-studio'), require('core-js/modules/es.symbol.description.js'), require('lucide-react/dynamic'), require('core-js/modules/es.array-buffer.constructor.js'), require('core-js/modules/es.array-buffer.slice.js'), require('core-js/modules/es.typed-array.uint8-array.js'), require('core-js/modules/es.typed-array.fill.js'), require('core-js/modules/es.typed-array.set.js'), require('core-js/modules/es.typed-array.sort.js'), require('core-js/modules/es.typed-array.to-locale-string.js'), require('core-js/modules/es.string.starts-with.js'), require('core-js/modules/web.url.js'), require('core-js/modules/web.url.to-json.js'), require('core-js/modules/web.url-search-params.js'), require('zustand'), require('core-js/modules/es.parse-int.js'), require('react-router-dom'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.string.ends-with.js'), require('contrast'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.number.to-fixed.js'), require('date-fns/format'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/es.regexp.constructor.js'), require('core-js/modules/es.regexp.exec.js'), require('formik'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.split.js'), require('core-js/modules/es.promise.finally.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.search.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.unscopables.flat-map.js')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.object.assign.js', 'react', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/web.dom-collections.iterator.js', 'core-js/modules/es.regexp.to-string.js', 'app-studio', 'core-js/modules/es.symbol.description.js', 'lucide-react/dynamic', 'core-js/modules/es.array-buffer.constructor.js', 'core-js/modules/es.array-buffer.slice.js', 'core-js/modules/es.typed-array.uint8-array.js', 'core-js/modules/es.typed-array.fill.js', 'core-js/modules/es.typed-array.set.js', 'core-js/modules/es.typed-array.sort.js', 'core-js/modules/es.typed-array.to-locale-string.js', 'core-js/modules/es.string.starts-with.js', 'core-js/modules/web.url.js', 'core-js/modules/web.url.to-json.js', 'core-js/modules/web.url-search-params.js', 'zustand', 'core-js/modules/es.parse-int.js', 'react-router-dom', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.string.ends-with.js', 'contrast', 'core-js/modules/es.promise.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.number.to-fixed.js', 'date-fns/format', 'core-js/modules/es.string.trim.js', 'core-js/modules/es.regexp.constructor.js', 'core-js/modules/es.regexp.exec.js', 'formik', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.split.js', 'core-js/modules/es.promise.finally.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.search.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.unscopables.flat-map.js'], factory) :
4
4
  (global = global || self, factory(global['@app-studio/web'] = {}, null, global.React, null, null, null, null, null, global.appStudio, null, global.dynamic, null, null, null, null, null, null, null, null, null, null, null, global.zustand, null, global.reactRouterDom, null, null, global.contrast, null, null, null, global.format, null, null, null, global.formik));
5
5
  }(this, (function (exports, es_object_assign_js, React, es_array_includes_js, es_array_iterator_js, es_string_includes_js, web_domCollections_iterator_js, es_regexp_toString_js, appStudio, es_symbol_description_js, dynamic, es_arrayBuffer_constructor_js, es_arrayBuffer_slice_js, es_typedArray_uint8Array_js, es_typedArray_fill_js, es_typedArray_set_js, es_typedArray_sort_js, es_typedArray_toLocaleString_js, es_string_startsWith_js, web_url_js, web_url_toJson_js, web_urlSearchParams_js, zustand, es_parseInt_js, reactRouterDom, es_parseFloat_js, es_string_endsWith_js, contrast, es_promise_js, es_array_reduce_js, es_number_toFixed_js, format, es_string_trim_js, es_regexp_constructor_js, es_regexp_exec_js, formik) { 'use strict';
6
6
 
@@ -17121,9 +17121,17 @@
17121
17121
  }, typingSpeed);
17122
17122
  return () => clearTimeout(timeout);
17123
17123
  }, [textArray, currentTextIndex, charIndex, isComplete, onComplete, pauseTime, typingSpeed]);
17124
+ var renderWithLineBreaks = text => {
17125
+ if (!text || typeof text !== 'string') return text;
17126
+ var parts = text.split('|');
17127
+ if (parts.length === 1) return text;
17128
+ return parts.map((part, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17129
+ key: index
17130
+ }, part, index < parts.length - 1 && /*#__PURE__*/React__default.createElement("br", null))));
17131
+ };
17124
17132
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, displayedText.map((text, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17125
17133
  key: index
17126
- }, text, showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17134
+ }, renderWithLineBreaks(text), showCursor && index === currentTextIndex && !isComplete && (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17127
17135
  as: "span",
17128
17136
  display: "inline-block",
17129
17137
  width: "0.1em",
@@ -17174,20 +17182,30 @@
17174
17182
  }
17175
17183
  }, [text, displayedText, phase]);
17176
17184
  // Calculate animation durations
17177
- var words = React.useMemo(() => displayedText.split(' '), [displayedText]);
17178
- var wordCount = words.length;
17185
+ var {
17186
+ lines,
17187
+ totalWordCount
17188
+ } = React.useMemo(() => {
17189
+ var rawLines = displayedText.split('|');
17190
+ var processedLines = rawLines.map(line => line.trim().split(/\s+/).filter(w => w.length > 0));
17191
+ var count = processedLines.reduce((acc, line) => acc + line.length, 0);
17192
+ return {
17193
+ lines: processedLines,
17194
+ totalWordCount: count
17195
+ };
17196
+ }, [displayedText]);
17179
17197
  var totalEnterDuration = React.useMemo(() => {
17180
17198
  if (sequential) {
17181
- return wordCount * (duration + stagger);
17199
+ return totalWordCount * (duration + stagger);
17182
17200
  }
17183
- return (wordCount - 1) * stagger + duration;
17184
- }, [wordCount, duration, stagger, sequential]);
17201
+ return (totalWordCount - 1) * stagger + duration;
17202
+ }, [totalWordCount, duration, stagger, sequential]);
17185
17203
  var totalExitDuration = React.useMemo(() => {
17186
17204
  if (sequential) {
17187
- return wordCount * (duration + stagger);
17205
+ return totalWordCount * (duration + stagger);
17188
17206
  }
17189
- return (wordCount - 1) * stagger + duration;
17190
- }, [wordCount, duration, stagger, sequential]);
17207
+ return (totalWordCount - 1) * stagger + duration;
17208
+ }, [totalWordCount, duration, stagger, sequential]);
17191
17209
  // Handle phase transitions
17192
17210
  React.useEffect(() => {
17193
17211
  if (timeoutRef.current) {
@@ -17236,25 +17254,32 @@
17236
17254
  var containerStyle = React.useMemo(() => Object.assign({
17237
17255
  display: 'inline-block',
17238
17256
  position: 'relative',
17239
- overflow: 'hidden',
17240
17257
  verticalAlign: 'bottom',
17241
17258
  whiteSpace: 'nowrap',
17242
17259
  lineHeight: 'normal'
17243
17260
  }, textStyle), [textStyle]);
17244
- // Word row container style
17245
- var wordRowStyle = React.useMemo(() => ({
17261
+ var linesContainerStyle = React.useMemo(() => ({
17246
17262
  display: 'inline-flex',
17247
- flexWrap: 'nowrap',
17263
+ flexDirection: 'column',
17264
+ alignItems: 'center'
17265
+ }), []);
17266
+ var lineStyle = React.useMemo(() => ({
17267
+ display: 'block',
17248
17268
  whiteSpace: 'nowrap'
17249
17269
  }), []);
17270
+ var globalWordIndex = 0;
17250
17271
  return /*#__PURE__*/React__default.createElement(appStudio.Element, Object.assign({
17251
17272
  as: "span",
17252
17273
  style: containerStyle
17253
17274
  }, props), /*#__PURE__*/React__default.createElement("span", {
17254
- style: wordRowStyle
17255
- }, words.map((word, index) => {
17256
- var delay = getDelay(index);
17257
- var isLast = index === words.length - 1;
17275
+ style: linesContainerStyle
17276
+ }, lines.map((lineWords, lineIndex) => (/*#__PURE__*/React__default.createElement("span", {
17277
+ key: "line-" + lineIndex,
17278
+ style: lineStyle
17279
+ }, lineWords.map((word, wordIndex) => {
17280
+ var currentGlobalIndex = globalWordIndex++;
17281
+ var delay = getDelay(currentGlobalIndex);
17282
+ var isLastInLine = wordIndex === lineWords.length - 1;
17258
17283
  // Create animation based on phase and direction
17259
17284
  var wordAnimation;
17260
17285
  var durationStr = duration + "ms";
@@ -17273,7 +17298,7 @@
17273
17298
  fillMode: 'both'
17274
17299
  });
17275
17300
  } else if (phase === 'exiting') {
17276
- // Custom animation objects for exiting (slideOut not in app-studio yet)
17301
+ // Custom animation objects for exiting
17277
17302
  wordAnimation = isUp ? {
17278
17303
  from: {
17279
17304
  transform: 'translateY(0)',
@@ -17304,22 +17329,30 @@
17304
17329
  }
17305
17330
  var wordStyle = Object.assign({}, customWordStyle, {
17306
17331
  display: 'inline-block',
17307
- marginRight: isLast ? 0 : '0.25em',
17332
+ marginRight: isLastInLine ? 0 : '0.25em',
17308
17333
  transform: phase === 'visible' ? 'translateY(0)' : undefined,
17309
17334
  opacity: phase === 'visible' ? 1 : undefined
17310
17335
  });
17311
17336
  return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17312
- key: animKey + "-" + index,
17337
+ key: animKey + "-" + lineIndex + "-" + wordIndex,
17313
17338
  as: "span",
17314
17339
  animate: wordAnimation
17315
17340
  }, restWordProps, wordStyle), word);
17316
- })));
17341
+ }))))));
17317
17342
  };
17318
17343
 
17319
17344
  var _excluded$$ = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "views", "highlightAnimate", "animate", "animationLoop", "highlightAnimationLoop", "highlightTypewriter", "highlightTypewriterDuration", "highlightSlide", "highlightSlideDuration", "highlightSlideStagger", "highlightSlideSequential", "themeMode", "textComponent"];
17320
17345
  function escapeRegExp(string) {
17321
17346
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17322
17347
  }
17348
+ var renderWithLineBreaks = text => {
17349
+ if (!text || typeof text !== 'string') return text;
17350
+ var parts = text.split('|');
17351
+ if (parts.length === 1) return text;
17352
+ return parts.map((part, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
17353
+ key: index
17354
+ }, part, index < parts.length - 1 && /*#__PURE__*/React__default.createElement("br", null))));
17355
+ };
17323
17356
  var TitleView = _ref => {
17324
17357
  var {
17325
17358
  children,
@@ -17453,7 +17486,7 @@
17453
17486
  textComponent: TextComponent
17454
17487
  });
17455
17488
  }
17456
- return content;
17489
+ return renderWithLineBreaks(content);
17457
17490
  };
17458
17491
  // Case 1: Has highlight target - render with highlighted parts
17459
17492
  if (typeof text === 'string' && activeHighlightTarget) {
@@ -17476,7 +17509,7 @@
17476
17509
  key: "text-" + idx,
17477
17510
  as: "span",
17478
17511
  display: "inline"
17479
- }, part)) : (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17512
+ }, renderWithLineBreaks(part))) : (/*#__PURE__*/React__default.createElement(TextComponent, Object.assign({
17480
17513
  key: "highlight-" + idx,
17481
17514
  as: "span",
17482
17515
  display: "inline",
@@ -17494,7 +17527,7 @@
17494
17527
  }, !highlightSlide ? highlightProps : {}, views == null ? void 0 : views.highlight), renderHighlightedContent(text)));
17495
17528
  }
17496
17529
  // Case 3: Default - no highlighting
17497
- return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({}, containerProps, props, views == null ? void 0 : views.container), text);
17530
+ return /*#__PURE__*/React__default.createElement(TextComponent, Object.assign({}, containerProps, props, views == null ? void 0 : views.container), renderWithLineBreaks(text));
17498
17531
  };
17499
17532
 
17500
17533
  /**