@puckeditor/plugin-ai 0.9.0-canary.bccb8f95 → 0.9.0-canary.bf40b813
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 -1731
- package/dist/index.js +807 -1056
- package/dist/index.mjs +773 -1022
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -430,8 +430,8 @@ var toCamelCase = (string) => string.replace(
|
|
|
430
430
|
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
431
431
|
);
|
|
432
432
|
var toPascalCase = (string) => {
|
|
433
|
-
const
|
|
434
|
-
return
|
|
433
|
+
const camelCase = toCamelCase(string);
|
|
434
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
435
435
|
};
|
|
436
436
|
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
437
437
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
@@ -993,12 +993,12 @@ function useChat({
|
|
|
993
993
|
}
|
|
994
994
|
|
|
995
995
|
// src/components/Chat/index.tsx
|
|
996
|
-
var
|
|
996
|
+
var import_core4 = require("@puckeditor/core");
|
|
997
997
|
var import_ai5 = require("ai");
|
|
998
|
-
var
|
|
998
|
+
var import_react17 = require("react");
|
|
999
999
|
var import_ulid = require("ulid");
|
|
1000
1000
|
|
|
1001
|
-
// ../
|
|
1001
|
+
// ../platform-client/lib/get-class-name-factory.ts
|
|
1002
1002
|
init_react_import();
|
|
1003
1003
|
var import_classnames = __toESM(require_classnames());
|
|
1004
1004
|
var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
|
@@ -1034,118 +1034,38 @@ var get_class_name_factory_default = getClassNameFactory;
|
|
|
1034
1034
|
|
|
1035
1035
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Chat/styles.module.css#css-module
|
|
1036
1036
|
init_react_import();
|
|
1037
|
-
var styles_module_default = { "Chat": "
|
|
1037
|
+
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
1038
|
|
|
1039
1039
|
// src/components/ChatBody/index.tsx
|
|
1040
1040
|
init_react_import();
|
|
1041
|
-
var
|
|
1041
|
+
var import_react11 = require("react");
|
|
1042
1042
|
var import_use_stick_to_bottom = require("use-stick-to-bottom");
|
|
1043
1043
|
var import_react_markdown = __toESM(require("react-markdown"));
|
|
1044
1044
|
|
|
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
|
|
1045
|
+
// ../platform-client/components/IconButton/index.ts
|
|
1099
1046
|
init_react_import();
|
|
1100
|
-
var Modal_module_default = { "Modal-background": "_Modal-background_1bedq_1", "Modal--visible": "_Modal--visible_1bedq_16", "Modal-modal": "_Modal-modal_1bedq_22" };
|
|
1101
|
-
|
|
1102
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1103
|
-
var import_react9 = require("react");
|
|
1104
1047
|
|
|
1105
|
-
// ../platform-client/
|
|
1048
|
+
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1106
1049
|
init_react_import();
|
|
1107
1050
|
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
1051
|
|
|
1131
|
-
//
|
|
1052
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/IconButton/IconButton.module.css#css-module
|
|
1132
1053
|
init_react_import();
|
|
1133
|
-
var
|
|
1054
|
+
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" };
|
|
1134
1055
|
|
|
1135
|
-
//
|
|
1056
|
+
// ../platform-client/components/Loader/index.tsx
|
|
1136
1057
|
init_react_import();
|
|
1137
|
-
var Button_module_default = { "Button": "_Button_16or4_1", "Button--tiny": "_Button--tiny_16or4_34", "Button--small": "_Button--small_16or4_39", "Button--medium": "_Button--medium_16or4_44", "Button--large": "_Button--large_16or4_52", "Button--brand": "_Button--brand_16or4_59", "Button--primary": "_Button--primary_16or4_79", "Button--secondary": "_Button--secondary_16or4_93", "Button--danger": "_Button--danger_16or4_111", "Button--flush": "_Button--flush_16or4_125", "Button--ghost": "_Button--ghost_16or4_129", "Button--disabled": "_Button--disabled_16or4_146", "Button--fullWidth": "_Button--fullWidth_16or4_156", "Button-spinner": "_Button-spinner_16or4_161" };
|
|
1138
1058
|
|
|
1139
|
-
// ../platform-client/
|
|
1059
|
+
// ../platform-client/lib/index.ts
|
|
1140
1060
|
init_react_import();
|
|
1141
1061
|
|
|
1142
1062
|
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Loader/styles.module.css#css-module
|
|
1143
1063
|
init_react_import();
|
|
1144
|
-
var styles_module_default2 = { "Loader": "
|
|
1064
|
+
var styles_module_default2 = { "Loader": "_Loader_68nru_13", "loader-animation": "_loader-animation_68nru_1" };
|
|
1145
1065
|
|
|
1146
1066
|
// ../platform-client/components/Loader/index.tsx
|
|
1147
1067
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1148
|
-
var getClassName =
|
|
1068
|
+
var getClassName = getClassNameFactory("Loader", styles_module_default2);
|
|
1149
1069
|
var Loader = ({
|
|
1150
1070
|
color,
|
|
1151
1071
|
size = 16,
|
|
@@ -1153,297 +1073,22 @@ var Loader = ({
|
|
|
1153
1073
|
}) => {
|
|
1154
1074
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1155
1075
|
"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,
|
|
1204
|
-
fullWidth,
|
|
1205
|
-
[size]: true
|
|
1206
|
-
}),
|
|
1207
|
-
onClick: (e) => {
|
|
1208
|
-
if (disabled) {
|
|
1209
|
-
e.preventDefault();
|
|
1210
|
-
return;
|
|
1211
|
-
}
|
|
1212
|
-
if (!onClick) return;
|
|
1213
|
-
setLoading(true);
|
|
1214
|
-
Promise.resolve(onClick(e)).then(() => {
|
|
1215
|
-
setLoading(false);
|
|
1216
|
-
});
|
|
1217
|
-
},
|
|
1218
|
-
type,
|
|
1219
|
-
disabled: disabled || loading,
|
|
1220
|
-
tabIndex,
|
|
1221
|
-
target: newTab ? "_blank" : void 0,
|
|
1222
|
-
rel: newTab ? "noreferrer" : void 0,
|
|
1223
|
-
href,
|
|
1224
|
-
children: [
|
|
1225
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("icon"), children: icon }),
|
|
1226
|
-
children,
|
|
1227
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 12 }) })
|
|
1228
|
-
]
|
|
1229
|
-
}
|
|
1230
|
-
);
|
|
1231
|
-
return el;
|
|
1232
|
-
};
|
|
1233
|
-
|
|
1234
|
-
// ../platform-client/components/Modal/Modal.tsx
|
|
1235
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1236
|
-
var getClassName3 = getClassNameFactory2("Modal", Modal_module_default);
|
|
1237
|
-
var modalContext = (0, import_react9.createContext)({
|
|
1238
|
-
buttonVariant: "primary",
|
|
1239
|
-
buttonSize: "medium",
|
|
1240
|
-
visible: false,
|
|
1241
|
-
setVisible: () => {
|
|
1242
|
-
},
|
|
1243
|
-
ref: null
|
|
1244
|
-
});
|
|
1245
|
-
var ModalProvider = ({
|
|
1246
|
-
children,
|
|
1247
|
-
defaultVisible,
|
|
1248
|
-
buttonVariant = "primary",
|
|
1249
|
-
buttonSize = "medium"
|
|
1250
|
-
}) => {
|
|
1251
|
-
const [visible, setVisible, ref] = useModalVisible(defaultVisible);
|
|
1252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1253
|
-
modalContext.Provider,
|
|
1254
|
-
{
|
|
1255
|
-
value: { buttonVariant, buttonSize, visible, setVisible, ref },
|
|
1256
|
-
children
|
|
1257
|
-
}
|
|
1258
|
-
);
|
|
1259
|
-
};
|
|
1260
|
-
var useModal = () => {
|
|
1261
|
-
const { visible, setVisible } = (0, import_react9.useContext)(modalContext);
|
|
1262
|
-
return { visible, setVisible };
|
|
1263
|
-
};
|
|
1264
|
-
var Modal = ({
|
|
1265
|
-
actionLabel = "Open",
|
|
1266
|
-
children,
|
|
1267
|
-
hideButton = false
|
|
1268
|
-
}) => {
|
|
1269
|
-
const { visible, setVisible, buttonVariant, buttonSize, ref } = (0, import_react9.useContext)(modalContext);
|
|
1270
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3({ visible }), children: [
|
|
1271
|
-
!hideButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("button"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1272
|
-
Button,
|
|
1273
|
-
{
|
|
1274
|
-
type: "button",
|
|
1275
|
-
variant: buttonVariant,
|
|
1276
|
-
size: buttonSize,
|
|
1277
|
-
onClick: (e) => {
|
|
1278
|
-
e.stopPropagation();
|
|
1279
|
-
setVisible(!visible);
|
|
1280
|
-
},
|
|
1281
|
-
children: actionLabel
|
|
1282
|
-
}
|
|
1283
|
-
) }),
|
|
1284
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("background"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("modal"), ref, children }) })
|
|
1285
|
-
] });
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
// ../platform-client/components/Heading/index.ts
|
|
1289
|
-
init_react_import();
|
|
1290
|
-
|
|
1291
|
-
// ../platform-client/components/Heading/Heading.tsx
|
|
1292
|
-
init_react_import();
|
|
1293
|
-
|
|
1294
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
1295
|
-
init_react_import();
|
|
1296
|
-
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" };
|
|
1297
|
-
|
|
1298
|
-
// ../platform-client/components/Heading/Heading.tsx
|
|
1299
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1300
|
-
var getClassName4 = get_class_name_factory_default2("Heading", Heading_module_default);
|
|
1301
|
-
var Heading = ({
|
|
1302
|
-
children,
|
|
1303
|
-
rank,
|
|
1304
|
-
size = "m",
|
|
1305
|
-
variant = "default"
|
|
1306
|
-
}) => {
|
|
1307
|
-
const Tag2 = rank ? `h${rank}` : "span";
|
|
1308
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1309
|
-
Tag2,
|
|
1310
|
-
{
|
|
1311
|
-
className: getClassName4({
|
|
1312
|
-
[size]: true,
|
|
1313
|
-
brand: variant === "brand"
|
|
1314
|
-
}),
|
|
1315
|
-
children
|
|
1316
|
-
}
|
|
1317
|
-
);
|
|
1318
|
-
};
|
|
1319
|
-
|
|
1320
|
-
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
1321
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1322
|
-
var getClassName5 = getClassNameFactory2("ActionModal", ActionModal_module_default);
|
|
1323
|
-
var ActionModalFooter = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName5("footer"), children });
|
|
1324
|
-
var ActionModal = ({
|
|
1325
|
-
actionLabel = "Open",
|
|
1326
|
-
children,
|
|
1327
|
-
title,
|
|
1328
|
-
description,
|
|
1329
|
-
actions,
|
|
1330
|
-
hideButton
|
|
1331
|
-
}) => {
|
|
1332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
|
1333
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5("header"), children: [
|
|
1334
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { size: "s", children: title }),
|
|
1335
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: description })
|
|
1336
|
-
] }),
|
|
1337
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName5("body"), children }),
|
|
1338
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionModalFooter, { children: actions })
|
|
1339
|
-
] }) });
|
|
1340
|
-
};
|
|
1341
|
-
ActionModal.Footer = ActionModalFooter;
|
|
1342
|
-
|
|
1343
|
-
// ../platform-client/components/AIAction/index.tsx
|
|
1344
|
-
init_react_import();
|
|
1345
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1346
|
-
|
|
1347
|
-
// ../platform-client/components/Align/index.ts
|
|
1348
|
-
init_react_import();
|
|
1349
|
-
|
|
1350
|
-
// ../platform-client/components/Align/Align.tsx
|
|
1351
|
-
init_react_import();
|
|
1352
|
-
var import_react10 = __toESM(require("react"));
|
|
1353
|
-
|
|
1354
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Align/Align.module.css#css-module
|
|
1355
|
-
init_react_import();
|
|
1356
|
-
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" };
|
|
1357
|
-
|
|
1358
|
-
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
1359
|
-
init_react_import();
|
|
1360
|
-
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
1361
|
-
var SEPARATORS = /[_.\- ]+/;
|
|
1362
|
-
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
1363
|
-
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
1364
|
-
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
1365
|
-
|
|
1366
|
-
// ../platform-client/components/Align/Align.tsx
|
|
1367
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1368
|
-
var getClassName6 = get_class_name_factory_default2("Align", Align_module_default);
|
|
1369
|
-
|
|
1370
|
-
// ../platform-client/components/AutoForm/index.ts
|
|
1371
|
-
init_react_import();
|
|
1372
|
-
|
|
1373
|
-
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
1374
|
-
init_react_import();
|
|
1375
|
-
var import_core = require("@puckeditor/core");
|
|
1376
|
-
var import_react11 = require("react");
|
|
1377
|
-
|
|
1378
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/AutoForm/AutoForm.module.css#css-module
|
|
1379
|
-
init_react_import();
|
|
1380
|
-
var AutoForm_module_default = { "AutoForm": "_AutoForm_1vmh9_1" };
|
|
1381
|
-
|
|
1382
|
-
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
1383
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1384
|
-
var getClassName7 = getClassNameFactory2("AutoForm", AutoForm_module_default);
|
|
1385
|
-
|
|
1386
|
-
// ../platform-client/components/Card/index.ts
|
|
1387
|
-
init_react_import();
|
|
1388
|
-
|
|
1389
|
-
// ../platform-client/components/Card/Card.tsx
|
|
1390
|
-
init_react_import();
|
|
1391
|
-
|
|
1392
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Card/Card.module.css#css-module
|
|
1393
|
-
init_react_import();
|
|
1394
|
-
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" };
|
|
1395
|
-
|
|
1396
|
-
// ../platform-client/components/Card/Card.tsx
|
|
1397
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1398
|
-
var getClassName8 = get_class_name_factory_default2("Card", Card_module_default);
|
|
1399
|
-
|
|
1400
|
-
// ../platform-client/components/CardSelector/index.tsx
|
|
1401
|
-
init_react_import();
|
|
1402
|
-
|
|
1403
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/CardSelector/styles.module.css#css-module
|
|
1404
|
-
init_react_import();
|
|
1405
|
-
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" };
|
|
1406
|
-
|
|
1407
|
-
// ../platform-client/components/CardSelector/index.tsx
|
|
1408
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1409
|
-
var cx = get_class_name_factory_default("CardSelector", styles_module_default3);
|
|
1410
|
-
var cxOption = get_class_name_factory_default("CardSelectorOption", styles_module_default3);
|
|
1411
|
-
|
|
1412
|
-
// ../platform-client/components/Code/index.ts
|
|
1413
|
-
init_react_import();
|
|
1414
|
-
|
|
1415
|
-
// ../platform-client/components/Code/Code.tsx
|
|
1416
|
-
init_react_import();
|
|
1417
|
-
|
|
1418
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Code/Code.module.css#css-module
|
|
1419
|
-
init_react_import();
|
|
1420
|
-
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" };
|
|
1421
|
-
|
|
1422
|
-
// ../platform-client/components/Code/CopyAction.tsx
|
|
1423
|
-
init_react_import();
|
|
1424
|
-
var import_react12 = require("react");
|
|
1425
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1426
|
-
|
|
1427
|
-
// ../platform-client/components/Code/Code.tsx
|
|
1428
|
-
var import_react13 = require("react");
|
|
1429
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1430
|
-
var getClassName9 = get_class_name_factory_default("Code", Code_module_default);
|
|
1431
|
-
var getClassNameTab = get_class_name_factory_default("Tab", Code_module_default);
|
|
1432
|
-
|
|
1433
|
-
// ../platform-client/components/IconButton/index.ts
|
|
1434
|
-
init_react_import();
|
|
1435
|
-
|
|
1436
|
-
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1437
|
-
init_react_import();
|
|
1438
|
-
var import_react14 = require("react");
|
|
1439
|
-
|
|
1440
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/IconButton/IconButton.module.css#css-module
|
|
1441
|
-
init_react_import();
|
|
1442
|
-
var IconButton_module_default = { "IconButton": "_IconButton_thegm_1", "IconButton--disabled": "_IconButton--disabled_thegm_20", "IconButton--dark": "_IconButton--dark_thegm_26", "IconButton-title": "_IconButton-title_thegm_37" };
|
|
1076
|
+
{
|
|
1077
|
+
className: getClassName(),
|
|
1078
|
+
style: {
|
|
1079
|
+
width: size,
|
|
1080
|
+
height: size,
|
|
1081
|
+
color
|
|
1082
|
+
},
|
|
1083
|
+
"aria-label": "loading",
|
|
1084
|
+
...props
|
|
1085
|
+
}
|
|
1086
|
+
);
|
|
1087
|
+
};
|
|
1443
1088
|
|
|
1444
1089
|
// ../platform-client/components/IconButton/IconButton.tsx
|
|
1445
|
-
var
|
|
1446
|
-
var
|
|
1090
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1091
|
+
var getClassName2 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
|
1447
1092
|
var IconButton = ({
|
|
1448
1093
|
children,
|
|
1449
1094
|
href,
|
|
@@ -1457,12 +1102,12 @@ var IconButton = ({
|
|
|
1457
1102
|
title,
|
|
1458
1103
|
dark
|
|
1459
1104
|
}) => {
|
|
1460
|
-
const [loading, setLoading] = (0,
|
|
1105
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
1461
1106
|
const ElementType = href ? "a" : onClick ? "button" : "div";
|
|
1462
|
-
const el = /* @__PURE__ */ (0,
|
|
1107
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1463
1108
|
ElementType,
|
|
1464
1109
|
{
|
|
1465
|
-
className:
|
|
1110
|
+
className: getClassName2({
|
|
1466
1111
|
primary: variant === "primary",
|
|
1467
1112
|
secondary: variant === "secondary",
|
|
1468
1113
|
disabled,
|
|
@@ -1484,11 +1129,11 @@ var IconButton = ({
|
|
|
1484
1129
|
href,
|
|
1485
1130
|
title,
|
|
1486
1131
|
children: [
|
|
1487
|
-
/* @__PURE__ */ (0,
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: getClassName2("title"), children: title }),
|
|
1488
1133
|
children,
|
|
1489
|
-
loading && /* @__PURE__ */ (0,
|
|
1134
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1490
1135
|
"\xA0\xA0",
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 14 })
|
|
1492
1137
|
] })
|
|
1493
1138
|
]
|
|
1494
1139
|
}
|
|
@@ -1496,285 +1141,21 @@ var IconButton = ({
|
|
|
1496
1141
|
return el;
|
|
1497
1142
|
};
|
|
1498
1143
|
|
|
1499
|
-
//
|
|
1500
|
-
init_react_import();
|
|
1501
|
-
|
|
1502
|
-
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
1503
|
-
init_react_import();
|
|
1504
|
-
|
|
1505
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/InfoBar/InfoBar.module.css#css-module
|
|
1506
|
-
init_react_import();
|
|
1507
|
-
var InfoBar_module_default = { "InfoBar": "_InfoBar_kchdj_1", "Info": "_Info_kchdj_1", "Info-title": "_Info-title_kchdj_21" };
|
|
1508
|
-
|
|
1509
|
-
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
1510
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1511
|
-
var cx2 = getClassNameFactory2("InfoBar", InfoBar_module_default);
|
|
1512
|
-
var cxInfo = getClassNameFactory2("Info", InfoBar_module_default);
|
|
1513
|
-
var Info = ({ title, children }) => {
|
|
1514
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cxInfo(), children: [
|
|
1515
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cxInfo("title"), children: title }),
|
|
1516
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cxInfo("children"), children })
|
|
1517
|
-
] });
|
|
1518
|
-
};
|
|
1519
|
-
var InfoBar = ({ children }) => {
|
|
1520
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cx2(), children });
|
|
1521
|
-
};
|
|
1522
|
-
InfoBar.Info = Info;
|
|
1523
|
-
|
|
1524
|
-
// ../platform-client/components/Inline/index.ts
|
|
1525
|
-
init_react_import();
|
|
1526
|
-
|
|
1527
|
-
// ../platform-client/components/Inline/Inline.tsx
|
|
1528
|
-
init_react_import();
|
|
1529
|
-
|
|
1530
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
1531
|
-
init_react_import();
|
|
1532
|
-
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" };
|
|
1533
|
-
|
|
1534
|
-
// ../platform-client/components/Inline/Inline.tsx
|
|
1535
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1536
|
-
var getClassName11 = get_class_name_factory_default2("Inline", Inline_module_default);
|
|
1537
|
-
var Inline = ({
|
|
1538
|
-
children,
|
|
1539
|
-
grow,
|
|
1540
|
-
center,
|
|
1541
|
-
size = "m",
|
|
1542
|
-
noWrap,
|
|
1543
|
-
centerH
|
|
1544
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1545
|
-
"div",
|
|
1546
|
-
{
|
|
1547
|
-
className: getClassName11({
|
|
1548
|
-
grow,
|
|
1549
|
-
center,
|
|
1550
|
-
centerH,
|
|
1551
|
-
noWrap,
|
|
1552
|
-
[`size${size.toUpperCase()}`]: size
|
|
1553
|
-
}),
|
|
1554
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("inner"), children })
|
|
1555
|
-
}
|
|
1556
|
-
);
|
|
1557
|
-
var InlineItem = ({
|
|
1558
|
-
children,
|
|
1559
|
-
grow,
|
|
1560
|
-
push,
|
|
1561
|
-
shrink
|
|
1562
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1563
|
-
"div",
|
|
1564
|
-
{
|
|
1565
|
-
style: {
|
|
1566
|
-
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
1567
|
-
flexShrink: shrink ? "1" : "0",
|
|
1568
|
-
marginLeft: push ? "auto" : 0,
|
|
1569
|
-
maxWidth: "100%"
|
|
1570
|
-
},
|
|
1571
|
-
children
|
|
1572
|
-
}
|
|
1573
|
-
);
|
|
1574
|
-
Inline.Item = InlineItem;
|
|
1575
|
-
|
|
1576
|
-
// ../platform-client/components/Link/index.ts
|
|
1577
|
-
init_react_import();
|
|
1578
|
-
|
|
1579
|
-
// ../platform-client/components/Link/Link.tsx
|
|
1580
|
-
init_react_import();
|
|
1581
|
-
|
|
1582
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Link/Link.module.css#css-module
|
|
1583
|
-
init_react_import();
|
|
1584
|
-
var Link_module_default = { "Link": "_Link_1j70m_1" };
|
|
1585
|
-
|
|
1586
|
-
// ../platform-client/components/Link/Link.tsx
|
|
1587
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1588
|
-
var getClassName12 = get_class_name_factory_default2("Link", Link_module_default);
|
|
1589
|
-
|
|
1590
|
-
// ../platform-client/components/Menu/index.tsx
|
|
1591
|
-
init_react_import();
|
|
1592
|
-
var import_react15 = require("react");
|
|
1593
|
-
|
|
1594
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Menu/styles.module.css#css-module
|
|
1595
|
-
init_react_import();
|
|
1596
|
-
var styles_module_default4 = { "Menu": "_Menu_1tu16_1", "Menu-content": "_Menu-content_1tu16_6", "Menu-sections": "_Menu-sections_1tu16_11", "Menu-action": "_Menu-action_1tu16_22", "Menu-list": "_Menu-list_1tu16_44", "Menu-item": "_Menu-item_1tu16_55", "Menu-item--disabled": "_Menu-item--disabled_1tu16_83" };
|
|
1597
|
-
|
|
1598
|
-
// ../platform-client/components/Menu/index.tsx
|
|
1599
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1600
|
-
var getClassName13 = get_class_name_factory_default2("Menu", styles_module_default4);
|
|
1601
|
-
var itemClassName = get_class_name_factory_default2("Menu-item", styles_module_default4);
|
|
1602
|
-
|
|
1603
|
-
// ../platform-client/components/Modal/index.ts
|
|
1604
|
-
init_react_import();
|
|
1605
|
-
|
|
1606
|
-
// ../platform-client/components/Page/index.ts
|
|
1607
|
-
init_react_import();
|
|
1608
|
-
|
|
1609
|
-
// ../platform-client/components/Page/Page.tsx
|
|
1610
|
-
init_react_import();
|
|
1611
|
-
|
|
1612
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Page/Page.module.css#css-module
|
|
1613
|
-
init_react_import();
|
|
1614
|
-
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" };
|
|
1615
|
-
|
|
1616
|
-
// ../platform-client/components/Page/Page.tsx
|
|
1617
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1618
|
-
var cx3 = getClassNameFactory2("Page", Page_module_default);
|
|
1619
|
-
|
|
1620
|
-
// ../platform-client/components/Pagination/index.ts
|
|
1621
|
-
init_react_import();
|
|
1622
|
-
|
|
1623
|
-
// ../platform-client/components/Pagination/Pagination.tsx
|
|
1624
|
-
init_react_import();
|
|
1625
|
-
var import_react16 = require("react");
|
|
1626
|
-
|
|
1627
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Pagination/Pagination.module.css#css-module
|
|
1628
|
-
init_react_import();
|
|
1629
|
-
var Pagination_module_default = { "Pagination": "_Pagination_1okv2_1", "PaginationButton": "_PaginationButton_1okv2_8", "PaginationButton--isActive": "_PaginationButton--isActive_1okv2_20", "Pagination-ellipsis": "_Pagination-ellipsis_1okv2_30" };
|
|
1630
|
-
|
|
1631
|
-
// ../platform-client/components/Pagination/Pagination.tsx
|
|
1632
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1633
|
-
var cx4 = getClassNameFactory2("Pagination", Pagination_module_default);
|
|
1634
|
-
var cxButton = getClassNameFactory2("PaginationButton", Pagination_module_default);
|
|
1635
|
-
|
|
1636
|
-
// ../platform-client/components/PlanGrid/index.tsx
|
|
1637
|
-
init_react_import();
|
|
1638
|
-
|
|
1639
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/PlanGrid/styles.module.css#css-module
|
|
1640
|
-
init_react_import();
|
|
1641
|
-
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" };
|
|
1642
|
-
|
|
1643
|
-
// ../utils/lib/format-currency.ts
|
|
1644
|
-
init_react_import();
|
|
1645
|
-
|
|
1646
|
-
// ../platform-client/lib/plan-ids.ts
|
|
1647
|
-
init_react_import();
|
|
1648
|
-
var PAYG_PLAN_ID = "pay-as-you-go_v2";
|
|
1649
|
-
var LAUNCH_PLAN_ID = "launch_monthly_v2";
|
|
1650
|
-
var GROWTH_PLAN_ID = "growth_monthly_v2";
|
|
1651
|
-
var PLAN_RANK = {
|
|
1652
|
-
[PAYG_PLAN_ID]: 0,
|
|
1653
|
-
[LAUNCH_PLAN_ID]: 1,
|
|
1654
|
-
[GROWTH_PLAN_ID]: 2
|
|
1655
|
-
};
|
|
1656
|
-
var LEGACY_PLAN_IDS = [
|
|
1657
|
-
"pro_monthly",
|
|
1658
|
-
"business_monthly",
|
|
1659
|
-
"growth_monthly",
|
|
1660
|
-
"pro_annual",
|
|
1661
|
-
"business_annual",
|
|
1662
|
-
"growth_annual",
|
|
1663
|
-
"pro50_monthly",
|
|
1664
|
-
"business200_monthly",
|
|
1665
|
-
"pro_unlimited_monthly",
|
|
1666
|
-
"business_unlimited_monthly"
|
|
1667
|
-
];
|
|
1668
|
-
var VALID_PLAN_IDS = [
|
|
1669
|
-
...LEGACY_PLAN_IDS,
|
|
1670
|
-
"pay-as-you-go_v2",
|
|
1671
|
-
"launch_monthly_v2",
|
|
1672
|
-
"growth_monthly_v2"
|
|
1673
|
-
];
|
|
1674
|
-
|
|
1675
|
-
// ../platform-client/components/PlanGrid/index.tsx
|
|
1676
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1677
|
-
var cx5 = get_class_name_factory_default("PlanGrid", styles_module_default5);
|
|
1678
|
-
|
|
1679
|
-
// ../platform-client/components/Section/index.ts
|
|
1680
|
-
init_react_import();
|
|
1681
|
-
|
|
1682
|
-
// ../platform-client/components/Section/Section.tsx
|
|
1683
|
-
init_react_import();
|
|
1684
|
-
|
|
1685
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Section/Section.module.css#css-module
|
|
1686
|
-
init_react_import();
|
|
1687
|
-
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" };
|
|
1688
|
-
|
|
1689
|
-
// ../platform-client/components/Section/Section.tsx
|
|
1690
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1691
|
-
var getClassName14 = getClassNameFactory2("Section", Section_module_default);
|
|
1692
|
-
|
|
1693
|
-
// ../platform-client/components/StatusTag/index.ts
|
|
1694
|
-
init_react_import();
|
|
1695
|
-
|
|
1696
|
-
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
1697
|
-
init_react_import();
|
|
1698
|
-
|
|
1699
|
-
// ../platform-client/components/Tag/index.ts
|
|
1700
|
-
init_react_import();
|
|
1701
|
-
|
|
1702
|
-
// ../platform-client/components/Tag/Tag.tsx
|
|
1703
|
-
init_react_import();
|
|
1704
|
-
|
|
1705
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Tag/Tag.module.css#css-module
|
|
1706
|
-
init_react_import();
|
|
1707
|
-
var Tag_module_default = { "Tag": "_Tag_s2h0n_1", "Tag--borderless": "_Tag--borderless_s2h0n_21", "Tag--colorBlue": "_Tag--colorBlue_s2h0n_25", "Tag--colorGreen": "_Tag--colorGreen_s2h0n_29", "Tag--colorRed": "_Tag--colorRed_s2h0n_33", "Tag--colorMuted": "_Tag--colorMuted_s2h0n_37", "Tag-sprite": "_Tag-sprite_s2h0n_41", "Tag--pulse": "_Tag--pulse_s2h0n_45", "pulse": "_pulse_s2h0n_1", "Tag-label": "_Tag-label_s2h0n_79" };
|
|
1708
|
-
|
|
1709
|
-
// ../platform-client/components/Tag/Tag.tsx
|
|
1710
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1711
|
-
var getClassName15 = getClassNameFactory2("Tag", Tag_module_default);
|
|
1712
|
-
|
|
1713
|
-
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
1714
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1715
|
-
|
|
1716
|
-
// ../platform-client/components/Table/index.ts
|
|
1717
|
-
init_react_import();
|
|
1718
|
-
|
|
1719
|
-
// ../platform-client/components/Table/Table.tsx
|
|
1144
|
+
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
1720
1145
|
init_react_import();
|
|
1721
|
-
var
|
|
1146
|
+
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" };
|
|
1722
1147
|
|
|
1723
|
-
//
|
|
1148
|
+
// src/components/PromptForm/index.tsx
|
|
1724
1149
|
init_react_import();
|
|
1725
|
-
var
|
|
1726
|
-
|
|
1727
|
-
// ../platform-client/components/Table/Table.tsx
|
|
1728
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1729
|
-
var getClassName16 = get_class_name_factory_default2("Table", Table_module_default);
|
|
1730
|
-
var getRowClassName = get_class_name_factory_default2("TableRow", Table_module_default);
|
|
1150
|
+
var import_react8 = require("react");
|
|
1731
1151
|
|
|
1732
1152
|
// ../platform-client/components/Textarea/index.tsx
|
|
1733
1153
|
init_react_import();
|
|
1734
1154
|
var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
|
|
1735
1155
|
|
|
1736
|
-
// ../platform-client/components/VerticalSpace/index.ts
|
|
1737
|
-
init_react_import();
|
|
1738
|
-
|
|
1739
|
-
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
1740
|
-
init_react_import();
|
|
1741
|
-
|
|
1742
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/VerticalSpace/VerticalSpace.module.css#css-module
|
|
1743
|
-
init_react_import();
|
|
1744
|
-
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" };
|
|
1745
|
-
|
|
1746
|
-
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
1747
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1748
|
-
var getClassName17 = get_class_name_factory_default2("VerticalSpace", VerticalSpace_module_default);
|
|
1749
|
-
|
|
1750
|
-
// ../platform-client/components/Viewport/index.tsx
|
|
1751
|
-
init_react_import();
|
|
1752
|
-
|
|
1753
|
-
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Viewport/styles.module.css#css-module
|
|
1754
|
-
init_react_import();
|
|
1755
|
-
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" };
|
|
1756
|
-
|
|
1757
|
-
// ../platform-client/components/Viewport/index.tsx
|
|
1758
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1759
|
-
var cx6 = getClassNameFactory("Viewport", styles_module_default6);
|
|
1760
|
-
|
|
1761
|
-
// ../platform-client/context/editor.tsx
|
|
1762
|
-
init_react_import();
|
|
1763
|
-
var import_react18 = require("react");
|
|
1764
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1765
|
-
var ctx = (0, import_react18.createContext)({});
|
|
1766
|
-
|
|
1767
|
-
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
1768
|
-
init_react_import();
|
|
1769
|
-
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" };
|
|
1770
|
-
|
|
1771
|
-
// src/components/PromptForm/index.tsx
|
|
1772
|
-
init_react_import();
|
|
1773
|
-
var import_react19 = require("react");
|
|
1774
|
-
|
|
1775
1156
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PromptForm/styles.module.css#css-module
|
|
1776
1157
|
init_react_import();
|
|
1777
|
-
var
|
|
1158
|
+
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" };
|
|
1778
1159
|
|
|
1779
1160
|
// src/lib/attachments.ts
|
|
1780
1161
|
init_react_import();
|
|
@@ -1861,6 +1242,20 @@ var resolveAttachmentUrl = (url, attachmentEndpoint) => {
|
|
|
1861
1242
|
}
|
|
1862
1243
|
return `${attachmentEndpoint.replace(/\/$/, "")}/${attachmentId}`;
|
|
1863
1244
|
};
|
|
1245
|
+
var fetchAttachmentUrl = async (endpoint, signal) => {
|
|
1246
|
+
const response = await fetch(endpoint, { redirect: "manual", signal });
|
|
1247
|
+
if (response.type === "opaqueredirect" || response.status >= 300 && response.status < 400) {
|
|
1248
|
+
return endpoint;
|
|
1249
|
+
}
|
|
1250
|
+
if (!response.ok) {
|
|
1251
|
+
throw new Error(`Attachment URL request failed with ${response.status}`);
|
|
1252
|
+
}
|
|
1253
|
+
const { url } = await response.json();
|
|
1254
|
+
if (typeof url !== "string" || !url) {
|
|
1255
|
+
throw new Error("Attachment URL response did not include a url");
|
|
1256
|
+
}
|
|
1257
|
+
return url;
|
|
1258
|
+
};
|
|
1864
1259
|
var isInternalMessage = (text) => text.startsWith(INTERNAL_MESSAGE_PREFIX);
|
|
1865
1260
|
var truncateFilename = (name, max = 25) => {
|
|
1866
1261
|
if (name.length <= max) return name;
|
|
@@ -1872,14 +1267,13 @@ var truncateFilename = (name, max = 25) => {
|
|
|
1872
1267
|
};
|
|
1873
1268
|
|
|
1874
1269
|
// src/components/PromptForm/index.tsx
|
|
1875
|
-
var
|
|
1876
|
-
var
|
|
1270
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1271
|
+
var cx = getClassNameFactory("PromptForm", styles_module_default4);
|
|
1877
1272
|
function PromptForm({
|
|
1878
1273
|
actions,
|
|
1879
1274
|
attachments,
|
|
1880
1275
|
onFileDrop,
|
|
1881
1276
|
onRemoveAttachment,
|
|
1882
|
-
colorScheme = "light",
|
|
1883
1277
|
glow,
|
|
1884
1278
|
handleSubmit,
|
|
1885
1279
|
helperText,
|
|
@@ -1892,13 +1286,13 @@ function PromptForm({
|
|
|
1892
1286
|
maxRows = 5,
|
|
1893
1287
|
value = ""
|
|
1894
1288
|
}) {
|
|
1895
|
-
const hasSetInitialPrompt = (0,
|
|
1896
|
-
const [prompt, setPrompt] = (0,
|
|
1897
|
-
const internalRef = (0,
|
|
1898
|
-
const [isDragOver, setIsDragOver] = (0,
|
|
1899
|
-
const dragCounterRef = (0,
|
|
1289
|
+
const hasSetInitialPrompt = (0, import_react8.useRef)(false);
|
|
1290
|
+
const [prompt, setPrompt] = (0, import_react8.useState)(value);
|
|
1291
|
+
const internalRef = (0, import_react8.useRef)(null);
|
|
1292
|
+
const [isDragOver, setIsDragOver] = (0, import_react8.useState)(false);
|
|
1293
|
+
const dragCounterRef = (0, import_react8.useRef)(0);
|
|
1900
1294
|
const canDrop = !!onFileDrop && !isDisabled && !isLoading;
|
|
1901
|
-
const handleDragEnter = (0,
|
|
1295
|
+
const handleDragEnter = (0, import_react8.useCallback)(
|
|
1902
1296
|
(e) => {
|
|
1903
1297
|
e.preventDefault();
|
|
1904
1298
|
dragCounterRef.current++;
|
|
@@ -1908,17 +1302,17 @@ function PromptForm({
|
|
|
1908
1302
|
},
|
|
1909
1303
|
[canDrop]
|
|
1910
1304
|
);
|
|
1911
|
-
const handleDragLeave = (0,
|
|
1305
|
+
const handleDragLeave = (0, import_react8.useCallback)((e) => {
|
|
1912
1306
|
e.preventDefault();
|
|
1913
1307
|
dragCounterRef.current--;
|
|
1914
1308
|
if (dragCounterRef.current === 0) {
|
|
1915
1309
|
setIsDragOver(false);
|
|
1916
1310
|
}
|
|
1917
1311
|
}, []);
|
|
1918
|
-
const handleDragOver = (0,
|
|
1312
|
+
const handleDragOver = (0, import_react8.useCallback)((e) => {
|
|
1919
1313
|
e.preventDefault();
|
|
1920
1314
|
}, []);
|
|
1921
|
-
const handleDrop = (0,
|
|
1315
|
+
const handleDrop = (0, import_react8.useCallback)(
|
|
1922
1316
|
(e) => {
|
|
1923
1317
|
e.preventDefault();
|
|
1924
1318
|
dragCounterRef.current = 0;
|
|
@@ -1932,7 +1326,7 @@ function PromptForm({
|
|
|
1932
1326
|
},
|
|
1933
1327
|
[canDrop, onFileDrop]
|
|
1934
1328
|
);
|
|
1935
|
-
const handlePaste = (0,
|
|
1329
|
+
const handlePaste = (0, import_react8.useCallback)(
|
|
1936
1330
|
(e) => {
|
|
1937
1331
|
if (!canDrop) return;
|
|
1938
1332
|
const files = getFilesFromClipboard(e.clipboardData);
|
|
@@ -1942,7 +1336,7 @@ function PromptForm({
|
|
|
1942
1336
|
},
|
|
1943
1337
|
[canDrop, onFileDrop]
|
|
1944
1338
|
);
|
|
1945
|
-
(0,
|
|
1339
|
+
(0, import_react8.useEffect)(() => {
|
|
1946
1340
|
setPrompt(value);
|
|
1947
1341
|
}, [setPrompt, value]);
|
|
1948
1342
|
const sendPrompt = async () => {
|
|
@@ -1957,7 +1351,7 @@ function PromptForm({
|
|
|
1957
1351
|
setPrompt("");
|
|
1958
1352
|
}
|
|
1959
1353
|
};
|
|
1960
|
-
(0,
|
|
1354
|
+
(0, import_react8.useEffect)(() => {
|
|
1961
1355
|
const currentUrl = new URL(location.href);
|
|
1962
1356
|
const initialPrompt = currentUrl.searchParams.get("initialPrompt");
|
|
1963
1357
|
if (!hasSetInitialPrompt.current && initialPrompt && prompt === "") {
|
|
@@ -1965,13 +1359,12 @@ function PromptForm({
|
|
|
1965
1359
|
setPrompt(initialPrompt);
|
|
1966
1360
|
}
|
|
1967
1361
|
}, [setPrompt]);
|
|
1968
|
-
return /* @__PURE__ */ (0,
|
|
1362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1969
1363
|
"div",
|
|
1970
1364
|
{
|
|
1971
|
-
className:
|
|
1365
|
+
className: cx({
|
|
1972
1366
|
isDisabled,
|
|
1973
1367
|
isLoading,
|
|
1974
|
-
dark: colorScheme === "dark",
|
|
1975
1368
|
glow,
|
|
1976
1369
|
userCta: !!cta
|
|
1977
1370
|
}),
|
|
@@ -1980,56 +1373,56 @@ function PromptForm({
|
|
|
1980
1373
|
onDragOver: onFileDrop ? handleDragOver : void 0,
|
|
1981
1374
|
onDrop: onFileDrop ? handleDrop : void 0,
|
|
1982
1375
|
children: [
|
|
1983
|
-
isDragOver ? /* @__PURE__ */ (0,
|
|
1984
|
-
/* @__PURE__ */ (0,
|
|
1985
|
-
/* @__PURE__ */ (0,
|
|
1376
|
+
isDragOver ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("dropOverlay"), children: [
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Paperclip, { size: 20 }),
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Attach file" })
|
|
1986
1379
|
] }) : null,
|
|
1987
|
-
helperText ? /* @__PURE__ */ (0,
|
|
1988
|
-
/* @__PURE__ */ (0,
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
1380
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cx("helper"), children: helperText }) : null,
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("inner"), children: [
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("glow") }),
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1991
1384
|
"form",
|
|
1992
1385
|
{
|
|
1993
1386
|
onSubmit: (e) => {
|
|
1994
1387
|
e.preventDefault();
|
|
1995
1388
|
void sendPrompt();
|
|
1996
1389
|
},
|
|
1997
|
-
children: /* @__PURE__ */ (0,
|
|
1998
|
-
attachments && attachments.length > 0 ? /* @__PURE__ */ (0,
|
|
1390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: cx("formInner"), children: [
|
|
1391
|
+
attachments && attachments.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: cx("attachments"), children: attachments.map((attachment) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1999
1392
|
"div",
|
|
2000
1393
|
{
|
|
2001
1394
|
className: [
|
|
2002
|
-
|
|
2003
|
-
attachment.status === "uploading" ?
|
|
2004
|
-
attachment.status === "failed" ?
|
|
1395
|
+
cx("attachmentChip"),
|
|
1396
|
+
attachment.status === "uploading" ? cx("attachmentChipUploading") : "",
|
|
1397
|
+
attachment.status === "failed" ? cx("attachmentChipFailed") : ""
|
|
2005
1398
|
].filter(Boolean).join(" "),
|
|
2006
1399
|
children: [
|
|
2007
|
-
attachment.status === "uploading" ? /* @__PURE__ */ (0,
|
|
1400
|
+
attachment.status === "uploading" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2008
1401
|
LoaderCircle,
|
|
2009
1402
|
{
|
|
2010
|
-
className:
|
|
1403
|
+
className: cx("attachmentSpinner"),
|
|
2011
1404
|
size: 14
|
|
2012
1405
|
}
|
|
2013
1406
|
) : null,
|
|
2014
|
-
/* @__PURE__ */ (0,
|
|
2015
|
-
attachment.status === "failed" ? /* @__PURE__ */ (0,
|
|
2016
|
-
onRemoveAttachment ? /* @__PURE__ */ (0,
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { title: attachment.filename, children: truncateFilename(attachment.filename) }),
|
|
1408
|
+
attachment.status === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: cx("attachmentError"), children: "Failed" }) : null,
|
|
1409
|
+
onRemoveAttachment ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2017
1410
|
"button",
|
|
2018
1411
|
{
|
|
2019
|
-
className:
|
|
1412
|
+
className: cx("attachmentRemove"),
|
|
2020
1413
|
onClick: () => onRemoveAttachment(attachment.clientId),
|
|
2021
1414
|
type: "button",
|
|
2022
|
-
children: /* @__PURE__ */ (0,
|
|
1415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(X, { size: 12 })
|
|
2023
1416
|
}
|
|
2024
1417
|
) : null
|
|
2025
1418
|
]
|
|
2026
1419
|
},
|
|
2027
1420
|
attachment.clientId
|
|
2028
1421
|
)) }) : null,
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2030
1423
|
import_react_textarea_autosize.default,
|
|
2031
1424
|
{
|
|
2032
|
-
className:
|
|
1425
|
+
className: cx("input"),
|
|
2033
1426
|
name: "prompt",
|
|
2034
1427
|
minRows,
|
|
2035
1428
|
maxRows,
|
|
@@ -2057,34 +1450,34 @@ function PromptForm({
|
|
|
2057
1450
|
}
|
|
2058
1451
|
}
|
|
2059
1452
|
),
|
|
2060
|
-
/* @__PURE__ */ (0,
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2061
1454
|
"div",
|
|
2062
1455
|
{
|
|
2063
|
-
className:
|
|
1456
|
+
className: cx("actions"),
|
|
2064
1457
|
onClick: () => {
|
|
2065
1458
|
internalRef?.current?.focus();
|
|
2066
1459
|
},
|
|
2067
1460
|
children: [
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2069
1462
|
"div",
|
|
2070
1463
|
{
|
|
2071
|
-
className:
|
|
1464
|
+
className: cx("actionsLeft"),
|
|
2072
1465
|
onClick: (e) => e.stopPropagation(),
|
|
2073
1466
|
children: actions
|
|
2074
1467
|
}
|
|
2075
1468
|
),
|
|
2076
|
-
/* @__PURE__ */ (0,
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2077
1470
|
"div",
|
|
2078
1471
|
{
|
|
2079
|
-
className:
|
|
1472
|
+
className: cx("actionsRight"),
|
|
2080
1473
|
onClick: (e) => e.stopPropagation(),
|
|
2081
|
-
children: /* @__PURE__ */ (0,
|
|
1474
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2082
1475
|
"button",
|
|
2083
1476
|
{
|
|
2084
|
-
className:
|
|
1477
|
+
className: cx("actionSubmit"),
|
|
2085
1478
|
type: "submit",
|
|
2086
1479
|
disabled: isLoading,
|
|
2087
|
-
children: isLoading ? /* @__PURE__ */ (0,
|
|
1480
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 18 }) : cta ?? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowUp, { size: 24 })
|
|
2088
1481
|
}
|
|
2089
1482
|
)
|
|
2090
1483
|
}
|
|
@@ -2103,18 +1496,47 @@ function PromptForm({
|
|
|
2103
1496
|
|
|
2104
1497
|
// src/lib/context.ts
|
|
2105
1498
|
init_react_import();
|
|
2106
|
-
var
|
|
2107
|
-
var toolStatusContext = (0,
|
|
1499
|
+
var import_react9 = require("react");
|
|
1500
|
+
var toolStatusContext = (0, import_react9.createContext)({});
|
|
2108
1501
|
var ToolStatusProvider = toolStatusContext.Provider;
|
|
2109
|
-
var hostContext = (0,
|
|
1502
|
+
var hostContext = (0, import_react9.createContext)(void 0);
|
|
2110
1503
|
var HostProvider = hostContext.Provider;
|
|
2111
|
-
var subagentStateContext = (0,
|
|
1504
|
+
var subagentStateContext = (0, import_react9.createContext)({});
|
|
2112
1505
|
var SubagentStateProvider = subagentStateContext.Provider;
|
|
2113
1506
|
|
|
1507
|
+
// src/lib/use-attachment-url.ts
|
|
1508
|
+
init_react_import();
|
|
1509
|
+
var import_react10 = require("react");
|
|
1510
|
+
function useAttachmentUrl(url, endpoint) {
|
|
1511
|
+
const isRef = getAttachmentIdFromRef(url) !== null;
|
|
1512
|
+
const [fetched, setFetched] = (0, import_react10.useState)();
|
|
1513
|
+
(0, import_react10.useEffect)(() => {
|
|
1514
|
+
if (!isRef) return;
|
|
1515
|
+
const controller = new AbortController();
|
|
1516
|
+
const loadUrl = async () => {
|
|
1517
|
+
try {
|
|
1518
|
+
const resolved = await fetchAttachmentUrl(
|
|
1519
|
+
resolveAttachmentUrl(url, endpoint),
|
|
1520
|
+
controller.signal
|
|
1521
|
+
);
|
|
1522
|
+
setFetched({ ref: url, url: resolved });
|
|
1523
|
+
} catch (error) {
|
|
1524
|
+
if (!controller.signal.aborted) {
|
|
1525
|
+
console.error("Failed to load attachment:", error);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
loadUrl();
|
|
1530
|
+
return () => controller.abort();
|
|
1531
|
+
}, [isRef, url, endpoint]);
|
|
1532
|
+
if (!isRef) return url;
|
|
1533
|
+
return fetched?.ref === url ? fetched.url : void 0;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
2114
1536
|
// src/components/ChatBody/index.tsx
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2117
|
-
var cxMessage =
|
|
1537
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1538
|
+
var cx2 = getClassNameFactory("Chat", styles_module_default3);
|
|
1539
|
+
var cxMessage = getClassNameFactory("ChatMessage", styles_module_default3);
|
|
2118
1540
|
function ChatBody({
|
|
2119
1541
|
actions,
|
|
2120
1542
|
attachments,
|
|
@@ -2137,45 +1559,45 @@ function ChatBody({
|
|
|
2137
1559
|
const lastMessage = hasMessages ? messages[messages.length - 1] : null;
|
|
2138
1560
|
const lastPart = lastMessage ? lastMessage.parts[lastMessage.parts.length - 1] : null;
|
|
2139
1561
|
const isLoading = status === "submitted" || status === "streaming" && !lastPart;
|
|
2140
|
-
return /* @__PURE__ */ (0,
|
|
1562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2141
1563
|
"div",
|
|
2142
1564
|
{
|
|
2143
|
-
className:
|
|
1565
|
+
className: cx2({
|
|
2144
1566
|
hasMessages,
|
|
2145
1567
|
hasChildren: !!children,
|
|
2146
1568
|
hideInput,
|
|
2147
1569
|
isLoading
|
|
2148
1570
|
}),
|
|
2149
1571
|
children: [
|
|
2150
|
-
children ? /* @__PURE__ */ (0,
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2153
|
-
/* @__PURE__ */ (0,
|
|
2154
|
-
isLoading && /* @__PURE__ */ (0,
|
|
2155
|
-
/* @__PURE__ */ (0,
|
|
2156
|
-
/* @__PURE__ */ (0,
|
|
1572
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("default"), children }) : null,
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("inner"), children: [
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("body"), ref: scrollRef, children: [
|
|
1575
|
+
/* @__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)) }),
|
|
1576
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("loader"), children: [
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("loaderIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loader, { size: 16 }) }),
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: "Thinking..." })
|
|
2157
1579
|
] })
|
|
2158
1580
|
] }),
|
|
2159
|
-
error && /* @__PURE__ */ (0,
|
|
2160
|
-
/* @__PURE__ */ (0,
|
|
2161
|
-
handleRetry && /* @__PURE__ */ (0,
|
|
1581
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("error"), children: [
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("errorLabel"), children: "Something went wrong." }),
|
|
1583
|
+
handleRetry && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("errorAction"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IconButton, { title: "Retry", onClick: handleRetry, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RotateCcw, { size: "14" }) }) })
|
|
2162
1584
|
] }),
|
|
2163
|
-
userError && /* @__PURE__ */ (0,
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2165
|
-
onDismissUserError && /* @__PURE__ */ (0,
|
|
1585
|
+
userError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("userError"), children: [
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: userError }),
|
|
1587
|
+
onDismissUserError && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2166
1588
|
"button",
|
|
2167
1589
|
{
|
|
2168
1590
|
"aria-label": "Dismiss",
|
|
2169
1591
|
title: "Dismiss",
|
|
2170
|
-
className:
|
|
1592
|
+
className: cx2("userErrorDismiss"),
|
|
2171
1593
|
onClick: onDismissUserError,
|
|
2172
1594
|
type: "button",
|
|
2173
|
-
children: /* @__PURE__ */ (0,
|
|
1595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(X, { size: 14 })
|
|
2174
1596
|
}
|
|
2175
1597
|
)
|
|
2176
1598
|
] }),
|
|
2177
|
-
/* @__PURE__ */ (0,
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cx2("form"), children: [
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2179
1601
|
PromptForm,
|
|
2180
1602
|
{
|
|
2181
1603
|
actions,
|
|
@@ -2189,7 +1611,7 @@ function ChatBody({
|
|
|
2189
1611
|
placeholder: "What do you want to build?"
|
|
2190
1612
|
}
|
|
2191
1613
|
),
|
|
2192
|
-
examplePrompts ? /* @__PURE__ */ (0,
|
|
1614
|
+
examplePrompts ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("examplePrompts"), children: examplePrompts }) : null
|
|
2193
1615
|
] })
|
|
2194
1616
|
] })
|
|
2195
1617
|
]
|
|
@@ -2214,17 +1636,17 @@ function mergeReasoningParts(parts) {
|
|
|
2214
1636
|
}
|
|
2215
1637
|
function ChatMessage({ message }) {
|
|
2216
1638
|
const { role, parts: rawParts } = message;
|
|
2217
|
-
const parts = (0,
|
|
1639
|
+
const parts = (0, import_react11.useMemo)(() => mergeReasoningParts(rawParts), [rawParts]);
|
|
2218
1640
|
if (role === "user") {
|
|
2219
1641
|
const attachmentParts = parts.filter((part) => part.type === "file");
|
|
2220
1642
|
const otherParts = parts.filter((part) => part.type !== "file");
|
|
2221
|
-
return /* @__PURE__ */ (0,
|
|
1643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2222
1644
|
"div",
|
|
2223
1645
|
{
|
|
2224
1646
|
className: cxMessage({ userRole: true }),
|
|
2225
1647
|
"data-message-id": message.id,
|
|
2226
|
-
children: /* @__PURE__ */ (0,
|
|
2227
|
-
otherParts.map((part, i) => /* @__PURE__ */ (0,
|
|
1648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: cxMessage("userBubble"), children: [
|
|
1649
|
+
otherParts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2228
1650
|
ChatMessagePart,
|
|
2229
1651
|
{
|
|
2230
1652
|
part,
|
|
@@ -2232,7 +1654,7 @@ function ChatMessage({ message }) {
|
|
|
2232
1654
|
},
|
|
2233
1655
|
`${message.id}-${part.type}-${i}`
|
|
2234
1656
|
)),
|
|
2235
|
-
attachmentParts.length > 0 ? /* @__PURE__ */ (0,
|
|
1657
|
+
attachmentParts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("userAttachments"), children: attachmentParts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2236
1658
|
ChatAttachmentThumbnail,
|
|
2237
1659
|
{
|
|
2238
1660
|
filename: part.filename,
|
|
@@ -2245,12 +1667,12 @@ function ChatMessage({ message }) {
|
|
|
2245
1667
|
}
|
|
2246
1668
|
);
|
|
2247
1669
|
}
|
|
2248
|
-
return /* @__PURE__ */ (0,
|
|
1670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2249
1671
|
"div",
|
|
2250
1672
|
{
|
|
2251
1673
|
className: cxMessage({ [`${role}Role`]: true }),
|
|
2252
1674
|
"data-message-id": message.id,
|
|
2253
|
-
children: parts.map((part, i) => /* @__PURE__ */ (0,
|
|
1675
|
+
children: parts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2254
1676
|
ChatMessagePart,
|
|
2255
1677
|
{
|
|
2256
1678
|
part,
|
|
@@ -2266,13 +1688,13 @@ function ChatAttachmentThumbnail({
|
|
|
2266
1688
|
mediaType,
|
|
2267
1689
|
url
|
|
2268
1690
|
}) {
|
|
2269
|
-
const host = (0,
|
|
1691
|
+
const host = (0, import_react11.useContext)(hostContext);
|
|
2270
1692
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2271
|
-
const resolvedUrl =
|
|
1693
|
+
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2272
1694
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2273
1695
|
const label = filename || attachmentId || "Attachment";
|
|
2274
1696
|
const isImage = mediaType.startsWith("image/");
|
|
2275
|
-
return /* @__PURE__ */ (0,
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2276
1698
|
"a",
|
|
2277
1699
|
{
|
|
2278
1700
|
"aria-label": label,
|
|
@@ -2282,8 +1704,8 @@ function ChatAttachmentThumbnail({
|
|
|
2282
1704
|
target: "_blank",
|
|
2283
1705
|
title: label,
|
|
2284
1706
|
children: [
|
|
2285
|
-
isImage ? /* @__PURE__ */ (0,
|
|
2286
|
-
/* @__PURE__ */ (0,
|
|
1707
|
+
isImage ? resolvedUrl && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { alt: label, src: resolvedUrl }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FileText, { size: 20 }),
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: cxMessage("thumbnailLabel"), children: label })
|
|
2287
1709
|
]
|
|
2288
1710
|
}
|
|
2289
1711
|
);
|
|
@@ -2298,24 +1720,24 @@ function ChatMessageWrapper({
|
|
|
2298
1720
|
role
|
|
2299
1721
|
}) {
|
|
2300
1722
|
if (role === "assistant" || role === "user") {
|
|
2301
|
-
return /* @__PURE__ */ (0,
|
|
1723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_markdown.default, { children });
|
|
2302
1724
|
}
|
|
2303
|
-
return /* @__PURE__ */ (0,
|
|
1725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children });
|
|
2304
1726
|
}
|
|
2305
1727
|
function ReasoningBlock({ part }) {
|
|
2306
|
-
const startTimeRef = (0,
|
|
2307
|
-
const [durationSecs, setDurationSecs] = (0,
|
|
1728
|
+
const startTimeRef = (0, import_react11.useRef)(null);
|
|
1729
|
+
const [durationSecs, setDurationSecs] = (0, import_react11.useState)(null);
|
|
2308
1730
|
if (part.state !== "done" && startTimeRef.current === null) {
|
|
2309
1731
|
startTimeRef.current = Date.now();
|
|
2310
1732
|
}
|
|
2311
|
-
(0,
|
|
1733
|
+
(0, import_react11.useEffect)(() => {
|
|
2312
1734
|
if (part.state === "done" && startTimeRef.current !== null) {
|
|
2313
1735
|
setDurationSecs(Math.round((Date.now() - startTimeRef.current) / 1e3));
|
|
2314
1736
|
}
|
|
2315
1737
|
}, [part.state]);
|
|
2316
1738
|
const loading = part.state ? part.state !== "done" : false;
|
|
2317
1739
|
const label = durationSecs !== null ? `Thought for ${durationSecs}s` : !loading ? "Thought for a while" : "Thinking...";
|
|
2318
|
-
return /* @__PURE__ */ (0,
|
|
1740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2319
1741
|
ChatEvent,
|
|
2320
1742
|
{
|
|
2321
1743
|
status: {
|
|
@@ -2323,7 +1745,7 @@ function ReasoningBlock({ part }) {
|
|
|
2323
1745
|
loading,
|
|
2324
1746
|
summary: part.text
|
|
2325
1747
|
},
|
|
2326
|
-
icon: /* @__PURE__ */ (0,
|
|
1748
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Brain, { size: 18 })
|
|
2327
1749
|
}
|
|
2328
1750
|
);
|
|
2329
1751
|
}
|
|
@@ -2332,19 +1754,19 @@ function ChatMessagePart({
|
|
|
2332
1754
|
role
|
|
2333
1755
|
}) {
|
|
2334
1756
|
if (part.type === "text") {
|
|
2335
|
-
return /* @__PURE__ */ (0,
|
|
1757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChatMessageWrapper, { role, children: part.text }) });
|
|
2336
1758
|
}
|
|
2337
1759
|
if (part.type === "reasoning") {
|
|
2338
|
-
return /* @__PURE__ */ (0,
|
|
1760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReasoningBlock, { part });
|
|
2339
1761
|
}
|
|
2340
1762
|
if (part.type === "tool-subagent") {
|
|
2341
|
-
return /* @__PURE__ */ (0,
|
|
1763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SubagentBlock, { toolCallId: part.toolCallId });
|
|
2342
1764
|
}
|
|
2343
1765
|
if (part.type.startsWith("tool-")) {
|
|
2344
|
-
return /* @__PURE__ */ (0,
|
|
1766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PuckTool, { ...part });
|
|
2345
1767
|
}
|
|
2346
1768
|
if (part.type === "file") {
|
|
2347
|
-
return /* @__PURE__ */ (0,
|
|
1769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2348
1770
|
ChatAttachment,
|
|
2349
1771
|
{
|
|
2350
1772
|
filename: part.filename,
|
|
@@ -2360,17 +1782,17 @@ function ChatAttachment({
|
|
|
2360
1782
|
mediaType,
|
|
2361
1783
|
url
|
|
2362
1784
|
}) {
|
|
2363
|
-
const host = (0,
|
|
1785
|
+
const host = (0, import_react11.useContext)(hostContext);
|
|
2364
1786
|
const endpoint = host ? `${host.replace(/\/$/, "")}/attachments` : "/api/puck/chat/attachments";
|
|
2365
|
-
const resolvedUrl =
|
|
1787
|
+
const resolvedUrl = useAttachmentUrl(url, endpoint);
|
|
2366
1788
|
const attachmentId = getAttachmentIdFromRef(url);
|
|
2367
1789
|
const label = filename || attachmentId || "Attachment";
|
|
2368
1790
|
if (mediaType.startsWith("image/")) {
|
|
2369
|
-
return /* @__PURE__ */ (0,
|
|
1791
|
+
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 }) }) });
|
|
2370
1792
|
}
|
|
2371
|
-
return /* @__PURE__ */ (0,
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2373
|
-
/* @__PURE__ */ (0,
|
|
1793
|
+
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: [
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FileText, { size: 16 }),
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
|
|
2374
1796
|
] }) });
|
|
2375
1797
|
}
|
|
2376
1798
|
function PuckTool({
|
|
@@ -2379,68 +1801,67 @@ function PuckTool({
|
|
|
2379
1801
|
defaultLabel = "Thinking...",
|
|
2380
1802
|
type
|
|
2381
1803
|
}) {
|
|
2382
|
-
const toolStatus = (0,
|
|
1804
|
+
const toolStatus = (0, import_react11.useContext)(toolStatusContext)[toolCallId];
|
|
2383
1805
|
const outputObj = output;
|
|
2384
1806
|
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus ?? { loading: true, label: defaultLabel };
|
|
2385
|
-
let icon = (0,
|
|
1807
|
+
let icon = (0, import_react11.useMemo)(() => {
|
|
2386
1808
|
if (type === "tool-write") {
|
|
2387
|
-
return /* @__PURE__ */ (0,
|
|
1809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Pen, { size: 18 });
|
|
2388
1810
|
} else if (type === "tool-refreshPageData") {
|
|
2389
|
-
return /* @__PURE__ */ (0,
|
|
1811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GitPullRequest, { size: 18 });
|
|
2390
1812
|
} else if (type === "tool-takeScreenshot") {
|
|
2391
|
-
return /* @__PURE__ */ (0,
|
|
1813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Camera, { size: 18 });
|
|
2392
1814
|
} else if (type === "tool-fetchUrl") {
|
|
2393
|
-
return /* @__PURE__ */ (0,
|
|
1815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CloudDownload, { size: 18 });
|
|
2394
1816
|
} else if (type === "tool-screenshotUrl") {
|
|
2395
|
-
return /* @__PURE__ */ (0,
|
|
1817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Camera, { size: 18 });
|
|
2396
1818
|
}
|
|
2397
|
-
return /* @__PURE__ */ (0,
|
|
1819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Check, { size: 18 });
|
|
2398
1820
|
}, [type]);
|
|
2399
|
-
return /* @__PURE__ */ (0,
|
|
1821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChatEvent, { status, icon });
|
|
2400
1822
|
}
|
|
2401
1823
|
function SubagentBlock({ toolCallId }) {
|
|
2402
|
-
const subagentState = (0,
|
|
1824
|
+
const subagentState = (0, import_react11.useContext)(subagentStateContext);
|
|
2403
1825
|
const state = subagentState[toolCallId];
|
|
2404
|
-
const toolStatusMap = (0,
|
|
1826
|
+
const toolStatusMap = (0, import_react11.useContext)(toolStatusContext);
|
|
2405
1827
|
const toolStatus = toolStatusMap[toolCallId];
|
|
2406
1828
|
const fallbackLabel = toolStatus?.label ?? "Running subagent";
|
|
2407
1829
|
const label = state?.label ? state.state === "done" ? `${state.agentType} subagent complete` : state.label : fallbackLabel;
|
|
2408
1830
|
const loading = state ? state.state !== "done" : toolStatus?.loading ?? true;
|
|
2409
1831
|
const hasBody = !!state && state.parts.length > 0;
|
|
2410
1832
|
const parts = state?.parts ?? [];
|
|
2411
|
-
const [isOpen, setIsOpen] = (0,
|
|
2412
|
-
return /* @__PURE__ */ (0,
|
|
1833
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
1834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2413
1835
|
"details",
|
|
2414
1836
|
{
|
|
2415
1837
|
className: cxMessage("event"),
|
|
2416
1838
|
onToggle: (e) => setIsOpen(e.currentTarget.open),
|
|
2417
1839
|
children: [
|
|
2418
|
-
/* @__PURE__ */ (0,
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2419
1841
|
"summary",
|
|
2420
1842
|
{
|
|
2421
|
-
className: cxMessage("eventHeader")
|
|
2422
|
-
style: hasBody ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
1843
|
+
className: `${cxMessage("eventHeader")} ${hasBody ? "" : cxMessage("eventHeader--static")}`,
|
|
2423
1844
|
children: [
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2426
|
-
hasBody && /* @__PURE__ */ (0,
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2428
|
-
/* @__PURE__ */ (0,
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventIcon"), children: loading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Loader, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Bot, { size: 18 }) }),
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventLabel"), children: label }),
|
|
1847
|
+
hasBody && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Plus, { size: 12 }) }),
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Minus, { size: 12 }) })
|
|
2429
1850
|
] })
|
|
2430
1851
|
]
|
|
2431
1852
|
}
|
|
2432
1853
|
),
|
|
2433
|
-
hasBody && isOpen && /* @__PURE__ */ (0,
|
|
1854
|
+
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}`)) })
|
|
2434
1855
|
]
|
|
2435
1856
|
}
|
|
2436
1857
|
);
|
|
2437
1858
|
}
|
|
2438
1859
|
function SubagentChildPartRenderer({ part }) {
|
|
2439
1860
|
if (part.kind === "text") {
|
|
2440
|
-
return /* @__PURE__ */ (0,
|
|
1861
|
+
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 }) });
|
|
2441
1862
|
}
|
|
2442
1863
|
if (part.kind === "reasoning") {
|
|
2443
|
-
return /* @__PURE__ */ (0,
|
|
1864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2444
1865
|
ReasoningBlock,
|
|
2445
1866
|
{
|
|
2446
1867
|
part: {
|
|
@@ -2452,7 +1873,7 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2452
1873
|
);
|
|
2453
1874
|
}
|
|
2454
1875
|
if (part.toolName === "subagent") {
|
|
2455
|
-
return /* @__PURE__ */ (0,
|
|
1876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SubagentBlock, { toolCallId: part.childToolCallId });
|
|
2456
1877
|
}
|
|
2457
1878
|
const synthesized = {
|
|
2458
1879
|
toolCallId: part.childToolCallId,
|
|
@@ -2461,35 +1882,34 @@ function SubagentChildPartRenderer({ part }) {
|
|
|
2461
1882
|
input: part.input,
|
|
2462
1883
|
output: part.output
|
|
2463
1884
|
};
|
|
2464
|
-
return /* @__PURE__ */ (0,
|
|
1885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PuckTool, { ...synthesized });
|
|
2465
1886
|
}
|
|
2466
1887
|
function ChatEvent({
|
|
2467
1888
|
status,
|
|
2468
|
-
icon = /* @__PURE__ */ (0,
|
|
1889
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Check, { size: 18 })
|
|
2469
1890
|
}) {
|
|
2470
|
-
const [isOpen, setIsOpen] = (0,
|
|
2471
|
-
return /* @__PURE__ */ (0,
|
|
1891
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
1892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2472
1893
|
"details",
|
|
2473
1894
|
{
|
|
2474
1895
|
className: cxMessage("event"),
|
|
2475
1896
|
onToggle: (e) => setIsOpen(e.currentTarget.open),
|
|
2476
1897
|
children: [
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2478
1899
|
"summary",
|
|
2479
1900
|
{
|
|
2480
|
-
className: cxMessage("eventHeader")
|
|
2481
|
-
style: status.summary ? {} : { color: "var(--puck-color-grey-05) !important", cursor: "unset" },
|
|
1901
|
+
className: `${cxMessage("eventHeader")} ${status.summary ? "" : cxMessage("eventHeader--static")}`,
|
|
2482
1902
|
children: [
|
|
2483
|
-
/* @__PURE__ */ (0,
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2485
|
-
status.summary && /* @__PURE__ */ (0,
|
|
2486
|
-
/* @__PURE__ */ (0,
|
|
2487
|
-
/* @__PURE__ */ (0,
|
|
1903
|
+
/* @__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 }) : icon }),
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: status.label }),
|
|
1905
|
+
status.summary && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1906
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventExpand"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Plus, { size: 12 }) }),
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cxMessage("eventCollapse"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Minus, { size: 12 }) })
|
|
2488
1908
|
] })
|
|
2489
1909
|
]
|
|
2490
1910
|
}
|
|
2491
1911
|
),
|
|
2492
|
-
status.summary && isOpen && /* @__PURE__ */ (0,
|
|
1912
|
+
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 }) })
|
|
2493
1913
|
]
|
|
2494
1914
|
}
|
|
2495
1915
|
);
|
|
@@ -2500,15 +1920,15 @@ function ExamplePrompt({
|
|
|
2500
1920
|
onClick,
|
|
2501
1921
|
disabled
|
|
2502
1922
|
}) {
|
|
2503
|
-
const content = /* @__PURE__ */ (0,
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
1923
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: label }),
|
|
1925
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cx2("examplePromptArrow"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ArrowUp, { size: "16" }) })
|
|
2506
1926
|
] });
|
|
2507
1927
|
if (href) {
|
|
2508
|
-
return /* @__PURE__ */ (0,
|
|
1928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2509
1929
|
"a",
|
|
2510
1930
|
{
|
|
2511
|
-
className:
|
|
1931
|
+
className: cx2("examplePrompt"),
|
|
2512
1932
|
href: disabled ? void 0 : href,
|
|
2513
1933
|
"aria-disabled": disabled || void 0,
|
|
2514
1934
|
onClick: (e) => {
|
|
@@ -2522,10 +1942,10 @@ function ExamplePrompt({
|
|
|
2522
1942
|
}
|
|
2523
1943
|
);
|
|
2524
1944
|
}
|
|
2525
|
-
return /* @__PURE__ */ (0,
|
|
1945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2526
1946
|
"button",
|
|
2527
1947
|
{
|
|
2528
|
-
className:
|
|
1948
|
+
className: cx2("examplePrompt"),
|
|
2529
1949
|
type: "button",
|
|
2530
1950
|
disabled,
|
|
2531
1951
|
onClick,
|
|
@@ -2559,26 +1979,26 @@ init_react_import();
|
|
|
2559
1979
|
|
|
2560
1980
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/DesignModeToggle/styles.module.css#css-module
|
|
2561
1981
|
init_react_import();
|
|
2562
|
-
var
|
|
1982
|
+
var styles_module_default5 = { "DesignModeToggle": "_DesignModeToggle_vng7q_1", "DesignModeToggle-button": "_DesignModeToggle-button_vng7q_8", "DesignModeToggle-button--active": "_DesignModeToggle-button--active_vng7q_32" };
|
|
2563
1983
|
|
|
2564
1984
|
// src/components/DesignModeToggle/index.tsx
|
|
2565
|
-
var
|
|
2566
|
-
var
|
|
1985
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1986
|
+
var cx3 = getClassNameFactory("DesignModeToggle", styles_module_default5);
|
|
2567
1987
|
function DesignModeToggle({
|
|
2568
1988
|
active,
|
|
2569
1989
|
onToggle,
|
|
2570
1990
|
disabled
|
|
2571
1991
|
}) {
|
|
2572
|
-
return /* @__PURE__ */ (0,
|
|
1992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cx3(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2573
1993
|
"button",
|
|
2574
1994
|
{
|
|
2575
|
-
className: `${
|
|
1995
|
+
className: `${cx3("button")} ${active ? cx3("button--active") : ""}`,
|
|
2576
1996
|
onClick: onToggle,
|
|
2577
1997
|
disabled,
|
|
2578
1998
|
type: "button",
|
|
2579
1999
|
title: active ? "Disable design mode" : "Enable design mode",
|
|
2580
2000
|
children: [
|
|
2581
|
-
/* @__PURE__ */ (0,
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WandSparkles, { size: 12 }),
|
|
2582
2002
|
"Design"
|
|
2583
2003
|
]
|
|
2584
2004
|
}
|
|
@@ -2587,12 +2007,12 @@ function DesignModeToggle({
|
|
|
2587
2007
|
|
|
2588
2008
|
// src/lib/design/runtime.tsx
|
|
2589
2009
|
init_react_import();
|
|
2590
|
-
var
|
|
2010
|
+
var import_core3 = require("@puckeditor/core");
|
|
2591
2011
|
|
|
2592
2012
|
// src/lib/design/component.tsx
|
|
2593
2013
|
init_react_import();
|
|
2594
|
-
var
|
|
2595
|
-
var
|
|
2014
|
+
var import_core2 = require("@puckeditor/core");
|
|
2015
|
+
var import_react14 = require("react");
|
|
2596
2016
|
|
|
2597
2017
|
// src/lib/morph-html.ts
|
|
2598
2018
|
init_react_import();
|
|
@@ -3454,7 +2874,7 @@ var registrationStore = new RegistrationStore();
|
|
|
3454
2874
|
|
|
3455
2875
|
// src/lib/design/inline-editing.ts
|
|
3456
2876
|
init_react_import();
|
|
3457
|
-
var
|
|
2877
|
+
var import_core = require("@puckeditor/core");
|
|
3458
2878
|
var CONTENT_EDITABLE_ATTR = "data-puck-content-editable";
|
|
3459
2879
|
var isInlineEditingDisabled = (el) => el.closest(`[${CONTENT_EDITABLE_ATTR}="false"]`) !== null;
|
|
3460
2880
|
var cssEscape = (value) => typeof CSS !== "undefined" && CSS.escape ? CSS.escape(value) : value.replace(/["\\]/g, "\\$&");
|
|
@@ -3535,7 +2955,7 @@ var attachInlineEditing = (el, {
|
|
|
3535
2955
|
mode,
|
|
3536
2956
|
getPuck
|
|
3537
2957
|
}) => {
|
|
3538
|
-
const cleanupPortal = (0,
|
|
2958
|
+
const cleanupPortal = (0, import_core.registerOverlayPortal)(el);
|
|
3539
2959
|
let hovering = false;
|
|
3540
2960
|
let focused = false;
|
|
3541
2961
|
const syncEditable = () => {
|
|
@@ -3560,7 +2980,7 @@ var attachInlineEditing = (el, {
|
|
|
3560
2980
|
type: "replace",
|
|
3561
2981
|
destinationIndex: selector.index,
|
|
3562
2982
|
destinationZone: selector.zone,
|
|
3563
|
-
data: { ...item, props: (0,
|
|
2983
|
+
data: { ...item, props: (0, import_core.setDeep)(item.props, propPath, nextValue) }
|
|
3564
2984
|
});
|
|
3565
2985
|
resolveDataById(componentId, "replace");
|
|
3566
2986
|
};
|
|
@@ -3705,7 +3125,7 @@ var wireArrayItemEditing = ({
|
|
|
3705
3125
|
// src/lib/design/render-html.tsx
|
|
3706
3126
|
init_react_import();
|
|
3707
3127
|
var import_htmlparser22 = require("htmlparser2");
|
|
3708
|
-
var
|
|
3128
|
+
var import_react12 = require("react");
|
|
3709
3129
|
var VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3710
3130
|
"area",
|
|
3711
3131
|
"base",
|
|
@@ -3768,7 +3188,7 @@ var nodeToReact = (node, slots, key) => {
|
|
|
3768
3188
|
if (isEventHandlerAttr2(name)) continue;
|
|
3769
3189
|
props2[REACT_PROP_NAMES[name] || name] = value;
|
|
3770
3190
|
}
|
|
3771
|
-
return (0,
|
|
3191
|
+
return (0, import_react12.createElement)(tag, props2, slots[slotName]);
|
|
3772
3192
|
}
|
|
3773
3193
|
const props = { key };
|
|
3774
3194
|
for (const [name, value] of Object.entries(attribs)) {
|
|
@@ -3780,10 +3200,10 @@ var nodeToReact = (node, slots, key) => {
|
|
|
3780
3200
|
}
|
|
3781
3201
|
}
|
|
3782
3202
|
if (VOID_ELEMENTS.has(tag)) {
|
|
3783
|
-
return (0,
|
|
3203
|
+
return (0, import_react12.createElement)(tag, props);
|
|
3784
3204
|
}
|
|
3785
3205
|
const children = el.children.map((child, i) => nodeToReact(child, slots, i)).filter((c) => c !== null);
|
|
3786
|
-
return (0,
|
|
3206
|
+
return (0, import_react12.createElement)(tag, props, ...children);
|
|
3787
3207
|
};
|
|
3788
3208
|
var htmlToReactTree = (html, slots) => {
|
|
3789
3209
|
if (!html) return null;
|
|
@@ -3791,14 +3211,14 @@ var htmlToReactTree = (html, slots) => {
|
|
|
3791
3211
|
const children = doc.children.map((child, i) => nodeToReact(child, slots, i)).filter((c) => c !== null);
|
|
3792
3212
|
if (children.length === 0) return null;
|
|
3793
3213
|
if (children.length === 1) return children[0];
|
|
3794
|
-
return (0,
|
|
3214
|
+
return (0, import_react12.createElement)(import_react12.Fragment, null, ...children);
|
|
3795
3215
|
};
|
|
3796
3216
|
|
|
3797
3217
|
// src/lib/design/slot-portal.tsx
|
|
3798
3218
|
init_react_import();
|
|
3799
|
-
var
|
|
3219
|
+
var import_react13 = require("react");
|
|
3800
3220
|
var import_react_dom = require("react-dom");
|
|
3801
|
-
var
|
|
3221
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3802
3222
|
var parseInlineStyle = (cssText) => {
|
|
3803
3223
|
const style = {};
|
|
3804
3224
|
for (const declaration of cssText.split(";")) {
|
|
@@ -3820,13 +3240,13 @@ var SlotPortal = ({
|
|
|
3820
3240
|
slotClassName,
|
|
3821
3241
|
SlotContent
|
|
3822
3242
|
}) => {
|
|
3823
|
-
const [target, setTarget] = (0,
|
|
3824
|
-
const lastTarget = (0,
|
|
3825
|
-
const style = (0,
|
|
3243
|
+
const [target, setTarget] = (0, import_react13.useState)(null);
|
|
3244
|
+
const lastTarget = (0, import_react13.useRef)(null);
|
|
3245
|
+
const style = (0, import_react13.useMemo)(
|
|
3826
3246
|
() => slotStyle ? parseInlineStyle(slotStyle) : void 0,
|
|
3827
3247
|
[slotStyle]
|
|
3828
3248
|
);
|
|
3829
|
-
(0,
|
|
3249
|
+
(0, import_react13.useEffect)(() => {
|
|
3830
3250
|
const el = entry.querySelector(`[data-puck-slot="${cssEscape(slotName)}"]`);
|
|
3831
3251
|
if (el !== lastTarget.current) {
|
|
3832
3252
|
el?.replaceChildren();
|
|
@@ -3840,13 +3260,13 @@ var SlotPortal = ({
|
|
|
3840
3260
|
}, [entry, html, slotName]);
|
|
3841
3261
|
if (!target || typeof SlotContent !== "function") return null;
|
|
3842
3262
|
return (0, import_react_dom.createPortal)(
|
|
3843
|
-
/* @__PURE__ */ (0,
|
|
3263
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SlotContent, { style, className: slotClassName || void 0 }),
|
|
3844
3264
|
target
|
|
3845
3265
|
);
|
|
3846
3266
|
};
|
|
3847
3267
|
|
|
3848
3268
|
// src/lib/design/component.tsx
|
|
3849
|
-
var
|
|
3269
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3850
3270
|
var DESIGN_COMPONENT = Symbol("puck-ai.designComponent");
|
|
3851
3271
|
var isDesignComponent = (config) => !!config?.[DESIGN_COMPONENT];
|
|
3852
3272
|
var streamingValues = /* @__PURE__ */ new Map();
|
|
@@ -3932,13 +3352,13 @@ function createDesignComponentConfig(registration) {
|
|
|
3932
3352
|
}
|
|
3933
3353
|
return resolvedFields;
|
|
3934
3354
|
},
|
|
3935
|
-
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ (0,
|
|
3355
|
+
render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EditorEntry, { ...renderProps }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Entry, { ...renderProps, getPuck: null })
|
|
3936
3356
|
};
|
|
3937
3357
|
componentConfig[DESIGN_COMPONENT] = true;
|
|
3938
3358
|
return componentConfig;
|
|
3939
3359
|
function EditorEntry(renderProps) {
|
|
3940
|
-
const getPuck = (0,
|
|
3941
|
-
return /* @__PURE__ */ (0,
|
|
3360
|
+
const getPuck = (0, import_core2.useGetPuck)();
|
|
3361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Entry, { ...renderProps, getPuck });
|
|
3942
3362
|
}
|
|
3943
3363
|
function Entry({
|
|
3944
3364
|
getPuck,
|
|
@@ -3947,11 +3367,11 @@ function createDesignComponentConfig(registration) {
|
|
|
3947
3367
|
style,
|
|
3948
3368
|
...props
|
|
3949
3369
|
}) {
|
|
3950
|
-
const getSnapshot = (0,
|
|
3370
|
+
const getSnapshot = (0, import_react14.useCallback)(
|
|
3951
3371
|
() => registrationStore.get(name) ?? registration,
|
|
3952
3372
|
[]
|
|
3953
3373
|
);
|
|
3954
|
-
const reg = (0,
|
|
3374
|
+
const reg = (0, import_react14.useSyncExternalStore)(
|
|
3955
3375
|
registrationStore.subscribe,
|
|
3956
3376
|
getSnapshot,
|
|
3957
3377
|
getSnapshot
|
|
@@ -3959,10 +3379,10 @@ function createDesignComponentConfig(registration) {
|
|
|
3959
3379
|
const html = reg.html ?? "";
|
|
3960
3380
|
const styles = reg.styles;
|
|
3961
3381
|
const script = reg.script;
|
|
3962
|
-
const [entryEl, setEntryEl] = (0,
|
|
3963
|
-
const scriptRef = (0,
|
|
3964
|
-
const annotations = (0,
|
|
3965
|
-
const { attrFields, arrayFields, attrSig, arraySig } = (0,
|
|
3382
|
+
const [entryEl, setEntryEl] = (0, import_react14.useState)(null);
|
|
3383
|
+
const scriptRef = (0, import_react14.useRef)(null);
|
|
3384
|
+
const annotations = (0, import_react14.useMemo)(() => getAnnotations(html), [html]);
|
|
3385
|
+
const { attrFields, arrayFields, attrSig, arraySig } = (0, import_react14.useMemo)(() => {
|
|
3966
3386
|
const attr = [];
|
|
3967
3387
|
const arrays = [];
|
|
3968
3388
|
for (const field of annotations.fields) {
|
|
@@ -3984,11 +3404,11 @@ function createDesignComponentConfig(registration) {
|
|
|
3984
3404
|
arraySig: JSON.stringify(arrays)
|
|
3985
3405
|
};
|
|
3986
3406
|
}, [props, annotations]);
|
|
3987
|
-
const patchedHtml = (0,
|
|
3407
|
+
const patchedHtml = (0, import_react14.useMemo)(() => {
|
|
3988
3408
|
if (puck.isEditing) return html;
|
|
3989
3409
|
return patchHtmlAnnotations(html, props);
|
|
3990
3410
|
}, [html, props, puck.isEditing]);
|
|
3991
|
-
const fieldValueAttrs = (0,
|
|
3411
|
+
const fieldValueAttrs = (0, import_react14.useMemo)(() => {
|
|
3992
3412
|
const attrs = {};
|
|
3993
3413
|
attrs["data-puck-design"] = name;
|
|
3994
3414
|
for (const field of annotations.fields) {
|
|
@@ -3999,17 +3419,17 @@ function createDesignComponentConfig(registration) {
|
|
|
3999
3419
|
}
|
|
4000
3420
|
return attrs;
|
|
4001
3421
|
}, [annotations, props, puck.isEditing]);
|
|
4002
|
-
const editorEntryNode = (0,
|
|
4003
|
-
() => puck.isEditing ? /* @__PURE__ */ (0,
|
|
3422
|
+
const editorEntryNode = (0, import_react14.useMemo)(
|
|
3423
|
+
() => puck.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: setEntryEl }) : null,
|
|
4004
3424
|
[puck.isEditing]
|
|
4005
3425
|
);
|
|
4006
|
-
(0,
|
|
3426
|
+
(0, import_react14.useEffect)(() => {
|
|
4007
3427
|
if (!puck.isEditing || !getPuck) return;
|
|
4008
3428
|
getPuck().resolveDataById(id, "force");
|
|
4009
3429
|
}, [reg, puck.isEditing, getPuck, id]);
|
|
4010
|
-
const fieldWiring = (0,
|
|
4011
|
-
const morphed = (0,
|
|
4012
|
-
(0,
|
|
3430
|
+
const fieldWiring = (0, import_react14.useRef)(/* @__PURE__ */ new Map());
|
|
3431
|
+
const morphed = (0, import_react14.useRef)(null);
|
|
3432
|
+
(0, import_react14.useLayoutEffect)(() => {
|
|
4013
3433
|
if (!puck.isEditing || !entryEl) return;
|
|
4014
3434
|
if (morphed.current?.el !== entryEl || morphed.current?.html !== html || morphed.current?.attrSig !== attrSig) {
|
|
4015
3435
|
morphed.current = { el: entryEl, html, attrSig };
|
|
@@ -4026,14 +3446,14 @@ function createDesignComponentConfig(registration) {
|
|
|
4026
3446
|
});
|
|
4027
3447
|
}
|
|
4028
3448
|
});
|
|
4029
|
-
(0,
|
|
3449
|
+
(0, import_react14.useEffect)(
|
|
4030
3450
|
() => () => {
|
|
4031
3451
|
fieldWiring.current.forEach((cleanup) => cleanup());
|
|
4032
3452
|
fieldWiring.current.clear();
|
|
4033
3453
|
},
|
|
4034
3454
|
[]
|
|
4035
3455
|
);
|
|
4036
|
-
(0,
|
|
3456
|
+
(0, import_react14.useEffect)(() => {
|
|
4037
3457
|
if (!entryEl || !puck.isEditing) return;
|
|
4038
3458
|
for (const attr of Array.from(entryEl.attributes)) {
|
|
4039
3459
|
if ((attr.name === "data-puck-design" || attr.name.startsWith("data-puck-field-value-")) && !(attr.name in fieldValueAttrs)) {
|
|
@@ -4046,10 +3466,10 @@ function createDesignComponentConfig(registration) {
|
|
|
4046
3466
|
}
|
|
4047
3467
|
}
|
|
4048
3468
|
}, [entryEl, fieldValueAttrs]);
|
|
4049
|
-
const appliedArrayHtml = (0,
|
|
4050
|
-
const arrayItemWiring = (0,
|
|
4051
|
-
const appliedArrays = (0,
|
|
4052
|
-
(0,
|
|
3469
|
+
const appliedArrayHtml = (0, import_react14.useRef)(/* @__PURE__ */ new WeakMap());
|
|
3470
|
+
const arrayItemWiring = (0, import_react14.useRef)({});
|
|
3471
|
+
const appliedArrays = (0, import_react14.useRef)(null);
|
|
3472
|
+
(0, import_react14.useEffect)(() => {
|
|
4053
3473
|
if (!puck.isEditing || !entryEl || !getPuck) return;
|
|
4054
3474
|
if (appliedArrays.current?.el === entryEl && appliedArrays.current?.html === html && appliedArrays.current?.sig === arraySig) {
|
|
4055
3475
|
return;
|
|
@@ -4101,7 +3521,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4101
3521
|
id,
|
|
4102
3522
|
getPuck
|
|
4103
3523
|
]);
|
|
4104
|
-
(0,
|
|
3524
|
+
(0, import_react14.useEffect)(
|
|
4105
3525
|
() => () => {
|
|
4106
3526
|
Object.values(arrayItemWiring.current).forEach(
|
|
4107
3527
|
(wiring) => wiring.forEach(({ cleanup }) => cleanup())
|
|
@@ -4109,7 +3529,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4109
3529
|
},
|
|
4110
3530
|
[]
|
|
4111
3531
|
);
|
|
4112
|
-
(0,
|
|
3532
|
+
(0, import_react14.useEffect)(() => {
|
|
4113
3533
|
if (!script || !entryEl) return;
|
|
4114
3534
|
scriptRef.current?.remove();
|
|
4115
3535
|
const doc = entryEl.ownerDocument;
|
|
@@ -4127,7 +3547,7 @@ function createDesignComponentConfig(registration) {
|
|
|
4127
3547
|
for (const slot of annotations.slots) {
|
|
4128
3548
|
const Slot = props[slot.name];
|
|
4129
3549
|
if (typeof Slot === "function") {
|
|
4130
|
-
slotContent[slot.name] = /* @__PURE__ */ (0,
|
|
3550
|
+
slotContent[slot.name] = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4131
3551
|
Slot,
|
|
4132
3552
|
{
|
|
4133
3553
|
style: slot.style ? parseStyleString(slot.style) : void 0,
|
|
@@ -4136,17 +3556,17 @@ function createDesignComponentConfig(registration) {
|
|
|
4136
3556
|
);
|
|
4137
3557
|
}
|
|
4138
3558
|
}
|
|
4139
|
-
return /* @__PURE__ */ (0,
|
|
4140
|
-
styles && /* @__PURE__ */ (0,
|
|
4141
|
-
style && /* @__PURE__ */ (0,
|
|
4142
|
-
/* @__PURE__ */ (0,
|
|
3559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3560
|
+
styles && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: styles }),
|
|
3561
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: style }),
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: setEntryEl, ...fieldValueAttrs, children: htmlToReactTree(patchedHtml, slotContent) })
|
|
4143
3563
|
] });
|
|
4144
3564
|
}
|
|
4145
|
-
return /* @__PURE__ */ (0,
|
|
4146
|
-
styles && /* @__PURE__ */ (0,
|
|
4147
|
-
style && /* @__PURE__ */ (0,
|
|
3565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
3566
|
+
styles && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: styles }),
|
|
3567
|
+
style && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: style }),
|
|
4148
3568
|
editorEntryNode,
|
|
4149
|
-
entryEl && annotations.slots.map((slot) => /* @__PURE__ */ (0,
|
|
3569
|
+
entryEl && annotations.slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4150
3570
|
SlotPortal,
|
|
4151
3571
|
{
|
|
4152
3572
|
entry: entryEl,
|
|
@@ -4164,8 +3584,8 @@ function createDesignComponentConfig(registration) {
|
|
|
4164
3584
|
|
|
4165
3585
|
// src/lib/design/globals.tsx
|
|
4166
3586
|
init_react_import();
|
|
4167
|
-
var
|
|
4168
|
-
var
|
|
3587
|
+
var import_react15 = require("react");
|
|
3588
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4169
3589
|
function getDynamicConfigGlobals(dynamicConfig) {
|
|
4170
3590
|
if (typeof dynamicConfig !== "object" || dynamicConfig === null) return {};
|
|
4171
3591
|
const { styles, script } = dynamicConfig;
|
|
@@ -4180,9 +3600,9 @@ function DesignGlobals({
|
|
|
4180
3600
|
script,
|
|
4181
3601
|
isEditing
|
|
4182
3602
|
}) {
|
|
4183
|
-
const scriptRef = (0,
|
|
4184
|
-
const hostRef = (0,
|
|
4185
|
-
(0,
|
|
3603
|
+
const scriptRef = (0, import_react15.useRef)(null);
|
|
3604
|
+
const hostRef = (0, import_react15.useRef)(null);
|
|
3605
|
+
(0, import_react15.useEffect)(() => {
|
|
4186
3606
|
if (!script) return;
|
|
4187
3607
|
scriptRef.current?.remove();
|
|
4188
3608
|
const doc = hostRef.current?.ownerDocument ?? document;
|
|
@@ -4195,10 +3615,10 @@ function DesignGlobals({
|
|
|
4195
3615
|
scriptRef.current = null;
|
|
4196
3616
|
};
|
|
4197
3617
|
}, [script]);
|
|
4198
|
-
return /* @__PURE__ */ (0,
|
|
4199
|
-
isEditing && /* @__PURE__ */ (0,
|
|
4200
|
-
styles && /* @__PURE__ */ (0,
|
|
4201
|
-
script && /* @__PURE__ */ (0,
|
|
3618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3619
|
+
isEditing && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: INLINE_EDIT_RESET }),
|
|
3620
|
+
styles && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: styles }),
|
|
3621
|
+
script && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: hostRef, style: { display: "none" } })
|
|
4202
3622
|
] });
|
|
4203
3623
|
}
|
|
4204
3624
|
var WRAPPED = "__puckAiDesignGlobals";
|
|
@@ -4208,8 +3628,8 @@ function withDesignGlobals(root) {
|
|
|
4208
3628
|
const userRender = root?.render;
|
|
4209
3629
|
const render = (props) => {
|
|
4210
3630
|
const { styles, script } = getDynamicConfigGlobals(props._dynamicConfig);
|
|
4211
|
-
return /* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
3631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3632
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4213
3633
|
DesignGlobals,
|
|
4214
3634
|
{
|
|
4215
3635
|
styles,
|
|
@@ -4231,7 +3651,7 @@ function ensureDesignGlobalsRoot(config) {
|
|
|
4231
3651
|
}
|
|
4232
3652
|
|
|
4233
3653
|
// src/lib/design/runtime.tsx
|
|
4234
|
-
var
|
|
3654
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
4235
3655
|
var cachedFieldMetadata;
|
|
4236
3656
|
function detectFieldMetadata(config) {
|
|
4237
3657
|
for (const comp of Object.values(config.components)) {
|
|
@@ -4270,7 +3690,7 @@ function applyConfigFieldMetadata(config, dynamicComponents) {
|
|
|
4270
3690
|
var DESIGNED_CATEGORY = "dynamic";
|
|
4271
3691
|
var dynamicConfigRootField = {
|
|
4272
3692
|
type: "custom",
|
|
4273
|
-
render: () => /* @__PURE__ */ (0,
|
|
3693
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {}),
|
|
4274
3694
|
ai: {
|
|
4275
3695
|
exclude: true
|
|
4276
3696
|
}
|
|
@@ -4377,7 +3797,7 @@ function syncDesignComponents(getPuck) {
|
|
|
4377
3797
|
}
|
|
4378
3798
|
function deleteDesignComponent(getPuck, name) {
|
|
4379
3799
|
const { appState, config, dispatch } = getPuck();
|
|
4380
|
-
const filtered = (0,
|
|
3800
|
+
const filtered = (0, import_core3.walkTree)(
|
|
4381
3801
|
appState.data,
|
|
4382
3802
|
config,
|
|
4383
3803
|
(content) => content.filter((item) => item.type !== name)
|
|
@@ -4538,14 +3958,14 @@ var drawScaled = (source, ratio) => {
|
|
|
4538
3958
|
const target = document.createElement("canvas");
|
|
4539
3959
|
target.width = scaleDimension(source.width, ratio);
|
|
4540
3960
|
target.height = scaleDimension(source.height, ratio);
|
|
4541
|
-
const
|
|
4542
|
-
if (!
|
|
3961
|
+
const ctx = target.getContext("2d");
|
|
3962
|
+
if (!ctx) {
|
|
4543
3963
|
releaseCanvas(target);
|
|
4544
3964
|
return source;
|
|
4545
3965
|
}
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
3966
|
+
ctx.imageSmoothingEnabled = true;
|
|
3967
|
+
ctx.imageSmoothingQuality = "high";
|
|
3968
|
+
ctx.drawImage(source, 0, 0, target.width, target.height);
|
|
4549
3969
|
return target;
|
|
4550
3970
|
};
|
|
4551
3971
|
var fitCanvas = (canvas) => {
|
|
@@ -4625,17 +4045,53 @@ async function postClientToolResponse(host, body) {
|
|
|
4625
4045
|
}
|
|
4626
4046
|
}
|
|
4627
4047
|
|
|
4048
|
+
// src/lib/to-serializable.ts
|
|
4049
|
+
init_react_import();
|
|
4050
|
+
function toSerializable(value, ancestors = []) {
|
|
4051
|
+
const json = typeof value === "object" && value !== null && "toJSON" in value && typeof value.toJSON === "function" ? value.toJSON() : value;
|
|
4052
|
+
if (typeof json !== "object" || json === null) {
|
|
4053
|
+
return typeof json === "function" || typeof json === "symbol" || typeof json === "bigint" ? void 0 : json;
|
|
4054
|
+
}
|
|
4055
|
+
if ("$$typeof" in json || ancestors.includes(json)) return void 0;
|
|
4056
|
+
ancestors.push(json);
|
|
4057
|
+
let copy;
|
|
4058
|
+
if (Array.isArray(json)) {
|
|
4059
|
+
copy = json.map((item) => toSerializable(item, ancestors) ?? null);
|
|
4060
|
+
} else {
|
|
4061
|
+
const record = json;
|
|
4062
|
+
const object = {};
|
|
4063
|
+
for (const key of Object.keys(record)) {
|
|
4064
|
+
const item = toSerializable(record[key], ancestors);
|
|
4065
|
+
if (item !== void 0) object[key] = item;
|
|
4066
|
+
}
|
|
4067
|
+
copy = object;
|
|
4068
|
+
}
|
|
4069
|
+
ancestors.pop();
|
|
4070
|
+
return copy;
|
|
4071
|
+
}
|
|
4072
|
+
|
|
4073
|
+
// src/components/PluginTheme/index.ts
|
|
4074
|
+
init_react_import();
|
|
4075
|
+
|
|
4076
|
+
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PluginTheme/styles.module.css#css-module
|
|
4077
|
+
init_react_import();
|
|
4078
|
+
var styles_module_default6 = { "PluginTheme": "_PluginTheme_u3emj_8" };
|
|
4079
|
+
|
|
4080
|
+
// src/components/PluginTheme/index.ts
|
|
4081
|
+
var cx4 = getClassNameFactory("PluginTheme", styles_module_default6);
|
|
4082
|
+
var pluginThemeClassName = cx4();
|
|
4083
|
+
|
|
4628
4084
|
// src/components/Chat/index.tsx
|
|
4629
|
-
var
|
|
4085
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
4630
4086
|
var q = (0, import_qler.default)();
|
|
4631
4087
|
var DEFAULT_API_VERSION = "v2";
|
|
4632
4088
|
var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
|
|
4633
4089
|
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.";
|
|
4634
|
-
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.
|
|
4090
|
+
var PLUGIN_AI_VERSION = true ? "0.9.0-canary.bf40b813" : "unknown";
|
|
4635
4091
|
var BENCHMARK = false;
|
|
4636
4092
|
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
|
|
4637
|
-
var
|
|
4638
|
-
var usePuck = (0,
|
|
4093
|
+
var getClassName3 = getClassNameFactory("Chat", styles_module_default);
|
|
4094
|
+
var usePuck = (0, import_core4.createUsePuck)();
|
|
4639
4095
|
function Chat2(props) {
|
|
4640
4096
|
const {
|
|
4641
4097
|
apiVersion = DEFAULT_API_VERSION,
|
|
@@ -4653,33 +4109,33 @@ function Chat2(props) {
|
|
|
4653
4109
|
placeholder
|
|
4654
4110
|
} = chat ?? {};
|
|
4655
4111
|
const puckDispatch = usePuck((s) => s.dispatch);
|
|
4656
|
-
const getPuck = (0,
|
|
4657
|
-
const localChatId = (0,
|
|
4658
|
-
const inputRef = (0,
|
|
4659
|
-
const pluginRef = (0,
|
|
4660
|
-
const [mode, setMode] = (0,
|
|
4661
|
-
const modeRef = (0,
|
|
4112
|
+
const getPuck = (0, import_core4.useGetPuck)();
|
|
4113
|
+
const localChatId = (0, import_react17.useRef)("");
|
|
4114
|
+
const inputRef = (0, import_react17.useRef)(null);
|
|
4115
|
+
const pluginRef = (0, import_react17.useRef)(null);
|
|
4116
|
+
const [mode, setMode] = (0, import_react17.useState)(defaultMode);
|
|
4117
|
+
const modeRef = (0, import_react17.useRef)(mode);
|
|
4662
4118
|
const designModeVisible = typeof designMode === "boolean" ? designMode : designMode.visible ?? false;
|
|
4663
|
-
(0,
|
|
4119
|
+
(0, import_react17.useEffect)(() => {
|
|
4664
4120
|
modeRef.current = mode;
|
|
4665
4121
|
}, [mode]);
|
|
4666
4122
|
const puckData = usePuck((s) => s.appState.data);
|
|
4667
|
-
(0,
|
|
4123
|
+
(0, import_react17.useEffect)(() => {
|
|
4668
4124
|
syncDesignComponents(getPuck);
|
|
4669
4125
|
}, [puckData, getPuck]);
|
|
4670
|
-
const [error, setError] = (0,
|
|
4671
|
-
const [userError, setUserError] = (0,
|
|
4672
|
-
const clientToolEndpointUnavailableRef = (0,
|
|
4673
|
-
const stopChatRef = (0,
|
|
4674
|
-
const [composerAttachments, setComposerAttachments] = (0,
|
|
4675
|
-
const removedAttachmentClientIdsRef = (0,
|
|
4676
|
-
const uploadControllersRef = (0,
|
|
4677
|
-
const pendingBuildOpsRef = (0,
|
|
4678
|
-
const lastStreamActivityRef = (0,
|
|
4679
|
-
const hiddenSinceRef = (0,
|
|
4680
|
-
const [toolStatus, setToolStatus] = (0,
|
|
4681
|
-
const [subagentState, setSubagentState] = (0,
|
|
4682
|
-
const attachmentConfig = (0,
|
|
4126
|
+
const [error, setError] = (0, import_react17.useState)();
|
|
4127
|
+
const [userError, setUserError] = (0, import_react17.useState)();
|
|
4128
|
+
const clientToolEndpointUnavailableRef = (0, import_react17.useRef)(false);
|
|
4129
|
+
const stopChatRef = (0, import_react17.useRef)(null);
|
|
4130
|
+
const [composerAttachments, setComposerAttachments] = (0, import_react17.useState)([]);
|
|
4131
|
+
const removedAttachmentClientIdsRef = (0, import_react17.useRef)(/* @__PURE__ */ new Set());
|
|
4132
|
+
const uploadControllersRef = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
4133
|
+
const pendingBuildOpsRef = (0, import_react17.useRef)([]);
|
|
4134
|
+
const lastStreamActivityRef = (0, import_react17.useRef)(0);
|
|
4135
|
+
const hiddenSinceRef = (0, import_react17.useRef)(null);
|
|
4136
|
+
const [toolStatus, setToolStatus] = (0, import_react17.useState)({});
|
|
4137
|
+
const [subagentState, setSubagentState] = (0, import_react17.useState)({});
|
|
4138
|
+
const attachmentConfig = (0, import_react17.useMemo)(
|
|
4683
4139
|
() => ({
|
|
4684
4140
|
accept: attachments?.accept ?? defaultAttachmentAccept,
|
|
4685
4141
|
enabled: attachments?.enabled ?? true,
|
|
@@ -4689,14 +4145,14 @@ function Chat2(props) {
|
|
|
4689
4145
|
}),
|
|
4690
4146
|
[attachments, host]
|
|
4691
4147
|
);
|
|
4692
|
-
(0,
|
|
4148
|
+
(0, import_react17.useEffect)(
|
|
4693
4149
|
() => () => {
|
|
4694
4150
|
uploadControllersRef.current.forEach((controller) => controller.abort());
|
|
4695
4151
|
uploadControllersRef.current.clear();
|
|
4696
4152
|
},
|
|
4697
4153
|
[]
|
|
4698
4154
|
);
|
|
4699
|
-
const deleteAttachment = (0,
|
|
4155
|
+
const deleteAttachment = (0, import_react17.useCallback)(
|
|
4700
4156
|
async (attachmentId) => {
|
|
4701
4157
|
try {
|
|
4702
4158
|
await fetch(`${attachmentConfig.endpoint}/${attachmentId}`, {
|
|
@@ -4708,7 +4164,7 @@ function Chat2(props) {
|
|
|
4708
4164
|
},
|
|
4709
4165
|
[attachmentConfig.endpoint]
|
|
4710
4166
|
);
|
|
4711
|
-
const uploadScreenshot = (0,
|
|
4167
|
+
const uploadScreenshot = (0, import_react17.useCallback)(
|
|
4712
4168
|
async (width, bucketUrl) => {
|
|
4713
4169
|
try {
|
|
4714
4170
|
const iframeDocument = document?.getElementById("preview-frame")?.contentDocument?.documentElement ?? null;
|
|
@@ -4763,14 +4219,14 @@ function Chat2(props) {
|
|
|
4763
4219
|
BUILD_OP_DEBOUNCE_MS,
|
|
4764
4220
|
{ maxWait: BUILD_OP_DEBOUNCE_MS }
|
|
4765
4221
|
);
|
|
4766
|
-
const queueBuildOp = (0,
|
|
4222
|
+
const queueBuildOp = (0, import_react17.useCallback)(
|
|
4767
4223
|
(operation) => {
|
|
4768
4224
|
pendingBuildOpsRef.current.push(operation);
|
|
4769
4225
|
debouncedFlushBuildOps();
|
|
4770
4226
|
},
|
|
4771
4227
|
[debouncedFlushBuildOps]
|
|
4772
4228
|
);
|
|
4773
|
-
const handleClientToolEndpointUnavailable = (0,
|
|
4229
|
+
const handleClientToolEndpointUnavailable = (0, import_react17.useCallback)(() => {
|
|
4774
4230
|
if (clientToolEndpointUnavailableRef.current) return;
|
|
4775
4231
|
clientToolEndpointUnavailableRef.current = true;
|
|
4776
4232
|
setError(CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE);
|
|
@@ -4794,7 +4250,7 @@ function Chat2(props) {
|
|
|
4794
4250
|
});
|
|
4795
4251
|
stopChatRef.current?.();
|
|
4796
4252
|
}, []);
|
|
4797
|
-
const sendClientToolResponse = (0,
|
|
4253
|
+
const sendClientToolResponse = (0, import_react17.useCallback)(
|
|
4798
4254
|
async (body) => {
|
|
4799
4255
|
try {
|
|
4800
4256
|
await postClientToolResponse(host, body);
|
|
@@ -4804,7 +4260,7 @@ function Chat2(props) {
|
|
|
4804
4260
|
},
|
|
4805
4261
|
[handleClientToolEndpointUnavailable, host]
|
|
4806
4262
|
);
|
|
4807
|
-
const processData = (0,
|
|
4263
|
+
const processData = (0, import_react17.useCallback)(
|
|
4808
4264
|
(dataPart) => {
|
|
4809
4265
|
lastStreamActivityRef.current = Date.now();
|
|
4810
4266
|
switch (dataPart.type) {
|
|
@@ -4833,12 +4289,14 @@ function Chat2(props) {
|
|
|
4833
4289
|
}
|
|
4834
4290
|
case "data-client-request": {
|
|
4835
4291
|
const { requestId, action } = dataPart.data;
|
|
4292
|
+
const chatId = localChatId.current || void 0;
|
|
4836
4293
|
if (action === "getPageData") {
|
|
4837
4294
|
debouncedFlushBuildOps.flush();
|
|
4838
4295
|
q.wait().then(() => {
|
|
4839
4296
|
const { appState } = getPuck();
|
|
4840
4297
|
return sendClientToolResponse({
|
|
4841
4298
|
id: requestId,
|
|
4299
|
+
chatId,
|
|
4842
4300
|
responses: [{ action, output: appState.data }]
|
|
4843
4301
|
});
|
|
4844
4302
|
}).catch((e) => {
|
|
@@ -4868,12 +4326,14 @@ function Chat2(props) {
|
|
|
4868
4326
|
}
|
|
4869
4327
|
return sendClientToolResponse({
|
|
4870
4328
|
id: requestId,
|
|
4329
|
+
chatId,
|
|
4871
4330
|
responses: [{ action, output: { sizeBytes: blob.size } }]
|
|
4872
4331
|
});
|
|
4873
4332
|
}).catch((e) => {
|
|
4874
4333
|
console.error("Failed to respond to client request:", e);
|
|
4875
4334
|
return sendClientToolResponse({
|
|
4876
4335
|
id: requestId,
|
|
4336
|
+
chatId,
|
|
4877
4337
|
responses: [{ action, output: { sizeBytes: 0 } }]
|
|
4878
4338
|
});
|
|
4879
4339
|
});
|
|
@@ -4941,14 +4401,14 @@ function Chat2(props) {
|
|
|
4941
4401
|
}
|
|
4942
4402
|
}
|
|
4943
4403
|
};
|
|
4944
|
-
const configWithRoot = {
|
|
4404
|
+
const configWithRoot = toSerializable({
|
|
4945
4405
|
...config,
|
|
4946
4406
|
root,
|
|
4947
4407
|
components: {
|
|
4948
4408
|
...config.components,
|
|
4949
4409
|
...getRequestComponentConfigs(appState.data)
|
|
4950
4410
|
}
|
|
4951
|
-
};
|
|
4411
|
+
});
|
|
4952
4412
|
const defaultOptions = {
|
|
4953
4413
|
headers: {
|
|
4954
4414
|
...opts.headers,
|
|
@@ -5011,21 +4471,21 @@ function Chat2(props) {
|
|
|
5011
4471
|
});
|
|
5012
4472
|
}
|
|
5013
4473
|
});
|
|
5014
|
-
(0,
|
|
4474
|
+
(0, import_react17.useEffect)(() => {
|
|
5015
4475
|
stopChatRef.current = stop;
|
|
5016
4476
|
return () => {
|
|
5017
4477
|
stopChatRef.current = null;
|
|
5018
4478
|
stop();
|
|
5019
4479
|
};
|
|
5020
4480
|
}, [stop]);
|
|
5021
|
-
const statusRef = (0,
|
|
5022
|
-
(0,
|
|
4481
|
+
const statusRef = (0, import_react17.useRef)(status);
|
|
4482
|
+
(0, import_react17.useEffect)(() => {
|
|
5023
4483
|
statusRef.current = status;
|
|
5024
4484
|
}, [status]);
|
|
5025
|
-
(0,
|
|
4485
|
+
(0, import_react17.useEffect)(() => {
|
|
5026
4486
|
lastStreamActivityRef.current = Date.now();
|
|
5027
4487
|
}, [messages]);
|
|
5028
|
-
(0,
|
|
4488
|
+
(0, import_react17.useEffect)(() => {
|
|
5029
4489
|
const FROZEN_HIDDEN_MS = 3 * 6e4;
|
|
5030
4490
|
const RESUME_GRACE_MS = 12e3;
|
|
5031
4491
|
const isStreaming = () => statusRef.current === "streaming" || statusRef.current === "submitted";
|
|
@@ -5068,12 +4528,12 @@ function Chat2(props) {
|
|
|
5068
4528
|
if (graceTimer) clearTimeout(graceTimer);
|
|
5069
4529
|
};
|
|
5070
4530
|
}, [stop]);
|
|
5071
|
-
const [forcedStatus, setForcedStatus] = (0,
|
|
5072
|
-
const resolvedStatus = (0,
|
|
4531
|
+
const [forcedStatus, setForcedStatus] = (0, import_react17.useState)();
|
|
4532
|
+
const resolvedStatus = (0, import_react17.useMemo)(
|
|
5073
4533
|
() => forcedStatus ?? status,
|
|
5074
4534
|
[status, forcedStatus]
|
|
5075
4535
|
);
|
|
5076
|
-
(0,
|
|
4536
|
+
(0, import_react17.useEffect)(() => {
|
|
5077
4537
|
if (!scrollTrackingId) return;
|
|
5078
4538
|
dispatchScrollTrackingEvent({
|
|
5079
4539
|
id: scrollTrackingId,
|
|
@@ -5086,7 +4546,7 @@ function Chat2(props) {
|
|
|
5086
4546
|
});
|
|
5087
4547
|
};
|
|
5088
4548
|
}, [resolvedStatus, scrollTrackingId]);
|
|
5089
|
-
(0,
|
|
4549
|
+
(0, import_react17.useEffect)(() => {
|
|
5090
4550
|
window.__PUCK_AI = {
|
|
5091
4551
|
processData,
|
|
5092
4552
|
setMessages,
|
|
@@ -5297,7 +4757,7 @@ function Chat2(props) {
|
|
|
5297
4757
|
if (!target?.attachmentId) return;
|
|
5298
4758
|
await deleteAttachment(target.attachmentId);
|
|
5299
4759
|
};
|
|
5300
|
-
const messagesWithStatuses = (0,
|
|
4760
|
+
const messagesWithStatuses = (0, import_react17.useMemo)(() => {
|
|
5301
4761
|
return messages.map((msg) => {
|
|
5302
4762
|
return {
|
|
5303
4763
|
...msg,
|
|
@@ -5310,71 +4770,78 @@ function Chat2(props) {
|
|
|
5310
4770
|
};
|
|
5311
4771
|
});
|
|
5312
4772
|
}, [messages, toolStatus]);
|
|
5313
|
-
return /* @__PURE__ */ (0,
|
|
5314
|
-
|
|
4773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4774
|
+
"div",
|
|
5315
4775
|
{
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
AttachmentComposer,
|
|
5321
|
-
{
|
|
5322
|
-
accept: attachmentConfig.accept,
|
|
5323
|
-
attachments: composerAttachments,
|
|
5324
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming",
|
|
5325
|
-
maxFiles: attachmentConfig.maxFiles,
|
|
5326
|
-
onChange: handleAttachmentChange
|
|
5327
|
-
}
|
|
5328
|
-
) : null,
|
|
5329
|
-
typeof chatActions === "function" ? chatActions({
|
|
5330
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5331
|
-
}) : chatActions,
|
|
5332
|
-
designModeVisible ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5333
|
-
DesignModeToggle,
|
|
5334
|
-
{
|
|
5335
|
-
active: mode === "design",
|
|
5336
|
-
onToggle: () => setMode(
|
|
5337
|
-
(mode2) => mode2 === "design" ? "assembly" : "design"
|
|
5338
|
-
),
|
|
5339
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5340
|
-
}
|
|
5341
|
-
) : null
|
|
5342
|
-
] }),
|
|
5343
|
-
attachments: composerAttachments,
|
|
5344
|
-
onRemoveAttachment: removeAttachment,
|
|
5345
|
-
handleSubmit,
|
|
5346
|
-
inputRef,
|
|
5347
|
-
status: resolvedStatus,
|
|
5348
|
-
examplePrompts: examplePrompts?.map(
|
|
5349
|
-
({ label, href, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5350
|
-
ExamplePrompt,
|
|
5351
|
-
{
|
|
5352
|
-
label,
|
|
5353
|
-
href,
|
|
5354
|
-
onClick,
|
|
5355
|
-
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
5356
|
-
},
|
|
5357
|
-
label
|
|
5358
|
-
)
|
|
5359
|
-
),
|
|
5360
|
-
error,
|
|
5361
|
-
handleRetry: () => {
|
|
5362
|
-
clientToolEndpointUnavailableRef.current = false;
|
|
5363
|
-
setError("");
|
|
5364
|
-
regenerate();
|
|
5365
|
-
},
|
|
5366
|
-
userError,
|
|
5367
|
-
onDismissUserError: () => setUserError(""),
|
|
5368
|
-
children: placeholder ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5369
|
-
Placeholder,
|
|
4776
|
+
className: `${getClassName3()} ${pluginThemeClassName}`,
|
|
4777
|
+
ref: pluginRef,
|
|
4778
|
+
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)(
|
|
4779
|
+
ChatBody,
|
|
5370
4780
|
{
|
|
5371
|
-
|
|
4781
|
+
messages: messagesWithStatuses,
|
|
4782
|
+
onFileDrop: attachmentConfig.enabled ? handleFiles : void 0,
|
|
4783
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
4784
|
+
attachmentConfig.enabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4785
|
+
AttachmentComposer,
|
|
4786
|
+
{
|
|
4787
|
+
accept: attachmentConfig.accept,
|
|
4788
|
+
attachments: composerAttachments,
|
|
4789
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming",
|
|
4790
|
+
maxFiles: attachmentConfig.maxFiles,
|
|
4791
|
+
onChange: handleAttachmentChange
|
|
4792
|
+
}
|
|
4793
|
+
) : null,
|
|
4794
|
+
typeof chatActions === "function" ? chatActions({
|
|
4795
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4796
|
+
}) : chatActions,
|
|
4797
|
+
designModeVisible ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4798
|
+
DesignModeToggle,
|
|
4799
|
+
{
|
|
4800
|
+
active: mode === "design",
|
|
4801
|
+
onToggle: () => setMode(
|
|
4802
|
+
(mode2) => mode2 === "design" ? "assembly" : "design"
|
|
4803
|
+
),
|
|
4804
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4805
|
+
}
|
|
4806
|
+
) : null
|
|
4807
|
+
] }),
|
|
4808
|
+
attachments: composerAttachments,
|
|
4809
|
+
onRemoveAttachment: removeAttachment,
|
|
4810
|
+
handleSubmit,
|
|
5372
4811
|
inputRef,
|
|
5373
|
-
|
|
4812
|
+
status: resolvedStatus,
|
|
4813
|
+
examplePrompts: examplePrompts?.map(
|
|
4814
|
+
({ label, href, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4815
|
+
ExamplePrompt,
|
|
4816
|
+
{
|
|
4817
|
+
label,
|
|
4818
|
+
href,
|
|
4819
|
+
onClick,
|
|
4820
|
+
disabled: resolvedStatus === "submitted" || resolvedStatus === "streaming"
|
|
4821
|
+
},
|
|
4822
|
+
label
|
|
4823
|
+
)
|
|
4824
|
+
),
|
|
4825
|
+
error,
|
|
4826
|
+
handleRetry: () => {
|
|
4827
|
+
clientToolEndpointUnavailableRef.current = false;
|
|
4828
|
+
setError("");
|
|
4829
|
+
regenerate();
|
|
4830
|
+
},
|
|
4831
|
+
userError,
|
|
4832
|
+
onDismissUserError: () => setUserError(""),
|
|
4833
|
+
children: placeholder ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
4834
|
+
Placeholder,
|
|
4835
|
+
{
|
|
4836
|
+
dispatch: puckDispatch,
|
|
4837
|
+
inputRef,
|
|
4838
|
+
pluginRef
|
|
4839
|
+
}
|
|
4840
|
+
)
|
|
5374
4841
|
}
|
|
5375
|
-
)
|
|
4842
|
+
) }) }) })
|
|
5376
4843
|
}
|
|
5377
|
-
)
|
|
4844
|
+
);
|
|
5378
4845
|
}
|
|
5379
4846
|
function finalizeReasoningParts(parts) {
|
|
5380
4847
|
return parts.map(
|
|
@@ -5482,14 +4949,14 @@ function AttachmentComposer({
|
|
|
5482
4949
|
maxFiles,
|
|
5483
4950
|
onChange
|
|
5484
4951
|
}) {
|
|
5485
|
-
const id = (0,
|
|
5486
|
-
const inputId = (0,
|
|
5487
|
-
return /* @__PURE__ */ (0,
|
|
5488
|
-
/* @__PURE__ */ (0,
|
|
4952
|
+
const id = (0, import_react17.useId)();
|
|
4953
|
+
const inputId = (0, import_react17.useMemo)(() => `attachment-input-${id}`, []);
|
|
4954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName3("attachmentControls"), children: [
|
|
4955
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5489
4956
|
"input",
|
|
5490
4957
|
{
|
|
5491
4958
|
accept: accept.join(","),
|
|
5492
|
-
className:
|
|
4959
|
+
className: getClassName3("attachmentInput"),
|
|
5493
4960
|
disabled: disabled || attachments.length >= maxFiles,
|
|
5494
4961
|
id: inputId,
|
|
5495
4962
|
multiple: true,
|
|
@@ -5497,16 +4964,16 @@ function AttachmentComposer({
|
|
|
5497
4964
|
type: "file"
|
|
5498
4965
|
}
|
|
5499
4966
|
),
|
|
5500
|
-
/* @__PURE__ */ (0,
|
|
4967
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5501
4968
|
"button",
|
|
5502
4969
|
{
|
|
5503
4970
|
"aria-label": "Attach files",
|
|
5504
|
-
className:
|
|
4971
|
+
className: getClassName3("attachmentButton"),
|
|
5505
4972
|
disabled: disabled || attachments.length >= maxFiles,
|
|
5506
4973
|
onClick: () => document.getElementById(inputId)?.click(),
|
|
5507
4974
|
title: "Attach files",
|
|
5508
4975
|
type: "button",
|
|
5509
|
-
children: /* @__PURE__ */ (0,
|
|
4976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Paperclip, { size: 14 })
|
|
5510
4977
|
}
|
|
5511
4978
|
)
|
|
5512
4979
|
] });
|
|
@@ -5529,24 +4996,24 @@ function Placeholder({
|
|
|
5529
4996
|
}
|
|
5530
4997
|
}, 10);
|
|
5531
4998
|
};
|
|
5532
|
-
return /* @__PURE__ */ (0,
|
|
5533
|
-
/* @__PURE__ */ (0,
|
|
5534
|
-
/* @__PURE__ */ (0,
|
|
5535
|
-
/* @__PURE__ */ (0,
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
4999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName3("placeholder"), children: [
|
|
5000
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName3("placeholderIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Sparkles, { "aria-hidden": "true", size: 28 }) }),
|
|
5001
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { className: getClassName3("placeholderTitle"), children: "Build with AI" }),
|
|
5002
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: getClassName3("placeholderDescription"), children: "Describe what you want to create or change." }),
|
|
5003
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName3("actions"), children: [
|
|
5004
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5538
5005
|
"button",
|
|
5539
5006
|
{
|
|
5540
|
-
className:
|
|
5007
|
+
className: getClassName3("action"),
|
|
5541
5008
|
onClick: handleEnterPromptClick,
|
|
5542
5009
|
type: "button",
|
|
5543
5010
|
children: "Write a prompt"
|
|
5544
5011
|
}
|
|
5545
5012
|
),
|
|
5546
|
-
/* @__PURE__ */ (0,
|
|
5013
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5547
5014
|
"button",
|
|
5548
5015
|
{
|
|
5549
|
-
className:
|
|
5016
|
+
className: getClassName3("actionOutlined"),
|
|
5550
5017
|
onClick: () => {
|
|
5551
5018
|
dispatch({
|
|
5552
5019
|
type: "setUi",
|
|
@@ -5583,7 +5050,7 @@ function isScrolledIntoView(el) {
|
|
|
5583
5050
|
|
|
5584
5051
|
// src/components/ScrollTracking/ScrollTracking.tsx
|
|
5585
5052
|
init_react_import();
|
|
5586
|
-
var
|
|
5053
|
+
var import_react19 = require("react");
|
|
5587
5054
|
|
|
5588
5055
|
// src/lib/scroll-into-view-local.ts
|
|
5589
5056
|
init_react_import();
|
|
@@ -5606,9 +5073,9 @@ function scrollIntoViewLocal(el, win, behavior = "smooth") {
|
|
|
5606
5073
|
|
|
5607
5074
|
// src/lib/use-frame-mutation-observer.ts
|
|
5608
5075
|
init_react_import();
|
|
5609
|
-
var
|
|
5076
|
+
var import_react18 = require("react");
|
|
5610
5077
|
function useFrameMutationObserver(callback) {
|
|
5611
|
-
return (0,
|
|
5078
|
+
return (0, import_react18.useCallback)(() => {
|
|
5612
5079
|
const frame = document?.getElementById(
|
|
5613
5080
|
"preview-frame"
|
|
5614
5081
|
);
|
|
@@ -5653,9 +5120,9 @@ var ScrollTracking = ({
|
|
|
5653
5120
|
children,
|
|
5654
5121
|
trackingId
|
|
5655
5122
|
}) => {
|
|
5656
|
-
const followedRefs = (0,
|
|
5657
|
-
const enabledRef = (0,
|
|
5658
|
-
(0,
|
|
5123
|
+
const followedRefs = (0, import_react19.useRef)([]);
|
|
5124
|
+
const enabledRef = (0, import_react19.useRef)(false);
|
|
5125
|
+
(0, import_react19.useEffect)(() => {
|
|
5659
5126
|
return subscribeToScrollTrackingEvents(({ id, enabled }) => {
|
|
5660
5127
|
if (id !== trackingId) return;
|
|
5661
5128
|
enabledRef.current = enabled;
|
|
@@ -5674,7 +5141,7 @@ var ScrollTracking = ({
|
|
|
5674
5141
|
});
|
|
5675
5142
|
}
|
|
5676
5143
|
});
|
|
5677
|
-
(0,
|
|
5144
|
+
(0, import_react19.useEffect)(() => {
|
|
5678
5145
|
follow();
|
|
5679
5146
|
}, [follow]);
|
|
5680
5147
|
return children;
|
|
@@ -5682,31 +5149,315 @@ var ScrollTracking = ({
|
|
|
5682
5149
|
|
|
5683
5150
|
// src/components/Drawer/index.tsx
|
|
5684
5151
|
init_react_import();
|
|
5685
|
-
var
|
|
5152
|
+
var import_core6 = require("@puckeditor/core");
|
|
5686
5153
|
|
|
5687
5154
|
// src/components/ManageComponents/index.tsx
|
|
5688
5155
|
init_react_import();
|
|
5689
|
-
var
|
|
5690
|
-
var
|
|
5156
|
+
var import_core5 = require("@puckeditor/core");
|
|
5157
|
+
var import_react23 = require("react");
|
|
5158
|
+
|
|
5159
|
+
// ../platform-client/components/ActionModal/index.ts
|
|
5160
|
+
init_react_import();
|
|
5161
|
+
|
|
5162
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
5163
|
+
init_react_import();
|
|
5164
|
+
|
|
5165
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/ActionModal/ActionModal.module.css#css-module
|
|
5166
|
+
init_react_import();
|
|
5167
|
+
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" };
|
|
5168
|
+
|
|
5169
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5170
|
+
init_react_import();
|
|
5171
|
+
|
|
5172
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Modal/Modal.module.css#css-module
|
|
5173
|
+
init_react_import();
|
|
5174
|
+
var Modal_module_default = { "Modal-background": "_Modal-background_10jdm_1", "Modal--visible": "_Modal--visible_10jdm_16", "Modal-modal": "_Modal-modal_10jdm_22" };
|
|
5175
|
+
|
|
5176
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5177
|
+
var import_react22 = require("react");
|
|
5178
|
+
|
|
5179
|
+
// ../platform-client/lib/use-modal-visible.ts
|
|
5180
|
+
init_react_import();
|
|
5181
|
+
var import_react20 = require("react");
|
|
5182
|
+
var useModalVisible = (defaultVisible) => {
|
|
5183
|
+
const [visible, setVisible] = (0, import_react20.useState)(defaultVisible ?? false);
|
|
5184
|
+
const ref = (0, import_react20.useRef)(null);
|
|
5185
|
+
(0, import_react20.useEffect)(() => {
|
|
5186
|
+
if (!visible) {
|
|
5187
|
+
return;
|
|
5188
|
+
}
|
|
5189
|
+
const handler = (e) => {
|
|
5190
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
5191
|
+
setVisible(false);
|
|
5192
|
+
}
|
|
5193
|
+
};
|
|
5194
|
+
document.body.addEventListener("click", handler);
|
|
5195
|
+
return () => {
|
|
5196
|
+
document.body.removeEventListener("click", handler);
|
|
5197
|
+
};
|
|
5198
|
+
}, [visible]);
|
|
5199
|
+
return [visible, setVisible, ref];
|
|
5200
|
+
};
|
|
5201
|
+
|
|
5202
|
+
// ../platform-client/components/Button/index.ts
|
|
5203
|
+
init_react_import();
|
|
5204
|
+
|
|
5205
|
+
// ../platform-client/components/Button/Button.tsx
|
|
5206
|
+
init_react_import();
|
|
5207
|
+
var import_react21 = require("react");
|
|
5208
|
+
|
|
5209
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Button/Button.module.css#css-module
|
|
5210
|
+
init_react_import();
|
|
5211
|
+
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" };
|
|
5212
|
+
|
|
5213
|
+
// ../platform-client/components/Button/Button.tsx
|
|
5214
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
5215
|
+
var getClassName4 = get_class_name_factory_default("Button", Button_module_default);
|
|
5216
|
+
var Button = ({
|
|
5217
|
+
children,
|
|
5218
|
+
href,
|
|
5219
|
+
onClick,
|
|
5220
|
+
variant = "primary",
|
|
5221
|
+
type,
|
|
5222
|
+
disabled,
|
|
5223
|
+
tabIndex,
|
|
5224
|
+
newTab,
|
|
5225
|
+
fullWidth,
|
|
5226
|
+
icon,
|
|
5227
|
+
size = "medium",
|
|
5228
|
+
loading: loadingProp = false
|
|
5229
|
+
}) => {
|
|
5230
|
+
const [loading, setLoading] = (0, import_react21.useState)(loadingProp);
|
|
5231
|
+
(0, import_react21.useEffect)(() => {
|
|
5232
|
+
const resetLoading = () => setLoading(loadingProp);
|
|
5233
|
+
resetLoading();
|
|
5234
|
+
window.addEventListener("pageshow", resetLoading);
|
|
5235
|
+
return () => window.removeEventListener("pageshow", resetLoading);
|
|
5236
|
+
}, [loadingProp]);
|
|
5237
|
+
const ElementType = href ? "a" : type ? "button" : "span";
|
|
5238
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
5239
|
+
ElementType,
|
|
5240
|
+
{
|
|
5241
|
+
className: getClassName4({
|
|
5242
|
+
brand: variant === "brand",
|
|
5243
|
+
primary: variant === "primary",
|
|
5244
|
+
secondary: variant === "secondary",
|
|
5245
|
+
danger: variant === "danger",
|
|
5246
|
+
ghost: variant === "ghost",
|
|
5247
|
+
// Disabled while its click is still running, too.
|
|
5248
|
+
disabled: disabled || loading,
|
|
5249
|
+
fullWidth,
|
|
5250
|
+
[size]: true
|
|
5251
|
+
}),
|
|
5252
|
+
onClick: (e) => {
|
|
5253
|
+
if (disabled || loading) {
|
|
5254
|
+
e.preventDefault();
|
|
5255
|
+
return;
|
|
5256
|
+
}
|
|
5257
|
+
if (!onClick) return;
|
|
5258
|
+
setLoading(true);
|
|
5259
|
+
Promise.resolve(onClick(e)).then(() => {
|
|
5260
|
+
setLoading(false);
|
|
5261
|
+
});
|
|
5262
|
+
},
|
|
5263
|
+
type,
|
|
5264
|
+
disabled: disabled || loading,
|
|
5265
|
+
tabIndex,
|
|
5266
|
+
target: newTab ? "_blank" : void 0,
|
|
5267
|
+
rel: newTab ? "noreferrer" : void 0,
|
|
5268
|
+
href,
|
|
5269
|
+
children: [
|
|
5270
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName4("icon"), children: icon }),
|
|
5271
|
+
children,
|
|
5272
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName4("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Loader, { size: 12 }) })
|
|
5273
|
+
]
|
|
5274
|
+
}
|
|
5275
|
+
);
|
|
5276
|
+
return el;
|
|
5277
|
+
};
|
|
5278
|
+
|
|
5279
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
5280
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
5281
|
+
var getClassName5 = getClassNameFactory("Modal", Modal_module_default);
|
|
5282
|
+
var modalContext = (0, import_react22.createContext)({
|
|
5283
|
+
buttonVariant: "primary",
|
|
5284
|
+
buttonSize: "medium",
|
|
5285
|
+
visible: false,
|
|
5286
|
+
setVisible: () => {
|
|
5287
|
+
},
|
|
5288
|
+
ref: null
|
|
5289
|
+
});
|
|
5290
|
+
var ModalProvider = ({
|
|
5291
|
+
children,
|
|
5292
|
+
defaultVisible,
|
|
5293
|
+
buttonVariant = "primary",
|
|
5294
|
+
buttonSize = "medium"
|
|
5295
|
+
}) => {
|
|
5296
|
+
const [visible, setVisible, ref] = useModalVisible(defaultVisible);
|
|
5297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5298
|
+
modalContext.Provider,
|
|
5299
|
+
{
|
|
5300
|
+
value: { buttonVariant, buttonSize, visible, setVisible, ref },
|
|
5301
|
+
children
|
|
5302
|
+
}
|
|
5303
|
+
);
|
|
5304
|
+
};
|
|
5305
|
+
var useModal = () => {
|
|
5306
|
+
const { visible, setVisible } = (0, import_react22.useContext)(modalContext);
|
|
5307
|
+
return { visible, setVisible };
|
|
5308
|
+
};
|
|
5309
|
+
var Modal = ({
|
|
5310
|
+
actionLabel = "Open",
|
|
5311
|
+
children,
|
|
5312
|
+
hideButton = false
|
|
5313
|
+
}) => {
|
|
5314
|
+
const { visible, setVisible, buttonVariant, buttonSize, ref } = (0, import_react22.useContext)(modalContext);
|
|
5315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName5({ visible }), children: [
|
|
5316
|
+
!hideButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName5("button"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5317
|
+
Button,
|
|
5318
|
+
{
|
|
5319
|
+
type: "button",
|
|
5320
|
+
variant: buttonVariant,
|
|
5321
|
+
size: buttonSize,
|
|
5322
|
+
onClick: (e) => {
|
|
5323
|
+
e.stopPropagation();
|
|
5324
|
+
setVisible(!visible);
|
|
5325
|
+
},
|
|
5326
|
+
children: actionLabel
|
|
5327
|
+
}
|
|
5328
|
+
) }),
|
|
5329
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName5("background"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName5("modal"), ref, children }) })
|
|
5330
|
+
] });
|
|
5331
|
+
};
|
|
5332
|
+
|
|
5333
|
+
// ../platform-client/components/Heading/index.ts
|
|
5334
|
+
init_react_import();
|
|
5335
|
+
|
|
5336
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
5337
|
+
init_react_import();
|
|
5338
|
+
|
|
5339
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
5340
|
+
init_react_import();
|
|
5341
|
+
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" };
|
|
5342
|
+
|
|
5343
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
5344
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
5345
|
+
var getClassName6 = get_class_name_factory_default("Heading", Heading_module_default);
|
|
5346
|
+
var Heading = ({
|
|
5347
|
+
children,
|
|
5348
|
+
rank,
|
|
5349
|
+
size = "m",
|
|
5350
|
+
variant = "default"
|
|
5351
|
+
}) => {
|
|
5352
|
+
const Tag = rank ? `h${rank}` : "span";
|
|
5353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
5354
|
+
Tag,
|
|
5355
|
+
{
|
|
5356
|
+
className: getClassName6({
|
|
5357
|
+
[size]: true,
|
|
5358
|
+
brand: variant === "brand"
|
|
5359
|
+
}),
|
|
5360
|
+
children
|
|
5361
|
+
}
|
|
5362
|
+
);
|
|
5363
|
+
};
|
|
5364
|
+
|
|
5365
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
5366
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
5367
|
+
var getClassName7 = getClassNameFactory("ActionModal", ActionModal_module_default);
|
|
5368
|
+
var ActionModalFooter = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName7("footer"), children });
|
|
5369
|
+
var ActionModal = ({
|
|
5370
|
+
actionLabel = "Open",
|
|
5371
|
+
children,
|
|
5372
|
+
title,
|
|
5373
|
+
description,
|
|
5374
|
+
actions,
|
|
5375
|
+
hideButton
|
|
5376
|
+
}) => {
|
|
5377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName7(), children: [
|
|
5378
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName7("header"), children: [
|
|
5379
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { size: "s", children: title }),
|
|
5380
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("small", { children: description })
|
|
5381
|
+
] }),
|
|
5382
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName7("body"), children }),
|
|
5383
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ActionModalFooter, { children: actions })
|
|
5384
|
+
] }) });
|
|
5385
|
+
};
|
|
5386
|
+
ActionModal.Footer = ActionModalFooter;
|
|
5387
|
+
|
|
5388
|
+
// ../platform-client/components/Inline/index.ts
|
|
5389
|
+
init_react_import();
|
|
5390
|
+
|
|
5391
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
5392
|
+
init_react_import();
|
|
5393
|
+
|
|
5394
|
+
// css-module:/home/runner/work/platform/platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
5395
|
+
init_react_import();
|
|
5396
|
+
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" };
|
|
5397
|
+
|
|
5398
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
5399
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5400
|
+
var getClassName8 = get_class_name_factory_default("Inline", Inline_module_default);
|
|
5401
|
+
var Inline = ({
|
|
5402
|
+
children,
|
|
5403
|
+
grow,
|
|
5404
|
+
center,
|
|
5405
|
+
size = "m",
|
|
5406
|
+
noWrap,
|
|
5407
|
+
centerH
|
|
5408
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5409
|
+
"div",
|
|
5410
|
+
{
|
|
5411
|
+
className: getClassName8({
|
|
5412
|
+
grow,
|
|
5413
|
+
center,
|
|
5414
|
+
centerH,
|
|
5415
|
+
noWrap,
|
|
5416
|
+
[`size${size.toUpperCase()}`]: size
|
|
5417
|
+
}),
|
|
5418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName8("inner"), children })
|
|
5419
|
+
}
|
|
5420
|
+
);
|
|
5421
|
+
var InlineItem = ({
|
|
5422
|
+
children,
|
|
5423
|
+
grow,
|
|
5424
|
+
push,
|
|
5425
|
+
shrink
|
|
5426
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5427
|
+
"div",
|
|
5428
|
+
{
|
|
5429
|
+
style: {
|
|
5430
|
+
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
5431
|
+
flexShrink: shrink ? "1" : "0",
|
|
5432
|
+
marginLeft: push ? "auto" : 0,
|
|
5433
|
+
maxWidth: "100%"
|
|
5434
|
+
},
|
|
5435
|
+
children
|
|
5436
|
+
}
|
|
5437
|
+
);
|
|
5438
|
+
Inline.Item = InlineItem;
|
|
5439
|
+
|
|
5440
|
+
// ../platform-client/components/Modal/index.ts
|
|
5441
|
+
init_react_import();
|
|
5691
5442
|
|
|
5692
5443
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ManageComponents/styles.module.css#css-module
|
|
5693
5444
|
init_react_import();
|
|
5694
|
-
var
|
|
5445
|
+
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" };
|
|
5695
5446
|
|
|
5696
5447
|
// src/components/ManageComponents/index.tsx
|
|
5697
|
-
var
|
|
5698
|
-
var
|
|
5699
|
-
var useRegistrations = () => (0,
|
|
5448
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5449
|
+
var cx5 = getClassNameFactory("ManageComponents", styles_module_default7);
|
|
5450
|
+
var useRegistrations = () => (0, import_react23.useSyncExternalStore)(
|
|
5700
5451
|
registrationStore.subscribe,
|
|
5701
5452
|
() => registrationStore.getAll(),
|
|
5702
5453
|
() => registrationStore.getAll()
|
|
5703
5454
|
);
|
|
5704
5455
|
function ManageModalContent({ onClose }) {
|
|
5705
|
-
const getPuck = (0,
|
|
5456
|
+
const getPuck = (0, import_core5.useGetPuck)();
|
|
5706
5457
|
const { visible, setVisible } = useModal();
|
|
5707
|
-
const [confirmTarget, setConfirmTarget] = (0,
|
|
5458
|
+
const [confirmTarget, setConfirmTarget] = (0, import_react23.useState)(null);
|
|
5708
5459
|
const entries = useRegistrations();
|
|
5709
|
-
(0,
|
|
5460
|
+
(0, import_react23.useEffect)(() => {
|
|
5710
5461
|
if (!visible) onClose();
|
|
5711
5462
|
}, [visible, onClose]);
|
|
5712
5463
|
const handleDelete = (name) => {
|
|
@@ -5717,14 +5468,14 @@ function ManageModalContent({ onClose }) {
|
|
|
5717
5468
|
}
|
|
5718
5469
|
};
|
|
5719
5470
|
if (confirmTarget) {
|
|
5720
|
-
return /* @__PURE__ */ (0,
|
|
5471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5721
5472
|
ActionModal,
|
|
5722
5473
|
{
|
|
5723
5474
|
title: "Delete component",
|
|
5724
5475
|
hideButton: true,
|
|
5725
|
-
actions: /* @__PURE__ */ (0,
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
5727
|
-
/* @__PURE__ */ (0,
|
|
5476
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Inline, { children: [
|
|
5477
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { variant: "secondary", onClick: () => setConfirmTarget(null), children: "Cancel" }),
|
|
5478
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5728
5479
|
Button,
|
|
5729
5480
|
{
|
|
5730
5481
|
variant: "danger",
|
|
@@ -5733,68 +5484,68 @@ function ManageModalContent({ onClose }) {
|
|
|
5733
5484
|
}
|
|
5734
5485
|
)
|
|
5735
5486
|
] }),
|
|
5736
|
-
children: /* @__PURE__ */ (0,
|
|
5487
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: cx5("confirmation"), children: [
|
|
5737
5488
|
"Are you sure you want to delete ",
|
|
5738
|
-
/* @__PURE__ */ (0,
|
|
5489
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("b", { children: confirmTarget.label }),
|
|
5739
5490
|
"?"
|
|
5740
5491
|
] })
|
|
5741
5492
|
}
|
|
5742
5493
|
);
|
|
5743
5494
|
}
|
|
5744
|
-
return /* @__PURE__ */ (0,
|
|
5745
|
-
entries.map(([name, reg]) => /* @__PURE__ */ (0,
|
|
5746
|
-
/* @__PURE__ */ (0,
|
|
5747
|
-
/* @__PURE__ */ (0,
|
|
5495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ActionModal, { title: "Manage components", hideButton: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cx5("list"), children: [
|
|
5496
|
+
entries.map(([name, reg]) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cx5("item"), children: [
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: cx5("itemName"), children: reg.label || name }),
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5748
5499
|
"button",
|
|
5749
5500
|
{
|
|
5750
|
-
className:
|
|
5501
|
+
className: cx5("delete"),
|
|
5751
5502
|
onClick: () => setConfirmTarget({ name, label: reg.label || name }),
|
|
5752
5503
|
type: "button",
|
|
5753
5504
|
children: [
|
|
5754
|
-
/* @__PURE__ */ (0,
|
|
5505
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Trash2, { size: 12 }),
|
|
5755
5506
|
"Delete"
|
|
5756
5507
|
]
|
|
5757
5508
|
}
|
|
5758
5509
|
)
|
|
5759
5510
|
] }, name)),
|
|
5760
|
-
entries.length === 0 && /* @__PURE__ */ (0,
|
|
5511
|
+
entries.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cx5("empty"), children: "No dynamic components" })
|
|
5761
5512
|
] }) });
|
|
5762
5513
|
}
|
|
5763
5514
|
function ManageComponentsCta() {
|
|
5764
|
-
const [open, setOpen] = (0,
|
|
5515
|
+
const [open, setOpen] = (0, import_react23.useState)(false);
|
|
5765
5516
|
const entries = useRegistrations();
|
|
5766
|
-
const handleClose = (0,
|
|
5517
|
+
const handleClose = (0, import_react23.useCallback)(() => setOpen(false), []);
|
|
5767
5518
|
if (entries.length === 0) return null;
|
|
5768
|
-
return /* @__PURE__ */ (0,
|
|
5769
|
-
/* @__PURE__ */ (0,
|
|
5770
|
-
/* @__PURE__ */ (0,
|
|
5519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
5520
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: cx5("cta"), onClick: () => setOpen(true), type: "button", children: [
|
|
5521
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Settings, { size: 14 }),
|
|
5771
5522
|
"Manage components"
|
|
5772
5523
|
] }),
|
|
5773
|
-
open && /* @__PURE__ */ (0,
|
|
5524
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModalProvider, { defaultVisible: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ManageModalContent, { onClose: handleClose }) })
|
|
5774
5525
|
] });
|
|
5775
5526
|
}
|
|
5776
5527
|
|
|
5777
5528
|
// css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Drawer/styles.module.css#css-module
|
|
5778
5529
|
init_react_import();
|
|
5779
|
-
var
|
|
5530
|
+
var styles_module_default8 = { "Drawer": "_Drawer_1mu8g_1", "Drawer--empty": "_Drawer--empty_1mu8g_5" };
|
|
5780
5531
|
|
|
5781
5532
|
// src/components/Drawer/index.tsx
|
|
5782
|
-
var
|
|
5783
|
-
var usePuck2 = (0,
|
|
5784
|
-
var
|
|
5533
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5534
|
+
var usePuck2 = (0, import_core6.createUsePuck)();
|
|
5535
|
+
var cx6 = getClassNameFactory("Drawer", styles_module_default8);
|
|
5785
5536
|
var createDrawer = (designModeVisible) => function Drawer({ children }) {
|
|
5786
5537
|
const config = usePuck2((s) => s.config);
|
|
5787
5538
|
if (Object.keys(config.components).length === 0) {
|
|
5788
|
-
return /* @__PURE__ */ (0,
|
|
5539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `${cx6({ empty: true })} ${pluginThemeClassName}`, children: "No blocks" });
|
|
5789
5540
|
}
|
|
5790
|
-
return /* @__PURE__ */ (0,
|
|
5541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `${cx6()} ${pluginThemeClassName}`, children: [
|
|
5791
5542
|
children,
|
|
5792
|
-
designModeVisible && /* @__PURE__ */ (0,
|
|
5543
|
+
designModeVisible && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ManageComponentsCta, {})
|
|
5793
5544
|
] });
|
|
5794
5545
|
};
|
|
5795
5546
|
|
|
5796
5547
|
// src/index.tsx
|
|
5797
|
-
var
|
|
5548
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5798
5549
|
function withDynamicConfig(config, data) {
|
|
5799
5550
|
const registrations = getPersistedRegistrations(data);
|
|
5800
5551
|
const dynamicConfig = {};
|
|
@@ -5831,16 +5582,16 @@ function createAiPlugin(opts) {
|
|
|
5831
5582
|
return {
|
|
5832
5583
|
label: "AI",
|
|
5833
5584
|
name: "ai",
|
|
5834
|
-
render: () => /* @__PURE__ */ (0,
|
|
5835
|
-
icon: /* @__PURE__ */ (0,
|
|
5585
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Chat2, { ...rest, scrollTrackingId }),
|
|
5586
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Bot, {}),
|
|
5836
5587
|
mobilePanelHeight: "min-content",
|
|
5837
5588
|
overrides: {
|
|
5838
5589
|
drawer: createDrawer(designModeVisible),
|
|
5839
5590
|
preview: ({ children }) => {
|
|
5840
5591
|
if (scrollTracking) {
|
|
5841
|
-
return /* @__PURE__ */ (0,
|
|
5592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ScrollTracking, { trackingId: scrollTrackingId, children });
|
|
5842
5593
|
}
|
|
5843
|
-
return /* @__PURE__ */ (0,
|
|
5594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children });
|
|
5844
5595
|
}
|
|
5845
5596
|
}
|
|
5846
5597
|
};
|