@mission-studio/puck 1.0.20 → 1.0.21
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/{chunk-X6VGLL5Y.mjs → chunk-MWW5LYLN.mjs} +182 -222
- package/dist/{chunk-A2J2E524.mjs → chunk-WFLVAZV2.mjs} +67 -3
- package/dist/config/server.js +166 -181
- package/dist/config/server.mjs +50 -25
- package/dist/config-entry.js +53 -31
- package/dist/config-entry.mjs +5 -5
- package/dist/index.js +53 -31
- package/dist/index.mjs +5 -5
- package/dist/renderer.d.mts +9 -4
- package/dist/renderer.d.ts +9 -4
- package/dist/renderer.js +53 -31
- package/dist/renderer.mjs +5 -5
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getHeadingStyle
|
|
3
|
-
|
|
2
|
+
getHeadingStyle,
|
|
3
|
+
getParagraphStyle
|
|
4
|
+
} from "./chunk-MWW5LYLN.mjs";
|
|
4
5
|
import {
|
|
5
6
|
useEntries,
|
|
6
7
|
useTheme
|
|
@@ -73,6 +74,69 @@ function Heading({
|
|
|
73
74
|
return /* @__PURE__ */ jsx(Tag, { id, style, children: resolvedText });
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
// components/page/next/Paragraph.tsx
|
|
78
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
79
|
+
function isThemeableValue2(value) {
|
|
80
|
+
return typeof value === "object" && value !== null && "useTheme" in value;
|
|
81
|
+
}
|
|
82
|
+
function isEntryBoundValue2(value) {
|
|
83
|
+
return typeof value === "object" && value !== null && "useEntry" in value;
|
|
84
|
+
}
|
|
85
|
+
function Paragraph({
|
|
86
|
+
text,
|
|
87
|
+
size = "base",
|
|
88
|
+
weight = "normal",
|
|
89
|
+
color,
|
|
90
|
+
align = "left",
|
|
91
|
+
lineHeight = "normal",
|
|
92
|
+
maxWidth,
|
|
93
|
+
id
|
|
94
|
+
}) {
|
|
95
|
+
const { resolveColor } = useTheme();
|
|
96
|
+
const { getEntryValue } = useEntries();
|
|
97
|
+
const resolvedText = (() => {
|
|
98
|
+
if (!text) return "";
|
|
99
|
+
if (typeof text === "string") return text;
|
|
100
|
+
if (isEntryBoundValue2(text)) {
|
|
101
|
+
if (text.useEntry) {
|
|
102
|
+
return String(getEntryValue(text.entryName, text.fieldKey) ?? "");
|
|
103
|
+
}
|
|
104
|
+
return text.value;
|
|
105
|
+
}
|
|
106
|
+
return "";
|
|
107
|
+
})();
|
|
108
|
+
const resolvedColor = (() => {
|
|
109
|
+
if (!color)
|
|
110
|
+
return hexToRgba(
|
|
111
|
+
resolveColor("foreground").color,
|
|
112
|
+
resolveColor("foreground").opacity
|
|
113
|
+
);
|
|
114
|
+
if (typeof color === "string") return color;
|
|
115
|
+
if (isThemeableValue2(color)) {
|
|
116
|
+
return color.useTheme ? hexToRgba(
|
|
117
|
+
resolveColor(color.themeKey).color,
|
|
118
|
+
resolveColor(color.themeKey).opacity
|
|
119
|
+
) : hexToRgba(color.value.color, color.value.opacity);
|
|
120
|
+
}
|
|
121
|
+
if ("color" in color) return hexToRgba(color.color, color.opacity);
|
|
122
|
+
return hexToRgba(
|
|
123
|
+
resolveColor("foreground").color,
|
|
124
|
+
resolveColor("foreground").opacity
|
|
125
|
+
);
|
|
126
|
+
})();
|
|
127
|
+
const style = getParagraphStyle({
|
|
128
|
+
size,
|
|
129
|
+
weight,
|
|
130
|
+
color: resolvedColor,
|
|
131
|
+
align,
|
|
132
|
+
lineHeight,
|
|
133
|
+
maxWidth
|
|
134
|
+
});
|
|
135
|
+
if (!resolvedText) return null;
|
|
136
|
+
return /* @__PURE__ */ jsx2("p", { id, style, children: resolvedText });
|
|
137
|
+
}
|
|
138
|
+
|
|
76
139
|
export {
|
|
77
|
-
Heading
|
|
140
|
+
Heading,
|
|
141
|
+
Paragraph
|
|
78
142
|
};
|