@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.js
CHANGED
|
@@ -404,6 +404,7 @@ var require_dist = __commonJS({
|
|
|
404
404
|
var index_exports = {};
|
|
405
405
|
__export(index_exports, {
|
|
406
406
|
createAiPlugin: () => createAiPlugin,
|
|
407
|
+
defaultDictionary: () => defaultDictionary,
|
|
407
408
|
withDynamicConfig: () => withDynamicConfig
|
|
408
409
|
});
|
|
409
410
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -430,8 +431,8 @@ var toCamelCase = (string) => string.replace(
|
|
|
430
431
|
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
431
432
|
);
|
|
432
433
|
var toPascalCase = (string) => {
|
|
433
|
-
const
|
|
434
|
-
return
|
|
434
|
+
const camelCase = toCamelCase(string);
|
|
435
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
435
436
|
};
|
|
436
437
|
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
437
438
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
@@ -995,10 +996,10 @@ function useChat({
|
|
|
995
996
|
// src/components/Chat/index.tsx
|
|
996
997
|
var import_core5 = require("@puckeditor/core");
|
|
997
998
|
var import_ai5 = require("ai");
|
|
998
|
-
var
|
|
999
|
+
var import_react17 = require("react");
|
|
999
1000
|
var import_ulid = require("ulid");
|
|
1000
1001
|
|
|
1001
|
-
// ../
|
|
1002
|
+
// ../platform-client/lib/get-class-name-factory.ts
|
|
1002
1003
|
init_react_import();
|
|
1003
1004
|
var import_classnames = __toESM(require_classnames());
|
|
1004
1005
|
var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
|
@@ -1034,417 +1035,62 @@ var get_class_name_factory_default = getClassNameFactory;
|
|
|
1034
1035
|
|
|
1035
1036
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Chat/styles.module.css#css-module
|
|
1036
1037
|
init_react_import();
|
|
1037
|
-
var styles_module_default = { "Chat": "
|
|
1038
|
+
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" };
|
|
1038
1039
|
|
|
1039
1040
|
// src/components/ChatBody/index.tsx
|
|
1040
1041
|
init_react_import();
|
|
1041
|
-
var
|
|
1042
|
+
var import_react11 = require("react");
|
|
1042
1043
|
var import_use_stick_to_bottom = require("use-stick-to-bottom");
|
|
1043
1044
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
1044
1045
|
|
|
1045
|
-
// ../platform-client/index.ts
|
|
1046
|
-
init_react_import();
|
|
1047
|
-
|
|
1048
|
-
// ../platform-client/components/ActionModal/index.ts
|
|
1049
|
-
init_react_import();
|
|
1050
|
-
|
|
1051
|
-
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
1052
|
-
init_react_import();
|
|
1053
|
-
|
|
1054
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/ActionModal/ActionModal.module.css#css-module
|
|
1055
|
-
init_react_import();
|
|
1056
|
-
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" };
|
|
1057
|
-
|
|
1058
|
-
// ../platform-client/lib/index.ts
|
|
1059
|
-
init_react_import();
|
|
1060
|
-
|
|
1061
|
-
// ../platform-client/lib/get-class-name-factory.ts
|
|
1062
|
-
init_react_import();
|
|
1063
|
-
var import_classnames2 = __toESM(require_classnames());
|
|
1064
|
-
var getClassNameFactory2 = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
|
1065
|
-
let descendant = false;
|
|
1066
|
-
let modifiers = false;
|
|
1067
|
-
if (typeof options === "string") {
|
|
1068
|
-
descendant = options;
|
|
1069
|
-
} else if (typeof options === "object") {
|
|
1070
|
-
modifiers = options;
|
|
1071
|
-
}
|
|
1072
|
-
if (descendant) {
|
|
1073
|
-
const style = styles[`${rootClass}-${descendant}`];
|
|
1074
|
-
if (style) {
|
|
1075
|
-
return baseClass + styles[`${rootClass}-${descendant}`] || "";
|
|
1076
|
-
}
|
|
1077
|
-
return "";
|
|
1078
|
-
} else if (modifiers) {
|
|
1079
|
-
const prefixedModifiers = {};
|
|
1080
|
-
for (let modifier in modifiers) {
|
|
1081
|
-
prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
|
1082
|
-
}
|
|
1083
|
-
const c = styles[rootClass];
|
|
1084
|
-
return baseClass + (0, import_classnames2.default)({
|
|
1085
|
-
[c]: !!c,
|
|
1086
|
-
// only apply the class if it exists
|
|
1087
|
-
...prefixedModifiers
|
|
1088
|
-
});
|
|
1089
|
-
} else {
|
|
1090
|
-
return baseClass + styles[rootClass] || "";
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
var get_class_name_factory_default2 = getClassNameFactory2;
|
|
1094
|
-
|
|
1095
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1096
|
-
init_react_import();
|
|
1097
|
-
|
|
1098
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Modal/Modal.module.css#css-module
|
|
1046
|
+
// ../platform-client/components/IconButton/index.ts
|
|
1099
1047
|
init_react_import();
|
|
1100
|
-
var Modal_module_default = { "Modal-background": "_Modal-background_mocy5_1", "Modal--visible": "_Modal--visible_mocy5_16", "Modal-modal": "_Modal-modal_mocy5_22" };
|
|
1101
|
-
|
|
1102
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1103
|
-
var import_react9 = require("react");
|
|
1104
1048
|
|
|
1105
|
-
// ../platform-client/
|
|
1049
|
+
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1106
1050
|
init_react_import();
|
|
1107
1051
|
var import_react7 = require("react");
|
|
1108
|
-
var useModalVisible = (defaultVisible) => {
|
|
1109
|
-
const [visible, setVisible] = (0, import_react7.useState)(defaultVisible ?? false);
|
|
1110
|
-
const ref = (0, import_react7.useRef)(null);
|
|
1111
|
-
(0, import_react7.useEffect)(() => {
|
|
1112
|
-
if (!visible) {
|
|
1113
|
-
return;
|
|
1114
|
-
}
|
|
1115
|
-
const handler = (e) => {
|
|
1116
|
-
if (ref.current && !ref.current.contains(e.target)) {
|
|
1117
|
-
setVisible(false);
|
|
1118
|
-
}
|
|
1119
|
-
};
|
|
1120
|
-
document.body.addEventListener("click", handler);
|
|
1121
|
-
return () => {
|
|
1122
|
-
document.body.removeEventListener("click", handler);
|
|
1123
|
-
};
|
|
1124
|
-
}, [visible]);
|
|
1125
|
-
return [visible, setVisible, ref];
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
// ../platform-client/components/Button/index.ts
|
|
1129
|
-
init_react_import();
|
|
1130
|
-
|
|
1131
|
-
// ../platform-client/components/Button/Button.tsx
|
|
1132
|
-
init_react_import();
|
|
1133
|
-
var import_react8 = require("react");
|
|
1134
1052
|
|
|
1135
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/
|
|
1053
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/IconButton/IconButton.module.css#css-module
|
|
1136
1054
|
init_react_import();
|
|
1137
|
-
var
|
|
1055
|
+
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" };
|
|
1138
1056
|
|
|
1139
1057
|
// ../platform-client/components/Loader/index.tsx
|
|
1140
1058
|
init_react_import();
|
|
1141
1059
|
|
|
1142
|
-
//
|
|
1143
|
-
init_react_import();
|
|
1144
|
-
var styles_module_default2 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
1145
|
-
|
|
1146
|
-
// ../platform-client/components/Loader/index.tsx
|
|
1147
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1148
|
-
var getClassName = getClassNameFactory2("Loader", styles_module_default2);
|
|
1149
|
-
var Loader = ({
|
|
1150
|
-
color,
|
|
1151
|
-
size = 16,
|
|
1152
|
-
...props
|
|
1153
|
-
}) => {
|
|
1154
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1155
|
-
"span",
|
|
1156
|
-
{
|
|
1157
|
-
className: getClassName(),
|
|
1158
|
-
style: {
|
|
1159
|
-
width: size,
|
|
1160
|
-
height: size,
|
|
1161
|
-
color
|
|
1162
|
-
},
|
|
1163
|
-
"aria-label": "loading",
|
|
1164
|
-
...props
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
};
|
|
1168
|
-
|
|
1169
|
-
// ../platform-client/components/Button/Button.tsx
|
|
1170
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1171
|
-
var getClassName2 = get_class_name_factory_default2("Button", Button_module_default);
|
|
1172
|
-
var Button = ({
|
|
1173
|
-
children,
|
|
1174
|
-
href,
|
|
1175
|
-
onClick,
|
|
1176
|
-
variant = "primary",
|
|
1177
|
-
type,
|
|
1178
|
-
disabled,
|
|
1179
|
-
tabIndex,
|
|
1180
|
-
newTab,
|
|
1181
|
-
fullWidth,
|
|
1182
|
-
icon,
|
|
1183
|
-
size = "medium",
|
|
1184
|
-
loading: loadingProp = false
|
|
1185
|
-
}) => {
|
|
1186
|
-
const [loading, setLoading] = (0, import_react8.useState)(loadingProp);
|
|
1187
|
-
(0, import_react8.useEffect)(() => {
|
|
1188
|
-
const resetLoading = () => setLoading(loadingProp);
|
|
1189
|
-
resetLoading();
|
|
1190
|
-
window.addEventListener("pageshow", resetLoading);
|
|
1191
|
-
return () => window.removeEventListener("pageshow", resetLoading);
|
|
1192
|
-
}, [loadingProp]);
|
|
1193
|
-
const ElementType = href ? "a" : type ? "button" : "span";
|
|
1194
|
-
const el = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1195
|
-
ElementType,
|
|
1196
|
-
{
|
|
1197
|
-
className: getClassName2({
|
|
1198
|
-
brand: variant === "brand",
|
|
1199
|
-
primary: variant === "primary",
|
|
1200
|
-
secondary: variant === "secondary",
|
|
1201
|
-
danger: variant === "danger",
|
|
1202
|
-
ghost: variant === "ghost",
|
|
1203
|
-
// Disabled while its click is still running, too.
|
|
1204
|
-
disabled: disabled || loading,
|
|
1205
|
-
fullWidth,
|
|
1206
|
-
[size]: true
|
|
1207
|
-
}),
|
|
1208
|
-
onClick: (e) => {
|
|
1209
|
-
if (disabled || loading) {
|
|
1210
|
-
e.preventDefault();
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
if (!onClick) return;
|
|
1214
|
-
setLoading(true);
|
|
1215
|
-
Promise.resolve(onClick(e)).then(() => {
|
|
1216
|
-
setLoading(false);
|
|
1217
|
-
});
|
|
1218
|
-
},
|
|
1219
|
-
type,
|
|
1220
|
-
disabled: disabled || loading,
|
|
1221
|
-
tabIndex,
|
|
1222
|
-
target: newTab ? "_blank" : void 0,
|
|
1223
|
-
rel: newTab ? "noreferrer" : void 0,
|
|
1224
|
-
href,
|
|
1225
|
-
children: [
|
|
1226
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("icon"), children: icon }),
|
|
1227
|
-
children,
|
|
1228
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 12 }) })
|
|
1229
|
-
]
|
|
1230
|
-
}
|
|
1231
|
-
);
|
|
1232
|
-
return el;
|
|
1233
|
-
};
|
|
1234
|
-
|
|
1235
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1236
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1237
|
-
var getClassName3 = getClassNameFactory2("Modal", Modal_module_default);
|
|
1238
|
-
var modalContext = (0, import_react9.createContext)({
|
|
1239
|
-
buttonVariant: "primary",
|
|
1240
|
-
buttonSize: "medium",
|
|
1241
|
-
visible: false,
|
|
1242
|
-
setVisible: () => {
|
|
1243
|
-
},
|
|
1244
|
-
ref: null
|
|
1245
|
-
});
|
|
1246
|
-
var ModalProvider = ({
|
|
1247
|
-
children,
|
|
1248
|
-
defaultVisible,
|
|
1249
|
-
buttonVariant = "primary",
|
|
1250
|
-
buttonSize = "medium"
|
|
1251
|
-
}) => {
|
|
1252
|
-
const [visible, setVisible, ref] = useModalVisible(defaultVisible);
|
|
1253
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1254
|
-
modalContext.Provider,
|
|
1255
|
-
{
|
|
1256
|
-
value: { buttonVariant, buttonSize, visible, setVisible, ref },
|
|
1257
|
-
children
|
|
1258
|
-
}
|
|
1259
|
-
);
|
|
1260
|
-
};
|
|
1261
|
-
var useModal = () => {
|
|
1262
|
-
const { visible, setVisible } = (0, import_react9.useContext)(modalContext);
|
|
1263
|
-
return { visible, setVisible };
|
|
1264
|
-
};
|
|
1265
|
-
var Modal = ({
|
|
1266
|
-
actionLabel = "Open",
|
|
1267
|
-
children,
|
|
1268
|
-
hideButton = false
|
|
1269
|
-
}) => {
|
|
1270
|
-
const { visible, setVisible, buttonVariant, buttonSize, ref } = (0, import_react9.useContext)(modalContext);
|
|
1271
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3({ visible }), children: [
|
|
1272
|
-
!hideButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("button"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1273
|
-
Button,
|
|
1274
|
-
{
|
|
1275
|
-
type: "button",
|
|
1276
|
-
variant: buttonVariant,
|
|
1277
|
-
size: buttonSize,
|
|
1278
|
-
onClick: (e) => {
|
|
1279
|
-
e.stopPropagation();
|
|
1280
|
-
setVisible(!visible);
|
|
1281
|
-
},
|
|
1282
|
-
children: actionLabel
|
|
1283
|
-
}
|
|
1284
|
-
) }),
|
|
1285
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("background"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("modal"), ref, children }) })
|
|
1286
|
-
] });
|
|
1287
|
-
};
|
|
1288
|
-
|
|
1289
|
-
// ../platform-client/components/Heading/index.ts
|
|
1290
|
-
init_react_import();
|
|
1291
|
-
|
|
1292
|
-
// ../platform-client/components/Heading/Heading.tsx
|
|
1293
|
-
init_react_import();
|
|
1294
|
-
|
|
1295
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
1296
|
-
init_react_import();
|
|
1297
|
-
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" };
|
|
1298
|
-
|
|
1299
|
-
// ../platform-client/components/Heading/Heading.tsx
|
|
1300
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1301
|
-
var getClassName4 = get_class_name_factory_default2("Heading", Heading_module_default);
|
|
1302
|
-
var Heading = ({
|
|
1303
|
-
children,
|
|
1304
|
-
rank,
|
|
1305
|
-
size = "m",
|
|
1306
|
-
variant = "default"
|
|
1307
|
-
}) => {
|
|
1308
|
-
const Tag2 = rank ? `h${rank}` : "span";
|
|
1309
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1310
|
-
Tag2,
|
|
1311
|
-
{
|
|
1312
|
-
className: getClassName4({
|
|
1313
|
-
[size]: true,
|
|
1314
|
-
brand: variant === "brand"
|
|
1315
|
-
}),
|
|
1316
|
-
children
|
|
1317
|
-
}
|
|
1318
|
-
);
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
1322
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1323
|
-
var getClassName5 = getClassNameFactory2("ActionModal", ActionModal_module_default);
|
|
1324
|
-
var ActionModalFooter = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName5("footer"), children });
|
|
1325
|
-
var ActionModal = ({
|
|
1326
|
-
actionLabel = "Open",
|
|
1327
|
-
children,
|
|
1328
|
-
title,
|
|
1329
|
-
description,
|
|
1330
|
-
actions,
|
|
1331
|
-
hideButton
|
|
1332
|
-
}) => {
|
|
1333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
|
1334
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5("header"), children: [
|
|
1335
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { size: "s", children: title }),
|
|
1336
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: description })
|
|
1337
|
-
] }),
|
|
1338
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName5("body"), children }),
|
|
1339
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionModalFooter, { children: actions })
|
|
1340
|
-
] }) });
|
|
1341
|
-
};
|
|
1342
|
-
ActionModal.Footer = ActionModalFooter;
|
|
1343
|
-
|
|
1344
|
-
// ../platform-client/components/AIAction/index.tsx
|
|
1345
|
-
init_react_import();
|
|
1346
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1347
|
-
|
|
1348
|
-
// ../platform-client/components/Align/index.ts
|
|
1349
|
-
init_react_import();
|
|
1350
|
-
|
|
1351
|
-
// ../platform-client/components/Align/Align.tsx
|
|
1352
|
-
init_react_import();
|
|
1353
|
-
var import_react10 = __toESM(require("react"));
|
|
1354
|
-
|
|
1355
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Align/Align.module.css#css-module
|
|
1356
|
-
init_react_import();
|
|
1357
|
-
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" };
|
|
1358
|
-
|
|
1359
|
-
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
1360
|
-
init_react_import();
|
|
1361
|
-
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
1362
|
-
var SEPARATORS = /[_.\- ]+/;
|
|
1363
|
-
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
1364
|
-
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
1365
|
-
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
1366
|
-
|
|
1367
|
-
// ../platform-client/components/Align/Align.tsx
|
|
1368
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1369
|
-
var getClassName6 = get_class_name_factory_default2("Align", Align_module_default);
|
|
1370
|
-
|
|
1371
|
-
// ../platform-client/components/AutoForm/index.ts
|
|
1372
|
-
init_react_import();
|
|
1373
|
-
|
|
1374
|
-
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
1375
|
-
init_react_import();
|
|
1376
|
-
var import_core = require("@puckeditor/core");
|
|
1377
|
-
var import_react11 = require("react");
|
|
1378
|
-
|
|
1379
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/AutoForm/AutoForm.module.css#css-module
|
|
1380
|
-
init_react_import();
|
|
1381
|
-
var AutoForm_module_default = { "AutoForm": "_AutoForm_1vmh9_1" };
|
|
1382
|
-
|
|
1383
|
-
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
1384
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1385
|
-
var getClassName7 = getClassNameFactory2("AutoForm", AutoForm_module_default);
|
|
1386
|
-
|
|
1387
|
-
// ../platform-client/components/Card/index.ts
|
|
1388
|
-
init_react_import();
|
|
1389
|
-
|
|
1390
|
-
// ../platform-client/components/Card/Card.tsx
|
|
1391
|
-
init_react_import();
|
|
1392
|
-
|
|
1393
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Card/Card.module.css#css-module
|
|
1394
|
-
init_react_import();
|
|
1395
|
-
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" };
|
|
1396
|
-
|
|
1397
|
-
// ../platform-client/components/Card/Card.tsx
|
|
1398
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1399
|
-
var getClassName8 = get_class_name_factory_default2("Card", Card_module_default);
|
|
1400
|
-
|
|
1401
|
-
// ../platform-client/components/CardSelector/index.tsx
|
|
1402
|
-
init_react_import();
|
|
1403
|
-
|
|
1404
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/CardSelector/styles.module.css#css-module
|
|
1405
|
-
init_react_import();
|
|
1406
|
-
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" };
|
|
1407
|
-
|
|
1408
|
-
// ../platform-client/components/CardSelector/index.tsx
|
|
1409
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1410
|
-
var cx = get_class_name_factory_default("CardSelector", styles_module_default3);
|
|
1411
|
-
var cxOption = get_class_name_factory_default("CardSelectorOption", styles_module_default3);
|
|
1412
|
-
|
|
1413
|
-
// ../platform-client/components/Code/index.ts
|
|
1414
|
-
init_react_import();
|
|
1415
|
-
|
|
1416
|
-
// ../platform-client/components/Code/Code.tsx
|
|
1417
|
-
init_react_import();
|
|
1418
|
-
|
|
1419
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Code/Code.module.css#css-module
|
|
1420
|
-
init_react_import();
|
|
1421
|
-
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" };
|
|
1422
|
-
|
|
1423
|
-
// ../platform-client/components/Code/CopyAction.tsx
|
|
1424
|
-
init_react_import();
|
|
1425
|
-
var import_react12 = require("react");
|
|
1426
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1427
|
-
|
|
1428
|
-
// ../platform-client/components/Code/Code.tsx
|
|
1429
|
-
var import_react13 = require("react");
|
|
1430
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1431
|
-
var getClassName9 = get_class_name_factory_default("Code", Code_module_default);
|
|
1432
|
-
var getClassNameTab = get_class_name_factory_default("Tab", Code_module_default);
|
|
1433
|
-
|
|
1434
|
-
// ../platform-client/components/IconButton/index.ts
|
|
1435
|
-
init_react_import();
|
|
1436
|
-
|
|
1437
|
-
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1060
|
+
// ../platform-client/lib/index.ts
|
|
1438
1061
|
init_react_import();
|
|
1439
|
-
var import_react14 = require("react");
|
|
1440
1062
|
|
|
1441
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/
|
|
1063
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Loader/styles.module.css#css-module
|
|
1442
1064
|
init_react_import();
|
|
1443
|
-
var
|
|
1065
|
+
var styles_module_default2 = { "Loader": "_Loader_68nru_13", "loader-animation": "_loader-animation_68nru_1" };
|
|
1066
|
+
|
|
1067
|
+
// ../platform-client/components/Loader/index.tsx
|
|
1068
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1069
|
+
var getClassName = getClassNameFactory("Loader", styles_module_default2);
|
|
1070
|
+
var Loader = ({
|
|
1071
|
+
color,
|
|
1072
|
+
label = "loading",
|
|
1073
|
+
size = 16,
|
|
1074
|
+
...props
|
|
1075
|
+
}) => {
|
|
1076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1077
|
+
"span",
|
|
1078
|
+
{
|
|
1079
|
+
className: getClassName(),
|
|
1080
|
+
style: {
|
|
1081
|
+
width: size,
|
|
1082
|
+
height: size,
|
|
1083
|
+
color
|
|
1084
|
+
},
|
|
1085
|
+
"aria-label": label,
|
|
1086
|
+
...props
|
|
1087
|
+
}
|
|
1088
|
+
);
|
|
1089
|
+
};
|
|
1444
1090
|
|
|
1445
1091
|
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1446
|
-
var
|
|
1447
|
-
var
|
|
1092
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1093
|
+
var getClassName2 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
|
1448
1094
|
var IconButton = ({
|
|
1449
1095
|
children,
|
|
1450
1096
|
href,
|
|
@@ -1458,12 +1104,12 @@ var IconButton = ({
|
|
|
1458
1104
|
title,
|
|
1459
1105
|
dark
|
|
1460
1106
|
}) => {
|
|
1461
|
-
const [loading, setLoading] = (0,
|
|
1107
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
1462
1108
|
const ElementType = href ? "a" : onClick ? "button" : "div";
|
|
1463
|
-
const el = /* @__PURE__ */ (0,
|
|
1109
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1464
1110
|
ElementType,
|
|
1465
1111
|
{
|
|
1466
|
-
className:
|
|
1112
|
+
className: getClassName2({
|
|
1467
1113
|
primary: variant === "primary",
|
|
1468
1114
|
secondary: variant === "secondary",
|
|
1469
1115
|
disabled,
|
|
@@ -1485,11 +1131,11 @@ var IconButton = ({
|
|
|
1485
1131
|
href,
|
|
1486
1132
|
title,
|
|
1487
1133
|
children: [
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: getClassName2("title"), children: title }),
|
|
1489
1135
|
children,
|
|
1490
|
-
loading && /* @__PURE__ */ (0,
|
|
1136
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1491
1137
|
"\xA0\xA0",
|
|
1492
|
-
/* @__PURE__ */ (0,
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 14 })
|
|
1493
1139
|
] })
|
|
1494
1140
|
]
|
|
1495
1141
|
}
|
|
@@ -1497,279 +1143,21 @@ var IconButton = ({
|
|
|
1497
1143
|
return el;
|
|
1498
1144
|
};
|
|
1499
1145
|
|
|
1500
|
-
//
|
|
1501
|
-
init_react_import();
|
|
1502
|
-
|
|
1503
|
-
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
1504
|
-
init_react_import();
|
|
1505
|
-
|
|
1506
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/InfoBar/InfoBar.module.css#css-module
|
|
1507
|
-
init_react_import();
|
|
1508
|
-
var InfoBar_module_default = { "InfoBar": "_InfoBar_kchdj_1", "Info": "_Info_kchdj_1", "Info-title": "_Info-title_kchdj_21" };
|
|
1509
|
-
|
|
1510
|
-
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
1511
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1512
|
-
var cx2 = getClassNameFactory2("InfoBar", InfoBar_module_default);
|
|
1513
|
-
var cxInfo = getClassNameFactory2("Info", InfoBar_module_default);
|
|
1514
|
-
var Info = ({ title, children }) => {
|
|
1515
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cxInfo(), children: [
|
|
1516
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cxInfo("title"), children: title }),
|
|
1517
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cxInfo("children"), children })
|
|
1518
|
-
] });
|
|
1519
|
-
};
|
|
1520
|
-
var InfoBar = ({ children }) => {
|
|
1521
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cx2(), children });
|
|
1522
|
-
};
|
|
1523
|
-
InfoBar.Info = Info;
|
|
1524
|
-
|
|
1525
|
-
// ../platform-client/components/Inline/index.ts
|
|
1526
|
-
init_react_import();
|
|
1527
|
-
|
|
1528
|
-
// ../platform-client/components/Inline/Inline.tsx
|
|
1529
|
-
init_react_import();
|
|
1530
|
-
|
|
1531
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
1532
|
-
init_react_import();
|
|
1533
|
-
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" };
|
|
1534
|
-
|
|
1535
|
-
// ../platform-client/components/Inline/Inline.tsx
|
|
1536
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1537
|
-
var getClassName11 = get_class_name_factory_default2("Inline", Inline_module_default);
|
|
1538
|
-
var Inline = ({
|
|
1539
|
-
children,
|
|
1540
|
-
grow,
|
|
1541
|
-
center,
|
|
1542
|
-
size = "m",
|
|
1543
|
-
noWrap,
|
|
1544
|
-
centerH
|
|
1545
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1546
|
-
"div",
|
|
1547
|
-
{
|
|
1548
|
-
className: getClassName11({
|
|
1549
|
-
grow,
|
|
1550
|
-
center,
|
|
1551
|
-
centerH,
|
|
1552
|
-
noWrap,
|
|
1553
|
-
[`size${size.toUpperCase()}`]: size
|
|
1554
|
-
}),
|
|
1555
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("inner"), children })
|
|
1556
|
-
}
|
|
1557
|
-
);
|
|
1558
|
-
var InlineItem = ({
|
|
1559
|
-
children,
|
|
1560
|
-
grow,
|
|
1561
|
-
push,
|
|
1562
|
-
shrink
|
|
1563
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1564
|
-
"div",
|
|
1565
|
-
{
|
|
1566
|
-
style: {
|
|
1567
|
-
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
1568
|
-
flexShrink: shrink ? "1" : "0",
|
|
1569
|
-
marginLeft: push ? "auto" : 0,
|
|
1570
|
-
maxWidth: "100%"
|
|
1571
|
-
},
|
|
1572
|
-
children
|
|
1573
|
-
}
|
|
1574
|
-
);
|
|
1575
|
-
Inline.Item = InlineItem;
|
|
1576
|
-
|
|
1577
|
-
// ../platform-client/components/Link/index.ts
|
|
1578
|
-
init_react_import();
|
|
1579
|
-
|
|
1580
|
-
// ../platform-client/components/Link/Link.tsx
|
|
1581
|
-
init_react_import();
|
|
1582
|
-
|
|
1583
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Link/Link.module.css#css-module
|
|
1584
|
-
init_react_import();
|
|
1585
|
-
var Link_module_default = { "Link": "_Link_1j70m_1" };
|
|
1586
|
-
|
|
1587
|
-
// ../platform-client/components/Link/Link.tsx
|
|
1588
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1589
|
-
var getClassName12 = get_class_name_factory_default2("Link", Link_module_default);
|
|
1590
|
-
|
|
1591
|
-
// ../platform-client/components/Menu/index.tsx
|
|
1592
|
-
init_react_import();
|
|
1593
|
-
var import_react15 = require("react");
|
|
1594
|
-
|
|
1595
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Menu/styles.module.css#css-module
|
|
1596
|
-
init_react_import();
|
|
1597
|
-
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" };
|
|
1598
|
-
|
|
1599
|
-
// ../platform-client/components/Menu/index.tsx
|
|
1600
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1601
|
-
var getClassName13 = get_class_name_factory_default2("Menu", styles_module_default4);
|
|
1602
|
-
var itemClassName = get_class_name_factory_default2("Menu-item", styles_module_default4);
|
|
1603
|
-
|
|
1604
|
-
// ../platform-client/components/Modal/index.ts
|
|
1605
|
-
init_react_import();
|
|
1606
|
-
|
|
1607
|
-
// ../platform-client/components/Page/index.ts
|
|
1608
|
-
init_react_import();
|
|
1609
|
-
|
|
1610
|
-
// ../platform-client/components/Page/Page.tsx
|
|
1611
|
-
init_react_import();
|
|
1612
|
-
|
|
1613
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Page/Page.module.css#css-module
|
|
1614
|
-
init_react_import();
|
|
1615
|
-
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" };
|
|
1616
|
-
|
|
1617
|
-
// ../platform-client/components/Page/Page.tsx
|
|
1618
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1619
|
-
var cx3 = getClassNameFactory2("Page", Page_module_default);
|
|
1620
|
-
|
|
1621
|
-
// ../platform-client/components/Pagination/index.ts
|
|
1622
|
-
init_react_import();
|
|
1623
|
-
|
|
1624
|
-
// ../platform-client/components/Pagination/Pagination.tsx
|
|
1625
|
-
init_react_import();
|
|
1626
|
-
var import_react16 = require("react");
|
|
1627
|
-
|
|
1628
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Pagination/Pagination.module.css#css-module
|
|
1629
|
-
init_react_import();
|
|
1630
|
-
var Pagination_module_default = { "Pagination": "_Pagination_1okv2_1", "PaginationButton": "_PaginationButton_1okv2_8", "PaginationButton--isActive": "_PaginationButton--isActive_1okv2_20", "Pagination-ellipsis": "_Pagination-ellipsis_1okv2_30" };
|
|
1631
|
-
|
|
1632
|
-
// ../platform-client/components/Pagination/Pagination.tsx
|
|
1633
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1634
|
-
var cx4 = getClassNameFactory2("Pagination", Pagination_module_default);
|
|
1635
|
-
var cxButton = getClassNameFactory2("PaginationButton", Pagination_module_default);
|
|
1636
|
-
|
|
1637
|
-
// ../platform-client/components/PlanGrid/index.tsx
|
|
1638
|
-
init_react_import();
|
|
1639
|
-
|
|
1640
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/PlanGrid/styles.module.css#css-module
|
|
1641
|
-
init_react_import();
|
|
1642
|
-
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" };
|
|
1643
|
-
|
|
1644
|
-
// ../utils/lib/format-currency.ts
|
|
1645
|
-
init_react_import();
|
|
1646
|
-
|
|
1647
|
-
// ../platform-client/lib/plan-ids.ts
|
|
1648
|
-
init_react_import();
|
|
1649
|
-
var PAYG_PLAN_ID = "pay-as-you-go_v2";
|
|
1650
|
-
var LAUNCH_PLAN_ID = "launch_monthly_v2";
|
|
1651
|
-
var GROWTH_PLAN_ID = "growth_monthly_v2";
|
|
1652
|
-
var PLAN_RANK = {
|
|
1653
|
-
[PAYG_PLAN_ID]: 0,
|
|
1654
|
-
[LAUNCH_PLAN_ID]: 1,
|
|
1655
|
-
[GROWTH_PLAN_ID]: 2
|
|
1656
|
-
};
|
|
1657
|
-
var LEGACY_PLAN_IDS = [
|
|
1658
|
-
"pro_monthly",
|
|
1659
|
-
"business_monthly",
|
|
1660
|
-
"growth_monthly",
|
|
1661
|
-
"pro_annual",
|
|
1662
|
-
"business_annual",
|
|
1663
|
-
"growth_annual",
|
|
1664
|
-
"pro50_monthly",
|
|
1665
|
-
"business200_monthly",
|
|
1666
|
-
"pro_unlimited_monthly",
|
|
1667
|
-
"business_unlimited_monthly"
|
|
1668
|
-
];
|
|
1669
|
-
var VALID_PLAN_IDS = [
|
|
1670
|
-
...LEGACY_PLAN_IDS,
|
|
1671
|
-
"pay-as-you-go_v2",
|
|
1672
|
-
"launch_monthly_v2",
|
|
1673
|
-
"growth_monthly_v2"
|
|
1674
|
-
];
|
|
1675
|
-
|
|
1676
|
-
// ../platform-client/components/PlanGrid/index.tsx
|
|
1677
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1678
|
-
var cx5 = get_class_name_factory_default("PlanGrid", styles_module_default5);
|
|
1679
|
-
|
|
1680
|
-
// ../platform-client/components/Section/index.ts
|
|
1681
|
-
init_react_import();
|
|
1682
|
-
|
|
1683
|
-
// ../platform-client/components/Section/Section.tsx
|
|
1684
|
-
init_react_import();
|
|
1685
|
-
|
|
1686
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Section/Section.module.css#css-module
|
|
1687
|
-
init_react_import();
|
|
1688
|
-
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" };
|
|
1689
|
-
|
|
1690
|
-
// ../platform-client/components/Section/Section.tsx
|
|
1691
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1692
|
-
var getClassName14 = getClassNameFactory2("Section", Section_module_default);
|
|
1693
|
-
|
|
1694
|
-
// ../platform-client/components/StatusTag/index.ts
|
|
1695
|
-
init_react_import();
|
|
1696
|
-
|
|
1697
|
-
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
1698
|
-
init_react_import();
|
|
1699
|
-
|
|
1700
|
-
// ../platform-client/components/Tag/index.ts
|
|
1701
|
-
init_react_import();
|
|
1702
|
-
|
|
1703
|
-
// ../platform-client/components/Tag/Tag.tsx
|
|
1704
|
-
init_react_import();
|
|
1705
|
-
|
|
1706
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Tag/Tag.module.css#css-module
|
|
1707
|
-
init_react_import();
|
|
1708
|
-
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" };
|
|
1709
|
-
|
|
1710
|
-
// ../platform-client/components/Tag/Tag.tsx
|
|
1711
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1712
|
-
var getClassName15 = getClassNameFactory2("Tag", Tag_module_default);
|
|
1713
|
-
|
|
1714
|
-
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
1715
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1716
|
-
|
|
1717
|
-
// ../platform-client/components/Table/index.ts
|
|
1718
|
-
init_react_import();
|
|
1719
|
-
|
|
1720
|
-
// ../platform-client/components/Table/Table.tsx
|
|
1146
|
+
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
1721
1147
|
init_react_import();
|
|
1722
|
-
var
|
|
1148
|
+
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" };
|
|
1723
1149
|
|
|
1724
|
-
//
|
|
1150
|
+
// src/components/PromptForm/index.tsx
|
|
1725
1151
|
init_react_import();
|
|
1726
|
-
var
|
|
1727
|
-
|
|
1728
|
-
// ../platform-client/components/Table/Table.tsx
|
|
1729
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1730
|
-
var getClassName16 = get_class_name_factory_default2("Table", Table_module_default);
|
|
1731
|
-
var getRowClassName = get_class_name_factory_default2("TableRow", Table_module_default);
|
|
1152
|
+
var import_react8 = require("react");
|
|
1732
1153
|
|
|
1733
1154
|
// ../platform-client/components/Textarea/index.tsx
|
|
1734
1155
|
init_react_import();
|
|
1735
1156
|
var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
|
|
1736
1157
|
|
|
1737
|
-
// ../platform-client/components/VerticalSpace/index.ts
|
|
1738
|
-
init_react_import();
|
|
1739
|
-
|
|
1740
|
-
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
1741
|
-
init_react_import();
|
|
1742
|
-
|
|
1743
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/VerticalSpace/VerticalSpace.module.css#css-module
|
|
1744
|
-
init_react_import();
|
|
1745
|
-
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" };
|
|
1746
|
-
|
|
1747
|
-
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
1748
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1749
|
-
var getClassName17 = get_class_name_factory_default2("VerticalSpace", VerticalSpace_module_default);
|
|
1750
|
-
|
|
1751
|
-
// ../platform-client/components/Viewport/index.tsx
|
|
1752
|
-
init_react_import();
|
|
1753
|
-
|
|
1754
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Viewport/styles.module.css#css-module
|
|
1755
|
-
init_react_import();
|
|
1756
|
-
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" };
|
|
1757
|
-
|
|
1758
|
-
// ../platform-client/components/Viewport/index.tsx
|
|
1759
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1760
|
-
var cx6 = getClassNameFactory("Viewport", styles_module_default6);
|
|
1761
|
-
|
|
1762
|
-
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
1763
|
-
init_react_import();
|
|
1764
|
-
var styles_module_default7 = { "Chat": "_Chat_5z5yi_1", "Chat--hasMessages": "_Chat--hasMessages_5z5yi_17", "Chat-inner": "_Chat-inner_5z5yi_28", "Chat--hasChildren": "_Chat--hasChildren_5z5yi_40", "Chat-body": "_Chat-body_5z5yi_45", "Chat--isLoading": "_Chat--isLoading_5z5yi_52", "Chat-messages": "_Chat-messages_5z5yi_56", "Chat-form": "_Chat-form_5z5yi_63", "Chat--hideInput": "_Chat--hideInput_5z5yi_68", "Chat-formHelper": "_Chat-formHelper_5z5yi_82", "Chat-examplePrompts": "_Chat-examplePrompts_5z5yi_97", "Chat-examplePrompt": "_Chat-examplePrompt_5z5yi_97", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_5z5yi_134", "Chat-default": "_Chat-default_5z5yi_139", "ChatMessage": "_ChatMessage_5z5yi_155", "ChatMessage--userRole": "_ChatMessage--userRole_5z5yi_164", "ChatMessage-userBubble": "_ChatMessage-userBubble_5z5yi_164", "ChatMessage-userAttachments": "_ChatMessage-userAttachments_5z5yi_175", "ChatMessage-thumbnail": "_ChatMessage-thumbnail_5z5yi_181", "ChatMessage-thumbnailLabel": "_ChatMessage-thumbnailLabel_5z5yi_211", "ChatMessage-text": "_ChatMessage-text_5z5yi_284", "ChatMessage-event": "_ChatMessage-event_5z5yi_319", "ChatMessage-eventBody": "_ChatMessage-eventBody_5z5yi_323", "ChatMessage-eventCollapse": "_ChatMessage-eventCollapse_5z5yi_332", "ChatMessage-eventHeader": "_ChatMessage-eventHeader_5z5yi_336", "ChatMessage-eventExpand": "_ChatMessage-eventExpand_5z5yi_336", "ChatMessage-eventIcon": "_ChatMessage-eventIcon_5z5yi_362", "ChatMessage-eventLabel": "_ChatMessage-eventLabel_5z5yi_366", "ChatMessage-attachmentImage": "_ChatMessage-attachmentImage_5z5yi_380", "ChatMessage-attachmentFile": "_ChatMessage-attachmentFile_5z5yi_397", "Chat-loader": "_Chat-loader_5z5yi_420", "Chat-loaderIcon": "_Chat-loaderIcon_5z5yi_430", "Chat-error": "_Chat-error_5z5yi_434", "Chat-errorLabel": "_Chat-errorLabel_5z5yi_443", "Chat-errorAction": "_Chat-errorAction_5z5yi_447", "Chat-userError": "_Chat-userError_5z5yi_451", "Chat-userErrorDismiss": "_Chat-userErrorDismiss_5z5yi_461" };
|
|
1765
|
-
|
|
1766
|
-
// src/components/PromptForm/index.tsx
|
|
1767
|
-
init_react_import();
|
|
1768
|
-
var import_react18 = require("react");
|
|
1769
|
-
|
|
1770
1158
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PromptForm/styles.module.css#css-module
|
|
1771
1159
|
init_react_import();
|
|
1772
|
-
var
|
|
1160
|
+
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" };
|
|
1773
1161
|
|
|
1774
1162
|
// src/lib/attachments.ts
|
|
1775
1163
|
init_react_import();
|
|
@@ -1880,15 +1268,59 @@ var truncateFilename = (name, max = 25) => {
|
|
|
1880
1268
|
return `${name.slice(0, available)}\u2026${ext}`;
|
|
1881
1269
|
};
|
|
1882
1270
|
|
|
1271
|
+
// src/lib/dictionary.ts
|
|
1272
|
+
init_react_import();
|
|
1273
|
+
var import_core = require("@puckeditor/core");
|
|
1274
|
+
var defaultDictionary = {
|
|
1275
|
+
"loader-loading": "loading",
|
|
1276
|
+
"plugin-ai-placeholder-title": "Build with AI",
|
|
1277
|
+
"plugin-ai-placeholder-description": "Describe what you want to create or change.",
|
|
1278
|
+
"plugin-ai-placeholder-write-prompt": "Write a prompt",
|
|
1279
|
+
"plugin-ai-placeholder-browse": "Browse",
|
|
1280
|
+
"plugin-ai-prompt-placeholder": "What do you want to build?",
|
|
1281
|
+
"plugin-ai-prompt-attachment-attach": "Attach files",
|
|
1282
|
+
"plugin-ai-prompt-attachment-drop": "Attach file",
|
|
1283
|
+
"plugin-ai-prompt-attachment-item-failed": "Failed",
|
|
1284
|
+
"plugin-ai-prompt-attachment-item-remove": "Remove attachment",
|
|
1285
|
+
"plugin-ai-prompt-design-mode": "Design",
|
|
1286
|
+
"plugin-ai-prompt-design-mode-enable": "Enable design mode",
|
|
1287
|
+
"plugin-ai-prompt-design-mode-disable": "Disable design mode",
|
|
1288
|
+
"plugin-ai-prompt-error-uploading": "Wait for attachments to finish uploading.",
|
|
1289
|
+
"plugin-ai-prompt-error-attachment-failed": "Remove failed attachments before sending.",
|
|
1290
|
+
"plugin-ai-prompt-error-attachment-upload-failed": "One or more attachments failed to upload.",
|
|
1291
|
+
"plugin-ai-prompt-error-max-files": "You can attach up to {count} files per message.",
|
|
1292
|
+
"plugin-ai-prompt-error-max-size": "{name} exceeds the {limit} MB file size limit.",
|
|
1293
|
+
"plugin-ai-prompt-error-type": "Unsupported file type: {name}",
|
|
1294
|
+
"plugin-ai-prompt-error-dismiss": "Dismiss",
|
|
1295
|
+
"plugin-ai-chat-msg-thinking": "Thinking...",
|
|
1296
|
+
"plugin-ai-chat-msg-thought-for": "Thought for {seconds}s",
|
|
1297
|
+
"plugin-ai-chat-msg-thought": "Thought for a while",
|
|
1298
|
+
"plugin-ai-chat-msg-attachment": "Attachment",
|
|
1299
|
+
"plugin-ai-chat-error": "Something went wrong.",
|
|
1300
|
+
"plugin-ai-chat-error-retry": "Retry",
|
|
1301
|
+
"plugin-ai-components-manage": "Manage components",
|
|
1302
|
+
"plugin-ai-components-manage-empty": "No dynamic components",
|
|
1303
|
+
"plugin-ai-components-delete": "Delete",
|
|
1304
|
+
"plugin-ai-components-delete-title": "Delete component",
|
|
1305
|
+
"plugin-ai-components-delete-confirm": "Are you sure you want to delete {label}?",
|
|
1306
|
+
"plugin-ai-components-delete-cancel": "Cancel"
|
|
1307
|
+
};
|
|
1308
|
+
var usePuck = (0, import_core.createUsePuck)();
|
|
1309
|
+
var interpolate = (message, params = {}) => message.replace(
|
|
1310
|
+
/\{(\w+)\}/g,
|
|
1311
|
+
(match, key) => params[key] !== void 0 ? String(params[key]) : match
|
|
1312
|
+
);
|
|
1313
|
+
var getMessage = (dictionary, key, params) => interpolate(dictionary[key] ?? defaultDictionary[key], params);
|
|
1314
|
+
var useMessage = (key, params) => usePuck((s) => getMessage(s.dictionary, key, params));
|
|
1315
|
+
|
|
1883
1316
|
// src/components/PromptForm/index.tsx
|
|
1884
|
-
var
|
|
1885
|
-
var
|
|
1317
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1318
|
+
var cx = getClassNameFactory("PromptForm", styles_module_default4);
|
|
1886
1319
|
function PromptForm({
|
|
1887
1320
|
actions,
|
|
1888
1321
|
attachments,
|
|
1889
1322
|
onFileDrop,
|
|
1890
1323
|
onRemoveAttachment,
|
|
1891
|
-
colorScheme = "light",
|
|
1892
1324
|
glow,
|
|
1893
1325
|
handleSubmit,
|
|
1894
1326
|
helperText,
|
|
@@ -1901,13 +1333,21 @@ function PromptForm({
|
|
|
1901
1333
|
maxRows = 5,
|
|
1902
1334
|
value = ""
|
|
1903
1335
|
}) {
|
|
1904
|
-
const
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
const
|
|
1336
|
+
const dropLabel = useMessage("plugin-ai-prompt-attachment-drop");
|
|
1337
|
+
const attachmentFailedLabel = useMessage(
|
|
1338
|
+
"plugin-ai-prompt-attachment-item-failed"
|
|
1339
|
+
);
|
|
1340
|
+
const attachmentRemoveLabel = useMessage(
|
|
1341
|
+
"plugin-ai-prompt-attachment-item-remove"
|
|
1342
|
+
);
|
|
1343
|
+
const loadingLabel = useMessage("loader-loading");
|
|
1344
|
+
const hasSetInitialPrompt = (0, import_react8.useRef)(false);
|
|
1345
|
+
const [prompt, setPrompt] = (0, import_react8.useState)(value);
|
|
1346
|
+
const internalRef = (0, import_react8.useRef)(null);
|
|
1347
|
+
const [isDragOver, setIsDragOver] = (0, import_react8.useState)(false);
|
|
1348
|
+
const dragCounterRef = (0, import_react8.useRef)(0);
|
|
1909
1349
|
const canDrop = !!onFileDrop && !isDisabled && !isLoading;
|
|
1910
|
-
const handleDragEnter = (0,
|
|
1350
|
+
const handleDragEnter = (0, import_react8.useCallback)(
|
|
1911
1351
|
(e) => {
|
|
1912
1352
|
e.preventDefault();
|
|
1913
1353
|
dragCounterRef.current++;
|
|
@@ -1917,17 +1357,17 @@ function PromptForm({
|
|
|
1917
1357
|
},
|
|
1918
1358
|
[canDrop]
|
|
1919
1359
|
);
|
|
1920
|
-
const handleDragLeave = (0,
|
|
1360
|
+
const handleDragLeave = (0, import_react8.useCallback)((e) => {
|
|
1921
1361
|
e.preventDefault();
|
|
1922
1362
|
dragCounterRef.current--;
|
|
1923
1363
|
if (dragCounterRef.current === 0) {
|
|
1924
1364
|
setIsDragOver(false);
|
|
1925
1365
|
}
|
|
1926
1366
|
}, []);
|
|
1927
|
-
const handleDragOver = (0,
|
|
1367
|
+
const handleDragOver = (0, import_react8.useCallback)((e) => {
|
|
1928
1368
|
e.preventDefault();
|
|
1929
1369
|
}, []);
|
|
1930
|
-
const handleDrop = (0,
|
|
1370
|
+
const handleDrop = (0, import_react8.useCallback)(
|
|
1931
1371
|
(e) => {
|
|
1932
1372
|
e.preventDefault();
|
|
1933
1373
|
dragCounterRef.current = 0;
|
|
@@ -1941,7 +1381,7 @@ function PromptForm({
|
|
|
1941
1381
|
},
|
|
1942
1382
|
[canDrop, onFileDrop]
|
|
1943
1383
|
);
|
|
1944
|
-
const handlePaste = (0,
|
|
1384
|
+
const handlePaste = (0, import_react8.useCallback)(
|
|
1945
1385
|
(e) => {
|
|
1946
1386
|
if (!canDrop) return;
|
|
1947
1387
|
const files = getFilesFromClipboard(e.clipboardData);
|
|
@@ -1951,7 +1391,7 @@ function PromptForm({
|
|
|
1951
1391
|
},
|
|
1952
1392
|
[canDrop, onFileDrop]
|
|
1953
1393
|
);
|
|
1954
|
-
(0,
|
|
1394
|
+
(0, import_react8.useEffect)(() => {
|
|
1955
1395
|
setPrompt(value);
|
|
1956
1396
|
}, [setPrompt, value]);
|
|
1957
1397
|
const sendPrompt = async () => {
|
|
@@ -1966,7 +1406,7 @@ function PromptForm({
|
|
|
1966
1406
|
setPrompt("");
|
|
1967
1407
|
}
|
|
1968
1408
|
};
|
|
1969
|
-
(0,
|
|
1409
|
+
(0, import_react8.useEffect)(() => {
|
|
1970
1410
|
const currentUrl = new URL(location.href);
|
|
1971
1411
|
const initialPrompt = currentUrl.searchParams.get("initialPrompt");
|
|
1972
1412
|
if (!hasSetInitialPrompt.current && initialPrompt && prompt === "") {
|
|
@@ -1974,13 +1414,12 @@ function PromptForm({
|
|
|
1974
1414
|
setPrompt(initialPrompt);
|
|
1975
1415
|
}
|
|
1976
1416
|
}, [setPrompt]);
|
|
1977
|
-
return /* @__PURE__ */ (0,
|
|
1417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1978
1418
|
"div",
|
|
1979
1419
|
{
|
|
1980
|
-
className:
|
|
1420
|
+
className: cx({
|
|
1981
1421
|
isDisabled,
|
|
1982
1422
|
isLoading,
|
|
1983
|
-
dark: colorScheme === "dark",
|
|
1984
1423
|
glow,
|
|
1985
1424
|
userCta: !!cta
|
|
1986
1425
|
}),
|
|
@@ -1989,56 +1428,57 @@ function PromptForm({
|
|
|
1989
1428
|
onDragOver: onFileDrop ? handleDragOver : void 0,
|
|
1990
1429
|
onDrop: onFileDrop ? handleDrop : void 0,
|
|
1991
1430
|
children: [
|
|
1992
|
-
isDragOver ? /* @__PURE__ */ (0,
|
|
1993
|
-
/* @__PURE__ */ (0,
|
|
1994
|
-
/* @__PURE__ */ (0,
|
|
1431
|
+
isDragOver ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("dropOverlay"), children: [
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Paperclip, { size: 20 }),
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: dropLabel })
|
|
1995
1434
|
] }) : null,
|
|
1996
|
-
helperText ? /* @__PURE__ */ (0,
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
1998
|
-
/* @__PURE__ */ (0,
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
1435
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cx("helper"), children: helperText }) : null,
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("inner"), children: [
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("glow") }),
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2000
1439
|
"form",
|
|
2001
1440
|
{
|
|
2002
1441
|
onSubmit: (e) => {
|
|
2003
1442
|
e.preventDefault();
|
|
2004
1443
|
void sendPrompt();
|
|
2005
1444
|
},
|
|
2006
|
-
children: /* @__PURE__ */ (0,
|
|
2007
|
-
attachments && attachments.length > 0 ? /* @__PURE__ */ (0,
|
|
1445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("formInner"), children: [
|
|
1446
|
+
attachments && attachments.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cx("attachments"), children: attachments.map((attachment) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2008
1447
|
"div",
|
|
2009
1448
|
{
|
|
2010
1449
|
className: [
|
|
2011
|
-
|
|
2012
|
-
attachment.status === "uploading" ?
|
|
2013
|
-
attachment.status === "failed" ?
|
|
1450
|
+
cx("attachmentChip"),
|
|
1451
|
+
attachment.status === "uploading" ? cx("attachmentChipUploading") : "",
|
|
1452
|
+
attachment.status === "failed" ? cx("attachmentChipFailed") : ""
|
|
2014
1453
|
].filter(Boolean).join(" "),
|
|
2015
1454
|
children: [
|
|
2016
|
-
attachment.status === "uploading" ? /* @__PURE__ */ (0,
|
|
1455
|
+
attachment.status === "uploading" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2017
1456
|
LoaderCircle,
|
|
2018
1457
|
{
|
|
2019
|
-
className:
|
|
1458
|
+
className: cx("attachmentSpinner"),
|
|
2020
1459
|
size: 14
|
|
2021
1460
|
}
|
|
2022
1461
|
) : null,
|
|
2023
|
-
/* @__PURE__ */ (0,
|
|
2024
|
-
attachment.status === "failed" ? /* @__PURE__ */ (0,
|
|
2025
|
-
onRemoveAttachment ? /* @__PURE__ */ (0,
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { title: attachment.filename, children: truncateFilename(attachment.filename) }),
|
|
1463
|
+
attachment.status === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("attachmentError"), children: attachmentFailedLabel }) : null,
|
|
1464
|
+
onRemoveAttachment ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2026
1465
|
"button",
|
|
2027
1466
|
{
|
|
2028
|
-
|
|
1467
|
+
"aria-label": attachmentRemoveLabel,
|
|
1468
|
+
className: cx("attachmentRemove"),
|
|
2029
1469
|
onClick: () => onRemoveAttachment(attachment.clientId),
|
|
2030
1470
|
type: "button",
|
|
2031
|
-
children: /* @__PURE__ */ (0,
|
|
1471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(X, { size: 12 })
|
|
2032
1472
|
}
|
|
2033
1473
|
) : null
|
|
2034
1474
|
]
|
|
2035
1475
|
},
|
|
2036
1476
|
attachment.clientId
|
|
2037
1477
|
)) }) : null,
|
|
2038
|
-
/* @__PURE__ */ (0,
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2039
1479
|
import_react_textarea_autosize.default,
|
|
2040
1480
|
{
|
|
2041
|
-
className:
|
|
1481
|
+
className: cx("input"),
|
|
2042
1482
|
name: "prompt",
|
|
2043
1483
|
minRows,
|
|
2044
1484
|
maxRows,
|
|
@@ -2066,34 +1506,34 @@ function PromptForm({
|
|
|
2066
1506
|
}
|
|
2067
1507
|
}
|
|
2068
1508
|
),
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2070
1510
|
"div",
|
|
2071
1511
|
{
|
|
2072
|
-
className:
|
|
1512
|
+
className: cx("actions"),
|
|
2073
1513
|
onClick: () => {
|
|
2074
1514
|
internalRef?.current?.focus();
|
|
2075
1515
|
},
|
|
2076
1516
|
children: [
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2078
1518
|
"div",
|
|
2079
1519
|
{
|
|
2080
|
-
className:
|
|
1520
|
+
className: cx("actionsLeft"),
|
|
2081
1521
|
onClick: (e) => e.stopPropagation(),
|
|
2082
1522
|
children: actions
|
|
2083
1523
|
}
|
|
2084
1524
|
),
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2086
1526
|
"div",
|
|
2087
1527
|
{
|
|
2088
|
-
className:
|
|
1528
|
+
className: cx("actionsRight"),
|
|
2089
1529
|
onClick: (e) => e.stopPropagation(),
|
|
2090
|
-
children: /* @__PURE__ */ (0,
|
|
1530
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2091
1531
|
"button",
|
|
2092
1532
|
{
|
|
2093
|
-
className:
|
|
1533
|
+
className: cx("actionSubmit"),
|
|
2094
1534
|
type: "submit",
|
|
2095
1535
|
disabled: isLoading,
|
|
2096
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
1536
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 18, label: loadingLabel }) : cta ?? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowUp, { size: 24 })
|
|
2097
1537
|
}
|
|
2098
1538
|
)
|
|
2099
1539
|
}
|
|
@@ -2112,21 +1552,21 @@ function PromptForm({
|
|
|
2112
1552
|
|
|
2113
1553
|
// src/lib/context.ts
|
|
2114
1554
|
init_react_import();
|
|
2115
|
-
var
|
|
2116
|
-
var toolStatusContext = (0,
|
|
1555
|
+
var import_react9 = require("react");
|
|
1556
|
+
var toolStatusContext = (0, import_react9.createContext)({});
|
|
2117
1557
|
var ToolStatusProvider = toolStatusContext.Provider;
|
|
2118
|
-
var hostContext = (0,
|
|
1558
|
+
var hostContext = (0, import_react9.createContext)(void 0);
|
|
2119
1559
|
var HostProvider = hostContext.Provider;
|
|
2120
|
-
var subagentStateContext = (0,
|
|
1560
|
+
var subagentStateContext = (0, import_react9.createContext)({});
|
|
2121
1561
|
var SubagentStateProvider = subagentStateContext.Provider;
|
|
2122
1562
|
|
|
2123
1563
|
// src/lib/use-attachment-url.ts
|
|
2124
1564
|
init_react_import();
|
|
2125
|
-
var
|
|
1565
|
+
var import_react10 = require("react");
|
|
2126
1566
|
function useAttachmentUrl(url, endpoint) {
|
|
2127
1567
|
const isRef = getAttachmentIdFromRef(url) !== null;
|
|
2128
|
-
const [fetched, setFetched] = (0,
|
|
2129
|
-
(0,
|
|
1568
|
+
const [fetched, setFetched] = (0, import_react10.useState)();
|
|
1569
|
+
(0, import_react10.useEffect)(() => {
|
|
2130
1570
|
if (!isRef) return;
|
|
2131
1571
|
const controller = new AbortController();
|
|
2132
1572
|
const loadUrl = async () => {
|
|
@@ -2150,9 +1590,9 @@ function useAttachmentUrl(url, endpoint) {
|
|
|
2150
1590
|
}
|
|
2151
1591
|
|
|
2152
1592
|
// src/components/ChatBody/index.tsx
|
|
2153
|
-
var
|
|
2154
|
-
var
|
|
2155
|
-
var cxMessage =
|
|
1593
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1594
|
+
var cx2 = getClassNameFactory("Chat", styles_module_default3);
|
|
1595
|
+
var cxMessage = getClassNameFactory("ChatMessage", styles_module_default3);
|
|
2156
1596
|
function ChatBody({
|
|
2157
1597
|
actions,
|
|
2158
1598
|
attachments,
|
|
@@ -2171,49 +1611,55 @@ function ChatBody({
|
|
|
2171
1611
|
onDismissUserError
|
|
2172
1612
|
}) {
|
|
2173
1613
|
const { scrollRef, contentRef } = (0, import_use_stick_to_bottom.useStickToBottom)();
|
|
1614
|
+
const loadingLabel = useMessage("loader-loading");
|
|
1615
|
+
const thinkingLabel = useMessage("plugin-ai-chat-msg-thinking");
|
|
1616
|
+
const errorLabel = useMessage("plugin-ai-chat-error");
|
|
1617
|
+
const retryLabel = useMessage("plugin-ai-chat-error-retry");
|
|
1618
|
+
const dismissLabel = useMessage("plugin-ai-prompt-error-dismiss");
|
|
1619
|
+
const promptPlaceholder = useMessage("plugin-ai-prompt-placeholder");
|
|
2174
1620
|
const hasMessages = messages && messages.length > 0;
|
|
2175
1621
|
const lastMessage = hasMessages ? messages[messages.length - 1] : null;
|
|
2176
1622
|
const lastPart = lastMessage ? lastMessage.parts[lastMessage.parts.length - 1] : null;
|
|
2177
1623
|
const isLoading = status === "submitted" || status === "streaming" && !lastPart;
|
|
2178
|
-
return /* @__PURE__ */ (0,
|
|
1624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2179
1625
|
"div",
|
|
2180
1626
|
{
|
|
2181
|
-
className:
|
|
1627
|
+
className: cx2({
|
|
2182
1628
|
hasMessages,
|
|
2183
1629
|
hasChildren: !!children,
|
|
2184
1630
|
hideInput,
|
|
2185
1631
|
isLoading
|
|
2186
1632
|
}),
|
|
2187
1633
|
children: [
|
|
2188
|
-
children ? /* @__PURE__ */ (0,
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2190
|
-
/* @__PURE__ */ (0,
|
|
2191
|
-
/* @__PURE__ */ (0,
|
|
2192
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2193
|
-
/* @__PURE__ */ (0,
|
|
2194
|
-
/* @__PURE__ */ (0,
|
|
1634
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("default"), children }) : null,
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("inner"), children: [
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("body"), ref: scrollRef, children: [
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("messages"), ref: contentRef, children: messages.toReversed().filter((message) => !shouldHideMessage(message)).map((message) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChatMessage, { message }, message.id)) }),
|
|
1638
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("loader"), children: [
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("loaderIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loader, { size: 16, label: loadingLabel }) }),
|
|
1640
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: thinkingLabel })
|
|
2195
1641
|
] })
|
|
2196
1642
|
] }),
|
|
2197
|
-
error && /* @__PURE__ */ (0,
|
|
2198
|
-
/* @__PURE__ */ (0,
|
|
2199
|
-
handleRetry && /* @__PURE__ */ (0,
|
|
1643
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("error"), children: [
|
|
1644
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("errorLabel"), children: errorLabel }),
|
|
1645
|
+
handleRetry && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("errorAction"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconButton, { title: retryLabel, onClick: handleRetry, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RotateCcw, { size: "14" }) }) })
|
|
2200
1646
|
] }),
|
|
2201
|
-
userError && /* @__PURE__ */ (0,
|
|
2202
|
-
/* @__PURE__ */ (0,
|
|
2203
|
-
onDismissUserError && /* @__PURE__ */ (0,
|
|
1647
|
+
userError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("userError"), children: [
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: userError }),
|
|
1649
|
+
onDismissUserError && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2204
1650
|
"button",
|
|
2205
1651
|
{
|
|
2206
|
-
"aria-label":
|
|
2207
|
-
title:
|
|
2208
|
-
className:
|
|
1652
|
+
"aria-label": dismissLabel,
|
|
1653
|
+
title: dismissLabel,
|
|
1654
|
+
className: cx2("userErrorDismiss"),
|
|
2209
1655
|
onClick: onDismissUserError,
|
|
2210
1656
|
type: "button",
|
|
2211
|
-
children: /* @__PURE__ */ (0,
|
|
1657
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(X, { size: 14 })
|
|
2212
1658
|
}
|
|
2213
1659
|
)
|
|
2214
1660
|
] }),
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
1661
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("form"), children: [
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2217
1663
|
PromptForm,
|
|
2218
1664
|
{
|
|
2219
1665
|
actions,
|
|
@@ -2224,10 +1670,10 @@ function ChatBody({
|
|
|
2224
1670
|
handleSubmit,
|
|
2225
1671
|
inputRef,
|
|
2226
1672
|
isLoading: status === "submitted" || status === "streaming",
|
|
2227
|
-
placeholder:
|
|
1673
|
+
placeholder: promptPlaceholder
|
|
2228
1674
|
}
|
|
2229
1675
|
),
|
|
2230
|
-
examplePrompts ? /* @__PURE__ */ (0,
|
|
1676
|
+
examplePrompts ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("examplePrompts"), children: examplePrompts }) : null
|
|
2231
1677
|
] })
|
|
2232
1678
|
] })
|
|
2233
1679
|
]
|
|
@@ -2252,17 +1698,17 @@ function mergeReasoningParts(parts) {
|
|
|
2252
1698
|
}
|
|
2253
1699
|
function ChatMessage({ message }) {
|
|
2254
1700
|
const { role, parts: rawParts } = message;
|
|
2255
|
-
const parts = (0,
|
|
1701
|
+
const parts = (0, import_react11.useMemo)(() => mergeReasoningParts(rawParts), [rawParts]);
|
|
2256
1702
|
if (role === "user") {
|
|
2257
1703
|
const attachmentParts = parts.filter((part) => part.type === "file");
|
|
2258
1704
|
const otherParts = parts.filter((part) => part.type !== "file");
|
|
2259
|
-
return /* @__PURE__ */ (0,
|
|
1705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2260
1706
|
"div",
|
|
2261
1707
|
{
|
|
2262
1708
|
className: cxMessage({ userRole: true }),
|
|
2263
1709
|
"data-message-id": message.id,
|
|
2264
|
-
children: /* @__PURE__ */ (0,
|
|
2265
|
-
otherParts.map((part, i) => /* @__PURE__ */ (0,
|
|
1710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cxMessage("userBubble"), children: [
|
|
1711
|
+
otherParts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2266
1712
|
ChatMessagePart,
|
|
2267
1713
|
{
|
|
2268
1714
|
part,
|
|
@@ -2270,7 +1716,7 @@ function ChatMessage({ message }) {
|
|
|
2270
1716
|
},
|
|
2271
1717
|
`${message.id}-${part.type}-${i}`
|
|
2272
1718
|
)),
|
|
2273
|
-
attachmentParts.length > 0 ? /* @__PURE__ */ (0,
|
|
1719
|
+
attachmentParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("userAttachments"), children: attachmentParts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2274
1720
|
ChatAttachmentThumbnail,
|
|
2275
1721
|
{
|
|
2276
1722
|
filename: part.filename,
|
|
@@ -2283,12 +1729,12 @@ function ChatMessage({ message }) {
|
|
|
2283
1729
|
}
|
|
2284
1730
|
);
|
|
2285
1731
|
}
|
|
2286
|
-
return /* @__PURE__ */ (0,
|
|
1732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2287
1733
|
"div",
|
|
2288
1734
|
{
|
|
2289
1735
|
className: cxMessage({ [`${role}Role`]: true }),
|
|
2290
1736
|
"data-message-id": message.id,
|
|
2291
|
-
children: parts.map((part, i) => /* @__PURE__ */ (0,
|
|
1737
|
+
children: parts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2292
1738
|
ChatMessagePart,
|
|
2293
1739
|
{
|
|
2294
1740
|
part,
|
|
@@ -2304,13 +1750,14 @@ function ChatAttachmentThumbnail({
|
|
|
2304
1750
|
mediaType,
|
|
2305
1751
|
url
|
|
2306
1752
|
}) {
|
|
2307
|
-
const host = (0,
|
|
1753
|
+
const host = (0, import_react11.useContext)(hostContext);
|
|
2308
1754
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2309
1755
|
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2310
1756
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2311
|
-
const
|
|
1757
|
+
const fallbackLabel = useMessage("plugin-ai-chat-msg-attachment");
|
|
1758
|
+
const label = filename || attachmentId || fallbackLabel;
|
|
2312
1759
|
const isImage = mediaType.startsWith("image/");
|
|
2313
|
-
return /* @__PURE__ */ (0,
|
|
1760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2314
1761
|
"a",
|
|
2315
1762
|
{
|
|
2316
1763
|
"aria-label": label,
|
|
@@ -2320,8 +1767,8 @@ function ChatAttachmentThumbnail({
|
|
|
2320
1767
|
target: "_blank",
|
|
2321
1768
|
title: label,
|
|
2322
1769
|
children: [
|
|
2323
|
-
isImage ? resolvedUrl && /* @__PURE__ */ (0,
|
|
2324
|
-
/* @__PURE__ */ (0,
|
|
1770
|
+
isImage ? resolvedUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { alt: label, src: resolvedUrl }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FileText, { size: 20 }),
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: cxMessage("thumbnailLabel"), children: label })
|
|
2325
1772
|
]
|
|
2326
1773
|
}
|
|
2327
1774
|
);
|
|
@@ -2336,24 +1783,25 @@ function ChatMessageWrapper({
|
|
|
2336
1783
|
role
|
|
2337
1784
|
}) {
|
|
2338
1785
|
if (role === "assistant" || role === "user") {
|
|
2339
|
-
return /* @__PURE__ */ (0,
|
|
1786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_markdown.default, { children });
|
|
2340
1787
|
}
|
|
2341
|
-
return /* @__PURE__ */ (0,
|
|
1788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children });
|
|
2342
1789
|
}
|
|
2343
1790
|
function ReasoningBlock({ part }) {
|
|
2344
|
-
const startTimeRef = (0,
|
|
2345
|
-
const [durationSecs, setDurationSecs] = (0,
|
|
1791
|
+
const startTimeRef = (0, import_react11.useRef)(null);
|
|
1792
|
+
const [durationSecs, setDurationSecs] = (0, import_react11.useState)(null);
|
|
2346
1793
|
if (part.state !== "done" && startTimeRef.current === null) {
|
|
2347
1794
|
startTimeRef.current = Date.now();
|
|
2348
1795
|
}
|
|
2349
|
-
(0,
|
|
1796
|
+
(0, import_react11.useEffect)(() => {
|
|
2350
1797
|
if (part.state === "done" && startTimeRef.current !== null) {
|
|
2351
1798
|
setDurationSecs(Math.round((Date.now() - startTimeRef.current) / 1e3));
|
|
2352
1799
|
}
|
|
2353
1800
|
}, [part.state]);
|
|
2354
1801
|
const loading = part.state ? part.state !== "done" : false;
|
|
2355
|
-
const
|
|
2356
|
-
|
|
1802
|
+
const labelKey = durationSecs !== null ? "plugin-ai-chat-msg-thought-for" : !loading ? "plugin-ai-chat-msg-thought" : "plugin-ai-chat-msg-thinking";
|
|
1803
|
+
const label = useMessage(labelKey, { seconds: durationSecs ?? 0 });
|
|
1804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2357
1805
|
ChatEvent,
|
|
2358
1806
|
{
|
|
2359
1807
|
status: {
|
|
@@ -2361,7 +1809,7 @@ function ReasoningBlock({ part }) {
|
|
|
2361
1809
|
loading,
|
|
2362
1810
|
summary: part.text
|
|
2363
1811
|
},
|
|
2364
|
-
icon: /* @__PURE__ */ (0,
|
|
1812
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Brain, { size: 18 })
|
|
2365
1813
|
}
|
|
2366
1814
|
);
|
|
2367
1815
|
}
|
|
@@ -2370,19 +1818,19 @@ function ChatMessagePart({
|
|
|
2370
1818
|
role
|
|
2371
1819
|
}) {
|
|
2372
1820
|
if (part.type === "text") {
|
|
2373
|
-
return /* @__PURE__ */ (0,
|
|
1821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChatMessageWrapper, { role, children: part.text }) });
|
|
2374
1822
|
}
|
|
2375
1823
|
if (part.type === "reasoning") {
|
|
2376
|
-
return /* @__PURE__ */ (0,
|
|
1824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReasoningBlock, { part });
|
|
2377
1825
|
}
|
|
2378
1826
|
if (part.type === "tool-subagent") {
|
|
2379
|
-
return /* @__PURE__ */ (0,
|
|
1827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SubagentBlock, { toolCallId: part.toolCallId });
|
|
2380
1828
|
}
|
|
2381
1829
|
if (part.type.startsWith("tool-")) {
|
|
2382
|
-
return /* @__PURE__ */ (0,
|
|
1830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PuckTool, { ...part });
|
|
2383
1831
|
}
|
|
2384
1832
|
if (part.type === "file") {
|
|
2385
|
-
return /* @__PURE__ */ (0,
|
|
1833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2386
1834
|
ChatAttachment,
|
|
2387
1835
|
{
|
|
2388
1836
|
filename: part.filename,
|
|
@@ -2398,87 +1846,87 @@ function ChatAttachment({
|
|
|
2398
1846
|
mediaType,
|
|
2399
1847
|
url
|
|
2400
1848
|
}) {
|
|
2401
|
-
const host = (0,
|
|
1849
|
+
const host = (0, import_react11.useContext)(hostContext);
|
|
2402
1850
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2403
1851
|
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2404
1852
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2405
|
-
const
|
|
1853
|
+
const fallbackLabel = useMessage("plugin-ai-chat-msg-attachment");
|
|
1854
|
+
const label = filename || attachmentId || fallbackLabel;
|
|
2406
1855
|
if (mediaType.startsWith("image/")) {
|
|
2407
|
-
return /* @__PURE__ */ (0,
|
|
1856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("attachmentImage"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: resolvedUrl, target: "_blank", rel: "noreferrer", children: resolvedUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { alt: label, src: resolvedUrl }) }) });
|
|
2408
1857
|
}
|
|
2409
|
-
return /* @__PURE__ */ (0,
|
|
2410
|
-
/* @__PURE__ */ (0,
|
|
2411
|
-
/* @__PURE__ */ (0,
|
|
1858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("attachmentFile"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("a", { href: resolvedUrl, target: "_blank", rel: "noreferrer", children: [
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FileText, { size: 16 }),
|
|
1860
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
|
|
2412
1861
|
] }) });
|
|
2413
1862
|
}
|
|
2414
|
-
function PuckTool({
|
|
2415
|
-
toolCallId
|
|
2416
|
-
|
|
2417
|
-
defaultLabel = "Thinking...",
|
|
2418
|
-
type
|
|
2419
|
-
}) {
|
|
2420
|
-
const toolStatus = (0, import_react21.useContext)(toolStatusContext)[toolCallId];
|
|
1863
|
+
function PuckTool({ toolCallId, output, type }) {
|
|
1864
|
+
const toolStatus = (0, import_react11.useContext)(toolStatusContext)[toolCallId];
|
|
1865
|
+
const thinkingLabel = useMessage("plugin-ai-chat-msg-thinking");
|
|
2421
1866
|
const outputObj = output;
|
|
2422
|
-
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus ?? {
|
|
2423
|
-
|
|
1867
|
+
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus ?? {
|
|
1868
|
+
loading: true,
|
|
1869
|
+
label: thinkingLabel
|
|
1870
|
+
};
|
|
1871
|
+
let icon = (0, import_react11.useMemo)(() => {
|
|
2424
1872
|
if (type === "tool-write") {
|
|
2425
|
-
return /* @__PURE__ */ (0,
|
|
1873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pen, { size: 18 });
|
|
2426
1874
|
} else if (type === "tool-refreshPageData") {
|
|
2427
|
-
return /* @__PURE__ */ (0,
|
|
1875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GitPullRequest, { size: 18 });
|
|
2428
1876
|
} else if (type === "tool-takeScreenshot") {
|
|
2429
|
-
return /* @__PURE__ */ (0,
|
|
1877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Camera, { size: 18 });
|
|
2430
1878
|
} else if (type === "tool-fetchUrl") {
|
|
2431
|
-
return /* @__PURE__ */ (0,
|
|
1879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CloudDownload, { size: 18 });
|
|
2432
1880
|
} else if (type === "tool-screenshotUrl") {
|
|
2433
|
-
return /* @__PURE__ */ (0,
|
|
1881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Camera, { size: 18 });
|
|
2434
1882
|
}
|
|
2435
|
-
return /* @__PURE__ */ (0,
|
|
1883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Check, { size: 18 });
|
|
2436
1884
|
}, [type]);
|
|
2437
|
-
return /* @__PURE__ */ (0,
|
|
1885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChatEvent, { status, icon });
|
|
2438
1886
|
}
|
|
2439
1887
|
function SubagentBlock({ toolCallId }) {
|
|
2440
|
-
const subagentState = (0,
|
|
1888
|
+
const subagentState = (0, import_react11.useContext)(subagentStateContext);
|
|
2441
1889
|
const state = subagentState[toolCallId];
|
|
2442
|
-
const toolStatusMap = (0,
|
|
1890
|
+
const toolStatusMap = (0, import_react11.useContext)(toolStatusContext);
|
|
1891
|
+
const loadingLabel = useMessage("loader-loading");
|
|
2443
1892
|
const toolStatus = toolStatusMap[toolCallId];
|
|
2444
1893
|
const fallbackLabel = toolStatus?.label ?? "Running subagent";
|
|
2445
1894
|
const label = state?.label ? state.state === "done" ? `${state.agentType} subagent complete` : state.label : fallbackLabel;
|
|
2446
1895
|
const loading = state ? state.state !== "done" : toolStatus?.loading ?? true;
|
|
2447
1896
|
const hasBody = !!state && state.parts.length > 0;
|
|
2448
1897
|
const parts = state?.parts ?? [];
|
|
2449
|
-
const [isOpen, setIsOpen] = (0,
|
|
2450
|
-
return /* @__PURE__ */ (0,
|
|
1898
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
1899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2451
1900
|
"details",
|
|
2452
1901
|
{
|
|
2453
1902
|
className: cxMessage("event"),
|
|
2454
1903
|
onToggle: (e) => setIsOpen(e.currentTarget.open),
|
|
2455
1904
|
children: [
|
|
2456
|
-
/* @__PURE__ */ (0,
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2457
1906
|
"summary",
|
|
2458
1907
|
{
|
|
2459
|
-
className: cxMessage("eventHeader")
|
|
2460
|
-
style: hasBody ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
1908
|
+
className: `${cxMessage("eventHeader")} ${hasBody ? "" : cxMessage("eventHeader--static")}`,
|
|
2461
1909
|
children: [
|
|
2462
|
-
/* @__PURE__ */ (0,
|
|
2463
|
-
/* @__PURE__ */ (0,
|
|
2464
|
-
hasBody && /* @__PURE__ */ (0,
|
|
2465
|
-
/* @__PURE__ */ (0,
|
|
2466
|
-
/* @__PURE__ */ (0,
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventIcon"), children: loading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loader, { size: 16, label: loadingLabel }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Bot, { size: 18 }) }),
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventLabel"), children: label }),
|
|
1912
|
+
hasBody && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Plus, { size: 12 }) }),
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Minus, { size: 12 }) })
|
|
2467
1915
|
] })
|
|
2468
1916
|
]
|
|
2469
1917
|
}
|
|
2470
1918
|
),
|
|
2471
|
-
hasBody && isOpen && /* @__PURE__ */ (0,
|
|
1919
|
+
hasBody && isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventBody"), children: parts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SubagentChildPartRenderer, { part }, `${toolCallId}-${i}`)) })
|
|
2472
1920
|
]
|
|
2473
1921
|
}
|
|
2474
1922
|
);
|
|
2475
1923
|
}
|
|
2476
1924
|
function SubagentChildPartRenderer({ part }) {
|
|
2477
1925
|
if (part.kind === "text") {
|
|
2478
|
-
return /* @__PURE__ */ (0,
|
|
1926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_markdown.default, { children: part.text }) });
|
|
2479
1927
|
}
|
|
2480
1928
|
if (part.kind === "reasoning") {
|
|
2481
|
-
return /* @__PURE__ */ (0,
|
|
1929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2482
1930
|
ReasoningBlock,
|
|
2483
1931
|
{
|
|
2484
1932
|
part: {
|
|
@@ -2490,7 +1938,7 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2490
1938
|
);
|
|
2491
1939
|
}
|
|
2492
1940
|
if (part.toolName === "subagent") {
|
|
2493
|
-
return /* @__PURE__ */ (0,
|
|
1941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SubagentBlock, { toolCallId: part.childToolCallId });
|
|
2494
1942
|
}
|
|
2495
1943
|
const synthesized = {
|
|
2496
1944
|
toolCallId: part.childToolCallId,
|
|
@@ -2499,35 +1947,35 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2499
1947
|
input: part.input,
|
|
2500
1948
|
output: part.output
|
|
2501
1949
|
};
|
|
2502
|
-
return /* @__PURE__ */ (0,
|
|
1950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PuckTool, { ...synthesized });
|
|
2503
1951
|
}
|
|
2504
1952
|
function ChatEvent({
|
|
2505
1953
|
status,
|
|
2506
|
-
icon = /* @__PURE__ */ (0,
|
|
1954
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Check, { size: 18 })
|
|
2507
1955
|
}) {
|
|
2508
|
-
const [isOpen, setIsOpen] = (0,
|
|
2509
|
-
|
|
1956
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
1957
|
+
const loadingLabel = useMessage("loader-loading");
|
|
1958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2510
1959
|
"details",
|
|
2511
1960
|
{
|
|
2512
1961
|
className: cxMessage("event"),
|
|
2513
1962
|
onToggle: (e) => setIsOpen(e.currentTarget.open),
|
|
2514
1963
|
children: [
|
|
2515
|
-
/* @__PURE__ */ (0,
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2516
1965
|
"summary",
|
|
2517
1966
|
{
|
|
2518
|
-
className: cxMessage("eventHeader")
|
|
2519
|
-
style: status.summary ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
1967
|
+
className: `${cxMessage("eventHeader")} ${status.summary ? "" : cxMessage("eventHeader--static")}`,
|
|
2520
1968
|
children: [
|
|
2521
|
-
/* @__PURE__ */ (0,
|
|
2522
|
-
/* @__PURE__ */ (0,
|
|
2523
|
-
status.summary && /* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2525
|
-
/* @__PURE__ */ (0,
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventIcon"), children: status.error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TriangleAlert, { size: 18 }) : status.loading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loader, { size: 16, label: loadingLabel }) : icon }),
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: status.label }),
|
|
1971
|
+
status.summary && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Plus, { size: 12 }) }),
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Minus, { size: 12 }) })
|
|
2526
1974
|
] })
|
|
2527
1975
|
]
|
|
2528
1976
|
}
|
|
2529
1977
|
),
|
|
2530
|
-
status.summary && isOpen && /* @__PURE__ */ (0,
|
|
1978
|
+
status.summary && isOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventBody"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_markdown.default, { children: status.summary }) })
|
|
2531
1979
|
]
|
|
2532
1980
|
}
|
|
2533
1981
|
);
|
|
@@ -2538,15 +1986,15 @@ function ExamplePrompt({
|
|
|
2538
1986
|
onClick,
|
|
2539
1987
|
disabled
|
|
2540
1988
|
}) {
|
|
2541
|
-
const content = /* @__PURE__ */ (0,
|
|
2542
|
-
/* @__PURE__ */ (0,
|
|
2543
|
-
/* @__PURE__ */ (0,
|
|
1989
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1990
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: label }),
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("examplePromptArrow"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ArrowUp, { size: "16" }) })
|
|
2544
1992
|
] });
|
|
2545
1993
|
if (href) {
|
|
2546
|
-
return /* @__PURE__ */ (0,
|
|
1994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2547
1995
|
"a",
|
|
2548
1996
|
{
|
|
2549
|
-
className:
|
|
1997
|
+
className: cx2("examplePrompt"),
|
|
2550
1998
|
href: disabled ? void 0 : href,
|
|
2551
1999
|
"aria-disabled": disabled || void 0,
|
|
2552
2000
|
onClick: (e) => {
|
|
@@ -2560,10 +2008,10 @@ function ExamplePrompt({
|
|
|
2560
2008
|
}
|
|
2561
2009
|
);
|
|
2562
2010
|
}
|
|
2563
|
-
return /* @__PURE__ */ (0,
|
|
2011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2564
2012
|
"button",
|
|
2565
2013
|
{
|
|
2566
|
-
className:
|
|
2014
|
+
className: cx2("examplePrompt"),
|
|
2567
2015
|
type: "button",
|
|
2568
2016
|
disabled,
|
|
2569
2017
|
onClick,
|
|
@@ -2597,27 +2045,30 @@ init_react_import();
|
|
|
2597
2045
|
|
|
2598
2046
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/DesignModeToggle/styles.module.css#css-module
|
|
2599
2047
|
init_react_import();
|
|
2600
|
-
var
|
|
2048
|
+
var styles_module_default5 = { "DesignModeToggle": "_DesignModeToggle_vng7q_1", "DesignModeToggle-button": "_DesignModeToggle-button_vng7q_8", "DesignModeToggle-button--active": "_DesignModeToggle-button--active_vng7q_32" };
|
|
2601
2049
|
|
|
2602
2050
|
// src/components/DesignModeToggle/index.tsx
|
|
2603
|
-
var
|
|
2604
|
-
var
|
|
2051
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2052
|
+
var cx3 = getClassNameFactory("DesignModeToggle", styles_module_default5);
|
|
2605
2053
|
function DesignModeToggle({
|
|
2606
2054
|
active,
|
|
2607
2055
|
onToggle,
|
|
2608
2056
|
disabled
|
|
2609
2057
|
}) {
|
|
2610
|
-
|
|
2058
|
+
const label = useMessage("plugin-ai-prompt-design-mode");
|
|
2059
|
+
const enableTitle = useMessage("plugin-ai-prompt-design-mode-enable");
|
|
2060
|
+
const disableTitle = useMessage("plugin-ai-prompt-design-mode-disable");
|
|
2061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cx3(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2611
2062
|
"button",
|
|
2612
2063
|
{
|
|
2613
|
-
className: `${
|
|
2064
|
+
className: `${cx3("button")} ${active ? cx3("button--active") : ""}`,
|
|
2614
2065
|
onClick: onToggle,
|
|
2615
2066
|
disabled,
|
|
2616
2067
|
type: "button",
|
|
2617
|
-
title: active ?
|
|
2068
|
+
title: active ? disableTitle : enableTitle,
|
|
2618
2069
|
children: [
|
|
2619
|
-
/* @__PURE__ */ (0,
|
|
2620
|
-
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WandSparkles, { size: 12 }),
|
|
2071
|
+
label
|
|
2621
2072
|
]
|
|
2622
2073
|
}
|
|
2623
2074
|
) });
|
|
@@ -2630,7 +2081,7 @@ var import_core4 = require("@puckeditor/core");
|
|
|
2630
2081
|
// src/lib/design/component.tsx
|
|
2631
2082
|
init_react_import();
|
|
2632
2083
|
var import_core3 = require("@puckeditor/core");
|
|
2633
|
-
var
|
|
2084
|
+
var import_react14 = require("react");
|
|
2634
2085
|
|
|
2635
2086
|
// src/lib/morph-html.ts
|
|
2636
2087
|
init_react_import();
|
|
@@ -3743,7 +3194,7 @@ var wireArrayItemEditing = ({
|
|
|
3743
3194
|
// src/lib/design/render-html.tsx
|
|
3744
3195
|
init_react_import();
|
|
3745
3196
|
var import_htmlparser22 = require("htmlparser2");
|
|
3746
|
-
var
|
|
3197
|
+
var import_react12 = require("react");
|
|
3747
3198
|
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3748
3199
|
"area",
|
|
3749
3200
|
"base",
|
|
@@ -3806,7 +3257,7 @@ var nodeToReact = (node, slots, key) => {
|
|
|
3806
3257
|
if (isEventHandlerAttr2(name)) continue;
|
|
3807
3258
|
props2[REACT_PROP_NAMES[name] || name] = value;
|
|
3808
3259
|
}
|
|
3809
|
-
return (0,
|
|
3260
|
+
return (0, import_react12.createElement)(tag, props2, slots[slotName]);
|
|
3810
3261
|
}
|
|
3811
3262
|
const props = { key };
|
|
3812
3263
|
for (const [name, value] of Object.entries(attribs)) {
|
|
@@ -3818,10 +3269,10 @@ var nodeToReact = (node, slots, key) => {
|
|
|
3818
3269
|
}
|
|
3819
3270
|
}
|
|
3820
3271
|
if (VOID_ELEMENTS.has(tag)) {
|
|
3821
|
-
return (0,
|
|
3272
|
+
return (0, import_react12.createElement)(tag, props);
|
|
3822
3273
|
}
|
|
3823
3274
|
const children = el.children.map((child, i) => nodeToReact(child, slots, i)).filter((c) => c !== null);
|
|
3824
|
-
return (0,
|
|
3275
|
+
return (0, import_react12.createElement)(tag, props, ...children);
|
|
3825
3276
|
};
|
|
3826
3277
|
var htmlToReactTree = (html, slots) => {
|
|
3827
3278
|
if (!html) return null;
|
|
@@ -3829,14 +3280,14 @@ var htmlToReactTree = (html, slots) => {
|
|
|
3829
3280
|
const children = doc.children.map((child, i) => nodeToReact(child, slots, i)).filter((c) => c !== null);
|
|
3830
3281
|
if (children.length === 0) return null;
|
|
3831
3282
|
if (children.length === 1) return children[0];
|
|
3832
|
-
return (0,
|
|
3283
|
+
return (0, import_react12.createElement)(import_react12.Fragment, null, ...children);
|
|
3833
3284
|
};
|
|
3834
3285
|
|
|
3835
3286
|
// src/lib/design/slot-portal.tsx
|
|
3836
3287
|
init_react_import();
|
|
3837
|
-
var
|
|
3288
|
+
var import_react13 = require("react");
|
|
3838
3289
|
var import_react_dom = require("react-dom");
|
|
3839
|
-
var
|
|
3290
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3840
3291
|
var parseInlineStyle = (cssText) => {
|
|
3841
3292
|
const style = {};
|
|
3842
3293
|
for (const declaration of cssText.split(";")) {
|
|
@@ -3858,13 +3309,13 @@ var SlotPortal = ({
|
|
|
3858
3309
|
slotClassName,
|
|
3859
3310
|
SlotContent
|
|
3860
3311
|
}) => {
|
|
3861
|
-
const [target, setTarget] = (0,
|
|
3862
|
-
const lastTarget = (0,
|
|
3863
|
-
const style = (0,
|
|
3312
|
+
const [target, setTarget] = (0, import_react13.useState)(null);
|
|
3313
|
+
const lastTarget = (0, import_react13.useRef)(null);
|
|
3314
|
+
const style = (0, import_react13.useMemo)(
|
|
3864
3315
|
() => slotStyle ? parseInlineStyle(slotStyle) : void 0,
|
|
3865
3316
|
[slotStyle]
|
|
3866
3317
|
);
|
|
3867
|
-
(0,
|
|
3318
|
+
(0, import_react13.useEffect)(() => {
|
|
3868
3319
|
const el = entry.querySelector(`[data-puck-slot="${cssEscape(slotName)}"]`);
|
|
3869
3320
|
if (el !== lastTarget.current) {
|
|
3870
3321
|
el?.replaceChildren();
|
|
@@ -3878,13 +3329,13 @@ var SlotPortal = ({
|
|
|
3878
3329
|
}, [entry, html, slotName]);
|
|
3879
3330
|
if (!target || typeof SlotContent !== "function") return null;
|
|
3880
3331
|
return (0, import_react_dom.createPortal)(
|
|
3881
|
-
/* @__PURE__ */ (0,
|
|
3332
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SlotContent, { style, className: slotClassName || void 0 }),
|
|
3882
3333
|
target
|
|
3883
3334
|
);
|
|
3884
3335
|
};
|
|
3885
3336
|
|
|
3886
3337
|
// src/lib/design/component.tsx
|
|
3887
|
-
var
|
|
3338
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3888
3339
|
var DESIGN_COMPONENT = Symbol("puck-ai.designComponent");
|
|
3889
3340
|
var isDesignComponent = (config) => !!config?.[DESIGN_COMPONENT];
|
|
3890
3341
|
var streamingValues = /* @__PURE__ */ new Map();
|
|
@@ -3970,13 +3421,13 @@ function createDesignComponentConfig(registration) {
|
|
|
3970
3421
|
}
|
|
3971
3422
|
return resolvedFields;
|
|
3972
3423
|
},
|
|
3973
|
-
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ (0,
|
|
3424
|
+
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EditorEntry, { ...renderProps }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Entry, { ...renderProps, getPuck: null })
|
|
3974
3425
|
};
|
|
3975
3426
|
componentConfig[DESIGN_COMPONENT] = true;
|
|
3976
3427
|
return componentConfig;
|
|
3977
3428
|
function EditorEntry(renderProps) {
|
|
3978
3429
|
const getPuck = (0, import_core3.useGetPuck)();
|
|
3979
|
-
return /* @__PURE__ */ (0,
|
|
3430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Entry, { ...renderProps, getPuck });
|
|
3980
3431
|
}
|
|
3981
3432
|
function Entry({
|
|
3982
3433
|
getPuck,
|
|
@@ -3985,11 +3436,11 @@ function createDesignComponentConfig(registration) {
|
|
|
3985
3436
|
style,
|
|
3986
3437
|
...props
|
|
3987
3438
|
}) {
|
|
3988
|
-
const getSnapshot = (0,
|
|
3439
|
+
const getSnapshot = (0, import_react14.useCallback)(
|
|
3989
3440
|
() => registrationStore.get(name) ?? registration,
|
|
3990
3441
|
[]
|
|
3991
3442
|
);
|
|
3992
|
-
const reg = (0,
|
|
3443
|
+
const reg = (0, import_react14.useSyncExternalStore)(
|
|
3993
3444
|
registrationStore.subscribe,
|
|
3994
3445
|
getSnapshot,
|
|
3995
3446
|
getSnapshot
|
|
@@ -3997,10 +3448,10 @@ function createDesignComponentConfig(registration) {
|
|
|
3997
3448
|
const html = reg.html ?? "";
|
|
3998
3449
|
const styles = reg.styles;
|
|
3999
3450
|
const script = reg.script;
|
|
4000
|
-
const [entryEl, setEntryEl] = (0,
|
|
4001
|
-
const scriptRef = (0,
|
|
4002
|
-
const annotations = (0,
|
|
4003
|
-
const { attrFields, arrayFields, attrSig, arraySig } = (0,
|
|
3451
|
+
const [entryEl, setEntryEl] = (0, import_react14.useState)(null);
|
|
3452
|
+
const scriptRef = (0, import_react14.useRef)(null);
|
|
3453
|
+
const annotations = (0, import_react14.useMemo)(() => getAnnotations(html), [html]);
|
|
3454
|
+
const { attrFields, arrayFields, attrSig, arraySig } = (0, import_react14.useMemo)(() => {
|
|
4004
3455
|
const attr = [];
|
|
4005
3456
|
const arrays = [];
|
|
4006
3457
|
for (const field of annotations.fields) {
|
|
@@ -4022,11 +3473,11 @@ function createDesignComponentConfig(registration) {
|
|
|
4022
3473
|
arraySig: JSON.stringify(arrays)
|
|
4023
3474
|
};
|
|
4024
3475
|
}, [props, annotations]);
|
|
4025
|
-
const patchedHtml = (0,
|
|
3476
|
+
const patchedHtml = (0, import_react14.useMemo)(() => {
|
|
4026
3477
|
if (puck.isEditing) return html;
|
|
4027
3478
|
return patchHtmlAnnotations(html, props);
|
|
4028
3479
|
}, [html, props, puck.isEditing]);
|
|
4029
|
-
const fieldValueAttrs = (0,
|
|
3480
|
+
const fieldValueAttrs = (0, import_react14.useMemo)(() => {
|
|
4030
3481
|
const attrs = {};
|
|
4031
3482
|
attrs["data-puck-design"] = name;
|
|
4032
3483
|
for (const field of annotations.fields) {
|
|
@@ -4037,17 +3488,17 @@ function createDesignComponentConfig(registration) {
|
|
|
4037
3488
|
}
|
|
4038
3489
|
return attrs;
|
|
4039
3490
|
}, [annotations, props, puck.isEditing]);
|
|
4040
|
-
const editorEntryNode = (0,
|
|
4041
|
-
() => puck.isEditing ? /* @__PURE__ */ (0,
|
|
3491
|
+
const editorEntryNode = (0, import_react14.useMemo)(
|
|
3492
|
+
() => puck.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: setEntryEl }) : null,
|
|
4042
3493
|
[puck.isEditing]
|
|
4043
3494
|
);
|
|
4044
|
-
(0,
|
|
3495
|
+
(0, import_react14.useEffect)(() => {
|
|
4045
3496
|
if (!puck.isEditing || !getPuck) return;
|
|
4046
3497
|
getPuck().resolveDataById(id, "force");
|
|
4047
3498
|
}, [reg, puck.isEditing, getPuck, id]);
|
|
4048
|
-
const fieldWiring = (0,
|
|
4049
|
-
const morphed = (0,
|
|
4050
|
-
(0,
|
|
3499
|
+
const fieldWiring = (0, import_react14.useRef)(/* @__PURE__ */ new Map());
|
|
3500
|
+
const morphed = (0, import_react14.useRef)(null);
|
|
3501
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
4051
3502
|
if (!puck.isEditing || !entryEl) return;
|
|
4052
3503
|
if (morphed.current?.el !== entryEl || morphed.current?.html !== html || morphed.current?.attrSig !== attrSig) {
|
|
4053
3504
|
morphed.current = { el: entryEl, html, attrSig };
|
|
@@ -4064,14 +3515,14 @@ function createDesignComponentConfig(registration) {
|
|
|
4064
3515
|
});
|
|
4065
3516
|
}
|
|
4066
3517
|
});
|
|
4067
|
-
(0,
|
|
3518
|
+
(0, import_react14.useEffect)(
|
|
4068
3519
|
() => () => {
|
|
4069
3520
|
fieldWiring.current.forEach((cleanup) => cleanup());
|
|
4070
3521
|
fieldWiring.current.clear();
|
|
4071
3522
|
},
|
|
4072
3523
|
[]
|
|
4073
3524
|
);
|
|
4074
|
-
(0,
|
|
3525
|
+
(0, import_react14.useEffect)(() => {
|
|
4075
3526
|
if (!entryEl || !puck.isEditing) return;
|
|
4076
3527
|
for (const attr of Array.from(entryEl.attributes)) {
|
|
4077
3528
|
if ((attr.name === "data-puck-design" || attr.name.startsWith("data-puck-field-value-")) && !(attr.name in fieldValueAttrs)) {
|
|
@@ -4084,10 +3535,10 @@ function createDesignComponentConfig(registration) {
|
|
|
4084
3535
|
}
|
|
4085
3536
|
}
|
|
4086
3537
|
}, [entryEl, fieldValueAttrs]);
|
|
4087
|
-
const appliedArrayHtml = (0,
|
|
4088
|
-
const arrayItemWiring = (0,
|
|
4089
|
-
const appliedArrays = (0,
|
|
4090
|
-
(0,
|
|
3538
|
+
const appliedArrayHtml = (0, import_react14.useRef)(/* @__PURE__ */ new WeakMap());
|
|
3539
|
+
const arrayItemWiring = (0, import_react14.useRef)({});
|
|
3540
|
+
const appliedArrays = (0, import_react14.useRef)(null);
|
|
3541
|
+
(0, import_react14.useEffect)(() => {
|
|
4091
3542
|
if (!puck.isEditing || !entryEl || !getPuck) return;
|
|
4092
3543
|
if (appliedArrays.current?.el === entryEl && appliedArrays.current?.html === html && appliedArrays.current?.sig === arraySig) {
|
|
4093
3544
|
return;
|
|
@@ -4139,7 +3590,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4139
3590
|
id,
|
|
4140
3591
|
getPuck
|
|
4141
3592
|
]);
|
|
4142
|
-
(0,
|
|
3593
|
+
(0, import_react14.useEffect)(
|
|
4143
3594
|
() => () => {
|
|
4144
3595
|
Object.values(arrayItemWiring.current).forEach(
|
|
4145
3596
|
(wiring) => wiring.forEach(({ cleanup }) => cleanup())
|
|
@@ -4147,7 +3598,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4147
3598
|
},
|
|
4148
3599
|
[]
|
|
4149
3600
|
);
|
|
4150
|
-
(0,
|
|
3601
|
+
(0, import_react14.useEffect)(() => {
|
|
4151
3602
|
if (!script || !entryEl) return;
|
|
4152
3603
|
scriptRef.current?.remove();
|
|
4153
3604
|
const doc = entryEl.ownerDocument;
|
|
@@ -4165,7 +3616,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4165
3616
|
for (const slot of annotations.slots) {
|
|
4166
3617
|
const Slot = props[slot.name];
|
|
4167
3618
|
if (typeof Slot === "function") {
|
|
4168
|
-
slotContent[slot.name] = /* @__PURE__ */ (0,
|
|
3619
|
+
slotContent[slot.name] = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4169
3620
|
Slot,
|
|
4170
3621
|
{
|
|
4171
3622
|
style: slot.style ? parseStyleString(slot.style) : void 0,
|
|
@@ -4174,17 +3625,17 @@ function createDesignComponentConfig(registration) {
|
|
|
4174
3625
|
);
|
|
4175
3626
|
}
|
|
4176
3627
|
}
|
|
4177
|
-
return /* @__PURE__ */ (0,
|
|
4178
|
-
styles && /* @__PURE__ */ (0,
|
|
4179
|
-
style && /* @__PURE__ */ (0,
|
|
4180
|
-
/* @__PURE__ */ (0,
|
|
3628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3629
|
+
styles && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: styles }),
|
|
3630
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: style }),
|
|
3631
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: setEntryEl, ...fieldValueAttrs, children: htmlToReactTree(patchedHtml, slotContent) })
|
|
4181
3632
|
] });
|
|
4182
3633
|
}
|
|
4183
|
-
return /* @__PURE__ */ (0,
|
|
4184
|
-
styles && /* @__PURE__ */ (0,
|
|
4185
|
-
style && /* @__PURE__ */ (0,
|
|
3634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3635
|
+
styles && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: styles }),
|
|
3636
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: style }),
|
|
4186
3637
|
editorEntryNode,
|
|
4187
|
-
entryEl && annotations.slots.map((slot) => /* @__PURE__ */ (0,
|
|
3638
|
+
entryEl && annotations.slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4188
3639
|
SlotPortal,
|
|
4189
3640
|
{
|
|
4190
3641
|
entry: entryEl,
|
|
@@ -4202,8 +3653,8 @@ function createDesignComponentConfig(registration) {
|
|
|
4202
3653
|
|
|
4203
3654
|
// src/lib/design/globals.tsx
|
|
4204
3655
|
init_react_import();
|
|
4205
|
-
var
|
|
4206
|
-
var
|
|
3656
|
+
var import_react15 = require("react");
|
|
3657
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4207
3658
|
function getDynamicConfigGlobals(dynamicConfig) {
|
|
4208
3659
|
if (typeof dynamicConfig !== "object" || dynamicConfig === null) return {};
|
|
4209
3660
|
const { styles, script } = dynamicConfig;
|
|
@@ -4218,9 +3669,9 @@ function DesignGlobals({
|
|
|
4218
3669
|
script,
|
|
4219
3670
|
isEditing
|
|
4220
3671
|
}) {
|
|
4221
|
-
const scriptRef = (0,
|
|
4222
|
-
const hostRef = (0,
|
|
4223
|
-
(0,
|
|
3672
|
+
const scriptRef = (0, import_react15.useRef)(null);
|
|
3673
|
+
const hostRef = (0, import_react15.useRef)(null);
|
|
3674
|
+
(0, import_react15.useEffect)(() => {
|
|
4224
3675
|
if (!script) return;
|
|
4225
3676
|
scriptRef.current?.remove();
|
|
4226
3677
|
const doc = hostRef.current?.ownerDocument ?? document;
|
|
@@ -4233,10 +3684,10 @@ function DesignGlobals({
|
|
|
4233
3684
|
scriptRef.current = null;
|
|
4234
3685
|
};
|
|
4235
3686
|
}, [script]);
|
|
4236
|
-
return /* @__PURE__ */ (0,
|
|
4237
|
-
isEditing && /* @__PURE__ */ (0,
|
|
4238
|
-
styles && /* @__PURE__ */ (0,
|
|
4239
|
-
script && /* @__PURE__ */ (0,
|
|
3687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3688
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: INLINE_EDIT_RESET }),
|
|
3689
|
+
styles && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: styles }),
|
|
3690
|
+
script && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: hostRef, style: { display: "none" } })
|
|
4240
3691
|
] });
|
|
4241
3692
|
}
|
|
4242
3693
|
var WRAPPED = "__puckAiDesignGlobals";
|
|
@@ -4246,8 +3697,8 @@ function withDesignGlobals(root) {
|
|
|
4246
3697
|
const userRender = root?.render;
|
|
4247
3698
|
const render = (props) => {
|
|
4248
3699
|
const { styles, script } = getDynamicConfigGlobals(props._dynamicConfig);
|
|
4249
|
-
return /* @__PURE__ */ (0,
|
|
4250
|
-
/* @__PURE__ */ (0,
|
|
3700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4251
3702
|
DesignGlobals,
|
|
4252
3703
|
{
|
|
4253
3704
|
styles,
|
|
@@ -4269,7 +3720,7 @@ function ensureDesignGlobalsRoot(config) {
|
|
|
4269
3720
|
}
|
|
4270
3721
|
|
|
4271
3722
|
// src/lib/design/runtime.tsx
|
|
4272
|
-
var
|
|
3723
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
4273
3724
|
var cachedFieldMetadata;
|
|
4274
3725
|
function detectFieldMetadata(config) {
|
|
4275
3726
|
for (const comp of Object.values(config.components)) {
|
|
@@ -4308,7 +3759,7 @@ function applyConfigFieldMetadata(config, dynamicComponents) {
|
|
|
4308
3759
|
var DESIGNED_CATEGORY = "dynamic";
|
|
4309
3760
|
var dynamicConfigRootField = {
|
|
4310
3761
|
type: "custom",
|
|
4311
|
-
render: () => /* @__PURE__ */ (0,
|
|
3762
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {}),
|
|
4312
3763
|
ai: {
|
|
4313
3764
|
exclude: true
|
|
4314
3765
|
}
|
|
@@ -4663,17 +4114,53 @@ async function postClientToolResponse(host, body) {
|
|
|
4663
4114
|
}
|
|
4664
4115
|
}
|
|
4665
4116
|
|
|
4117
|
+
// src/lib/to-serializable.ts
|
|
4118
|
+
init_react_import();
|
|
4119
|
+
function toSerializable(value, ancestors = []) {
|
|
4120
|
+
const json = typeof value === "object" && value !== null && "toJSON" in value && typeof value.toJSON === "function" ? value.toJSON() : value;
|
|
4121
|
+
if (typeof json !== "object" || json === null) {
|
|
4122
|
+
return typeof json === "function" || typeof json === "symbol" || typeof json === "bigint" ? void 0 : json;
|
|
4123
|
+
}
|
|
4124
|
+
if ("$$typeof" in json || ancestors.includes(json)) return void 0;
|
|
4125
|
+
ancestors.push(json);
|
|
4126
|
+
let copy;
|
|
4127
|
+
if (Array.isArray(json)) {
|
|
4128
|
+
copy = json.map((item) => toSerializable(item, ancestors) ?? null);
|
|
4129
|
+
} else {
|
|
4130
|
+
const record = json;
|
|
4131
|
+
const object = {};
|
|
4132
|
+
for (const key of Object.keys(record)) {
|
|
4133
|
+
const item = toSerializable(record[key], ancestors);
|
|
4134
|
+
if (item !== void 0) object[key] = item;
|
|
4135
|
+
}
|
|
4136
|
+
copy = object;
|
|
4137
|
+
}
|
|
4138
|
+
ancestors.pop();
|
|
4139
|
+
return copy;
|
|
4140
|
+
}
|
|
4141
|
+
|
|
4142
|
+
// src/components/PluginTheme/index.ts
|
|
4143
|
+
init_react_import();
|
|
4144
|
+
|
|
4145
|
+
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PluginTheme/styles.module.css#css-module
|
|
4146
|
+
init_react_import();
|
|
4147
|
+
var styles_module_default6 = { "PluginTheme": "_PluginTheme_u3emj_8" };
|
|
4148
|
+
|
|
4149
|
+
// src/components/PluginTheme/index.ts
|
|
4150
|
+
var cx4 = getClassNameFactory("PluginTheme", styles_module_default6);
|
|
4151
|
+
var pluginThemeClassName = cx4();
|
|
4152
|
+
|
|
4666
4153
|
// src/components/Chat/index.tsx
|
|
4667
|
-
var
|
|
4154
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4668
4155
|
var q = (0, import_qler.default)();
|
|
4669
4156
|
var DEFAULT_API_VERSION = "v2";
|
|
4670
4157
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4671
4158
|
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.";
|
|
4672
|
-
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.
|
|
4159
|
+
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.552a686b" : "unknown";
|
|
4673
4160
|
var BENCHMARK = false;
|
|
4674
4161
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
|
|
4675
|
-
var
|
|
4676
|
-
var
|
|
4162
|
+
var getClassName3 = getClassNameFactory("Chat", styles_module_default);
|
|
4163
|
+
var usePuck2 = (0, import_core5.createUsePuck)();
|
|
4677
4164
|
function Chat2(props) {
|
|
4678
4165
|
const {
|
|
4679
4166
|
apiVersion = DEFAULT_API_VERSION,
|
|
@@ -4690,34 +4177,35 @@ function Chat2(props) {
|
|
|
4690
4177
|
actions: chatActions,
|
|
4691
4178
|
placeholder
|
|
4692
4179
|
} = chat ?? {};
|
|
4693
|
-
const puckDispatch =
|
|
4180
|
+
const puckDispatch = usePuck2((s) => s.dispatch);
|
|
4694
4181
|
const getPuck = (0, import_core5.useGetPuck)();
|
|
4695
|
-
const
|
|
4696
|
-
const
|
|
4697
|
-
const
|
|
4698
|
-
const
|
|
4699
|
-
const
|
|
4182
|
+
const t = (key, params) => getMessage(getPuck().dictionary, key, params);
|
|
4183
|
+
const localChatId = (0, import_react17.useRef)("");
|
|
4184
|
+
const inputRef = (0, import_react17.useRef)(null);
|
|
4185
|
+
const pluginRef = (0, import_react17.useRef)(null);
|
|
4186
|
+
const [mode, setMode] = (0, import_react17.useState)(defaultMode);
|
|
4187
|
+
const modeRef = (0, import_react17.useRef)(mode);
|
|
4700
4188
|
const designModeVisible = typeof designMode === "boolean" ? designMode : designMode.visible ?? false;
|
|
4701
|
-
(0,
|
|
4189
|
+
(0, import_react17.useEffect)(() => {
|
|
4702
4190
|
modeRef.current = mode;
|
|
4703
4191
|
}, [mode]);
|
|
4704
|
-
const puckData =
|
|
4705
|
-
(0,
|
|
4192
|
+
const puckData = usePuck2((s) => s.appState.data);
|
|
4193
|
+
(0, import_react17.useEffect)(() => {
|
|
4706
4194
|
syncDesignComponents(getPuck);
|
|
4707
4195
|
}, [puckData, getPuck]);
|
|
4708
|
-
const [error, setError] = (0,
|
|
4709
|
-
const [userError, setUserError] = (0,
|
|
4710
|
-
const clientToolEndpointUnavailableRef = (0,
|
|
4711
|
-
const stopChatRef = (0,
|
|
4712
|
-
const [composerAttachments, setComposerAttachments] = (0,
|
|
4713
|
-
const removedAttachmentClientIdsRef = (0,
|
|
4714
|
-
const uploadControllersRef = (0,
|
|
4715
|
-
const pendingBuildOpsRef = (0,
|
|
4716
|
-
const lastStreamActivityRef = (0,
|
|
4717
|
-
const hiddenSinceRef = (0,
|
|
4718
|
-
const [toolStatus, setToolStatus] = (0,
|
|
4719
|
-
const [subagentState, setSubagentState] = (0,
|
|
4720
|
-
const attachmentConfig = (0,
|
|
4196
|
+
const [error, setError] = (0, import_react17.useState)();
|
|
4197
|
+
const [userError, setUserError] = (0, import_react17.useState)();
|
|
4198
|
+
const clientToolEndpointUnavailableRef = (0, import_react17.useRef)(false);
|
|
4199
|
+
const stopChatRef = (0, import_react17.useRef)(null);
|
|
4200
|
+
const [composerAttachments, setComposerAttachments] = (0, import_react17.useState)([]);
|
|
4201
|
+
const removedAttachmentClientIdsRef = (0, import_react17.useRef)(/* @__PURE__ */ new Set());
|
|
4202
|
+
const uploadControllersRef = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
4203
|
+
const pendingBuildOpsRef = (0, import_react17.useRef)([]);
|
|
4204
|
+
const lastStreamActivityRef = (0, import_react17.useRef)(0);
|
|
4205
|
+
const hiddenSinceRef = (0, import_react17.useRef)(null);
|
|
4206
|
+
const [toolStatus, setToolStatus] = (0, import_react17.useState)({});
|
|
4207
|
+
const [subagentState, setSubagentState] = (0, import_react17.useState)({});
|
|
4208
|
+
const attachmentConfig = (0, import_react17.useMemo)(
|
|
4721
4209
|
() => ({
|
|
4722
4210
|
accept: attachments?.accept ?? defaultAttachmentAccept,
|
|
4723
4211
|
enabled: attachments?.enabled ?? true,
|
|
@@ -4727,14 +4215,14 @@ function Chat2(props) {
|
|
|
4727
4215
|
}),
|
|
4728
4216
|
[attachments, host]
|
|
4729
4217
|
);
|
|
4730
|
-
(0,
|
|
4218
|
+
(0, import_react17.useEffect)(
|
|
4731
4219
|
() => () => {
|
|
4732
4220
|
uploadControllersRef.current.forEach((controller) => controller.abort());
|
|
4733
4221
|
uploadControllersRef.current.clear();
|
|
4734
4222
|
},
|
|
4735
4223
|
[]
|
|
4736
4224
|
);
|
|
4737
|
-
const deleteAttachment = (0,
|
|
4225
|
+
const deleteAttachment = (0, import_react17.useCallback)(
|
|
4738
4226
|
async (attachmentId) => {
|
|
4739
4227
|
try {
|
|
4740
4228
|
await fetch(`${attachmentConfig.endpoint}/${attachmentId}`, {
|
|
@@ -4746,7 +4234,7 @@ function Chat2(props) {
|
|
|
4746
4234
|
},
|
|
4747
4235
|
[attachmentConfig.endpoint]
|
|
4748
4236
|
);
|
|
4749
|
-
const uploadScreenshot = (0,
|
|
4237
|
+
const uploadScreenshot = (0, import_react17.useCallback)(
|
|
4750
4238
|
async (width, bucketUrl) => {
|
|
4751
4239
|
try {
|
|
4752
4240
|
const iframeDocument = document?.getElementById("preview-frame")?.contentDocument?.documentElement ?? null;
|
|
@@ -4801,14 +4289,14 @@ function Chat2(props) {
|
|
|
4801
4289
|
BUILD_OP_DEBOUNCE_MS,
|
|
4802
4290
|
{ maxWait: BUILD_OP_DEBOUNCE_MS }
|
|
4803
4291
|
);
|
|
4804
|
-
const queueBuildOp = (0,
|
|
4292
|
+
const queueBuildOp = (0, import_react17.useCallback)(
|
|
4805
4293
|
(operation) => {
|
|
4806
4294
|
pendingBuildOpsRef.current.push(operation);
|
|
4807
4295
|
debouncedFlushBuildOps();
|
|
4808
4296
|
},
|
|
4809
4297
|
[debouncedFlushBuildOps]
|
|
4810
4298
|
);
|
|
4811
|
-
const handleClientToolEndpointUnavailable = (0,
|
|
4299
|
+
const handleClientToolEndpointUnavailable = (0, import_react17.useCallback)(() => {
|
|
4812
4300
|
if (clientToolEndpointUnavailableRef.current) return;
|
|
4813
4301
|
clientToolEndpointUnavailableRef.current = true;
|
|
4814
4302
|
setError(CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE);
|
|
@@ -4832,7 +4320,7 @@ function Chat2(props) {
|
|
|
4832
4320
|
});
|
|
4833
4321
|
stopChatRef.current?.();
|
|
4834
4322
|
}, []);
|
|
4835
|
-
const sendClientToolResponse = (0,
|
|
4323
|
+
const sendClientToolResponse = (0, import_react17.useCallback)(
|
|
4836
4324
|
async (body) => {
|
|
4837
4325
|
try {
|
|
4838
4326
|
await postClientToolResponse(host, body);
|
|
@@ -4842,7 +4330,7 @@ function Chat2(props) {
|
|
|
4842
4330
|
},
|
|
4843
4331
|
[handleClientToolEndpointUnavailable, host]
|
|
4844
4332
|
);
|
|
4845
|
-
const processData = (0,
|
|
4333
|
+
const processData = (0, import_react17.useCallback)(
|
|
4846
4334
|
(dataPart) => {
|
|
4847
4335
|
lastStreamActivityRef.current = Date.now();
|
|
4848
4336
|
switch (dataPart.type) {
|
|
@@ -4983,14 +4471,14 @@ function Chat2(props) {
|
|
|
4983
4471
|
}
|
|
4984
4472
|
}
|
|
4985
4473
|
};
|
|
4986
|
-
const configWithRoot = {
|
|
4474
|
+
const configWithRoot = toSerializable({
|
|
4987
4475
|
...config,
|
|
4988
4476
|
root,
|
|
4989
4477
|
components: {
|
|
4990
4478
|
...config.components,
|
|
4991
4479
|
...getRequestComponentConfigs(appState.data)
|
|
4992
4480
|
}
|
|
4993
|
-
};
|
|
4481
|
+
});
|
|
4994
4482
|
const defaultOptions = {
|
|
4995
4483
|
headers: {
|
|
4996
4484
|
...opts.headers,
|
|
@@ -5053,21 +4541,21 @@ function Chat2(props) {
|
|
|
5053
4541
|
});
|
|
5054
4542
|
}
|
|
5055
4543
|
});
|
|
5056
|
-
(0,
|
|
4544
|
+
(0, import_react17.useEffect)(() => {
|
|
5057
4545
|
stopChatRef.current = stop;
|
|
5058
4546
|
return () => {
|
|
5059
4547
|
stopChatRef.current = null;
|
|
5060
4548
|
stop();
|
|
5061
4549
|
};
|
|
5062
4550
|
}, [stop]);
|
|
5063
|
-
const statusRef = (0,
|
|
5064
|
-
(0,
|
|
4551
|
+
const statusRef = (0, import_react17.useRef)(status);
|
|
4552
|
+
(0, import_react17.useEffect)(() => {
|
|
5065
4553
|
statusRef.current = status;
|
|
5066
4554
|
}, [status]);
|
|
5067
|
-
(0,
|
|
4555
|
+
(0, import_react17.useEffect)(() => {
|
|
5068
4556
|
lastStreamActivityRef.current = Date.now();
|
|
5069
4557
|
}, [messages]);
|
|
5070
|
-
(0,
|
|
4558
|
+
(0, import_react17.useEffect)(() => {
|
|
5071
4559
|
const FROZEN_HIDDEN_MS = 3 * 6e4;
|
|
5072
4560
|
const RESUME_GRACE_MS = 12e3;
|
|
5073
4561
|
const isStreaming = () => statusRef.current === "streaming" || statusRef.current === "submitted";
|
|
@@ -5110,12 +4598,12 @@ function Chat2(props) {
|
|
|
5110
4598
|
if (graceTimer) clearTimeout(graceTimer);
|
|
5111
4599
|
};
|
|
5112
4600
|
}, [stop]);
|
|
5113
|
-
const [forcedStatus, setForcedStatus] = (0,
|
|
5114
|
-
const resolvedStatus = (0,
|
|
4601
|
+
const [forcedStatus, setForcedStatus] = (0, import_react17.useState)();
|
|
4602
|
+
const resolvedStatus = (0, import_react17.useMemo)(
|
|
5115
4603
|
() => forcedStatus ?? status,
|
|
5116
4604
|
[status, forcedStatus]
|
|
5117
4605
|
);
|
|
5118
|
-
(0,
|
|
4606
|
+
(0, import_react17.useEffect)(() => {
|
|
5119
4607
|
if (!scrollTrackingId) return;
|
|
5120
4608
|
dispatchScrollTrackingEvent({
|
|
5121
4609
|
id: scrollTrackingId,
|
|
@@ -5128,7 +4616,7 @@ function Chat2(props) {
|
|
|
5128
4616
|
});
|
|
5129
4617
|
};
|
|
5130
4618
|
}, [resolvedStatus, scrollTrackingId]);
|
|
5131
|
-
(0,
|
|
4619
|
+
(0, import_react17.useEffect)(() => {
|
|
5132
4620
|
window.__PUCK_AI = {
|
|
5133
4621
|
processData,
|
|
5134
4622
|
setMessages,
|
|
@@ -5150,11 +4638,11 @@ function Chat2(props) {
|
|
|
5150
4638
|
if (composerAttachments.some(
|
|
5151
4639
|
(attachment) => attachment.status === "uploading"
|
|
5152
4640
|
)) {
|
|
5153
|
-
setUserError("
|
|
4641
|
+
setUserError(t("plugin-ai-prompt-error-uploading"));
|
|
5154
4642
|
return false;
|
|
5155
4643
|
}
|
|
5156
4644
|
if (composerAttachments.some((attachment) => attachment.status === "failed")) {
|
|
5157
|
-
setUserError("
|
|
4645
|
+
setUserError(t("plugin-ai-prompt-error-attachment-failed"));
|
|
5158
4646
|
return false;
|
|
5159
4647
|
}
|
|
5160
4648
|
if (!text && readyAttachments.length === 0) {
|
|
@@ -5196,7 +4684,9 @@ function Chat2(props) {
|
|
|
5196
4684
|
}
|
|
5197
4685
|
if (composerAttachments.length + files.length > attachmentConfig.maxFiles) {
|
|
5198
4686
|
setUserError(
|
|
5199
|
-
|
|
4687
|
+
t("plugin-ai-prompt-error-max-files", {
|
|
4688
|
+
count: attachmentConfig.maxFiles
|
|
4689
|
+
})
|
|
5200
4690
|
);
|
|
5201
4691
|
return;
|
|
5202
4692
|
}
|
|
@@ -5206,7 +4696,10 @@ function Chat2(props) {
|
|
|
5206
4696
|
if (oversizedFile) {
|
|
5207
4697
|
const limitMB = Math.round(attachmentConfig.maxSizeBytes / 1024 / 1024);
|
|
5208
4698
|
setUserError(
|
|
5209
|
-
|
|
4699
|
+
t("plugin-ai-prompt-error-max-size", {
|
|
4700
|
+
name: oversizedFile.name,
|
|
4701
|
+
limit: limitMB
|
|
4702
|
+
})
|
|
5210
4703
|
);
|
|
5211
4704
|
return;
|
|
5212
4705
|
}
|
|
@@ -5214,7 +4707,9 @@ function Chat2(props) {
|
|
|
5214
4707
|
(file) => !matchesAccept(file, attachmentConfig.accept)
|
|
5215
4708
|
);
|
|
5216
4709
|
if (unsupportedFile) {
|
|
5217
|
-
setUserError(
|
|
4710
|
+
setUserError(
|
|
4711
|
+
t("plugin-ai-prompt-error-type", { name: unsupportedFile.name })
|
|
4712
|
+
);
|
|
5218
4713
|
return;
|
|
5219
4714
|
}
|
|
5220
4715
|
setUserError("");
|
|
@@ -5306,7 +4801,7 @@ function Chat2(props) {
|
|
|
5306
4801
|
} : attachment
|
|
5307
4802
|
)
|
|
5308
4803
|
);
|
|
5309
|
-
setUserError("
|
|
4804
|
+
setUserError(t("plugin-ai-prompt-error-attachment-upload-failed"));
|
|
5310
4805
|
} finally {
|
|
5311
4806
|
uploadControllersRef.current.delete(clientId);
|
|
5312
4807
|
}
|
|
@@ -5339,7 +4834,7 @@ function Chat2(props) {
|
|
|
5339
4834
|
if (!target?.attachmentId) return;
|
|
5340
4835
|
await deleteAttachment(target.attachmentId);
|
|
5341
4836
|
};
|
|
5342
|
-
const messagesWithStatuses = (0,
|
|
4837
|
+
const messagesWithStatuses = (0, import_react17.useMemo)(() => {
|
|
5343
4838
|
return messages.map((msg) => {
|
|
5344
4839
|
return {
|
|
5345
4840
|
...msg,
|
|
@@ -5352,71 +4847,78 @@ function Chat2(props) {
|
|
|
5352
4847
|
};
|
|
5353
4848
|
});
|
|
5354
4849
|
}, [messages, toolStatus]);
|
|
5355
|
-
return /* @__PURE__ */ (0,
|
|
5356
|
-
|
|
4850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4851
|
+
"div",
|
|
5357
4852
|
{
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
AttachmentComposer,
|
|
5363
|
-
{
|
|
5364
|
-
accept: attachmentConfig.accept,
|
|
5365
|
-
attachments: composerAttachments,
|
|
5366
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming",
|
|
5367
|
-
maxFiles: attachmentConfig.maxFiles,
|
|
5368
|
-
onChange: handleAttachmentChange
|
|
5369
|
-
}
|
|
5370
|
-
) : null,
|
|
5371
|
-
typeof chatActions === "function" ? chatActions({
|
|
5372
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5373
|
-
}) : chatActions,
|
|
5374
|
-
designModeVisible ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5375
|
-
DesignModeToggle,
|
|
5376
|
-
{
|
|
5377
|
-
active: mode === "design",
|
|
5378
|
-
onToggle: () => setMode(
|
|
5379
|
-
(mode2) => mode2 === "design" ? "assembly" : "design"
|
|
5380
|
-
),
|
|
5381
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5382
|
-
}
|
|
5383
|
-
) : null
|
|
5384
|
-
] }),
|
|
5385
|
-
attachments: composerAttachments,
|
|
5386
|
-
onRemoveAttachment: removeAttachment,
|
|
5387
|
-
handleSubmit,
|
|
5388
|
-
inputRef,
|
|
5389
|
-
status: resolvedStatus,
|
|
5390
|
-
examplePrompts: examplePrompts?.map(
|
|
5391
|
-
({ label, href, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5392
|
-
ExamplePrompt,
|
|
5393
|
-
{
|
|
5394
|
-
label,
|
|
5395
|
-
href,
|
|
5396
|
-
onClick,
|
|
5397
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5398
|
-
},
|
|
5399
|
-
label
|
|
5400
|
-
)
|
|
5401
|
-
),
|
|
5402
|
-
error,
|
|
5403
|
-
handleRetry: () => {
|
|
5404
|
-
clientToolEndpointUnavailableRef.current = false;
|
|
5405
|
-
setError("");
|
|
5406
|
-
regenerate();
|
|
5407
|
-
},
|
|
5408
|
-
userError,
|
|
5409
|
-
onDismissUserError: () => setUserError(""),
|
|
5410
|
-
children: placeholder ?? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5411
|
-
Placeholder,
|
|
4853
|
+
className: `${getClassName3()} ${pluginThemeClassName}`,
|
|
4854
|
+
ref: pluginRef,
|
|
4855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HostProvider, { value: host, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SubagentStateProvider, { value: subagentState, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4856
|
+
ChatBody,
|
|
5412
4857
|
{
|
|
5413
|
-
|
|
4858
|
+
messages: messagesWithStatuses,
|
|
4859
|
+
onFileDrop: attachmentConfig.enabled ? handleFiles : void 0,
|
|
4860
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
4861
|
+
attachmentConfig.enabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4862
|
+
AttachmentComposer,
|
|
4863
|
+
{
|
|
4864
|
+
accept: attachmentConfig.accept,
|
|
4865
|
+
attachments: composerAttachments,
|
|
4866
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming",
|
|
4867
|
+
maxFiles: attachmentConfig.maxFiles,
|
|
4868
|
+
onChange: handleAttachmentChange
|
|
4869
|
+
}
|
|
4870
|
+
) : null,
|
|
4871
|
+
typeof chatActions === "function" ? chatActions({
|
|
4872
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4873
|
+
}) : chatActions,
|
|
4874
|
+
designModeVisible ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4875
|
+
DesignModeToggle,
|
|
4876
|
+
{
|
|
4877
|
+
active: mode === "design",
|
|
4878
|
+
onToggle: () => setMode(
|
|
4879
|
+
(mode2) => mode2 === "design" ? "assembly" : "design"
|
|
4880
|
+
),
|
|
4881
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4882
|
+
}
|
|
4883
|
+
) : null
|
|
4884
|
+
] }),
|
|
4885
|
+
attachments: composerAttachments,
|
|
4886
|
+
onRemoveAttachment: removeAttachment,
|
|
4887
|
+
handleSubmit,
|
|
5414
4888
|
inputRef,
|
|
5415
|
-
|
|
4889
|
+
status: resolvedStatus,
|
|
4890
|
+
examplePrompts: examplePrompts?.map(
|
|
4891
|
+
({ label, href, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4892
|
+
ExamplePrompt,
|
|
4893
|
+
{
|
|
4894
|
+
label,
|
|
4895
|
+
href,
|
|
4896
|
+
onClick,
|
|
4897
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4898
|
+
},
|
|
4899
|
+
label
|
|
4900
|
+
)
|
|
4901
|
+
),
|
|
4902
|
+
error,
|
|
4903
|
+
handleRetry: () => {
|
|
4904
|
+
clientToolEndpointUnavailableRef.current = false;
|
|
4905
|
+
setError("");
|
|
4906
|
+
regenerate();
|
|
4907
|
+
},
|
|
4908
|
+
userError,
|
|
4909
|
+
onDismissUserError: () => setUserError(""),
|
|
4910
|
+
children: placeholder ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4911
|
+
Placeholder,
|
|
4912
|
+
{
|
|
4913
|
+
dispatch: puckDispatch,
|
|
4914
|
+
inputRef,
|
|
4915
|
+
pluginRef
|
|
4916
|
+
}
|
|
4917
|
+
)
|
|
5416
4918
|
}
|
|
5417
|
-
)
|
|
4919
|
+
) }) }) })
|
|
5418
4920
|
}
|
|
5419
|
-
)
|
|
4921
|
+
);
|
|
5420
4922
|
}
|
|
5421
4923
|
function finalizeReasoningParts(parts) {
|
|
5422
4924
|
return parts.map(
|
|
@@ -5524,14 +5026,15 @@ function AttachmentComposer({
|
|
|
5524
5026
|
maxFiles,
|
|
5525
5027
|
onChange
|
|
5526
5028
|
}) {
|
|
5527
|
-
const id = (0,
|
|
5528
|
-
const inputId = (0,
|
|
5529
|
-
|
|
5530
|
-
|
|
5029
|
+
const id = (0, import_react17.useId)();
|
|
5030
|
+
const inputId = (0, import_react17.useMemo)(() => `attachment-input-${id}`, []);
|
|
5031
|
+
const attachLabel = useMessage("plugin-ai-prompt-attachment-attach");
|
|
5032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName3("attachmentControls"), children: [
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5531
5034
|
"input",
|
|
5532
5035
|
{
|
|
5533
5036
|
accept: accept.join(","),
|
|
5534
|
-
className:
|
|
5037
|
+
className: getClassName3("attachmentInput"),
|
|
5535
5038
|
disabled: disabled || attachments.length >= maxFiles,
|
|
5536
5039
|
id: inputId,
|
|
5537
5040
|
multiple: true,
|
|
@@ -5539,16 +5042,16 @@ function AttachmentComposer({
|
|
|
5539
5042
|
type: "file"
|
|
5540
5043
|
}
|
|
5541
5044
|
),
|
|
5542
|
-
/* @__PURE__ */ (0,
|
|
5045
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5543
5046
|
"button",
|
|
5544
5047
|
{
|
|
5545
|
-
"aria-label":
|
|
5546
|
-
className:
|
|
5048
|
+
"aria-label": attachLabel,
|
|
5049
|
+
className: getClassName3("attachmentButton"),
|
|
5547
5050
|
disabled: disabled || attachments.length >= maxFiles,
|
|
5548
5051
|
onClick: () => document.getElementById(inputId)?.click(),
|
|
5549
|
-
title:
|
|
5052
|
+
title: attachLabel,
|
|
5550
5053
|
type: "button",
|
|
5551
|
-
children: /* @__PURE__ */ (0,
|
|
5054
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Paperclip, { size: 14 })
|
|
5552
5055
|
}
|
|
5553
5056
|
)
|
|
5554
5057
|
] });
|
|
@@ -5558,6 +5061,10 @@ function Placeholder({
|
|
|
5558
5061
|
inputRef,
|
|
5559
5062
|
pluginRef
|
|
5560
5063
|
}) {
|
|
5064
|
+
const title = useMessage("plugin-ai-placeholder-title");
|
|
5065
|
+
const description = useMessage("plugin-ai-placeholder-description");
|
|
5066
|
+
const writePromptLabel = useMessage("plugin-ai-placeholder-write-prompt");
|
|
5067
|
+
const browseLabel = useMessage("plugin-ai-placeholder-browse");
|
|
5561
5068
|
const handleEnterPromptClick = () => {
|
|
5562
5069
|
inputRef.current?.focus({ preventScroll: true });
|
|
5563
5070
|
setTimeout(() => {
|
|
@@ -5571,24 +5078,24 @@ function Placeholder({
|
|
|
5571
5078
|
}
|
|
5572
5079
|
}, 10);
|
|
5573
5080
|
};
|
|
5574
|
-
return /* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5578
|
-
/* @__PURE__ */ (0,
|
|
5579
|
-
/* @__PURE__ */ (0,
|
|
5081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName3("placeholder"), children: [
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName3("placeholderIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Sparkles, { "aria-hidden": "true", size: 28 }) }),
|
|
5083
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { className: getClassName3("placeholderTitle"), children: title }),
|
|
5084
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName3("placeholderDescription"), children: description }),
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName3("actions"), children: [
|
|
5086
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5580
5087
|
"button",
|
|
5581
5088
|
{
|
|
5582
|
-
className:
|
|
5089
|
+
className: getClassName3("action"),
|
|
5583
5090
|
onClick: handleEnterPromptClick,
|
|
5584
5091
|
type: "button",
|
|
5585
|
-
children:
|
|
5092
|
+
children: writePromptLabel
|
|
5586
5093
|
}
|
|
5587
5094
|
),
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
5095
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5589
5096
|
"button",
|
|
5590
5097
|
{
|
|
5591
|
-
className:
|
|
5098
|
+
className: getClassName3("actionOutlined"),
|
|
5592
5099
|
onClick: () => {
|
|
5593
5100
|
dispatch({
|
|
5594
5101
|
type: "setUi",
|
|
@@ -5596,7 +5103,7 @@ function Placeholder({
|
|
|
5596
5103
|
});
|
|
5597
5104
|
},
|
|
5598
5105
|
type: "button",
|
|
5599
|
-
children:
|
|
5106
|
+
children: browseLabel
|
|
5600
5107
|
}
|
|
5601
5108
|
)
|
|
5602
5109
|
] })
|
|
@@ -5625,7 +5132,7 @@ function isScrolledIntoView(el) {
|
|
|
5625
5132
|
|
|
5626
5133
|
// src/components/ScrollTracking/ScrollTracking.tsx
|
|
5627
5134
|
init_react_import();
|
|
5628
|
-
var
|
|
5135
|
+
var import_react19 = require("react");
|
|
5629
5136
|
|
|
5630
5137
|
// src/lib/scroll-into-view-local.ts
|
|
5631
5138
|
init_react_import();
|
|
@@ -5648,9 +5155,9 @@ function scrollIntoViewLocal(el, win, behavior = "smooth") {
|
|
|
5648
5155
|
|
|
5649
5156
|
// src/lib/use-frame-mutation-observer.ts
|
|
5650
5157
|
init_react_import();
|
|
5651
|
-
var
|
|
5158
|
+
var import_react18 = require("react");
|
|
5652
5159
|
function useFrameMutationObserver(callback) {
|
|
5653
|
-
return (0,
|
|
5160
|
+
return (0, import_react18.useCallback)(() => {
|
|
5654
5161
|
const frame = document?.getElementById(
|
|
5655
5162
|
"preview-frame"
|
|
5656
5163
|
);
|
|
@@ -5695,9 +5202,9 @@ var ScrollTracking = ({
|
|
|
5695
5202
|
children,
|
|
5696
5203
|
trackingId
|
|
5697
5204
|
}) => {
|
|
5698
|
-
const followedRefs = (0,
|
|
5699
|
-
const enabledRef = (0,
|
|
5700
|
-
(0,
|
|
5205
|
+
const followedRefs = (0, import_react19.useRef)([]);
|
|
5206
|
+
const enabledRef = (0, import_react19.useRef)(false);
|
|
5207
|
+
(0, import_react19.useEffect)(() => {
|
|
5701
5208
|
return subscribeToScrollTrackingEvents(({ id, enabled }) => {
|
|
5702
5209
|
if (id !== trackingId) return;
|
|
5703
5210
|
enabledRef.current = enabled;
|
|
@@ -5716,7 +5223,7 @@ var ScrollTracking = ({
|
|
|
5716
5223
|
});
|
|
5717
5224
|
}
|
|
5718
5225
|
});
|
|
5719
|
-
(0,
|
|
5226
|
+
(0, import_react19.useEffect)(() => {
|
|
5720
5227
|
follow();
|
|
5721
5228
|
}, [follow]);
|
|
5722
5229
|
return children;
|
|
@@ -5729,26 +5236,316 @@ var import_core7 = require("@puckeditor/core");
|
|
|
5729
5236
|
// src/components/ManageComponents/index.tsx
|
|
5730
5237
|
init_react_import();
|
|
5731
5238
|
var import_core6 = require("@puckeditor/core");
|
|
5732
|
-
var
|
|
5239
|
+
var import_react23 = require("react");
|
|
5240
|
+
|
|
5241
|
+
// ../platform-client/components/ActionModal/index.ts
|
|
5242
|
+
init_react_import();
|
|
5243
|
+
|
|
5244
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
5245
|
+
init_react_import();
|
|
5246
|
+
|
|
5247
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/ActionModal/ActionModal.module.css#css-module
|
|
5248
|
+
init_react_import();
|
|
5249
|
+
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" };
|
|
5250
|
+
|
|
5251
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5252
|
+
init_react_import();
|
|
5253
|
+
|
|
5254
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Modal/Modal.module.css#css-module
|
|
5255
|
+
init_react_import();
|
|
5256
|
+
var Modal_module_default = { "Modal-background": "_Modal-background_10jdm_1", "Modal--visible": "_Modal--visible_10jdm_16", "Modal-modal": "_Modal-modal_10jdm_22" };
|
|
5257
|
+
|
|
5258
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5259
|
+
var import_react22 = require("react");
|
|
5260
|
+
|
|
5261
|
+
// ../platform-client/lib/use-modal-visible.ts
|
|
5262
|
+
init_react_import();
|
|
5263
|
+
var import_react20 = require("react");
|
|
5264
|
+
var useModalVisible = (defaultVisible) => {
|
|
5265
|
+
const [visible, setVisible] = (0, import_react20.useState)(defaultVisible ?? false);
|
|
5266
|
+
const ref = (0, import_react20.useRef)(null);
|
|
5267
|
+
(0, import_react20.useEffect)(() => {
|
|
5268
|
+
if (!visible) {
|
|
5269
|
+
return;
|
|
5270
|
+
}
|
|
5271
|
+
const handler = (e) => {
|
|
5272
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
5273
|
+
setVisible(false);
|
|
5274
|
+
}
|
|
5275
|
+
};
|
|
5276
|
+
document.body.addEventListener("click", handler);
|
|
5277
|
+
return () => {
|
|
5278
|
+
document.body.removeEventListener("click", handler);
|
|
5279
|
+
};
|
|
5280
|
+
}, [visible]);
|
|
5281
|
+
return [visible, setVisible, ref];
|
|
5282
|
+
};
|
|
5283
|
+
|
|
5284
|
+
// ../platform-client/components/Button/index.ts
|
|
5285
|
+
init_react_import();
|
|
5286
|
+
|
|
5287
|
+
// ../platform-client/components/Button/Button.tsx
|
|
5288
|
+
init_react_import();
|
|
5289
|
+
var import_react21 = require("react");
|
|
5290
|
+
|
|
5291
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Button/Button.module.css#css-module
|
|
5292
|
+
init_react_import();
|
|
5293
|
+
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" };
|
|
5294
|
+
|
|
5295
|
+
// ../platform-client/components/Button/Button.tsx
|
|
5296
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
5297
|
+
var getClassName4 = get_class_name_factory_default("Button", Button_module_default);
|
|
5298
|
+
var Button = ({
|
|
5299
|
+
children,
|
|
5300
|
+
href,
|
|
5301
|
+
onClick,
|
|
5302
|
+
variant = "primary",
|
|
5303
|
+
type,
|
|
5304
|
+
disabled,
|
|
5305
|
+
tabIndex,
|
|
5306
|
+
newTab,
|
|
5307
|
+
fullWidth,
|
|
5308
|
+
icon,
|
|
5309
|
+
size = "medium",
|
|
5310
|
+
loading: loadingProp = false
|
|
5311
|
+
}) => {
|
|
5312
|
+
const [loading, setLoading] = (0, import_react21.useState)(loadingProp);
|
|
5313
|
+
(0, import_react21.useEffect)(() => {
|
|
5314
|
+
const resetLoading = () => setLoading(loadingProp);
|
|
5315
|
+
resetLoading();
|
|
5316
|
+
window.addEventListener("pageshow", resetLoading);
|
|
5317
|
+
return () => window.removeEventListener("pageshow", resetLoading);
|
|
5318
|
+
}, [loadingProp]);
|
|
5319
|
+
const ElementType = href ? "a" : type ? "button" : "span";
|
|
5320
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5321
|
+
ElementType,
|
|
5322
|
+
{
|
|
5323
|
+
className: getClassName4({
|
|
5324
|
+
brand: variant === "brand",
|
|
5325
|
+
primary: variant === "primary",
|
|
5326
|
+
secondary: variant === "secondary",
|
|
5327
|
+
danger: variant === "danger",
|
|
5328
|
+
ghost: variant === "ghost",
|
|
5329
|
+
// Disabled while its click is still running, too.
|
|
5330
|
+
disabled: disabled || loading,
|
|
5331
|
+
fullWidth,
|
|
5332
|
+
[size]: true
|
|
5333
|
+
}),
|
|
5334
|
+
onClick: (e) => {
|
|
5335
|
+
if (disabled || loading) {
|
|
5336
|
+
e.preventDefault();
|
|
5337
|
+
return;
|
|
5338
|
+
}
|
|
5339
|
+
if (!onClick) return;
|
|
5340
|
+
setLoading(true);
|
|
5341
|
+
Promise.resolve(onClick(e)).then(() => {
|
|
5342
|
+
setLoading(false);
|
|
5343
|
+
});
|
|
5344
|
+
},
|
|
5345
|
+
type,
|
|
5346
|
+
disabled: disabled || loading,
|
|
5347
|
+
tabIndex,
|
|
5348
|
+
target: newTab ? "_blank" : void 0,
|
|
5349
|
+
rel: newTab ? "noreferrer" : void 0,
|
|
5350
|
+
href,
|
|
5351
|
+
children: [
|
|
5352
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName4("icon"), children: icon }),
|
|
5353
|
+
children,
|
|
5354
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName4("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loader, { size: 12 }) })
|
|
5355
|
+
]
|
|
5356
|
+
}
|
|
5357
|
+
);
|
|
5358
|
+
return el;
|
|
5359
|
+
};
|
|
5360
|
+
|
|
5361
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5362
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5363
|
+
var getClassName5 = getClassNameFactory("Modal", Modal_module_default);
|
|
5364
|
+
var modalContext = (0, import_react22.createContext)({
|
|
5365
|
+
buttonVariant: "primary",
|
|
5366
|
+
buttonSize: "medium",
|
|
5367
|
+
visible: false,
|
|
5368
|
+
setVisible: () => {
|
|
5369
|
+
},
|
|
5370
|
+
ref: null
|
|
5371
|
+
});
|
|
5372
|
+
var ModalProvider = ({
|
|
5373
|
+
children,
|
|
5374
|
+
defaultVisible,
|
|
5375
|
+
buttonVariant = "primary",
|
|
5376
|
+
buttonSize = "medium"
|
|
5377
|
+
}) => {
|
|
5378
|
+
const [visible, setVisible, ref] = useModalVisible(defaultVisible);
|
|
5379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5380
|
+
modalContext.Provider,
|
|
5381
|
+
{
|
|
5382
|
+
value: { buttonVariant, buttonSize, visible, setVisible, ref },
|
|
5383
|
+
children
|
|
5384
|
+
}
|
|
5385
|
+
);
|
|
5386
|
+
};
|
|
5387
|
+
var useModal = () => {
|
|
5388
|
+
const { visible, setVisible } = (0, import_react22.useContext)(modalContext);
|
|
5389
|
+
return { visible, setVisible };
|
|
5390
|
+
};
|
|
5391
|
+
var Modal = ({
|
|
5392
|
+
actionLabel = "Open",
|
|
5393
|
+
children,
|
|
5394
|
+
hideButton = false
|
|
5395
|
+
}) => {
|
|
5396
|
+
const { visible, setVisible, buttonVariant, buttonSize, ref } = (0, import_react22.useContext)(modalContext);
|
|
5397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName5({ visible }), children: [
|
|
5398
|
+
!hideButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName5("button"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5399
|
+
Button,
|
|
5400
|
+
{
|
|
5401
|
+
type: "button",
|
|
5402
|
+
variant: buttonVariant,
|
|
5403
|
+
size: buttonSize,
|
|
5404
|
+
onClick: (e) => {
|
|
5405
|
+
e.stopPropagation();
|
|
5406
|
+
setVisible(!visible);
|
|
5407
|
+
},
|
|
5408
|
+
children: actionLabel
|
|
5409
|
+
}
|
|
5410
|
+
) }),
|
|
5411
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName5("background"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName5("modal"), ref, children }) })
|
|
5412
|
+
] });
|
|
5413
|
+
};
|
|
5414
|
+
|
|
5415
|
+
// ../platform-client/components/Heading/index.ts
|
|
5416
|
+
init_react_import();
|
|
5417
|
+
|
|
5418
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
5419
|
+
init_react_import();
|
|
5420
|
+
|
|
5421
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
5422
|
+
init_react_import();
|
|
5423
|
+
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" };
|
|
5424
|
+
|
|
5425
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
5426
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5427
|
+
var getClassName6 = get_class_name_factory_default("Heading", Heading_module_default);
|
|
5428
|
+
var Heading = ({
|
|
5429
|
+
children,
|
|
5430
|
+
rank,
|
|
5431
|
+
size = "m",
|
|
5432
|
+
variant = "default"
|
|
5433
|
+
}) => {
|
|
5434
|
+
const Tag = rank ? `h${rank}` : "span";
|
|
5435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5436
|
+
Tag,
|
|
5437
|
+
{
|
|
5438
|
+
className: getClassName6({
|
|
5439
|
+
[size]: true,
|
|
5440
|
+
brand: variant === "brand"
|
|
5441
|
+
}),
|
|
5442
|
+
children
|
|
5443
|
+
}
|
|
5444
|
+
);
|
|
5445
|
+
};
|
|
5446
|
+
|
|
5447
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
5448
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5449
|
+
var getClassName7 = getClassNameFactory("ActionModal", ActionModal_module_default);
|
|
5450
|
+
var ActionModalFooter = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName7("footer"), children });
|
|
5451
|
+
var ActionModal = ({
|
|
5452
|
+
actionLabel = "Open",
|
|
5453
|
+
children,
|
|
5454
|
+
title,
|
|
5455
|
+
description,
|
|
5456
|
+
actions,
|
|
5457
|
+
hideButton
|
|
5458
|
+
}) => {
|
|
5459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName7(), children: [
|
|
5460
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName7("header"), children: [
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { size: "s", children: title }),
|
|
5462
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: description })
|
|
5463
|
+
] }),
|
|
5464
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName7("body"), children }),
|
|
5465
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ActionModalFooter, { children: actions })
|
|
5466
|
+
] }) });
|
|
5467
|
+
};
|
|
5468
|
+
ActionModal.Footer = ActionModalFooter;
|
|
5469
|
+
|
|
5470
|
+
// ../platform-client/components/Inline/index.ts
|
|
5471
|
+
init_react_import();
|
|
5472
|
+
|
|
5473
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
5474
|
+
init_react_import();
|
|
5475
|
+
|
|
5476
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
5477
|
+
init_react_import();
|
|
5478
|
+
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" };
|
|
5479
|
+
|
|
5480
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
5481
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5482
|
+
var getClassName8 = get_class_name_factory_default("Inline", Inline_module_default);
|
|
5483
|
+
var Inline = ({
|
|
5484
|
+
children,
|
|
5485
|
+
grow,
|
|
5486
|
+
center,
|
|
5487
|
+
size = "m",
|
|
5488
|
+
noWrap,
|
|
5489
|
+
centerH
|
|
5490
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5491
|
+
"div",
|
|
5492
|
+
{
|
|
5493
|
+
className: getClassName8({
|
|
5494
|
+
grow,
|
|
5495
|
+
center,
|
|
5496
|
+
centerH,
|
|
5497
|
+
noWrap,
|
|
5498
|
+
[`size${size.toUpperCase()}`]: size
|
|
5499
|
+
}),
|
|
5500
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName8("inner"), children })
|
|
5501
|
+
}
|
|
5502
|
+
);
|
|
5503
|
+
var InlineItem = ({
|
|
5504
|
+
children,
|
|
5505
|
+
grow,
|
|
5506
|
+
push,
|
|
5507
|
+
shrink
|
|
5508
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5509
|
+
"div",
|
|
5510
|
+
{
|
|
5511
|
+
style: {
|
|
5512
|
+
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
5513
|
+
flexShrink: shrink ? "1" : "0",
|
|
5514
|
+
marginLeft: push ? "auto" : 0,
|
|
5515
|
+
maxWidth: "100%"
|
|
5516
|
+
},
|
|
5517
|
+
children
|
|
5518
|
+
}
|
|
5519
|
+
);
|
|
5520
|
+
Inline.Item = InlineItem;
|
|
5521
|
+
|
|
5522
|
+
// ../platform-client/components/Modal/index.ts
|
|
5523
|
+
init_react_import();
|
|
5733
5524
|
|
|
5734
5525
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ManageComponents/styles.module.css#css-module
|
|
5735
5526
|
init_react_import();
|
|
5736
|
-
var
|
|
5527
|
+
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" };
|
|
5737
5528
|
|
|
5738
5529
|
// src/components/ManageComponents/index.tsx
|
|
5739
|
-
var
|
|
5740
|
-
var
|
|
5741
|
-
var useRegistrations = () => (0,
|
|
5530
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5531
|
+
var cx5 = getClassNameFactory("ManageComponents", styles_module_default7);
|
|
5532
|
+
var useRegistrations = () => (0, import_react23.useSyncExternalStore)(
|
|
5742
5533
|
registrationStore.subscribe,
|
|
5743
5534
|
() => registrationStore.getAll(),
|
|
5744
5535
|
() => registrationStore.getAll()
|
|
5745
5536
|
);
|
|
5746
5537
|
function ManageModalContent({ onClose }) {
|
|
5747
5538
|
const getPuck = (0, import_core6.useGetPuck)();
|
|
5539
|
+
const deleteTitle = useMessage("plugin-ai-components-delete-title");
|
|
5540
|
+
const cancelLabel = useMessage("plugin-ai-components-delete-cancel");
|
|
5541
|
+
const deleteLabel = useMessage("plugin-ai-components-delete");
|
|
5542
|
+
const deleteConfirm = useMessage("plugin-ai-components-delete-confirm");
|
|
5543
|
+
const manageTitle = useMessage("plugin-ai-components-manage");
|
|
5544
|
+
const emptyLabel = useMessage("plugin-ai-components-manage-empty");
|
|
5748
5545
|
const { visible, setVisible } = useModal();
|
|
5749
|
-
const [confirmTarget, setConfirmTarget] = (0,
|
|
5546
|
+
const [confirmTarget, setConfirmTarget] = (0, import_react23.useState)(null);
|
|
5750
5547
|
const entries = useRegistrations();
|
|
5751
|
-
(0,
|
|
5548
|
+
(0, import_react23.useEffect)(() => {
|
|
5752
5549
|
if (!visible) onClose();
|
|
5753
5550
|
}, [visible, onClose]);
|
|
5754
5551
|
const handleDelete = (name) => {
|
|
@@ -5759,84 +5556,84 @@ function ManageModalContent({ onClose }) {
|
|
|
5759
5556
|
}
|
|
5760
5557
|
};
|
|
5761
5558
|
if (confirmTarget) {
|
|
5762
|
-
return /* @__PURE__ */ (0,
|
|
5559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5763
5560
|
ActionModal,
|
|
5764
5561
|
{
|
|
5765
|
-
title:
|
|
5562
|
+
title: deleteTitle,
|
|
5766
5563
|
hideButton: true,
|
|
5767
|
-
actions: /* @__PURE__ */ (0,
|
|
5768
|
-
/* @__PURE__ */ (0,
|
|
5769
|
-
/* @__PURE__ */ (0,
|
|
5564
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Inline, { children: [
|
|
5565
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "secondary", onClick: () => setConfirmTarget(null), children: cancelLabel }),
|
|
5566
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5770
5567
|
Button,
|
|
5771
5568
|
{
|
|
5772
5569
|
variant: "danger",
|
|
5773
5570
|
onClick: () => handleDelete(confirmTarget.name),
|
|
5774
|
-
children:
|
|
5571
|
+
children: deleteLabel
|
|
5775
5572
|
}
|
|
5776
5573
|
)
|
|
5777
5574
|
] }),
|
|
5778
|
-
children: /* @__PURE__ */ (0,
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
] })
|
|
5575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: cx5("confirmation"), children: deleteConfirm.split("{label}").map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react23.Fragment, { children: [
|
|
5576
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("b", { children: confirmTarget.label }),
|
|
5577
|
+
part
|
|
5578
|
+
] }, i)) })
|
|
5783
5579
|
}
|
|
5784
5580
|
);
|
|
5785
5581
|
}
|
|
5786
|
-
return /* @__PURE__ */ (0,
|
|
5787
|
-
entries.map(([name, reg]) => /* @__PURE__ */ (0,
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
5582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ActionModal, { title: manageTitle, hideButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cx5("list"), children: [
|
|
5583
|
+
entries.map(([name, reg]) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cx5("item"), children: [
|
|
5584
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: cx5("itemName"), children: reg.label || name }),
|
|
5585
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5790
5586
|
"button",
|
|
5791
5587
|
{
|
|
5792
|
-
className:
|
|
5588
|
+
className: cx5("delete"),
|
|
5793
5589
|
onClick: () => setConfirmTarget({ name, label: reg.label || name }),
|
|
5794
5590
|
type: "button",
|
|
5795
5591
|
children: [
|
|
5796
|
-
/* @__PURE__ */ (0,
|
|
5797
|
-
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Trash2, { size: 12 }),
|
|
5593
|
+
deleteLabel
|
|
5798
5594
|
]
|
|
5799
5595
|
}
|
|
5800
5596
|
)
|
|
5801
5597
|
] }, name)),
|
|
5802
|
-
entries.length === 0 && /* @__PURE__ */ (0,
|
|
5598
|
+
entries.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cx5("empty"), children: emptyLabel })
|
|
5803
5599
|
] }) });
|
|
5804
5600
|
}
|
|
5805
5601
|
function ManageComponentsCta() {
|
|
5806
|
-
const [open, setOpen] = (0,
|
|
5602
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
5807
5603
|
const entries = useRegistrations();
|
|
5808
|
-
const
|
|
5604
|
+
const manageLabel = useMessage("plugin-ai-components-manage");
|
|
5605
|
+
const handleClose = (0, import_react23.useCallback)(() => setOpen(false), []);
|
|
5809
5606
|
if (entries.length === 0) return null;
|
|
5810
|
-
return /* @__PURE__ */ (0,
|
|
5811
|
-
/* @__PURE__ */ (0,
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
5813
|
-
|
|
5607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: cx5("cta"), onClick: () => setOpen(true), type: "button", children: [
|
|
5609
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Settings, { size: 14 }),
|
|
5610
|
+
manageLabel
|
|
5814
5611
|
] }),
|
|
5815
|
-
open && /* @__PURE__ */ (0,
|
|
5612
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModalProvider, { defaultVisible: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ManageModalContent, { onClose: handleClose }) })
|
|
5816
5613
|
] });
|
|
5817
5614
|
}
|
|
5818
5615
|
|
|
5819
5616
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Drawer/styles.module.css#css-module
|
|
5820
5617
|
init_react_import();
|
|
5821
|
-
var
|
|
5618
|
+
var styles_module_default8 = { "Drawer": "_Drawer_1mu8g_1", "Drawer--empty": "_Drawer--empty_1mu8g_5" };
|
|
5822
5619
|
|
|
5823
5620
|
// src/components/Drawer/index.tsx
|
|
5824
|
-
var
|
|
5825
|
-
var
|
|
5826
|
-
var
|
|
5621
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5622
|
+
var usePuck3 = (0, import_core7.createUsePuck)();
|
|
5623
|
+
var cx6 = getClassNameFactory("Drawer", styles_module_default8);
|
|
5827
5624
|
var createDrawer = (designModeVisible) => function Drawer({ children }) {
|
|
5828
|
-
const config =
|
|
5625
|
+
const config = usePuck3((s) => s.config);
|
|
5829
5626
|
if (Object.keys(config.components).length === 0) {
|
|
5830
|
-
return /* @__PURE__ */ (0,
|
|
5627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `${cx6({ empty: true })} ${pluginThemeClassName}`, children: "No blocks" });
|
|
5831
5628
|
}
|
|
5832
|
-
return /* @__PURE__ */ (0,
|
|
5629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${cx6()} ${pluginThemeClassName}`, children: [
|
|
5833
5630
|
children,
|
|
5834
|
-
designModeVisible && /* @__PURE__ */ (0,
|
|
5631
|
+
designModeVisible && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ManageComponentsCta, {})
|
|
5835
5632
|
] });
|
|
5836
5633
|
};
|
|
5837
5634
|
|
|
5838
5635
|
// src/index.tsx
|
|
5839
|
-
var
|
|
5636
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5840
5637
|
function withDynamicConfig(config, data) {
|
|
5841
5638
|
const registrations = getPersistedRegistrations(data);
|
|
5842
5639
|
const dynamicConfig = {};
|
|
@@ -5867,22 +5664,22 @@ function withDynamicConfig(config, data) {
|
|
|
5867
5664
|
return result;
|
|
5868
5665
|
}
|
|
5869
5666
|
function createAiPlugin(opts) {
|
|
5870
|
-
const { scrollTracking = true, ...rest } = opts || {};
|
|
5667
|
+
const { label = "AI", scrollTracking = true, ...rest } = opts || {};
|
|
5871
5668
|
const scrollTrackingId = `puck-ai-scroll-${(0, import_ulid2.ulid)()}`;
|
|
5872
5669
|
const designModeVisible = typeof opts?.designMode === "boolean" ? opts.designMode : opts?.designMode?.visible ?? false;
|
|
5873
5670
|
return {
|
|
5874
|
-
label
|
|
5671
|
+
label,
|
|
5875
5672
|
name: "ai",
|
|
5876
|
-
render: () => /* @__PURE__ */ (0,
|
|
5877
|
-
icon: /* @__PURE__ */ (0,
|
|
5673
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Chat2, { ...rest, scrollTrackingId }),
|
|
5674
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Bot, {}),
|
|
5878
5675
|
mobilePanelHeight: "min-content",
|
|
5879
5676
|
overrides: {
|
|
5880
5677
|
drawer: createDrawer(designModeVisible),
|
|
5881
5678
|
preview: ({ children }) => {
|
|
5882
5679
|
if (scrollTracking) {
|
|
5883
|
-
return /* @__PURE__ */ (0,
|
|
5680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ScrollTracking, { trackingId: scrollTrackingId, children });
|
|
5884
5681
|
}
|
|
5885
|
-
return /* @__PURE__ */ (0,
|
|
5682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
|
|
5886
5683
|
}
|
|
5887
5684
|
}
|
|
5888
5685
|
};
|
|
@@ -5890,6 +5687,7 @@ function createAiPlugin(opts) {
|
|
|
5890
5687
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5891
5688
|
0 && (module.exports = {
|
|
5892
5689
|
createAiPlugin,
|
|
5690
|
+
defaultDictionary,
|
|
5893
5691
|
withDynamicConfig
|
|
5894
5692
|
});
|
|
5895
5693
|
/*! Bundled license information:
|