@puckeditor/plugin-ai 0.9.0-canary.53ee4e95 → 0.9.0-canary.552a686b
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.css +816 -1733
- package/dist/index.d.mts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +880 -1082
- package/dist/index.mjs +858 -1055
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -417,8 +417,8 @@ var toCamelCase = (string) => string.replace(
|
|
|
417
417
|
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
418
418
|
);
|
|
419
419
|
var toPascalCase = (string) => {
|
|
420
|
-
const
|
|
421
|
-
return
|
|
420
|
+
const camelCase = toCamelCase(string);
|
|
421
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
422
422
|
};
|
|
423
423
|
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
424
424
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
@@ -991,7 +991,7 @@ function useChat({
|
|
|
991
991
|
|
|
992
992
|
// src/components/Chat/index.tsx
|
|
993
993
|
import {
|
|
994
|
-
createUsePuck,
|
|
994
|
+
createUsePuck as createUsePuck2,
|
|
995
995
|
useGetPuck as useGetPuck4
|
|
996
996
|
} from "@puckeditor/core";
|
|
997
997
|
import {
|
|
@@ -999,15 +999,15 @@ import {
|
|
|
999
999
|
} from "ai";
|
|
1000
1000
|
import {
|
|
1001
1001
|
useCallback as useCallback6,
|
|
1002
|
-
useEffect as
|
|
1002
|
+
useEffect as useEffect9,
|
|
1003
1003
|
useId as useId3,
|
|
1004
|
-
useMemo as
|
|
1005
|
-
useRef as
|
|
1006
|
-
useState as
|
|
1004
|
+
useMemo as useMemo4,
|
|
1005
|
+
useRef as useRef9,
|
|
1006
|
+
useState as useState9
|
|
1007
1007
|
} from "react";
|
|
1008
1008
|
import { ulid } from "ulid";
|
|
1009
1009
|
|
|
1010
|
-
// ../
|
|
1010
|
+
// ../platform-client/lib/get-class-name-factory.ts
|
|
1011
1011
|
init_react_import();
|
|
1012
1012
|
var import_classnames = __toESM(require_classnames());
|
|
1013
1013
|
var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
|
@@ -1043,126 +1043,47 @@ var get_class_name_factory_default = getClassNameFactory;
|
|
|
1043
1043
|
|
|
1044
1044
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Chat/styles.module.css#css-module
|
|
1045
1045
|
init_react_import();
|
|
1046
|
-
var styles_module_default = { "Chat": "
|
|
1046
|
+
var styles_module_default = { "Chat": "_Chat_gflib_1", "Chat-header": "_Chat-header_gflib_9", "Chat-placeholder": "_Chat-placeholder_gflib_24", "Chat-placeholderIcon": "_Chat-placeholderIcon_gflib_43", "Chat-placeholderTitle": "_Chat-placeholderTitle_gflib_57", "Chat-placeholderDescription": "_Chat-placeholderDescription_gflib_62", "Chat-actions": "_Chat-actions_gflib_68", "Chat-action": "_Chat-action_gflib_68", "Chat-actionOutlined": "_Chat-actionOutlined_gflib_77", "Chat-attachmentControls": "_Chat-attachmentControls_gflib_140", "Chat-attachmentInput": "_Chat-attachmentInput_gflib_147", "Chat-attachmentButton": "_Chat-attachmentButton_gflib_151" };
|
|
1047
1047
|
|
|
1048
1048
|
// src/components/ChatBody/index.tsx
|
|
1049
1049
|
init_react_import();
|
|
1050
1050
|
import {
|
|
1051
|
-
useContext
|
|
1052
|
-
useEffect as
|
|
1053
|
-
useMemo
|
|
1054
|
-
useRef as
|
|
1055
|
-
useState as
|
|
1051
|
+
useContext,
|
|
1052
|
+
useEffect as useEffect5,
|
|
1053
|
+
useMemo,
|
|
1054
|
+
useRef as useRef5,
|
|
1055
|
+
useState as useState6
|
|
1056
1056
|
} from "react";
|
|
1057
1057
|
import { useStickToBottom } from "use-stick-to-bottom";
|
|
1058
1058
|
import Markdown from "react-markdown";
|
|
1059
1059
|
|
|
1060
|
-
// ../platform-client/index.ts
|
|
1060
|
+
// ../platform-client/components/IconButton/index.ts
|
|
1061
1061
|
init_react_import();
|
|
1062
1062
|
|
|
1063
|
-
// ../platform-client/components/
|
|
1063
|
+
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1064
1064
|
init_react_import();
|
|
1065
|
+
import { useState as useState3 } from "react";
|
|
1065
1066
|
|
|
1066
|
-
//
|
|
1067
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/IconButton/IconButton.module.css#css-module
|
|
1067
1068
|
init_react_import();
|
|
1069
|
+
var IconButton_module_default = { "IconButton": "_IconButton_voaix_1", "IconButton--disabled": "_IconButton--disabled_voaix_30", "IconButton--dark": "_IconButton--dark_voaix_40", "IconButton-title": "_IconButton-title_voaix_61" };
|
|
1068
1070
|
|
|
1069
|
-
//
|
|
1071
|
+
// ../platform-client/components/Loader/index.tsx
|
|
1070
1072
|
init_react_import();
|
|
1071
|
-
var ActionModal_module_default = { "ActionModal": "_ActionModal_1g44k_1", "ActionModal-header": "_ActionModal-header_1g44k_6", "ActionModal-body": "_ActionModal-body_1g44k_17", "ActionModal-footer": "_ActionModal-footer_1g44k_25" };
|
|
1072
1073
|
|
|
1073
1074
|
// ../platform-client/lib/index.ts
|
|
1074
1075
|
init_react_import();
|
|
1075
1076
|
|
|
1076
|
-
// ../platform-client/lib/get-class-name-factory.ts
|
|
1077
|
-
init_react_import();
|
|
1078
|
-
var import_classnames2 = __toESM(require_classnames());
|
|
1079
|
-
var getClassNameFactory2 = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
|
1080
|
-
let descendant = false;
|
|
1081
|
-
let modifiers = false;
|
|
1082
|
-
if (typeof options === "string") {
|
|
1083
|
-
descendant = options;
|
|
1084
|
-
} else if (typeof options === "object") {
|
|
1085
|
-
modifiers = options;
|
|
1086
|
-
}
|
|
1087
|
-
if (descendant) {
|
|
1088
|
-
const style = styles[`${rootClass}-${descendant}`];
|
|
1089
|
-
if (style) {
|
|
1090
|
-
return baseClass + styles[`${rootClass}-${descendant}`] || "";
|
|
1091
|
-
}
|
|
1092
|
-
return "";
|
|
1093
|
-
} else if (modifiers) {
|
|
1094
|
-
const prefixedModifiers = {};
|
|
1095
|
-
for (let modifier in modifiers) {
|
|
1096
|
-
prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
|
1097
|
-
}
|
|
1098
|
-
const c = styles[rootClass];
|
|
1099
|
-
return baseClass + (0, import_classnames2.default)({
|
|
1100
|
-
[c]: !!c,
|
|
1101
|
-
// only apply the class if it exists
|
|
1102
|
-
...prefixedModifiers
|
|
1103
|
-
});
|
|
1104
|
-
} else {
|
|
1105
|
-
return baseClass + styles[rootClass] || "";
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
var get_class_name_factory_default2 = getClassNameFactory2;
|
|
1109
|
-
|
|
1110
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1111
|
-
init_react_import();
|
|
1112
|
-
|
|
1113
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Modal/Modal.module.css#css-module
|
|
1114
|
-
init_react_import();
|
|
1115
|
-
var Modal_module_default = { "Modal-background": "_Modal-background_mocy5_1", "Modal--visible": "_Modal--visible_mocy5_16", "Modal-modal": "_Modal-modal_mocy5_22" };
|
|
1116
|
-
|
|
1117
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1118
|
-
import { createContext, useContext } from "react";
|
|
1119
|
-
|
|
1120
|
-
// ../platform-client/lib/use-modal-visible.ts
|
|
1121
|
-
init_react_import();
|
|
1122
|
-
import { useEffect as useEffect3, useState as useState3, useRef as useRef4 } from "react";
|
|
1123
|
-
var useModalVisible = (defaultVisible) => {
|
|
1124
|
-
const [visible, setVisible] = useState3(defaultVisible ?? false);
|
|
1125
|
-
const ref = useRef4(null);
|
|
1126
|
-
useEffect3(() => {
|
|
1127
|
-
if (!visible) {
|
|
1128
|
-
return;
|
|
1129
|
-
}
|
|
1130
|
-
const handler = (e) => {
|
|
1131
|
-
if (ref.current && !ref.current.contains(e.target)) {
|
|
1132
|
-
setVisible(false);
|
|
1133
|
-
}
|
|
1134
|
-
};
|
|
1135
|
-
document.body.addEventListener("click", handler);
|
|
1136
|
-
return () => {
|
|
1137
|
-
document.body.removeEventListener("click", handler);
|
|
1138
|
-
};
|
|
1139
|
-
}, [visible]);
|
|
1140
|
-
return [visible, setVisible, ref];
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
|
-
// ../platform-client/components/Button/index.ts
|
|
1144
|
-
init_react_import();
|
|
1145
|
-
|
|
1146
|
-
// ../platform-client/components/Button/Button.tsx
|
|
1147
|
-
init_react_import();
|
|
1148
|
-
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
1149
|
-
|
|
1150
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Button/Button.module.css#css-module
|
|
1151
|
-
init_react_import();
|
|
1152
|
-
var Button_module_default = { "Button": "_Button_16or4_1", "Button--tiny": "_Button--tiny_16or4_34", "Button--small": "_Button--small_16or4_39", "Button--medium": "_Button--medium_16or4_44", "Button--large": "_Button--large_16or4_52", "Button--brand": "_Button--brand_16or4_59", "Button--primary": "_Button--primary_16or4_79", "Button--secondary": "_Button--secondary_16or4_93", "Button--danger": "_Button--danger_16or4_111", "Button--flush": "_Button--flush_16or4_125", "Button--ghost": "_Button--ghost_16or4_129", "Button--disabled": "_Button--disabled_16or4_146", "Button--fullWidth": "_Button--fullWidth_16or4_156", "Button-spinner": "_Button-spinner_16or4_161" };
|
|
1153
|
-
|
|
1154
|
-
// ../platform-client/components/Loader/index.tsx
|
|
1155
|
-
init_react_import();
|
|
1156
|
-
|
|
1157
1077
|
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Loader/styles.module.css#css-module
|
|
1158
1078
|
init_react_import();
|
|
1159
|
-
var styles_module_default2 = { "Loader": "
|
|
1079
|
+
var styles_module_default2 = { "Loader": "_Loader_68nru_13", "loader-animation": "_loader-animation_68nru_1" };
|
|
1160
1080
|
|
|
1161
1081
|
// ../platform-client/components/Loader/index.tsx
|
|
1162
1082
|
import { jsx } from "react/jsx-runtime";
|
|
1163
|
-
var getClassName =
|
|
1083
|
+
var getClassName = getClassNameFactory("Loader", styles_module_default2);
|
|
1164
1084
|
var Loader = ({
|
|
1165
1085
|
color,
|
|
1086
|
+
label = "loading",
|
|
1166
1087
|
size = 16,
|
|
1167
1088
|
...props
|
|
1168
1089
|
}) => {
|
|
@@ -1175,291 +1096,15 @@ var Loader = ({
|
|
|
1175
1096
|
height: size,
|
|
1176
1097
|
color
|
|
1177
1098
|
},
|
|
1178
|
-
"aria-label":
|
|
1099
|
+
"aria-label": label,
|
|
1179
1100
|
...props
|
|
1180
1101
|
}
|
|
1181
1102
|
);
|
|
1182
1103
|
};
|
|
1183
1104
|
|
|
1184
|
-
// ../platform-client/components/Button/Button.tsx
|
|
1185
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1186
|
-
var getClassName2 = get_class_name_factory_default2("Button", Button_module_default);
|
|
1187
|
-
var Button = ({
|
|
1188
|
-
children,
|
|
1189
|
-
href,
|
|
1190
|
-
onClick,
|
|
1191
|
-
variant = "primary",
|
|
1192
|
-
type,
|
|
1193
|
-
disabled,
|
|
1194
|
-
tabIndex,
|
|
1195
|
-
newTab,
|
|
1196
|
-
fullWidth,
|
|
1197
|
-
icon,
|
|
1198
|
-
size = "medium",
|
|
1199
|
-
loading: loadingProp = false
|
|
1200
|
-
}) => {
|
|
1201
|
-
const [loading, setLoading] = useState4(loadingProp);
|
|
1202
|
-
useEffect4(() => {
|
|
1203
|
-
const resetLoading = () => setLoading(loadingProp);
|
|
1204
|
-
resetLoading();
|
|
1205
|
-
window.addEventListener("pageshow", resetLoading);
|
|
1206
|
-
return () => window.removeEventListener("pageshow", resetLoading);
|
|
1207
|
-
}, [loadingProp]);
|
|
1208
|
-
const ElementType = href ? "a" : type ? "button" : "span";
|
|
1209
|
-
const el = /* @__PURE__ */ jsxs(
|
|
1210
|
-
ElementType,
|
|
1211
|
-
{
|
|
1212
|
-
className: getClassName2({
|
|
1213
|
-
brand: variant === "brand",
|
|
1214
|
-
primary: variant === "primary",
|
|
1215
|
-
secondary: variant === "secondary",
|
|
1216
|
-
danger: variant === "danger",
|
|
1217
|
-
ghost: variant === "ghost",
|
|
1218
|
-
// Disabled while its click is still running, too.
|
|
1219
|
-
disabled: disabled || loading,
|
|
1220
|
-
fullWidth,
|
|
1221
|
-
[size]: true
|
|
1222
|
-
}),
|
|
1223
|
-
onClick: (e) => {
|
|
1224
|
-
if (disabled || loading) {
|
|
1225
|
-
e.preventDefault();
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
if (!onClick) return;
|
|
1229
|
-
setLoading(true);
|
|
1230
|
-
Promise.resolve(onClick(e)).then(() => {
|
|
1231
|
-
setLoading(false);
|
|
1232
|
-
});
|
|
1233
|
-
},
|
|
1234
|
-
type,
|
|
1235
|
-
disabled: disabled || loading,
|
|
1236
|
-
tabIndex,
|
|
1237
|
-
target: newTab ? "_blank" : void 0,
|
|
1238
|
-
rel: newTab ? "noreferrer" : void 0,
|
|
1239
|
-
href,
|
|
1240
|
-
children: [
|
|
1241
|
-
icon && /* @__PURE__ */ jsx2("div", { className: getClassName2("icon"), children: icon }),
|
|
1242
|
-
children,
|
|
1243
|
-
loading && /* @__PURE__ */ jsx2("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ jsx2(Loader, { size: 12 }) })
|
|
1244
|
-
]
|
|
1245
|
-
}
|
|
1246
|
-
);
|
|
1247
|
-
return el;
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1251
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1252
|
-
var getClassName3 = getClassNameFactory2("Modal", Modal_module_default);
|
|
1253
|
-
var modalContext = createContext({
|
|
1254
|
-
buttonVariant: "primary",
|
|
1255
|
-
buttonSize: "medium",
|
|
1256
|
-
visible: false,
|
|
1257
|
-
setVisible: () => {
|
|
1258
|
-
},
|
|
1259
|
-
ref: null
|
|
1260
|
-
});
|
|
1261
|
-
var ModalProvider = ({
|
|
1262
|
-
children,
|
|
1263
|
-
defaultVisible,
|
|
1264
|
-
buttonVariant = "primary",
|
|
1265
|
-
buttonSize = "medium"
|
|
1266
|
-
}) => {
|
|
1267
|
-
const [visible, setVisible, ref] = useModalVisible(defaultVisible);
|
|
1268
|
-
return /* @__PURE__ */ jsx3(
|
|
1269
|
-
modalContext.Provider,
|
|
1270
|
-
{
|
|
1271
|
-
value: { buttonVariant, buttonSize, visible, setVisible, ref },
|
|
1272
|
-
children
|
|
1273
|
-
}
|
|
1274
|
-
);
|
|
1275
|
-
};
|
|
1276
|
-
var useModal = () => {
|
|
1277
|
-
const { visible, setVisible } = useContext(modalContext);
|
|
1278
|
-
return { visible, setVisible };
|
|
1279
|
-
};
|
|
1280
|
-
var Modal = ({
|
|
1281
|
-
actionLabel = "Open",
|
|
1282
|
-
children,
|
|
1283
|
-
hideButton = false
|
|
1284
|
-
}) => {
|
|
1285
|
-
const { visible, setVisible, buttonVariant, buttonSize, ref } = useContext(modalContext);
|
|
1286
|
-
return /* @__PURE__ */ jsxs2("div", { className: getClassName3({ visible }), children: [
|
|
1287
|
-
!hideButton && /* @__PURE__ */ jsx3("div", { className: getClassName3("button"), children: /* @__PURE__ */ jsx3(
|
|
1288
|
-
Button,
|
|
1289
|
-
{
|
|
1290
|
-
type: "button",
|
|
1291
|
-
variant: buttonVariant,
|
|
1292
|
-
size: buttonSize,
|
|
1293
|
-
onClick: (e) => {
|
|
1294
|
-
e.stopPropagation();
|
|
1295
|
-
setVisible(!visible);
|
|
1296
|
-
},
|
|
1297
|
-
children: actionLabel
|
|
1298
|
-
}
|
|
1299
|
-
) }),
|
|
1300
|
-
/* @__PURE__ */ jsx3("div", { className: getClassName3("background"), children: /* @__PURE__ */ jsx3("div", { className: getClassName3("modal"), ref, children }) })
|
|
1301
|
-
] });
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
|
-
// ../platform-client/components/Heading/index.ts
|
|
1305
|
-
init_react_import();
|
|
1306
|
-
|
|
1307
|
-
// ../platform-client/components/Heading/Heading.tsx
|
|
1308
|
-
init_react_import();
|
|
1309
|
-
|
|
1310
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
1311
|
-
init_react_import();
|
|
1312
|
-
var Heading_module_default = { "Heading": "_Heading_1sfil_1", "Heading--brand": "_Heading--brand_1sfil_12", "Heading--xxxxl": "_Heading--xxxxl_1sfil_23", "Heading--xxxl": "_Heading--xxxl_1sfil_27", "Heading--xxl": "_Heading--xxl_1sfil_31", "Heading--xl": "_Heading--xl_1sfil_35", "Heading--l": "_Heading--l_1sfil_39", "Heading--m": "_Heading--m_1sfil_43", "Heading--s": "_Heading--s_1sfil_47", "Heading--xs": "_Heading--xs_1sfil_51", "Heading--xxs": "_Heading--xxs_1sfil_55" };
|
|
1313
|
-
|
|
1314
|
-
// ../platform-client/components/Heading/Heading.tsx
|
|
1315
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1316
|
-
var getClassName4 = get_class_name_factory_default2("Heading", Heading_module_default);
|
|
1317
|
-
var Heading = ({
|
|
1318
|
-
children,
|
|
1319
|
-
rank,
|
|
1320
|
-
size = "m",
|
|
1321
|
-
variant = "default"
|
|
1322
|
-
}) => {
|
|
1323
|
-
const Tag2 = rank ? `h${rank}` : "span";
|
|
1324
|
-
return /* @__PURE__ */ jsx4(
|
|
1325
|
-
Tag2,
|
|
1326
|
-
{
|
|
1327
|
-
className: getClassName4({
|
|
1328
|
-
[size]: true,
|
|
1329
|
-
brand: variant === "brand"
|
|
1330
|
-
}),
|
|
1331
|
-
children
|
|
1332
|
-
}
|
|
1333
|
-
);
|
|
1334
|
-
};
|
|
1335
|
-
|
|
1336
|
-
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
1337
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1338
|
-
var getClassName5 = getClassNameFactory2("ActionModal", ActionModal_module_default);
|
|
1339
|
-
var ActionModalFooter = ({ children }) => /* @__PURE__ */ jsx5("div", { className: getClassName5("footer"), children });
|
|
1340
|
-
var ActionModal = ({
|
|
1341
|
-
actionLabel = "Open",
|
|
1342
|
-
children,
|
|
1343
|
-
title,
|
|
1344
|
-
description,
|
|
1345
|
-
actions,
|
|
1346
|
-
hideButton
|
|
1347
|
-
}) => {
|
|
1348
|
-
return /* @__PURE__ */ jsx5(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ jsxs3("div", { className: getClassName5(), children: [
|
|
1349
|
-
/* @__PURE__ */ jsxs3("div", { className: getClassName5("header"), children: [
|
|
1350
|
-
/* @__PURE__ */ jsx5(Heading, { size: "s", children: title }),
|
|
1351
|
-
description && /* @__PURE__ */ jsx5("small", { children: description })
|
|
1352
|
-
] }),
|
|
1353
|
-
/* @__PURE__ */ jsx5("div", { className: getClassName5("body"), children }),
|
|
1354
|
-
actions && /* @__PURE__ */ jsx5(ActionModalFooter, { children: actions })
|
|
1355
|
-
] }) });
|
|
1356
|
-
};
|
|
1357
|
-
ActionModal.Footer = ActionModalFooter;
|
|
1358
|
-
|
|
1359
|
-
// ../platform-client/components/AIAction/index.tsx
|
|
1360
|
-
init_react_import();
|
|
1361
|
-
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1362
|
-
|
|
1363
|
-
// ../platform-client/components/Align/index.ts
|
|
1364
|
-
init_react_import();
|
|
1365
|
-
|
|
1366
|
-
// ../platform-client/components/Align/Align.tsx
|
|
1367
|
-
init_react_import();
|
|
1368
|
-
import React2 from "react";
|
|
1369
|
-
|
|
1370
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Align/Align.module.css#css-module
|
|
1371
|
-
init_react_import();
|
|
1372
|
-
var Align_module_default = { "Align": "_Align_oewlu_1", "Align--horizontalCenter": "_Align--horizontalCenter_oewlu_7", "Align--horizontalRight": "_Align--horizontalRight_oewlu_11", "Align--verticalBottom": "_Align--verticalBottom_oewlu_15", "Align--verticalCenter": "_Align--verticalCenter_oewlu_20", "Align-item": "_Align-item_oewlu_25" };
|
|
1373
|
-
|
|
1374
|
-
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
1375
|
-
init_react_import();
|
|
1376
|
-
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
1377
|
-
var SEPARATORS = /[_.\- ]+/;
|
|
1378
|
-
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
1379
|
-
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
1380
|
-
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
1381
|
-
|
|
1382
|
-
// ../platform-client/components/Align/Align.tsx
|
|
1383
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1384
|
-
var getClassName6 = get_class_name_factory_default2("Align", Align_module_default);
|
|
1385
|
-
|
|
1386
|
-
// ../platform-client/components/AutoForm/index.ts
|
|
1387
|
-
init_react_import();
|
|
1388
|
-
|
|
1389
|
-
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
1390
|
-
init_react_import();
|
|
1391
|
-
import { AutoField, FieldLabel } from "@puckeditor/core";
|
|
1392
|
-
import { useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
|
|
1393
|
-
|
|
1394
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/AutoForm/AutoForm.module.css#css-module
|
|
1395
|
-
init_react_import();
|
|
1396
|
-
var AutoForm_module_default = { "AutoForm": "_AutoForm_1vmh9_1" };
|
|
1397
|
-
|
|
1398
|
-
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
1399
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1400
|
-
var getClassName7 = getClassNameFactory2("AutoForm", AutoForm_module_default);
|
|
1401
|
-
|
|
1402
|
-
// ../platform-client/components/Card/index.ts
|
|
1403
|
-
init_react_import();
|
|
1404
|
-
|
|
1405
|
-
// ../platform-client/components/Card/Card.tsx
|
|
1406
|
-
init_react_import();
|
|
1407
|
-
|
|
1408
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Card/Card.module.css#css-module
|
|
1409
|
-
init_react_import();
|
|
1410
|
-
var Card_module_default = { "Card": "_Card_rpnal_1", "Card-body": "_Card-body_rpnal_17", "Card-title": "_Card-title_rpnal_23", "Card-subtitle": "_Card-subtitle_rpnal_27", "Card-chevron": "_Card-chevron_rpnal_32", "Card--showChevron": "_Card--showChevron_rpnal_38", "Card--isActive": "_Card--isActive_rpnal_42" };
|
|
1411
|
-
|
|
1412
|
-
// ../platform-client/components/Card/Card.tsx
|
|
1413
|
-
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1414
|
-
var getClassName8 = get_class_name_factory_default2("Card", Card_module_default);
|
|
1415
|
-
|
|
1416
|
-
// ../platform-client/components/CardSelector/index.tsx
|
|
1417
|
-
init_react_import();
|
|
1418
|
-
|
|
1419
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/CardSelector/styles.module.css#css-module
|
|
1420
|
-
init_react_import();
|
|
1421
|
-
var styles_module_default3 = { "CardSelector": "_CardSelector_1ogry_1", "CardSelectorOption": "_CardSelectorOption_1ogry_12", "CardSelectorOption--isSelected": "_CardSelectorOption--isSelected_1ogry_23", "CardSelectorOption--disabled": "_CardSelectorOption--disabled_1ogry_27", "CardSelectorOption-description": "_CardSelectorOption-description_1ogry_31", "CardSelectorOption-body": "_CardSelectorOption-body_1ogry_35" };
|
|
1422
|
-
|
|
1423
|
-
// ../platform-client/components/CardSelector/index.tsx
|
|
1424
|
-
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1425
|
-
var cx = get_class_name_factory_default("CardSelector", styles_module_default3);
|
|
1426
|
-
var cxOption = get_class_name_factory_default("CardSelectorOption", styles_module_default3);
|
|
1427
|
-
|
|
1428
|
-
// ../platform-client/components/Code/index.ts
|
|
1429
|
-
init_react_import();
|
|
1430
|
-
|
|
1431
|
-
// ../platform-client/components/Code/Code.tsx
|
|
1432
|
-
init_react_import();
|
|
1433
|
-
|
|
1434
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Code/Code.module.css#css-module
|
|
1435
|
-
init_react_import();
|
|
1436
|
-
var Code_module_default = { "Code": "_Code_d4378_1", "Code-body": "_Code-body_d4378_8", "Code--light": "_Code--light_d4378_19", "Code-header": "_Code-header_d4378_34", "Code-corner": "_Code-corner_d4378_51", "Code-actions": "_Code-actions_d4378_71", "Code--lineNumbers": "_Code--lineNumbers_d4378_76", "Code-tabs": "_Code-tabs_d4378_91", "Tab": "_Tab_d4378_99", "Tab--isActive": "_Tab--isActive_d4378_104", "Tab--light": "_Tab--light_d4378_108", "Tab-button": "_Tab-button_d4378_112" };
|
|
1437
|
-
|
|
1438
|
-
// ../platform-client/components/Code/CopyAction.tsx
|
|
1439
|
-
init_react_import();
|
|
1440
|
-
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1441
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1442
|
-
|
|
1443
|
-
// ../platform-client/components/Code/Code.tsx
|
|
1444
|
-
import { useRef as useRef6, useState as useState7 } from "react";
|
|
1445
|
-
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1446
|
-
var getClassName9 = get_class_name_factory_default("Code", Code_module_default);
|
|
1447
|
-
var getClassNameTab = get_class_name_factory_default("Tab", Code_module_default);
|
|
1448
|
-
|
|
1449
|
-
// ../platform-client/components/IconButton/index.ts
|
|
1450
|
-
init_react_import();
|
|
1451
|
-
|
|
1452
1105
|
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/IconButton/IconButton.module.css#css-module
|
|
1457
|
-
init_react_import();
|
|
1458
|
-
var IconButton_module_default = { "IconButton": "_IconButton_thegm_1", "IconButton--disabled": "_IconButton--disabled_thegm_20", "IconButton--dark": "_IconButton--dark_thegm_26", "IconButton-title": "_IconButton-title_thegm_37" };
|
|
1459
|
-
|
|
1460
|
-
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1461
|
-
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1462
|
-
var getClassName10 = get_class_name_factory_default2("IconButton", IconButton_module_default);
|
|
1106
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1107
|
+
var getClassName2 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
|
1463
1108
|
var IconButton = ({
|
|
1464
1109
|
children,
|
|
1465
1110
|
href,
|
|
@@ -1473,12 +1118,12 @@ var IconButton = ({
|
|
|
1473
1118
|
title,
|
|
1474
1119
|
dark
|
|
1475
1120
|
}) => {
|
|
1476
|
-
const [loading, setLoading] =
|
|
1121
|
+
const [loading, setLoading] = useState3(false);
|
|
1477
1122
|
const ElementType = href ? "a" : onClick ? "button" : "div";
|
|
1478
|
-
const el = /* @__PURE__ */
|
|
1123
|
+
const el = /* @__PURE__ */ jsxs(
|
|
1479
1124
|
ElementType,
|
|
1480
1125
|
{
|
|
1481
|
-
className:
|
|
1126
|
+
className: getClassName2({
|
|
1482
1127
|
primary: variant === "primary",
|
|
1483
1128
|
secondary: variant === "secondary",
|
|
1484
1129
|
disabled,
|
|
@@ -1500,11 +1145,11 @@ var IconButton = ({
|
|
|
1500
1145
|
href,
|
|
1501
1146
|
title,
|
|
1502
1147
|
children: [
|
|
1503
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx2("span", { className: getClassName2("title"), children: title }),
|
|
1504
1149
|
children,
|
|
1505
|
-
loading && /* @__PURE__ */
|
|
1150
|
+
loading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1506
1151
|
"\xA0\xA0",
|
|
1507
|
-
/* @__PURE__ */
|
|
1152
|
+
/* @__PURE__ */ jsx2(Loader, { size: 14 })
|
|
1508
1153
|
] })
|
|
1509
1154
|
]
|
|
1510
1155
|
}
|
|
@@ -1512,284 +1157,26 @@ var IconButton = ({
|
|
|
1512
1157
|
return el;
|
|
1513
1158
|
};
|
|
1514
1159
|
|
|
1515
|
-
// ../platform-client/components/InfoBar/index.tsx
|
|
1516
|
-
init_react_import();
|
|
1517
|
-
|
|
1518
|
-
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
1519
|
-
init_react_import();
|
|
1520
|
-
|
|
1521
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/InfoBar/InfoBar.module.css#css-module
|
|
1522
|
-
init_react_import();
|
|
1523
|
-
var InfoBar_module_default = { "InfoBar": "_InfoBar_kchdj_1", "Info": "_Info_kchdj_1", "Info-title": "_Info-title_kchdj_21" };
|
|
1524
|
-
|
|
1525
|
-
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
1526
|
-
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1527
|
-
var cx2 = getClassNameFactory2("InfoBar", InfoBar_module_default);
|
|
1528
|
-
var cxInfo = getClassNameFactory2("Info", InfoBar_module_default);
|
|
1529
|
-
var Info = ({ title, children }) => {
|
|
1530
|
-
return /* @__PURE__ */ jsxs9("div", { className: cxInfo(), children: [
|
|
1531
|
-
/* @__PURE__ */ jsx14("div", { className: cxInfo("title"), children: title }),
|
|
1532
|
-
/* @__PURE__ */ jsx14("div", { className: cxInfo("children"), children })
|
|
1533
|
-
] });
|
|
1534
|
-
};
|
|
1535
|
-
var InfoBar = ({ children }) => {
|
|
1536
|
-
return /* @__PURE__ */ jsx14("div", { className: cx2(), children });
|
|
1537
|
-
};
|
|
1538
|
-
InfoBar.Info = Info;
|
|
1539
|
-
|
|
1540
|
-
// ../platform-client/components/Inline/index.ts
|
|
1541
|
-
init_react_import();
|
|
1542
|
-
|
|
1543
|
-
// ../platform-client/components/Inline/Inline.tsx
|
|
1544
|
-
init_react_import();
|
|
1545
|
-
|
|
1546
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
1547
|
-
init_react_import();
|
|
1548
|
-
var Inline_module_default = { "Inline": "_Inline_6o5on_3", "Inline-inner": "_Inline-inner_6o5on_7", "Inline--noWrap": "_Inline--noWrap_6o5on_12", "Inline--sizeNONE": "_Inline--sizeNONE_6o5on_16", "Inline--sizeXXS": "_Inline--sizeXXS_6o5on_20", "Inline--sizeXS": "_Inline--sizeXS_6o5on_24", "Inline--sizeS": "_Inline--sizeS_6o5on_28", "Inline--sizeM": "_Inline--sizeM_6o5on_32", "Inline--sizeL": "_Inline--sizeL_6o5on_36", "Inline--center": "_Inline--center_6o5on_40", "Inline--centerH": "_Inline--centerH_6o5on_44", "Inline--grow": "_Inline--grow_6o5on_48" };
|
|
1549
|
-
|
|
1550
|
-
// ../platform-client/components/Inline/Inline.tsx
|
|
1551
|
-
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1552
|
-
var getClassName11 = get_class_name_factory_default2("Inline", Inline_module_default);
|
|
1553
|
-
var Inline = ({
|
|
1554
|
-
children,
|
|
1555
|
-
grow,
|
|
1556
|
-
center,
|
|
1557
|
-
size = "m",
|
|
1558
|
-
noWrap,
|
|
1559
|
-
centerH
|
|
1560
|
-
}) => /* @__PURE__ */ jsx15(
|
|
1561
|
-
"div",
|
|
1562
|
-
{
|
|
1563
|
-
className: getClassName11({
|
|
1564
|
-
grow,
|
|
1565
|
-
center,
|
|
1566
|
-
centerH,
|
|
1567
|
-
noWrap,
|
|
1568
|
-
[`size${size.toUpperCase()}`]: size
|
|
1569
|
-
}),
|
|
1570
|
-
children: /* @__PURE__ */ jsx15("div", { className: getClassName11("inner"), children })
|
|
1571
|
-
}
|
|
1572
|
-
);
|
|
1573
|
-
var InlineItem = ({
|
|
1574
|
-
children,
|
|
1575
|
-
grow,
|
|
1576
|
-
push,
|
|
1577
|
-
shrink
|
|
1578
|
-
}) => /* @__PURE__ */ jsx15(
|
|
1579
|
-
"div",
|
|
1580
|
-
{
|
|
1581
|
-
style: {
|
|
1582
|
-
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
1583
|
-
flexShrink: shrink ? "1" : "0",
|
|
1584
|
-
marginLeft: push ? "auto" : 0,
|
|
1585
|
-
maxWidth: "100%"
|
|
1586
|
-
},
|
|
1587
|
-
children
|
|
1588
|
-
}
|
|
1589
|
-
);
|
|
1590
|
-
Inline.Item = InlineItem;
|
|
1591
|
-
|
|
1592
|
-
// ../platform-client/components/Link/index.ts
|
|
1593
|
-
init_react_import();
|
|
1594
|
-
|
|
1595
|
-
// ../platform-client/components/Link/Link.tsx
|
|
1596
|
-
init_react_import();
|
|
1597
|
-
|
|
1598
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Link/Link.module.css#css-module
|
|
1599
|
-
init_react_import();
|
|
1600
|
-
var Link_module_default = { "Link": "_Link_1j70m_1" };
|
|
1601
|
-
|
|
1602
|
-
// ../platform-client/components/Link/Link.tsx
|
|
1603
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1604
|
-
var getClassName12 = get_class_name_factory_default2("Link", Link_module_default);
|
|
1605
|
-
|
|
1606
|
-
// ../platform-client/components/Menu/index.tsx
|
|
1607
|
-
init_react_import();
|
|
1608
|
-
import { useState as useState9 } from "react";
|
|
1609
|
-
|
|
1610
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Menu/styles.module.css#css-module
|
|
1611
|
-
init_react_import();
|
|
1612
|
-
var styles_module_default4 = { "Menu": "_Menu_1jr57_1", "Menu-content": "_Menu-content_1jr57_6", "Menu-sections": "_Menu-sections_1jr57_11", "Menu-action": "_Menu-action_1jr57_22", "Menu-list": "_Menu-list_1jr57_44", "Menu-item": "_Menu-item_1jr57_55", "Menu-item--disabled": "_Menu-item--disabled_1jr57_84" };
|
|
1613
|
-
|
|
1614
|
-
// ../platform-client/components/Menu/index.tsx
|
|
1615
|
-
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1616
|
-
var getClassName13 = get_class_name_factory_default2("Menu", styles_module_default4);
|
|
1617
|
-
var itemClassName = get_class_name_factory_default2("Menu-item", styles_module_default4);
|
|
1618
|
-
|
|
1619
|
-
// ../platform-client/components/Modal/index.ts
|
|
1620
|
-
init_react_import();
|
|
1621
|
-
|
|
1622
|
-
// ../platform-client/components/Page/index.ts
|
|
1623
|
-
init_react_import();
|
|
1624
|
-
|
|
1625
|
-
// ../platform-client/components/Page/Page.tsx
|
|
1626
|
-
init_react_import();
|
|
1627
|
-
|
|
1628
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Page/Page.module.css#css-module
|
|
1629
|
-
init_react_import();
|
|
1630
|
-
var Page_module_default = { "Page": "_Page_nkzj9_1", "Page-masthead": "_Page-masthead_nkzj9_8", "Page-crumbs": "_Page-crumbs_nkzj9_18", "Page-crumb": "_Page-crumb_nkzj9_18", "Page-crumbLink": "_Page-crumbLink_nkzj9_29", "Page-actions": "_Page-actions_nkzj9_61", "Page-footer": "_Page-footer_nkzj9_65" };
|
|
1631
|
-
|
|
1632
|
-
// ../platform-client/components/Page/Page.tsx
|
|
1633
|
-
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1634
|
-
var cx3 = getClassNameFactory2("Page", Page_module_default);
|
|
1635
|
-
|
|
1636
|
-
// ../platform-client/components/Pagination/index.ts
|
|
1637
|
-
init_react_import();
|
|
1638
|
-
|
|
1639
|
-
// ../platform-client/components/Pagination/Pagination.tsx
|
|
1640
|
-
init_react_import();
|
|
1641
|
-
import { useMemo } from "react";
|
|
1642
|
-
|
|
1643
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Pagination/Pagination.module.css#css-module
|
|
1644
|
-
init_react_import();
|
|
1645
|
-
var Pagination_module_default = { "Pagination": "_Pagination_1okv2_1", "PaginationButton": "_PaginationButton_1okv2_8", "PaginationButton--isActive": "_PaginationButton--isActive_1okv2_20", "Pagination-ellipsis": "_Pagination-ellipsis_1okv2_30" };
|
|
1646
|
-
|
|
1647
|
-
// ../platform-client/components/Pagination/Pagination.tsx
|
|
1648
|
-
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1649
|
-
var cx4 = getClassNameFactory2("Pagination", Pagination_module_default);
|
|
1650
|
-
var cxButton = getClassNameFactory2("PaginationButton", Pagination_module_default);
|
|
1651
|
-
|
|
1652
|
-
// ../platform-client/components/PlanGrid/index.tsx
|
|
1653
|
-
init_react_import();
|
|
1654
|
-
|
|
1655
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/PlanGrid/styles.module.css#css-module
|
|
1656
|
-
init_react_import();
|
|
1657
|
-
var styles_module_default5 = { "PlanGrid": "_PlanGrid_1ar8g_1", "PlanGrid-billingNote": "_PlanGrid-billingNote_1ar8g_8", "PlanGrid-planKicker": "_PlanGrid-planKicker_1ar8g_9", "PlanGrid-tableWrapper": "_PlanGrid-tableWrapper_1ar8g_18", "PlanGrid-table": "_PlanGrid-table_1ar8g_18", "PlanGrid-caption": "_PlanGrid-caption_1ar8g_33", "PlanGrid-featureHeader": "_PlanGrid-featureHeader_1ar8g_43", "PlanGrid-featureName": "_PlanGrid-featureName_1ar8g_44", "PlanGrid-planHeader": "_PlanGrid-planHeader_1ar8g_45", "PlanGrid-featureValue": "_PlanGrid-featureValue_1ar8g_46", "PlanGrid-planHeaderInner": "_PlanGrid-planHeaderInner_1ar8g_76", "PlanGrid-planTitle": "_PlanGrid-planTitle_1ar8g_91", "PlanGrid-planDescription": "_PlanGrid-planDescription_1ar8g_97", "PlanGrid-priceBlock": "_PlanGrid-priceBlock_1ar8g_105", "PlanGrid-price": "_PlanGrid-price_1ar8g_105", "PlanGrid-standardPrice": "_PlanGrid-standardPrice_1ar8g_117", "PlanGrid-priceValue": "_PlanGrid-priceValue_1ar8g_124", "PlanGrid-priceInterval": "_PlanGrid-priceInterval_1ar8g_130", "PlanGrid-priceNote": "_PlanGrid-priceNote_1ar8g_136", "PlanGrid-action": "_PlanGrid-action_1ar8g_143", "PlanGrid-included": "_PlanGrid-included_1ar8g_168", "PlanGrid-unavailable": "_PlanGrid-unavailable_1ar8g_179", "PlanGrid-highlightCell": "_PlanGrid-highlightCell_1ar8g_183", "PlanGrid-enterprise": "_PlanGrid-enterprise_1ar8g_201" };
|
|
1658
|
-
|
|
1659
|
-
// ../utils/lib/format-currency.ts
|
|
1660
|
-
init_react_import();
|
|
1661
|
-
|
|
1662
|
-
// ../platform-client/lib/plan-ids.ts
|
|
1663
|
-
init_react_import();
|
|
1664
|
-
var PAYG_PLAN_ID = "pay-as-you-go_v2";
|
|
1665
|
-
var LAUNCH_PLAN_ID = "launch_monthly_v2";
|
|
1666
|
-
var GROWTH_PLAN_ID = "growth_monthly_v2";
|
|
1667
|
-
var PLAN_RANK = {
|
|
1668
|
-
[PAYG_PLAN_ID]: 0,
|
|
1669
|
-
[LAUNCH_PLAN_ID]: 1,
|
|
1670
|
-
[GROWTH_PLAN_ID]: 2
|
|
1671
|
-
};
|
|
1672
|
-
var LEGACY_PLAN_IDS = [
|
|
1673
|
-
"pro_monthly",
|
|
1674
|
-
"business_monthly",
|
|
1675
|
-
"growth_monthly",
|
|
1676
|
-
"pro_annual",
|
|
1677
|
-
"business_annual",
|
|
1678
|
-
"growth_annual",
|
|
1679
|
-
"pro50_monthly",
|
|
1680
|
-
"business200_monthly",
|
|
1681
|
-
"pro_unlimited_monthly",
|
|
1682
|
-
"business_unlimited_monthly"
|
|
1683
|
-
];
|
|
1684
|
-
var VALID_PLAN_IDS = [
|
|
1685
|
-
...LEGACY_PLAN_IDS,
|
|
1686
|
-
"pay-as-you-go_v2",
|
|
1687
|
-
"launch_monthly_v2",
|
|
1688
|
-
"growth_monthly_v2"
|
|
1689
|
-
];
|
|
1690
|
-
|
|
1691
|
-
// ../platform-client/components/PlanGrid/index.tsx
|
|
1692
|
-
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1693
|
-
var cx5 = get_class_name_factory_default("PlanGrid", styles_module_default5);
|
|
1694
|
-
|
|
1695
|
-
// ../platform-client/components/Section/index.ts
|
|
1696
|
-
init_react_import();
|
|
1697
|
-
|
|
1698
|
-
// ../platform-client/components/Section/Section.tsx
|
|
1699
|
-
init_react_import();
|
|
1700
|
-
|
|
1701
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Section/Section.module.css#css-module
|
|
1702
|
-
init_react_import();
|
|
1703
|
-
var Section_module_default = { "Section-inner": "_Section-inner_1uwo0_1", "Section--flush": "_Section--flush_1uwo0_8", "Section": "_Section_1uwo0_1", "Section--full": "_Section--full_1uwo0_17" };
|
|
1704
|
-
|
|
1705
|
-
// ../platform-client/components/Section/Section.tsx
|
|
1706
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1707
|
-
var getClassName14 = getClassNameFactory2("Section", Section_module_default);
|
|
1708
|
-
|
|
1709
|
-
// ../platform-client/components/StatusTag/index.ts
|
|
1710
|
-
init_react_import();
|
|
1711
|
-
|
|
1712
|
-
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
1713
|
-
init_react_import();
|
|
1714
|
-
|
|
1715
|
-
// ../platform-client/components/Tag/index.ts
|
|
1716
|
-
init_react_import();
|
|
1717
|
-
|
|
1718
|
-
// ../platform-client/components/Tag/Tag.tsx
|
|
1719
|
-
init_react_import();
|
|
1720
|
-
|
|
1721
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Tag/Tag.module.css#css-module
|
|
1722
|
-
init_react_import();
|
|
1723
|
-
var Tag_module_default = { "Tag": "_Tag_162k8_1", "Tag--borderless": "_Tag--borderless_162k8_21", "Tag--colorBlue": "_Tag--colorBlue_162k8_25", "Tag--colorGreen": "_Tag--colorGreen_162k8_30", "Tag--colorRed": "_Tag--colorRed_162k8_34", "Tag--colorMuted": "_Tag--colorMuted_162k8_38", "Tag-sprite": "_Tag-sprite_162k8_42", "Tag--pulse": "_Tag--pulse_162k8_46", "pulse": "_pulse_162k8_1", "Tag-label": "_Tag-label_162k8_80" };
|
|
1724
|
-
|
|
1725
|
-
// ../platform-client/components/Tag/Tag.tsx
|
|
1726
|
-
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1727
|
-
var getClassName15 = getClassNameFactory2("Tag", Tag_module_default);
|
|
1728
|
-
|
|
1729
|
-
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
1730
|
-
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1731
|
-
|
|
1732
|
-
// ../platform-client/components/Table/index.ts
|
|
1733
|
-
init_react_import();
|
|
1734
|
-
|
|
1735
|
-
// ../platform-client/components/Table/Table.tsx
|
|
1736
|
-
init_react_import();
|
|
1737
|
-
import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef7, useState as useState10 } from "react";
|
|
1738
|
-
|
|
1739
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Table/Table.module.css#css-module
|
|
1740
|
-
init_react_import();
|
|
1741
|
-
var Table_module_default = { "Table": "_Table_o345u_1", "Table-filters": "_Table-filters_o345u_9", "Table-inner": "_Table-inner_o345u_13", "Table-table": "_Table-table_o345u_17", "Table--hideHeader": "_Table--hideHeader_o345u_41", "Table-footer": "_Table-footer_o345u_89", "Table--clickableRows": "_Table--clickableRows_o345u_93", "Table-placeholder": "_Table-placeholder_o345u_98", "Table-loader": "_Table-loader_o345u_110", "TableRow--highlightRow": "_TableRow--highlightRow_o345u_114" };
|
|
1742
|
-
|
|
1743
|
-
// ../platform-client/components/Table/Table.tsx
|
|
1744
|
-
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1745
|
-
var getClassName16 = get_class_name_factory_default2("Table", Table_module_default);
|
|
1746
|
-
var getRowClassName = get_class_name_factory_default2("TableRow", Table_module_default);
|
|
1747
|
-
|
|
1748
|
-
// ../platform-client/components/Textarea/index.tsx
|
|
1749
|
-
init_react_import();
|
|
1750
|
-
import { default as default2 } from "react-textarea-autosize";
|
|
1751
|
-
|
|
1752
|
-
// ../platform-client/components/VerticalSpace/index.ts
|
|
1753
|
-
init_react_import();
|
|
1754
|
-
|
|
1755
|
-
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
1756
|
-
init_react_import();
|
|
1757
|
-
|
|
1758
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/VerticalSpace/VerticalSpace.module.css#css-module
|
|
1759
|
-
init_react_import();
|
|
1760
|
-
var VerticalSpace_module_default = { "VerticalSpace": "_VerticalSpace_16t6j_1", "VerticalSpace--size4": "_VerticalSpace--size4_16t6j_5", "VerticalSpace--size8": "_VerticalSpace--size8_16t6j_9", "VerticalSpace--size16": "_VerticalSpace--size16_16t6j_13", "VerticalSpace--size32": "_VerticalSpace--size32_16t6j_17", "VerticalSpace--size40": "_VerticalSpace--size40_16t6j_21", "VerticalSpace--size48": "_VerticalSpace--size48_16t6j_25", "VerticalSpace--size56": "_VerticalSpace--size56_16t6j_29", "VerticalSpace--size96": "_VerticalSpace--size96_16t6j_33", "VerticalSpace--size128": "_VerticalSpace--size128_16t6j_37" };
|
|
1761
|
-
|
|
1762
|
-
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
1763
|
-
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1764
|
-
var getClassName17 = get_class_name_factory_default2("VerticalSpace", VerticalSpace_module_default);
|
|
1765
|
-
|
|
1766
|
-
// ../platform-client/components/Viewport/index.tsx
|
|
1767
|
-
init_react_import();
|
|
1768
|
-
|
|
1769
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Viewport/styles.module.css#css-module
|
|
1770
|
-
init_react_import();
|
|
1771
|
-
var styles_module_default6 = { "Viewport": "_Viewport_1vvhm_3", "Viewport--standard": "_Viewport--standard_1vvhm_6", "Viewport--inline": "_Viewport--inline_1vvhm_7", "Viewport--narrow": "_Viewport--narrow_1vvhm_11", "Viewport--flex": "_Viewport--flex_1vvhm_19" };
|
|
1772
|
-
|
|
1773
|
-
// ../platform-client/components/Viewport/index.tsx
|
|
1774
|
-
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1775
|
-
var cx6 = getClassNameFactory("Viewport", styles_module_default6);
|
|
1776
|
-
|
|
1777
1160
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
1778
1161
|
init_react_import();
|
|
1779
|
-
var
|
|
1162
|
+
var styles_module_default3 = { "Chat": "_Chat_epa47_1", "Chat--hasMessages": "_Chat--hasMessages_epa47_23", "Chat-inner": "_Chat-inner_epa47_34", "Chat--hasChildren": "_Chat--hasChildren_epa47_46", "Chat-body": "_Chat-body_epa47_51", "Chat--isLoading": "_Chat--isLoading_epa47_58", "Chat-messages": "_Chat-messages_epa47_62", "Chat-form": "_Chat-form_epa47_69", "Chat--hideInput": "_Chat--hideInput_epa47_74", "Chat-formHelper": "_Chat-formHelper_epa47_88", "Chat-examplePrompts": "_Chat-examplePrompts_epa47_104", "Chat-examplePrompt": "_Chat-examplePrompt_epa47_104", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_epa47_145", "Chat-default": "_Chat-default_epa47_150", "ChatMessage": "_ChatMessage_epa47_167", "ChatMessage--userRole": "_ChatMessage--userRole_epa47_176", "ChatMessage-userBubble": "_ChatMessage-userBubble_epa47_176", "ChatMessage-userAttachments": "_ChatMessage-userAttachments_epa47_187", "ChatMessage-thumbnail": "_ChatMessage-thumbnail_epa47_193", "ChatMessage-thumbnailLabel": "_ChatMessage-thumbnailLabel_epa47_224", "ChatMessage-text": "_ChatMessage-text_epa47_298", "ChatMessage-event": "_ChatMessage-event_epa47_334", "ChatMessage-eventBody": "_ChatMessage-eventBody_epa47_338", "ChatMessage-eventCollapse": "_ChatMessage-eventCollapse_epa47_347", "ChatMessage-eventHeader": "_ChatMessage-eventHeader_epa47_351", "ChatMessage-eventExpand": "_ChatMessage-eventExpand_epa47_351", "ChatMessage-eventHeader--static": "_ChatMessage-eventHeader--static_epa47_377", "ChatMessage-eventIcon": "_ChatMessage-eventIcon_epa47_383", "ChatMessage-eventLabel": "_ChatMessage-eventLabel_epa47_387", "ChatMessage-attachmentImage": "_ChatMessage-attachmentImage_epa47_401", "ChatMessage-attachmentFile": "_ChatMessage-attachmentFile_epa47_419", "Chat-loader": "_Chat-loader_epa47_443", "Chat-loaderIcon": "_Chat-loaderIcon_epa47_453", "Chat-error": "_Chat-error_epa47_457", "Chat-errorLabel": "_Chat-errorLabel_epa47_466", "Chat-errorAction": "_Chat-errorAction_epa47_470", "Chat-userError": "_Chat-userError_epa47_474", "Chat-userErrorDismiss": "_Chat-userErrorDismiss_epa47_484" };
|
|
1780
1163
|
|
|
1781
1164
|
// src/components/PromptForm/index.tsx
|
|
1782
1165
|
init_react_import();
|
|
1783
1166
|
import {
|
|
1784
1167
|
useCallback as useCallback4,
|
|
1785
|
-
useEffect as
|
|
1786
|
-
useRef as
|
|
1787
|
-
useState as
|
|
1168
|
+
useEffect as useEffect3,
|
|
1169
|
+
useRef as useRef4,
|
|
1170
|
+
useState as useState4
|
|
1788
1171
|
} from "react";
|
|
1789
1172
|
|
|
1173
|
+
// ../platform-client/components/Textarea/index.tsx
|
|
1174
|
+
init_react_import();
|
|
1175
|
+
import { default as default2 } from "react-textarea-autosize";
|
|
1176
|
+
|
|
1790
1177
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PromptForm/styles.module.css#css-module
|
|
1791
1178
|
init_react_import();
|
|
1792
|
-
var
|
|
1179
|
+
var styles_module_default4 = { "PromptForm": "_PromptForm_1p0vz_1", "PromptForm-dropOverlay": "_PromptForm-dropOverlay_1p0vz_15", "PromptForm-inner": "_PromptForm-inner_1p0vz_43", "PromptForm--glow": "_PromptForm--glow_1p0vz_52", "PromptForm-glow": "_PromptForm-glow_1p0vz_52", "loop": "_loop_1p0vz_1", "PromptForm-formInner": "_PromptForm-formInner_1p0vz_85", "PromptForm-input": "_PromptForm-input_1p0vz_94", "PromptForm--isDisabled": "_PromptForm--isDisabled_1p0vz_133", "PromptForm-helper": "_PromptForm-helper_1p0vz_152", "PromptForm-actions": "_PromptForm-actions_1p0vz_162", "PromptForm-actionsLeft": "_PromptForm-actionsLeft_1p0vz_173", "PromptForm-actionsRight": "_PromptForm-actionsRight_1p0vz_182", "PromptForm-actionSubmit": "_PromptForm-actionSubmit_1p0vz_187", "PromptForm--userCta": "_PromptForm--userCta_1p0vz_211", "PromptForm--isLoading": "_PromptForm--isLoading_1p0vz_241", "PromptForm-attachments": "_PromptForm-attachments_1p0vz_247", "PromptForm-attachmentChip": "_PromptForm-attachmentChip_1p0vz_255", "PromptForm-attachmentChipUploading": "_PromptForm-attachmentChipUploading_1p0vz_271", "PromptForm-attachmentChipFailed": "_PromptForm-attachmentChipFailed_1p0vz_275", "PromptForm-attachmentError": "_PromptForm-attachmentError_1p0vz_280", "PromptForm-attachmentSpinner": "_PromptForm-attachmentSpinner_1p0vz_285", "PromptForm-attachmentSpin": "_PromptForm-attachmentSpin_1p0vz_285", "PromptForm-attachmentRemove": "_PromptForm-attachmentRemove_1p0vz_289" };
|
|
1793
1180
|
|
|
1794
1181
|
// src/lib/attachments.ts
|
|
1795
1182
|
init_react_import();
|
|
@@ -1900,15 +1287,59 @@ var truncateFilename = (name, max = 25) => {
|
|
|
1900
1287
|
return `${name.slice(0, available)}\u2026${ext}`;
|
|
1901
1288
|
};
|
|
1902
1289
|
|
|
1290
|
+
// src/lib/dictionary.ts
|
|
1291
|
+
init_react_import();
|
|
1292
|
+
import { createUsePuck } from "@puckeditor/core";
|
|
1293
|
+
var defaultDictionary = {
|
|
1294
|
+
"loader-loading": "loading",
|
|
1295
|
+
"plugin-ai-placeholder-title": "Build with AI",
|
|
1296
|
+
"plugin-ai-placeholder-description": "Describe what you want to create or change.",
|
|
1297
|
+
"plugin-ai-placeholder-write-prompt": "Write a prompt",
|
|
1298
|
+
"plugin-ai-placeholder-browse": "Browse",
|
|
1299
|
+
"plugin-ai-prompt-placeholder": "What do you want to build?",
|
|
1300
|
+
"plugin-ai-prompt-attachment-attach": "Attach files",
|
|
1301
|
+
"plugin-ai-prompt-attachment-drop": "Attach file",
|
|
1302
|
+
"plugin-ai-prompt-attachment-item-failed": "Failed",
|
|
1303
|
+
"plugin-ai-prompt-attachment-item-remove": "Remove attachment",
|
|
1304
|
+
"plugin-ai-prompt-design-mode": "Design",
|
|
1305
|
+
"plugin-ai-prompt-design-mode-enable": "Enable design mode",
|
|
1306
|
+
"plugin-ai-prompt-design-mode-disable": "Disable design mode",
|
|
1307
|
+
"plugin-ai-prompt-error-uploading": "Wait for attachments to finish uploading.",
|
|
1308
|
+
"plugin-ai-prompt-error-attachment-failed": "Remove failed attachments before sending.",
|
|
1309
|
+
"plugin-ai-prompt-error-attachment-upload-failed": "One or more attachments failed to upload.",
|
|
1310
|
+
"plugin-ai-prompt-error-max-files": "You can attach up to {count} files per message.",
|
|
1311
|
+
"plugin-ai-prompt-error-max-size": "{name} exceeds the {limit} MB file size limit.",
|
|
1312
|
+
"plugin-ai-prompt-error-type": "Unsupported file type: {name}",
|
|
1313
|
+
"plugin-ai-prompt-error-dismiss": "Dismiss",
|
|
1314
|
+
"plugin-ai-chat-msg-thinking": "Thinking...",
|
|
1315
|
+
"plugin-ai-chat-msg-thought-for": "Thought for {seconds}s",
|
|
1316
|
+
"plugin-ai-chat-msg-thought": "Thought for a while",
|
|
1317
|
+
"plugin-ai-chat-msg-attachment": "Attachment",
|
|
1318
|
+
"plugin-ai-chat-error": "Something went wrong.",
|
|
1319
|
+
"plugin-ai-chat-error-retry": "Retry",
|
|
1320
|
+
"plugin-ai-components-manage": "Manage components",
|
|
1321
|
+
"plugin-ai-components-manage-empty": "No dynamic components",
|
|
1322
|
+
"plugin-ai-components-delete": "Delete",
|
|
1323
|
+
"plugin-ai-components-delete-title": "Delete component",
|
|
1324
|
+
"plugin-ai-components-delete-confirm": "Are you sure you want to delete {label}?",
|
|
1325
|
+
"plugin-ai-components-delete-cancel": "Cancel"
|
|
1326
|
+
};
|
|
1327
|
+
var usePuck = createUsePuck();
|
|
1328
|
+
var interpolate = (message, params = {}) => message.replace(
|
|
1329
|
+
/\{(\w+)\}/g,
|
|
1330
|
+
(match, key) => params[key] !== void 0 ? String(params[key]) : match
|
|
1331
|
+
);
|
|
1332
|
+
var getMessage = (dictionary, key, params) => interpolate(dictionary[key] ?? defaultDictionary[key], params);
|
|
1333
|
+
var useMessage = (key, params) => usePuck((s) => getMessage(s.dictionary, key, params));
|
|
1334
|
+
|
|
1903
1335
|
// src/components/PromptForm/index.tsx
|
|
1904
|
-
import { jsx as
|
|
1905
|
-
var
|
|
1336
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1337
|
+
var cx = getClassNameFactory("PromptForm", styles_module_default4);
|
|
1906
1338
|
function PromptForm({
|
|
1907
1339
|
actions,
|
|
1908
1340
|
attachments,
|
|
1909
1341
|
onFileDrop,
|
|
1910
1342
|
onRemoveAttachment,
|
|
1911
|
-
colorScheme = "light",
|
|
1912
1343
|
glow,
|
|
1913
1344
|
handleSubmit,
|
|
1914
1345
|
helperText,
|
|
@@ -1921,11 +1352,19 @@ function PromptForm({
|
|
|
1921
1352
|
maxRows = 5,
|
|
1922
1353
|
value = ""
|
|
1923
1354
|
}) {
|
|
1924
|
-
const
|
|
1925
|
-
const
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
const
|
|
1355
|
+
const dropLabel = useMessage("plugin-ai-prompt-attachment-drop");
|
|
1356
|
+
const attachmentFailedLabel = useMessage(
|
|
1357
|
+
"plugin-ai-prompt-attachment-item-failed"
|
|
1358
|
+
);
|
|
1359
|
+
const attachmentRemoveLabel = useMessage(
|
|
1360
|
+
"plugin-ai-prompt-attachment-item-remove"
|
|
1361
|
+
);
|
|
1362
|
+
const loadingLabel = useMessage("loader-loading");
|
|
1363
|
+
const hasSetInitialPrompt = useRef4(false);
|
|
1364
|
+
const [prompt, setPrompt] = useState4(value);
|
|
1365
|
+
const internalRef = useRef4(null);
|
|
1366
|
+
const [isDragOver, setIsDragOver] = useState4(false);
|
|
1367
|
+
const dragCounterRef = useRef4(0);
|
|
1929
1368
|
const canDrop = !!onFileDrop && !isDisabled && !isLoading;
|
|
1930
1369
|
const handleDragEnter = useCallback4(
|
|
1931
1370
|
(e) => {
|
|
@@ -1971,7 +1410,7 @@ function PromptForm({
|
|
|
1971
1410
|
},
|
|
1972
1411
|
[canDrop, onFileDrop]
|
|
1973
1412
|
);
|
|
1974
|
-
|
|
1413
|
+
useEffect3(() => {
|
|
1975
1414
|
setPrompt(value);
|
|
1976
1415
|
}, [setPrompt, value]);
|
|
1977
1416
|
const sendPrompt = async () => {
|
|
@@ -1986,7 +1425,7 @@ function PromptForm({
|
|
|
1986
1425
|
setPrompt("");
|
|
1987
1426
|
}
|
|
1988
1427
|
};
|
|
1989
|
-
|
|
1428
|
+
useEffect3(() => {
|
|
1990
1429
|
const currentUrl = new URL(location.href);
|
|
1991
1430
|
const initialPrompt = currentUrl.searchParams.get("initialPrompt");
|
|
1992
1431
|
if (!hasSetInitialPrompt.current && initialPrompt && prompt === "") {
|
|
@@ -1994,13 +1433,12 @@ function PromptForm({
|
|
|
1994
1433
|
setPrompt(initialPrompt);
|
|
1995
1434
|
}
|
|
1996
1435
|
}, [setPrompt]);
|
|
1997
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsxs2(
|
|
1998
1437
|
"div",
|
|
1999
1438
|
{
|
|
2000
|
-
className:
|
|
1439
|
+
className: cx({
|
|
2001
1440
|
isDisabled,
|
|
2002
1441
|
isLoading,
|
|
2003
|
-
dark: colorScheme === "dark",
|
|
2004
1442
|
glow,
|
|
2005
1443
|
userCta: !!cta
|
|
2006
1444
|
}),
|
|
@@ -2009,56 +1447,57 @@ function PromptForm({
|
|
|
2009
1447
|
onDragOver: onFileDrop ? handleDragOver : void 0,
|
|
2010
1448
|
onDrop: onFileDrop ? handleDrop : void 0,
|
|
2011
1449
|
children: [
|
|
2012
|
-
isDragOver ? /* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__PURE__ */
|
|
1450
|
+
isDragOver ? /* @__PURE__ */ jsxs2("div", { className: cx("dropOverlay"), children: [
|
|
1451
|
+
/* @__PURE__ */ jsx3(Paperclip, { size: 20 }),
|
|
1452
|
+
/* @__PURE__ */ jsx3("span", { children: dropLabel })
|
|
2015
1453
|
] }) : null,
|
|
2016
|
-
helperText ? /* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
1454
|
+
helperText ? /* @__PURE__ */ jsx3("div", { className: cx("helper"), children: helperText }) : null,
|
|
1455
|
+
/* @__PURE__ */ jsxs2("div", { className: cx("inner"), children: [
|
|
1456
|
+
/* @__PURE__ */ jsx3("span", { className: cx("glow") }),
|
|
1457
|
+
/* @__PURE__ */ jsx3(
|
|
2020
1458
|
"form",
|
|
2021
1459
|
{
|
|
2022
1460
|
onSubmit: (e) => {
|
|
2023
1461
|
e.preventDefault();
|
|
2024
1462
|
void sendPrompt();
|
|
2025
1463
|
},
|
|
2026
|
-
children: /* @__PURE__ */
|
|
2027
|
-
attachments && attachments.length > 0 ? /* @__PURE__ */
|
|
1464
|
+
children: /* @__PURE__ */ jsxs2("div", { className: cx("formInner"), children: [
|
|
1465
|
+
attachments && attachments.length > 0 ? /* @__PURE__ */ jsx3("div", { className: cx("attachments"), children: attachments.map((attachment) => /* @__PURE__ */ jsxs2(
|
|
2028
1466
|
"div",
|
|
2029
1467
|
{
|
|
2030
1468
|
className: [
|
|
2031
|
-
|
|
2032
|
-
attachment.status === "uploading" ?
|
|
2033
|
-
attachment.status === "failed" ?
|
|
1469
|
+
cx("attachmentChip"),
|
|
1470
|
+
attachment.status === "uploading" ? cx("attachmentChipUploading") : "",
|
|
1471
|
+
attachment.status === "failed" ? cx("attachmentChipFailed") : ""
|
|
2034
1472
|
].filter(Boolean).join(" "),
|
|
2035
1473
|
children: [
|
|
2036
|
-
attachment.status === "uploading" ? /* @__PURE__ */
|
|
1474
|
+
attachment.status === "uploading" ? /* @__PURE__ */ jsx3(
|
|
2037
1475
|
LoaderCircle,
|
|
2038
1476
|
{
|
|
2039
|
-
className:
|
|
1477
|
+
className: cx("attachmentSpinner"),
|
|
2040
1478
|
size: 14
|
|
2041
1479
|
}
|
|
2042
1480
|
) : null,
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
attachment.status === "failed" ? /* @__PURE__ */
|
|
2045
|
-
onRemoveAttachment ? /* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ jsx3("span", { title: attachment.filename, children: truncateFilename(attachment.filename) }),
|
|
1482
|
+
attachment.status === "failed" ? /* @__PURE__ */ jsx3("span", { className: cx("attachmentError"), children: attachmentFailedLabel }) : null,
|
|
1483
|
+
onRemoveAttachment ? /* @__PURE__ */ jsx3(
|
|
2046
1484
|
"button",
|
|
2047
1485
|
{
|
|
2048
|
-
|
|
1486
|
+
"aria-label": attachmentRemoveLabel,
|
|
1487
|
+
className: cx("attachmentRemove"),
|
|
2049
1488
|
onClick: () => onRemoveAttachment(attachment.clientId),
|
|
2050
1489
|
type: "button",
|
|
2051
|
-
children: /* @__PURE__ */
|
|
1490
|
+
children: /* @__PURE__ */ jsx3(X, { size: 12 })
|
|
2052
1491
|
}
|
|
2053
1492
|
) : null
|
|
2054
1493
|
]
|
|
2055
1494
|
},
|
|
2056
1495
|
attachment.clientId
|
|
2057
1496
|
)) }) : null,
|
|
2058
|
-
/* @__PURE__ */
|
|
1497
|
+
/* @__PURE__ */ jsx3(
|
|
2059
1498
|
default2,
|
|
2060
1499
|
{
|
|
2061
|
-
className:
|
|
1500
|
+
className: cx("input"),
|
|
2062
1501
|
name: "prompt",
|
|
2063
1502
|
minRows,
|
|
2064
1503
|
maxRows,
|
|
@@ -2086,34 +1525,34 @@ function PromptForm({
|
|
|
2086
1525
|
}
|
|
2087
1526
|
}
|
|
2088
1527
|
),
|
|
2089
|
-
/* @__PURE__ */
|
|
1528
|
+
/* @__PURE__ */ jsxs2(
|
|
2090
1529
|
"div",
|
|
2091
1530
|
{
|
|
2092
|
-
className:
|
|
1531
|
+
className: cx("actions"),
|
|
2093
1532
|
onClick: () => {
|
|
2094
1533
|
internalRef?.current?.focus();
|
|
2095
1534
|
},
|
|
2096
1535
|
children: [
|
|
2097
|
-
/* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ jsx3(
|
|
2098
1537
|
"div",
|
|
2099
1538
|
{
|
|
2100
|
-
className:
|
|
1539
|
+
className: cx("actionsLeft"),
|
|
2101
1540
|
onClick: (e) => e.stopPropagation(),
|
|
2102
1541
|
children: actions
|
|
2103
1542
|
}
|
|
2104
1543
|
),
|
|
2105
|
-
/* @__PURE__ */
|
|
1544
|
+
/* @__PURE__ */ jsx3(
|
|
2106
1545
|
"div",
|
|
2107
1546
|
{
|
|
2108
|
-
className:
|
|
1547
|
+
className: cx("actionsRight"),
|
|
2109
1548
|
onClick: (e) => e.stopPropagation(),
|
|
2110
|
-
children: /* @__PURE__ */
|
|
1549
|
+
children: /* @__PURE__ */ jsx3(
|
|
2111
1550
|
"button",
|
|
2112
1551
|
{
|
|
2113
|
-
className:
|
|
1552
|
+
className: cx("actionSubmit"),
|
|
2114
1553
|
type: "submit",
|
|
2115
1554
|
disabled: isLoading,
|
|
2116
|
-
children: isLoading ? /* @__PURE__ */
|
|
1555
|
+
children: isLoading ? /* @__PURE__ */ jsx3(Loader, { size: 18, label: loadingLabel }) : cta ?? /* @__PURE__ */ jsx3(ArrowUp, { size: 24 })
|
|
2117
1556
|
}
|
|
2118
1557
|
)
|
|
2119
1558
|
}
|
|
@@ -2132,21 +1571,21 @@ function PromptForm({
|
|
|
2132
1571
|
|
|
2133
1572
|
// src/lib/context.ts
|
|
2134
1573
|
init_react_import();
|
|
2135
|
-
import { createContext
|
|
2136
|
-
var toolStatusContext =
|
|
1574
|
+
import { createContext } from "react";
|
|
1575
|
+
var toolStatusContext = createContext({});
|
|
2137
1576
|
var ToolStatusProvider = toolStatusContext.Provider;
|
|
2138
|
-
var hostContext =
|
|
1577
|
+
var hostContext = createContext(void 0);
|
|
2139
1578
|
var HostProvider = hostContext.Provider;
|
|
2140
|
-
var subagentStateContext =
|
|
1579
|
+
var subagentStateContext = createContext({});
|
|
2141
1580
|
var SubagentStateProvider = subagentStateContext.Provider;
|
|
2142
1581
|
|
|
2143
1582
|
// src/lib/use-attachment-url.ts
|
|
2144
1583
|
init_react_import();
|
|
2145
|
-
import { useEffect as
|
|
1584
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
2146
1585
|
function useAttachmentUrl(url, endpoint) {
|
|
2147
1586
|
const isRef = getAttachmentIdFromRef(url) !== null;
|
|
2148
|
-
const [fetched, setFetched] =
|
|
2149
|
-
|
|
1587
|
+
const [fetched, setFetched] = useState5();
|
|
1588
|
+
useEffect4(() => {
|
|
2150
1589
|
if (!isRef) return;
|
|
2151
1590
|
const controller = new AbortController();
|
|
2152
1591
|
const loadUrl = async () => {
|
|
@@ -2170,9 +1609,9 @@ function useAttachmentUrl(url, endpoint) {
|
|
|
2170
1609
|
}
|
|
2171
1610
|
|
|
2172
1611
|
// src/components/ChatBody/index.tsx
|
|
2173
|
-
import { Fragment as
|
|
2174
|
-
var
|
|
2175
|
-
var cxMessage =
|
|
1612
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1613
|
+
var cx2 = getClassNameFactory("Chat", styles_module_default3);
|
|
1614
|
+
var cxMessage = getClassNameFactory("ChatMessage", styles_module_default3);
|
|
2176
1615
|
function ChatBody({
|
|
2177
1616
|
actions,
|
|
2178
1617
|
attachments,
|
|
@@ -2191,49 +1630,55 @@ function ChatBody({
|
|
|
2191
1630
|
onDismissUserError
|
|
2192
1631
|
}) {
|
|
2193
1632
|
const { scrollRef, contentRef } = useStickToBottom();
|
|
1633
|
+
const loadingLabel = useMessage("loader-loading");
|
|
1634
|
+
const thinkingLabel = useMessage("plugin-ai-chat-msg-thinking");
|
|
1635
|
+
const errorLabel = useMessage("plugin-ai-chat-error");
|
|
1636
|
+
const retryLabel = useMessage("plugin-ai-chat-error-retry");
|
|
1637
|
+
const dismissLabel = useMessage("plugin-ai-prompt-error-dismiss");
|
|
1638
|
+
const promptPlaceholder = useMessage("plugin-ai-prompt-placeholder");
|
|
2194
1639
|
const hasMessages = messages && messages.length > 0;
|
|
2195
1640
|
const lastMessage = hasMessages ? messages[messages.length - 1] : null;
|
|
2196
1641
|
const lastPart = lastMessage ? lastMessage.parts[lastMessage.parts.length - 1] : null;
|
|
2197
1642
|
const isLoading = status === "submitted" || status === "streaming" && !lastPart;
|
|
2198
|
-
return /* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ jsxs3(
|
|
2199
1644
|
"div",
|
|
2200
1645
|
{
|
|
2201
|
-
className:
|
|
1646
|
+
className: cx2({
|
|
2202
1647
|
hasMessages,
|
|
2203
1648
|
hasChildren: !!children,
|
|
2204
1649
|
hideInput,
|
|
2205
1650
|
isLoading
|
|
2206
1651
|
}),
|
|
2207
1652
|
children: [
|
|
2208
|
-
children ? /* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
isLoading && /* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__PURE__ */
|
|
1653
|
+
children ? /* @__PURE__ */ jsx4("div", { className: cx2("default"), children }) : null,
|
|
1654
|
+
/* @__PURE__ */ jsxs3("div", { className: cx2("inner"), children: [
|
|
1655
|
+
/* @__PURE__ */ jsxs3("div", { className: cx2("body"), ref: scrollRef, children: [
|
|
1656
|
+
/* @__PURE__ */ jsx4("div", { className: cx2("messages"), ref: contentRef, children: messages.toReversed().filter((message) => !shouldHideMessage(message)).map((message) => /* @__PURE__ */ jsx4(ChatMessage, { message }, message.id)) }),
|
|
1657
|
+
isLoading && /* @__PURE__ */ jsxs3("div", { className: cx2("loader"), children: [
|
|
1658
|
+
/* @__PURE__ */ jsx4("div", { className: cx2("loaderIcon"), children: /* @__PURE__ */ jsx4(Loader, { size: 16, label: loadingLabel }) }),
|
|
1659
|
+
/* @__PURE__ */ jsx4("div", { children: thinkingLabel })
|
|
2215
1660
|
] })
|
|
2216
1661
|
] }),
|
|
2217
|
-
error && /* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
handleRetry && /* @__PURE__ */
|
|
1662
|
+
error && /* @__PURE__ */ jsxs3("div", { className: cx2("error"), children: [
|
|
1663
|
+
/* @__PURE__ */ jsx4("div", { className: cx2("errorLabel"), children: errorLabel }),
|
|
1664
|
+
handleRetry && /* @__PURE__ */ jsx4("div", { className: cx2("errorAction"), children: /* @__PURE__ */ jsx4(IconButton, { title: retryLabel, onClick: handleRetry, children: /* @__PURE__ */ jsx4(RotateCcw, { size: "14" }) }) })
|
|
2220
1665
|
] }),
|
|
2221
|
-
userError && /* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
onDismissUserError && /* @__PURE__ */
|
|
1666
|
+
userError && /* @__PURE__ */ jsxs3("div", { className: cx2("userError"), children: [
|
|
1667
|
+
/* @__PURE__ */ jsx4("span", { children: userError }),
|
|
1668
|
+
onDismissUserError && /* @__PURE__ */ jsx4(
|
|
2224
1669
|
"button",
|
|
2225
1670
|
{
|
|
2226
|
-
"aria-label":
|
|
2227
|
-
title:
|
|
2228
|
-
className:
|
|
1671
|
+
"aria-label": dismissLabel,
|
|
1672
|
+
title: dismissLabel,
|
|
1673
|
+
className: cx2("userErrorDismiss"),
|
|
2229
1674
|
onClick: onDismissUserError,
|
|
2230
1675
|
type: "button",
|
|
2231
|
-
children: /* @__PURE__ */
|
|
1676
|
+
children: /* @__PURE__ */ jsx4(X, { size: 14 })
|
|
2232
1677
|
}
|
|
2233
1678
|
)
|
|
2234
1679
|
] }),
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
1680
|
+
/* @__PURE__ */ jsxs3("div", { className: cx2("form"), children: [
|
|
1681
|
+
/* @__PURE__ */ jsx4(
|
|
2237
1682
|
PromptForm,
|
|
2238
1683
|
{
|
|
2239
1684
|
actions,
|
|
@@ -2244,10 +1689,10 @@ function ChatBody({
|
|
|
2244
1689
|
handleSubmit,
|
|
2245
1690
|
inputRef,
|
|
2246
1691
|
isLoading: status === "submitted" || status === "streaming",
|
|
2247
|
-
placeholder:
|
|
1692
|
+
placeholder: promptPlaceholder
|
|
2248
1693
|
}
|
|
2249
1694
|
),
|
|
2250
|
-
examplePrompts ? /* @__PURE__ */
|
|
1695
|
+
examplePrompts ? /* @__PURE__ */ jsx4("div", { className: cx2("examplePrompts"), children: examplePrompts }) : null
|
|
2251
1696
|
] })
|
|
2252
1697
|
] })
|
|
2253
1698
|
]
|
|
@@ -2272,17 +1717,17 @@ function mergeReasoningParts(parts) {
|
|
|
2272
1717
|
}
|
|
2273
1718
|
function ChatMessage({ message }) {
|
|
2274
1719
|
const { role, parts: rawParts } = message;
|
|
2275
|
-
const parts =
|
|
1720
|
+
const parts = useMemo(() => mergeReasoningParts(rawParts), [rawParts]);
|
|
2276
1721
|
if (role === "user") {
|
|
2277
1722
|
const attachmentParts = parts.filter((part) => part.type === "file");
|
|
2278
1723
|
const otherParts = parts.filter((part) => part.type !== "file");
|
|
2279
|
-
return /* @__PURE__ */
|
|
1724
|
+
return /* @__PURE__ */ jsx4(
|
|
2280
1725
|
"div",
|
|
2281
1726
|
{
|
|
2282
1727
|
className: cxMessage({ userRole: true }),
|
|
2283
1728
|
"data-message-id": message.id,
|
|
2284
|
-
children: /* @__PURE__ */
|
|
2285
|
-
otherParts.map((part, i) => /* @__PURE__ */
|
|
1729
|
+
children: /* @__PURE__ */ jsxs3("div", { className: cxMessage("userBubble"), children: [
|
|
1730
|
+
otherParts.map((part, i) => /* @__PURE__ */ jsx4(
|
|
2286
1731
|
ChatMessagePart,
|
|
2287
1732
|
{
|
|
2288
1733
|
part,
|
|
@@ -2290,7 +1735,7 @@ function ChatMessage({ message }) {
|
|
|
2290
1735
|
},
|
|
2291
1736
|
`${message.id}-${part.type}-${i}`
|
|
2292
1737
|
)),
|
|
2293
|
-
attachmentParts.length > 0 ? /* @__PURE__ */
|
|
1738
|
+
attachmentParts.length > 0 ? /* @__PURE__ */ jsx4("div", { className: cxMessage("userAttachments"), children: attachmentParts.map((part, i) => /* @__PURE__ */ jsx4(
|
|
2294
1739
|
ChatAttachmentThumbnail,
|
|
2295
1740
|
{
|
|
2296
1741
|
filename: part.filename,
|
|
@@ -2303,12 +1748,12 @@ function ChatMessage({ message }) {
|
|
|
2303
1748
|
}
|
|
2304
1749
|
);
|
|
2305
1750
|
}
|
|
2306
|
-
return /* @__PURE__ */
|
|
1751
|
+
return /* @__PURE__ */ jsx4(
|
|
2307
1752
|
"div",
|
|
2308
1753
|
{
|
|
2309
1754
|
className: cxMessage({ [`${role}Role`]: true }),
|
|
2310
1755
|
"data-message-id": message.id,
|
|
2311
|
-
children: parts.map((part, i) => /* @__PURE__ */
|
|
1756
|
+
children: parts.map((part, i) => /* @__PURE__ */ jsx4(
|
|
2312
1757
|
ChatMessagePart,
|
|
2313
1758
|
{
|
|
2314
1759
|
part,
|
|
@@ -2324,13 +1769,14 @@ function ChatAttachmentThumbnail({
|
|
|
2324
1769
|
mediaType,
|
|
2325
1770
|
url
|
|
2326
1771
|
}) {
|
|
2327
|
-
const host =
|
|
1772
|
+
const host = useContext(hostContext);
|
|
2328
1773
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2329
1774
|
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2330
1775
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2331
|
-
const
|
|
1776
|
+
const fallbackLabel = useMessage("plugin-ai-chat-msg-attachment");
|
|
1777
|
+
const label = filename || attachmentId || fallbackLabel;
|
|
2332
1778
|
const isImage = mediaType.startsWith("image/");
|
|
2333
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ jsxs3(
|
|
2334
1780
|
"a",
|
|
2335
1781
|
{
|
|
2336
1782
|
"aria-label": label,
|
|
@@ -2340,8 +1786,8 @@ function ChatAttachmentThumbnail({
|
|
|
2340
1786
|
target: "_blank",
|
|
2341
1787
|
title: label,
|
|
2342
1788
|
children: [
|
|
2343
|
-
isImage ? resolvedUrl && /* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
1789
|
+
isImage ? resolvedUrl && /* @__PURE__ */ jsx4("img", { alt: label, src: resolvedUrl }) : /* @__PURE__ */ jsx4(FileText, { size: 20 }),
|
|
1790
|
+
/* @__PURE__ */ jsx4("span", { className: cxMessage("thumbnailLabel"), children: label })
|
|
2345
1791
|
]
|
|
2346
1792
|
}
|
|
2347
1793
|
);
|
|
@@ -2356,24 +1802,25 @@ function ChatMessageWrapper({
|
|
|
2356
1802
|
role
|
|
2357
1803
|
}) {
|
|
2358
1804
|
if (role === "assistant" || role === "user") {
|
|
2359
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx4(Markdown, { children });
|
|
2360
1806
|
}
|
|
2361
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ jsx4("span", { children });
|
|
2362
1808
|
}
|
|
2363
1809
|
function ReasoningBlock({ part }) {
|
|
2364
|
-
const startTimeRef =
|
|
2365
|
-
const [durationSecs, setDurationSecs] =
|
|
1810
|
+
const startTimeRef = useRef5(null);
|
|
1811
|
+
const [durationSecs, setDurationSecs] = useState6(null);
|
|
2366
1812
|
if (part.state !== "done" && startTimeRef.current === null) {
|
|
2367
1813
|
startTimeRef.current = Date.now();
|
|
2368
1814
|
}
|
|
2369
|
-
|
|
1815
|
+
useEffect5(() => {
|
|
2370
1816
|
if (part.state === "done" && startTimeRef.current !== null) {
|
|
2371
1817
|
setDurationSecs(Math.round((Date.now() - startTimeRef.current) / 1e3));
|
|
2372
1818
|
}
|
|
2373
1819
|
}, [part.state]);
|
|
2374
1820
|
const loading = part.state ? part.state !== "done" : false;
|
|
2375
|
-
const
|
|
2376
|
-
|
|
1821
|
+
const labelKey = durationSecs !== null ? "plugin-ai-chat-msg-thought-for" : !loading ? "plugin-ai-chat-msg-thought" : "plugin-ai-chat-msg-thinking";
|
|
1822
|
+
const label = useMessage(labelKey, { seconds: durationSecs ?? 0 });
|
|
1823
|
+
return /* @__PURE__ */ jsx4(
|
|
2377
1824
|
ChatEvent,
|
|
2378
1825
|
{
|
|
2379
1826
|
status: {
|
|
@@ -2381,7 +1828,7 @@ function ReasoningBlock({ part }) {
|
|
|
2381
1828
|
loading,
|
|
2382
1829
|
summary: part.text
|
|
2383
1830
|
},
|
|
2384
|
-
icon: /* @__PURE__ */
|
|
1831
|
+
icon: /* @__PURE__ */ jsx4(Brain, { size: 18 })
|
|
2385
1832
|
}
|
|
2386
1833
|
);
|
|
2387
1834
|
}
|
|
@@ -2390,19 +1837,19 @@ function ChatMessagePart({
|
|
|
2390
1837
|
role
|
|
2391
1838
|
}) {
|
|
2392
1839
|
if (part.type === "text") {
|
|
2393
|
-
return /* @__PURE__ */
|
|
1840
|
+
return /* @__PURE__ */ jsx4("div", { className: cxMessage("text"), children: /* @__PURE__ */ jsx4(ChatMessageWrapper, { role, children: part.text }) });
|
|
2394
1841
|
}
|
|
2395
1842
|
if (part.type === "reasoning") {
|
|
2396
|
-
return /* @__PURE__ */
|
|
1843
|
+
return /* @__PURE__ */ jsx4(ReasoningBlock, { part });
|
|
2397
1844
|
}
|
|
2398
1845
|
if (part.type === "tool-subagent") {
|
|
2399
|
-
return /* @__PURE__ */
|
|
1846
|
+
return /* @__PURE__ */ jsx4(SubagentBlock, { toolCallId: part.toolCallId });
|
|
2400
1847
|
}
|
|
2401
1848
|
if (part.type.startsWith("tool-")) {
|
|
2402
|
-
return /* @__PURE__ */
|
|
1849
|
+
return /* @__PURE__ */ jsx4(PuckTool, { ...part });
|
|
2403
1850
|
}
|
|
2404
1851
|
if (part.type === "file") {
|
|
2405
|
-
return /* @__PURE__ */
|
|
1852
|
+
return /* @__PURE__ */ jsx4(
|
|
2406
1853
|
ChatAttachment,
|
|
2407
1854
|
{
|
|
2408
1855
|
filename: part.filename,
|
|
@@ -2418,87 +1865,87 @@ function ChatAttachment({
|
|
|
2418
1865
|
mediaType,
|
|
2419
1866
|
url
|
|
2420
1867
|
}) {
|
|
2421
|
-
const host =
|
|
1868
|
+
const host = useContext(hostContext);
|
|
2422
1869
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2423
1870
|
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2424
1871
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2425
|
-
const
|
|
1872
|
+
const fallbackLabel = useMessage("plugin-ai-chat-msg-attachment");
|
|
1873
|
+
const label = filename || attachmentId || fallbackLabel;
|
|
2426
1874
|
if (mediaType.startsWith("image/")) {
|
|
2427
|
-
return /* @__PURE__ */
|
|
1875
|
+
return /* @__PURE__ */ jsx4("div", { className: cxMessage("attachmentImage"), children: /* @__PURE__ */ jsx4("a", { href: resolvedUrl, target: "_blank", rel: "noreferrer", children: resolvedUrl && /* @__PURE__ */ jsx4("img", { alt: label, src: resolvedUrl }) }) });
|
|
2428
1876
|
}
|
|
2429
|
-
return /* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2431
|
-
/* @__PURE__ */
|
|
1877
|
+
return /* @__PURE__ */ jsx4("div", { className: cxMessage("attachmentFile"), children: /* @__PURE__ */ jsxs3("a", { href: resolvedUrl, target: "_blank", rel: "noreferrer", children: [
|
|
1878
|
+
/* @__PURE__ */ jsx4(FileText, { size: 16 }),
|
|
1879
|
+
/* @__PURE__ */ jsx4("span", { children: label })
|
|
2432
1880
|
] }) });
|
|
2433
1881
|
}
|
|
2434
|
-
function PuckTool({
|
|
2435
|
-
toolCallId
|
|
2436
|
-
|
|
2437
|
-
defaultLabel = "Thinking...",
|
|
2438
|
-
type
|
|
2439
|
-
}) {
|
|
2440
|
-
const toolStatus = useContext2(toolStatusContext)[toolCallId];
|
|
1882
|
+
function PuckTool({ toolCallId, output, type }) {
|
|
1883
|
+
const toolStatus = useContext(toolStatusContext)[toolCallId];
|
|
1884
|
+
const thinkingLabel = useMessage("plugin-ai-chat-msg-thinking");
|
|
2441
1885
|
const outputObj = output;
|
|
2442
|
-
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus ?? {
|
|
2443
|
-
|
|
1886
|
+
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus ?? {
|
|
1887
|
+
loading: true,
|
|
1888
|
+
label: thinkingLabel
|
|
1889
|
+
};
|
|
1890
|
+
let icon = useMemo(() => {
|
|
2444
1891
|
if (type === "tool-write") {
|
|
2445
|
-
return /* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ jsx4(Pen, { size: 18 });
|
|
2446
1893
|
} else if (type === "tool-refreshPageData") {
|
|
2447
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsx4(GitPullRequest, { size: 18 });
|
|
2448
1895
|
} else if (type === "tool-takeScreenshot") {
|
|
2449
|
-
return /* @__PURE__ */
|
|
1896
|
+
return /* @__PURE__ */ jsx4(Camera, { size: 18 });
|
|
2450
1897
|
} else if (type === "tool-fetchUrl") {
|
|
2451
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ jsx4(CloudDownload, { size: 18 });
|
|
2452
1899
|
} else if (type === "tool-screenshotUrl") {
|
|
2453
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ jsx4(Camera, { size: 18 });
|
|
2454
1901
|
}
|
|
2455
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ jsx4(Check, { size: 18 });
|
|
2456
1903
|
}, [type]);
|
|
2457
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ jsx4(ChatEvent, { status, icon });
|
|
2458
1905
|
}
|
|
2459
1906
|
function SubagentBlock({ toolCallId }) {
|
|
2460
|
-
const subagentState =
|
|
1907
|
+
const subagentState = useContext(subagentStateContext);
|
|
2461
1908
|
const state = subagentState[toolCallId];
|
|
2462
|
-
const toolStatusMap =
|
|
1909
|
+
const toolStatusMap = useContext(toolStatusContext);
|
|
1910
|
+
const loadingLabel = useMessage("loader-loading");
|
|
2463
1911
|
const toolStatus = toolStatusMap[toolCallId];
|
|
2464
1912
|
const fallbackLabel = toolStatus?.label ?? "Running subagent";
|
|
2465
1913
|
const label = state?.label ? state.state === "done" ? `${state.agentType} subagent complete` : state.label : fallbackLabel;
|
|
2466
1914
|
const loading = state ? state.state !== "done" : toolStatus?.loading ?? true;
|
|
2467
1915
|
const hasBody = !!state && state.parts.length > 0;
|
|
2468
1916
|
const parts = state?.parts ?? [];
|
|
2469
|
-
const [isOpen, setIsOpen] =
|
|
2470
|
-
return /* @__PURE__ */
|
|
1917
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1918
|
+
return /* @__PURE__ */ jsxs3(
|
|
2471
1919
|
"details",
|
|
2472
1920
|
{
|
|
2473
1921
|
className: cxMessage("event"),
|
|
2474
1922
|
onToggle: (e) => setIsOpen(e.currentTarget.open),
|
|
2475
1923
|
children: [
|
|
2476
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ jsxs3(
|
|
2477
1925
|
"summary",
|
|
2478
1926
|
{
|
|
2479
|
-
className: cxMessage("eventHeader")
|
|
2480
|
-
style: hasBody ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
1927
|
+
className: `${cxMessage("eventHeader")} ${hasBody ? "" : cxMessage("eventHeader--static")}`,
|
|
2481
1928
|
children: [
|
|
2482
|
-
/* @__PURE__ */
|
|
2483
|
-
/* @__PURE__ */
|
|
2484
|
-
hasBody && /* @__PURE__ */
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
-
/* @__PURE__ */
|
|
1929
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventIcon"), children: loading ? /* @__PURE__ */ jsx4(Loader, { size: 16, label: loadingLabel }) : /* @__PURE__ */ jsx4(Bot, { size: 18 }) }),
|
|
1930
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventLabel"), children: label }),
|
|
1931
|
+
hasBody && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1932
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ jsx4(Plus, { size: 12 }) }),
|
|
1933
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ jsx4(Minus, { size: 12 }) })
|
|
2487
1934
|
] })
|
|
2488
1935
|
]
|
|
2489
1936
|
}
|
|
2490
1937
|
),
|
|
2491
|
-
hasBody && isOpen && /* @__PURE__ */
|
|
1938
|
+
hasBody && isOpen && /* @__PURE__ */ jsx4("div", { className: cxMessage("eventBody"), children: parts.map((part, i) => /* @__PURE__ */ jsx4(SubagentChildPartRenderer, { part }, `${toolCallId}-${i}`)) })
|
|
2492
1939
|
]
|
|
2493
1940
|
}
|
|
2494
1941
|
);
|
|
2495
1942
|
}
|
|
2496
1943
|
function SubagentChildPartRenderer({ part }) {
|
|
2497
1944
|
if (part.kind === "text") {
|
|
2498
|
-
return /* @__PURE__ */
|
|
1945
|
+
return /* @__PURE__ */ jsx4("div", { className: cxMessage("text"), children: /* @__PURE__ */ jsx4(Markdown, { children: part.text }) });
|
|
2499
1946
|
}
|
|
2500
1947
|
if (part.kind === "reasoning") {
|
|
2501
|
-
return /* @__PURE__ */
|
|
1948
|
+
return /* @__PURE__ */ jsx4(
|
|
2502
1949
|
ReasoningBlock,
|
|
2503
1950
|
{
|
|
2504
1951
|
part: {
|
|
@@ -2510,7 +1957,7 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2510
1957
|
);
|
|
2511
1958
|
}
|
|
2512
1959
|
if (part.toolName === "subagent") {
|
|
2513
|
-
return /* @__PURE__ */
|
|
1960
|
+
return /* @__PURE__ */ jsx4(SubagentBlock, { toolCallId: part.childToolCallId });
|
|
2514
1961
|
}
|
|
2515
1962
|
const synthesized = {
|
|
2516
1963
|
toolCallId: part.childToolCallId,
|
|
@@ -2519,35 +1966,35 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2519
1966
|
input: part.input,
|
|
2520
1967
|
output: part.output
|
|
2521
1968
|
};
|
|
2522
|
-
return /* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ jsx4(PuckTool, { ...synthesized });
|
|
2523
1970
|
}
|
|
2524
1971
|
function ChatEvent({
|
|
2525
1972
|
status,
|
|
2526
|
-
icon = /* @__PURE__ */
|
|
1973
|
+
icon = /* @__PURE__ */ jsx4(Check, { size: 18 })
|
|
2527
1974
|
}) {
|
|
2528
|
-
const [isOpen, setIsOpen] =
|
|
2529
|
-
|
|
1975
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
1976
|
+
const loadingLabel = useMessage("loader-loading");
|
|
1977
|
+
return /* @__PURE__ */ jsxs3(
|
|
2530
1978
|
"details",
|
|
2531
1979
|
{
|
|
2532
1980
|
className: cxMessage("event"),
|
|
2533
1981
|
onToggle: (e) => setIsOpen(e.currentTarget.open),
|
|
2534
1982
|
children: [
|
|
2535
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsxs3(
|
|
2536
1984
|
"summary",
|
|
2537
1985
|
{
|
|
2538
|
-
className: cxMessage("eventHeader")
|
|
2539
|
-
style: status.summary ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
1986
|
+
className: `${cxMessage("eventHeader")} ${status.summary ? "" : cxMessage("eventHeader--static")}`,
|
|
2540
1987
|
children: [
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
status.summary && /* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventIcon"), children: status.error ? /* @__PURE__ */ jsx4(TriangleAlert, { size: 18 }) : status.loading ? /* @__PURE__ */ jsx4(Loader, { size: 16, label: loadingLabel }) : icon }),
|
|
1989
|
+
/* @__PURE__ */ jsx4("div", { children: status.label }),
|
|
1990
|
+
status.summary && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1991
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ jsx4(Plus, { size: 12 }) }),
|
|
1992
|
+
/* @__PURE__ */ jsx4("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ jsx4(Minus, { size: 12 }) })
|
|
2546
1993
|
] })
|
|
2547
1994
|
]
|
|
2548
1995
|
}
|
|
2549
1996
|
),
|
|
2550
|
-
status.summary && isOpen && /* @__PURE__ */
|
|
1997
|
+
status.summary && isOpen && /* @__PURE__ */ jsx4("div", { className: cxMessage("eventBody"), children: /* @__PURE__ */ jsx4(Markdown, { children: status.summary }) })
|
|
2551
1998
|
]
|
|
2552
1999
|
}
|
|
2553
2000
|
);
|
|
@@ -2558,15 +2005,15 @@ function ExamplePrompt({
|
|
|
2558
2005
|
onClick,
|
|
2559
2006
|
disabled
|
|
2560
2007
|
}) {
|
|
2561
|
-
const content = /* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2008
|
+
const content = /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2009
|
+
/* @__PURE__ */ jsx4("div", { children: label }),
|
|
2010
|
+
/* @__PURE__ */ jsx4("div", { className: cx2("examplePromptArrow"), children: /* @__PURE__ */ jsx4(ArrowUp, { size: "16" }) })
|
|
2564
2011
|
] });
|
|
2565
2012
|
if (href) {
|
|
2566
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ jsx4(
|
|
2567
2014
|
"a",
|
|
2568
2015
|
{
|
|
2569
|
-
className:
|
|
2016
|
+
className: cx2("examplePrompt"),
|
|
2570
2017
|
href: disabled ? void 0 : href,
|
|
2571
2018
|
"aria-disabled": disabled || void 0,
|
|
2572
2019
|
onClick: (e) => {
|
|
@@ -2580,10 +2027,10 @@ function ExamplePrompt({
|
|
|
2580
2027
|
}
|
|
2581
2028
|
);
|
|
2582
2029
|
}
|
|
2583
|
-
return /* @__PURE__ */
|
|
2030
|
+
return /* @__PURE__ */ jsx4(
|
|
2584
2031
|
"button",
|
|
2585
2032
|
{
|
|
2586
|
-
className:
|
|
2033
|
+
className: cx2("examplePrompt"),
|
|
2587
2034
|
type: "button",
|
|
2588
2035
|
disabled,
|
|
2589
2036
|
onClick,
|
|
@@ -2617,27 +2064,30 @@ init_react_import();
|
|
|
2617
2064
|
|
|
2618
2065
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/DesignModeToggle/styles.module.css#css-module
|
|
2619
2066
|
init_react_import();
|
|
2620
|
-
var
|
|
2067
|
+
var styles_module_default5 = { "DesignModeToggle": "_DesignModeToggle_vng7q_1", "DesignModeToggle-button": "_DesignModeToggle-button_vng7q_8", "DesignModeToggle-button--active": "_DesignModeToggle-button--active_vng7q_32" };
|
|
2621
2068
|
|
|
2622
2069
|
// src/components/DesignModeToggle/index.tsx
|
|
2623
|
-
import { jsx as
|
|
2624
|
-
var
|
|
2070
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2071
|
+
var cx3 = getClassNameFactory("DesignModeToggle", styles_module_default5);
|
|
2625
2072
|
function DesignModeToggle({
|
|
2626
2073
|
active,
|
|
2627
2074
|
onToggle,
|
|
2628
2075
|
disabled
|
|
2629
2076
|
}) {
|
|
2630
|
-
|
|
2077
|
+
const label = useMessage("plugin-ai-prompt-design-mode");
|
|
2078
|
+
const enableTitle = useMessage("plugin-ai-prompt-design-mode-enable");
|
|
2079
|
+
const disableTitle = useMessage("plugin-ai-prompt-design-mode-disable");
|
|
2080
|
+
return /* @__PURE__ */ jsx5("div", { className: cx3(), children: /* @__PURE__ */ jsxs4(
|
|
2631
2081
|
"button",
|
|
2632
2082
|
{
|
|
2633
|
-
className: `${
|
|
2083
|
+
className: `${cx3("button")} ${active ? cx3("button--active") : ""}`,
|
|
2634
2084
|
onClick: onToggle,
|
|
2635
2085
|
disabled,
|
|
2636
2086
|
type: "button",
|
|
2637
|
-
title: active ?
|
|
2087
|
+
title: active ? disableTitle : enableTitle,
|
|
2638
2088
|
children: [
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
|
|
2089
|
+
/* @__PURE__ */ jsx5(WandSparkles, { size: 12 }),
|
|
2090
|
+
label
|
|
2641
2091
|
]
|
|
2642
2092
|
}
|
|
2643
2093
|
) });
|
|
@@ -2656,11 +2106,11 @@ import {
|
|
|
2656
2106
|
} from "@puckeditor/core";
|
|
2657
2107
|
import {
|
|
2658
2108
|
useCallback as useCallback5,
|
|
2659
|
-
useEffect as
|
|
2109
|
+
useEffect as useEffect7,
|
|
2660
2110
|
useLayoutEffect,
|
|
2661
|
-
useMemo as
|
|
2662
|
-
useRef as
|
|
2663
|
-
useState as
|
|
2111
|
+
useMemo as useMemo3,
|
|
2112
|
+
useRef as useRef7,
|
|
2113
|
+
useState as useState8,
|
|
2664
2114
|
useSyncExternalStore as useSyncExternalStore2
|
|
2665
2115
|
} from "react";
|
|
2666
2116
|
|
|
@@ -3775,7 +3225,7 @@ var wireArrayItemEditing = ({
|
|
|
3775
3225
|
// src/lib/design/render-html.tsx
|
|
3776
3226
|
init_react_import();
|
|
3777
3227
|
import { parseDocument as parseDocument2 } from "htmlparser2";
|
|
3778
|
-
import { createElement as createElement3, Fragment as
|
|
3228
|
+
import { createElement as createElement3, Fragment as Fragment3 } from "react";
|
|
3779
3229
|
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3780
3230
|
"area",
|
|
3781
3231
|
"base",
|
|
@@ -3861,14 +3311,14 @@ var htmlToReactTree = (html, slots) => {
|
|
|
3861
3311
|
const children = doc.children.map((child, i) => nodeToReact(child, slots, i)).filter((c) => c !== null);
|
|
3862
3312
|
if (children.length === 0) return null;
|
|
3863
3313
|
if (children.length === 1) return children[0];
|
|
3864
|
-
return createElement3(
|
|
3314
|
+
return createElement3(Fragment3, null, ...children);
|
|
3865
3315
|
};
|
|
3866
3316
|
|
|
3867
3317
|
// src/lib/design/slot-portal.tsx
|
|
3868
3318
|
init_react_import();
|
|
3869
|
-
import { useEffect as
|
|
3319
|
+
import { useEffect as useEffect6, useMemo as useMemo2, useRef as useRef6, useState as useState7 } from "react";
|
|
3870
3320
|
import { createPortal } from "react-dom";
|
|
3871
|
-
import { jsx as
|
|
3321
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3872
3322
|
var parseInlineStyle = (cssText) => {
|
|
3873
3323
|
const style = {};
|
|
3874
3324
|
for (const declaration of cssText.split(";")) {
|
|
@@ -3890,13 +3340,13 @@ var SlotPortal = ({
|
|
|
3890
3340
|
slotClassName,
|
|
3891
3341
|
SlotContent
|
|
3892
3342
|
}) => {
|
|
3893
|
-
const [target, setTarget] =
|
|
3894
|
-
const lastTarget =
|
|
3895
|
-
const style =
|
|
3343
|
+
const [target, setTarget] = useState7(null);
|
|
3344
|
+
const lastTarget = useRef6(null);
|
|
3345
|
+
const style = useMemo2(
|
|
3896
3346
|
() => slotStyle ? parseInlineStyle(slotStyle) : void 0,
|
|
3897
3347
|
[slotStyle]
|
|
3898
3348
|
);
|
|
3899
|
-
|
|
3349
|
+
useEffect6(() => {
|
|
3900
3350
|
const el = entry.querySelector(`[data-puck-slot="${cssEscape(slotName)}"]`);
|
|
3901
3351
|
if (el !== lastTarget.current) {
|
|
3902
3352
|
el?.replaceChildren();
|
|
@@ -3910,13 +3360,13 @@ var SlotPortal = ({
|
|
|
3910
3360
|
}, [entry, html, slotName]);
|
|
3911
3361
|
if (!target || typeof SlotContent !== "function") return null;
|
|
3912
3362
|
return createPortal(
|
|
3913
|
-
/* @__PURE__ */
|
|
3363
|
+
/* @__PURE__ */ jsx6(SlotContent, { style, className: slotClassName || void 0 }),
|
|
3914
3364
|
target
|
|
3915
3365
|
);
|
|
3916
3366
|
};
|
|
3917
3367
|
|
|
3918
3368
|
// src/lib/design/component.tsx
|
|
3919
|
-
import { Fragment as
|
|
3369
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3920
3370
|
var DESIGN_COMPONENT = Symbol("puck-ai.designComponent");
|
|
3921
3371
|
var isDesignComponent = (config) => !!config?.[DESIGN_COMPONENT];
|
|
3922
3372
|
var streamingValues = /* @__PURE__ */ new Map();
|
|
@@ -4002,13 +3452,13 @@ function createDesignComponentConfig(registration) {
|
|
|
4002
3452
|
}
|
|
4003
3453
|
return resolvedFields;
|
|
4004
3454
|
},
|
|
4005
|
-
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */
|
|
3455
|
+
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ jsx7(EditorEntry, { ...renderProps }) : /* @__PURE__ */ jsx7(Entry, { ...renderProps, getPuck: null })
|
|
4006
3456
|
};
|
|
4007
3457
|
componentConfig[DESIGN_COMPONENT] = true;
|
|
4008
3458
|
return componentConfig;
|
|
4009
3459
|
function EditorEntry(renderProps) {
|
|
4010
3460
|
const getPuck = useGetPuck2();
|
|
4011
|
-
return /* @__PURE__ */
|
|
3461
|
+
return /* @__PURE__ */ jsx7(Entry, { ...renderProps, getPuck });
|
|
4012
3462
|
}
|
|
4013
3463
|
function Entry({
|
|
4014
3464
|
getPuck,
|
|
@@ -4029,10 +3479,10 @@ function createDesignComponentConfig(registration) {
|
|
|
4029
3479
|
const html = reg.html ?? "";
|
|
4030
3480
|
const styles = reg.styles;
|
|
4031
3481
|
const script = reg.script;
|
|
4032
|
-
const [entryEl, setEntryEl] =
|
|
4033
|
-
const scriptRef =
|
|
4034
|
-
const annotations =
|
|
4035
|
-
const { attrFields, arrayFields, attrSig, arraySig } =
|
|
3482
|
+
const [entryEl, setEntryEl] = useState8(null);
|
|
3483
|
+
const scriptRef = useRef7(null);
|
|
3484
|
+
const annotations = useMemo3(() => getAnnotations(html), [html]);
|
|
3485
|
+
const { attrFields, arrayFields, attrSig, arraySig } = useMemo3(() => {
|
|
4036
3486
|
const attr = [];
|
|
4037
3487
|
const arrays = [];
|
|
4038
3488
|
for (const field of annotations.fields) {
|
|
@@ -4054,11 +3504,11 @@ function createDesignComponentConfig(registration) {
|
|
|
4054
3504
|
arraySig: JSON.stringify(arrays)
|
|
4055
3505
|
};
|
|
4056
3506
|
}, [props, annotations]);
|
|
4057
|
-
const patchedHtml =
|
|
3507
|
+
const patchedHtml = useMemo3(() => {
|
|
4058
3508
|
if (puck.isEditing) return html;
|
|
4059
3509
|
return patchHtmlAnnotations(html, props);
|
|
4060
3510
|
}, [html, props, puck.isEditing]);
|
|
4061
|
-
const fieldValueAttrs =
|
|
3511
|
+
const fieldValueAttrs = useMemo3(() => {
|
|
4062
3512
|
const attrs = {};
|
|
4063
3513
|
attrs["data-puck-design"] = name;
|
|
4064
3514
|
for (const field of annotations.fields) {
|
|
@@ -4069,16 +3519,16 @@ function createDesignComponentConfig(registration) {
|
|
|
4069
3519
|
}
|
|
4070
3520
|
return attrs;
|
|
4071
3521
|
}, [annotations, props, puck.isEditing]);
|
|
4072
|
-
const editorEntryNode =
|
|
4073
|
-
() => puck.isEditing ? /* @__PURE__ */
|
|
3522
|
+
const editorEntryNode = useMemo3(
|
|
3523
|
+
() => puck.isEditing ? /* @__PURE__ */ jsx7("div", { ref: setEntryEl }) : null,
|
|
4074
3524
|
[puck.isEditing]
|
|
4075
3525
|
);
|
|
4076
|
-
|
|
3526
|
+
useEffect7(() => {
|
|
4077
3527
|
if (!puck.isEditing || !getPuck) return;
|
|
4078
3528
|
getPuck().resolveDataById(id, "force");
|
|
4079
3529
|
}, [reg, puck.isEditing, getPuck, id]);
|
|
4080
|
-
const fieldWiring =
|
|
4081
|
-
const morphed =
|
|
3530
|
+
const fieldWiring = useRef7(/* @__PURE__ */ new Map());
|
|
3531
|
+
const morphed = useRef7(null);
|
|
4082
3532
|
useLayoutEffect(() => {
|
|
4083
3533
|
if (!puck.isEditing || !entryEl) return;
|
|
4084
3534
|
if (morphed.current?.el !== entryEl || morphed.current?.html !== html || morphed.current?.attrSig !== attrSig) {
|
|
@@ -4096,14 +3546,14 @@ function createDesignComponentConfig(registration) {
|
|
|
4096
3546
|
});
|
|
4097
3547
|
}
|
|
4098
3548
|
});
|
|
4099
|
-
|
|
3549
|
+
useEffect7(
|
|
4100
3550
|
() => () => {
|
|
4101
3551
|
fieldWiring.current.forEach((cleanup) => cleanup());
|
|
4102
3552
|
fieldWiring.current.clear();
|
|
4103
3553
|
},
|
|
4104
3554
|
[]
|
|
4105
3555
|
);
|
|
4106
|
-
|
|
3556
|
+
useEffect7(() => {
|
|
4107
3557
|
if (!entryEl || !puck.isEditing) return;
|
|
4108
3558
|
for (const attr of Array.from(entryEl.attributes)) {
|
|
4109
3559
|
if ((attr.name === "data-puck-design" || attr.name.startsWith("data-puck-field-value-")) && !(attr.name in fieldValueAttrs)) {
|
|
@@ -4116,10 +3566,10 @@ function createDesignComponentConfig(registration) {
|
|
|
4116
3566
|
}
|
|
4117
3567
|
}
|
|
4118
3568
|
}, [entryEl, fieldValueAttrs]);
|
|
4119
|
-
const appliedArrayHtml =
|
|
4120
|
-
const arrayItemWiring =
|
|
4121
|
-
const appliedArrays =
|
|
4122
|
-
|
|
3569
|
+
const appliedArrayHtml = useRef7(/* @__PURE__ */ new WeakMap());
|
|
3570
|
+
const arrayItemWiring = useRef7({});
|
|
3571
|
+
const appliedArrays = useRef7(null);
|
|
3572
|
+
useEffect7(() => {
|
|
4123
3573
|
if (!puck.isEditing || !entryEl || !getPuck) return;
|
|
4124
3574
|
if (appliedArrays.current?.el === entryEl && appliedArrays.current?.html === html && appliedArrays.current?.sig === arraySig) {
|
|
4125
3575
|
return;
|
|
@@ -4171,7 +3621,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4171
3621
|
id,
|
|
4172
3622
|
getPuck
|
|
4173
3623
|
]);
|
|
4174
|
-
|
|
3624
|
+
useEffect7(
|
|
4175
3625
|
() => () => {
|
|
4176
3626
|
Object.values(arrayItemWiring.current).forEach(
|
|
4177
3627
|
(wiring) => wiring.forEach(({ cleanup }) => cleanup())
|
|
@@ -4179,7 +3629,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4179
3629
|
},
|
|
4180
3630
|
[]
|
|
4181
3631
|
);
|
|
4182
|
-
|
|
3632
|
+
useEffect7(() => {
|
|
4183
3633
|
if (!script || !entryEl) return;
|
|
4184
3634
|
scriptRef.current?.remove();
|
|
4185
3635
|
const doc = entryEl.ownerDocument;
|
|
@@ -4197,7 +3647,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4197
3647
|
for (const slot of annotations.slots) {
|
|
4198
3648
|
const Slot = props[slot.name];
|
|
4199
3649
|
if (typeof Slot === "function") {
|
|
4200
|
-
slotContent[slot.name] = /* @__PURE__ */
|
|
3650
|
+
slotContent[slot.name] = /* @__PURE__ */ jsx7(
|
|
4201
3651
|
Slot,
|
|
4202
3652
|
{
|
|
4203
3653
|
style: slot.style ? parseStyleString(slot.style) : void 0,
|
|
@@ -4206,17 +3656,17 @@ function createDesignComponentConfig(registration) {
|
|
|
4206
3656
|
);
|
|
4207
3657
|
}
|
|
4208
3658
|
}
|
|
4209
|
-
return /* @__PURE__ */
|
|
4210
|
-
styles && /* @__PURE__ */
|
|
4211
|
-
style && /* @__PURE__ */
|
|
4212
|
-
/* @__PURE__ */
|
|
3659
|
+
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
3660
|
+
styles && /* @__PURE__ */ jsx7("style", { children: styles }),
|
|
3661
|
+
style && /* @__PURE__ */ jsx7("style", { children: style }),
|
|
3662
|
+
/* @__PURE__ */ jsx7("div", { ref: setEntryEl, ...fieldValueAttrs, children: htmlToReactTree(patchedHtml, slotContent) })
|
|
4213
3663
|
] });
|
|
4214
3664
|
}
|
|
4215
|
-
return /* @__PURE__ */
|
|
4216
|
-
styles && /* @__PURE__ */
|
|
4217
|
-
style && /* @__PURE__ */
|
|
3665
|
+
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
3666
|
+
styles && /* @__PURE__ */ jsx7("style", { children: styles }),
|
|
3667
|
+
style && /* @__PURE__ */ jsx7("style", { children: style }),
|
|
4218
3668
|
editorEntryNode,
|
|
4219
|
-
entryEl && annotations.slots.map((slot) => /* @__PURE__ */
|
|
3669
|
+
entryEl && annotations.slots.map((slot) => /* @__PURE__ */ jsx7(
|
|
4220
3670
|
SlotPortal,
|
|
4221
3671
|
{
|
|
4222
3672
|
entry: entryEl,
|
|
@@ -4234,8 +3684,8 @@ function createDesignComponentConfig(registration) {
|
|
|
4234
3684
|
|
|
4235
3685
|
// src/lib/design/globals.tsx
|
|
4236
3686
|
init_react_import();
|
|
4237
|
-
import { useEffect as
|
|
4238
|
-
import { Fragment as
|
|
3687
|
+
import { useEffect as useEffect8, useRef as useRef8 } from "react";
|
|
3688
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4239
3689
|
function getDynamicConfigGlobals(dynamicConfig) {
|
|
4240
3690
|
if (typeof dynamicConfig !== "object" || dynamicConfig === null) return {};
|
|
4241
3691
|
const { styles, script } = dynamicConfig;
|
|
@@ -4250,9 +3700,9 @@ function DesignGlobals({
|
|
|
4250
3700
|
script,
|
|
4251
3701
|
isEditing
|
|
4252
3702
|
}) {
|
|
4253
|
-
const scriptRef =
|
|
4254
|
-
const hostRef =
|
|
4255
|
-
|
|
3703
|
+
const scriptRef = useRef8(null);
|
|
3704
|
+
const hostRef = useRef8(null);
|
|
3705
|
+
useEffect8(() => {
|
|
4256
3706
|
if (!script) return;
|
|
4257
3707
|
scriptRef.current?.remove();
|
|
4258
3708
|
const doc = hostRef.current?.ownerDocument ?? document;
|
|
@@ -4265,10 +3715,10 @@ function DesignGlobals({
|
|
|
4265
3715
|
scriptRef.current = null;
|
|
4266
3716
|
};
|
|
4267
3717
|
}, [script]);
|
|
4268
|
-
return /* @__PURE__ */
|
|
4269
|
-
isEditing && /* @__PURE__ */
|
|
4270
|
-
styles && /* @__PURE__ */
|
|
4271
|
-
script && /* @__PURE__ */
|
|
3718
|
+
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
3719
|
+
isEditing && /* @__PURE__ */ jsx8("style", { children: INLINE_EDIT_RESET }),
|
|
3720
|
+
styles && /* @__PURE__ */ jsx8("style", { children: styles }),
|
|
3721
|
+
script && /* @__PURE__ */ jsx8("div", { ref: hostRef, style: { display: "none" } })
|
|
4272
3722
|
] });
|
|
4273
3723
|
}
|
|
4274
3724
|
var WRAPPED = "__puckAiDesignGlobals";
|
|
@@ -4278,8 +3728,8 @@ function withDesignGlobals(root) {
|
|
|
4278
3728
|
const userRender = root?.render;
|
|
4279
3729
|
const render = (props) => {
|
|
4280
3730
|
const { styles, script } = getDynamicConfigGlobals(props._dynamicConfig);
|
|
4281
|
-
return /* @__PURE__ */
|
|
4282
|
-
/* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
3732
|
+
/* @__PURE__ */ jsx8(
|
|
4283
3733
|
DesignGlobals,
|
|
4284
3734
|
{
|
|
4285
3735
|
styles,
|
|
@@ -4301,7 +3751,7 @@ function ensureDesignGlobalsRoot(config) {
|
|
|
4301
3751
|
}
|
|
4302
3752
|
|
|
4303
3753
|
// src/lib/design/runtime.tsx
|
|
4304
|
-
import { jsx as
|
|
3754
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
4305
3755
|
var cachedFieldMetadata;
|
|
4306
3756
|
function detectFieldMetadata(config) {
|
|
4307
3757
|
for (const comp of Object.values(config.components)) {
|
|
@@ -4340,7 +3790,7 @@ function applyConfigFieldMetadata(config, dynamicComponents) {
|
|
|
4340
3790
|
var DESIGNED_CATEGORY = "dynamic";
|
|
4341
3791
|
var dynamicConfigRootField = {
|
|
4342
3792
|
type: "custom",
|
|
4343
|
-
render: () => /* @__PURE__ */
|
|
3793
|
+
render: () => /* @__PURE__ */ jsx9("div", {}),
|
|
4344
3794
|
ai: {
|
|
4345
3795
|
exclude: true
|
|
4346
3796
|
}
|
|
@@ -4695,17 +4145,53 @@ async function postClientToolResponse(host, body) {
|
|
|
4695
4145
|
}
|
|
4696
4146
|
}
|
|
4697
4147
|
|
|
4148
|
+
// src/lib/to-serializable.ts
|
|
4149
|
+
init_react_import();
|
|
4150
|
+
function toSerializable(value, ancestors = []) {
|
|
4151
|
+
const json = typeof value === "object" && value !== null && "toJSON" in value && typeof value.toJSON === "function" ? value.toJSON() : value;
|
|
4152
|
+
if (typeof json !== "object" || json === null) {
|
|
4153
|
+
return typeof json === "function" || typeof json === "symbol" || typeof json === "bigint" ? void 0 : json;
|
|
4154
|
+
}
|
|
4155
|
+
if ("$$typeof" in json || ancestors.includes(json)) return void 0;
|
|
4156
|
+
ancestors.push(json);
|
|
4157
|
+
let copy;
|
|
4158
|
+
if (Array.isArray(json)) {
|
|
4159
|
+
copy = json.map((item) => toSerializable(item, ancestors) ?? null);
|
|
4160
|
+
} else {
|
|
4161
|
+
const record = json;
|
|
4162
|
+
const object = {};
|
|
4163
|
+
for (const key of Object.keys(record)) {
|
|
4164
|
+
const item = toSerializable(record[key], ancestors);
|
|
4165
|
+
if (item !== void 0) object[key] = item;
|
|
4166
|
+
}
|
|
4167
|
+
copy = object;
|
|
4168
|
+
}
|
|
4169
|
+
ancestors.pop();
|
|
4170
|
+
return copy;
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
// src/components/PluginTheme/index.ts
|
|
4174
|
+
init_react_import();
|
|
4175
|
+
|
|
4176
|
+
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PluginTheme/styles.module.css#css-module
|
|
4177
|
+
init_react_import();
|
|
4178
|
+
var styles_module_default6 = { "PluginTheme": "_PluginTheme_u3emj_8" };
|
|
4179
|
+
|
|
4180
|
+
// src/components/PluginTheme/index.ts
|
|
4181
|
+
var cx4 = getClassNameFactory("PluginTheme", styles_module_default6);
|
|
4182
|
+
var pluginThemeClassName = cx4();
|
|
4183
|
+
|
|
4698
4184
|
// src/components/Chat/index.tsx
|
|
4699
|
-
import { Fragment as
|
|
4185
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4700
4186
|
var q = qler();
|
|
4701
4187
|
var DEFAULT_API_VERSION = "v2";
|
|
4702
4188
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4703
4189
|
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.";
|
|
4704
|
-
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.
|
|
4190
|
+
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.552a686b" : "unknown";
|
|
4705
4191
|
var BENCHMARK = false;
|
|
4706
4192
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
|
|
4707
|
-
var
|
|
4708
|
-
var
|
|
4193
|
+
var getClassName3 = getClassNameFactory("Chat", styles_module_default);
|
|
4194
|
+
var usePuck2 = createUsePuck2();
|
|
4709
4195
|
function Chat2(props) {
|
|
4710
4196
|
const {
|
|
4711
4197
|
apiVersion = DEFAULT_API_VERSION,
|
|
@@ -4722,34 +4208,35 @@ function Chat2(props) {
|
|
|
4722
4208
|
actions: chatActions,
|
|
4723
4209
|
placeholder
|
|
4724
4210
|
} = chat ?? {};
|
|
4725
|
-
const puckDispatch =
|
|
4211
|
+
const puckDispatch = usePuck2((s) => s.dispatch);
|
|
4726
4212
|
const getPuck = useGetPuck4();
|
|
4727
|
-
const
|
|
4728
|
-
const
|
|
4729
|
-
const
|
|
4730
|
-
const
|
|
4731
|
-
const
|
|
4213
|
+
const t = (key, params) => getMessage(getPuck().dictionary, key, params);
|
|
4214
|
+
const localChatId = useRef9("");
|
|
4215
|
+
const inputRef = useRef9(null);
|
|
4216
|
+
const pluginRef = useRef9(null);
|
|
4217
|
+
const [mode, setMode] = useState9(defaultMode);
|
|
4218
|
+
const modeRef = useRef9(mode);
|
|
4732
4219
|
const designModeVisible = typeof designMode === "boolean" ? designMode : designMode.visible ?? false;
|
|
4733
|
-
|
|
4220
|
+
useEffect9(() => {
|
|
4734
4221
|
modeRef.current = mode;
|
|
4735
4222
|
}, [mode]);
|
|
4736
|
-
const puckData =
|
|
4737
|
-
|
|
4223
|
+
const puckData = usePuck2((s) => s.appState.data);
|
|
4224
|
+
useEffect9(() => {
|
|
4738
4225
|
syncDesignComponents(getPuck);
|
|
4739
4226
|
}, [puckData, getPuck]);
|
|
4740
|
-
const [error, setError] =
|
|
4741
|
-
const [userError, setUserError] =
|
|
4742
|
-
const clientToolEndpointUnavailableRef =
|
|
4743
|
-
const stopChatRef =
|
|
4744
|
-
const [composerAttachments, setComposerAttachments] =
|
|
4745
|
-
const removedAttachmentClientIdsRef =
|
|
4746
|
-
const uploadControllersRef =
|
|
4747
|
-
const pendingBuildOpsRef =
|
|
4748
|
-
const lastStreamActivityRef =
|
|
4749
|
-
const hiddenSinceRef =
|
|
4750
|
-
const [toolStatus, setToolStatus] =
|
|
4751
|
-
const [subagentState, setSubagentState] =
|
|
4752
|
-
const attachmentConfig =
|
|
4227
|
+
const [error, setError] = useState9();
|
|
4228
|
+
const [userError, setUserError] = useState9();
|
|
4229
|
+
const clientToolEndpointUnavailableRef = useRef9(false);
|
|
4230
|
+
const stopChatRef = useRef9(null);
|
|
4231
|
+
const [composerAttachments, setComposerAttachments] = useState9([]);
|
|
4232
|
+
const removedAttachmentClientIdsRef = useRef9(/* @__PURE__ */ new Set());
|
|
4233
|
+
const uploadControllersRef = useRef9(/* @__PURE__ */ new Map());
|
|
4234
|
+
const pendingBuildOpsRef = useRef9([]);
|
|
4235
|
+
const lastStreamActivityRef = useRef9(0);
|
|
4236
|
+
const hiddenSinceRef = useRef9(null);
|
|
4237
|
+
const [toolStatus, setToolStatus] = useState9({});
|
|
4238
|
+
const [subagentState, setSubagentState] = useState9({});
|
|
4239
|
+
const attachmentConfig = useMemo4(
|
|
4753
4240
|
() => ({
|
|
4754
4241
|
accept: attachments?.accept ?? defaultAttachmentAccept,
|
|
4755
4242
|
enabled: attachments?.enabled ?? true,
|
|
@@ -4759,7 +4246,7 @@ function Chat2(props) {
|
|
|
4759
4246
|
}),
|
|
4760
4247
|
[attachments, host]
|
|
4761
4248
|
);
|
|
4762
|
-
|
|
4249
|
+
useEffect9(
|
|
4763
4250
|
() => () => {
|
|
4764
4251
|
uploadControllersRef.current.forEach((controller) => controller.abort());
|
|
4765
4252
|
uploadControllersRef.current.clear();
|
|
@@ -5015,14 +4502,14 @@ function Chat2(props) {
|
|
|
5015
4502
|
}
|
|
5016
4503
|
}
|
|
5017
4504
|
};
|
|
5018
|
-
const configWithRoot = {
|
|
4505
|
+
const configWithRoot = toSerializable({
|
|
5019
4506
|
...config,
|
|
5020
4507
|
root,
|
|
5021
4508
|
components: {
|
|
5022
4509
|
...config.components,
|
|
5023
4510
|
...getRequestComponentConfigs(appState.data)
|
|
5024
4511
|
}
|
|
5025
|
-
};
|
|
4512
|
+
});
|
|
5026
4513
|
const defaultOptions = {
|
|
5027
4514
|
headers: {
|
|
5028
4515
|
...opts.headers,
|
|
@@ -5085,21 +4572,21 @@ function Chat2(props) {
|
|
|
5085
4572
|
});
|
|
5086
4573
|
}
|
|
5087
4574
|
});
|
|
5088
|
-
|
|
4575
|
+
useEffect9(() => {
|
|
5089
4576
|
stopChatRef.current = stop;
|
|
5090
4577
|
return () => {
|
|
5091
4578
|
stopChatRef.current = null;
|
|
5092
4579
|
stop();
|
|
5093
4580
|
};
|
|
5094
4581
|
}, [stop]);
|
|
5095
|
-
const statusRef =
|
|
5096
|
-
|
|
4582
|
+
const statusRef = useRef9(status);
|
|
4583
|
+
useEffect9(() => {
|
|
5097
4584
|
statusRef.current = status;
|
|
5098
4585
|
}, [status]);
|
|
5099
|
-
|
|
4586
|
+
useEffect9(() => {
|
|
5100
4587
|
lastStreamActivityRef.current = Date.now();
|
|
5101
4588
|
}, [messages]);
|
|
5102
|
-
|
|
4589
|
+
useEffect9(() => {
|
|
5103
4590
|
const FROZEN_HIDDEN_MS = 3 * 6e4;
|
|
5104
4591
|
const RESUME_GRACE_MS = 12e3;
|
|
5105
4592
|
const isStreaming = () => statusRef.current === "streaming" || statusRef.current === "submitted";
|
|
@@ -5142,12 +4629,12 @@ function Chat2(props) {
|
|
|
5142
4629
|
if (graceTimer) clearTimeout(graceTimer);
|
|
5143
4630
|
};
|
|
5144
4631
|
}, [stop]);
|
|
5145
|
-
const [forcedStatus, setForcedStatus] =
|
|
5146
|
-
const resolvedStatus =
|
|
4632
|
+
const [forcedStatus, setForcedStatus] = useState9();
|
|
4633
|
+
const resolvedStatus = useMemo4(
|
|
5147
4634
|
() => forcedStatus ?? status,
|
|
5148
4635
|
[status, forcedStatus]
|
|
5149
4636
|
);
|
|
5150
|
-
|
|
4637
|
+
useEffect9(() => {
|
|
5151
4638
|
if (!scrollTrackingId) return;
|
|
5152
4639
|
dispatchScrollTrackingEvent({
|
|
5153
4640
|
id: scrollTrackingId,
|
|
@@ -5160,7 +4647,7 @@ function Chat2(props) {
|
|
|
5160
4647
|
});
|
|
5161
4648
|
};
|
|
5162
4649
|
}, [resolvedStatus, scrollTrackingId]);
|
|
5163
|
-
|
|
4650
|
+
useEffect9(() => {
|
|
5164
4651
|
window.__PUCK_AI = {
|
|
5165
4652
|
processData,
|
|
5166
4653
|
setMessages,
|
|
@@ -5182,11 +4669,11 @@ function Chat2(props) {
|
|
|
5182
4669
|
if (composerAttachments.some(
|
|
5183
4670
|
(attachment) => attachment.status === "uploading"
|
|
5184
4671
|
)) {
|
|
5185
|
-
setUserError("
|
|
4672
|
+
setUserError(t("plugin-ai-prompt-error-uploading"));
|
|
5186
4673
|
return false;
|
|
5187
4674
|
}
|
|
5188
4675
|
if (composerAttachments.some((attachment) => attachment.status === "failed")) {
|
|
5189
|
-
setUserError("
|
|
4676
|
+
setUserError(t("plugin-ai-prompt-error-attachment-failed"));
|
|
5190
4677
|
return false;
|
|
5191
4678
|
}
|
|
5192
4679
|
if (!text && readyAttachments.length === 0) {
|
|
@@ -5228,7 +4715,9 @@ function Chat2(props) {
|
|
|
5228
4715
|
}
|
|
5229
4716
|
if (composerAttachments.length + files.length > attachmentConfig.maxFiles) {
|
|
5230
4717
|
setUserError(
|
|
5231
|
-
|
|
4718
|
+
t("plugin-ai-prompt-error-max-files", {
|
|
4719
|
+
count: attachmentConfig.maxFiles
|
|
4720
|
+
})
|
|
5232
4721
|
);
|
|
5233
4722
|
return;
|
|
5234
4723
|
}
|
|
@@ -5238,7 +4727,10 @@ function Chat2(props) {
|
|
|
5238
4727
|
if (oversizedFile) {
|
|
5239
4728
|
const limitMB = Math.round(attachmentConfig.maxSizeBytes / 1024 / 1024);
|
|
5240
4729
|
setUserError(
|
|
5241
|
-
|
|
4730
|
+
t("plugin-ai-prompt-error-max-size", {
|
|
4731
|
+
name: oversizedFile.name,
|
|
4732
|
+
limit: limitMB
|
|
4733
|
+
})
|
|
5242
4734
|
);
|
|
5243
4735
|
return;
|
|
5244
4736
|
}
|
|
@@ -5246,7 +4738,9 @@ function Chat2(props) {
|
|
|
5246
4738
|
(file) => !matchesAccept(file, attachmentConfig.accept)
|
|
5247
4739
|
);
|
|
5248
4740
|
if (unsupportedFile) {
|
|
5249
|
-
setUserError(
|
|
4741
|
+
setUserError(
|
|
4742
|
+
t("plugin-ai-prompt-error-type", { name: unsupportedFile.name })
|
|
4743
|
+
);
|
|
5250
4744
|
return;
|
|
5251
4745
|
}
|
|
5252
4746
|
setUserError("");
|
|
@@ -5338,7 +4832,7 @@ function Chat2(props) {
|
|
|
5338
4832
|
} : attachment
|
|
5339
4833
|
)
|
|
5340
4834
|
);
|
|
5341
|
-
setUserError("
|
|
4835
|
+
setUserError(t("plugin-ai-prompt-error-attachment-upload-failed"));
|
|
5342
4836
|
} finally {
|
|
5343
4837
|
uploadControllersRef.current.delete(clientId);
|
|
5344
4838
|
}
|
|
@@ -5371,7 +4865,7 @@ function Chat2(props) {
|
|
|
5371
4865
|
if (!target?.attachmentId) return;
|
|
5372
4866
|
await deleteAttachment(target.attachmentId);
|
|
5373
4867
|
};
|
|
5374
|
-
const messagesWithStatuses =
|
|
4868
|
+
const messagesWithStatuses = useMemo4(() => {
|
|
5375
4869
|
return messages.map((msg) => {
|
|
5376
4870
|
return {
|
|
5377
4871
|
...msg,
|
|
@@ -5384,71 +4878,78 @@ function Chat2(props) {
|
|
|
5384
4878
|
};
|
|
5385
4879
|
});
|
|
5386
4880
|
}, [messages, toolStatus]);
|
|
5387
|
-
return /* @__PURE__ */
|
|
5388
|
-
|
|
4881
|
+
return /* @__PURE__ */ jsx10(
|
|
4882
|
+
"div",
|
|
5389
4883
|
{
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
AttachmentComposer,
|
|
5395
|
-
{
|
|
5396
|
-
accept: attachmentConfig.accept,
|
|
5397
|
-
attachments: composerAttachments,
|
|
5398
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming",
|
|
5399
|
-
maxFiles: attachmentConfig.maxFiles,
|
|
5400
|
-
onChange: handleAttachmentChange
|
|
5401
|
-
}
|
|
5402
|
-
) : null,
|
|
5403
|
-
typeof chatActions === "function" ? chatActions({
|
|
5404
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5405
|
-
}) : chatActions,
|
|
5406
|
-
designModeVisible ? /* @__PURE__ */ jsx34(
|
|
5407
|
-
DesignModeToggle,
|
|
5408
|
-
{
|
|
5409
|
-
active: mode === "design",
|
|
5410
|
-
onToggle: () => setMode(
|
|
5411
|
-
(mode2) => mode2 === "design" ? "assembly" : "design"
|
|
5412
|
-
),
|
|
5413
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5414
|
-
}
|
|
5415
|
-
) : null
|
|
5416
|
-
] }),
|
|
5417
|
-
attachments: composerAttachments,
|
|
5418
|
-
onRemoveAttachment: removeAttachment,
|
|
5419
|
-
handleSubmit,
|
|
5420
|
-
inputRef,
|
|
5421
|
-
status: resolvedStatus,
|
|
5422
|
-
examplePrompts: examplePrompts?.map(
|
|
5423
|
-
({ label, href, onClick }) => /* @__PURE__ */ jsx34(
|
|
5424
|
-
ExamplePrompt,
|
|
5425
|
-
{
|
|
5426
|
-
label,
|
|
5427
|
-
href,
|
|
5428
|
-
onClick,
|
|
5429
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5430
|
-
},
|
|
5431
|
-
label
|
|
5432
|
-
)
|
|
5433
|
-
),
|
|
5434
|
-
error,
|
|
5435
|
-
handleRetry: () => {
|
|
5436
|
-
clientToolEndpointUnavailableRef.current = false;
|
|
5437
|
-
setError("");
|
|
5438
|
-
regenerate();
|
|
5439
|
-
},
|
|
5440
|
-
userError,
|
|
5441
|
-
onDismissUserError: () => setUserError(""),
|
|
5442
|
-
children: placeholder ?? /* @__PURE__ */ jsx34(
|
|
5443
|
-
Placeholder,
|
|
4884
|
+
className: `${getClassName3()} ${pluginThemeClassName}`,
|
|
4885
|
+
ref: pluginRef,
|
|
4886
|
+
children: /* @__PURE__ */ jsx10(HostProvider, { value: host, children: /* @__PURE__ */ jsx10(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ jsx10(SubagentStateProvider, { value: subagentState, children: /* @__PURE__ */ jsx10(
|
|
4887
|
+
ChatBody,
|
|
5444
4888
|
{
|
|
5445
|
-
|
|
4889
|
+
messages: messagesWithStatuses,
|
|
4890
|
+
onFileDrop: attachmentConfig.enabled ? handleFiles : void 0,
|
|
4891
|
+
actions: /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
4892
|
+
attachmentConfig.enabled ? /* @__PURE__ */ jsx10(
|
|
4893
|
+
AttachmentComposer,
|
|
4894
|
+
{
|
|
4895
|
+
accept: attachmentConfig.accept,
|
|
4896
|
+
attachments: composerAttachments,
|
|
4897
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming",
|
|
4898
|
+
maxFiles: attachmentConfig.maxFiles,
|
|
4899
|
+
onChange: handleAttachmentChange
|
|
4900
|
+
}
|
|
4901
|
+
) : null,
|
|
4902
|
+
typeof chatActions === "function" ? chatActions({
|
|
4903
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4904
|
+
}) : chatActions,
|
|
4905
|
+
designModeVisible ? /* @__PURE__ */ jsx10(
|
|
4906
|
+
DesignModeToggle,
|
|
4907
|
+
{
|
|
4908
|
+
active: mode === "design",
|
|
4909
|
+
onToggle: () => setMode(
|
|
4910
|
+
(mode2) => mode2 === "design" ? "assembly" : "design"
|
|
4911
|
+
),
|
|
4912
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4913
|
+
}
|
|
4914
|
+
) : null
|
|
4915
|
+
] }),
|
|
4916
|
+
attachments: composerAttachments,
|
|
4917
|
+
onRemoveAttachment: removeAttachment,
|
|
4918
|
+
handleSubmit,
|
|
5446
4919
|
inputRef,
|
|
5447
|
-
|
|
4920
|
+
status: resolvedStatus,
|
|
4921
|
+
examplePrompts: examplePrompts?.map(
|
|
4922
|
+
({ label, href, onClick }) => /* @__PURE__ */ jsx10(
|
|
4923
|
+
ExamplePrompt,
|
|
4924
|
+
{
|
|
4925
|
+
label,
|
|
4926
|
+
href,
|
|
4927
|
+
onClick,
|
|
4928
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4929
|
+
},
|
|
4930
|
+
label
|
|
4931
|
+
)
|
|
4932
|
+
),
|
|
4933
|
+
error,
|
|
4934
|
+
handleRetry: () => {
|
|
4935
|
+
clientToolEndpointUnavailableRef.current = false;
|
|
4936
|
+
setError("");
|
|
4937
|
+
regenerate();
|
|
4938
|
+
},
|
|
4939
|
+
userError,
|
|
4940
|
+
onDismissUserError: () => setUserError(""),
|
|
4941
|
+
children: placeholder ?? /* @__PURE__ */ jsx10(
|
|
4942
|
+
Placeholder,
|
|
4943
|
+
{
|
|
4944
|
+
dispatch: puckDispatch,
|
|
4945
|
+
inputRef,
|
|
4946
|
+
pluginRef
|
|
4947
|
+
}
|
|
4948
|
+
)
|
|
5448
4949
|
}
|
|
5449
|
-
)
|
|
4950
|
+
) }) }) })
|
|
5450
4951
|
}
|
|
5451
|
-
)
|
|
4952
|
+
);
|
|
5452
4953
|
}
|
|
5453
4954
|
function finalizeReasoningParts(parts) {
|
|
5454
4955
|
return parts.map(
|
|
@@ -5557,13 +5058,14 @@ function AttachmentComposer({
|
|
|
5557
5058
|
onChange
|
|
5558
5059
|
}) {
|
|
5559
5060
|
const id = useId3();
|
|
5560
|
-
const inputId =
|
|
5561
|
-
|
|
5562
|
-
|
|
5061
|
+
const inputId = useMemo4(() => `attachment-input-${id}`, []);
|
|
5062
|
+
const attachLabel = useMessage("plugin-ai-prompt-attachment-attach");
|
|
5063
|
+
return /* @__PURE__ */ jsxs7("div", { className: getClassName3("attachmentControls"), children: [
|
|
5064
|
+
/* @__PURE__ */ jsx10(
|
|
5563
5065
|
"input",
|
|
5564
5066
|
{
|
|
5565
5067
|
accept: accept.join(","),
|
|
5566
|
-
className:
|
|
5068
|
+
className: getClassName3("attachmentInput"),
|
|
5567
5069
|
disabled: disabled || attachments.length >= maxFiles,
|
|
5568
5070
|
id: inputId,
|
|
5569
5071
|
multiple: true,
|
|
@@ -5571,16 +5073,16 @@ function AttachmentComposer({
|
|
|
5571
5073
|
type: "file"
|
|
5572
5074
|
}
|
|
5573
5075
|
),
|
|
5574
|
-
/* @__PURE__ */
|
|
5076
|
+
/* @__PURE__ */ jsx10(
|
|
5575
5077
|
"button",
|
|
5576
5078
|
{
|
|
5577
|
-
"aria-label":
|
|
5578
|
-
className:
|
|
5079
|
+
"aria-label": attachLabel,
|
|
5080
|
+
className: getClassName3("attachmentButton"),
|
|
5579
5081
|
disabled: disabled || attachments.length >= maxFiles,
|
|
5580
5082
|
onClick: () => document.getElementById(inputId)?.click(),
|
|
5581
|
-
title:
|
|
5083
|
+
title: attachLabel,
|
|
5582
5084
|
type: "button",
|
|
5583
|
-
children: /* @__PURE__ */
|
|
5085
|
+
children: /* @__PURE__ */ jsx10(Paperclip, { size: 14 })
|
|
5584
5086
|
}
|
|
5585
5087
|
)
|
|
5586
5088
|
] });
|
|
@@ -5590,6 +5092,10 @@ function Placeholder({
|
|
|
5590
5092
|
inputRef,
|
|
5591
5093
|
pluginRef
|
|
5592
5094
|
}) {
|
|
5095
|
+
const title = useMessage("plugin-ai-placeholder-title");
|
|
5096
|
+
const description = useMessage("plugin-ai-placeholder-description");
|
|
5097
|
+
const writePromptLabel = useMessage("plugin-ai-placeholder-write-prompt");
|
|
5098
|
+
const browseLabel = useMessage("plugin-ai-placeholder-browse");
|
|
5593
5099
|
const handleEnterPromptClick = () => {
|
|
5594
5100
|
inputRef.current?.focus({ preventScroll: true });
|
|
5595
5101
|
setTimeout(() => {
|
|
@@ -5603,24 +5109,24 @@ function Placeholder({
|
|
|
5603
5109
|
}
|
|
5604
5110
|
}, 10);
|
|
5605
5111
|
};
|
|
5606
|
-
return /* @__PURE__ */
|
|
5607
|
-
/* @__PURE__ */
|
|
5608
|
-
/* @__PURE__ */
|
|
5609
|
-
/* @__PURE__ */
|
|
5610
|
-
/* @__PURE__ */
|
|
5611
|
-
/* @__PURE__ */
|
|
5112
|
+
return /* @__PURE__ */ jsxs7("div", { className: getClassName3("placeholder"), children: [
|
|
5113
|
+
/* @__PURE__ */ jsx10("span", { className: getClassName3("placeholderIcon"), children: /* @__PURE__ */ jsx10(Sparkles, { "aria-hidden": "true", size: 28 }) }),
|
|
5114
|
+
/* @__PURE__ */ jsx10("strong", { className: getClassName3("placeholderTitle"), children: title }),
|
|
5115
|
+
/* @__PURE__ */ jsx10("span", { className: getClassName3("placeholderDescription"), children: description }),
|
|
5116
|
+
/* @__PURE__ */ jsxs7("div", { className: getClassName3("actions"), children: [
|
|
5117
|
+
/* @__PURE__ */ jsx10(
|
|
5612
5118
|
"button",
|
|
5613
5119
|
{
|
|
5614
|
-
className:
|
|
5120
|
+
className: getClassName3("action"),
|
|
5615
5121
|
onClick: handleEnterPromptClick,
|
|
5616
5122
|
type: "button",
|
|
5617
|
-
children:
|
|
5123
|
+
children: writePromptLabel
|
|
5618
5124
|
}
|
|
5619
5125
|
),
|
|
5620
|
-
/* @__PURE__ */
|
|
5126
|
+
/* @__PURE__ */ jsx10(
|
|
5621
5127
|
"button",
|
|
5622
5128
|
{
|
|
5623
|
-
className:
|
|
5129
|
+
className: getClassName3("actionOutlined"),
|
|
5624
5130
|
onClick: () => {
|
|
5625
5131
|
dispatch({
|
|
5626
5132
|
type: "setUi",
|
|
@@ -5628,7 +5134,7 @@ function Placeholder({
|
|
|
5628
5134
|
});
|
|
5629
5135
|
},
|
|
5630
5136
|
type: "button",
|
|
5631
|
-
children:
|
|
5137
|
+
children: browseLabel
|
|
5632
5138
|
}
|
|
5633
5139
|
)
|
|
5634
5140
|
] })
|
|
@@ -5657,7 +5163,7 @@ function isScrolledIntoView(el) {
|
|
|
5657
5163
|
|
|
5658
5164
|
// src/components/ScrollTracking/ScrollTracking.tsx
|
|
5659
5165
|
init_react_import();
|
|
5660
|
-
import { useEffect as
|
|
5166
|
+
import { useEffect as useEffect10, useRef as useRef10 } from "react";
|
|
5661
5167
|
|
|
5662
5168
|
// src/lib/scroll-into-view-local.ts
|
|
5663
5169
|
init_react_import();
|
|
@@ -5727,9 +5233,9 @@ var ScrollTracking = ({
|
|
|
5727
5233
|
children,
|
|
5728
5234
|
trackingId
|
|
5729
5235
|
}) => {
|
|
5730
|
-
const followedRefs =
|
|
5731
|
-
const enabledRef =
|
|
5732
|
-
|
|
5236
|
+
const followedRefs = useRef10([]);
|
|
5237
|
+
const enabledRef = useRef10(false);
|
|
5238
|
+
useEffect10(() => {
|
|
5733
5239
|
return subscribeToScrollTrackingEvents(({ id, enabled }) => {
|
|
5734
5240
|
if (id !== trackingId) return;
|
|
5735
5241
|
enabledRef.current = enabled;
|
|
@@ -5748,7 +5254,7 @@ var ScrollTracking = ({
|
|
|
5748
5254
|
});
|
|
5749
5255
|
}
|
|
5750
5256
|
});
|
|
5751
|
-
|
|
5257
|
+
useEffect10(() => {
|
|
5752
5258
|
follow();
|
|
5753
5259
|
}, [follow]);
|
|
5754
5260
|
return children;
|
|
@@ -5756,20 +5262,310 @@ var ScrollTracking = ({
|
|
|
5756
5262
|
|
|
5757
5263
|
// src/components/Drawer/index.tsx
|
|
5758
5264
|
init_react_import();
|
|
5759
|
-
import { createUsePuck as
|
|
5265
|
+
import { createUsePuck as createUsePuck3 } from "@puckeditor/core";
|
|
5760
5266
|
|
|
5761
5267
|
// src/components/ManageComponents/index.tsx
|
|
5762
5268
|
init_react_import();
|
|
5763
5269
|
import { useGetPuck as useGetPuck5 } from "@puckeditor/core";
|
|
5764
|
-
import {
|
|
5270
|
+
import {
|
|
5271
|
+
Fragment as Fragment7,
|
|
5272
|
+
useCallback as useCallback8,
|
|
5273
|
+
useEffect as useEffect13,
|
|
5274
|
+
useState as useState12,
|
|
5275
|
+
useSyncExternalStore as useSyncExternalStore3
|
|
5276
|
+
} from "react";
|
|
5277
|
+
|
|
5278
|
+
// ../platform-client/components/ActionModal/index.ts
|
|
5279
|
+
init_react_import();
|
|
5280
|
+
|
|
5281
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
5282
|
+
init_react_import();
|
|
5283
|
+
|
|
5284
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/ActionModal/ActionModal.module.css#css-module
|
|
5285
|
+
init_react_import();
|
|
5286
|
+
var ActionModal_module_default = { "ActionModal": "_ActionModal_10j8y_1", "ActionModal-header": "_ActionModal-header_10j8y_6", "ActionModal-body": "_ActionModal-body_10j8y_20", "ActionModal-footer": "_ActionModal-footer_10j8y_28" };
|
|
5287
|
+
|
|
5288
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5289
|
+
init_react_import();
|
|
5290
|
+
|
|
5291
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Modal/Modal.module.css#css-module
|
|
5292
|
+
init_react_import();
|
|
5293
|
+
var Modal_module_default = { "Modal-background": "_Modal-background_10jdm_1", "Modal--visible": "_Modal--visible_10jdm_16", "Modal-modal": "_Modal-modal_10jdm_22" };
|
|
5294
|
+
|
|
5295
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5296
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
5297
|
+
|
|
5298
|
+
// ../platform-client/lib/use-modal-visible.ts
|
|
5299
|
+
init_react_import();
|
|
5300
|
+
import { useEffect as useEffect11, useState as useState10, useRef as useRef11 } from "react";
|
|
5301
|
+
var useModalVisible = (defaultVisible) => {
|
|
5302
|
+
const [visible, setVisible] = useState10(defaultVisible ?? false);
|
|
5303
|
+
const ref = useRef11(null);
|
|
5304
|
+
useEffect11(() => {
|
|
5305
|
+
if (!visible) {
|
|
5306
|
+
return;
|
|
5307
|
+
}
|
|
5308
|
+
const handler = (e) => {
|
|
5309
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
5310
|
+
setVisible(false);
|
|
5311
|
+
}
|
|
5312
|
+
};
|
|
5313
|
+
document.body.addEventListener("click", handler);
|
|
5314
|
+
return () => {
|
|
5315
|
+
document.body.removeEventListener("click", handler);
|
|
5316
|
+
};
|
|
5317
|
+
}, [visible]);
|
|
5318
|
+
return [visible, setVisible, ref];
|
|
5319
|
+
};
|
|
5320
|
+
|
|
5321
|
+
// ../platform-client/components/Button/index.ts
|
|
5322
|
+
init_react_import();
|
|
5323
|
+
|
|
5324
|
+
// ../platform-client/components/Button/Button.tsx
|
|
5325
|
+
init_react_import();
|
|
5326
|
+
import { useEffect as useEffect12, useState as useState11 } from "react";
|
|
5327
|
+
|
|
5328
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Button/Button.module.css#css-module
|
|
5329
|
+
init_react_import();
|
|
5330
|
+
var Button_module_default = { "Button": "_Button_z2rgr_1", "Button--tiny": "_Button--tiny_z2rgr_43", "Button--small": "_Button--small_z2rgr_51", "Button--medium": "_Button--medium_z2rgr_59", "Button--large": "_Button--large_z2rgr_69", "Button--brand": "_Button--brand_z2rgr_78", "Button--primary": "_Button--primary_z2rgr_101", "Button--secondary": "_Button--secondary_z2rgr_129", "Button--danger": "_Button--danger_z2rgr_163", "Button--flush": "_Button--flush_z2rgr_186", "Button--ghost": "_Button--ghost_z2rgr_190", "Button--disabled": "_Button--disabled_z2rgr_216", "Button--fullWidth": "_Button--fullWidth_z2rgr_267", "Button-spinner": "_Button-spinner_z2rgr_272" };
|
|
5331
|
+
|
|
5332
|
+
// ../platform-client/components/Button/Button.tsx
|
|
5333
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5334
|
+
var getClassName4 = get_class_name_factory_default("Button", Button_module_default);
|
|
5335
|
+
var Button = ({
|
|
5336
|
+
children,
|
|
5337
|
+
href,
|
|
5338
|
+
onClick,
|
|
5339
|
+
variant = "primary",
|
|
5340
|
+
type,
|
|
5341
|
+
disabled,
|
|
5342
|
+
tabIndex,
|
|
5343
|
+
newTab,
|
|
5344
|
+
fullWidth,
|
|
5345
|
+
icon,
|
|
5346
|
+
size = "medium",
|
|
5347
|
+
loading: loadingProp = false
|
|
5348
|
+
}) => {
|
|
5349
|
+
const [loading, setLoading] = useState11(loadingProp);
|
|
5350
|
+
useEffect12(() => {
|
|
5351
|
+
const resetLoading = () => setLoading(loadingProp);
|
|
5352
|
+
resetLoading();
|
|
5353
|
+
window.addEventListener("pageshow", resetLoading);
|
|
5354
|
+
return () => window.removeEventListener("pageshow", resetLoading);
|
|
5355
|
+
}, [loadingProp]);
|
|
5356
|
+
const ElementType = href ? "a" : type ? "button" : "span";
|
|
5357
|
+
const el = /* @__PURE__ */ jsxs8(
|
|
5358
|
+
ElementType,
|
|
5359
|
+
{
|
|
5360
|
+
className: getClassName4({
|
|
5361
|
+
brand: variant === "brand",
|
|
5362
|
+
primary: variant === "primary",
|
|
5363
|
+
secondary: variant === "secondary",
|
|
5364
|
+
danger: variant === "danger",
|
|
5365
|
+
ghost: variant === "ghost",
|
|
5366
|
+
// Disabled while its click is still running, too.
|
|
5367
|
+
disabled: disabled || loading,
|
|
5368
|
+
fullWidth,
|
|
5369
|
+
[size]: true
|
|
5370
|
+
}),
|
|
5371
|
+
onClick: (e) => {
|
|
5372
|
+
if (disabled || loading) {
|
|
5373
|
+
e.preventDefault();
|
|
5374
|
+
return;
|
|
5375
|
+
}
|
|
5376
|
+
if (!onClick) return;
|
|
5377
|
+
setLoading(true);
|
|
5378
|
+
Promise.resolve(onClick(e)).then(() => {
|
|
5379
|
+
setLoading(false);
|
|
5380
|
+
});
|
|
5381
|
+
},
|
|
5382
|
+
type,
|
|
5383
|
+
disabled: disabled || loading,
|
|
5384
|
+
tabIndex,
|
|
5385
|
+
target: newTab ? "_blank" : void 0,
|
|
5386
|
+
rel: newTab ? "noreferrer" : void 0,
|
|
5387
|
+
href,
|
|
5388
|
+
children: [
|
|
5389
|
+
icon && /* @__PURE__ */ jsx11("div", { className: getClassName4("icon"), children: icon }),
|
|
5390
|
+
children,
|
|
5391
|
+
loading && /* @__PURE__ */ jsx11("div", { className: getClassName4("spinner"), children: /* @__PURE__ */ jsx11(Loader, { size: 12 }) })
|
|
5392
|
+
]
|
|
5393
|
+
}
|
|
5394
|
+
);
|
|
5395
|
+
return el;
|
|
5396
|
+
};
|
|
5397
|
+
|
|
5398
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5399
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5400
|
+
var getClassName5 = getClassNameFactory("Modal", Modal_module_default);
|
|
5401
|
+
var modalContext = createContext2({
|
|
5402
|
+
buttonVariant: "primary",
|
|
5403
|
+
buttonSize: "medium",
|
|
5404
|
+
visible: false,
|
|
5405
|
+
setVisible: () => {
|
|
5406
|
+
},
|
|
5407
|
+
ref: null
|
|
5408
|
+
});
|
|
5409
|
+
var ModalProvider = ({
|
|
5410
|
+
children,
|
|
5411
|
+
defaultVisible,
|
|
5412
|
+
buttonVariant = "primary",
|
|
5413
|
+
buttonSize = "medium"
|
|
5414
|
+
}) => {
|
|
5415
|
+
const [visible, setVisible, ref] = useModalVisible(defaultVisible);
|
|
5416
|
+
return /* @__PURE__ */ jsx12(
|
|
5417
|
+
modalContext.Provider,
|
|
5418
|
+
{
|
|
5419
|
+
value: { buttonVariant, buttonSize, visible, setVisible, ref },
|
|
5420
|
+
children
|
|
5421
|
+
}
|
|
5422
|
+
);
|
|
5423
|
+
};
|
|
5424
|
+
var useModal = () => {
|
|
5425
|
+
const { visible, setVisible } = useContext2(modalContext);
|
|
5426
|
+
return { visible, setVisible };
|
|
5427
|
+
};
|
|
5428
|
+
var Modal = ({
|
|
5429
|
+
actionLabel = "Open",
|
|
5430
|
+
children,
|
|
5431
|
+
hideButton = false
|
|
5432
|
+
}) => {
|
|
5433
|
+
const { visible, setVisible, buttonVariant, buttonSize, ref } = useContext2(modalContext);
|
|
5434
|
+
return /* @__PURE__ */ jsxs9("div", { className: getClassName5({ visible }), children: [
|
|
5435
|
+
!hideButton && /* @__PURE__ */ jsx12("div", { className: getClassName5("button"), children: /* @__PURE__ */ jsx12(
|
|
5436
|
+
Button,
|
|
5437
|
+
{
|
|
5438
|
+
type: "button",
|
|
5439
|
+
variant: buttonVariant,
|
|
5440
|
+
size: buttonSize,
|
|
5441
|
+
onClick: (e) => {
|
|
5442
|
+
e.stopPropagation();
|
|
5443
|
+
setVisible(!visible);
|
|
5444
|
+
},
|
|
5445
|
+
children: actionLabel
|
|
5446
|
+
}
|
|
5447
|
+
) }),
|
|
5448
|
+
/* @__PURE__ */ jsx12("div", { className: getClassName5("background"), children: /* @__PURE__ */ jsx12("div", { className: getClassName5("modal"), ref, children }) })
|
|
5449
|
+
] });
|
|
5450
|
+
};
|
|
5451
|
+
|
|
5452
|
+
// ../platform-client/components/Heading/index.ts
|
|
5453
|
+
init_react_import();
|
|
5454
|
+
|
|
5455
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
5456
|
+
init_react_import();
|
|
5457
|
+
|
|
5458
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
5459
|
+
init_react_import();
|
|
5460
|
+
var Heading_module_default = { "Heading": "_Heading_l89dy_1", "Heading--brand": "_Heading--brand_l89dy_15", "Heading--xxxxl": "_Heading--xxxxl_l89dy_26", "Heading--xxxl": "_Heading--xxxl_l89dy_33", "Heading--xxl": "_Heading--xxl_l89dy_40", "Heading--xl": "_Heading--xl_l89dy_47", "Heading--l": "_Heading--l_l89dy_54", "Heading--m": "_Heading--m_l89dy_58", "Heading--s": "_Heading--s_l89dy_62", "Heading--xs": "_Heading--xs_l89dy_69", "Heading--xxs": "_Heading--xxs_l89dy_76" };
|
|
5461
|
+
|
|
5462
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
5463
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
5464
|
+
var getClassName6 = get_class_name_factory_default("Heading", Heading_module_default);
|
|
5465
|
+
var Heading = ({
|
|
5466
|
+
children,
|
|
5467
|
+
rank,
|
|
5468
|
+
size = "m",
|
|
5469
|
+
variant = "default"
|
|
5470
|
+
}) => {
|
|
5471
|
+
const Tag = rank ? `h${rank}` : "span";
|
|
5472
|
+
return /* @__PURE__ */ jsx13(
|
|
5473
|
+
Tag,
|
|
5474
|
+
{
|
|
5475
|
+
className: getClassName6({
|
|
5476
|
+
[size]: true,
|
|
5477
|
+
brand: variant === "brand"
|
|
5478
|
+
}),
|
|
5479
|
+
children
|
|
5480
|
+
}
|
|
5481
|
+
);
|
|
5482
|
+
};
|
|
5483
|
+
|
|
5484
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
5485
|
+
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5486
|
+
var getClassName7 = getClassNameFactory("ActionModal", ActionModal_module_default);
|
|
5487
|
+
var ActionModalFooter = ({ children }) => /* @__PURE__ */ jsx14("div", { className: getClassName7("footer"), children });
|
|
5488
|
+
var ActionModal = ({
|
|
5489
|
+
actionLabel = "Open",
|
|
5490
|
+
children,
|
|
5491
|
+
title,
|
|
5492
|
+
description,
|
|
5493
|
+
actions,
|
|
5494
|
+
hideButton
|
|
5495
|
+
}) => {
|
|
5496
|
+
return /* @__PURE__ */ jsx14(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ jsxs10("div", { className: getClassName7(), children: [
|
|
5497
|
+
/* @__PURE__ */ jsxs10("div", { className: getClassName7("header"), children: [
|
|
5498
|
+
/* @__PURE__ */ jsx14(Heading, { size: "s", children: title }),
|
|
5499
|
+
description && /* @__PURE__ */ jsx14("small", { children: description })
|
|
5500
|
+
] }),
|
|
5501
|
+
/* @__PURE__ */ jsx14("div", { className: getClassName7("body"), children }),
|
|
5502
|
+
actions && /* @__PURE__ */ jsx14(ActionModalFooter, { children: actions })
|
|
5503
|
+
] }) });
|
|
5504
|
+
};
|
|
5505
|
+
ActionModal.Footer = ActionModalFooter;
|
|
5506
|
+
|
|
5507
|
+
// ../platform-client/components/Inline/index.ts
|
|
5508
|
+
init_react_import();
|
|
5509
|
+
|
|
5510
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
5511
|
+
init_react_import();
|
|
5512
|
+
|
|
5513
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
5514
|
+
init_react_import();
|
|
5515
|
+
var Inline_module_default = { "Inline": "_Inline_6o5on_3", "Inline-inner": "_Inline-inner_6o5on_7", "Inline--noWrap": "_Inline--noWrap_6o5on_12", "Inline--sizeNONE": "_Inline--sizeNONE_6o5on_16", "Inline--sizeXXS": "_Inline--sizeXXS_6o5on_20", "Inline--sizeXS": "_Inline--sizeXS_6o5on_24", "Inline--sizeS": "_Inline--sizeS_6o5on_28", "Inline--sizeM": "_Inline--sizeM_6o5on_32", "Inline--sizeL": "_Inline--sizeL_6o5on_36", "Inline--center": "_Inline--center_6o5on_40", "Inline--centerH": "_Inline--centerH_6o5on_44", "Inline--grow": "_Inline--grow_6o5on_48" };
|
|
5516
|
+
|
|
5517
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
5518
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
5519
|
+
var getClassName8 = get_class_name_factory_default("Inline", Inline_module_default);
|
|
5520
|
+
var Inline = ({
|
|
5521
|
+
children,
|
|
5522
|
+
grow,
|
|
5523
|
+
center,
|
|
5524
|
+
size = "m",
|
|
5525
|
+
noWrap,
|
|
5526
|
+
centerH
|
|
5527
|
+
}) => /* @__PURE__ */ jsx15(
|
|
5528
|
+
"div",
|
|
5529
|
+
{
|
|
5530
|
+
className: getClassName8({
|
|
5531
|
+
grow,
|
|
5532
|
+
center,
|
|
5533
|
+
centerH,
|
|
5534
|
+
noWrap,
|
|
5535
|
+
[`size${size.toUpperCase()}`]: size
|
|
5536
|
+
}),
|
|
5537
|
+
children: /* @__PURE__ */ jsx15("div", { className: getClassName8("inner"), children })
|
|
5538
|
+
}
|
|
5539
|
+
);
|
|
5540
|
+
var InlineItem = ({
|
|
5541
|
+
children,
|
|
5542
|
+
grow,
|
|
5543
|
+
push,
|
|
5544
|
+
shrink
|
|
5545
|
+
}) => /* @__PURE__ */ jsx15(
|
|
5546
|
+
"div",
|
|
5547
|
+
{
|
|
5548
|
+
style: {
|
|
5549
|
+
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
5550
|
+
flexShrink: shrink ? "1" : "0",
|
|
5551
|
+
marginLeft: push ? "auto" : 0,
|
|
5552
|
+
maxWidth: "100%"
|
|
5553
|
+
},
|
|
5554
|
+
children
|
|
5555
|
+
}
|
|
5556
|
+
);
|
|
5557
|
+
Inline.Item = InlineItem;
|
|
5558
|
+
|
|
5559
|
+
// ../platform-client/components/Modal/index.ts
|
|
5560
|
+
init_react_import();
|
|
5765
5561
|
|
|
5766
5562
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ManageComponents/styles.module.css#css-module
|
|
5767
5563
|
init_react_import();
|
|
5768
|
-
var
|
|
5564
|
+
var styles_module_default7 = { "ManageComponents-cta": "_ManageComponents-cta_iejpb_1", "ManageComponents-list": "_ManageComponents-list_iejpb_25", "ManageComponents-item": "_ManageComponents-item_iejpb_32", "ManageComponents-delete": "_ManageComponents-delete_iejpb_47", "ManageComponents-empty": "_ManageComponents-empty_iejpb_70", "ManageComponents-confirmation": "_ManageComponents-confirmation_iejpb_75" };
|
|
5769
5565
|
|
|
5770
5566
|
// src/components/ManageComponents/index.tsx
|
|
5771
|
-
import { Fragment as
|
|
5772
|
-
var
|
|
5567
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5568
|
+
var cx5 = getClassNameFactory("ManageComponents", styles_module_default7);
|
|
5773
5569
|
var useRegistrations = () => useSyncExternalStore3(
|
|
5774
5570
|
registrationStore.subscribe,
|
|
5775
5571
|
() => registrationStore.getAll(),
|
|
@@ -5777,10 +5573,16 @@ var useRegistrations = () => useSyncExternalStore3(
|
|
|
5777
5573
|
);
|
|
5778
5574
|
function ManageModalContent({ onClose }) {
|
|
5779
5575
|
const getPuck = useGetPuck5();
|
|
5576
|
+
const deleteTitle = useMessage("plugin-ai-components-delete-title");
|
|
5577
|
+
const cancelLabel = useMessage("plugin-ai-components-delete-cancel");
|
|
5578
|
+
const deleteLabel = useMessage("plugin-ai-components-delete");
|
|
5579
|
+
const deleteConfirm = useMessage("plugin-ai-components-delete-confirm");
|
|
5580
|
+
const manageTitle = useMessage("plugin-ai-components-manage");
|
|
5581
|
+
const emptyLabel = useMessage("plugin-ai-components-manage-empty");
|
|
5780
5582
|
const { visible, setVisible } = useModal();
|
|
5781
|
-
const [confirmTarget, setConfirmTarget] =
|
|
5583
|
+
const [confirmTarget, setConfirmTarget] = useState12(null);
|
|
5782
5584
|
const entries = useRegistrations();
|
|
5783
|
-
|
|
5585
|
+
useEffect13(() => {
|
|
5784
5586
|
if (!visible) onClose();
|
|
5785
5587
|
}, [visible, onClose]);
|
|
5786
5588
|
const handleDelete = (name) => {
|
|
@@ -5791,84 +5593,84 @@ function ManageModalContent({ onClose }) {
|
|
|
5791
5593
|
}
|
|
5792
5594
|
};
|
|
5793
5595
|
if (confirmTarget) {
|
|
5794
|
-
return /* @__PURE__ */
|
|
5596
|
+
return /* @__PURE__ */ jsx16(
|
|
5795
5597
|
ActionModal,
|
|
5796
5598
|
{
|
|
5797
|
-
title:
|
|
5599
|
+
title: deleteTitle,
|
|
5798
5600
|
hideButton: true,
|
|
5799
|
-
actions: /* @__PURE__ */
|
|
5800
|
-
/* @__PURE__ */
|
|
5801
|
-
/* @__PURE__ */
|
|
5601
|
+
actions: /* @__PURE__ */ jsxs11(Inline, { children: [
|
|
5602
|
+
/* @__PURE__ */ jsx16(Button, { variant: "secondary", onClick: () => setConfirmTarget(null), children: cancelLabel }),
|
|
5603
|
+
/* @__PURE__ */ jsx16(
|
|
5802
5604
|
Button,
|
|
5803
5605
|
{
|
|
5804
5606
|
variant: "danger",
|
|
5805
5607
|
onClick: () => handleDelete(confirmTarget.name),
|
|
5806
|
-
children:
|
|
5608
|
+
children: deleteLabel
|
|
5807
5609
|
}
|
|
5808
5610
|
)
|
|
5809
5611
|
] }),
|
|
5810
|
-
children: /* @__PURE__ */
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
] })
|
|
5612
|
+
children: /* @__PURE__ */ jsx16("p", { className: cx5("confirmation"), children: deleteConfirm.split("{label}").map((part, i) => /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
5613
|
+
i > 0 && /* @__PURE__ */ jsx16("b", { children: confirmTarget.label }),
|
|
5614
|
+
part
|
|
5615
|
+
] }, i)) })
|
|
5815
5616
|
}
|
|
5816
5617
|
);
|
|
5817
5618
|
}
|
|
5818
|
-
return /* @__PURE__ */
|
|
5819
|
-
entries.map(([name, reg]) => /* @__PURE__ */
|
|
5820
|
-
/* @__PURE__ */
|
|
5821
|
-
/* @__PURE__ */
|
|
5619
|
+
return /* @__PURE__ */ jsx16(ActionModal, { title: manageTitle, hideButton: true, children: /* @__PURE__ */ jsxs11("div", { className: cx5("list"), children: [
|
|
5620
|
+
entries.map(([name, reg]) => /* @__PURE__ */ jsxs11("div", { className: cx5("item"), children: [
|
|
5621
|
+
/* @__PURE__ */ jsx16("span", { className: cx5("itemName"), children: reg.label || name }),
|
|
5622
|
+
/* @__PURE__ */ jsxs11(
|
|
5822
5623
|
"button",
|
|
5823
5624
|
{
|
|
5824
|
-
className:
|
|
5625
|
+
className: cx5("delete"),
|
|
5825
5626
|
onClick: () => setConfirmTarget({ name, label: reg.label || name }),
|
|
5826
5627
|
type: "button",
|
|
5827
5628
|
children: [
|
|
5828
|
-
/* @__PURE__ */
|
|
5829
|
-
|
|
5629
|
+
/* @__PURE__ */ jsx16(Trash2, { size: 12 }),
|
|
5630
|
+
deleteLabel
|
|
5830
5631
|
]
|
|
5831
5632
|
}
|
|
5832
5633
|
)
|
|
5833
5634
|
] }, name)),
|
|
5834
|
-
entries.length === 0 && /* @__PURE__ */
|
|
5635
|
+
entries.length === 0 && /* @__PURE__ */ jsx16("div", { className: cx5("empty"), children: emptyLabel })
|
|
5835
5636
|
] }) });
|
|
5836
5637
|
}
|
|
5837
5638
|
function ManageComponentsCta() {
|
|
5838
|
-
const [open, setOpen] =
|
|
5639
|
+
const [open, setOpen] = useState12(false);
|
|
5839
5640
|
const entries = useRegistrations();
|
|
5641
|
+
const manageLabel = useMessage("plugin-ai-components-manage");
|
|
5840
5642
|
const handleClose = useCallback8(() => setOpen(false), []);
|
|
5841
5643
|
if (entries.length === 0) return null;
|
|
5842
|
-
return /* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
|
|
5644
|
+
return /* @__PURE__ */ jsxs11(Fragment8, { children: [
|
|
5645
|
+
/* @__PURE__ */ jsxs11("button", { className: cx5("cta"), onClick: () => setOpen(true), type: "button", children: [
|
|
5646
|
+
/* @__PURE__ */ jsx16(Settings, { size: 14 }),
|
|
5647
|
+
manageLabel
|
|
5846
5648
|
] }),
|
|
5847
|
-
open && /* @__PURE__ */
|
|
5649
|
+
open && /* @__PURE__ */ jsx16(ModalProvider, { defaultVisible: true, children: /* @__PURE__ */ jsx16(ManageModalContent, { onClose: handleClose }) })
|
|
5848
5650
|
] });
|
|
5849
5651
|
}
|
|
5850
5652
|
|
|
5851
5653
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Drawer/styles.module.css#css-module
|
|
5852
5654
|
init_react_import();
|
|
5853
|
-
var
|
|
5655
|
+
var styles_module_default8 = { "Drawer": "_Drawer_1mu8g_1", "Drawer--empty": "_Drawer--empty_1mu8g_5" };
|
|
5854
5656
|
|
|
5855
5657
|
// src/components/Drawer/index.tsx
|
|
5856
|
-
import { jsx as
|
|
5857
|
-
var
|
|
5858
|
-
var
|
|
5658
|
+
import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5659
|
+
var usePuck3 = createUsePuck3();
|
|
5660
|
+
var cx6 = getClassNameFactory("Drawer", styles_module_default8);
|
|
5859
5661
|
var createDrawer = (designModeVisible) => function Drawer({ children }) {
|
|
5860
|
-
const config =
|
|
5662
|
+
const config = usePuck3((s) => s.config);
|
|
5861
5663
|
if (Object.keys(config.components).length === 0) {
|
|
5862
|
-
return /* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsx17("div", { className: `${cx6({ empty: true })} ${pluginThemeClassName}`, children: "No blocks" });
|
|
5863
5665
|
}
|
|
5864
|
-
return /* @__PURE__ */
|
|
5666
|
+
return /* @__PURE__ */ jsxs12("div", { className: `${cx6()} ${pluginThemeClassName}`, children: [
|
|
5865
5667
|
children,
|
|
5866
|
-
designModeVisible && /* @__PURE__ */
|
|
5668
|
+
designModeVisible && /* @__PURE__ */ jsx17(ManageComponentsCta, {})
|
|
5867
5669
|
] });
|
|
5868
5670
|
};
|
|
5869
5671
|
|
|
5870
5672
|
// src/index.tsx
|
|
5871
|
-
import { Fragment as
|
|
5673
|
+
import { Fragment as Fragment9, jsx as jsx18 } from "react/jsx-runtime";
|
|
5872
5674
|
function withDynamicConfig(config, data) {
|
|
5873
5675
|
const registrations = getPersistedRegistrations(data);
|
|
5874
5676
|
const dynamicConfig = {};
|
|
@@ -5899,28 +5701,29 @@ function withDynamicConfig(config, data) {
|
|
|
5899
5701
|
return result;
|
|
5900
5702
|
}
|
|
5901
5703
|
function createAiPlugin(opts) {
|
|
5902
|
-
const { scrollTracking = true, ...rest } = opts || {};
|
|
5704
|
+
const { label = "AI", scrollTracking = true, ...rest } = opts || {};
|
|
5903
5705
|
const scrollTrackingId = `puck-ai-scroll-${ulid2()}`;
|
|
5904
5706
|
const designModeVisible = typeof opts?.designMode === "boolean" ? opts.designMode : opts?.designMode?.visible ?? false;
|
|
5905
5707
|
return {
|
|
5906
|
-
label
|
|
5708
|
+
label,
|
|
5907
5709
|
name: "ai",
|
|
5908
|
-
render: () => /* @__PURE__ */
|
|
5909
|
-
icon: /* @__PURE__ */
|
|
5710
|
+
render: () => /* @__PURE__ */ jsx18(Chat2, { ...rest, scrollTrackingId }),
|
|
5711
|
+
icon: /* @__PURE__ */ jsx18(Bot, {}),
|
|
5910
5712
|
mobilePanelHeight: "min-content",
|
|
5911
5713
|
overrides: {
|
|
5912
5714
|
drawer: createDrawer(designModeVisible),
|
|
5913
5715
|
preview: ({ children }) => {
|
|
5914
5716
|
if (scrollTracking) {
|
|
5915
|
-
return /* @__PURE__ */
|
|
5717
|
+
return /* @__PURE__ */ jsx18(ScrollTracking, { trackingId: scrollTrackingId, children });
|
|
5916
5718
|
}
|
|
5917
|
-
return /* @__PURE__ */
|
|
5719
|
+
return /* @__PURE__ */ jsx18(Fragment9, { children });
|
|
5918
5720
|
}
|
|
5919
5721
|
}
|
|
5920
5722
|
};
|
|
5921
5723
|
}
|
|
5922
5724
|
export {
|
|
5923
5725
|
createAiPlugin,
|
|
5726
|
+
defaultDictionary,
|
|
5924
5727
|
withDynamicConfig
|
|
5925
5728
|
};
|
|
5926
5729
|
/*! Bundled license information:
|