@puckeditor/plugin-ai 0.0.1
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 +1768 -0
- package/dist/index.d.mts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +1372 -0
- package/dist/index.mjs +1363 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1372 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __spreadValues = (a, b) => {
|
|
15
|
+
for (var prop in b || (b = {}))
|
|
16
|
+
if (__hasOwnProp.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
if (__getOwnPropSymbols)
|
|
19
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
+
if (__propIsEnum.call(b, prop))
|
|
21
|
+
__defNormalProp(a, prop, b[prop]);
|
|
22
|
+
}
|
|
23
|
+
return a;
|
|
24
|
+
};
|
|
25
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
|
+
var __objRest = (source, exclude) => {
|
|
27
|
+
var target = {};
|
|
28
|
+
for (var prop in source)
|
|
29
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
if (source != null && __getOwnPropSymbols)
|
|
32
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
+
target[prop] = source[prop];
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
38
|
+
var __esm = (fn, res) => function __init() {
|
|
39
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
40
|
+
};
|
|
41
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
42
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
43
|
+
};
|
|
44
|
+
var __export = (target, all) => {
|
|
45
|
+
for (var name in all)
|
|
46
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
47
|
+
};
|
|
48
|
+
var __copyProps = (to, from, except, desc) => {
|
|
49
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
50
|
+
for (let key of __getOwnPropNames(from))
|
|
51
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
52
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
53
|
+
}
|
|
54
|
+
return to;
|
|
55
|
+
};
|
|
56
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
57
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
58
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
59
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
60
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
61
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
62
|
+
mod
|
|
63
|
+
));
|
|
64
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
65
|
+
|
|
66
|
+
// ../tsup-config/react-import.js
|
|
67
|
+
var import_react;
|
|
68
|
+
var init_react_import = __esm({
|
|
69
|
+
"../tsup-config/react-import.js"() {
|
|
70
|
+
"use strict";
|
|
71
|
+
import_react = __toESM(require("react"));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// ../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
76
|
+
var require_classnames = __commonJS({
|
|
77
|
+
"../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports2, module2) {
|
|
78
|
+
"use strict";
|
|
79
|
+
init_react_import();
|
|
80
|
+
(function() {
|
|
81
|
+
"use strict";
|
|
82
|
+
var hasOwn = {}.hasOwnProperty;
|
|
83
|
+
function classNames() {
|
|
84
|
+
var classes = "";
|
|
85
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
86
|
+
var arg = arguments[i];
|
|
87
|
+
if (arg) {
|
|
88
|
+
classes = appendClass(classes, parseValue(arg));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return classes;
|
|
92
|
+
}
|
|
93
|
+
function parseValue(arg) {
|
|
94
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
95
|
+
return arg;
|
|
96
|
+
}
|
|
97
|
+
if (typeof arg !== "object") {
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(arg)) {
|
|
101
|
+
return classNames.apply(null, arg);
|
|
102
|
+
}
|
|
103
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
104
|
+
return arg.toString();
|
|
105
|
+
}
|
|
106
|
+
var classes = "";
|
|
107
|
+
for (var key in arg) {
|
|
108
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
109
|
+
classes = appendClass(classes, key);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return classes;
|
|
113
|
+
}
|
|
114
|
+
function appendClass(value, newClass) {
|
|
115
|
+
if (!newClass) {
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
if (value) {
|
|
119
|
+
return value + " " + newClass;
|
|
120
|
+
}
|
|
121
|
+
return value + newClass;
|
|
122
|
+
}
|
|
123
|
+
if (typeof module2 !== "undefined" && module2.exports) {
|
|
124
|
+
classNames.default = classNames;
|
|
125
|
+
module2.exports = classNames;
|
|
126
|
+
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
127
|
+
define("classnames", [], function() {
|
|
128
|
+
return classNames;
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
window.classNames = classNames;
|
|
132
|
+
}
|
|
133
|
+
})();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// index.ts
|
|
138
|
+
var index_exports = {};
|
|
139
|
+
__export(index_exports, {
|
|
140
|
+
ChatBody: () => ChatBody,
|
|
141
|
+
default: () => src_default
|
|
142
|
+
});
|
|
143
|
+
module.exports = __toCommonJS(index_exports);
|
|
144
|
+
init_react_import();
|
|
145
|
+
|
|
146
|
+
// src/index.tsx
|
|
147
|
+
init_react_import();
|
|
148
|
+
|
|
149
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/lucide-react.js
|
|
150
|
+
init_react_import();
|
|
151
|
+
|
|
152
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
153
|
+
init_react_import();
|
|
154
|
+
var import_react3 = require("react");
|
|
155
|
+
|
|
156
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
157
|
+
init_react_import();
|
|
158
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
159
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
160
|
+
return Boolean(className) && array.indexOf(className) === index;
|
|
161
|
+
}).join(" ");
|
|
162
|
+
|
|
163
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/Icon.js
|
|
164
|
+
init_react_import();
|
|
165
|
+
var import_react2 = require("react");
|
|
166
|
+
|
|
167
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
168
|
+
init_react_import();
|
|
169
|
+
var defaultAttributes = {
|
|
170
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
171
|
+
width: 24,
|
|
172
|
+
height: 24,
|
|
173
|
+
viewBox: "0 0 24 24",
|
|
174
|
+
fill: "none",
|
|
175
|
+
stroke: "currentColor",
|
|
176
|
+
strokeWidth: 2,
|
|
177
|
+
strokeLinecap: "round",
|
|
178
|
+
strokeLinejoin: "round"
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/Icon.js
|
|
182
|
+
var Icon = (0, import_react2.forwardRef)(
|
|
183
|
+
(_a, ref) => {
|
|
184
|
+
var _b = _a, {
|
|
185
|
+
color = "currentColor",
|
|
186
|
+
size = 24,
|
|
187
|
+
strokeWidth = 2,
|
|
188
|
+
absoluteStrokeWidth,
|
|
189
|
+
className = "",
|
|
190
|
+
children,
|
|
191
|
+
iconNode
|
|
192
|
+
} = _b, rest = __objRest(_b, [
|
|
193
|
+
"color",
|
|
194
|
+
"size",
|
|
195
|
+
"strokeWidth",
|
|
196
|
+
"absoluteStrokeWidth",
|
|
197
|
+
"className",
|
|
198
|
+
"children",
|
|
199
|
+
"iconNode"
|
|
200
|
+
]);
|
|
201
|
+
return (0, import_react2.createElement)(
|
|
202
|
+
"svg",
|
|
203
|
+
__spreadValues(__spreadProps(__spreadValues({
|
|
204
|
+
ref
|
|
205
|
+
}, defaultAttributes), {
|
|
206
|
+
width: size,
|
|
207
|
+
height: size,
|
|
208
|
+
stroke: color,
|
|
209
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
210
|
+
className: mergeClasses("lucide", className)
|
|
211
|
+
}), rest),
|
|
212
|
+
[
|
|
213
|
+
...iconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
|
|
214
|
+
...Array.isArray(children) ? children : [children]
|
|
215
|
+
]
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
221
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
222
|
+
const Component = (0, import_react3.forwardRef)(
|
|
223
|
+
(_a, ref) => {
|
|
224
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
225
|
+
return (0, import_react3.createElement)(Icon, __spreadValues({
|
|
226
|
+
ref,
|
|
227
|
+
iconNode,
|
|
228
|
+
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className)
|
|
229
|
+
}, props));
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
Component.displayName = `${iconName}`;
|
|
233
|
+
return Component;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/arrow-right.js
|
|
237
|
+
init_react_import();
|
|
238
|
+
var ArrowRight = createLucideIcon("ArrowRight", [
|
|
239
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
240
|
+
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
241
|
+
]);
|
|
242
|
+
|
|
243
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/arrow-up.js
|
|
244
|
+
init_react_import();
|
|
245
|
+
var ArrowUp = createLucideIcon("ArrowUp", [
|
|
246
|
+
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
247
|
+
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
248
|
+
]);
|
|
249
|
+
|
|
250
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/bot.js
|
|
251
|
+
init_react_import();
|
|
252
|
+
var Bot = createLucideIcon("Bot", [
|
|
253
|
+
["path", { d: "M12 8V4H8", key: "hb8ula" }],
|
|
254
|
+
["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
|
|
255
|
+
["path", { d: "M2 14h2", key: "vft8re" }],
|
|
256
|
+
["path", { d: "M20 14h2", key: "4cs60a" }],
|
|
257
|
+
["path", { d: "M15 13v2", key: "1xurst" }],
|
|
258
|
+
["path", { d: "M9 13v2", key: "rq6x2g" }]
|
|
259
|
+
]);
|
|
260
|
+
|
|
261
|
+
// ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.1.1/node_modules/lucide-react/dist/esm/icons/check.js
|
|
262
|
+
init_react_import();
|
|
263
|
+
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
264
|
+
|
|
265
|
+
// src/components/Chat/index.tsx
|
|
266
|
+
init_react_import();
|
|
267
|
+
var import_react20 = require("@ai-sdk/react");
|
|
268
|
+
var import_puck5 = require("@measured/puck");
|
|
269
|
+
var import_ai = require("ai");
|
|
270
|
+
var import_react21 = require("react");
|
|
271
|
+
var import_ulid = require("ulid");
|
|
272
|
+
|
|
273
|
+
// ../platform-client/index.ts
|
|
274
|
+
init_react_import();
|
|
275
|
+
|
|
276
|
+
// ../platform-client/components/ActionModal/index.ts
|
|
277
|
+
init_react_import();
|
|
278
|
+
|
|
279
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
280
|
+
init_react_import();
|
|
281
|
+
|
|
282
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/ActionModal/ActionModal.module.css#css-module
|
|
283
|
+
init_react_import();
|
|
284
|
+
var ActionModal_module_default = { "ActionModal": "_ActionModal_r3pvy_1", "ActionModal-header": "_ActionModal-header_r3pvy_6", "ActionModal-body": "_ActionModal-body_r3pvy_17", "ActionModal-footer": "_ActionModal-footer_r3pvy_22" };
|
|
285
|
+
|
|
286
|
+
// ../platform-client/lib/index.ts
|
|
287
|
+
init_react_import();
|
|
288
|
+
|
|
289
|
+
// ../platform-client/lib/get-class-name-factory.ts
|
|
290
|
+
init_react_import();
|
|
291
|
+
var import_classnames = __toESM(require_classnames());
|
|
292
|
+
var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
|
|
293
|
+
let descendant = false;
|
|
294
|
+
let modifiers = false;
|
|
295
|
+
if (typeof options === "string") {
|
|
296
|
+
descendant = options;
|
|
297
|
+
} else if (typeof options === "object") {
|
|
298
|
+
modifiers = options;
|
|
299
|
+
}
|
|
300
|
+
if (descendant) {
|
|
301
|
+
const style = styles[`${rootClass}-${descendant}`];
|
|
302
|
+
if (style) {
|
|
303
|
+
return baseClass + styles[`${rootClass}-${descendant}`] || "";
|
|
304
|
+
}
|
|
305
|
+
return "";
|
|
306
|
+
} else if (modifiers) {
|
|
307
|
+
const prefixedModifiers = {};
|
|
308
|
+
for (let modifier in modifiers) {
|
|
309
|
+
prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
|
|
310
|
+
}
|
|
311
|
+
const c = styles[rootClass];
|
|
312
|
+
return baseClass + (0, import_classnames.default)(__spreadValues({
|
|
313
|
+
[c]: !!c
|
|
314
|
+
}, prefixedModifiers));
|
|
315
|
+
} else {
|
|
316
|
+
return baseClass + styles[rootClass] || "";
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
var get_class_name_factory_default = getClassNameFactory;
|
|
320
|
+
|
|
321
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
322
|
+
init_react_import();
|
|
323
|
+
|
|
324
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Modal/Modal.module.css#css-module
|
|
325
|
+
init_react_import();
|
|
326
|
+
var Modal_module_default = { "Modal-background": "_Modal-background_874yi_1", "Modal--visible": "_Modal--visible_874yi_16", "Modal-modal": "_Modal-modal_874yi_22" };
|
|
327
|
+
|
|
328
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
329
|
+
var import_react6 = require("react");
|
|
330
|
+
|
|
331
|
+
// ../platform-client/lib/use-modal-visible.ts
|
|
332
|
+
init_react_import();
|
|
333
|
+
var import_react4 = require("react");
|
|
334
|
+
|
|
335
|
+
// ../platform-client/components/Button/index.ts
|
|
336
|
+
init_react_import();
|
|
337
|
+
|
|
338
|
+
// ../platform-client/components/Button/Button.tsx
|
|
339
|
+
init_react_import();
|
|
340
|
+
var import_react5 = require("react");
|
|
341
|
+
|
|
342
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Button/Button.module.css#css-module
|
|
343
|
+
init_react_import();
|
|
344
|
+
var Button_module_default = { "Button": "_Button_w2ngt_1", "Button--medium": "_Button--medium_w2ngt_29", "Button--large": "_Button--large_w2ngt_37", "Button-icon": "_Button-icon_w2ngt_44", "Button--primary": "_Button--primary_w2ngt_48", "Button--secondary": "_Button--secondary_w2ngt_67", "Button--flush": "_Button--flush_w2ngt_84", "Button--disabled": "_Button--disabled_w2ngt_88", "Button--fullWidth": "_Button--fullWidth_w2ngt_95", "Button-spinner": "_Button-spinner_w2ngt_100" };
|
|
345
|
+
|
|
346
|
+
// ../platform-client/components/Loader/index.tsx
|
|
347
|
+
init_react_import();
|
|
348
|
+
|
|
349
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Loader/styles.module.css#css-module
|
|
350
|
+
init_react_import();
|
|
351
|
+
var styles_module_default = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
|
352
|
+
|
|
353
|
+
// ../platform-client/components/Loader/index.tsx
|
|
354
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
355
|
+
var getClassName = getClassNameFactory("Loader", styles_module_default);
|
|
356
|
+
var Loader = (_a) => {
|
|
357
|
+
var _b = _a, {
|
|
358
|
+
color,
|
|
359
|
+
size = 16
|
|
360
|
+
} = _b, props = __objRest(_b, [
|
|
361
|
+
"color",
|
|
362
|
+
"size"
|
|
363
|
+
]);
|
|
364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
365
|
+
"span",
|
|
366
|
+
__spreadValues({
|
|
367
|
+
className: getClassName(),
|
|
368
|
+
style: {
|
|
369
|
+
width: size,
|
|
370
|
+
height: size,
|
|
371
|
+
color
|
|
372
|
+
},
|
|
373
|
+
"aria-label": "loading"
|
|
374
|
+
}, props)
|
|
375
|
+
);
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// ../platform-client/components/Button/Button.tsx
|
|
379
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
380
|
+
var getClassName2 = get_class_name_factory_default("Button", Button_module_default);
|
|
381
|
+
var Button = ({
|
|
382
|
+
children,
|
|
383
|
+
href,
|
|
384
|
+
onClick,
|
|
385
|
+
variant = "primary",
|
|
386
|
+
type,
|
|
387
|
+
disabled,
|
|
388
|
+
tabIndex,
|
|
389
|
+
newTab,
|
|
390
|
+
fullWidth,
|
|
391
|
+
icon,
|
|
392
|
+
size = "medium",
|
|
393
|
+
loading: loadingProp = false
|
|
394
|
+
}) => {
|
|
395
|
+
const [loading, setLoading] = (0, import_react5.useState)(loadingProp);
|
|
396
|
+
(0, import_react5.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
|
397
|
+
const ElementType = href ? "a" : type ? "button" : "span";
|
|
398
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
399
|
+
ElementType,
|
|
400
|
+
{
|
|
401
|
+
className: getClassName2({
|
|
402
|
+
primary: variant === "primary",
|
|
403
|
+
secondary: variant === "secondary",
|
|
404
|
+
disabled,
|
|
405
|
+
fullWidth,
|
|
406
|
+
[size]: true
|
|
407
|
+
}),
|
|
408
|
+
onClick: (e) => {
|
|
409
|
+
if (disabled) return;
|
|
410
|
+
if (!onClick) return;
|
|
411
|
+
setLoading(true);
|
|
412
|
+
Promise.resolve(onClick(e)).then(() => {
|
|
413
|
+
setLoading(false);
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
type,
|
|
417
|
+
disabled: disabled || loading,
|
|
418
|
+
tabIndex,
|
|
419
|
+
target: newTab ? "_blank" : void 0,
|
|
420
|
+
rel: newTab ? "noreferrer" : void 0,
|
|
421
|
+
href,
|
|
422
|
+
children: [
|
|
423
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("icon"), children: icon }),
|
|
424
|
+
children,
|
|
425
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 14 }) })
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
return el;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// ../platform-client/components/Modal/Modal.tsx
|
|
433
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
434
|
+
var getClassName3 = getClassNameFactory("Modal", Modal_module_default);
|
|
435
|
+
var modalContext = (0, import_react6.createContext)({ visible: false, setVisible: () => {
|
|
436
|
+
}, ref: null });
|
|
437
|
+
var Modal = ({
|
|
438
|
+
actionLabel = "Open",
|
|
439
|
+
children
|
|
440
|
+
}) => {
|
|
441
|
+
const { visible, setVisible, ref } = (0, import_react6.useContext)(modalContext);
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3({ visible }), children: [
|
|
443
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("button"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
444
|
+
Button,
|
|
445
|
+
{
|
|
446
|
+
variant: "secondary",
|
|
447
|
+
onClick: () => {
|
|
448
|
+
setVisible(!visible);
|
|
449
|
+
},
|
|
450
|
+
children: actionLabel
|
|
451
|
+
}
|
|
452
|
+
) }),
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("background"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("modal"), ref, children }) })
|
|
454
|
+
] });
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// ../platform-client/components/Heading/index.ts
|
|
458
|
+
init_react_import();
|
|
459
|
+
|
|
460
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
461
|
+
init_react_import();
|
|
462
|
+
|
|
463
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Heading/Heading.module.css#css-module
|
|
464
|
+
init_react_import();
|
|
465
|
+
var Heading_module_default = { "Heading": "_Heading_1czuc_1", "Heading--xxxxl": "_Heading--xxxxl_1czuc_11", "Heading--xxxl": "_Heading--xxxl_1czuc_17", "Heading--xxl": "_Heading--xxl_1czuc_21", "Heading--xl": "_Heading--xl_1czuc_25", "Heading--l": "_Heading--l_1czuc_29", "Heading--m": "_Heading--m_1czuc_33", "Heading--s": "_Heading--s_1czuc_37", "Heading--xs": "_Heading--xs_1czuc_41", "Heading--xxs": "_Heading--xxs_1czuc_45" };
|
|
466
|
+
|
|
467
|
+
// ../platform-client/components/Heading/Heading.tsx
|
|
468
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
469
|
+
var getClassName4 = get_class_name_factory_default("Heading", Heading_module_default);
|
|
470
|
+
var Heading = ({ children, rank, size = "m" }) => {
|
|
471
|
+
const Tag2 = rank ? `h${rank}` : "span";
|
|
472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
473
|
+
Tag2,
|
|
474
|
+
{
|
|
475
|
+
className: getClassName4({
|
|
476
|
+
[size]: true
|
|
477
|
+
}),
|
|
478
|
+
children
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
// ../platform-client/components/ActionModal/ActionModal.tsx
|
|
484
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
485
|
+
var getClassName5 = getClassNameFactory("ActionModal", ActionModal_module_default);
|
|
486
|
+
var ActionModalFooter = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName5("footer"), children });
|
|
487
|
+
var ActionModal = ({
|
|
488
|
+
actionLabel = "Open",
|
|
489
|
+
children,
|
|
490
|
+
title,
|
|
491
|
+
description,
|
|
492
|
+
actions
|
|
493
|
+
}) => {
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Modal, { actionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5("header"), children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { size: "s", children: title }),
|
|
497
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: description })
|
|
498
|
+
] }),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: getClassName5("body"), children }),
|
|
500
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionModalFooter, { children: actions })
|
|
501
|
+
] }) });
|
|
502
|
+
};
|
|
503
|
+
ActionModal.Footer = ActionModalFooter;
|
|
504
|
+
|
|
505
|
+
// ../platform-client/components/AIAction/index.tsx
|
|
506
|
+
init_react_import();
|
|
507
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
508
|
+
|
|
509
|
+
// ../platform-client/components/Align/index.ts
|
|
510
|
+
init_react_import();
|
|
511
|
+
|
|
512
|
+
// ../platform-client/components/Align/Align.tsx
|
|
513
|
+
init_react_import();
|
|
514
|
+
var import_react7 = __toESM(require("react"));
|
|
515
|
+
|
|
516
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Align/Align.module.css#css-module
|
|
517
|
+
init_react_import();
|
|
518
|
+
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" };
|
|
519
|
+
|
|
520
|
+
// ../../node_modules/.pnpm/camelcase@8.0.0/node_modules/camelcase/index.js
|
|
521
|
+
init_react_import();
|
|
522
|
+
var IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
523
|
+
var SEPARATORS = /[_.\- ]+/;
|
|
524
|
+
var LEADING_SEPARATORS = new RegExp("^" + SEPARATORS.source);
|
|
525
|
+
var SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, "gu");
|
|
526
|
+
var NUMBERS_AND_IDENTIFIER = new RegExp("\\d+" + IDENTIFIER.source, "gu");
|
|
527
|
+
|
|
528
|
+
// ../platform-client/components/Align/Align.tsx
|
|
529
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
530
|
+
var getClassName6 = get_class_name_factory_default("Align", Align_module_default);
|
|
531
|
+
|
|
532
|
+
// ../platform-client/components/AutoForm/index.ts
|
|
533
|
+
init_react_import();
|
|
534
|
+
|
|
535
|
+
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
536
|
+
init_react_import();
|
|
537
|
+
var import_puck = require("@measured/puck");
|
|
538
|
+
var import_react8 = require("react");
|
|
539
|
+
|
|
540
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/AutoForm/AutoForm.module.css#css-module
|
|
541
|
+
init_react_import();
|
|
542
|
+
var AutoForm_module_default = { "AutoForm": "_AutoForm_1vmh9_1" };
|
|
543
|
+
|
|
544
|
+
// ../platform-client/components/AutoForm/AutoForm.tsx
|
|
545
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
546
|
+
var getClassName7 = getClassNameFactory("AutoForm", AutoForm_module_default);
|
|
547
|
+
|
|
548
|
+
// ../platform-client/components/Avatar/index.ts
|
|
549
|
+
init_react_import();
|
|
550
|
+
|
|
551
|
+
// ../platform-client/components/Avatar/Avatar.tsx
|
|
552
|
+
init_react_import();
|
|
553
|
+
|
|
554
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Avatar/Avatar.module.css#css-module
|
|
555
|
+
init_react_import();
|
|
556
|
+
var Avatar_module_default = { "Avatar": "_Avatar_meij0_1", "Avatar--onLightGrey": "_Avatar--onLightGrey_meij0_15", "Avatar--flush": "_Avatar--flush_meij0_19", "Avatar-image": "_Avatar-image_meij0_24", "Avatar-name": "_Avatar-name_meij0_41", "Avatar--smallText": "_Avatar--smallText_meij0_50", "Avatar--inline": "_Avatar--inline_meij0_54", "Avatar--muted": "_Avatar--muted_meij0_59" };
|
|
557
|
+
|
|
558
|
+
// ../platform-client/components/Avatar/Avatar.tsx
|
|
559
|
+
var import_link = __toESM(require("next/link"));
|
|
560
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
561
|
+
var getClassName8 = get_class_name_factory_default("Avatar", Avatar_module_default);
|
|
562
|
+
|
|
563
|
+
// ../platform-client/components/Card/index.ts
|
|
564
|
+
init_react_import();
|
|
565
|
+
|
|
566
|
+
// ../platform-client/components/Card/Card.tsx
|
|
567
|
+
init_react_import();
|
|
568
|
+
|
|
569
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Card/Card.module.css#css-module
|
|
570
|
+
init_react_import();
|
|
571
|
+
var Card_module_default = { "Card": "_Card_jzb6b_1", "Card-body": "_Card-body_jzb6b_17", "Card-title": "_Card-title_jzb6b_23", "Card-subtitle": "_Card-subtitle_jzb6b_27", "Card-chevron": "_Card-chevron_jzb6b_31", "Card--showChevron": "_Card--showChevron_jzb6b_37", "Card--isActive": "_Card--isActive_jzb6b_41" };
|
|
572
|
+
|
|
573
|
+
// ../platform-client/components/Card/Card.tsx
|
|
574
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
575
|
+
var getClassName9 = get_class_name_factory_default("Card", Card_module_default);
|
|
576
|
+
|
|
577
|
+
// ../platform-client/components/Footer/index.tsx
|
|
578
|
+
init_react_import();
|
|
579
|
+
|
|
580
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Footer/styles.module.css#css-module
|
|
581
|
+
init_react_import();
|
|
582
|
+
var styles_module_default2 = { "Footer": "_Footer_eew04_1", "Footer--dark": "_Footer--dark_eew04_7", "Footer-inner": "_Footer-inner_eew04_13", "Footer-brand": "_Footer-brand_eew04_21", "Footer-main": "_Footer-main_eew04_26", "Footer-logo": "_Footer-logo_eew04_41", "Footer-copyright": "_Footer-copyright_eew04_46", "Footer-sections": "_Footer-sections_eew04_54", "Footer-section": "_Footer-section_eew04_54", "Footer-sectionHeader": "_Footer-sectionHeader_eew04_72", "Footer-icon": "_Footer-icon_eew04_77", "Footer-link": "_Footer-link_eew04_86" };
|
|
583
|
+
|
|
584
|
+
// ../platform-client/components/Footer/index.tsx
|
|
585
|
+
var import_link2 = __toESM(require("next/link"));
|
|
586
|
+
|
|
587
|
+
// ../platform-client/components/Logo/index.tsx
|
|
588
|
+
init_react_import();
|
|
589
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
590
|
+
|
|
591
|
+
// ../platform-client/components/Footer/index.tsx
|
|
592
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
593
|
+
var cx = getClassNameFactory("Footer", styles_module_default2);
|
|
594
|
+
|
|
595
|
+
// ../platform-client/components/IconButton/index.ts
|
|
596
|
+
init_react_import();
|
|
597
|
+
|
|
598
|
+
// ../platform-client/components/IconButton/IconButton.tsx
|
|
599
|
+
init_react_import();
|
|
600
|
+
var import_react9 = require("react");
|
|
601
|
+
|
|
602
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/IconButton/IconButton.module.css#css-module
|
|
603
|
+
init_react_import();
|
|
604
|
+
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" };
|
|
605
|
+
|
|
606
|
+
// ../platform-client/components/IconButton/IconButton.tsx
|
|
607
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
608
|
+
var getClassName10 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
|
609
|
+
|
|
610
|
+
// ../platform-client/components/InfoBar/index.tsx
|
|
611
|
+
init_react_import();
|
|
612
|
+
|
|
613
|
+
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
614
|
+
init_react_import();
|
|
615
|
+
|
|
616
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/InfoBar/InfoBar.module.css#css-module
|
|
617
|
+
init_react_import();
|
|
618
|
+
var InfoBar_module_default = { "InfoBar": "_InfoBar_kchdj_1", "Info": "_Info_kchdj_1", "Info-title": "_Info-title_kchdj_21" };
|
|
619
|
+
|
|
620
|
+
// ../platform-client/components/InfoBar/InfoBar.tsx
|
|
621
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
622
|
+
var cx2 = getClassNameFactory("InfoBar", InfoBar_module_default);
|
|
623
|
+
var cxInfo = getClassNameFactory("Info", InfoBar_module_default);
|
|
624
|
+
var Info = ({ title, children }) => {
|
|
625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cxInfo(), children: [
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cxInfo("title"), children: title }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cxInfo("children"), children })
|
|
628
|
+
] });
|
|
629
|
+
};
|
|
630
|
+
var InfoBar = ({ children }) => {
|
|
631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cx2(), children });
|
|
632
|
+
};
|
|
633
|
+
InfoBar.Info = Info;
|
|
634
|
+
|
|
635
|
+
// ../platform-client/components/Inline/index.ts
|
|
636
|
+
init_react_import();
|
|
637
|
+
|
|
638
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
639
|
+
init_react_import();
|
|
640
|
+
|
|
641
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Inline/Inline.module.css#css-module
|
|
642
|
+
init_react_import();
|
|
643
|
+
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" };
|
|
644
|
+
|
|
645
|
+
// ../platform-client/components/Inline/Inline.tsx
|
|
646
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
647
|
+
var getClassName11 = get_class_name_factory_default("Inline", Inline_module_default);
|
|
648
|
+
var Inline = ({
|
|
649
|
+
children,
|
|
650
|
+
grow,
|
|
651
|
+
center,
|
|
652
|
+
size = "m",
|
|
653
|
+
noWrap,
|
|
654
|
+
centerH
|
|
655
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
656
|
+
"div",
|
|
657
|
+
{
|
|
658
|
+
className: getClassName11({
|
|
659
|
+
grow,
|
|
660
|
+
center,
|
|
661
|
+
centerH,
|
|
662
|
+
noWrap,
|
|
663
|
+
[`size${size.toUpperCase()}`]: size
|
|
664
|
+
}),
|
|
665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName11("inner"), children })
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
var InlineItem = ({
|
|
669
|
+
children,
|
|
670
|
+
grow,
|
|
671
|
+
push,
|
|
672
|
+
shrink
|
|
673
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
style: {
|
|
677
|
+
flexGrow: grow ? typeof grow === "number" ? grow : "1" : "0",
|
|
678
|
+
flexShrink: shrink ? "1" : "0",
|
|
679
|
+
marginLeft: push ? "auto" : 0,
|
|
680
|
+
maxWidth: "100%"
|
|
681
|
+
},
|
|
682
|
+
children
|
|
683
|
+
}
|
|
684
|
+
);
|
|
685
|
+
Inline.Item = InlineItem;
|
|
686
|
+
|
|
687
|
+
// ../platform-client/components/Layout/index.ts
|
|
688
|
+
init_react_import();
|
|
689
|
+
|
|
690
|
+
// ../platform-client/components/Layout/Layout.tsx
|
|
691
|
+
init_react_import();
|
|
692
|
+
|
|
693
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Layout/Layout.module.css#css-module
|
|
694
|
+
init_react_import();
|
|
695
|
+
var Layout_module_default = { "Layout": "_Layout_hy65k_1", "Layout-switcher": "_Layout-switcher_hy65k_12", "Layout-bar": "_Layout-bar_hy65k_18", "Layout-nav": "_Layout-nav_hy65k_25", "Layout-page": "_Layout-page_hy65k_30" };
|
|
696
|
+
|
|
697
|
+
// ../platform-client/components/Layout/Layout.tsx
|
|
698
|
+
var import_react10 = require("react");
|
|
699
|
+
|
|
700
|
+
// ../platform-client/components/Nav/index.ts
|
|
701
|
+
init_react_import();
|
|
702
|
+
|
|
703
|
+
// ../platform-client/components/Nav/Nav.tsx
|
|
704
|
+
init_react_import();
|
|
705
|
+
|
|
706
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Nav/Nav.module.css#css-module
|
|
707
|
+
init_react_import();
|
|
708
|
+
var Nav_module_default = { "Nav-list": "_Nav-list_b6txo_1", "NavSection": "_NavSection_b6txo_7", "Nav--slim": "_Nav--slim_b6txo_15", "NavSection-list": "_NavSection-list_b6txo_24", "NavSection-title": "_NavSection-title_b6txo_36", "NavItem-link": "_NavItem-link_b6txo_47", "NavItem-linkIcon": "_NavItem-linkIcon_b6txo_67", "NavItem--active": "_NavItem--active_b6txo_72", "NavItem": "_NavItem_b6txo_47", "NavItem-list": "_NavItem-list_b6txo_91" };
|
|
709
|
+
|
|
710
|
+
// ../platform-client/components/Nav/Nav.tsx
|
|
711
|
+
var import_link3 = __toESM(require("next/link"));
|
|
712
|
+
var import_navigation = require("next/navigation");
|
|
713
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
714
|
+
var getClassName12 = getClassNameFactory("Nav", Nav_module_default);
|
|
715
|
+
var getClassNameSection = getClassNameFactory("NavSection", Nav_module_default);
|
|
716
|
+
var getClassNameItem = getClassNameFactory("NavItem", Nav_module_default);
|
|
717
|
+
|
|
718
|
+
// ../platform-client/components/Layout/Layout.tsx
|
|
719
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
720
|
+
var getClassName13 = getClassNameFactory("Layout", Layout_module_default);
|
|
721
|
+
|
|
722
|
+
// ../platform-client/components/Link/index.ts
|
|
723
|
+
init_react_import();
|
|
724
|
+
|
|
725
|
+
// ../platform-client/components/Link/Link.tsx
|
|
726
|
+
init_react_import();
|
|
727
|
+
|
|
728
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Link/Link.module.css#css-module
|
|
729
|
+
init_react_import();
|
|
730
|
+
var Link_module_default = { "Link": "_Link_1j70m_1" };
|
|
731
|
+
|
|
732
|
+
// ../platform-client/components/Link/Link.tsx
|
|
733
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
734
|
+
var getClassName14 = get_class_name_factory_default("Link", Link_module_default);
|
|
735
|
+
|
|
736
|
+
// ../platform-client/components/Modal/index.ts
|
|
737
|
+
init_react_import();
|
|
738
|
+
|
|
739
|
+
// ../platform-client/components/Page/index.ts
|
|
740
|
+
init_react_import();
|
|
741
|
+
|
|
742
|
+
// ../platform-client/components/Page/Page.tsx
|
|
743
|
+
init_react_import();
|
|
744
|
+
|
|
745
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Page/Page.module.css#css-module
|
|
746
|
+
init_react_import();
|
|
747
|
+
var Page_module_default = { "Page": "_Page_1uz1e_1", "Page-masthead": "_Page-masthead_1uz1e_8", "Page-crumbs": "_Page-crumbs_1uz1e_18", "Page-crumb": "_Page-crumb_1uz1e_18", "Page-crumbLink": "_Page-crumbLink_1uz1e_28", "Page-actions": "_Page-actions_1uz1e_60" };
|
|
748
|
+
|
|
749
|
+
// ../platform-client/components/Page/Page.tsx
|
|
750
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
751
|
+
var cx3 = getClassNameFactory("Page", Page_module_default);
|
|
752
|
+
|
|
753
|
+
// ../platform-client/components/Puck/index.ts
|
|
754
|
+
init_react_import();
|
|
755
|
+
|
|
756
|
+
// ../platform-client/components/Puck/Puck.tsx
|
|
757
|
+
init_react_import();
|
|
758
|
+
var import_puck4 = require("@measured/puck");
|
|
759
|
+
|
|
760
|
+
// ../platform-client/components/PuckLayout/index.ts
|
|
761
|
+
init_react_import();
|
|
762
|
+
|
|
763
|
+
// ../platform-client/components/PuckLayout/PuckLayout.tsx
|
|
764
|
+
init_react_import();
|
|
765
|
+
var import_puck3 = require("@measured/puck");
|
|
766
|
+
|
|
767
|
+
// ../platform-client/components/PuckHeader/index.ts
|
|
768
|
+
init_react_import();
|
|
769
|
+
|
|
770
|
+
// ../platform-client/components/PuckHeader/PuckHeader.tsx
|
|
771
|
+
init_react_import();
|
|
772
|
+
|
|
773
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/PuckHeader/PuckHeader.module.css#css-module
|
|
774
|
+
init_react_import();
|
|
775
|
+
var PuckHeader_module_default = { "PuckHeader": "_PuckHeader_19h0f_1", "PuckHeader-left": "_PuckHeader-left_19h0f_16", "PuckHeader-center": "_PuckHeader-center_19h0f_22", "PuckHeader-right": "_PuckHeader-right_19h0f_27", "PuckHeader-pageInput": "_PuckHeader-pageInput_19h0f_34", "PuckHeader-pageInputActions": "_PuckHeader-pageInputActions_19h0f_50", "PuckHeader-input": "_PuckHeader-input_19h0f_56", "PuckHeader-historyActions": "_PuckHeader-historyActions_19h0f_69" };
|
|
776
|
+
|
|
777
|
+
// ../platform-client/components/PuckHeader/PuckHeader.tsx
|
|
778
|
+
var import_puck2 = require("@measured/puck");
|
|
779
|
+
|
|
780
|
+
// ../platform-client/context/editor.tsx
|
|
781
|
+
init_react_import();
|
|
782
|
+
var import_react11 = require("react");
|
|
783
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
784
|
+
var ctx = (0, import_react11.createContext)({});
|
|
785
|
+
|
|
786
|
+
// ../platform-client/components/StatusTag/index.ts
|
|
787
|
+
init_react_import();
|
|
788
|
+
|
|
789
|
+
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
790
|
+
init_react_import();
|
|
791
|
+
|
|
792
|
+
// ../platform-client/components/Tag/index.ts
|
|
793
|
+
init_react_import();
|
|
794
|
+
|
|
795
|
+
// ../platform-client/components/Tag/Tag.tsx
|
|
796
|
+
init_react_import();
|
|
797
|
+
|
|
798
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Tag/Tag.module.css#css-module
|
|
799
|
+
init_react_import();
|
|
800
|
+
var Tag_module_default = { "Tag": "_Tag_1baze_1", "Tag--colorBlue": "_Tag--colorBlue_1baze_19", "Tag--colorGreen": "_Tag--colorGreen_1baze_23", "Tag--colorRed": "_Tag--colorRed_1baze_27", "Tag--colorMuted": "_Tag--colorMuted_1baze_31", "Tag-sprite": "_Tag-sprite_1baze_35", "Tag--pulse": "_Tag--pulse_1baze_39", "pulse": "_pulse_1baze_1" };
|
|
801
|
+
|
|
802
|
+
// ../platform-client/components/Tag/Tag.tsx
|
|
803
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
804
|
+
var getClassName15 = getClassNameFactory("Tag", Tag_module_default);
|
|
805
|
+
|
|
806
|
+
// ../platform-client/components/StatusTag/StatusTag.tsx
|
|
807
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
808
|
+
|
|
809
|
+
// ../platform-client/components/PuckHeader/PuckHeader.tsx
|
|
810
|
+
var import_react13 = require("react");
|
|
811
|
+
|
|
812
|
+
// ../platform-client/components/AppSwitchers/index.ts
|
|
813
|
+
init_react_import();
|
|
814
|
+
|
|
815
|
+
// ../platform-client/components/AppSwitchers/AppSwitchers.tsx
|
|
816
|
+
init_react_import();
|
|
817
|
+
|
|
818
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/AppSwitchers/AppSwitchers.module.css#css-module
|
|
819
|
+
init_react_import();
|
|
820
|
+
var AppSwitchers_module_default = { "AppSwitchers": "_AppSwitchers_b7m1z_1", "AppSwitchers-divider": "_AppSwitchers-divider_b7m1z_8" };
|
|
821
|
+
|
|
822
|
+
// ../platform-client/components/AppSwitchers/AppSwitchers.tsx
|
|
823
|
+
var import_react12 = require("react");
|
|
824
|
+
|
|
825
|
+
// ../platform-client/components/Switcher/index.ts
|
|
826
|
+
init_react_import();
|
|
827
|
+
|
|
828
|
+
// ../platform-client/components/Switcher/Switcher.tsx
|
|
829
|
+
init_react_import();
|
|
830
|
+
|
|
831
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Switcher/Switcher.module.css#css-module
|
|
832
|
+
init_react_import();
|
|
833
|
+
var Switcher_module_default = { "Switcher": "_Switcher_134wo_1", "Switcher-link": "_Switcher-link_134wo_8", "Switcher-switcher": "_Switcher-switcher_134wo_18", "Switcher--hasHref": "_Switcher--hasHref_134wo_29", "Switcher-logoInner": "_Switcher-logoInner_134wo_35", "Switcher-label": "_Switcher-label_134wo_42", "Switcher--slim": "_Switcher--slim_134wo_55", "Switcher-logo": "_Switcher-logo_134wo_35", "Switcher-menu": "_Switcher-menu_134wo_64", "Switcher--menuVisible": "_Switcher--menuVisible_134wo_75", "Switcher-menuList": "_Switcher-menuList_134wo_79", "Switcher-menuItemAction": "_Switcher-menuItemAction_134wo_85" };
|
|
834
|
+
|
|
835
|
+
// ../platform-client/components/Switcher/Switcher.tsx
|
|
836
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
837
|
+
var getClassName16 = getClassNameFactory("Switcher", Switcher_module_default);
|
|
838
|
+
|
|
839
|
+
// ../platform-client/components/AppSwitchers/AppSwitchers.tsx
|
|
840
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
841
|
+
var getClassName17 = getClassNameFactory("AppSwitchers", AppSwitchers_module_default);
|
|
842
|
+
|
|
843
|
+
// ../platform-client/components/PuckHeader/PuckHeader.tsx
|
|
844
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
845
|
+
var getClassName18 = get_class_name_factory_default("PuckHeader", PuckHeader_module_default);
|
|
846
|
+
|
|
847
|
+
// ../platform-client/components/PuckLayout/PuckLayout.tsx
|
|
848
|
+
var import_react14 = require("react");
|
|
849
|
+
|
|
850
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/PuckLayout/PuckLayout.module.css#css-module
|
|
851
|
+
init_react_import();
|
|
852
|
+
var PuckLayout_module_default = { "PuckLayout": "_PuckLayout_1yvk1_1", "PuckLayout-layout": "_PuckLayout-layout_1yvk1_8", "PuckLayout-loader": "_PuckLayout-loader_1yvk1_15", "PuckLayout-sideHeader": "_PuckLayout-sideHeader_1yvk1_24", "PuckLayout-switcher": "_PuckLayout-switcher_1yvk1_32", "PuckLayout-nav": "_PuckLayout-nav_1yvk1_37", "PuckLayout-versionLoader": "_PuckLayout-versionLoader_1yvk1_42", "PuckLayout-versionList": "_PuckLayout-versionList_1yvk1_48", "PuckLayout-version": "_PuckLayout-version_1yvk1_42", "PuckLayout-versionBody": "_PuckLayout-versionBody_1yvk1_64", "PuckLayout-versionDetails": "_PuckLayout-versionDetails_1yvk1_71", "PuckLayout-versionInner": "_PuckLayout-versionInner_1yvk1_81", "PuckLayout-versionVersion": "_PuckLayout-versionVersion_1yvk1_86", "PuckLayout-versionStatus": "_PuckLayout-versionStatus_1yvk1_90", "PuckLayout-versionAuthor": "_PuckLayout-versionAuthor_1yvk1_104", "PuckLayout-versionAuthorName": "_PuckLayout-versionAuthorName_1yvk1_108", "PuckLayout-versionDate": "_PuckLayout-versionDate_1yvk1_112", "PuckLayout-fields": "_PuckLayout-fields_1yvk1_117", "PuckLayout-sidebar": "_PuckLayout-sidebar_1yvk1_121" };
|
|
853
|
+
|
|
854
|
+
// ../platform-client/components/PuckLayout/PuckLayout.tsx
|
|
855
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
856
|
+
var getClassName19 = getClassNameFactory("PuckLayout", PuckLayout_module_default);
|
|
857
|
+
|
|
858
|
+
// ../platform-client/components/Puck/Puck.tsx
|
|
859
|
+
var import_react15 = require("react");
|
|
860
|
+
var import_navigation2 = require("next/navigation");
|
|
861
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
862
|
+
|
|
863
|
+
// ../platform-client/components/Section/index.ts
|
|
864
|
+
init_react_import();
|
|
865
|
+
|
|
866
|
+
// ../platform-client/components/Section/Section.tsx
|
|
867
|
+
init_react_import();
|
|
868
|
+
|
|
869
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Section/Section.module.css#css-module
|
|
870
|
+
init_react_import();
|
|
871
|
+
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" };
|
|
872
|
+
|
|
873
|
+
// ../platform-client/components/Section/Section.tsx
|
|
874
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
875
|
+
var getClassName20 = getClassNameFactory("Section", Section_module_default);
|
|
876
|
+
|
|
877
|
+
// ../platform-client/components/Table/index.ts
|
|
878
|
+
init_react_import();
|
|
879
|
+
|
|
880
|
+
// ../platform-client/components/Table/Table.tsx
|
|
881
|
+
init_react_import();
|
|
882
|
+
var import_react16 = require("react");
|
|
883
|
+
|
|
884
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Table/Table.module.css#css-module
|
|
885
|
+
init_react_import();
|
|
886
|
+
var Table_module_default = { "Table": "_Table_1t44j_1", "Table-filters": "_Table-filters_1t44j_8", "Table-inner": "_Table-inner_1t44j_12", "Table-table": "_Table-table_1t44j_16", "Table-footer": "_Table-footer_1t44j_78", "Table--clickableRows": "_Table--clickableRows_1t44j_82", "Table-placeholder": "_Table-placeholder_1t44j_87" };
|
|
887
|
+
|
|
888
|
+
// ../platform-client/components/Table/Table.tsx
|
|
889
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
890
|
+
var getClassName21 = get_class_name_factory_default("Table", Table_module_default);
|
|
891
|
+
|
|
892
|
+
// ../platform-client/components/Tabs/index.ts
|
|
893
|
+
init_react_import();
|
|
894
|
+
|
|
895
|
+
// ../platform-client/components/Tabs/Tabs.tsx
|
|
896
|
+
init_react_import();
|
|
897
|
+
|
|
898
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/Tabs/Tabs.module.css#css-module
|
|
899
|
+
init_react_import();
|
|
900
|
+
var Tabs_module_default = { "Tabs": "_Tabs_1d592_1", "TabItem": "_TabItem_1d592_8", "TabItem-link": "_TabItem-link_1d592_12", "TabItem-icon": "_TabItem-icon_1d592_23", "TabItem--isActive": "_TabItem--isActive_1d592_29" };
|
|
901
|
+
|
|
902
|
+
// ../platform-client/components/Tabs/Tabs.tsx
|
|
903
|
+
var import_link4 = __toESM(require("next/link"));
|
|
904
|
+
var import_navigation3 = require("next/navigation");
|
|
905
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
906
|
+
var getClassName22 = getClassNameFactory("Tabs", Tabs_module_default);
|
|
907
|
+
var getClassNameTab = getClassNameFactory("TabItem", Tabs_module_default);
|
|
908
|
+
|
|
909
|
+
// ../platform-client/components/Textarea/index.tsx
|
|
910
|
+
init_react_import();
|
|
911
|
+
var import_react_textarea_autosize = __toESM(require("react-textarea-autosize"));
|
|
912
|
+
|
|
913
|
+
// ../platform-client/components/VerticalSpace/index.ts
|
|
914
|
+
init_react_import();
|
|
915
|
+
|
|
916
|
+
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
917
|
+
init_react_import();
|
|
918
|
+
|
|
919
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/platform-client/components/VerticalSpace/VerticalSpace.module.css#css-module
|
|
920
|
+
init_react_import();
|
|
921
|
+
var VerticalSpace_module_default = { "VerticalSpace": "_VerticalSpace_1tjaw_1", "VerticalSpace--size4": "_VerticalSpace--size4_1tjaw_5", "VerticalSpace--size8": "_VerticalSpace--size8_1tjaw_9", "VerticalSpace--size16": "_VerticalSpace--size16_1tjaw_13", "VerticalSpace--size32": "_VerticalSpace--size32_1tjaw_17", "VerticalSpace--size40": "_VerticalSpace--size40_1tjaw_21", "VerticalSpace--size48": "_VerticalSpace--size48_1tjaw_25", "VerticalSpace--size56": "_VerticalSpace--size56_1tjaw_29", "VerticalSpace--size96": "_VerticalSpace--size96_1tjaw_33", "VerticalSpace--size128": "_VerticalSpace--size128_1tjaw_37" };
|
|
922
|
+
|
|
923
|
+
// ../platform-client/components/VerticalSpace/VerticalSpace.tsx
|
|
924
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
925
|
+
var getClassName23 = get_class_name_factory_default("VerticalSpace", VerticalSpace_module_default);
|
|
926
|
+
|
|
927
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/plugin-ai/src/components/Chat/styles.module.css#css-module
|
|
928
|
+
init_react_import();
|
|
929
|
+
var styles_module_default3 = { "Chat": "_Chat_1p4ln_1", "Chat-header": "_Chat-header_1p4ln_8", "Chat-placeholder": "_Chat-placeholder_1p4ln_22", "Chat-actions": "_Chat-actions_1p4ln_40", "Chat-action": "_Chat-action_1p4ln_40", "Chat-actionOutlined": "_Chat-actionOutlined_1p4ln_49" };
|
|
930
|
+
|
|
931
|
+
// src/components/ChatBody/index.tsx
|
|
932
|
+
init_react_import();
|
|
933
|
+
var import_react19 = require("react");
|
|
934
|
+
var import_use_stick_to_bottom = require("use-stick-to-bottom");
|
|
935
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
936
|
+
|
|
937
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
|
|
938
|
+
init_react_import();
|
|
939
|
+
var styles_module_default4 = { "Chat": "_Chat_dx6l4_1", "Chat-inner": "_Chat-inner_dx6l4_17", "Chat--hasMessages": "_Chat--hasMessages_dx6l4_25", "Chat--hasChildren": "_Chat--hasChildren_dx6l4_29", "Chat-messages": "_Chat-messages_dx6l4_34", "Chat-form": "_Chat-form_dx6l4_41", "Chat--hideInput": "_Chat--hideInput_dx6l4_46", "Chat-formHelper": "_Chat-formHelper_dx6l4_60", "Chat-examplePrompts": "_Chat-examplePrompts_dx6l4_75", "Chat-examplePrompt": "_Chat-examplePrompt_dx6l4_75", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_dx6l4_103", "Chat-default": "_Chat-default_dx6l4_107", "ChatMessage": "_ChatMessage_dx6l4_124", "ChatMessage--userRole": "_ChatMessage--userRole_dx6l4_129", "ChatMessage-text": "_ChatMessage-text_dx6l4_129", "ChatMessage-data": "_ChatMessage-data_dx6l4_219", "ChatMessage-dataInner": "_ChatMessage-dataInner_dx6l4_230", "ChatMessage-dataIcon": "_ChatMessage-dataIcon_dx6l4_236", "Chat-loader": "_Chat-loader_dx6l4_240" };
|
|
940
|
+
|
|
941
|
+
// src/components/PromptForm/index.tsx
|
|
942
|
+
init_react_import();
|
|
943
|
+
var import_react17 = require("react");
|
|
944
|
+
|
|
945
|
+
// css-module:/Users/chrisvilla/Projects/puck-platform/packages/plugin-ai/src/components/PromptForm/styles.module.css#css-module
|
|
946
|
+
init_react_import();
|
|
947
|
+
var styles_module_default5 = { "PromptForm": "_PromptForm_136g1_1", "PromptForm-inner": "_PromptForm-inner_136g1_8", "PromptForm--dark": "_PromptForm--dark_136g1_14", "PromptForm--glow": "_PromptForm--glow_136g1_19", "PromptForm-glow": "_PromptForm-glow_136g1_19", "loop": "_loop_136g1_1", "PromptForm-formInner": "_PromptForm-formInner_136g1_60", "PromptForm-input": "_PromptForm-input_136g1_64", "PromptForm--disabled": "_PromptForm--disabled_136g1_92", "PromptForm-helper": "_PromptForm-helper_136g1_97", "PromptForm-actions": "_PromptForm-actions_136g1_107", "PromptForm-actionsLeft": "_PromptForm-actionsLeft_136g1_118", "PromptForm-actionsRight": "_PromptForm-actionsRight_136g1_124", "PromptForm-actionSubmit": "_PromptForm-actionSubmit_136g1_128", "PromptForm--isDisabled": "_PromptForm--isDisabled_136g1_147", "PromptForm--isLoading": "_PromptForm--isLoading_136g1_152" };
|
|
948
|
+
|
|
949
|
+
// src/components/PromptForm/index.tsx
|
|
950
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
951
|
+
var cx4 = getClassNameFactory("PromptForm", styles_module_default5);
|
|
952
|
+
function PromptForm({
|
|
953
|
+
actions,
|
|
954
|
+
colorScheme = "light",
|
|
955
|
+
glow,
|
|
956
|
+
handleSubmit,
|
|
957
|
+
helperText,
|
|
958
|
+
inputRef,
|
|
959
|
+
isDisabled,
|
|
960
|
+
isLoading,
|
|
961
|
+
placeholder = "Create a page for..."
|
|
962
|
+
}) {
|
|
963
|
+
const hasSetInitialPrompt = (0, import_react17.useRef)(false);
|
|
964
|
+
const [prompt, setPrompt] = (0, import_react17.useState)("");
|
|
965
|
+
const sendPrompt = () => {
|
|
966
|
+
if (isLoading || isDisabled) return;
|
|
967
|
+
if (handleSubmit) {
|
|
968
|
+
handleSubmit(prompt);
|
|
969
|
+
}
|
|
970
|
+
setPrompt("");
|
|
971
|
+
};
|
|
972
|
+
(0, import_react17.useEffect)(() => {
|
|
973
|
+
const currentUrl = new URL(location.href);
|
|
974
|
+
const initialPrompt = currentUrl.searchParams.get("initialPrompt");
|
|
975
|
+
if (!hasSetInitialPrompt.current && initialPrompt && prompt === "") {
|
|
976
|
+
hasSetInitialPrompt.current = true;
|
|
977
|
+
setPrompt(initialPrompt);
|
|
978
|
+
}
|
|
979
|
+
}, [setPrompt]);
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
981
|
+
"div",
|
|
982
|
+
{
|
|
983
|
+
className: cx4({
|
|
984
|
+
isDisabled,
|
|
985
|
+
isLoading,
|
|
986
|
+
dark: colorScheme === "dark",
|
|
987
|
+
glow
|
|
988
|
+
}),
|
|
989
|
+
children: [
|
|
990
|
+
helperText ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cx4("helper"), children: helperText }) : null,
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx4("inner"), children: [
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: cx4("glow") }),
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
994
|
+
"form",
|
|
995
|
+
{
|
|
996
|
+
onSubmit: (e) => {
|
|
997
|
+
e.preventDefault();
|
|
998
|
+
sendPrompt();
|
|
999
|
+
},
|
|
1000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx4("formInner"), children: [
|
|
1001
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1002
|
+
import_react_textarea_autosize.default,
|
|
1003
|
+
{
|
|
1004
|
+
className: cx4("input"),
|
|
1005
|
+
name: "prompt",
|
|
1006
|
+
minRows: 2,
|
|
1007
|
+
placeholder,
|
|
1008
|
+
disabled: isDisabled,
|
|
1009
|
+
value: prompt,
|
|
1010
|
+
ref: inputRef,
|
|
1011
|
+
onChange: (e) => setPrompt(e.target.value),
|
|
1012
|
+
onKeyDown: (e) => {
|
|
1013
|
+
if (!e.shiftKey && e.key === "Enter") {
|
|
1014
|
+
e.preventDefault();
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
onKeyUp: (e) => {
|
|
1018
|
+
if (!e.shiftKey && e.key === "Enter") {
|
|
1019
|
+
e.preventDefault();
|
|
1020
|
+
sendPrompt();
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
),
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: cx4("actions"), children: [
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cx4("actionsLeft"), children: actions }),
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cx4("actionsRight"), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1028
|
+
"button",
|
|
1029
|
+
{
|
|
1030
|
+
className: cx4("actionSubmit"),
|
|
1031
|
+
type: "submit",
|
|
1032
|
+
disabled: isLoading,
|
|
1033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ArrowUp, {})
|
|
1034
|
+
}
|
|
1035
|
+
) })
|
|
1036
|
+
] })
|
|
1037
|
+
] })
|
|
1038
|
+
}
|
|
1039
|
+
)
|
|
1040
|
+
] })
|
|
1041
|
+
]
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// src/lib/context.ts
|
|
1047
|
+
init_react_import();
|
|
1048
|
+
var import_react18 = require("react");
|
|
1049
|
+
var toolStatusContext = (0, import_react18.createContext)({});
|
|
1050
|
+
var ToolStatusProvider = toolStatusContext.Provider;
|
|
1051
|
+
|
|
1052
|
+
// src/components/ChatBody/index.tsx
|
|
1053
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1054
|
+
var cx5 = getClassNameFactory("Chat", styles_module_default4);
|
|
1055
|
+
var cxMessage = getClassNameFactory("ChatMessage", styles_module_default4);
|
|
1056
|
+
var ignoredParts = ["data-puck-actions", "step-start", "step-finish"];
|
|
1057
|
+
function ChatBody({
|
|
1058
|
+
children,
|
|
1059
|
+
examplePrompts,
|
|
1060
|
+
handleSubmit,
|
|
1061
|
+
hideInput,
|
|
1062
|
+
inputRef,
|
|
1063
|
+
messages = [],
|
|
1064
|
+
status
|
|
1065
|
+
}) {
|
|
1066
|
+
const { scrollRef, contentRef } = (0, import_use_stick_to_bottom.useStickToBottom)();
|
|
1067
|
+
const hasMessages = messages && messages.length > 0;
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cx5({ hasMessages, hasChildren: !!children, hideInput }), children: [
|
|
1069
|
+
children ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx5("default"), children }) : null,
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cx5("inner"), ref: scrollRef, children: [
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx5("messages"), ref: contentRef, children: messages.toReversed().map((message) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChatMessage, { message }, message.id)) }),
|
|
1072
|
+
status === "submitted" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx5("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loader, {}) }),
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cx5("form"), children: [
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1075
|
+
PromptForm,
|
|
1076
|
+
{
|
|
1077
|
+
glow: !hasMessages,
|
|
1078
|
+
handleSubmit,
|
|
1079
|
+
inputRef,
|
|
1080
|
+
isLoading: status === "submitted" || status === "streaming",
|
|
1081
|
+
placeholder: "What do you want to build?"
|
|
1082
|
+
}
|
|
1083
|
+
),
|
|
1084
|
+
examplePrompts ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx5("examplePrompts"), children: examplePrompts }) : null
|
|
1085
|
+
] })
|
|
1086
|
+
] })
|
|
1087
|
+
] });
|
|
1088
|
+
}
|
|
1089
|
+
function ChatMessage({ message }) {
|
|
1090
|
+
const { role, parts } = message;
|
|
1091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1092
|
+
"div",
|
|
1093
|
+
{
|
|
1094
|
+
className: cxMessage({ [`${role}Role`]: true }),
|
|
1095
|
+
"data-message-id": message.id,
|
|
1096
|
+
children: parts.filter((part) => !ignoredParts.includes(part.type)).map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1097
|
+
ChatMessagePart,
|
|
1098
|
+
{
|
|
1099
|
+
part,
|
|
1100
|
+
role
|
|
1101
|
+
},
|
|
1102
|
+
`${message.id}-${part.type}-${i}`
|
|
1103
|
+
))
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
function ChatMessageWrapper({
|
|
1108
|
+
children,
|
|
1109
|
+
role
|
|
1110
|
+
}) {
|
|
1111
|
+
if (role === "assistant") {
|
|
1112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_markdown.default, { children });
|
|
1113
|
+
}
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { children });
|
|
1115
|
+
}
|
|
1116
|
+
function ChatMessagePart({
|
|
1117
|
+
part,
|
|
1118
|
+
role
|
|
1119
|
+
}) {
|
|
1120
|
+
if (part.type === "text") {
|
|
1121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ChatMessageWrapper, { role, children: part.text }) });
|
|
1122
|
+
}
|
|
1123
|
+
if (part.type === "tool-createPage") {
|
|
1124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PuckTool, __spreadValues({}, part));
|
|
1125
|
+
}
|
|
1126
|
+
if (part.type === "tool-updatePage") {
|
|
1127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PuckTool, __spreadValues({}, part));
|
|
1128
|
+
}
|
|
1129
|
+
if (part.type === "tool-userTool") {
|
|
1130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PuckTool, __spreadValues({}, part));
|
|
1131
|
+
}
|
|
1132
|
+
return null;
|
|
1133
|
+
}
|
|
1134
|
+
function PuckTool({
|
|
1135
|
+
toolCallId,
|
|
1136
|
+
output,
|
|
1137
|
+
defaultLabel = "Thinking..."
|
|
1138
|
+
}) {
|
|
1139
|
+
const toolStatus = (0, import_react19.useContext)(toolStatusContext)[toolCallId];
|
|
1140
|
+
const outputObj = output;
|
|
1141
|
+
const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus != null ? toolStatus : { loading: true, label: defaultLabel };
|
|
1142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PuckAction, { description: status.label, loading: status.loading });
|
|
1143
|
+
}
|
|
1144
|
+
function PuckAction({
|
|
1145
|
+
loading,
|
|
1146
|
+
description
|
|
1147
|
+
}) {
|
|
1148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cxMessage("data"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cxMessage("dataInner"), children: [
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cxMessage("dataIcon"), children: loading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loader, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Check, { size: 18 }) }),
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: description })
|
|
1151
|
+
] }) });
|
|
1152
|
+
}
|
|
1153
|
+
function ExamplePrompt({
|
|
1154
|
+
label,
|
|
1155
|
+
href
|
|
1156
|
+
}) {
|
|
1157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("a", { className: cx5("examplePrompt"), href, children: [
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: label }),
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cx5("examplePromptArrow"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ArrowRight, { size: "16" }) })
|
|
1160
|
+
] });
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// src/components/Chat/index.tsx
|
|
1164
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1165
|
+
var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
|
|
1166
|
+
var getClassName24 = getClassNameFactory("Chat", styles_module_default3);
|
|
1167
|
+
var usePuck3 = (0, import_puck5.createUsePuck)();
|
|
1168
|
+
function Chat({
|
|
1169
|
+
chatId,
|
|
1170
|
+
examplePrompts,
|
|
1171
|
+
host = "/api/puck/chat",
|
|
1172
|
+
initialMessages = []
|
|
1173
|
+
}) {
|
|
1174
|
+
const puckDispatch = usePuck3((s) => s.dispatch);
|
|
1175
|
+
const getPuck = (0, import_puck5.useGetPuck)();
|
|
1176
|
+
const [localChatId, setLocalChatId] = (0, import_react21.useState)(chatId);
|
|
1177
|
+
const inputRef = (0, import_react21.useRef)(null);
|
|
1178
|
+
const pluginRef = (0, import_react21.useRef)(null);
|
|
1179
|
+
const [toolStatus, setToolStatus] = (0, import_react21.useState)({});
|
|
1180
|
+
const { messages, status, sendMessage } = (0, import_react20.useChat)({
|
|
1181
|
+
generateId: () => prefixedUlid("msg"),
|
|
1182
|
+
messages: initialMessages,
|
|
1183
|
+
transport: new import_ai.DefaultChatTransport({
|
|
1184
|
+
api: host,
|
|
1185
|
+
prepareSendMessagesRequest: (opts) => {
|
|
1186
|
+
return {
|
|
1187
|
+
body: __spreadProps(__spreadValues({}, opts.body), {
|
|
1188
|
+
id: opts.id,
|
|
1189
|
+
trigger: opts.trigger,
|
|
1190
|
+
messages: opts.messages,
|
|
1191
|
+
pageData: getPuck().appState.data,
|
|
1192
|
+
config: getPuck().config
|
|
1193
|
+
})
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
}),
|
|
1197
|
+
onData: (dataPart) => {
|
|
1198
|
+
switch (dataPart.type) {
|
|
1199
|
+
case "data-new-chat-created": {
|
|
1200
|
+
setLocalChatId(dataPart.data.chatId);
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
case "data-puck-actions": {
|
|
1204
|
+
dataPart.data.forEach((action) => {
|
|
1205
|
+
try {
|
|
1206
|
+
puckDispatch(action);
|
|
1207
|
+
} catch (e) {
|
|
1208
|
+
console.error("Bad action: ", action);
|
|
1209
|
+
console.error(e);
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
case "data-tool-status": {
|
|
1215
|
+
setToolStatus((s) => __spreadProps(__spreadValues({}, s), {
|
|
1216
|
+
[dataPart.data.toolCallId]: dataPart.data.status
|
|
1217
|
+
}));
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
default:
|
|
1221
|
+
console.warn("dataPart without case:", dataPart);
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
const handleSubmit = (prompt) => {
|
|
1227
|
+
const text = prompt.trim();
|
|
1228
|
+
if (!text) {
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
sendMessage(
|
|
1232
|
+
{
|
|
1233
|
+
text
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
body: {
|
|
1237
|
+
chatId: localChatId
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
).catch((e) => {
|
|
1241
|
+
console.error(e);
|
|
1242
|
+
});
|
|
1243
|
+
};
|
|
1244
|
+
const messagesWithStatuses = (0, import_react21.useMemo)(() => {
|
|
1245
|
+
return messages.map((msg) => {
|
|
1246
|
+
return __spreadProps(__spreadValues({}, msg), {
|
|
1247
|
+
parts: msg.parts.map((part) => {
|
|
1248
|
+
if ("toolCallId" in part) {
|
|
1249
|
+
return __spreadProps(__spreadValues({}, part), { status: toolStatus[part.toolCallId] });
|
|
1250
|
+
}
|
|
1251
|
+
return part;
|
|
1252
|
+
})
|
|
1253
|
+
});
|
|
1254
|
+
});
|
|
1255
|
+
}, [messages, toolStatus]);
|
|
1256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24(), ref: pluginRef, children: [
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("header"), children: "AI page builder" }),
|
|
1258
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1259
|
+
ChatBody,
|
|
1260
|
+
{
|
|
1261
|
+
messages: messagesWithStatuses,
|
|
1262
|
+
handleSubmit,
|
|
1263
|
+
inputRef,
|
|
1264
|
+
status,
|
|
1265
|
+
examplePrompts: examplePrompts == null ? void 0 : examplePrompts.map(({ label, href }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ExamplePrompt, { label, href }, label)),
|
|
1266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1267
|
+
Placeholder,
|
|
1268
|
+
{
|
|
1269
|
+
dispatch: puckDispatch,
|
|
1270
|
+
inputRef,
|
|
1271
|
+
pluginRef
|
|
1272
|
+
}
|
|
1273
|
+
)
|
|
1274
|
+
}
|
|
1275
|
+
) })
|
|
1276
|
+
] });
|
|
1277
|
+
}
|
|
1278
|
+
function Placeholder({
|
|
1279
|
+
dispatch,
|
|
1280
|
+
inputRef,
|
|
1281
|
+
pluginRef
|
|
1282
|
+
}) {
|
|
1283
|
+
const handleEnterPromptClick = () => {
|
|
1284
|
+
var _a;
|
|
1285
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
1286
|
+
setTimeout(() => {
|
|
1287
|
+
if (pluginRef.current && inputRef.current && !isScrolledIntoView(inputRef.current)) {
|
|
1288
|
+
const box = pluginRef.current.getBoundingClientRect();
|
|
1289
|
+
const top = box.top - (window.innerHeight - box.height) / 2;
|
|
1290
|
+
window.scrollTo({
|
|
1291
|
+
behavior: "smooth",
|
|
1292
|
+
top
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
}, 10);
|
|
1296
|
+
};
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("placeholder"), children: [
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Bot, { size: "24" }),
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "Use AI to build a page using your own components" }),
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("actions"), children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1302
|
+
"button",
|
|
1303
|
+
{
|
|
1304
|
+
className: getClassName24("action"),
|
|
1305
|
+
onClick: handleEnterPromptClick,
|
|
1306
|
+
children: "Enter prompt"
|
|
1307
|
+
}
|
|
1308
|
+
),
|
|
1309
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1310
|
+
"button",
|
|
1311
|
+
{
|
|
1312
|
+
className: getClassName24("actionOutlined"),
|
|
1313
|
+
onClick: () => {
|
|
1314
|
+
dispatch({
|
|
1315
|
+
type: "setUi",
|
|
1316
|
+
ui: { plugin: { current: "blocks" } }
|
|
1317
|
+
});
|
|
1318
|
+
},
|
|
1319
|
+
children: "Build manually"
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1322
|
+
] })
|
|
1323
|
+
] });
|
|
1324
|
+
}
|
|
1325
|
+
function isScrolledIntoView(el) {
|
|
1326
|
+
const rect = el.getBoundingClientRect();
|
|
1327
|
+
const elemTop = rect.top;
|
|
1328
|
+
const elemBottom = rect.bottom;
|
|
1329
|
+
return elemTop >= 0 && elemBottom <= window.innerHeight;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
// src/index.tsx
|
|
1333
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1334
|
+
function createAIPlugin(opts) {
|
|
1335
|
+
return {
|
|
1336
|
+
label: "AI",
|
|
1337
|
+
name: "ai",
|
|
1338
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Chat, __spreadValues({}, opts)),
|
|
1339
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Bot, {}),
|
|
1340
|
+
mobilePanelHeight: "min-content"
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
var src_default = createAIPlugin;
|
|
1344
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1345
|
+
0 && (module.exports = {
|
|
1346
|
+
ChatBody
|
|
1347
|
+
});
|
|
1348
|
+
/*! Bundled license information:
|
|
1349
|
+
|
|
1350
|
+
classnames/index.js:
|
|
1351
|
+
(*!
|
|
1352
|
+
Copyright (c) 2018 Jed Watson.
|
|
1353
|
+
Licensed under the MIT License (MIT), see
|
|
1354
|
+
http://jedwatson.github.io/classnames
|
|
1355
|
+
*)
|
|
1356
|
+
|
|
1357
|
+
lucide-react/dist/esm/shared/src/utils.js:
|
|
1358
|
+
lucide-react/dist/esm/defaultAttributes.js:
|
|
1359
|
+
lucide-react/dist/esm/Icon.js:
|
|
1360
|
+
lucide-react/dist/esm/createLucideIcon.js:
|
|
1361
|
+
lucide-react/dist/esm/icons/arrow-right.js:
|
|
1362
|
+
lucide-react/dist/esm/icons/arrow-up.js:
|
|
1363
|
+
lucide-react/dist/esm/icons/bot.js:
|
|
1364
|
+
lucide-react/dist/esm/icons/check.js:
|
|
1365
|
+
lucide-react/dist/esm/lucide-react.js:
|
|
1366
|
+
(**
|
|
1367
|
+
* @license lucide-react v0.452.0 - ISC
|
|
1368
|
+
*
|
|
1369
|
+
* This source code is licensed under the ISC license.
|
|
1370
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
1371
|
+
*)
|
|
1372
|
+
*/
|