@puckeditor/plugin-ai 0.9.0-canary.51cc139e → 0.9.0-canary.53ee4e95
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/index.js +298 -303
- package/dist/index.mjs +174 -179
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1003,7 +1003,7 @@ import {
|
|
|
1003
1003
|
useId as useId3,
|
|
1004
1004
|
useMemo as useMemo6,
|
|
1005
1005
|
useRef as useRef13,
|
|
1006
|
-
useState as
|
|
1006
|
+
useState as useState16
|
|
1007
1007
|
} from "react";
|
|
1008
1008
|
import { ulid } from "ulid";
|
|
1009
1009
|
|
|
@@ -1048,11 +1048,11 @@ var styles_module_default = { "Chat": "_Chat_1ei0a_1", "Chat-header": "_Chat-hea
|
|
|
1048
1048
|
// src/components/ChatBody/index.tsx
|
|
1049
1049
|
init_react_import();
|
|
1050
1050
|
import {
|
|
1051
|
-
useContext as
|
|
1051
|
+
useContext as useContext2,
|
|
1052
1052
|
useEffect as useEffect10,
|
|
1053
1053
|
useMemo as useMemo3,
|
|
1054
1054
|
useRef as useRef9,
|
|
1055
|
-
useState as
|
|
1055
|
+
useState as useState13
|
|
1056
1056
|
} from "react";
|
|
1057
1057
|
import { useStickToBottom } from "use-stick-to-bottom";
|
|
1058
1058
|
import Markdown from "react-markdown";
|
|
@@ -1215,12 +1215,13 @@ var Button = ({
|
|
|
1215
1215
|
secondary: variant === "secondary",
|
|
1216
1216
|
danger: variant === "danger",
|
|
1217
1217
|
ghost: variant === "ghost",
|
|
1218
|
-
|
|
1218
|
+
// Disabled while its click is still running, too.
|
|
1219
|
+
disabled: disabled || loading,
|
|
1219
1220
|
fullWidth,
|
|
1220
1221
|
[size]: true
|
|
1221
1222
|
}),
|
|
1222
1223
|
onClick: (e) => {
|
|
1223
|
-
if (disabled) {
|
|
1224
|
+
if (disabled || loading) {
|
|
1224
1225
|
e.preventDefault();
|
|
1225
1226
|
return;
|
|
1226
1227
|
}
|
|
@@ -1773,12 +1774,6 @@ var styles_module_default6 = { "Viewport": "_Viewport_1vvhm_3", "Viewport--stand
|
|
|
1773
1774
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1774
1775
|
var cx6 = getClassNameFactory("Viewport", styles_module_default6);
|
|
1775
1776
|
|
|
1776
|
-
// ../platform-client/context/editor.tsx
|
|
1777
|
-
init_react_import();
|
|
1778
|
-
import { createContext as createContext2, useContext as useContext2, useState as useState11 } from "react";
|
|
1779
|
-
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1780
|
-
var ctx = createContext2({});
|
|
1781
|
-
|
|
1782
1777
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
1783
1778
|
init_react_import();
|
|
1784
1779
|
var styles_module_default7 = { "Chat": "_Chat_5z5yi_1", "Chat--hasMessages": "_Chat--hasMessages_5z5yi_17", "Chat-inner": "_Chat-inner_5z5yi_28", "Chat--hasChildren": "_Chat--hasChildren_5z5yi_40", "Chat-body": "_Chat-body_5z5yi_45", "Chat--isLoading": "_Chat--isLoading_5z5yi_52", "Chat-messages": "_Chat-messages_5z5yi_56", "Chat-form": "_Chat-form_5z5yi_63", "Chat--hideInput": "_Chat--hideInput_5z5yi_68", "Chat-formHelper": "_Chat-formHelper_5z5yi_82", "Chat-examplePrompts": "_Chat-examplePrompts_5z5yi_97", "Chat-examplePrompt": "_Chat-examplePrompt_5z5yi_97", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_5z5yi_134", "Chat-default": "_Chat-default_5z5yi_139", "ChatMessage": "_ChatMessage_5z5yi_155", "ChatMessage--userRole": "_ChatMessage--userRole_5z5yi_164", "ChatMessage-userBubble": "_ChatMessage-userBubble_5z5yi_164", "ChatMessage-userAttachments": "_ChatMessage-userAttachments_5z5yi_175", "ChatMessage-thumbnail": "_ChatMessage-thumbnail_5z5yi_181", "ChatMessage-thumbnailLabel": "_ChatMessage-thumbnailLabel_5z5yi_211", "ChatMessage-text": "_ChatMessage-text_5z5yi_284", "ChatMessage-event": "_ChatMessage-event_5z5yi_319", "ChatMessage-eventBody": "_ChatMessage-eventBody_5z5yi_323", "ChatMessage-eventCollapse": "_ChatMessage-eventCollapse_5z5yi_332", "ChatMessage-eventHeader": "_ChatMessage-eventHeader_5z5yi_336", "ChatMessage-eventExpand": "_ChatMessage-eventExpand_5z5yi_336", "ChatMessage-eventIcon": "_ChatMessage-eventIcon_5z5yi_362", "ChatMessage-eventLabel": "_ChatMessage-eventLabel_5z5yi_366", "ChatMessage-attachmentImage": "_ChatMessage-attachmentImage_5z5yi_380", "ChatMessage-attachmentFile": "_ChatMessage-attachmentFile_5z5yi_397", "Chat-loader": "_Chat-loader_5z5yi_420", "Chat-loaderIcon": "_Chat-loaderIcon_5z5yi_430", "Chat-error": "_Chat-error_5z5yi_434", "Chat-errorLabel": "_Chat-errorLabel_5z5yi_443", "Chat-errorAction": "_Chat-errorAction_5z5yi_447", "Chat-userError": "_Chat-userError_5z5yi_451", "Chat-userErrorDismiss": "_Chat-userErrorDismiss_5z5yi_461" };
|
|
@@ -1789,7 +1784,7 @@ import {
|
|
|
1789
1784
|
useCallback as useCallback4,
|
|
1790
1785
|
useEffect as useEffect8,
|
|
1791
1786
|
useRef as useRef8,
|
|
1792
|
-
useState as
|
|
1787
|
+
useState as useState11
|
|
1793
1788
|
} from "react";
|
|
1794
1789
|
|
|
1795
1790
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PromptForm/styles.module.css#css-module
|
|
@@ -1906,7 +1901,7 @@ var truncateFilename = (name, max = 25) => {
|
|
|
1906
1901
|
};
|
|
1907
1902
|
|
|
1908
1903
|
// src/components/PromptForm/index.tsx
|
|
1909
|
-
import { jsx as
|
|
1904
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1910
1905
|
var cx7 = getClassNameFactory2("PromptForm", styles_module_default8);
|
|
1911
1906
|
function PromptForm({
|
|
1912
1907
|
actions,
|
|
@@ -1927,9 +1922,9 @@ function PromptForm({
|
|
|
1927
1922
|
value = ""
|
|
1928
1923
|
}) {
|
|
1929
1924
|
const hasSetInitialPrompt = useRef8(false);
|
|
1930
|
-
const [prompt, setPrompt] =
|
|
1925
|
+
const [prompt, setPrompt] = useState11(value);
|
|
1931
1926
|
const internalRef = useRef8(null);
|
|
1932
|
-
const [isDragOver, setIsDragOver] =
|
|
1927
|
+
const [isDragOver, setIsDragOver] = useState11(false);
|
|
1933
1928
|
const dragCounterRef = useRef8(0);
|
|
1934
1929
|
const canDrop = !!onFileDrop && !isDisabled && !isLoading;
|
|
1935
1930
|
const handleDragEnter = useCallback4(
|
|
@@ -2015,13 +2010,13 @@ function PromptForm({
|
|
|
2015
2010
|
onDrop: onFileDrop ? handleDrop : void 0,
|
|
2016
2011
|
children: [
|
|
2017
2012
|
isDragOver ? /* @__PURE__ */ jsxs15("div", { className: cx7("dropOverlay"), children: [
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsx27(Paperclip, { size: 20 }),
|
|
2014
|
+
/* @__PURE__ */ jsx27("span", { children: "Attach file" })
|
|
2020
2015
|
] }) : null,
|
|
2021
|
-
helperText ? /* @__PURE__ */
|
|
2016
|
+
helperText ? /* @__PURE__ */ jsx27("div", { className: cx7("helper"), children: helperText }) : null,
|
|
2022
2017
|
/* @__PURE__ */ jsxs15("div", { className: cx7("inner"), children: [
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ jsx27("span", { className: cx7("glow") }),
|
|
2019
|
+
/* @__PURE__ */ jsx27(
|
|
2025
2020
|
"form",
|
|
2026
2021
|
{
|
|
2027
2022
|
onSubmit: (e) => {
|
|
@@ -2029,7 +2024,7 @@ function PromptForm({
|
|
|
2029
2024
|
void sendPrompt();
|
|
2030
2025
|
},
|
|
2031
2026
|
children: /* @__PURE__ */ jsxs15("div", { className: cx7("formInner"), children: [
|
|
2032
|
-
attachments && attachments.length > 0 ? /* @__PURE__ */
|
|
2027
|
+
attachments && attachments.length > 0 ? /* @__PURE__ */ jsx27("div", { className: cx7("attachments"), children: attachments.map((attachment) => /* @__PURE__ */ jsxs15(
|
|
2033
2028
|
"div",
|
|
2034
2029
|
{
|
|
2035
2030
|
className: [
|
|
@@ -2038,29 +2033,29 @@ function PromptForm({
|
|
|
2038
2033
|
attachment.status === "failed" ? cx7("attachmentChipFailed") : ""
|
|
2039
2034
|
].filter(Boolean).join(" "),
|
|
2040
2035
|
children: [
|
|
2041
|
-
attachment.status === "uploading" ? /* @__PURE__ */
|
|
2036
|
+
attachment.status === "uploading" ? /* @__PURE__ */ jsx27(
|
|
2042
2037
|
LoaderCircle,
|
|
2043
2038
|
{
|
|
2044
2039
|
className: cx7("attachmentSpinner"),
|
|
2045
2040
|
size: 14
|
|
2046
2041
|
}
|
|
2047
2042
|
) : null,
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
attachment.status === "failed" ? /* @__PURE__ */
|
|
2050
|
-
onRemoveAttachment ? /* @__PURE__ */
|
|
2043
|
+
/* @__PURE__ */ jsx27("span", { title: attachment.filename, children: truncateFilename(attachment.filename) }),
|
|
2044
|
+
attachment.status === "failed" ? /* @__PURE__ */ jsx27("span", { className: cx7("attachmentError"), children: "Failed" }) : null,
|
|
2045
|
+
onRemoveAttachment ? /* @__PURE__ */ jsx27(
|
|
2051
2046
|
"button",
|
|
2052
2047
|
{
|
|
2053
2048
|
className: cx7("attachmentRemove"),
|
|
2054
2049
|
onClick: () => onRemoveAttachment(attachment.clientId),
|
|
2055
2050
|
type: "button",
|
|
2056
|
-
children: /* @__PURE__ */
|
|
2051
|
+
children: /* @__PURE__ */ jsx27(X, { size: 12 })
|
|
2057
2052
|
}
|
|
2058
2053
|
) : null
|
|
2059
2054
|
]
|
|
2060
2055
|
},
|
|
2061
2056
|
attachment.clientId
|
|
2062
2057
|
)) }) : null,
|
|
2063
|
-
/* @__PURE__ */
|
|
2058
|
+
/* @__PURE__ */ jsx27(
|
|
2064
2059
|
default2,
|
|
2065
2060
|
{
|
|
2066
2061
|
className: cx7("input"),
|
|
@@ -2099,7 +2094,7 @@ function PromptForm({
|
|
|
2099
2094
|
internalRef?.current?.focus();
|
|
2100
2095
|
},
|
|
2101
2096
|
children: [
|
|
2102
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ jsx27(
|
|
2103
2098
|
"div",
|
|
2104
2099
|
{
|
|
2105
2100
|
className: cx7("actionsLeft"),
|
|
@@ -2107,18 +2102,18 @@ function PromptForm({
|
|
|
2107
2102
|
children: actions
|
|
2108
2103
|
}
|
|
2109
2104
|
),
|
|
2110
|
-
/* @__PURE__ */
|
|
2105
|
+
/* @__PURE__ */ jsx27(
|
|
2111
2106
|
"div",
|
|
2112
2107
|
{
|
|
2113
2108
|
className: cx7("actionsRight"),
|
|
2114
2109
|
onClick: (e) => e.stopPropagation(),
|
|
2115
|
-
children: /* @__PURE__ */
|
|
2110
|
+
children: /* @__PURE__ */ jsx27(
|
|
2116
2111
|
"button",
|
|
2117
2112
|
{
|
|
2118
2113
|
className: cx7("actionSubmit"),
|
|
2119
2114
|
type: "submit",
|
|
2120
2115
|
disabled: isLoading,
|
|
2121
|
-
children: isLoading ? /* @__PURE__ */
|
|
2116
|
+
children: isLoading ? /* @__PURE__ */ jsx27(Loader, { size: 18 }) : cta ?? /* @__PURE__ */ jsx27(ArrowUp, { size: 24 })
|
|
2122
2117
|
}
|
|
2123
2118
|
)
|
|
2124
2119
|
}
|
|
@@ -2137,20 +2132,20 @@ function PromptForm({
|
|
|
2137
2132
|
|
|
2138
2133
|
// src/lib/context.ts
|
|
2139
2134
|
init_react_import();
|
|
2140
|
-
import { createContext as
|
|
2141
|
-
var toolStatusContext =
|
|
2135
|
+
import { createContext as createContext2 } from "react";
|
|
2136
|
+
var toolStatusContext = createContext2({});
|
|
2142
2137
|
var ToolStatusProvider = toolStatusContext.Provider;
|
|
2143
|
-
var hostContext =
|
|
2138
|
+
var hostContext = createContext2(void 0);
|
|
2144
2139
|
var HostProvider = hostContext.Provider;
|
|
2145
|
-
var subagentStateContext =
|
|
2140
|
+
var subagentStateContext = createContext2({});
|
|
2146
2141
|
var SubagentStateProvider = subagentStateContext.Provider;
|
|
2147
2142
|
|
|
2148
2143
|
// src/lib/use-attachment-url.ts
|
|
2149
2144
|
init_react_import();
|
|
2150
|
-
import { useEffect as useEffect9, useState as
|
|
2145
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
2151
2146
|
function useAttachmentUrl(url, endpoint) {
|
|
2152
2147
|
const isRef = getAttachmentIdFromRef(url) !== null;
|
|
2153
|
-
const [fetched, setFetched] =
|
|
2148
|
+
const [fetched, setFetched] = useState12();
|
|
2154
2149
|
useEffect9(() => {
|
|
2155
2150
|
if (!isRef) return;
|
|
2156
2151
|
const controller = new AbortController();
|
|
@@ -2175,7 +2170,7 @@ function useAttachmentUrl(url, endpoint) {
|
|
|
2175
2170
|
}
|
|
2176
2171
|
|
|
2177
2172
|
// src/components/ChatBody/index.tsx
|
|
2178
|
-
import { Fragment as Fragment5, jsx as
|
|
2173
|
+
import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2179
2174
|
var cx8 = getClassNameFactory2("Chat", styles_module_default7);
|
|
2180
2175
|
var cxMessage = getClassNameFactory2("ChatMessage", styles_module_default7);
|
|
2181
2176
|
function ChatBody({
|
|
@@ -2210,22 +2205,22 @@ function ChatBody({
|
|
|
2210
2205
|
isLoading
|
|
2211
2206
|
}),
|
|
2212
2207
|
children: [
|
|
2213
|
-
children ? /* @__PURE__ */
|
|
2208
|
+
children ? /* @__PURE__ */ jsx28("div", { className: cx8("default"), children }) : null,
|
|
2214
2209
|
/* @__PURE__ */ jsxs16("div", { className: cx8("inner"), children: [
|
|
2215
2210
|
/* @__PURE__ */ jsxs16("div", { className: cx8("body"), ref: scrollRef, children: [
|
|
2216
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsx28("div", { className: cx8("messages"), ref: contentRef, children: messages.toReversed().filter((message) => !shouldHideMessage(message)).map((message) => /* @__PURE__ */ jsx28(ChatMessage, { message }, message.id)) }),
|
|
2217
2212
|
isLoading && /* @__PURE__ */ jsxs16("div", { className: cx8("loader"), children: [
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
/* @__PURE__ */
|
|
2213
|
+
/* @__PURE__ */ jsx28("div", { className: cx8("loaderIcon"), children: /* @__PURE__ */ jsx28(Loader, { size: 16 }) }),
|
|
2214
|
+
/* @__PURE__ */ jsx28("div", { children: "Thinking..." })
|
|
2220
2215
|
] })
|
|
2221
2216
|
] }),
|
|
2222
2217
|
error && /* @__PURE__ */ jsxs16("div", { className: cx8("error"), children: [
|
|
2223
|
-
/* @__PURE__ */
|
|
2224
|
-
handleRetry && /* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ jsx28("div", { className: cx8("errorLabel"), children: "Something went wrong." }),
|
|
2219
|
+
handleRetry && /* @__PURE__ */ jsx28("div", { className: cx8("errorAction"), children: /* @__PURE__ */ jsx28(IconButton, { title: "Retry", onClick: handleRetry, children: /* @__PURE__ */ jsx28(RotateCcw, { size: "14" }) }) })
|
|
2225
2220
|
] }),
|
|
2226
2221
|
userError && /* @__PURE__ */ jsxs16("div", { className: cx8("userError"), children: [
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
onDismissUserError && /* @__PURE__ */
|
|
2222
|
+
/* @__PURE__ */ jsx28("span", { children: userError }),
|
|
2223
|
+
onDismissUserError && /* @__PURE__ */ jsx28(
|
|
2229
2224
|
"button",
|
|
2230
2225
|
{
|
|
2231
2226
|
"aria-label": "Dismiss",
|
|
@@ -2233,12 +2228,12 @@ function ChatBody({
|
|
|
2233
2228
|
className: cx8("userErrorDismiss"),
|
|
2234
2229
|
onClick: onDismissUserError,
|
|
2235
2230
|
type: "button",
|
|
2236
|
-
children: /* @__PURE__ */
|
|
2231
|
+
children: /* @__PURE__ */ jsx28(X, { size: 14 })
|
|
2237
2232
|
}
|
|
2238
2233
|
)
|
|
2239
2234
|
] }),
|
|
2240
2235
|
/* @__PURE__ */ jsxs16("div", { className: cx8("form"), children: [
|
|
2241
|
-
/* @__PURE__ */
|
|
2236
|
+
/* @__PURE__ */ jsx28(
|
|
2242
2237
|
PromptForm,
|
|
2243
2238
|
{
|
|
2244
2239
|
actions,
|
|
@@ -2252,7 +2247,7 @@ function ChatBody({
|
|
|
2252
2247
|
placeholder: "What do you want to build?"
|
|
2253
2248
|
}
|
|
2254
2249
|
),
|
|
2255
|
-
examplePrompts ? /* @__PURE__ */
|
|
2250
|
+
examplePrompts ? /* @__PURE__ */ jsx28("div", { className: cx8("examplePrompts"), children: examplePrompts }) : null
|
|
2256
2251
|
] })
|
|
2257
2252
|
] })
|
|
2258
2253
|
]
|
|
@@ -2281,13 +2276,13 @@ function ChatMessage({ message }) {
|
|
|
2281
2276
|
if (role === "user") {
|
|
2282
2277
|
const attachmentParts = parts.filter((part) => part.type === "file");
|
|
2283
2278
|
const otherParts = parts.filter((part) => part.type !== "file");
|
|
2284
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ jsx28(
|
|
2285
2280
|
"div",
|
|
2286
2281
|
{
|
|
2287
2282
|
className: cxMessage({ userRole: true }),
|
|
2288
2283
|
"data-message-id": message.id,
|
|
2289
2284
|
children: /* @__PURE__ */ jsxs16("div", { className: cxMessage("userBubble"), children: [
|
|
2290
|
-
otherParts.map((part, i) => /* @__PURE__ */
|
|
2285
|
+
otherParts.map((part, i) => /* @__PURE__ */ jsx28(
|
|
2291
2286
|
ChatMessagePart,
|
|
2292
2287
|
{
|
|
2293
2288
|
part,
|
|
@@ -2295,7 +2290,7 @@ function ChatMessage({ message }) {
|
|
|
2295
2290
|
},
|
|
2296
2291
|
`${message.id}-${part.type}-${i}`
|
|
2297
2292
|
)),
|
|
2298
|
-
attachmentParts.length > 0 ? /* @__PURE__ */
|
|
2293
|
+
attachmentParts.length > 0 ? /* @__PURE__ */ jsx28("div", { className: cxMessage("userAttachments"), children: attachmentParts.map((part, i) => /* @__PURE__ */ jsx28(
|
|
2299
2294
|
ChatAttachmentThumbnail,
|
|
2300
2295
|
{
|
|
2301
2296
|
filename: part.filename,
|
|
@@ -2308,12 +2303,12 @@ function ChatMessage({ message }) {
|
|
|
2308
2303
|
}
|
|
2309
2304
|
);
|
|
2310
2305
|
}
|
|
2311
|
-
return /* @__PURE__ */
|
|
2306
|
+
return /* @__PURE__ */ jsx28(
|
|
2312
2307
|
"div",
|
|
2313
2308
|
{
|
|
2314
2309
|
className: cxMessage({ [`${role}Role`]: true }),
|
|
2315
2310
|
"data-message-id": message.id,
|
|
2316
|
-
children: parts.map((part, i) => /* @__PURE__ */
|
|
2311
|
+
children: parts.map((part, i) => /* @__PURE__ */ jsx28(
|
|
2317
2312
|
ChatMessagePart,
|
|
2318
2313
|
{
|
|
2319
2314
|
part,
|
|
@@ -2329,7 +2324,7 @@ function ChatAttachmentThumbnail({
|
|
|
2329
2324
|
mediaType,
|
|
2330
2325
|
url
|
|
2331
2326
|
}) {
|
|
2332
|
-
const host =
|
|
2327
|
+
const host = useContext2(hostContext);
|
|
2333
2328
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2334
2329
|
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2335
2330
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
@@ -2345,8 +2340,8 @@ function ChatAttachmentThumbnail({
|
|
|
2345
2340
|
target: "_blank",
|
|
2346
2341
|
title: label,
|
|
2347
2342
|
children: [
|
|
2348
|
-
isImage ? resolvedUrl && /* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2343
|
+
isImage ? resolvedUrl && /* @__PURE__ */ jsx28("img", { alt: label, src: resolvedUrl }) : /* @__PURE__ */ jsx28(FileText, { size: 20 }),
|
|
2344
|
+
/* @__PURE__ */ jsx28("span", { className: cxMessage("thumbnailLabel"), children: label })
|
|
2350
2345
|
]
|
|
2351
2346
|
}
|
|
2352
2347
|
);
|
|
@@ -2361,13 +2356,13 @@ function ChatMessageWrapper({
|
|
|
2361
2356
|
role
|
|
2362
2357
|
}) {
|
|
2363
2358
|
if (role === "assistant" || role === "user") {
|
|
2364
|
-
return /* @__PURE__ */
|
|
2359
|
+
return /* @__PURE__ */ jsx28(Markdown, { children });
|
|
2365
2360
|
}
|
|
2366
|
-
return /* @__PURE__ */
|
|
2361
|
+
return /* @__PURE__ */ jsx28("span", { children });
|
|
2367
2362
|
}
|
|
2368
2363
|
function ReasoningBlock({ part }) {
|
|
2369
2364
|
const startTimeRef = useRef9(null);
|
|
2370
|
-
const [durationSecs, setDurationSecs] =
|
|
2365
|
+
const [durationSecs, setDurationSecs] = useState13(null);
|
|
2371
2366
|
if (part.state !== "done" && startTimeRef.current === null) {
|
|
2372
2367
|
startTimeRef.current = Date.now();
|
|
2373
2368
|
}
|
|
@@ -2378,7 +2373,7 @@ function ReasoningBlock({ part }) {
|
|
|
2378
2373
|
}, [part.state]);
|
|
2379
2374
|
const loading = part.state ? part.state !== "done" : false;
|
|
2380
2375
|
const label = durationSecs !== null ? `Thought for ${durationSecs}s` : !loading ? "Thought for a while" : "Thinking...";
|
|
2381
|
-
return /* @__PURE__ */
|
|
2376
|
+
return /* @__PURE__ */ jsx28(
|
|
2382
2377
|
ChatEvent,
|
|
2383
2378
|
{
|
|
2384
2379
|
status: {
|
|
@@ -2386,7 +2381,7 @@ function ReasoningBlock({ part }) {
|
|
|
2386
2381
|
loading,
|
|
2387
2382
|
summary: part.text
|
|
2388
2383
|
},
|
|
2389
|
-
icon: /* @__PURE__ */
|
|
2384
|
+
icon: /* @__PURE__ */ jsx28(Brain, { size: 18 })
|
|
2390
2385
|
}
|
|
2391
2386
|
);
|
|
2392
2387
|
}
|
|
@@ -2395,19 +2390,19 @@ function ChatMessagePart({
|
|
|
2395
2390
|
role
|
|
2396
2391
|
}) {
|
|
2397
2392
|
if (part.type === "text") {
|
|
2398
|
-
return /* @__PURE__ */
|
|
2393
|
+
return /* @__PURE__ */ jsx28("div", { className: cxMessage("text"), children: /* @__PURE__ */ jsx28(ChatMessageWrapper, { role, children: part.text }) });
|
|
2399
2394
|
}
|
|
2400
2395
|
if (part.type === "reasoning") {
|
|
2401
|
-
return /* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ jsx28(ReasoningBlock, { part });
|
|
2402
2397
|
}
|
|
2403
2398
|
if (part.type === "tool-subagent") {
|
|
2404
|
-
return /* @__PURE__ */
|
|
2399
|
+
return /* @__PURE__ */ jsx28(SubagentBlock, { toolCallId: part.toolCallId });
|
|
2405
2400
|
}
|
|
2406
2401
|
if (part.type.startsWith("tool-")) {
|
|
2407
|
-
return /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ jsx28(PuckTool, { ...part });
|
|
2408
2403
|
}
|
|
2409
2404
|
if (part.type === "file") {
|
|
2410
|
-
return /* @__PURE__ */
|
|
2405
|
+
return /* @__PURE__ */ jsx28(
|
|
2411
2406
|
ChatAttachment,
|
|
2412
2407
|
{
|
|
2413
2408
|
filename: part.filename,
|
|
@@ -2423,17 +2418,17 @@ function ChatAttachment({
|
|
|
2423
2418
|
mediaType,
|
|
2424
2419
|
url
|
|
2425
2420
|
}) {
|
|
2426
|
-
const host =
|
|
2421
|
+
const host = useContext2(hostContext);
|
|
2427
2422
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2428
2423
|
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2429
2424
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2430
2425
|
const label = filename || attachmentId || "Attachment";
|
|
2431
2426
|
if (mediaType.startsWith("image/")) {
|
|
2432
|
-
return /* @__PURE__ */
|
|
2427
|
+
return /* @__PURE__ */ jsx28("div", { className: cxMessage("attachmentImage"), children: /* @__PURE__ */ jsx28("a", { href: resolvedUrl, target: "_blank", rel: "noreferrer", children: resolvedUrl && /* @__PURE__ */ jsx28("img", { alt: label, src: resolvedUrl }) }) });
|
|
2433
2428
|
}
|
|
2434
|
-
return /* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ jsx28("div", { className: cxMessage("attachmentFile"), children: /* @__PURE__ */ jsxs16("a", { href: resolvedUrl, target: "_blank", rel: "noreferrer", children: [
|
|
2430
|
+
/* @__PURE__ */ jsx28(FileText, { size: 16 }),
|
|
2431
|
+
/* @__PURE__ */ jsx28("span", { children: label })
|
|
2437
2432
|
] }) });
|
|
2438
2433
|
}
|
|
2439
2434
|
function PuckTool({
|
|
@@ -2442,36 +2437,36 @@ function PuckTool({
|
|
|
2442
2437
|
defaultLabel = "Thinking...",
|
|
2443
2438
|
type
|
|
2444
2439
|
}) {
|
|
2445
|
-
const toolStatus =
|
|
2440
|
+
const toolStatus = useContext2(toolStatusContext)[toolCallId];
|
|
2446
2441
|
const outputObj = output;
|
|
2447
2442
|
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus ?? { loading: true, label: defaultLabel };
|
|
2448
2443
|
let icon = useMemo3(() => {
|
|
2449
2444
|
if (type === "tool-write") {
|
|
2450
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ jsx28(Pen, { size: 18 });
|
|
2451
2446
|
} else if (type === "tool-refreshPageData") {
|
|
2452
|
-
return /* @__PURE__ */
|
|
2447
|
+
return /* @__PURE__ */ jsx28(GitPullRequest, { size: 18 });
|
|
2453
2448
|
} else if (type === "tool-takeScreenshot") {
|
|
2454
|
-
return /* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ jsx28(Camera, { size: 18 });
|
|
2455
2450
|
} else if (type === "tool-fetchUrl") {
|
|
2456
|
-
return /* @__PURE__ */
|
|
2451
|
+
return /* @__PURE__ */ jsx28(CloudDownload, { size: 18 });
|
|
2457
2452
|
} else if (type === "tool-screenshotUrl") {
|
|
2458
|
-
return /* @__PURE__ */
|
|
2453
|
+
return /* @__PURE__ */ jsx28(Camera, { size: 18 });
|
|
2459
2454
|
}
|
|
2460
|
-
return /* @__PURE__ */
|
|
2455
|
+
return /* @__PURE__ */ jsx28(Check, { size: 18 });
|
|
2461
2456
|
}, [type]);
|
|
2462
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsx28(ChatEvent, { status, icon });
|
|
2463
2458
|
}
|
|
2464
2459
|
function SubagentBlock({ toolCallId }) {
|
|
2465
|
-
const subagentState =
|
|
2460
|
+
const subagentState = useContext2(subagentStateContext);
|
|
2466
2461
|
const state = subagentState[toolCallId];
|
|
2467
|
-
const toolStatusMap =
|
|
2462
|
+
const toolStatusMap = useContext2(toolStatusContext);
|
|
2468
2463
|
const toolStatus = toolStatusMap[toolCallId];
|
|
2469
2464
|
const fallbackLabel = toolStatus?.label ?? "Running subagent";
|
|
2470
2465
|
const label = state?.label ? state.state === "done" ? `${state.agentType} subagent complete` : state.label : fallbackLabel;
|
|
2471
2466
|
const loading = state ? state.state !== "done" : toolStatus?.loading ?? true;
|
|
2472
2467
|
const hasBody = !!state && state.parts.length > 0;
|
|
2473
2468
|
const parts = state?.parts ?? [];
|
|
2474
|
-
const [isOpen, setIsOpen] =
|
|
2469
|
+
const [isOpen, setIsOpen] = useState13(false);
|
|
2475
2470
|
return /* @__PURE__ */ jsxs16(
|
|
2476
2471
|
"details",
|
|
2477
2472
|
{
|
|
@@ -2484,26 +2479,26 @@ function SubagentBlock({ toolCallId }) {
|
|
|
2484
2479
|
className: cxMessage("eventHeader"),
|
|
2485
2480
|
style: hasBody ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
2486
2481
|
children: [
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
/* @__PURE__ */
|
|
2482
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventIcon"), children: loading ? /* @__PURE__ */ jsx28(Loader, { size: 16 }) : /* @__PURE__ */ jsx28(Bot, { size: 18 }) }),
|
|
2483
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventLabel"), children: label }),
|
|
2489
2484
|
hasBody && /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2485
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ jsx28(Plus, { size: 12 }) }),
|
|
2486
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ jsx28(Minus, { size: 12 }) })
|
|
2492
2487
|
] })
|
|
2493
2488
|
]
|
|
2494
2489
|
}
|
|
2495
2490
|
),
|
|
2496
|
-
hasBody && isOpen && /* @__PURE__ */
|
|
2491
|
+
hasBody && isOpen && /* @__PURE__ */ jsx28("div", { className: cxMessage("eventBody"), children: parts.map((part, i) => /* @__PURE__ */ jsx28(SubagentChildPartRenderer, { part }, `${toolCallId}-${i}`)) })
|
|
2497
2492
|
]
|
|
2498
2493
|
}
|
|
2499
2494
|
);
|
|
2500
2495
|
}
|
|
2501
2496
|
function SubagentChildPartRenderer({ part }) {
|
|
2502
2497
|
if (part.kind === "text") {
|
|
2503
|
-
return /* @__PURE__ */
|
|
2498
|
+
return /* @__PURE__ */ jsx28("div", { className: cxMessage("text"), children: /* @__PURE__ */ jsx28(Markdown, { children: part.text }) });
|
|
2504
2499
|
}
|
|
2505
2500
|
if (part.kind === "reasoning") {
|
|
2506
|
-
return /* @__PURE__ */
|
|
2501
|
+
return /* @__PURE__ */ jsx28(
|
|
2507
2502
|
ReasoningBlock,
|
|
2508
2503
|
{
|
|
2509
2504
|
part: {
|
|
@@ -2515,7 +2510,7 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2515
2510
|
);
|
|
2516
2511
|
}
|
|
2517
2512
|
if (part.toolName === "subagent") {
|
|
2518
|
-
return /* @__PURE__ */
|
|
2513
|
+
return /* @__PURE__ */ jsx28(SubagentBlock, { toolCallId: part.childToolCallId });
|
|
2519
2514
|
}
|
|
2520
2515
|
const synthesized = {
|
|
2521
2516
|
toolCallId: part.childToolCallId,
|
|
@@ -2524,13 +2519,13 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2524
2519
|
input: part.input,
|
|
2525
2520
|
output: part.output
|
|
2526
2521
|
};
|
|
2527
|
-
return /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ jsx28(PuckTool, { ...synthesized });
|
|
2528
2523
|
}
|
|
2529
2524
|
function ChatEvent({
|
|
2530
2525
|
status,
|
|
2531
|
-
icon = /* @__PURE__ */
|
|
2526
|
+
icon = /* @__PURE__ */ jsx28(Check, { size: 18 })
|
|
2532
2527
|
}) {
|
|
2533
|
-
const [isOpen, setIsOpen] =
|
|
2528
|
+
const [isOpen, setIsOpen] = useState13(false);
|
|
2534
2529
|
return /* @__PURE__ */ jsxs16(
|
|
2535
2530
|
"details",
|
|
2536
2531
|
{
|
|
@@ -2543,16 +2538,16 @@ function ChatEvent({
|
|
|
2543
2538
|
className: cxMessage("eventHeader"),
|
|
2544
2539
|
style: status.summary ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
2545
2540
|
children: [
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2541
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventIcon"), children: status.error ? /* @__PURE__ */ jsx28(TriangleAlert, { size: 18 }) : status.loading ? /* @__PURE__ */ jsx28(Loader, { size: 16 }) : icon }),
|
|
2542
|
+
/* @__PURE__ */ jsx28("div", { children: status.label }),
|
|
2548
2543
|
status.summary && /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2549
|
-
/* @__PURE__ */
|
|
2550
|
-
/* @__PURE__ */
|
|
2544
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ jsx28(Plus, { size: 12 }) }),
|
|
2545
|
+
/* @__PURE__ */ jsx28("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ jsx28(Minus, { size: 12 }) })
|
|
2551
2546
|
] })
|
|
2552
2547
|
]
|
|
2553
2548
|
}
|
|
2554
2549
|
),
|
|
2555
|
-
status.summary && isOpen && /* @__PURE__ */
|
|
2550
|
+
status.summary && isOpen && /* @__PURE__ */ jsx28("div", { className: cxMessage("eventBody"), children: /* @__PURE__ */ jsx28(Markdown, { children: status.summary }) })
|
|
2556
2551
|
]
|
|
2557
2552
|
}
|
|
2558
2553
|
);
|
|
@@ -2564,11 +2559,11 @@ function ExamplePrompt({
|
|
|
2564
2559
|
disabled
|
|
2565
2560
|
}) {
|
|
2566
2561
|
const content = /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2562
|
+
/* @__PURE__ */ jsx28("div", { children: label }),
|
|
2563
|
+
/* @__PURE__ */ jsx28("div", { className: cx8("examplePromptArrow"), children: /* @__PURE__ */ jsx28(ArrowUp, { size: "16" }) })
|
|
2569
2564
|
] });
|
|
2570
2565
|
if (href) {
|
|
2571
|
-
return /* @__PURE__ */
|
|
2566
|
+
return /* @__PURE__ */ jsx28(
|
|
2572
2567
|
"a",
|
|
2573
2568
|
{
|
|
2574
2569
|
className: cx8("examplePrompt"),
|
|
@@ -2585,7 +2580,7 @@ function ExamplePrompt({
|
|
|
2585
2580
|
}
|
|
2586
2581
|
);
|
|
2587
2582
|
}
|
|
2588
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ jsx28(
|
|
2589
2584
|
"button",
|
|
2590
2585
|
{
|
|
2591
2586
|
className: cx8("examplePrompt"),
|
|
@@ -2625,14 +2620,14 @@ init_react_import();
|
|
|
2625
2620
|
var styles_module_default9 = { "DesignModeToggle": "_DesignModeToggle_o5uty_1", "DesignModeToggle-button": "_DesignModeToggle-button_o5uty_8", "DesignModeToggle-button--active": "_DesignModeToggle-button--active_o5uty_28" };
|
|
2626
2621
|
|
|
2627
2622
|
// src/components/DesignModeToggle/index.tsx
|
|
2628
|
-
import { jsx as
|
|
2623
|
+
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2629
2624
|
var cx9 = getClassNameFactory2("DesignModeToggle", styles_module_default9);
|
|
2630
2625
|
function DesignModeToggle({
|
|
2631
2626
|
active,
|
|
2632
2627
|
onToggle,
|
|
2633
2628
|
disabled
|
|
2634
2629
|
}) {
|
|
2635
|
-
return /* @__PURE__ */
|
|
2630
|
+
return /* @__PURE__ */ jsx29("div", { className: cx9(), children: /* @__PURE__ */ jsxs17(
|
|
2636
2631
|
"button",
|
|
2637
2632
|
{
|
|
2638
2633
|
className: `${cx9("button")} ${active ? cx9("button--active") : ""}`,
|
|
@@ -2641,7 +2636,7 @@ function DesignModeToggle({
|
|
|
2641
2636
|
type: "button",
|
|
2642
2637
|
title: active ? "Disable design mode" : "Enable design mode",
|
|
2643
2638
|
children: [
|
|
2644
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx29(WandSparkles, { size: 12 }),
|
|
2645
2640
|
"Design"
|
|
2646
2641
|
]
|
|
2647
2642
|
}
|
|
@@ -2665,7 +2660,7 @@ import {
|
|
|
2665
2660
|
useLayoutEffect,
|
|
2666
2661
|
useMemo as useMemo5,
|
|
2667
2662
|
useRef as useRef11,
|
|
2668
|
-
useState as
|
|
2663
|
+
useState as useState15,
|
|
2669
2664
|
useSyncExternalStore as useSyncExternalStore2
|
|
2670
2665
|
} from "react";
|
|
2671
2666
|
|
|
@@ -3871,9 +3866,9 @@ var htmlToReactTree = (html, slots) => {
|
|
|
3871
3866
|
|
|
3872
3867
|
// src/lib/design/slot-portal.tsx
|
|
3873
3868
|
init_react_import();
|
|
3874
|
-
import { useEffect as useEffect11, useMemo as useMemo4, useRef as useRef10, useState as
|
|
3869
|
+
import { useEffect as useEffect11, useMemo as useMemo4, useRef as useRef10, useState as useState14 } from "react";
|
|
3875
3870
|
import { createPortal } from "react-dom";
|
|
3876
|
-
import { jsx as
|
|
3871
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3877
3872
|
var parseInlineStyle = (cssText) => {
|
|
3878
3873
|
const style = {};
|
|
3879
3874
|
for (const declaration of cssText.split(";")) {
|
|
@@ -3895,7 +3890,7 @@ var SlotPortal = ({
|
|
|
3895
3890
|
slotClassName,
|
|
3896
3891
|
SlotContent
|
|
3897
3892
|
}) => {
|
|
3898
|
-
const [target, setTarget] =
|
|
3893
|
+
const [target, setTarget] = useState14(null);
|
|
3899
3894
|
const lastTarget = useRef10(null);
|
|
3900
3895
|
const style = useMemo4(
|
|
3901
3896
|
() => slotStyle ? parseInlineStyle(slotStyle) : void 0,
|
|
@@ -3915,13 +3910,13 @@ var SlotPortal = ({
|
|
|
3915
3910
|
}, [entry, html, slotName]);
|
|
3916
3911
|
if (!target || typeof SlotContent !== "function") return null;
|
|
3917
3912
|
return createPortal(
|
|
3918
|
-
/* @__PURE__ */
|
|
3913
|
+
/* @__PURE__ */ jsx30(SlotContent, { style, className: slotClassName || void 0 }),
|
|
3919
3914
|
target
|
|
3920
3915
|
);
|
|
3921
3916
|
};
|
|
3922
3917
|
|
|
3923
3918
|
// src/lib/design/component.tsx
|
|
3924
|
-
import { Fragment as Fragment7, jsx as
|
|
3919
|
+
import { Fragment as Fragment7, jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3925
3920
|
var DESIGN_COMPONENT = Symbol("puck-ai.designComponent");
|
|
3926
3921
|
var isDesignComponent = (config) => !!config?.[DESIGN_COMPONENT];
|
|
3927
3922
|
var streamingValues = /* @__PURE__ */ new Map();
|
|
@@ -4007,13 +4002,13 @@ function createDesignComponentConfig(registration) {
|
|
|
4007
4002
|
}
|
|
4008
4003
|
return resolvedFields;
|
|
4009
4004
|
},
|
|
4010
|
-
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */
|
|
4005
|
+
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ jsx31(EditorEntry, { ...renderProps }) : /* @__PURE__ */ jsx31(Entry, { ...renderProps, getPuck: null })
|
|
4011
4006
|
};
|
|
4012
4007
|
componentConfig[DESIGN_COMPONENT] = true;
|
|
4013
4008
|
return componentConfig;
|
|
4014
4009
|
function EditorEntry(renderProps) {
|
|
4015
4010
|
const getPuck = useGetPuck2();
|
|
4016
|
-
return /* @__PURE__ */
|
|
4011
|
+
return /* @__PURE__ */ jsx31(Entry, { ...renderProps, getPuck });
|
|
4017
4012
|
}
|
|
4018
4013
|
function Entry({
|
|
4019
4014
|
getPuck,
|
|
@@ -4034,7 +4029,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4034
4029
|
const html = reg.html ?? "";
|
|
4035
4030
|
const styles = reg.styles;
|
|
4036
4031
|
const script = reg.script;
|
|
4037
|
-
const [entryEl, setEntryEl] =
|
|
4032
|
+
const [entryEl, setEntryEl] = useState15(null);
|
|
4038
4033
|
const scriptRef = useRef11(null);
|
|
4039
4034
|
const annotations = useMemo5(() => getAnnotations(html), [html]);
|
|
4040
4035
|
const { attrFields, arrayFields, attrSig, arraySig } = useMemo5(() => {
|
|
@@ -4075,7 +4070,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4075
4070
|
return attrs;
|
|
4076
4071
|
}, [annotations, props, puck.isEditing]);
|
|
4077
4072
|
const editorEntryNode = useMemo5(
|
|
4078
|
-
() => puck.isEditing ? /* @__PURE__ */
|
|
4073
|
+
() => puck.isEditing ? /* @__PURE__ */ jsx31("div", { ref: setEntryEl }) : null,
|
|
4079
4074
|
[puck.isEditing]
|
|
4080
4075
|
);
|
|
4081
4076
|
useEffect12(() => {
|
|
@@ -4202,7 +4197,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4202
4197
|
for (const slot of annotations.slots) {
|
|
4203
4198
|
const Slot = props[slot.name];
|
|
4204
4199
|
if (typeof Slot === "function") {
|
|
4205
|
-
slotContent[slot.name] = /* @__PURE__ */
|
|
4200
|
+
slotContent[slot.name] = /* @__PURE__ */ jsx31(
|
|
4206
4201
|
Slot,
|
|
4207
4202
|
{
|
|
4208
4203
|
style: slot.style ? parseStyleString(slot.style) : void 0,
|
|
@@ -4212,16 +4207,16 @@ function createDesignComponentConfig(registration) {
|
|
|
4212
4207
|
}
|
|
4213
4208
|
}
|
|
4214
4209
|
return /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
4215
|
-
styles && /* @__PURE__ */
|
|
4216
|
-
style && /* @__PURE__ */
|
|
4217
|
-
/* @__PURE__ */
|
|
4210
|
+
styles && /* @__PURE__ */ jsx31("style", { children: styles }),
|
|
4211
|
+
style && /* @__PURE__ */ jsx31("style", { children: style }),
|
|
4212
|
+
/* @__PURE__ */ jsx31("div", { ref: setEntryEl, ...fieldValueAttrs, children: htmlToReactTree(patchedHtml, slotContent) })
|
|
4218
4213
|
] });
|
|
4219
4214
|
}
|
|
4220
4215
|
return /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
4221
|
-
styles && /* @__PURE__ */
|
|
4222
|
-
style && /* @__PURE__ */
|
|
4216
|
+
styles && /* @__PURE__ */ jsx31("style", { children: styles }),
|
|
4217
|
+
style && /* @__PURE__ */ jsx31("style", { children: style }),
|
|
4223
4218
|
editorEntryNode,
|
|
4224
|
-
entryEl && annotations.slots.map((slot) => /* @__PURE__ */
|
|
4219
|
+
entryEl && annotations.slots.map((slot) => /* @__PURE__ */ jsx31(
|
|
4225
4220
|
SlotPortal,
|
|
4226
4221
|
{
|
|
4227
4222
|
entry: entryEl,
|
|
@@ -4240,7 +4235,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4240
4235
|
// src/lib/design/globals.tsx
|
|
4241
4236
|
init_react_import();
|
|
4242
4237
|
import { useEffect as useEffect13, useRef as useRef12 } from "react";
|
|
4243
|
-
import { Fragment as Fragment8, jsx as
|
|
4238
|
+
import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4244
4239
|
function getDynamicConfigGlobals(dynamicConfig) {
|
|
4245
4240
|
if (typeof dynamicConfig !== "object" || dynamicConfig === null) return {};
|
|
4246
4241
|
const { styles, script } = dynamicConfig;
|
|
@@ -4271,9 +4266,9 @@ function DesignGlobals({
|
|
|
4271
4266
|
};
|
|
4272
4267
|
}, [script]);
|
|
4273
4268
|
return /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
4274
|
-
isEditing && /* @__PURE__ */
|
|
4275
|
-
styles && /* @__PURE__ */
|
|
4276
|
-
script && /* @__PURE__ */
|
|
4269
|
+
isEditing && /* @__PURE__ */ jsx32("style", { children: INLINE_EDIT_RESET }),
|
|
4270
|
+
styles && /* @__PURE__ */ jsx32("style", { children: styles }),
|
|
4271
|
+
script && /* @__PURE__ */ jsx32("div", { ref: hostRef, style: { display: "none" } })
|
|
4277
4272
|
] });
|
|
4278
4273
|
}
|
|
4279
4274
|
var WRAPPED = "__puckAiDesignGlobals";
|
|
@@ -4284,7 +4279,7 @@ function withDesignGlobals(root) {
|
|
|
4284
4279
|
const render = (props) => {
|
|
4285
4280
|
const { styles, script } = getDynamicConfigGlobals(props._dynamicConfig);
|
|
4286
4281
|
return /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
4287
|
-
/* @__PURE__ */
|
|
4282
|
+
/* @__PURE__ */ jsx32(
|
|
4288
4283
|
DesignGlobals,
|
|
4289
4284
|
{
|
|
4290
4285
|
styles,
|
|
@@ -4306,7 +4301,7 @@ function ensureDesignGlobalsRoot(config) {
|
|
|
4306
4301
|
}
|
|
4307
4302
|
|
|
4308
4303
|
// src/lib/design/runtime.tsx
|
|
4309
|
-
import { jsx as
|
|
4304
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
4310
4305
|
var cachedFieldMetadata;
|
|
4311
4306
|
function detectFieldMetadata(config) {
|
|
4312
4307
|
for (const comp of Object.values(config.components)) {
|
|
@@ -4345,7 +4340,7 @@ function applyConfigFieldMetadata(config, dynamicComponents) {
|
|
|
4345
4340
|
var DESIGNED_CATEGORY = "dynamic";
|
|
4346
4341
|
var dynamicConfigRootField = {
|
|
4347
4342
|
type: "custom",
|
|
4348
|
-
render: () => /* @__PURE__ */
|
|
4343
|
+
render: () => /* @__PURE__ */ jsx33("div", {}),
|
|
4349
4344
|
ai: {
|
|
4350
4345
|
exclude: true
|
|
4351
4346
|
}
|
|
@@ -4613,14 +4608,14 @@ var drawScaled = (source, ratio) => {
|
|
|
4613
4608
|
const target = document.createElement("canvas");
|
|
4614
4609
|
target.width = scaleDimension(source.width, ratio);
|
|
4615
4610
|
target.height = scaleDimension(source.height, ratio);
|
|
4616
|
-
const
|
|
4617
|
-
if (!
|
|
4611
|
+
const ctx = target.getContext("2d");
|
|
4612
|
+
if (!ctx) {
|
|
4618
4613
|
releaseCanvas(target);
|
|
4619
4614
|
return source;
|
|
4620
4615
|
}
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4616
|
+
ctx.imageSmoothingEnabled = true;
|
|
4617
|
+
ctx.imageSmoothingQuality = "high";
|
|
4618
|
+
ctx.drawImage(source, 0, 0, target.width, target.height);
|
|
4624
4619
|
return target;
|
|
4625
4620
|
};
|
|
4626
4621
|
var fitCanvas = (canvas) => {
|
|
@@ -4701,12 +4696,12 @@ async function postClientToolResponse(host, body) {
|
|
|
4701
4696
|
}
|
|
4702
4697
|
|
|
4703
4698
|
// src/components/Chat/index.tsx
|
|
4704
|
-
import { Fragment as Fragment9, jsx as
|
|
4699
|
+
import { Fragment as Fragment9, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4705
4700
|
var q = qler();
|
|
4706
4701
|
var DEFAULT_API_VERSION = "v2";
|
|
4707
4702
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4708
4703
|
var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
|
|
4709
|
-
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.
|
|
4704
|
+
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.53ee4e95" : "unknown";
|
|
4710
4705
|
var BENCHMARK = false;
|
|
4711
4706
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
|
|
4712
4707
|
var getClassName18 = getClassNameFactory("Chat", styles_module_default);
|
|
@@ -4732,7 +4727,7 @@ function Chat2(props) {
|
|
|
4732
4727
|
const localChatId = useRef13("");
|
|
4733
4728
|
const inputRef = useRef13(null);
|
|
4734
4729
|
const pluginRef = useRef13(null);
|
|
4735
|
-
const [mode, setMode] =
|
|
4730
|
+
const [mode, setMode] = useState16(defaultMode);
|
|
4736
4731
|
const modeRef = useRef13(mode);
|
|
4737
4732
|
const designModeVisible = typeof designMode === "boolean" ? designMode : designMode.visible ?? false;
|
|
4738
4733
|
useEffect14(() => {
|
|
@@ -4742,18 +4737,18 @@ function Chat2(props) {
|
|
|
4742
4737
|
useEffect14(() => {
|
|
4743
4738
|
syncDesignComponents(getPuck);
|
|
4744
4739
|
}, [puckData, getPuck]);
|
|
4745
|
-
const [error, setError] =
|
|
4746
|
-
const [userError, setUserError] =
|
|
4740
|
+
const [error, setError] = useState16();
|
|
4741
|
+
const [userError, setUserError] = useState16();
|
|
4747
4742
|
const clientToolEndpointUnavailableRef = useRef13(false);
|
|
4748
4743
|
const stopChatRef = useRef13(null);
|
|
4749
|
-
const [composerAttachments, setComposerAttachments] =
|
|
4744
|
+
const [composerAttachments, setComposerAttachments] = useState16([]);
|
|
4750
4745
|
const removedAttachmentClientIdsRef = useRef13(/* @__PURE__ */ new Set());
|
|
4751
4746
|
const uploadControllersRef = useRef13(/* @__PURE__ */ new Map());
|
|
4752
4747
|
const pendingBuildOpsRef = useRef13([]);
|
|
4753
4748
|
const lastStreamActivityRef = useRef13(0);
|
|
4754
4749
|
const hiddenSinceRef = useRef13(null);
|
|
4755
|
-
const [toolStatus, setToolStatus] =
|
|
4756
|
-
const [subagentState, setSubagentState] =
|
|
4750
|
+
const [toolStatus, setToolStatus] = useState16({});
|
|
4751
|
+
const [subagentState, setSubagentState] = useState16({});
|
|
4757
4752
|
const attachmentConfig = useMemo6(
|
|
4758
4753
|
() => ({
|
|
4759
4754
|
accept: attachments?.accept ?? defaultAttachmentAccept,
|
|
@@ -5147,7 +5142,7 @@ function Chat2(props) {
|
|
|
5147
5142
|
if (graceTimer) clearTimeout(graceTimer);
|
|
5148
5143
|
};
|
|
5149
5144
|
}, [stop]);
|
|
5150
|
-
const [forcedStatus, setForcedStatus] =
|
|
5145
|
+
const [forcedStatus, setForcedStatus] = useState16();
|
|
5151
5146
|
const resolvedStatus = useMemo6(
|
|
5152
5147
|
() => forcedStatus ?? status,
|
|
5153
5148
|
[status, forcedStatus]
|
|
@@ -5389,13 +5384,13 @@ function Chat2(props) {
|
|
|
5389
5384
|
};
|
|
5390
5385
|
});
|
|
5391
5386
|
}, [messages, toolStatus]);
|
|
5392
|
-
return /* @__PURE__ */
|
|
5387
|
+
return /* @__PURE__ */ jsx34("div", { className: getClassName18(), ref: pluginRef, children: /* @__PURE__ */ jsx34(HostProvider, { value: host, children: /* @__PURE__ */ jsx34(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ jsx34(SubagentStateProvider, { value: subagentState, children: /* @__PURE__ */ jsx34(
|
|
5393
5388
|
ChatBody,
|
|
5394
5389
|
{
|
|
5395
5390
|
messages: messagesWithStatuses,
|
|
5396
5391
|
onFileDrop: attachmentConfig.enabled ? handleFiles : void 0,
|
|
5397
5392
|
actions: /* @__PURE__ */ jsxs20(Fragment9, { children: [
|
|
5398
|
-
attachmentConfig.enabled ? /* @__PURE__ */
|
|
5393
|
+
attachmentConfig.enabled ? /* @__PURE__ */ jsx34(
|
|
5399
5394
|
AttachmentComposer,
|
|
5400
5395
|
{
|
|
5401
5396
|
accept: attachmentConfig.accept,
|
|
@@ -5408,7 +5403,7 @@ function Chat2(props) {
|
|
|
5408
5403
|
typeof chatActions === "function" ? chatActions({
|
|
5409
5404
|
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5410
5405
|
}) : chatActions,
|
|
5411
|
-
designModeVisible ? /* @__PURE__ */
|
|
5406
|
+
designModeVisible ? /* @__PURE__ */ jsx34(
|
|
5412
5407
|
DesignModeToggle,
|
|
5413
5408
|
{
|
|
5414
5409
|
active: mode === "design",
|
|
@@ -5425,7 +5420,7 @@ function Chat2(props) {
|
|
|
5425
5420
|
inputRef,
|
|
5426
5421
|
status: resolvedStatus,
|
|
5427
5422
|
examplePrompts: examplePrompts?.map(
|
|
5428
|
-
({ label, href, onClick }) => /* @__PURE__ */
|
|
5423
|
+
({ label, href, onClick }) => /* @__PURE__ */ jsx34(
|
|
5429
5424
|
ExamplePrompt,
|
|
5430
5425
|
{
|
|
5431
5426
|
label,
|
|
@@ -5444,7 +5439,7 @@ function Chat2(props) {
|
|
|
5444
5439
|
},
|
|
5445
5440
|
userError,
|
|
5446
5441
|
onDismissUserError: () => setUserError(""),
|
|
5447
|
-
children: placeholder ?? /* @__PURE__ */
|
|
5442
|
+
children: placeholder ?? /* @__PURE__ */ jsx34(
|
|
5448
5443
|
Placeholder,
|
|
5449
5444
|
{
|
|
5450
5445
|
dispatch: puckDispatch,
|
|
@@ -5564,7 +5559,7 @@ function AttachmentComposer({
|
|
|
5564
5559
|
const id = useId3();
|
|
5565
5560
|
const inputId = useMemo6(() => `attachment-input-${id}`, []);
|
|
5566
5561
|
return /* @__PURE__ */ jsxs20("div", { className: getClassName18("attachmentControls"), children: [
|
|
5567
|
-
/* @__PURE__ */
|
|
5562
|
+
/* @__PURE__ */ jsx34(
|
|
5568
5563
|
"input",
|
|
5569
5564
|
{
|
|
5570
5565
|
accept: accept.join(","),
|
|
@@ -5576,7 +5571,7 @@ function AttachmentComposer({
|
|
|
5576
5571
|
type: "file"
|
|
5577
5572
|
}
|
|
5578
5573
|
),
|
|
5579
|
-
/* @__PURE__ */
|
|
5574
|
+
/* @__PURE__ */ jsx34(
|
|
5580
5575
|
"button",
|
|
5581
5576
|
{
|
|
5582
5577
|
"aria-label": "Attach files",
|
|
@@ -5585,7 +5580,7 @@ function AttachmentComposer({
|
|
|
5585
5580
|
onClick: () => document.getElementById(inputId)?.click(),
|
|
5586
5581
|
title: "Attach files",
|
|
5587
5582
|
type: "button",
|
|
5588
|
-
children: /* @__PURE__ */
|
|
5583
|
+
children: /* @__PURE__ */ jsx34(Paperclip, { size: 14 })
|
|
5589
5584
|
}
|
|
5590
5585
|
)
|
|
5591
5586
|
] });
|
|
@@ -5609,11 +5604,11 @@ function Placeholder({
|
|
|
5609
5604
|
}, 10);
|
|
5610
5605
|
};
|
|
5611
5606
|
return /* @__PURE__ */ jsxs20("div", { className: getClassName18("placeholder"), children: [
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
5607
|
+
/* @__PURE__ */ jsx34("span", { className: getClassName18("placeholderIcon"), children: /* @__PURE__ */ jsx34(Sparkles, { "aria-hidden": "true", size: 28 }) }),
|
|
5608
|
+
/* @__PURE__ */ jsx34("strong", { className: getClassName18("placeholderTitle"), children: "Build with AI" }),
|
|
5609
|
+
/* @__PURE__ */ jsx34("span", { className: getClassName18("placeholderDescription"), children: "Describe what you want to create or change." }),
|
|
5615
5610
|
/* @__PURE__ */ jsxs20("div", { className: getClassName18("actions"), children: [
|
|
5616
|
-
/* @__PURE__ */
|
|
5611
|
+
/* @__PURE__ */ jsx34(
|
|
5617
5612
|
"button",
|
|
5618
5613
|
{
|
|
5619
5614
|
className: getClassName18("action"),
|
|
@@ -5622,7 +5617,7 @@ function Placeholder({
|
|
|
5622
5617
|
children: "Write a prompt"
|
|
5623
5618
|
}
|
|
5624
5619
|
),
|
|
5625
|
-
/* @__PURE__ */
|
|
5620
|
+
/* @__PURE__ */ jsx34(
|
|
5626
5621
|
"button",
|
|
5627
5622
|
{
|
|
5628
5623
|
className: getClassName18("actionOutlined"),
|
|
@@ -5766,14 +5761,14 @@ import { createUsePuck as createUsePuck2 } from "@puckeditor/core";
|
|
|
5766
5761
|
// src/components/ManageComponents/index.tsx
|
|
5767
5762
|
init_react_import();
|
|
5768
5763
|
import { useGetPuck as useGetPuck5 } from "@puckeditor/core";
|
|
5769
|
-
import { useCallback as useCallback8, useEffect as useEffect16, useState as
|
|
5764
|
+
import { useCallback as useCallback8, useEffect as useEffect16, useState as useState17, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
5770
5765
|
|
|
5771
5766
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ManageComponents/styles.module.css#css-module
|
|
5772
5767
|
init_react_import();
|
|
5773
5768
|
var styles_module_default10 = { "ManageComponents-cta": "_ManageComponents-cta_xifz3_1", "ManageComponents-list": "_ManageComponents-list_xifz3_22", "ManageComponents-item": "_ManageComponents-item_xifz3_29", "ManageComponents-delete": "_ManageComponents-delete_xifz3_41", "ManageComponents-empty": "_ManageComponents-empty_xifz3_57" };
|
|
5774
5769
|
|
|
5775
5770
|
// src/components/ManageComponents/index.tsx
|
|
5776
|
-
import { Fragment as Fragment10, jsx as
|
|
5771
|
+
import { Fragment as Fragment10, jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5777
5772
|
var cx10 = getClassNameFactory2("ManageComponents", styles_module_default10);
|
|
5778
5773
|
var useRegistrations = () => useSyncExternalStore3(
|
|
5779
5774
|
registrationStore.subscribe,
|
|
@@ -5783,7 +5778,7 @@ var useRegistrations = () => useSyncExternalStore3(
|
|
|
5783
5778
|
function ManageModalContent({ onClose }) {
|
|
5784
5779
|
const getPuck = useGetPuck5();
|
|
5785
5780
|
const { visible, setVisible } = useModal();
|
|
5786
|
-
const [confirmTarget, setConfirmTarget] =
|
|
5781
|
+
const [confirmTarget, setConfirmTarget] = useState17(null);
|
|
5787
5782
|
const entries = useRegistrations();
|
|
5788
5783
|
useEffect16(() => {
|
|
5789
5784
|
if (!visible) onClose();
|
|
@@ -5796,14 +5791,14 @@ function ManageModalContent({ onClose }) {
|
|
|
5796
5791
|
}
|
|
5797
5792
|
};
|
|
5798
5793
|
if (confirmTarget) {
|
|
5799
|
-
return /* @__PURE__ */
|
|
5794
|
+
return /* @__PURE__ */ jsx35(
|
|
5800
5795
|
ActionModal,
|
|
5801
5796
|
{
|
|
5802
5797
|
title: "Delete component",
|
|
5803
5798
|
hideButton: true,
|
|
5804
5799
|
actions: /* @__PURE__ */ jsxs21(Inline, { children: [
|
|
5805
|
-
/* @__PURE__ */
|
|
5806
|
-
/* @__PURE__ */
|
|
5800
|
+
/* @__PURE__ */ jsx35(Button, { variant: "secondary", onClick: () => setConfirmTarget(null), children: "Cancel" }),
|
|
5801
|
+
/* @__PURE__ */ jsx35(
|
|
5807
5802
|
Button,
|
|
5808
5803
|
{
|
|
5809
5804
|
variant: "danger",
|
|
@@ -5814,15 +5809,15 @@ function ManageModalContent({ onClose }) {
|
|
|
5814
5809
|
] }),
|
|
5815
5810
|
children: /* @__PURE__ */ jsxs21("p", { children: [
|
|
5816
5811
|
"Are you sure you want to delete ",
|
|
5817
|
-
/* @__PURE__ */
|
|
5812
|
+
/* @__PURE__ */ jsx35("b", { children: confirmTarget.label }),
|
|
5818
5813
|
"?"
|
|
5819
5814
|
] })
|
|
5820
5815
|
}
|
|
5821
5816
|
);
|
|
5822
5817
|
}
|
|
5823
|
-
return /* @__PURE__ */
|
|
5818
|
+
return /* @__PURE__ */ jsx35(ActionModal, { title: "Manage components", hideButton: true, children: /* @__PURE__ */ jsxs21("div", { className: cx10("list"), children: [
|
|
5824
5819
|
entries.map(([name, reg]) => /* @__PURE__ */ jsxs21("div", { className: cx10("item"), children: [
|
|
5825
|
-
/* @__PURE__ */
|
|
5820
|
+
/* @__PURE__ */ jsx35("span", { className: cx10("itemName"), children: reg.label || name }),
|
|
5826
5821
|
/* @__PURE__ */ jsxs21(
|
|
5827
5822
|
"button",
|
|
5828
5823
|
{
|
|
@@ -5830,26 +5825,26 @@ function ManageModalContent({ onClose }) {
|
|
|
5830
5825
|
onClick: () => setConfirmTarget({ name, label: reg.label || name }),
|
|
5831
5826
|
type: "button",
|
|
5832
5827
|
children: [
|
|
5833
|
-
/* @__PURE__ */
|
|
5828
|
+
/* @__PURE__ */ jsx35(Trash2, { size: 12 }),
|
|
5834
5829
|
"Delete"
|
|
5835
5830
|
]
|
|
5836
5831
|
}
|
|
5837
5832
|
)
|
|
5838
5833
|
] }, name)),
|
|
5839
|
-
entries.length === 0 && /* @__PURE__ */
|
|
5834
|
+
entries.length === 0 && /* @__PURE__ */ jsx35("div", { className: cx10("empty"), children: "No dynamic components" })
|
|
5840
5835
|
] }) });
|
|
5841
5836
|
}
|
|
5842
5837
|
function ManageComponentsCta() {
|
|
5843
|
-
const [open, setOpen] =
|
|
5838
|
+
const [open, setOpen] = useState17(false);
|
|
5844
5839
|
const entries = useRegistrations();
|
|
5845
5840
|
const handleClose = useCallback8(() => setOpen(false), []);
|
|
5846
5841
|
if (entries.length === 0) return null;
|
|
5847
5842
|
return /* @__PURE__ */ jsxs21(Fragment10, { children: [
|
|
5848
5843
|
/* @__PURE__ */ jsxs21("button", { className: cx10("cta"), onClick: () => setOpen(true), type: "button", children: [
|
|
5849
|
-
/* @__PURE__ */
|
|
5844
|
+
/* @__PURE__ */ jsx35(Settings, { size: 14 }),
|
|
5850
5845
|
"Manage components"
|
|
5851
5846
|
] }),
|
|
5852
|
-
open && /* @__PURE__ */
|
|
5847
|
+
open && /* @__PURE__ */ jsx35(ModalProvider, { defaultVisible: true, children: /* @__PURE__ */ jsx35(ManageModalContent, { onClose: handleClose }) })
|
|
5853
5848
|
] });
|
|
5854
5849
|
}
|
|
5855
5850
|
|
|
@@ -5858,22 +5853,22 @@ init_react_import();
|
|
|
5858
5853
|
var styles_module_default11 = { "Drawer--empty": "_Drawer--empty_8e8cs_1" };
|
|
5859
5854
|
|
|
5860
5855
|
// src/components/Drawer/index.tsx
|
|
5861
|
-
import { jsx as
|
|
5856
|
+
import { jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5862
5857
|
var usePuck2 = createUsePuck2();
|
|
5863
5858
|
var cx11 = get_class_name_factory_default("Drawer", styles_module_default11);
|
|
5864
5859
|
var createDrawer = (designModeVisible) => function Drawer({ children }) {
|
|
5865
5860
|
const config = usePuck2((s) => s.config);
|
|
5866
5861
|
if (Object.keys(config.components).length === 0) {
|
|
5867
|
-
return /* @__PURE__ */
|
|
5862
|
+
return /* @__PURE__ */ jsx36("div", { className: cx11({ empty: true }), children: "No blocks" });
|
|
5868
5863
|
}
|
|
5869
5864
|
return /* @__PURE__ */ jsxs22("div", { className: cx11(), children: [
|
|
5870
5865
|
children,
|
|
5871
|
-
designModeVisible && /* @__PURE__ */
|
|
5866
|
+
designModeVisible && /* @__PURE__ */ jsx36(ManageComponentsCta, {})
|
|
5872
5867
|
] });
|
|
5873
5868
|
};
|
|
5874
5869
|
|
|
5875
5870
|
// src/index.tsx
|
|
5876
|
-
import { Fragment as Fragment11, jsx as
|
|
5871
|
+
import { Fragment as Fragment11, jsx as jsx37 } from "react/jsx-runtime";
|
|
5877
5872
|
function withDynamicConfig(config, data) {
|
|
5878
5873
|
const registrations = getPersistedRegistrations(data);
|
|
5879
5874
|
const dynamicConfig = {};
|
|
@@ -5910,16 +5905,16 @@ function createAiPlugin(opts) {
|
|
|
5910
5905
|
return {
|
|
5911
5906
|
label: "AI",
|
|
5912
5907
|
name: "ai",
|
|
5913
|
-
render: () => /* @__PURE__ */
|
|
5914
|
-
icon: /* @__PURE__ */
|
|
5908
|
+
render: () => /* @__PURE__ */ jsx37(Chat2, { ...rest, scrollTrackingId }),
|
|
5909
|
+
icon: /* @__PURE__ */ jsx37(Bot, {}),
|
|
5915
5910
|
mobilePanelHeight: "min-content",
|
|
5916
5911
|
overrides: {
|
|
5917
5912
|
drawer: createDrawer(designModeVisible),
|
|
5918
5913
|
preview: ({ children }) => {
|
|
5919
5914
|
if (scrollTracking) {
|
|
5920
|
-
return /* @__PURE__ */
|
|
5915
|
+
return /* @__PURE__ */ jsx37(ScrollTracking, { trackingId: scrollTrackingId, children });
|
|
5921
5916
|
}
|
|
5922
|
-
return /* @__PURE__ */
|
|
5917
|
+
return /* @__PURE__ */ jsx37(Fragment11, { children });
|
|
5923
5918
|
}
|
|
5924
5919
|
}
|
|
5925
5920
|
};
|