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.
- package/LICENSE +22 -0
- package/README.md +1333 -0
- package/bin/cli.js +213 -0
- package/build-properties.js +654 -0
- package/build-shared-hooks.js +253 -0
- package/config.js +148 -0
- package/controls/Animations/AnimationEffects.js +111 -0
- package/controls/Animations/AnimationSettings.js +437 -0
- package/controls/Animations/Reveals.js +168 -0
- package/controls/Animations/ScrollAnimation_Opacity.js +15 -0
- package/controls/Animations/ScrollAnimation_Rotate.js +17 -0
- package/controls/Animations/ScrollAnimation_Scale.js +18 -0
- package/controls/Animations/ScrollAnimation_Translate.js +31 -0
- package/controls/Background/Background.js +66 -0
- package/controls/Background/BackgroundButton.js +69 -0
- package/controls/Background/BackgroundColor.js +28 -0
- package/controls/Background/BackgroundContainer.js +73 -0
- package/controls/Background/BackgroundGradient.js +149 -0
- package/controls/Background/BackgroundImage.js +108 -0
- package/controls/Background/BackgroundOnlyColor.js +53 -0
- package/controls/Background/BackgroundTransparent.js +66 -0
- package/controls/Background/BackgroundVideo.js +9 -0
- package/controls/Background/Color.js +52 -0
- package/controls/Background/Gradient.js +263 -0
- package/controls/Background/GradientContainer.js +263 -0
- package/controls/Background/Image.js +269 -0
- package/controls/Background/Image_CMS.js +305 -0
- package/controls/Background/SVG.js +235 -0
- package/controls/Background/Video.js +29 -0
- package/controls/Borders/Border.js +114 -0
- package/controls/Borders/BorderColor.js +25 -0
- package/controls/Borders/BorderRadius.js +19 -0
- package/controls/Borders/BorderStyle.js +26 -0
- package/controls/Borders/BorderWidth.js +20 -0
- package/controls/Borders/Borders.js +69 -0
- package/controls/Borders/BordersContainer.js +90 -0
- package/controls/Borders/BordersInput.js +107 -0
- package/controls/Borders/Outline.js +100 -0
- package/controls/Borders/OutlineColor.js +25 -0
- package/controls/Borders/OutlineOffset.js +13 -0
- package/controls/Borders/OutlineStyle.js +26 -0
- package/controls/Borders/OutlineWidth.js +13 -0
- package/controls/Effects/BackdropBlur.js +11 -0
- package/controls/Effects/Blur.js +11 -0
- package/controls/Effects/BoxShadow.js +15 -0
- package/controls/Effects/Brightness.js +11 -0
- package/controls/Effects/DropShadow.js +14 -0
- package/controls/Effects/Effects.js +71 -0
- package/controls/Effects/Filters.js +114 -0
- package/controls/Effects/Opacity.js +14 -0
- package/controls/Effects/Saturate.js +11 -0
- package/controls/Layout/AspectRatio.js +53 -0
- package/controls/Layout/Container.js +24 -0
- package/controls/Layout/Hidden.js +9 -0
- package/controls/Layout/Inset.js +15 -0
- package/controls/Layout/Isolation.js +25 -0
- package/controls/Layout/Layout.js +38 -0
- package/controls/Layout/Overflow.js +33 -0
- package/controls/Layout/Position.js +37 -0
- package/controls/Layout/TopRightBottomLeft.js +90 -0
- package/controls/Layout/Visibility.js +25 -0
- package/controls/Layout/ZIndex.js +36 -0
- package/controls/Overlay/Color.js +52 -0
- package/controls/Overlay/Gradient.js +298 -0
- package/controls/Overlay/Image.js +226 -0
- package/controls/Overlay/Overlay.js +66 -0
- package/controls/Sizing/Height.js +18 -0
- package/controls/Sizing/MaxHeight.js +17 -0
- package/controls/Sizing/MaxWidth.js +17 -0
- package/controls/Sizing/MinHeight.js +18 -0
- package/controls/Sizing/MinWidth.js +18 -0
- package/controls/Sizing/Sizing.js +66 -0
- package/controls/Sizing/SizingContainer.js +122 -0
- package/controls/Sizing/SizingImage.js +75 -0
- package/controls/Sizing/SizingInput.js +71 -0
- package/controls/Sizing/SizingSVG.js +74 -0
- package/controls/Sizing/Width.js +18 -0
- package/controls/Spacing/Margin.js +17 -0
- package/controls/Spacing/Padding.js +17 -0
- package/controls/Spacing/Spacing.js +23 -0
- package/controls/Spacing/SpacingButton.js +42 -0
- package/controls/Spacing/SpacingContainer.js +32 -0
- package/controls/Spacing/SpacingInput.js +42 -0
- package/controls/Transforms/Rotate.js +13 -0
- package/controls/Transforms/Scale.js +13 -0
- package/controls/Transforms/Skew.js +25 -0
- package/controls/Transforms/TransformOrigin.js +12 -0
- package/controls/Transforms/Transforms.js +98 -0
- package/controls/Transforms/Translate.js +26 -0
- package/controls/Transitions/Delay.js +13 -0
- package/controls/Transitions/Duration.js +13 -0
- package/controls/Transitions/Property.js +42 -0
- package/controls/Transitions/TimingFunction.js +44 -0
- package/controls/Transitions/Transitions.js +20 -0
- package/controls/alignment/AlignContent.js +48 -0
- package/controls/alignment/AlignItems.js +64 -0
- package/controls/alignment/AlignSelf.js +34 -0
- package/controls/alignment/JustifyContent.js +44 -0
- package/controls/alignment/JustifyItems.js +32 -0
- package/controls/alignment/JustifySelf.js +34 -0
- package/controls/core/CSSClasses.js +11 -0
- package/controls/core/ControlType.js +25 -0
- package/controls/core/HTMLTag.js +80 -0
- package/controls/core/HoverGroup.js +38 -0
- package/controls/core/ID.js +12 -0
- package/controls/core/Image.js +95 -0
- package/controls/core/MenuItem.js +187 -0
- package/controls/core/ObjectFit.js +32 -0
- package/controls/core/ObjectPosition.js +65 -0
- package/controls/grid-flex/ActAsGridOrFlexItem.js +54 -0
- package/controls/grid-flex/ColEnd.js +28 -0
- package/controls/grid-flex/ColStart.js +27 -0
- package/controls/grid-flex/Columns.js +38 -0
- package/controls/grid-flex/FlexDirection.js +27 -0
- package/controls/grid-flex/FlexItem.js +106 -0
- package/controls/grid-flex/GridItem.js +41 -0
- package/controls/grid-flex/Order.js +45 -0
- package/controls/grid-flex/RowEnd.js +28 -0
- package/controls/grid-flex/RowStart.js +27 -0
- package/controls/grid-flex/Rows.js +38 -0
- package/controls/index.js +187 -0
- package/controls/interactive/ButtonFontAndTextStyles.js +208 -0
- package/controls/interactive/Filter.js +54 -0
- package/controls/interactive/InputFontAndTextStyles.js +156 -0
- package/controls/interactive/Link.js +13 -0
- package/controls/typography/HeadingColor.js +112 -0
- package/controls/typography/TextColor.js +51 -0
- package/controls/typography/TextDecoration.js +99 -0
- package/controls/typography/TextFontsAndTextStyles.js +243 -0
- package/controls/typography/TextSimple.js +55 -0
- package/controls/typography/TextStyles.js +55 -0
- package/controls/typography/Typography.js +13 -0
- package/index.js +19 -0
- package/package.json +55 -0
- package/properties/BackgroundType.js +18 -0
- package/properties/ButtonSize.js +19 -0
- package/properties/ContainerHeights.js +23 -0
- package/properties/ContainerWidths.js +27 -0
- package/properties/FontWeight.js +16 -0
- package/properties/GradientDirection.js +39 -0
- package/properties/LetterSpacing.js +13 -0
- package/properties/LineHeight.js +13 -0
- package/properties/RevealAnimations.js +12 -0
- package/properties/Slider.js +10 -0
- package/properties/TextAlign.js +23 -0
- package/properties/TransformOrigins.js +43 -0
- package/properties/TransitionNames.js +20 -0
- package/properties/index.js +13 -0
- package/shared-hooks/animations/globalAnimations.js +141 -0
- package/shared-hooks/animations/globalReveal.js +48 -0
- package/shared-hooks/background/globalBackground.js +306 -0
- package/shared-hooks/background/globalBgImageFetchPriority.js +34 -0
- package/shared-hooks/borders/globalBorders.js +85 -0
- package/shared-hooks/borders/globalOutline.js +39 -0
- package/shared-hooks/core/addPrefixToTailwindClasses.js +24 -0
- package/shared-hooks/core/advancedClasses.js +5 -0
- package/shared-hooks/core/classnames.js +92 -0
- package/shared-hooks/core/getHoverPrefix.js +21 -0
- package/shared-hooks/core/globalHTMLTag.js +17 -0
- package/shared-hooks/core/injectPrefixOnDarkModeColors.js +6 -0
- package/shared-hooks/effects/globalEffects.js +45 -0
- package/shared-hooks/effects/globalFilters.js +80 -0
- package/shared-hooks/effects/globalOverlay.js +166 -0
- package/shared-hooks/interactive/globalFilter.js +24 -0
- package/shared-hooks/interactive/globalLink.js +23 -0
- package/shared-hooks/layout/globalActAsGridOrFlexItem.js +66 -0
- package/shared-hooks/layout/globalLayout.js +50 -0
- package/shared-hooks/navigation/globalMenuItem.js +35 -0
- package/shared-hooks/navigation/globalNavItems.js +60 -0
- package/shared-hooks/navigation/globalNavTitle.js +23 -0
- package/shared-hooks/sizing/aspectRatioClasses.js +20 -0
- package/shared-hooks/sizing/globalSizing.js +19 -0
- package/shared-hooks/sizing/globalSizingContainer.js +40 -0
- package/shared-hooks/sizing/objectClasses.js +9 -0
- package/shared-hooks/spacing/globalSpacing.js +13 -0
- package/shared-hooks/spacing/globalSpacingMargin.js +11 -0
- package/shared-hooks/spacing/globalSpacingPadding.js +11 -0
- package/shared-hooks/transforms/globalTransforms.js +78 -0
- package/shared-hooks/transitions/getAlpineTransitionAttributesDesktop.js +111 -0
- package/shared-hooks/transitions/getAlpineTransitionAttributesMobile.js +110 -0
- package/shared-hooks/transitions/globalTransitions.js +48 -0
- package/shared-hooks/typography/globalButtonFontAndTextStyles.js +65 -0
- package/shared-hooks/typography/globalHeadingColor.js +69 -0
- package/shared-hooks/typography/globalInputFontAndTextStyles.js +40 -0
- package/shared-hooks/typography/globalTextFontsAndTextStyles.js +47 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
const globalBgColor = (app, args = {}) => {
|
|
2
|
+
const {
|
|
3
|
+
globalControlTypeBg: controlType,
|
|
4
|
+
globalBgColor: color,
|
|
5
|
+
globalBgColorOpacity: opacity,
|
|
6
|
+
globalBgColorEnd: colorEnd,
|
|
7
|
+
globalBgColorOpacityEnd: opacityEnd,
|
|
8
|
+
} = app.props;
|
|
9
|
+
|
|
10
|
+
const wantsPeer = args?.peer || false;
|
|
11
|
+
const wantsActive = args?.active || false;
|
|
12
|
+
const wantsFocus = args?.focus || false;
|
|
13
|
+
|
|
14
|
+
const classes = classnames([color, opacity, `dark:${opacity}`]);
|
|
15
|
+
|
|
16
|
+
if (controlType == "hover") {
|
|
17
|
+
if (wantsPeer) {
|
|
18
|
+
classes.add([
|
|
19
|
+
colorEnd.replace(/hover:/g, "peer-hover:"),
|
|
20
|
+
opacityEnd.replace(/hover:/g, "peer-hover:"),
|
|
21
|
+
`dark:${opacityEnd.replace(/hover:/g, "peer-hover:")}`,
|
|
22
|
+
]);
|
|
23
|
+
} else {
|
|
24
|
+
classes.add([colorEnd, opacityEnd, `dark:${opacityEnd}`]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (wantsActive) {
|
|
28
|
+
classes.add([
|
|
29
|
+
colorEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
30
|
+
opacityEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
31
|
+
`dark:${opacityEnd.replace(/hover:/g, "data-[active=true]:")}`,
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (wantsFocus) {
|
|
36
|
+
classes.add([
|
|
37
|
+
colorEnd.replace(/hover:/g, "focus:"),
|
|
38
|
+
opacityEnd.replace(/hover:/g, "focus:"),
|
|
39
|
+
`dark:${opacityEnd.replace(/hover:/g, "focus:")}`,
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return classes.toString();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const globalBgGradient = (app, args) => {
|
|
48
|
+
const {
|
|
49
|
+
globalControlTypeBg: controlType,
|
|
50
|
+
globalBgGradientDirection: direction,
|
|
51
|
+
globalBgGradientDirectionEnd: directionEnd,
|
|
52
|
+
|
|
53
|
+
globalBgGradientFromColor: fromColor,
|
|
54
|
+
globalBgGradientFromOpacity: fromOpacity,
|
|
55
|
+
globalBgGradientFromPosition: fromPosition,
|
|
56
|
+
|
|
57
|
+
globalBgGradientViaEnabled: viaEnabled,
|
|
58
|
+
globalBgGradientViaColor: viaColor,
|
|
59
|
+
globalBgGradientViaOpacity: viaOpacity,
|
|
60
|
+
globalBgGradientViaPosition: viaPosition,
|
|
61
|
+
|
|
62
|
+
globalBgGradientToColor: toColor,
|
|
63
|
+
globalBgGradientToOpacity: toOpacity,
|
|
64
|
+
globalBgGradientToPosition: toPosition,
|
|
65
|
+
|
|
66
|
+
globalBgGradientFromColorEnd: fromColorEnd,
|
|
67
|
+
globalBgGradientFromOpacityEnd: fromOpacityEnd,
|
|
68
|
+
|
|
69
|
+
globalBgGradientViaEnabledEnd: viaEnabledEnd,
|
|
70
|
+
globalBgGradientViaColorEnd: viaColorEnd,
|
|
71
|
+
globalBgGradientViaOpacityEnd: viaOpacityEnd,
|
|
72
|
+
|
|
73
|
+
globalBgGradientToColorEnd: toColorEnd,
|
|
74
|
+
globalBgGradientToOpacityEnd: toOpacityEnd,
|
|
75
|
+
} = app.props;
|
|
76
|
+
|
|
77
|
+
const wantsPeer = args?.peer || false;
|
|
78
|
+
const wantsActive = args?.active || false;
|
|
79
|
+
const wantsFocus = args?.focus || false;
|
|
80
|
+
const hasPrefix = (args?.prefix && args?.prefixCallback) || false;
|
|
81
|
+
const prefixCallback = args?.prefixCallback || (() => {});
|
|
82
|
+
|
|
83
|
+
const classes = classnames([
|
|
84
|
+
direction,
|
|
85
|
+
fromColor,
|
|
86
|
+
fromOpacity,
|
|
87
|
+
fromPosition,
|
|
88
|
+
toColor,
|
|
89
|
+
toOpacity,
|
|
90
|
+
toPosition,
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
if (viaEnabled == "true") {
|
|
94
|
+
classes.add([viaColor, viaOpacity, viaPosition]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (controlType == "hover") {
|
|
98
|
+
if (wantsPeer) {
|
|
99
|
+
classes.add([
|
|
100
|
+
directionEnd.replace(/hover:/g, "peer-hover:"),
|
|
101
|
+
fromColorEnd.replace(/hover:/g, "peer-hover:"),
|
|
102
|
+
fromOpacityEnd.replace(/hover:/g, "peer-hover:"),
|
|
103
|
+
toColorEnd.replace(/hover:/g, "peer-hover:"),
|
|
104
|
+
toOpacityEnd.replace(/hover:/g, "peer-hover:"),
|
|
105
|
+
]);
|
|
106
|
+
} else if (hasPrefix) {
|
|
107
|
+
classes.add([
|
|
108
|
+
prefixCallback(
|
|
109
|
+
directionEnd.replace(/hover:/g, ""),
|
|
110
|
+
args.prefix
|
|
111
|
+
),
|
|
112
|
+
prefixCallback(
|
|
113
|
+
fromColorEnd.replace(/hover:/g, ""),
|
|
114
|
+
args.prefix
|
|
115
|
+
),
|
|
116
|
+
prefixCallback(
|
|
117
|
+
fromOpacityEnd.replace(/hover:/g, ""),
|
|
118
|
+
args.prefix
|
|
119
|
+
),
|
|
120
|
+
prefixCallback(toColorEnd.replace(/hover:/g, ""), args.prefix),
|
|
121
|
+
prefixCallback(
|
|
122
|
+
toOpacityEnd.replace(/hover:/g, ""),
|
|
123
|
+
args.prefix
|
|
124
|
+
),
|
|
125
|
+
]);
|
|
126
|
+
} else {
|
|
127
|
+
classes.add([
|
|
128
|
+
directionEnd,
|
|
129
|
+
fromColorEnd,
|
|
130
|
+
fromOpacityEnd,
|
|
131
|
+
toColorEnd,
|
|
132
|
+
toOpacityEnd,
|
|
133
|
+
]);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (wantsActive) {
|
|
137
|
+
classes.add([
|
|
138
|
+
directionEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
139
|
+
fromColorEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
140
|
+
fromOpacityEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
141
|
+
toColorEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
142
|
+
toOpacityEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (wantsFocus) {
|
|
147
|
+
classes.add([
|
|
148
|
+
directionEnd.replace(/hover:/g, "focus:"),
|
|
149
|
+
fromColorEnd.replace(/hover:/g, "focus:"),
|
|
150
|
+
fromOpacityEnd.replace(/hover:/g, "focus:"),
|
|
151
|
+
toColorEnd.replace(/hover:/g, "focus:"),
|
|
152
|
+
toOpacityEnd.replace(/hover:/g, "focus:"),
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (viaEnabledEnd == "true") {
|
|
157
|
+
if (wantsPeer) {
|
|
158
|
+
classes.add([
|
|
159
|
+
viaColorEnd.replace(/hover:/g, "peer-hover:"),
|
|
160
|
+
viaOpacityEnd.replace(/hover:/g, "peer-hover:"),
|
|
161
|
+
]);
|
|
162
|
+
} else if (hasPrefix) {
|
|
163
|
+
classes.add([
|
|
164
|
+
prefixCallback(
|
|
165
|
+
viaColorEnd.replace(/hover:/g, ""),
|
|
166
|
+
args.prefix
|
|
167
|
+
),
|
|
168
|
+
prefixCallback(
|
|
169
|
+
viaOpacityEnd.replace(/hover:/g, ""),
|
|
170
|
+
args.prefix
|
|
171
|
+
),
|
|
172
|
+
]);
|
|
173
|
+
} else {
|
|
174
|
+
classes.add([viaColorEnd, viaOpacityEnd]);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (wantsActive) {
|
|
178
|
+
classes.add([
|
|
179
|
+
viaColorEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
180
|
+
viaOpacityEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
181
|
+
]);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (wantsFocus) {
|
|
185
|
+
classes.add([
|
|
186
|
+
viaColorEnd.replace(/hover:/g, "focus:"),
|
|
187
|
+
viaOpacityEnd.replace(/hover:/g, "focus:"),
|
|
188
|
+
]);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return classes.toString();
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const globalBgImage = (app, args) => {
|
|
197
|
+
const {
|
|
198
|
+
globalControlTypeBg: controlType,
|
|
199
|
+
globalBgImageType: type,
|
|
200
|
+
globalBgImageCmsField: cmsField,
|
|
201
|
+
globalBgImageResource: resource,
|
|
202
|
+
globalBgImagePosition: position,
|
|
203
|
+
globalBgImageSize: size,
|
|
204
|
+
globalBgImageRepeat: repeat,
|
|
205
|
+
|
|
206
|
+
globalBgImageResourceEnd: resourceEnd,
|
|
207
|
+
globalBgImagePositionEnd: positionEnd,
|
|
208
|
+
globalBgImageSizeEnd: sizeEnd,
|
|
209
|
+
globalBgImageRepeatEnd: repeatEnd,
|
|
210
|
+
} = app.props;
|
|
211
|
+
|
|
212
|
+
const isCms = type === "cms";
|
|
213
|
+
if (isCms) {
|
|
214
|
+
return classnames([size, repeat, position]).toString();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const wantsPeer = args?.peer || false;
|
|
218
|
+
const wantsActive = args?.active || false;
|
|
219
|
+
const wantsFocus = args?.focus || false;
|
|
220
|
+
const hasPrefix = (args?.prefix && args?.prefixCallback) || false;
|
|
221
|
+
const prefixCallback = args?.prefixCallback || (() => {});
|
|
222
|
+
|
|
223
|
+
const classes = classnames().add([
|
|
224
|
+
`bg-[url(${resource?.image})]`,
|
|
225
|
+
size,
|
|
226
|
+
repeat,
|
|
227
|
+
position,
|
|
228
|
+
]);
|
|
229
|
+
|
|
230
|
+
if (controlType == "hover") {
|
|
231
|
+
if (wantsPeer) {
|
|
232
|
+
classes.add([
|
|
233
|
+
`peer-hover:bg-[url(${resourceEnd?.image})]`,
|
|
234
|
+
sizeEnd.replace(/hover:/g, "peer-hover:"),
|
|
235
|
+
repeatEnd.replace(/hover:/g, "peer-hover:"),
|
|
236
|
+
positionEnd.replace(/hover:/g, "peer-hover:"),
|
|
237
|
+
]);
|
|
238
|
+
} else if (hasPrefix) {
|
|
239
|
+
classes.add([
|
|
240
|
+
prefixCallback(`bg-[url(${resourceEnd?.image})]`, args.prefix),
|
|
241
|
+
prefixCallback(sizeEnd.replace(/hover:/g, ""), args.prefix),
|
|
242
|
+
prefixCallback(repeatEnd.replace(/hover:/g, ""), args.prefix),
|
|
243
|
+
prefixCallback(positionEnd.replace(/hover:/g, ""), args.prefix),
|
|
244
|
+
]);
|
|
245
|
+
} else {
|
|
246
|
+
classes.add([
|
|
247
|
+
`hover:bg-[url(${resourceEnd?.image})]`,
|
|
248
|
+
sizeEnd,
|
|
249
|
+
repeatEnd,
|
|
250
|
+
positionEnd,
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (wantsActive) {
|
|
255
|
+
classes.add([
|
|
256
|
+
`data-[active=true]:bg-[url(${resourceEnd?.image})]`,
|
|
257
|
+
sizeEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
258
|
+
repeatEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
259
|
+
positionEnd.replace(/hover:/g, "data-[active=true]:"),
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (wantsFocus) {
|
|
264
|
+
classes.add([
|
|
265
|
+
`focus:bg-[url(${resourceEnd?.image})]`,
|
|
266
|
+
sizeEnd.replace(/hover:/g, "focus:"),
|
|
267
|
+
repeatEnd.replace(/hover:/g, "focus:"),
|
|
268
|
+
positionEnd.replace(/hover:/g, "focus:"),
|
|
269
|
+
]);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return classes.toString();
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const globalBgVideoThumbnail = (app, args) => {
|
|
277
|
+
const { globalBgVideo: video } = app.props;
|
|
278
|
+
|
|
279
|
+
return classnames([
|
|
280
|
+
`bg-[url(${video?.image})] bg-cover bg-center`,
|
|
281
|
+
]).toString();
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const globalBackground = (app, args = {}) => {
|
|
285
|
+
const { globalControlTypeBg: controlType, globalBgType: type } = app.props;
|
|
286
|
+
|
|
287
|
+
if (controlType == "none") {
|
|
288
|
+
return "";
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
switch (type) {
|
|
292
|
+
case "color":
|
|
293
|
+
return globalBgColor(app, args);
|
|
294
|
+
case "gradient":
|
|
295
|
+
return globalBgGradient(app, args);
|
|
296
|
+
case "image":
|
|
297
|
+
return globalBgImage(app, args);
|
|
298
|
+
case "video":
|
|
299
|
+
return globalBgVideoThumbnail(app, args);
|
|
300
|
+
case "none":
|
|
301
|
+
return "";
|
|
302
|
+
default:
|
|
303
|
+
console.error("Invalid background type:", type);
|
|
304
|
+
return "";
|
|
305
|
+
}
|
|
306
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const globalBgImageFetchPriority = (rw) => {
|
|
2
|
+
const {
|
|
3
|
+
globalBgImageFetchPriority,
|
|
4
|
+
globalBgType,
|
|
5
|
+
globalBgImageResource,
|
|
6
|
+
globalBgImageResourceEnd,
|
|
7
|
+
} = rw.props;
|
|
8
|
+
|
|
9
|
+
if (globalBgType != "image") {
|
|
10
|
+
return {
|
|
11
|
+
wantsFetchPriority: false,
|
|
12
|
+
linkElement: "",
|
|
13
|
+
linkElementEnd: "",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const globalBgImageFetchPriorityEnabled = globalBgImageFetchPriority != "auto";
|
|
18
|
+
|
|
19
|
+
let globalBgImageFetchPriorityLinkElement = "";
|
|
20
|
+
if (globalBgImageResource?.image) {
|
|
21
|
+
globalBgImageFetchPriorityLinkElement = `<link rel='preload' href='${globalBgImageResource?.image}' as='image' fetchpriority='${globalBgImageFetchPriority}' />`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let globalBgImageFetchPriorityLinkElementEnd = "";
|
|
25
|
+
if (globalBgImageResourceEnd?.image) {
|
|
26
|
+
globalBgImageFetchPriorityLinkElementEnd = `<link rel='preload' href='${globalBgImageResourceEnd?.image}' as='image' fetchpriority='${globalBgImageFetchPriority}' />`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
globalBgImageFetchPriorityEnabled,
|
|
31
|
+
globalBgImageFetchPriorityLinkElement,
|
|
32
|
+
globalBgImageFetchPriorityLinkElementEnd,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const globalBorders = (app, args = {}) => {
|
|
2
|
+
const {
|
|
3
|
+
globalControlTypeBorders: type,
|
|
4
|
+
globalBordersColor: color,
|
|
5
|
+
globalBordersColorOpacity: colorOpacity,
|
|
6
|
+
globalBordersWidth: width,
|
|
7
|
+
globalBordersRadius: radius,
|
|
8
|
+
globalBordersStyle: style,
|
|
9
|
+
globalBordersColorEnd: colorEnd,
|
|
10
|
+
globalBordersColorOpacityEnd: colorOpacityEnd,
|
|
11
|
+
globalBordersWidthEnd: widthEnd,
|
|
12
|
+
globalBordersRadiusEnd: radiusEnd,
|
|
13
|
+
globalBordersStyleEnd: styleEnd,
|
|
14
|
+
} = app.props;
|
|
15
|
+
|
|
16
|
+
const classes = [];
|
|
17
|
+
|
|
18
|
+
const { node } = app;
|
|
19
|
+
node.isContainer = args.isContainer || false;
|
|
20
|
+
const wantsActive = args.active || false;
|
|
21
|
+
const wantsFocus = args.focus || false;
|
|
22
|
+
|
|
23
|
+
if (type == 'none') {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
classes.push(
|
|
28
|
+
width,
|
|
29
|
+
style,
|
|
30
|
+
radius,
|
|
31
|
+
color.split(' ')
|
|
32
|
+
.filter(Boolean) // Remove empty strings
|
|
33
|
+
.map(c => `${c.trim()}/${colorOpacity}`)
|
|
34
|
+
.join(' '),
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const prefix = getHoverPrefix(node, 'background', 'self');
|
|
38
|
+
if (type == 'hover') {
|
|
39
|
+
classes.push(
|
|
40
|
+
widthEnd,
|
|
41
|
+
radiusEnd,
|
|
42
|
+
`${prefix}:${styleEnd}`,
|
|
43
|
+
colorEnd.split(' ')
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.map(c => `${prefix}:${c.trim()}/${colorOpacityEnd}`)
|
|
46
|
+
.join(' '),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (wantsActive) {
|
|
51
|
+
const endColor = type == 'hover' ? colorEnd : color;
|
|
52
|
+
const endWidth = type == 'hover' ? widthEnd : width;
|
|
53
|
+
const endRadius = type == 'hover' ? radiusEnd : radius;
|
|
54
|
+
const endStyle = type == 'hover' ? styleEnd : style;
|
|
55
|
+
|
|
56
|
+
classes.push(
|
|
57
|
+
endWidth.replace(/hover/g, 'data-[active=true]'),
|
|
58
|
+
endRadius.replace(/hover/g, 'data-[active=true]'),
|
|
59
|
+
`data-[active=true]:${endStyle}`,
|
|
60
|
+
endColor.split(' ')
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.map(c => `data-[active=true]:${c.trim()}/${colorOpacityEnd}`)
|
|
63
|
+
.join(' '),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (wantsFocus) {
|
|
68
|
+
const endColor = type == 'hover' ? colorEnd : color;
|
|
69
|
+
const endWidth = type == 'hover' ? widthEnd : width;
|
|
70
|
+
const endRadius = type == 'hover' ? radiusEnd : radius;
|
|
71
|
+
const endStyle = type == 'hover' ? styleEnd : style;
|
|
72
|
+
|
|
73
|
+
classes.push(
|
|
74
|
+
endWidth.replace(/hover/g, 'focus'),
|
|
75
|
+
endRadius.replace(/hover/g, 'focus'),
|
|
76
|
+
`${prefix.replace(/hover/g, "focus")}:${endStyle}`,
|
|
77
|
+
endColor.split(' ')
|
|
78
|
+
.filter(Boolean)
|
|
79
|
+
.map(c => `${prefix.replace(/hover/g, "focus")}:${c.trim()}/${colorOpacityEnd}`)
|
|
80
|
+
.join(' '),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return classnames(classes).toString();
|
|
85
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const globalOutline = (rw) => {
|
|
2
|
+
const {
|
|
3
|
+
globalControlTypeOutline,
|
|
4
|
+
globalOutlineStyle,
|
|
5
|
+
globalOutlineColor,
|
|
6
|
+
globalOutlineColorOpacity,
|
|
7
|
+
globalOutlineWidth,
|
|
8
|
+
globalOutlineOffset,
|
|
9
|
+
|
|
10
|
+
globalOutlineColorFocus,
|
|
11
|
+
globalOutlineColorOpacityFocus,
|
|
12
|
+
globalOutlineWidthFocus,
|
|
13
|
+
globalOutlineOffsetFocus,
|
|
14
|
+
} = rw.props;
|
|
15
|
+
|
|
16
|
+
const classes = classnames();
|
|
17
|
+
if (globalControlTypeOutline == 'none') {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (globalControlTypeOutline != 'none') {
|
|
22
|
+
classes.add([
|
|
23
|
+
`${globalOutlineStyle}`,
|
|
24
|
+
`${globalOutlineColor}/${globalOutlineColorOpacity}`,
|
|
25
|
+
globalOutlineWidth,
|
|
26
|
+
globalOutlineOffset,
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (globalControlTypeOutline == 'focus') {
|
|
31
|
+
classes.add([
|
|
32
|
+
`${globalOutlineColorFocus}/${globalOutlineColorOpacityFocus}`,
|
|
33
|
+
globalOutlineWidthFocus,
|
|
34
|
+
globalOutlineOffsetFocus,
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return classes.toString();
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a prefix (like "hover:" or "group-hover:") to Tailwind classes.
|
|
3
|
+
* Handles classes that already have modifiers by inserting the prefix after the existing modifier.
|
|
4
|
+
*/
|
|
5
|
+
function addPrefixToTailwindClasses(classString, prefix) {
|
|
6
|
+
return classString
|
|
7
|
+
.split(/\s+/)
|
|
8
|
+
.map((cls) => {
|
|
9
|
+
// Remove "hover:" from the class string to avoid duplication
|
|
10
|
+
cls = cls.replace(/hover:/g, "");
|
|
11
|
+
|
|
12
|
+
// If already has prefix after modifier, skip
|
|
13
|
+
if (cls.includes(`${prefix}:`)) return cls;
|
|
14
|
+
// If has modifier (e.g. md:), insert prefix after modifier
|
|
15
|
+
const match = cls.match(/^([a-z0-9]+:)(.+)$/i);
|
|
16
|
+
if (match) {
|
|
17
|
+
return `${match[1]}${prefix}:${match[2]}`;
|
|
18
|
+
}
|
|
19
|
+
// Otherwise, just add prefix at start
|
|
20
|
+
return `${prefix}:${cls}`;
|
|
21
|
+
})
|
|
22
|
+
.join(" ");
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function to manage CSS class names with optional modifiers.
|
|
3
|
+
*
|
|
4
|
+
* @param {string|string[]} [initialClasses=''] - Initial space-separated class names or an array of class names.
|
|
5
|
+
* @returns {Object} An object with methods to manipulate the class names.
|
|
6
|
+
*/
|
|
7
|
+
const classnames = (initialClasses = "") => {
|
|
8
|
+
// Handle both string and array input for initial classes
|
|
9
|
+
let initialClassArray = Array.isArray(initialClasses)
|
|
10
|
+
? initialClasses
|
|
11
|
+
: initialClasses.split(" ").filter(Boolean);
|
|
12
|
+
|
|
13
|
+
let classes = new Set(initialClassArray);
|
|
14
|
+
let currentModifier = "";
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
/**
|
|
18
|
+
* Adds one or more class names.
|
|
19
|
+
*
|
|
20
|
+
* @param {string|string[]} className - A single class name or an array of class names to add.
|
|
21
|
+
* @returns {Object} The classnames instance for chaining.
|
|
22
|
+
*/
|
|
23
|
+
add(className) {
|
|
24
|
+
const classesToAdd = Array.isArray(className)
|
|
25
|
+
? className
|
|
26
|
+
: [className];
|
|
27
|
+
classesToAdd.forEach((cls) => classes.add(cls));
|
|
28
|
+
return this;
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Removes one or more class names.
|
|
32
|
+
*
|
|
33
|
+
* @param {string|string[]} className - A single class name or an array of class names to remove.
|
|
34
|
+
* @returns {Object} The classnames instance for chaining.
|
|
35
|
+
*/
|
|
36
|
+
remove(className) {
|
|
37
|
+
const classesToRemove = Array.isArray(className)
|
|
38
|
+
? className
|
|
39
|
+
: [className];
|
|
40
|
+
classesToRemove.forEach((cls) => classes.delete(cls));
|
|
41
|
+
return this;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Toggles one or more class names.
|
|
45
|
+
*
|
|
46
|
+
* @param {string|string[]} classToToggle - A single class name or an array of class names to toggle.
|
|
47
|
+
* @returns {Object} The classnames instance for chaining.
|
|
48
|
+
*/
|
|
49
|
+
toggle(className) {
|
|
50
|
+
const classesToToggle = Array.isArray(className)
|
|
51
|
+
? className
|
|
52
|
+
: [className];
|
|
53
|
+
classesToToggle.forEach((cls) => {
|
|
54
|
+
classes.has(cls) ? classes.delete(cls) : classes.add(cls);
|
|
55
|
+
});
|
|
56
|
+
return this;
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Sets a CSS modifier (e.g., 'hover', 'focus').
|
|
60
|
+
*
|
|
61
|
+
* @param {string} modifier - The modifier to set, with or without a trailing colon.
|
|
62
|
+
* @returns {Object} The classnames instance for chaining.
|
|
63
|
+
*/
|
|
64
|
+
modifier(modifier) {
|
|
65
|
+
if (!modifier) {
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
currentModifier = modifier.replace(/:$/, "").trim();
|
|
70
|
+
return this;
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Gets the final class string with the current modifier applied.
|
|
74
|
+
*
|
|
75
|
+
* @returns {string} The final class string.
|
|
76
|
+
*/
|
|
77
|
+
getClasses() {
|
|
78
|
+
const classArray = Array.from(classes);
|
|
79
|
+
return currentModifier
|
|
80
|
+
? classArray.map((cls) => `${currentModifier}:${cls}`).join(" ")
|
|
81
|
+
: classArray.filter(Boolean).join(" ");
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Returns the class string when the classnames instance is coerced to a string.
|
|
85
|
+
*
|
|
86
|
+
* @returns {string} The final class string.
|
|
87
|
+
*/
|
|
88
|
+
toString() {
|
|
89
|
+
return this.getClasses();
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const getHoverPrefix = (
|
|
2
|
+
node = {},
|
|
3
|
+
applyTo = "",
|
|
4
|
+
hoverGroup = "self",
|
|
5
|
+
customId = ""
|
|
6
|
+
) => {
|
|
7
|
+
const needsPeerPrefix =
|
|
8
|
+
node.isContainer && ["background", "content"].includes(applyTo);
|
|
9
|
+
|
|
10
|
+
if (hoverGroup === "parent") return `group-hover/${node.parent.id}`;
|
|
11
|
+
if (hoverGroup === "custom") return `group-hover/${customId}`;
|
|
12
|
+
if (needsPeerPrefix && hoverGroup === "self")
|
|
13
|
+
return `group-hover/${node.id}`;
|
|
14
|
+
|
|
15
|
+
return hoverGroup === "self"
|
|
16
|
+
? needsPeerPrefix
|
|
17
|
+
? `peer-hover`
|
|
18
|
+
: "hover"
|
|
19
|
+
: `group-hover/${hoverGroup}`;
|
|
20
|
+
};
|
|
21
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const globalHTMLTag = (app, fallback = "div") => {
|
|
2
|
+
const { globalHTMLTag, globalHTMLTagCustom } = app.props;
|
|
3
|
+
|
|
4
|
+
if (globalHTMLTag === "custom") {
|
|
5
|
+
return globalHTMLTagCustom
|
|
6
|
+
.replace(/</g, "")
|
|
7
|
+
.replace(/>/g, "")
|
|
8
|
+
.replace(/[^a-zA-Z0-9]/g, "");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (globalHTMLTag == "default") {
|
|
12
|
+
return fallback;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return globalHTMLTag || fallback;
|
|
16
|
+
};
|
|
17
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const globalEffects = (app, args = {}) => {
|
|
2
|
+
const {
|
|
3
|
+
globalEffectsApplyTo: applyTo,
|
|
4
|
+
globalControlTypeEffects: type,
|
|
5
|
+
globalHoverGroupEffects: hoverGroup,
|
|
6
|
+
globalHoverGroupCustomIdEffects: customId,
|
|
7
|
+
globalBoxShadow: boxShadow,
|
|
8
|
+
globalOpacity: opacity,
|
|
9
|
+
globalBoxShadowEnd: boxShadowEnd,
|
|
10
|
+
globalOpacityEnd: opacityEnd,
|
|
11
|
+
} = app.props;
|
|
12
|
+
|
|
13
|
+
const { node } = app;
|
|
14
|
+
|
|
15
|
+
node.isContainer = args.isContainer || false;
|
|
16
|
+
const wantsActive = args.active || false;
|
|
17
|
+
const wantsFocus = args.focus || false;
|
|
18
|
+
const prefix = getHoverPrefix(node, applyTo, hoverGroup, customId);
|
|
19
|
+
|
|
20
|
+
const classes = [];
|
|
21
|
+
|
|
22
|
+
if (type != "none") {
|
|
23
|
+
classes.push(boxShadow, opacity);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (type == "hover") {
|
|
27
|
+
classes.push(`${prefix}:${boxShadowEnd}`, `${prefix}:${opacityEnd}`);
|
|
28
|
+
|
|
29
|
+
if (wantsActive) {
|
|
30
|
+
classes.push(
|
|
31
|
+
`data-[active=true]:${boxShadowEnd}`,
|
|
32
|
+
`data-[active=true]:${opacityEnd}`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (wantsFocus) {
|
|
37
|
+
classes.push(
|
|
38
|
+
`${prefix.replace(/hover/g, "focus")}:${boxShadowEnd}`,
|
|
39
|
+
`${prefix.replace(/hover/g, "focus")}:${opacityEnd}`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return classnames(classes).toString();
|
|
45
|
+
};
|