rw-elements-tools 1.2.0

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.
Files changed (185) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1333 -0
  3. package/bin/cli.js +213 -0
  4. package/build-properties.js +654 -0
  5. package/build-shared-hooks.js +253 -0
  6. package/config.js +148 -0
  7. package/controls/Animations/AnimationEffects.js +111 -0
  8. package/controls/Animations/AnimationSettings.js +437 -0
  9. package/controls/Animations/Reveals.js +168 -0
  10. package/controls/Animations/ScrollAnimation_Opacity.js +15 -0
  11. package/controls/Animations/ScrollAnimation_Rotate.js +17 -0
  12. package/controls/Animations/ScrollAnimation_Scale.js +18 -0
  13. package/controls/Animations/ScrollAnimation_Translate.js +31 -0
  14. package/controls/Background/Background.js +66 -0
  15. package/controls/Background/BackgroundButton.js +69 -0
  16. package/controls/Background/BackgroundColor.js +28 -0
  17. package/controls/Background/BackgroundContainer.js +73 -0
  18. package/controls/Background/BackgroundGradient.js +149 -0
  19. package/controls/Background/BackgroundImage.js +108 -0
  20. package/controls/Background/BackgroundOnlyColor.js +53 -0
  21. package/controls/Background/BackgroundTransparent.js +66 -0
  22. package/controls/Background/BackgroundVideo.js +9 -0
  23. package/controls/Background/Color.js +52 -0
  24. package/controls/Background/Gradient.js +263 -0
  25. package/controls/Background/GradientContainer.js +263 -0
  26. package/controls/Background/Image.js +269 -0
  27. package/controls/Background/Image_CMS.js +305 -0
  28. package/controls/Background/SVG.js +235 -0
  29. package/controls/Background/Video.js +29 -0
  30. package/controls/Borders/Border.js +114 -0
  31. package/controls/Borders/BorderColor.js +25 -0
  32. package/controls/Borders/BorderRadius.js +19 -0
  33. package/controls/Borders/BorderStyle.js +26 -0
  34. package/controls/Borders/BorderWidth.js +20 -0
  35. package/controls/Borders/Borders.js +69 -0
  36. package/controls/Borders/BordersContainer.js +90 -0
  37. package/controls/Borders/BordersInput.js +107 -0
  38. package/controls/Borders/Outline.js +100 -0
  39. package/controls/Borders/OutlineColor.js +25 -0
  40. package/controls/Borders/OutlineOffset.js +13 -0
  41. package/controls/Borders/OutlineStyle.js +26 -0
  42. package/controls/Borders/OutlineWidth.js +13 -0
  43. package/controls/Effects/BackdropBlur.js +11 -0
  44. package/controls/Effects/Blur.js +11 -0
  45. package/controls/Effects/BoxShadow.js +15 -0
  46. package/controls/Effects/Brightness.js +11 -0
  47. package/controls/Effects/DropShadow.js +14 -0
  48. package/controls/Effects/Effects.js +71 -0
  49. package/controls/Effects/Filters.js +114 -0
  50. package/controls/Effects/Opacity.js +14 -0
  51. package/controls/Effects/Saturate.js +11 -0
  52. package/controls/Layout/AspectRatio.js +53 -0
  53. package/controls/Layout/Container.js +24 -0
  54. package/controls/Layout/Hidden.js +9 -0
  55. package/controls/Layout/Inset.js +15 -0
  56. package/controls/Layout/Isolation.js +25 -0
  57. package/controls/Layout/Layout.js +38 -0
  58. package/controls/Layout/Overflow.js +33 -0
  59. package/controls/Layout/Position.js +37 -0
  60. package/controls/Layout/TopRightBottomLeft.js +90 -0
  61. package/controls/Layout/Visibility.js +25 -0
  62. package/controls/Layout/ZIndex.js +36 -0
  63. package/controls/Overlay/Color.js +52 -0
  64. package/controls/Overlay/Gradient.js +298 -0
  65. package/controls/Overlay/Image.js +226 -0
  66. package/controls/Overlay/Overlay.js +66 -0
  67. package/controls/Sizing/Height.js +18 -0
  68. package/controls/Sizing/MaxHeight.js +17 -0
  69. package/controls/Sizing/MaxWidth.js +17 -0
  70. package/controls/Sizing/MinHeight.js +18 -0
  71. package/controls/Sizing/MinWidth.js +18 -0
  72. package/controls/Sizing/Sizing.js +66 -0
  73. package/controls/Sizing/SizingContainer.js +122 -0
  74. package/controls/Sizing/SizingImage.js +75 -0
  75. package/controls/Sizing/SizingInput.js +71 -0
  76. package/controls/Sizing/SizingSVG.js +74 -0
  77. package/controls/Sizing/Width.js +18 -0
  78. package/controls/Spacing/Margin.js +17 -0
  79. package/controls/Spacing/Padding.js +17 -0
  80. package/controls/Spacing/Spacing.js +23 -0
  81. package/controls/Spacing/SpacingButton.js +42 -0
  82. package/controls/Spacing/SpacingContainer.js +32 -0
  83. package/controls/Spacing/SpacingInput.js +42 -0
  84. package/controls/Transforms/Rotate.js +13 -0
  85. package/controls/Transforms/Scale.js +13 -0
  86. package/controls/Transforms/Skew.js +25 -0
  87. package/controls/Transforms/TransformOrigin.js +12 -0
  88. package/controls/Transforms/Transforms.js +98 -0
  89. package/controls/Transforms/Translate.js +26 -0
  90. package/controls/Transitions/Delay.js +13 -0
  91. package/controls/Transitions/Duration.js +13 -0
  92. package/controls/Transitions/Property.js +42 -0
  93. package/controls/Transitions/TimingFunction.js +44 -0
  94. package/controls/Transitions/Transitions.js +20 -0
  95. package/controls/alignment/AlignContent.js +48 -0
  96. package/controls/alignment/AlignItems.js +64 -0
  97. package/controls/alignment/AlignSelf.js +34 -0
  98. package/controls/alignment/JustifyContent.js +44 -0
  99. package/controls/alignment/JustifyItems.js +32 -0
  100. package/controls/alignment/JustifySelf.js +34 -0
  101. package/controls/core/CSSClasses.js +11 -0
  102. package/controls/core/ControlType.js +25 -0
  103. package/controls/core/HTMLTag.js +80 -0
  104. package/controls/core/HoverGroup.js +38 -0
  105. package/controls/core/ID.js +12 -0
  106. package/controls/core/Image.js +95 -0
  107. package/controls/core/MenuItem.js +187 -0
  108. package/controls/core/ObjectFit.js +32 -0
  109. package/controls/core/ObjectPosition.js +65 -0
  110. package/controls/grid-flex/ActAsGridOrFlexItem.js +54 -0
  111. package/controls/grid-flex/ColEnd.js +28 -0
  112. package/controls/grid-flex/ColStart.js +27 -0
  113. package/controls/grid-flex/Columns.js +38 -0
  114. package/controls/grid-flex/FlexDirection.js +27 -0
  115. package/controls/grid-flex/FlexItem.js +106 -0
  116. package/controls/grid-flex/GridItem.js +41 -0
  117. package/controls/grid-flex/Order.js +45 -0
  118. package/controls/grid-flex/RowEnd.js +28 -0
  119. package/controls/grid-flex/RowStart.js +27 -0
  120. package/controls/grid-flex/Rows.js +38 -0
  121. package/controls/index.js +187 -0
  122. package/controls/interactive/ButtonFontAndTextStyles.js +208 -0
  123. package/controls/interactive/Filter.js +54 -0
  124. package/controls/interactive/InputFontAndTextStyles.js +156 -0
  125. package/controls/interactive/Link.js +13 -0
  126. package/controls/typography/HeadingColor.js +112 -0
  127. package/controls/typography/TextColor.js +51 -0
  128. package/controls/typography/TextDecoration.js +99 -0
  129. package/controls/typography/TextFontsAndTextStyles.js +243 -0
  130. package/controls/typography/TextSimple.js +55 -0
  131. package/controls/typography/TextStyles.js +55 -0
  132. package/controls/typography/Typography.js +13 -0
  133. package/index.js +19 -0
  134. package/package.json +55 -0
  135. package/properties/BackgroundType.js +18 -0
  136. package/properties/ButtonSize.js +19 -0
  137. package/properties/ContainerHeights.js +23 -0
  138. package/properties/ContainerWidths.js +27 -0
  139. package/properties/FontWeight.js +16 -0
  140. package/properties/GradientDirection.js +39 -0
  141. package/properties/LetterSpacing.js +13 -0
  142. package/properties/LineHeight.js +13 -0
  143. package/properties/RevealAnimations.js +12 -0
  144. package/properties/Slider.js +10 -0
  145. package/properties/TextAlign.js +23 -0
  146. package/properties/TransformOrigins.js +43 -0
  147. package/properties/TransitionNames.js +20 -0
  148. package/properties/index.js +13 -0
  149. package/shared-hooks/animations/globalAnimations.js +141 -0
  150. package/shared-hooks/animations/globalReveal.js +48 -0
  151. package/shared-hooks/background/globalBackground.js +306 -0
  152. package/shared-hooks/background/globalBgImageFetchPriority.js +34 -0
  153. package/shared-hooks/borders/globalBorders.js +85 -0
  154. package/shared-hooks/borders/globalOutline.js +39 -0
  155. package/shared-hooks/core/addPrefixToTailwindClasses.js +24 -0
  156. package/shared-hooks/core/advancedClasses.js +5 -0
  157. package/shared-hooks/core/classnames.js +92 -0
  158. package/shared-hooks/core/getHoverPrefix.js +21 -0
  159. package/shared-hooks/core/globalHTMLTag.js +17 -0
  160. package/shared-hooks/core/injectPrefixOnDarkModeColors.js +6 -0
  161. package/shared-hooks/effects/globalEffects.js +45 -0
  162. package/shared-hooks/effects/globalFilters.js +80 -0
  163. package/shared-hooks/effects/globalOverlay.js +166 -0
  164. package/shared-hooks/interactive/globalFilter.js +24 -0
  165. package/shared-hooks/interactive/globalLink.js +23 -0
  166. package/shared-hooks/layout/globalActAsGridOrFlexItem.js +66 -0
  167. package/shared-hooks/layout/globalLayout.js +50 -0
  168. package/shared-hooks/navigation/globalMenuItem.js +35 -0
  169. package/shared-hooks/navigation/globalNavItems.js +60 -0
  170. package/shared-hooks/navigation/globalNavTitle.js +23 -0
  171. package/shared-hooks/sizing/aspectRatioClasses.js +20 -0
  172. package/shared-hooks/sizing/globalSizing.js +19 -0
  173. package/shared-hooks/sizing/globalSizingContainer.js +40 -0
  174. package/shared-hooks/sizing/objectClasses.js +9 -0
  175. package/shared-hooks/spacing/globalSpacing.js +13 -0
  176. package/shared-hooks/spacing/globalSpacingMargin.js +11 -0
  177. package/shared-hooks/spacing/globalSpacingPadding.js +11 -0
  178. package/shared-hooks/transforms/globalTransforms.js +78 -0
  179. package/shared-hooks/transitions/getAlpineTransitionAttributesDesktop.js +111 -0
  180. package/shared-hooks/transitions/getAlpineTransitionAttributesMobile.js +110 -0
  181. package/shared-hooks/transitions/globalTransitions.js +48 -0
  182. package/shared-hooks/typography/globalButtonFontAndTextStyles.js +65 -0
  183. package/shared-hooks/typography/globalHeadingColor.js +69 -0
  184. package/shared-hooks/typography/globalInputFontAndTextStyles.js +40 -0
  185. package/shared-hooks/typography/globalTextFontsAndTextStyles.js +47 -0
@@ -0,0 +1,80 @@
1
+ const globalFilters = (app, args = {}) => {
2
+ const {
3
+ globalControlTypeFilters: type,
4
+ globalHoverGroupFilters: hoverGroup,
5
+ globalHoverGroupCustomIdFilters: customId,
6
+ globalFiltersApplyTo: applyTo,
7
+ // filters
8
+ globalFiltersBlur: blur,
9
+ globalFiltersBrightness: brightness,
10
+ globalFiltersDropShadow: dropShadow,
11
+ globalFiltersSaturate: saturate,
12
+
13
+ // backdrop filters
14
+ globalFiltersBackdropBlur: backdropBlur,
15
+
16
+ // end filters
17
+ globalFiltersBlurEnd: blurEnd,
18
+ globalFiltersBrightnessEnd: brightnessEnd,
19
+ globalFiltersDropShadowEnd: dropShadowEnd,
20
+ globalFiltersSaturateEnd: saturateEnd,
21
+
22
+ // end backdrop filters
23
+ globalFiltersBackdropBlurEnd: backdropBlurEnd,
24
+ } = app.props;
25
+
26
+ const { node } = app;
27
+
28
+ node.isContainer = args.isContainer || false;
29
+ const wantsActive = args.active || false;
30
+ const wantsFocus = args.focus || false;
31
+ const prefix = getHoverPrefix(node, applyTo, hoverGroup, customId);
32
+
33
+ if (type == "none") {
34
+ return "";
35
+ }
36
+
37
+ const wantsBlur = !blur.endsWith("[0px]") || !blurEnd.endsWith("[0px]");
38
+ const wantsBackdropBlur =
39
+ !backdropBlur.endsWith("[0px]") || !backdropBlurEnd.endsWith("[0px]");
40
+
41
+ const classes = [
42
+ wantsBlur ? blur : "",
43
+ brightness,
44
+ dropShadow,
45
+ saturate,
46
+ wantsBackdropBlur ? backdropBlur : "",
47
+ ];
48
+
49
+ if (type == "hover") {
50
+ classes.push(
51
+ wantsBlur ? `${prefix}:${blurEnd}` : "",
52
+ `${prefix}:${brightnessEnd}`,
53
+ `${prefix}:${dropShadowEnd}`,
54
+ `${prefix}:${saturateEnd}`,
55
+ wantsBackdropBlur ? `${prefix}:${backdropBlurEnd}` : ""
56
+ );
57
+
58
+ if (wantsActive) {
59
+ classes.push(
60
+ `data-[active=true]:${blurEnd}`,
61
+ `data-[active=true]:${brightnessEnd}`,
62
+ `data-[active=true]:${dropShadowEnd}`,
63
+ `data-[active=true]:${saturateEnd}`,
64
+ `data-[active=true]:${backdropBlurEnd}`
65
+ );
66
+ }
67
+
68
+ if (wantsFocus) {
69
+ classes.push(
70
+ `${prefix.replace(/hover/g, "focus")}:${blurEnd}`,
71
+ `${prefix.replace(/hover/g, "focus")}:${brightnessEnd}`,
72
+ `${prefix.replace(/hover/g, "focus")}:${dropShadowEnd}`,
73
+ `${prefix.replace(/hover/g, "focus")}:${saturateEnd}`,
74
+ `${prefix.replace(/hover/g, "focus")}:${backdropBlurEnd}`
75
+ );
76
+ }
77
+ }
78
+
79
+ return classnames(classes).toString();
80
+ };
@@ -0,0 +1,166 @@
1
+ const globalOverlayColor = (app, prefix) => {
2
+ const {
3
+ globalControlTypeOverlay: controlType,
4
+ globalOverlayColor: color,
5
+ globalOverlayColorOpacity: opacity,
6
+ globalOverlayColorEnd: colorEnd,
7
+ globalOverlayColorOpacityEnd: opacityEnd,
8
+ } = app.props;
9
+
10
+ const classes = classnames([color, `${opacity} dark:${opacity}`]);
11
+
12
+ if (controlType == "hover") {
13
+ classes.add([
14
+ injectPrefixOnDarkModeColors(prefix, `${prefix}:${colorEnd}`),
15
+ `${prefix}:${opacityEnd}`,
16
+ `dark:${prefix}:${opacityEnd}`,
17
+ ]);
18
+ }
19
+
20
+ return classes.toString();
21
+ }
22
+
23
+ const globalOverlayGradient = (app, prefix) => {
24
+ const {
25
+ globalControlTypeOverlay: controlType,
26
+ globalOverlayGradientDirection: direction,
27
+ globalOverlayGradientDirectionEnd: directionEnd,
28
+
29
+ globalOverlayGradientFromColor: fromColor,
30
+ globalOverlayGradientFromOpacity: fromOpacity,
31
+ globalOverlayGradientFromPosition: fromPosition,
32
+
33
+ globalOverlayGradientViaEnabled: viaEnabled,
34
+ globalOverlayGradientViaColor: viaColor,
35
+ globalOverlayGradientViaOpacity: viaOpacity,
36
+ globalOverlayGradientViaPosition: viaPosition,
37
+
38
+ globalOverlayGradientToColor: toColor,
39
+ globalOverlayGradientToOpacity: toOpacity,
40
+ globalOverlayGradientToPosition: toPosition,
41
+
42
+ globalOverlayGradientFromColorEnd: fromColorEnd,
43
+ globalOverlayGradientFromOpacityEnd: fromOpacityEnd,
44
+ globalOverlayGradientFromPositionEnd: fromPositionEnd,
45
+
46
+ globalOverlayGradientViaEnabledEnd: viaEnabledEnd,
47
+ globalOverlayGradientViaColorEnd: viaColorEnd,
48
+ globalOverlayGradientViaOpacityEnd: viaOpacityEnd,
49
+ globalOverlayGradientViaPositionEnd: viaPositionEnd,
50
+
51
+ globalOverlayGradientToColorEnd: toColorEnd,
52
+ globalOverlayGradientToOpacityEnd: toOpacityEnd,
53
+ globalOverlayGradientToPositionEnd: toPositionEnd,
54
+ } = app.props;
55
+
56
+ const classes = classnames([
57
+ direction,
58
+ `${fromColor}/${fromOpacity}`,
59
+ fromPosition,
60
+ `${toColor}/${toOpacity}`,
61
+ toPosition,
62
+ ])
63
+
64
+ if (viaEnabled == 'true') {
65
+ classes.add([
66
+ `${viaColor}/${viaOpacity}`,
67
+ viaPosition,
68
+ ])
69
+ }
70
+
71
+ if (controlType == "hover") {
72
+ classes.add([
73
+ `${prefix}:${directionEnd}`,
74
+ `${prefix}:${fromColorEnd}/${fromOpacityEnd}`,
75
+ `${prefix}:${fromPositionEnd}`,
76
+ `${prefix}:${toColorEnd}/${toOpacityEnd}`,
77
+ `${prefix}:${toPositionEnd}`,
78
+ ])
79
+
80
+ if (viaEnabledEnd == 'true') {
81
+ classes.add([
82
+ `${prefix}:${viaColorEnd}/${viaOpacityEnd}`,
83
+ `${prefix}:${viaPositionEnd}`,
84
+ ])
85
+ }
86
+ }
87
+
88
+ return classes.toString();
89
+ };
90
+
91
+ const globalOverlayImage = (app, prefix) => {
92
+ const {
93
+ globalControlTypeOverlay: controlType,
94
+ globalOverlayImageResource: resource,
95
+ globalOverlayImagePositionX: x,
96
+ globalOverlayImagePositionY: y,
97
+ globalOverlayImageSize: size,
98
+ globalOverlayImageRepeat: repeat,
99
+
100
+ globalOverlayImageResourceEnd: resourceEnd,
101
+ globalOverlayImagePositionXEnd: xEnd,
102
+ globalOverlayImagePositionYEnd: yEnd,
103
+ globalOverlayImageSizeEnd: sizeEnd,
104
+ globalOverlayImageRepeatEnd: repeatEnd,
105
+ } = app.props;
106
+
107
+ // @TODO: add responsive image support
108
+ // loop over breakpoints, resize image, and add {breakpoint}:bg-[url()] classes
109
+
110
+ const bgPosition = (horizontal, vertical) => {
111
+ const mappings = {
112
+ "center-top": "bg-top",
113
+ "center-bottom": "bg-bottom",
114
+ "left-center": "bg-left",
115
+ "right-center": "bg-right",
116
+ "center-center": "bg-center",
117
+ };
118
+
119
+ const key = `${horizontal}-${vertical}`;
120
+ return mappings[key] || `bg-${key}`;
121
+ };
122
+
123
+ const classes = classnames().add([
124
+ `bg-[url(${app.getResource(resource, 1200)})]`,
125
+ size,
126
+ repeat,
127
+ bgPosition(x, y),
128
+ ]);
129
+
130
+ if (controlType == "hover") {
131
+ classes.add([
132
+ `${prefix}:bg-[url(${app.getResource(resourceEnd, 1200)})]`,
133
+ `${prefix}:${sizeEnd}`,
134
+ `${prefix}:${repeatEnd}`,
135
+ `${prefix}:${bgPosition(xEnd, yEnd)}`,
136
+ ]);
137
+ }
138
+
139
+ return classes.toString();
140
+ };
141
+
142
+ const globalOverlay = (app, isContainer = false) => {
143
+ const { globalControlTypeOverlay: controlType, globalOverlayType: type } = app.props;
144
+
145
+ const { node } = app;
146
+
147
+ node.isContainer = isContainer;
148
+ const prefix = getHoverPrefix(node, 'background', 'self');
149
+ if (controlType == "none") {
150
+ return "";
151
+ }
152
+
153
+ switch (type) {
154
+ case "color":
155
+ return globalOverlayColor(app, prefix);
156
+ case "gradient":
157
+ return globalOverlayGradient(app, prefix);
158
+ case "image":
159
+ return globalOverlayImage(app, prefix);
160
+ case "none":
161
+ return "";
162
+ default:
163
+ console.error("Invalid background type:", type);
164
+ return "";
165
+ }
166
+ }
@@ -0,0 +1,24 @@
1
+ const globalFilter = (rw) => {
2
+ const {
3
+ globalFilterEnable: wantsFilter,
4
+ globalFilterGroup: group,
5
+ globalFilterCustomGroupId: groupId,
6
+ globalFilterTransition: transition = null,
7
+ } = rw.props;
8
+
9
+ const { parent } = rw.node;
10
+
11
+ const filterGroupId = group == "parent" ? parent.id : groupId;
12
+
13
+ return {
14
+ wantsFilter,
15
+ filterGroupId,
16
+ transition,
17
+ args: wantsFilter
18
+ ? {
19
+ "data-filter-group": filterGroupId,
20
+ "data-filter-transition": transition,
21
+ }
22
+ : {},
23
+ };
24
+ };
@@ -0,0 +1,23 @@
1
+ const globalLink = (app) => {
2
+ const { globalLink: link = null } = app.props;
3
+ const hasLink = typeof link === 'object' && Object.keys(link).length > 0 && link.href.length > 0;
4
+
5
+ let linkAttributes = {
6
+ hasLink,
7
+ args: {}
8
+ };
9
+
10
+ if (!hasLink) return linkAttributes;
11
+
12
+ const { href, title, target } = link;
13
+ const attrs = link.attributes?.reduce((acc, { key, value }) => ({ ...acc, [key]: value }), {})
14
+
15
+ linkAttributes.args = {
16
+ ...attrs,
17
+ href,
18
+ title,
19
+ target,
20
+ };
21
+
22
+ return linkAttributes;
23
+ };
@@ -0,0 +1,66 @@
1
+ const globalActAsGridOrFlexItem = (app) => {
2
+ const {
3
+ globalGridOrFlexDisplayAs: displayAs,
4
+ globalGridOrFlexItemSettings: settingsType,
5
+
6
+ // Grid Item
7
+ globalGridItemColSpan: colSpan,
8
+ globlaGridItemColStart: colStart,
9
+ globalGridItemColEnd: colEnd,
10
+ globalGridItemRowSpan: rowSpan,
11
+ globalGridItemRowStart: rowStart,
12
+ globalGridItemRowEnd: rowEnd,
13
+
14
+ // Flex Item
15
+ globalFlexItemFlex: flex,
16
+ globalFlexItemShrink: shrink,
17
+ globalFlexItemGrow: grow,
18
+ globalFlexItemBasis: basis,
19
+ globalFlexItemBasisCustom: basisCustom,
20
+
21
+ // General
22
+ globalGridOrFlexItemAlignSelf: alignSelf,
23
+ globalGridOrFlexItemJustifySelf: justifySelf,
24
+ globalGridOrFlexItemOrder: order,
25
+ globalGridOrFlexItemOrderCustom: orderCustom
26
+ } = app.props;
27
+
28
+ if (displayAs == "default") {
29
+ return false;
30
+ }
31
+
32
+ const classes = [];
33
+
34
+ if (displayAs == "flex") {
35
+ classes.push(
36
+ alignSelf,
37
+ justifySelf,
38
+ ...(settingsType === "advanced" ? [
39
+ flex,
40
+ shrink,
41
+ grow,
42
+ basis == "custom" ? basisCustom : basis,
43
+ order == "custom" ? orderCustom : order
44
+ ] : [])
45
+ );
46
+ }
47
+
48
+ if (displayAs == "grid") {
49
+ classes.push(
50
+ colSpan,
51
+ rowSpan,
52
+ ...(settingsType === "advanced" ? [
53
+ colStart !== "col-start-auto" ? colStart : undefined,
54
+ colEnd !== "col-end-auto" ? colEnd : undefined,
55
+ rowStart !== "row-start-auto" ? rowStart : undefined,
56
+ rowEnd !== "row-end-auto" ? rowEnd : undefined,
57
+ alignSelf,
58
+ justifySelf,
59
+ order == "custom" ? orderCustom : order
60
+ ] : [])
61
+ );
62
+ }
63
+
64
+ return classnames(classes).toString();
65
+ }
66
+
@@ -0,0 +1,50 @@
1
+ const getHiddenClasses = (hidden = {}, defaultDisplay = "block") => {
2
+ if (Object.keys(hidden).length === 0) {
3
+ return defaultDisplay;
4
+ }
5
+
6
+ return Object.entries(hidden).reduce((classes, [breakpoint, isHidden]) => {
7
+ const modifier = breakpoint === "base" ? "" : `${breakpoint}:`;
8
+ const className = isHidden
9
+ ? `${modifier}hidden`
10
+ : `${modifier}${defaultDisplay}`;
11
+ return classes ? `${classes} ${className}` : className;
12
+ }, "");
13
+ };
14
+
15
+ const globalLayout = (app, args = {}) => {
16
+ const {
17
+ globalLayoutPosition: position,
18
+ globalLayoutZIndexType: zIndexType,
19
+ globalLayoutZIndex: zIndex,
20
+
21
+ globalLayoutTopRightBottomLeftType: topRightBottomLeftType,
22
+ globalLayoutInset: inset,
23
+ globalLayoutTop: top,
24
+ globalLayoutRight: right,
25
+ globalLayoutBottom: bottom,
26
+ globalLayoutLeft: left,
27
+
28
+ globalLayoutOverflow: overflow,
29
+ globalLayoutIsolation: isolation,
30
+ globalLayoutVisibility: visibility,
31
+ } = app.props;
32
+
33
+ const { globalLayoutHidden } = app.responsiveProps;
34
+ const { defaultDisplay } = args;
35
+
36
+ const hidden = getHiddenClasses(globalLayoutHidden, defaultDisplay);
37
+
38
+ return classnames([
39
+ position,
40
+ zIndexType !== "custom" ? zIndexType : zIndex,
41
+ topRightBottomLeftType === "uniform" && inset,
42
+ ...(topRightBottomLeftType === "individual"
43
+ ? [top, right, bottom, left].filter(Boolean)
44
+ : []),
45
+ overflow,
46
+ isolation,
47
+ visibility,
48
+ hidden,
49
+ ]).toString();
50
+ };
@@ -0,0 +1,35 @@
1
+ const globalMenuItem = (rw) => {
2
+ const {
3
+ globalMenuItemFontFamily,
4
+ globalMenuItemTextStyles,
5
+ globalMenuItemFontWeight,
6
+ globalMenuItemLetterSpacing,
7
+ globalMenuItemItalic,
8
+ globalMenuItemState,
9
+ globalMenuItemColor,
10
+ globalMenuItemOpacity,
11
+ globalMenuItemTextShadow,
12
+ globalMenuItemUnderline,
13
+ globalMenuItemHoverColor,
14
+ globalMenuItemHoverOpacity,
15
+ globalMenuItemHoverTextShadow,
16
+ globalMenuItemHoverUnderline,
17
+ } = rw.props;
18
+
19
+ return classnames([
20
+ globalMenuItemFontFamily,
21
+ globalMenuItemTextStyles,
22
+ globalMenuItemFontWeight,
23
+ globalMenuItemLetterSpacing,
24
+ globalMenuItemItalic,
25
+ globalMenuItemState,
26
+ globalMenuItemColor,
27
+ globalMenuItemOpacity,
28
+ globalMenuItemTextShadow,
29
+ globalMenuItemUnderline,
30
+ globalMenuItemHoverColor,
31
+ globalMenuItemHoverOpacity,
32
+ globalMenuItemHoverTextShadow,
33
+ globalMenuItemHoverUnderline,
34
+ ]).toString();
35
+ };
@@ -0,0 +1,60 @@
1
+ const globalNavItems = (rw, isActive = false) => {
2
+ const {
3
+ globalNavItemsTextColor: textColor,
4
+ globalNavItemsTextColorOpacity: textColorOpacity,
5
+ globalNavItemsFont: font,
6
+ globalNavItemsFontSize: fontSize,
7
+ globalNavItemsTextShadow: textShadow,
8
+ globalNavItemsFontWeight: fontWeight,
9
+ globalNavItemsLetterSpacing: letterSpacing,
10
+ globalNavItemsItalic: italic,
11
+ globalNavItemsUnderline: underline,
12
+
13
+ globalNavItemsTextColorHover: textColorHover,
14
+ globalNavItemsTextColorOpacityHover: textColorOpacityHover,
15
+ globalNavItemsTextShadowHover: textShadowHover,
16
+ globalNavItemsUnderlineHover: underlineHover,
17
+ } = rw.props;
18
+
19
+ console.log({ fontWeight });
20
+
21
+ const inactiveStyles = {
22
+ textColor,
23
+ textColorOpacity,
24
+ font,
25
+ fontSize,
26
+ textShadow,
27
+ fontWeight,
28
+ letterSpacing,
29
+ italic,
30
+ underline,
31
+ };
32
+
33
+ const activeStyles = {
34
+ ...inactiveStyles,
35
+ textColor: textColorHover,
36
+ textColorOpacity: textColorOpacityHover,
37
+ textShadow: textShadowHover,
38
+ underline: underlineHover,
39
+
40
+ };
41
+
42
+ // remove hover: prefix from all active styles
43
+ const activeStylesFormatted = Object.fromEntries(
44
+ Object.entries(activeStyles).map(([key, value]) => [key, value.replace(/hover:/g, '')])
45
+ );
46
+
47
+ const hoverStyles = {
48
+ textColorHover,
49
+ textColorOpacityHover,
50
+ textShadowHover,
51
+ underlineHover,
52
+ };
53
+
54
+ const currentStyles = isActive ? activeStylesFormatted : inactiveStyles;
55
+
56
+ return classnames([
57
+ ...Object.values(currentStyles),
58
+ ...Object.values(hoverStyles),
59
+ ]).toString();
60
+ };
@@ -0,0 +1,23 @@
1
+ const globalNavTitle = (rw) => {
2
+ const {
3
+ globalNavTitleTextColor,
4
+ globalNavTitleTextColorOpacity,
5
+ globalNavTitleFont,
6
+ globalNavTitleFontSize,
7
+ globalNavTitleTextShadow,
8
+ globalNavTitleFontWeight,
9
+ globalNavTitleFontLetterSpacing,
10
+ globalNavTitleItalic,
11
+ globalNavTitleUnderline,
12
+ } = rw.props;
13
+ return classnames([
14
+ `${globalNavTitleTextColor}/${globalNavTitleTextColorOpacity}`,
15
+ globalNavTitleFont,
16
+ globalNavTitleFontSize,
17
+ globalNavTitleTextShadow,
18
+ globalNavTitleFontWeight,
19
+ globalNavTitleFontLetterSpacing,
20
+ globalNavTitleItalic,
21
+ globalNavTitleUnderline,
22
+ ]).toString();
23
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Generates aspect ratio classes based on props.
3
+ *
4
+ * @param {Object} props - The properties object containing aspect ratio definitions.
5
+ * @param {string} [modifier=""] - Optional CSS modifier (e.g., 'hover', 'focus').
6
+ * @returns {string} The generated class string.
7
+ */
8
+ const aspectRatioClasses = (rw) => {
9
+ const { aspectRatio, aspectRatioCustom } = rw.props;
10
+
11
+ const aspectRatioClasses = {
12
+ "aspect-[auto]":
13
+ rw.component.title == "Video" ? "aspect-video" : "aspect-[auto]",
14
+ "aspect-[custom]": aspectRatioCustom,
15
+ };
16
+
17
+ return classnames()
18
+ .add(aspectRatioClasses[aspectRatio] || aspectRatio)
19
+ .toString();
20
+ };
@@ -0,0 +1,19 @@
1
+ const globalSizing = (app) => {
2
+ const {
3
+ globalHeight: height,
4
+ globalWidth: width,
5
+ globalSizingMinMaxEnabled: minMaxEnabled,
6
+ globalMinWidth: minWidth,
7
+ globalMaxWidth: maxWidth,
8
+ globalMinHeight: minHeight,
9
+ globalMaxHeight: maxHeight,
10
+ } = app.props;
11
+
12
+ const classes = classnames([width, height]);
13
+
14
+ if (minMaxEnabled == 'true') {
15
+ classes.add([minWidth, minHeight, maxWidth, maxHeight]);
16
+ }
17
+
18
+ return classes.toString();
19
+ }
@@ -0,0 +1,40 @@
1
+ const globalSizingContainer = (app) => {
2
+ const {
3
+ globalWidthType: widthType,
4
+ globalWidth: width,
5
+ globalHeightType: heightType,
6
+ globalHeight: height,
7
+
8
+ globalSizingMinMaxEnabled: minMaxEnabled,
9
+ globalMinWidth: minWidth,
10
+ globalMaxWidth: maxWidth,
11
+ globalMinHeight: minHeight,
12
+ globalMaxHeight: maxHeight,
13
+ } = app.props
14
+
15
+ const widthClasses = {
16
+ 'auto': 'w-auto',
17
+ 'full': 'w-full',
18
+ 'screen': 'w-screen',
19
+ 'container': 'container w-full',
20
+ 'theme': width
21
+ };
22
+
23
+ const heightClasses = {
24
+ 'auto': 'h-auto',
25
+ 'full': 'h-full',
26
+ 'screen': 'h-screen',
27
+ 'theme': height
28
+ };
29
+
30
+ const classes = classnames([
31
+ widthClasses[widthType],
32
+ heightClasses[heightType]
33
+ ]);
34
+
35
+ if (minMaxEnabled == 'true') {
36
+ classes.add([minWidth, minHeight, maxWidth, maxHeight]);
37
+ }
38
+
39
+ return classes.toString();
40
+ }
@@ -0,0 +1,9 @@
1
+ const objectClasses = (rw) => {
2
+ const { aspectRatio, objectFit, objectPosition } = rw.props;
3
+
4
+ return classnames([
5
+ aspectRatio !== "aspect-[auto]" ? objectFit : "",
6
+ objectPosition,
7
+ ]).toString();
8
+ };
9
+
@@ -0,0 +1,13 @@
1
+ const globalSpacing = (app) => {
2
+ const {
3
+ globalSpacingEnabled: enabled,
4
+ globalMargin: margin,
5
+ globalPadding: padding,
6
+ } = app.props;
7
+
8
+ if (enabled == 'false') {
9
+ return false;
10
+ }
11
+
12
+ return classnames([margin, padding]).toString();
13
+ }
@@ -0,0 +1,11 @@
1
+ const globalSpacingMargin = (app) => {
2
+ const {
3
+ globalSpacingEnabled: enabled,
4
+ globalMargin: margin,
5
+ } = app.props;
6
+
7
+ return enabled == 'false'
8
+ ? false
9
+ : margin;
10
+ }
11
+
@@ -0,0 +1,11 @@
1
+ const globalSpacingPadding = (app) => {
2
+ const {
3
+ globalSpacingEnabled: enabled,
4
+ globalPadding: padding,
5
+ } = app.props;
6
+
7
+ return enabled == 'false'
8
+ ? false
9
+ : padding;
10
+ }
11
+