@frontlit/page-builder 0.1.0-alpha.5 → 0.1.0-alpha.6

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.
@@ -1110,16 +1110,123 @@ var Header3 = createHeading(
1110
1110
  "scroll-m-20 text-2xl font-semibold tracking-normal",
1111
1111
  (theme) => theme?.typography?.header3
1112
1112
  );
1113
- var Image2 = ({
1113
+ var registry = globalThis;
1114
+ function setImageAttributesResolver(resolver) {
1115
+ registry.__frontlitImageResolver = resolver;
1116
+ }
1117
+ function resolveImageAttributes(input) {
1118
+ return registry.__frontlitImageResolver?.(input) ?? null;
1119
+ }
1120
+ var roundedMap = {
1121
+ 0: "rounded-none",
1122
+ 1: "rounded-sm",
1123
+ 2: "rounded",
1124
+ 3: "rounded-md",
1125
+ 4: "rounded-lg",
1126
+ 5: "rounded-xl",
1127
+ 6: "rounded-2xl",
1128
+ 7: "rounded-3xl",
1129
+ 8: "rounded-full"
1130
+ };
1131
+ var objectFitClass = {
1132
+ cover: "object-cover",
1133
+ contain: "object-contain",
1134
+ fill: "object-fill",
1135
+ none: "object-none",
1136
+ "scale-down": "object-scale-down"
1137
+ };
1138
+ var Image2 = (props) => {
1139
+ const {
1140
+ src,
1141
+ alt = "",
1142
+ defaultImage,
1143
+ priority = false,
1144
+ loading = priority ? "eager" : "lazy",
1145
+ sizes,
1146
+ noDefaultImage = false,
1147
+ className = "",
1148
+ classes = "",
1149
+ width = "w-full",
1150
+ height = "h-auto",
1151
+ objectFit = "cover",
1152
+ borderRadius
1153
+ } = props;
1154
+ const source = src || defaultImage;
1155
+ const radiusClass = typeof borderRadius === "number" ? roundedMap[borderRadius] ?? "rounded" : borderRadius;
1156
+ if (!source) {
1157
+ if (noDefaultImage) return null;
1158
+ return /* @__PURE__ */ jsx(
1159
+ "div",
1160
+ {
1161
+ className: cn(
1162
+ "relative aspect-video overflow-hidden bg-muted",
1163
+ width,
1164
+ height,
1165
+ radiusClass,
1166
+ classes,
1167
+ className
1168
+ )
1169
+ }
1170
+ );
1171
+ }
1172
+ const optimized = resolveImageAttributes({ src: source, alt, sizes, priority });
1173
+ return /* @__PURE__ */ jsx(
1174
+ "div",
1175
+ {
1176
+ className: cn(
1177
+ "relative aspect-video overflow-hidden",
1178
+ width,
1179
+ height,
1180
+ radiusClass,
1181
+ classes,
1182
+ className
1183
+ ),
1184
+ children: /* @__PURE__ */ jsx(
1185
+ "img",
1186
+ {
1187
+ src: source,
1188
+ alt,
1189
+ sizes,
1190
+ loading,
1191
+ decoding: "async",
1192
+ fetchPriority: priority ? "high" : void 0,
1193
+ ...optimized,
1194
+ className: cn(
1195
+ "absolute inset-0 h-full w-full",
1196
+ radiusClass,
1197
+ objectFitClass[objectFit]
1198
+ )
1199
+ }
1200
+ )
1201
+ }
1202
+ );
1203
+ };
1204
+ var Image3 = ({
1114
1205
  src,
1115
1206
  alt = "",
1116
1207
  className = "",
1117
1208
  theme,
1209
+ priority = false,
1210
+ sizes,
1118
1211
  ...props
1119
1212
  }) => {
1120
1213
  const cardStyles = theme?.interactives?.card;
1121
1214
  const classes = cn("w-full object-cover", cardStyles?.border?.radius, className);
1122
- return /* @__PURE__ */ jsx("img", { src, alt, className: classes, ...props });
1215
+ const optimized = resolveImageAttributes({ src, alt, sizes, priority });
1216
+ return /* @__PURE__ */ jsx(
1217
+ "img",
1218
+ {
1219
+ src,
1220
+ alt,
1221
+ sizes,
1222
+ loading: priority ? "eager" : "lazy",
1223
+ decoding: "async",
1224
+ fetchPriority: priority ? "high" : void 0,
1225
+ className: classes,
1226
+ ...props,
1227
+ ...optimized
1228
+ }
1229
+ );
1123
1230
  };
1124
1231
  var Input = React7.forwardRef(
1125
1232
  ({ className, type, ...props }, ref) => {
@@ -3413,6 +3520,6 @@ var TooltipContent = React7.forwardRef(({ className, sideOffset = 6, theme: prov
3413
3520
  });
3414
3521
  TooltipContent.displayName = TooltipPrimitive.Content.displayName;
3415
3522
 
3416
- export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge2 as Badge, Button, Button2, Caption, Checkbox, CodeSnippet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Display, Drawer, DropdownMenu, DropdownMenuArrow, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Header1, Header2, Header3, Header4, Image2 as Image, Input2 as Input, Label3 as Label, Link, PageCard, PageCardContent, PageCardHeader, PageCardImage, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, Preheader, RadioGroup2 as RadioGroup, RadioGroupItem, Section, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Subheader1, Subheader2, Switch, Switch2, TAILWIND_TEXT_PX, Text1, Text2, Textarea, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, cn, createHeading, fluidFontSize, themes };
3417
- //# sourceMappingURL=chunk-J7Z4UW45.js.map
3418
- //# sourceMappingURL=chunk-J7Z4UW45.js.map
3523
+ export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge2 as Badge, Button, Button2, Caption, Checkbox, CodeSnippet, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Display, Drawer, DropdownMenu, DropdownMenuArrow, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Header1, Header2, Header3, Header4, Image2 as Image, Image3 as Image2, Input2 as Input, Label3 as Label, Link, PageCard, PageCardContent, PageCardHeader, PageCardImage, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, Preheader, RadioGroup2 as RadioGroup, RadioGroupItem, Section, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Subheader1, Subheader2, Switch, Switch2, TAILWIND_TEXT_PX, Text1, Text2, Textarea, Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, cn, createHeading, fluidFontSize, resolveImageAttributes, roundedMap, setImageAttributesResolver, themes };
3524
+ //# sourceMappingURL=chunk-OEQJQ4OA.js.map
3525
+ //# sourceMappingURL=chunk-OEQJQ4OA.js.map