@app-studio/web 0.9.10 → 0.9.11

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.
@@ -26547,14 +26547,305 @@
26547
26547
  backgroundPosition: '50% 50%, 50% 50%'
26548
26548
  }
26549
26549
  };
26550
+ /**
26551
+ * Background Image styles
26552
+ */
26553
+ var BackgroundImageStyles = {
26554
+ container: {
26555
+ position: 'relative',
26556
+ display: 'flex',
26557
+ flexDirection: 'column',
26558
+ alignItems: 'center',
26559
+ justifyContent: 'center',
26560
+ overflow: 'hidden'
26561
+ },
26562
+ image: {
26563
+ position: 'absolute',
26564
+ top: 0,
26565
+ left: 0,
26566
+ width: '100%',
26567
+ height: '100%',
26568
+ backgroundSize: 'cover',
26569
+ backgroundPosition: 'center',
26570
+ backgroundRepeat: 'no-repeat',
26571
+ backgroundAttachment: 'scroll'
26572
+ },
26573
+ overlay: {
26574
+ position: 'absolute',
26575
+ top: 0,
26576
+ left: 0,
26577
+ width: '100%',
26578
+ height: '100%',
26579
+ pointerEvents: 'none'
26580
+ },
26581
+ content: {
26582
+ position: 'relative',
26583
+ zIndex: 2
26584
+ }
26585
+ };
26550
26586
 
26551
- var _excluded$1e = ["children", "showRadialGradient", "views", "themeMode"],
26587
+ /**
26588
+ * Gradient Styles
26589
+ *
26590
+ * Defines the styles for the Gradient component following the design guidelines:
26591
+ * - Typography: Inter/Geist font, specific sizes/weights
26592
+ * - Spacing: 4px grid system
26593
+ * - Colors: Neutral palette with semantic colors
26594
+ * - Rounded corners: Consistent border radius
26595
+ * - Transitions: Subtle animations
26596
+ */
26597
+ /**
26598
+ * Maps direction strings to CSS gradient directions
26599
+ */
26600
+ var DirectionMap = {
26601
+ 'to-right': 'to right',
26602
+ 'to-left': 'to left',
26603
+ 'to-bottom': 'to bottom',
26604
+ 'to-top': 'to top',
26605
+ 'to-top-right': 'to top right',
26606
+ 'to-top-left': 'to top left',
26607
+ 'to-bottom-right': 'to bottom right',
26608
+ 'to-bottom-left': 'to bottom left'
26609
+ };
26610
+ /**
26611
+ * Maps position strings to CSS position values
26612
+ */
26613
+ var PositionMap = {
26614
+ center: 'center',
26615
+ top: 'top',
26616
+ right: 'right',
26617
+ bottom: 'bottom',
26618
+ left: 'left',
26619
+ 'top-right': 'top right',
26620
+ 'top-left': 'top left',
26621
+ 'bottom-right': 'bottom right',
26622
+ 'bottom-left': 'bottom left'
26623
+ };
26624
+ /**
26625
+ * Default color stops for different gradient types
26626
+ */
26627
+ var DefaultColorStops = {
26628
+ linear: [{
26629
+ color: 'color.blue.500',
26630
+ position: '0%'
26631
+ }, {
26632
+ color: 'color.purple.500',
26633
+ position: '100%'
26634
+ }],
26635
+ radial: [{
26636
+ color: 'color.blue.500',
26637
+ position: '0%'
26638
+ }, {
26639
+ color: 'color.purple.500',
26640
+ position: '100%'
26641
+ }],
26642
+ conic: [{
26643
+ color: 'color.red.500',
26644
+ position: '0deg'
26645
+ }, {
26646
+ color: 'color.yellow.500',
26647
+ position: '90deg'
26648
+ }, {
26649
+ color: 'color.green.500',
26650
+ position: '180deg'
26651
+ }, {
26652
+ color: 'color.blue.500',
26653
+ position: '270deg'
26654
+ }, {
26655
+ color: 'color.red.500',
26656
+ position: '360deg'
26657
+ }]
26658
+ };
26659
+ /**
26660
+ * Generates a CSS gradient string based on the provided parameters
26661
+ */
26662
+ var generateGradientString = (type, colors, direction, shape, position) => {
26663
+ // Format color stops
26664
+ var colorStopsString = colors.map(stop => stop.color + " " + (stop.position || '')).join(', ');
26665
+ // Generate the appropriate gradient string based on type
26666
+ switch (type) {
26667
+ case 'linear':
26668
+ var dir = direction && DirectionMap[direction] ? DirectionMap[direction] : direction || 'to right';
26669
+ return "linear-gradient(" + dir + ", " + colorStopsString + ")";
26670
+ case 'radial':
26671
+ var pos = position && PositionMap[position] ? PositionMap[position] : position || 'center';
26672
+ var shapeValue = shape || 'circle';
26673
+ return "radial-gradient(" + shapeValue + " at " + pos + ", " + colorStopsString + ")";
26674
+ case 'conic':
26675
+ var conicPos = position && PositionMap[position] ? PositionMap[position] : position || 'center';
26676
+ return "conic-gradient(from 0deg at " + conicPos + ", " + colorStopsString + ")";
26677
+ default:
26678
+ return "linear-gradient(to right, " + colorStopsString + ")";
26679
+ }
26680
+ };
26681
+ /**
26682
+ * Animation styles for animated gradients using app-studio's animation system
26683
+ */
26684
+ var GradientAnimations = {
26685
+ linear: {
26686
+ backgroundSize: '200% 200%',
26687
+ transition: 'background-position 3s ease-in-out',
26688
+ animate: {
26689
+ from: {
26690
+ backgroundPosition: '0% 50%'
26691
+ },
26692
+ '50%': {
26693
+ backgroundPosition: '100% 50%'
26694
+ },
26695
+ to: {
26696
+ backgroundPosition: '0% 50%'
26697
+ }
26698
+ }
26699
+ },
26700
+ radial: {
26701
+ backgroundSize: '100% 100%',
26702
+ transition: 'all 3s ease-in-out',
26703
+ animate: {
26704
+ from: {
26705
+ backgroundPosition: 'center',
26706
+ backgroundSize: '100% 100%'
26707
+ },
26708
+ '50%': {
26709
+ backgroundSize: '120% 120%'
26710
+ },
26711
+ to: {
26712
+ backgroundPosition: 'center',
26713
+ backgroundSize: '100% 100%'
26714
+ }
26715
+ }
26716
+ },
26717
+ conic: {
26718
+ transition: 'transform 3s linear',
26719
+ animate: {
26720
+ from: {
26721
+ transform: 'rotate(0deg)'
26722
+ },
26723
+ to: {
26724
+ transform: 'rotate(360deg)'
26725
+ }
26726
+ }
26727
+ }
26728
+ };
26729
+ /**
26730
+ * Default styles for the Gradient component
26731
+ */
26732
+ var DefaultGradientStyles = {
26733
+ container: {
26734
+ position: 'relative',
26735
+ overflow: 'hidden',
26736
+ borderRadius: '8px',
26737
+ transition: 'all 0.2s ease'
26738
+ },
26739
+ content: {
26740
+ position: 'relative',
26741
+ zIndex: 1,
26742
+ width: '100%',
26743
+ height: '100%',
26744
+ padding: '16px'
26745
+ }
26746
+ };
26747
+
26748
+ var _excluded$1e = ["type", "direction", "shape", "position", "from", "to", "colors", "animate", "animationDuration", "children", "views", "themeMode"];
26749
+ var GradientView = _ref => {
26750
+ var {
26751
+ type = 'linear',
26752
+ direction = 'to-right',
26753
+ shape = 'circle',
26754
+ position = 'center',
26755
+ from,
26756
+ to,
26757
+ colors,
26758
+ animate = false,
26759
+ animationDuration = 3,
26760
+ children,
26761
+ views,
26762
+ themeMode: elementMode
26763
+ } = _ref,
26764
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1e);
26765
+ var {
26766
+ getColor,
26767
+ themeMode
26768
+ } = appStudio.useTheme();
26769
+ // Determine color stops to use
26770
+ var colorStops = React.useMemo(() => {
26771
+ // If colors array is provided, use it
26772
+ if (colors && colors.length > 0) {
26773
+ return colors;
26774
+ }
26775
+ // If from and to are provided, create a two-color gradient
26776
+ if (from && to) {
26777
+ return [{
26778
+ color: from,
26779
+ position: '0%'
26780
+ }, {
26781
+ color: to,
26782
+ position: '100%'
26783
+ }];
26784
+ }
26785
+ // Otherwise use default colors for the selected gradient type
26786
+ return DefaultColorStops[type];
26787
+ }, [colors, from, to, type]);
26788
+ // Generate the gradient string
26789
+ var gradientString = React.useMemo(() => {
26790
+ // Process color stops to resolve theme colors
26791
+ var processedColorStops = colorStops.map(stop => Object.assign({}, stop, {
26792
+ color: getColor(stop.color, elementMode ? {
26793
+ themeMode: elementMode
26794
+ } : undefined)
26795
+ }));
26796
+ return generateGradientString(type, processedColorStops, direction, shape, position);
26797
+ }, [type, colorStops, direction, shape, position, getColor, themeMode, elementMode]);
26798
+ // Prepare animation styles if animation is enabled
26799
+ var animationStyles = React.useMemo(() => {
26800
+ if (!animate) return {};
26801
+ var baseAnimation = GradientAnimations[type];
26802
+ return Object.assign({}, baseAnimation, {
26803
+ transition: baseAnimation.transition.replace('3s', animationDuration + "s"),
26804
+ // Apply animation properties
26805
+ animationDuration: animationDuration + "s",
26806
+ animationIterationCount: 'infinite',
26807
+ animationTimingFunction: type === 'conic' ? 'linear' : 'ease-in-out'
26808
+ });
26809
+ }, [animate, animationDuration, type]);
26810
+ return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26811
+ background: gradientString
26812
+ }, DefaultGradientStyles.container, animationStyles, views == null ? void 0 : views.container, props), children && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, DefaultGradientStyles.content, views == null ? void 0 : views.content), children)));
26813
+ };
26814
+
26815
+ /**
26816
+ * Gradient Component
26817
+ *
26818
+ * @example
26819
+ * // Basic linear gradient
26820
+ * <Gradient from="blue.500" to="purple.500" height="200px" width="100%" />
26821
+ *
26822
+ * @example
26823
+ * // Radial gradient with content
26824
+ * <Gradient
26825
+ * type="radial"
26826
+ * colors={[
26827
+ * { color: 'red.500', position: '0%' },
26828
+ * { color: 'orange.500', position: '50%' },
26829
+ * { color: 'yellow.500', position: '100%' }
26830
+ * ]}
26831
+ * height="200px"
26832
+ * >
26833
+ * <Text color="white">Content inside gradient</Text>
26834
+ * </Gradient>
26835
+ */
26836
+ var Gradient = props => {
26837
+ return /*#__PURE__*/React__default.createElement(GradientView, Object.assign({}, props));
26838
+ };
26839
+
26840
+ var _excluded$1f = ["children", "showRadialGradient", "views", "themeMode"],
26552
26841
  _excluded2$l = ["number"],
26553
26842
  _excluded3$g = ["rows", "cols", "squareSize"],
26554
26843
  _excluded4$d = ["count", "colors", "speed", "shapes"],
26555
26844
  _excluded5$6 = ["gridSize", "lineColor", "pulseColor", "animationSpeed"],
26556
26845
  _excluded6$4 = ["rippleCount", "colors", "maxSize", "frequency"],
26557
- _excluded7$1 = ["children", "views"];
26846
+ _excluded7$1 = ["children", "src", "backgroundSize", "backgroundPosition", "backgroundRepeat", "backgroundAttachment", "imageOpacity", "overlay", "blendMode", "views", "themeMode"],
26847
+ _excluded8$1 = ["children"],
26848
+ _excluded9$1 = ["children", "views"];
26558
26849
  // Background Context
26559
26850
  var BackgroundContext = /*#__PURE__*/React.createContext({});
26560
26851
  /**
@@ -26566,7 +26857,7 @@
26566
26857
  showRadialGradient = true,
26567
26858
  views
26568
26859
  } = _ref,
26569
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1e);
26860
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1f);
26570
26861
  var gradientColors = {
26571
26862
  white: 'rgba(255,255,255,1)',
26572
26863
  transparent: 'rgba(255,255,255,0)'
@@ -26927,12 +27218,64 @@
26927
27218
  }
26928
27219
  }))));
26929
27220
  };
26930
- var BackgroundViewBase = _ref7 => {
27221
+ /**
27222
+ * Background Image Component
27223
+ */
27224
+ var BackgroundImage = _ref7 => {
26931
27225
  var {
26932
27226
  children,
26933
- views
27227
+ src,
27228
+ backgroundSize = 'cover',
27229
+ backgroundPosition = 'center',
27230
+ backgroundRepeat = 'no-repeat',
27231
+ backgroundAttachment = 'scroll',
27232
+ imageOpacity = 1,
27233
+ overlay,
27234
+ blendMode = 'normal',
27235
+ views,
27236
+ themeMode: elementMode
26934
27237
  } = _ref7,
26935
27238
  props = _objectWithoutPropertiesLoose(_ref7, _excluded7$1);
27239
+ var {
27240
+ getColor
27241
+ } = appStudio.useTheme();
27242
+ var imageStyle = Object.assign({}, BackgroundImageStyles.image, {
27243
+ backgroundImage: "url(" + src + ")",
27244
+ backgroundSize,
27245
+ backgroundPosition,
27246
+ backgroundRepeat,
27247
+ backgroundAttachment,
27248
+ opacity: imageOpacity
27249
+ });
27250
+ var overlayStyle = overlay ? Object.assign({}, BackgroundImageStyles.overlay, {
27251
+ backgroundColor: getColor(overlay, elementMode ? {
27252
+ themeMode: elementMode
27253
+ } : undefined),
27254
+ mixBlendMode: blendMode
27255
+ }) : {};
27256
+ return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, BackgroundImageStyles.container, views == null ? void 0 : views.container, props), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
27257
+ style: imageStyle
27258
+ }, views == null ? void 0 : views.image)), overlay && /*#__PURE__*/React__default.createElement(appStudio.View, {
27259
+ style: overlayStyle
27260
+ }), children && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, BackgroundImageStyles.content, views == null ? void 0 : views.content), children)));
27261
+ };
27262
+ /**
27263
+ * Background Gradient Component
27264
+ * Uses the existing Gradient component as a background
27265
+ */
27266
+ var BackgroundGradient = _ref8 => {
27267
+ var {
27268
+ children
27269
+ } = _ref8,
27270
+ gradientProps = _objectWithoutPropertiesLoose(_ref8, _excluded8$1);
27271
+ return /*#__PURE__*/React__default.createElement(Gradient, Object.assign({}, gradientProps), children);
27272
+ };
27273
+ var BackgroundViewBase = _ref9 => {
27274
+ var {
27275
+ children,
27276
+ views
27277
+ } = _ref9,
27278
+ props = _objectWithoutPropertiesLoose(_ref9, _excluded9$1);
26936
27279
  return /*#__PURE__*/React__default.createElement(BackgroundContext.Provider, {
26937
27280
  value: {}
26938
27281
  }, /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, DefaultBackgroundStyles.container, views == null ? void 0 : views.container, props), children));
@@ -26946,6 +27289,8 @@
26946
27289
  BackgroundView.Particles = Particles;
26947
27290
  BackgroundView.Grid = Grid;
26948
27291
  BackgroundView.Ripples = Ripples;
27292
+ BackgroundView.Image = BackgroundImage;
27293
+ BackgroundView.Gradient = BackgroundGradient;
26949
27294
 
26950
27295
  /**
26951
27296
  * Background Component with compound pattern
@@ -26975,6 +27320,18 @@
26975
27320
  * @example
26976
27321
  * // Ripples effect
26977
27322
  * <Background.Ripples rippleCount={5} maxSize={200} frequency={3} />
27323
+ *
27324
+ * @example
27325
+ * // Background Image
27326
+ * <Background.Image src="/path/to/image.jpg" size="cover" overlay="rgba(0,0,0,0.5)">
27327
+ * <Text color="white">Content over image</Text>
27328
+ * </Background.Image>
27329
+ *
27330
+ * @example
27331
+ * // Background Gradient
27332
+ * <Background.Gradient from="blue.500" to="purple.500" animate={true}>
27333
+ * <Text color="white">Content over gradient</Text>
27334
+ * </Background.Gradient>
26978
27335
  */
26979
27336
  var BackgroundComponent = /*#__PURE__*/React__default.forwardRef((props, ref) => /*#__PURE__*/React__default.createElement(BackgroundView, Object.assign({}, props, {
26980
27337
  ref: ref
@@ -26986,7 +27343,9 @@
26986
27343
  Wall: BackgroundView.Wall,
26987
27344
  Particles: BackgroundView.Particles,
26988
27345
  Grid: BackgroundView.Grid,
26989
- Ripples: BackgroundView.Ripples
27346
+ Ripples: BackgroundView.Ripples,
27347
+ Image: BackgroundView.Image,
27348
+ Gradient: BackgroundView.Gradient
26990
27349
  });
26991
27350
  Background.displayName = 'Background';
26992
27351