@bettercms-ai/ui 0.12.0 → 0.13.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/dist/{Video-BPXQ-e0c.d.ts → Video-c2HnnOCp.d.ts} +4 -2
- package/dist/blocks.d.ts +1 -1
- package/dist/blocks.js +6 -2
- package/dist/blocks.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/registry.js +6 -2
- package/dist/registry.js.map +1 -1
- package/dist/renderer.js +18 -5
- package/dist/renderer.js.map +1 -1
- package/dist/resolve.js +2 -1
- package/dist/resolve.js.map +1 -1
- package/package.json +4 -3
package/dist/renderer.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
// src/renderer.tsx
|
|
4
|
+
import { splitButtonStyle } from "@bettercms-ai/types";
|
|
5
|
+
|
|
3
6
|
// src/blocks/Heading.tsx
|
|
4
7
|
import { jsx } from "react/jsx-runtime";
|
|
5
8
|
function Heading({
|
|
@@ -555,7 +558,8 @@ function Image({
|
|
|
555
558
|
"data-bcms-field": field,
|
|
556
559
|
"data-bcms-kind": kind
|
|
557
560
|
}) {
|
|
558
|
-
|
|
561
|
+
const sized = typeof width === "number" && width > 0;
|
|
562
|
+
return /* @__PURE__ */ jsxs2("figure", { className: cn(sized ? "max-w-full" : "w-full", className), children: [
|
|
559
563
|
/* @__PURE__ */ jsx4(
|
|
560
564
|
"img",
|
|
561
565
|
{
|
|
@@ -566,7 +570,8 @@ function Image({
|
|
|
566
570
|
sizes,
|
|
567
571
|
"data-bcms-field": field,
|
|
568
572
|
"data-bcms-kind": kind,
|
|
569
|
-
|
|
573
|
+
style: sized ? { width: `${width}px`, maxWidth: "100%", height: "auto" } : void 0,
|
|
574
|
+
className: cn(!sized && "w-full", "h-auto rounded-md object-cover"),
|
|
570
575
|
loading: "lazy"
|
|
571
576
|
}
|
|
572
577
|
),
|
|
@@ -588,6 +593,7 @@ function Button({
|
|
|
588
593
|
newTab = false,
|
|
589
594
|
align = "left",
|
|
590
595
|
className = "",
|
|
596
|
+
style,
|
|
591
597
|
"data-bcms-field": field,
|
|
592
598
|
"data-bcms-kind": kind
|
|
593
599
|
}) {
|
|
@@ -622,6 +628,7 @@ function Button({
|
|
|
622
628
|
...newTab === true ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
623
629
|
"data-bcms-field": field,
|
|
624
630
|
"data-bcms-kind": kind,
|
|
631
|
+
style,
|
|
625
632
|
className: cn(baseStyles, variantStyles[buttonVariantOf(variant)], alignClass, sizeClass, fullClass, className),
|
|
626
633
|
children: [
|
|
627
634
|
icon && /* @__PURE__ */ jsx5("span", { className: "mr-2 inline-flex", dangerouslySetInnerHTML: { __html: buttonIconSvg(icon, "bcms-btn-icon") } }),
|
|
@@ -963,6 +970,11 @@ function blockStyleToReactStyle(style) {
|
|
|
963
970
|
import "react";
|
|
964
971
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
965
972
|
var CONTAINER_TYPES = /* @__PURE__ */ new Set(["columns", "section", "slider", "tabs"]);
|
|
973
|
+
function styleOf(block) {
|
|
974
|
+
if (block.type !== "button") return { wrapper: blockStyleToReactStyle(block.style), paint: {} };
|
|
975
|
+
const { placement, paint } = splitButtonStyle(block.style);
|
|
976
|
+
return { wrapper: blockStyleToReactStyle(placement), paint: paint ? { style: paint } : {} };
|
|
977
|
+
}
|
|
966
978
|
function bindingProps(block, annotate) {
|
|
967
979
|
if (!annotate || !block.id) return {};
|
|
968
980
|
switch (block.type) {
|
|
@@ -993,8 +1005,8 @@ function resolveBlock(block, className, annotate = false) {
|
|
|
993
1005
|
);
|
|
994
1006
|
}
|
|
995
1007
|
const Component = entry.component;
|
|
996
|
-
const blockStyle =
|
|
997
|
-
const el = /* @__PURE__ */ jsx15(Component, { ...block.props, className, ...bindingProps(block, annotate) });
|
|
1008
|
+
const { wrapper: blockStyle, paint } = styleOf(block);
|
|
1009
|
+
const el = /* @__PURE__ */ jsx15(Component, { ...block.props, ...paint, className, ...bindingProps(block, annotate) });
|
|
998
1010
|
return blockStyle ? /* @__PURE__ */ jsx15("div", { style: blockStyle, children: el }) : el;
|
|
999
1011
|
}
|
|
1000
1012
|
function BlockRenderer({
|
|
@@ -1018,11 +1030,12 @@ function BlockRenderer({
|
|
|
1018
1030
|
}
|
|
1019
1031
|
const Component = entry.component;
|
|
1020
1032
|
const containerProps = CONTAINER_TYPES.has(block.type) ? { renderBlock: renderBlock ?? ((child) => resolveBlock(child, void 0, annotate)) } : {};
|
|
1021
|
-
const blockStyle =
|
|
1033
|
+
const { wrapper: blockStyle, paint } = styleOf(block);
|
|
1022
1034
|
const el = /* @__PURE__ */ jsx15(
|
|
1023
1035
|
Component,
|
|
1024
1036
|
{
|
|
1025
1037
|
...block.props,
|
|
1038
|
+
...paint,
|
|
1026
1039
|
className,
|
|
1027
1040
|
...containerProps,
|
|
1028
1041
|
...bindingProps(block, annotate)
|