@puckeditor/plugin-ai 0.1.0-canary.f39908a2 → 0.1.0-canary.f56e596d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20681,7 +20681,7 @@ function useChat(_a17 = {}) {
20681
20681
 
20682
20682
  // src/components/Chat/index.tsx
20683
20683
  var import_puck2 = require("@measured/puck");
20684
- var import_react19 = require("react");
20684
+ var import_react20 = require("react");
20685
20685
  var import_ulid = require("ulid");
20686
20686
 
20687
20687
  // ../utils/lib/get-class-name-factory.ts
@@ -20721,7 +20721,7 @@ var styles_module_default = { "Chat": "_Chat_1mv7h_1", "Chat-header": "_Chat-hea
20721
20721
 
20722
20722
  // src/components/ChatBody/index.tsx
20723
20723
  init_react_import();
20724
- var import_react17 = require("react");
20724
+ var import_react18 = require("react");
20725
20725
  var import_use_stick_to_bottom = require("use-stick-to-bottom");
20726
20726
  var import_react_markdown = __toESM(require("react-markdown"));
20727
20727
 
@@ -20917,7 +20917,7 @@ init_react_import();
20917
20917
 
20918
20918
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Heading/Heading.module.css#css-module
20919
20919
  init_react_import();
20920
- 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" };
20920
+ var Heading_module_default = { "Heading": "_Heading_qkzg9_1", "Heading--xxxxl": "_Heading--xxxxl_qkzg9_11", "Heading--xxxl": "_Heading--xxxl_qkzg9_15", "Heading--xxl": "_Heading--xxl_qkzg9_19", "Heading--xl": "_Heading--xl_qkzg9_23", "Heading--l": "_Heading--l_qkzg9_27", "Heading--m": "_Heading--m_qkzg9_31", "Heading--s": "_Heading--s_qkzg9_35", "Heading--xs": "_Heading--xs_qkzg9_39", "Heading--xxs": "_Heading--xxs_qkzg9_43" };
20921
20921
 
20922
20922
  // ../platform-client/components/Heading/Heading.tsx
20923
20923
  var import_jsx_runtime4 = require("react/jsx-runtime");
@@ -21182,12 +21182,28 @@ init_react_import();
21182
21182
 
21183
21183
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Page/Page.module.css#css-module
21184
21184
  init_react_import();
21185
- 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" };
21185
+ var Page_module_default = { "Page": "_Page_1ajs1_1", "Page-masthead": "_Page-masthead_1ajs1_8", "Page-crumbs": "_Page-crumbs_1ajs1_19", "Page-crumb": "_Page-crumb_1ajs1_19", "Page-crumbLink": "_Page-crumbLink_1ajs1_30", "Page-actions": "_Page-actions_1ajs1_62", "Page-footer": "_Page-footer_1ajs1_66" };
21186
21186
 
21187
21187
  // ../platform-client/components/Page/Page.tsx
21188
21188
  var import_jsx_runtime14 = require("react/jsx-runtime");
21189
21189
  var cx2 = getClassNameFactory2("Page", Page_module_default);
21190
21190
 
21191
+ // ../platform-client/components/Pagination/index.ts
21192
+ init_react_import();
21193
+
21194
+ // ../platform-client/components/Pagination/Pagination.tsx
21195
+ init_react_import();
21196
+ var import_react13 = require("react");
21197
+
21198
+ // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Pagination/Pagination.module.css#css-module
21199
+ init_react_import();
21200
+ var Pagination_module_default = { "Pagination": "_Pagination_1okv2_1", "PaginationButton": "_PaginationButton_1okv2_8", "PaginationButton--isActive": "_PaginationButton--isActive_1okv2_20", "Pagination-ellipsis": "_Pagination-ellipsis_1okv2_30" };
21201
+
21202
+ // ../platform-client/components/Pagination/Pagination.tsx
21203
+ var import_jsx_runtime15 = require("react/jsx-runtime");
21204
+ var cx3 = getClassNameFactory2("Pagination", Pagination_module_default);
21205
+ var cxButton = getClassNameFactory2("PaginationButton", Pagination_module_default);
21206
+
21191
21207
  // ../platform-client/components/Section/index.ts
21192
21208
  init_react_import();
21193
21209
 
@@ -21199,7 +21215,7 @@ init_react_import();
21199
21215
  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" };
21200
21216
 
21201
21217
  // ../platform-client/components/Section/Section.tsx
21202
- var import_jsx_runtime15 = require("react/jsx-runtime");
21218
+ var import_jsx_runtime16 = require("react/jsx-runtime");
21203
21219
  var getClassName12 = getClassNameFactory2("Section", Section_module_default);
21204
21220
 
21205
21221
  // ../platform-client/components/StatusTag/index.ts
@@ -21219,25 +21235,25 @@ init_react_import();
21219
21235
  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" };
21220
21236
 
21221
21237
  // ../platform-client/components/Tag/Tag.tsx
21222
- var import_jsx_runtime16 = require("react/jsx-runtime");
21238
+ var import_jsx_runtime17 = require("react/jsx-runtime");
21223
21239
  var getClassName13 = getClassNameFactory2("Tag", Tag_module_default);
21224
21240
 
21225
21241
  // ../platform-client/components/StatusTag/StatusTag.tsx
21226
- var import_jsx_runtime17 = require("react/jsx-runtime");
21242
+ var import_jsx_runtime18 = require("react/jsx-runtime");
21227
21243
 
21228
21244
  // ../platform-client/components/Table/index.ts
21229
21245
  init_react_import();
21230
21246
 
21231
21247
  // ../platform-client/components/Table/Table.tsx
21232
21248
  init_react_import();
21233
- var import_react13 = require("react");
21249
+ var import_react14 = require("react");
21234
21250
 
21235
21251
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Table/Table.module.css#css-module
21236
21252
  init_react_import();
21237
- 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" };
21253
+ var Table_module_default = { "Table": "_Table_1w0os_1", "Table-filters": "_Table-filters_1w0os_9", "Table-inner": "_Table-inner_1w0os_13", "Table-table": "_Table-table_1w0os_17", "Table-footer": "_Table-footer_1w0os_85", "Table--clickableRows": "_Table--clickableRows_1w0os_89", "Table-placeholder": "_Table-placeholder_1w0os_94", "Table-loader": "_Table-loader_1w0os_105" };
21238
21254
 
21239
21255
  // ../platform-client/components/Table/Table.tsx
21240
- var import_jsx_runtime18 = require("react/jsx-runtime");
21256
+ var import_jsx_runtime19 = require("react/jsx-runtime");
21241
21257
  var getClassName14 = get_class_name_factory_default("Table", Table_module_default);
21242
21258
 
21243
21259
  // ../platform-client/components/Textarea/index.tsx
@@ -21255,30 +21271,41 @@ init_react_import();
21255
21271
  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" };
21256
21272
 
21257
21273
  // ../platform-client/components/VerticalSpace/VerticalSpace.tsx
21258
- var import_jsx_runtime19 = require("react/jsx-runtime");
21274
+ var import_jsx_runtime20 = require("react/jsx-runtime");
21259
21275
  var getClassName15 = get_class_name_factory_default("VerticalSpace", VerticalSpace_module_default);
21260
21276
 
21277
+ // ../platform-client/components/Viewport/index.tsx
21278
+ init_react_import();
21279
+
21280
+ // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Viewport/styles.module.css#css-module
21281
+ init_react_import();
21282
+ var styles_module_default3 = { "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" };
21283
+
21284
+ // ../platform-client/components/Viewport/index.tsx
21285
+ var import_jsx_runtime21 = require("react/jsx-runtime");
21286
+ var cx4 = getClassNameFactory("Viewport", styles_module_default3);
21287
+
21261
21288
  // ../platform-client/context/editor.tsx
21262
21289
  init_react_import();
21263
- var import_react14 = require("react");
21264
- var import_jsx_runtime20 = require("react/jsx-runtime");
21265
- var ctx = (0, import_react14.createContext)({});
21290
+ var import_react15 = require("react");
21291
+ var import_jsx_runtime22 = require("react/jsx-runtime");
21292
+ var ctx = (0, import_react15.createContext)({});
21266
21293
 
21267
21294
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-ai/src/components/ChatBody/styles.module.css#css-module
21268
21295
  init_react_import();
21269
- var styles_module_default3 = { "Chat": "_Chat_14j71_1", "Chat-inner": "_Chat-inner_14j71_17", "Chat--hasMessages": "_Chat--hasMessages_14j71_25", "Chat--hasChildren": "_Chat--hasChildren_14j71_29", "Chat-messages": "_Chat-messages_14j71_34", "Chat-form": "_Chat-form_14j71_41", "Chat--hideInput": "_Chat--hideInput_14j71_46", "Chat-formHelper": "_Chat-formHelper_14j71_60", "Chat-examplePrompts": "_Chat-examplePrompts_14j71_75", "Chat-examplePrompt": "_Chat-examplePrompt_14j71_75", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_14j71_103", "Chat-default": "_Chat-default_14j71_107", "ChatMessage": "_ChatMessage_14j71_124", "ChatMessage--userRole": "_ChatMessage--userRole_14j71_129", "ChatMessage-text": "_ChatMessage-text_14j71_129", "ChatMessage-data": "_ChatMessage-data_14j71_219", "ChatMessage-dataInner": "_ChatMessage-dataInner_14j71_230", "ChatMessage-dataIcon": "_ChatMessage-dataIcon_14j71_236", "Chat-loader": "_Chat-loader_14j71_240", "Chat-error": "_Chat-error_14j71_245", "Chat-errorLabel": "_Chat-errorLabel_14j71_254", "Chat-errorAction": "_Chat-errorAction_14j71_258" };
21296
+ var styles_module_default4 = { "Chat": "_Chat_150yz_1", "Chat-inner": "_Chat-inner_150yz_17", "Chat--hasMessages": "_Chat--hasMessages_150yz_25", "Chat--hasChildren": "_Chat--hasChildren_150yz_29", "Chat-messages": "_Chat-messages_150yz_34", "Chat-form": "_Chat-form_150yz_41", "Chat--hideInput": "_Chat--hideInput_150yz_46", "Chat-formHelper": "_Chat-formHelper_150yz_60", "Chat-examplePrompts": "_Chat-examplePrompts_150yz_75", "Chat-examplePrompt": "_Chat-examplePrompt_150yz_75", "Chat-examplePromptArrow": "_Chat-examplePromptArrow_150yz_103", "Chat-default": "_Chat-default_150yz_107", "ChatMessage": "_ChatMessage_150yz_124", "ChatMessage--userRole": "_ChatMessage--userRole_150yz_130", "ChatMessage-text": "_ChatMessage-text_150yz_130", "ChatMessage-data": "_ChatMessage-data_150yz_220", "ChatMessage-dataInner": "_ChatMessage-dataInner_150yz_231", "ChatMessage-dataIcon": "_ChatMessage-dataIcon_150yz_237", "Chat-loader": "_Chat-loader_150yz_241", "Chat-error": "_Chat-error_150yz_246", "Chat-errorLabel": "_Chat-errorLabel_150yz_255", "Chat-errorAction": "_Chat-errorAction_150yz_259" };
21270
21297
 
21271
21298
  // src/components/PromptForm/index.tsx
21272
21299
  init_react_import();
21273
- var import_react15 = require("react");
21300
+ var import_react16 = require("react");
21274
21301
 
21275
21302
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/plugin-ai/src/components/PromptForm/styles.module.css#css-module
21276
21303
  init_react_import();
21277
- var styles_module_default4 = { "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" };
21304
+ 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" };
21278
21305
 
21279
21306
  // src/components/PromptForm/index.tsx
21280
- var import_jsx_runtime21 = require("react/jsx-runtime");
21281
- var cx3 = getClassNameFactory2("PromptForm", styles_module_default4);
21307
+ var import_jsx_runtime23 = require("react/jsx-runtime");
21308
+ var cx5 = getClassNameFactory2("PromptForm", styles_module_default5);
21282
21309
  function PromptForm({
21283
21310
  actions,
21284
21311
  colorScheme = "light",
@@ -21290,8 +21317,8 @@ function PromptForm({
21290
21317
  isLoading,
21291
21318
  placeholder = "Create a page for..."
21292
21319
  }) {
21293
- const hasSetInitialPrompt = (0, import_react15.useRef)(false);
21294
- const [prompt, setPrompt] = (0, import_react15.useState)("");
21320
+ const hasSetInitialPrompt = (0, import_react16.useRef)(false);
21321
+ const [prompt, setPrompt] = (0, import_react16.useState)("");
21295
21322
  const sendPrompt = () => {
21296
21323
  if (isLoading || isDisabled) return;
21297
21324
  if (handleSubmit) {
@@ -21299,7 +21326,7 @@ function PromptForm({
21299
21326
  }
21300
21327
  setPrompt("");
21301
21328
  };
21302
- (0, import_react15.useEffect)(() => {
21329
+ (0, import_react16.useEffect)(() => {
21303
21330
  const currentUrl = new URL(location.href);
21304
21331
  const initialPrompt = currentUrl.searchParams.get("initialPrompt");
21305
21332
  if (!hasSetInitialPrompt.current && initialPrompt && prompt === "") {
@@ -21307,31 +21334,31 @@ function PromptForm({
21307
21334
  setPrompt(initialPrompt);
21308
21335
  }
21309
21336
  }, [setPrompt]);
21310
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21337
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21311
21338
  "div",
21312
21339
  {
21313
- className: cx3({
21340
+ className: cx5({
21314
21341
  isDisabled,
21315
21342
  isLoading,
21316
21343
  dark: colorScheme === "dark",
21317
21344
  glow
21318
21345
  }),
21319
21346
  children: [
21320
- helperText ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: cx3("helper"), children: helperText }) : null,
21321
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx3("inner"), children: [
21322
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cx3("glow") }),
21323
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21347
+ helperText ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cx5("helper"), children: helperText }) : null,
21348
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx5("inner"), children: [
21349
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: cx5("glow") }),
21350
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21324
21351
  "form",
21325
21352
  {
21326
21353
  onSubmit: (e) => {
21327
21354
  e.preventDefault();
21328
21355
  sendPrompt();
21329
21356
  },
21330
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx3("formInner"), children: [
21331
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21357
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx5("formInner"), children: [
21358
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21332
21359
  import_react_textarea_autosize.default,
21333
21360
  {
21334
- className: cx3("input"),
21361
+ className: cx5("input"),
21335
21362
  name: "prompt",
21336
21363
  minRows: 2,
21337
21364
  placeholder,
@@ -21352,15 +21379,15 @@ function PromptForm({
21352
21379
  }
21353
21380
  }
21354
21381
  ),
21355
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx3("actions"), children: [
21356
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: cx3("actionsLeft"), children: actions }),
21357
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: cx3("actionsRight"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21382
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cx5("actions"), children: [
21383
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cx5("actionsLeft"), children: actions }),
21384
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: cx5("actionsRight"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21358
21385
  "button",
21359
21386
  {
21360
- className: cx3("actionSubmit"),
21387
+ className: cx5("actionSubmit"),
21361
21388
  type: "submit",
21362
21389
  disabled: isLoading,
21363
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArrowUp, {})
21390
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArrowUp, {})
21364
21391
  }
21365
21392
  ) })
21366
21393
  ] })
@@ -21375,14 +21402,14 @@ function PromptForm({
21375
21402
 
21376
21403
  // src/lib/context.ts
21377
21404
  init_react_import();
21378
- var import_react16 = require("react");
21379
- var toolStatusContext = (0, import_react16.createContext)({});
21405
+ var import_react17 = require("react");
21406
+ var toolStatusContext = (0, import_react17.createContext)({});
21380
21407
  var ToolStatusProvider = toolStatusContext.Provider;
21381
21408
 
21382
21409
  // src/components/ChatBody/index.tsx
21383
- var import_jsx_runtime22 = require("react/jsx-runtime");
21384
- var cx4 = getClassNameFactory2("Chat", styles_module_default3);
21385
- var cxMessage = getClassNameFactory2("ChatMessage", styles_module_default3);
21410
+ var import_jsx_runtime24 = require("react/jsx-runtime");
21411
+ var cx6 = getClassNameFactory2("Chat", styles_module_default4);
21412
+ var cxMessage = getClassNameFactory2("ChatMessage", styles_module_default4);
21386
21413
  function ChatBody({
21387
21414
  children,
21388
21415
  examplePrompts,
@@ -21396,17 +21423,17 @@ function ChatBody({
21396
21423
  }) {
21397
21424
  const { scrollRef, contentRef } = (0, import_use_stick_to_bottom.useStickToBottom)();
21398
21425
  const hasMessages = messages && messages.length > 0;
21399
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx4({ hasMessages, hasChildren: !!children, hideInput }), children: [
21400
- children ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("default"), children }) : null,
21401
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx4("inner"), ref: scrollRef, children: [
21402
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("messages"), ref: contentRef, children: messages.toReversed().map((message) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatMessage, { message }, message.id)) }),
21403
- status === "submitted" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader, { size: 14 }) }),
21404
- error45 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx4("error"), children: [
21405
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("errorLabel"), children: "Something went wrong." }),
21406
- handleRetry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("errorAction"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IconButton, { title: "Retry", onClick: handleRetry, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RotateCcw, { size: "14" }) }) })
21426
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cx6({ hasMessages, hasChildren: !!children, hideInput }), children: [
21427
+ children ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("default"), children }) : null,
21428
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cx6("inner"), ref: scrollRef, children: [
21429
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("messages"), ref: contentRef, children: messages.toReversed().map((message) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatMessage, { message }, message.id)) }),
21430
+ status === "submitted" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Loader, { size: 14 }) }),
21431
+ error45 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cx6("error"), children: [
21432
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("errorLabel"), children: "Something went wrong." }),
21433
+ handleRetry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("errorAction"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(IconButton, { title: "Retry", onClick: handleRetry, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(RotateCcw, { size: "14" }) }) })
21407
21434
  ] }),
21408
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx4("form"), children: [
21409
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21435
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cx6("form"), children: [
21436
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21410
21437
  PromptForm,
21411
21438
  {
21412
21439
  glow: !hasMessages,
@@ -21416,19 +21443,19 @@ function ChatBody({
21416
21443
  placeholder: "What do you want to build?"
21417
21444
  }
21418
21445
  ),
21419
- examplePrompts ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("examplePrompts"), children: examplePrompts }) : null
21446
+ examplePrompts ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("examplePrompts"), children: examplePrompts }) : null
21420
21447
  ] })
21421
21448
  ] })
21422
21449
  ] });
21423
21450
  }
21424
21451
  function ChatMessage({ message }) {
21425
21452
  const { role, parts } = message;
21426
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21453
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21427
21454
  "div",
21428
21455
  {
21429
21456
  className: cxMessage({ [`${role}Role`]: true }),
21430
21457
  "data-message-id": message.id,
21431
- children: parts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21458
+ children: parts.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21432
21459
  ChatMessagePart,
21433
21460
  {
21434
21461
  part,
@@ -21444,25 +21471,25 @@ function ChatMessageWrapper({
21444
21471
  role
21445
21472
  }) {
21446
21473
  if (role === "assistant") {
21447
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_markdown.default, { children });
21474
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_markdown.default, { children });
21448
21475
  }
21449
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children });
21476
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children });
21450
21477
  }
21451
21478
  function ChatMessagePart({
21452
21479
  part,
21453
21480
  role
21454
21481
  }) {
21455
21482
  if (part.type === "text") {
21456
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ChatMessageWrapper, { role, children: part.text }) });
21483
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cxMessage("text"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatMessageWrapper, { role, children: part.text }) });
21457
21484
  }
21458
21485
  if (part.type === "tool-createPage") {
21459
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PuckTool, __spreadValues({}, part));
21486
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PuckTool, __spreadValues({}, part));
21460
21487
  }
21461
21488
  if (part.type === "tool-updatePage") {
21462
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PuckTool, __spreadValues({}, part));
21489
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PuckTool, __spreadValues({}, part));
21463
21490
  }
21464
21491
  if (part.type === "tool-userTool") {
21465
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PuckTool, __spreadValues({}, part));
21492
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PuckTool, __spreadValues({}, part));
21466
21493
  }
21467
21494
  return null;
21468
21495
  }
@@ -21471,30 +21498,30 @@ function PuckTool({
21471
21498
  output,
21472
21499
  defaultLabel = "Thinking..."
21473
21500
  }) {
21474
- const toolStatus = (0, import_react17.useContext)(toolStatusContext)[toolCallId];
21501
+ const toolStatus = (0, import_react18.useContext)(toolStatusContext)[toolCallId];
21475
21502
  const outputObj = output;
21476
21503
  const status = outputObj && "status" in outputObj ? outputObj.status : toolStatus != null ? toolStatus : { loading: true, label: defaultLabel };
21477
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolStatus, { status });
21504
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ToolStatus, { status });
21478
21505
  }
21479
21506
  function ToolStatus({ status }) {
21480
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cxMessage("data"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cxMessage("dataInner"), children: [
21481
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cxMessage("dataIcon"), children: status.error ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TriangleAlert, { size: 18 }) : status.loading ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Check, { size: 18 }) }),
21482
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: status.label })
21507
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cxMessage("data"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cxMessage("dataInner"), children: [
21508
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cxMessage("dataIcon"), children: status.error ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TriangleAlert, { size: 18 }) : status.loading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Loader, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Check, { size: 18 }) }),
21509
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: status.label })
21483
21510
  ] }) });
21484
21511
  }
21485
21512
  function ExamplePrompt({
21486
21513
  label,
21487
21514
  href
21488
21515
  }) {
21489
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("a", { className: cx4("examplePrompt"), href, children: [
21490
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: label }),
21491
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cx4("examplePromptArrow"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowRight, { size: "16" }) })
21516
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("a", { className: cx6("examplePrompt"), href, children: [
21517
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: label }),
21518
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cx6("examplePromptArrow"), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ArrowRight, { size: "16" }) })
21492
21519
  ] });
21493
21520
  }
21494
21521
 
21495
21522
  // src/components/Chat/index.tsx
21496
21523
  var import_qler = __toESM(require("qler"));
21497
- var import_jsx_runtime23 = require("react/jsx-runtime");
21524
+ var import_jsx_runtime25 = require("react/jsx-runtime");
21498
21525
  var q = (0, import_qler.default)();
21499
21526
  var BENCHMARK = false;
21500
21527
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
@@ -21508,11 +21535,11 @@ function Chat2({
21508
21535
  }) {
21509
21536
  const puckDispatch = usePuck((s) => s.dispatch);
21510
21537
  const getPuck = (0, import_puck2.useGetPuck)();
21511
- const localChatId = (0, import_react19.useRef)(chatId);
21512
- const inputRef = (0, import_react19.useRef)(null);
21513
- const pluginRef = (0, import_react19.useRef)(null);
21514
- const [error45, setError] = (0, import_react19.useState)();
21515
- const [toolStatus, setToolStatus] = (0, import_react19.useState)({});
21538
+ const localChatId = (0, import_react20.useRef)(chatId);
21539
+ const inputRef = (0, import_react20.useRef)(null);
21540
+ const pluginRef = (0, import_react20.useRef)(null);
21541
+ const [error45, setError] = (0, import_react20.useState)();
21542
+ const [toolStatus, setToolStatus] = (0, import_react20.useState)({});
21516
21543
  const { messages, status, sendMessage, regenerate } = useChat({
21517
21544
  generateId: () => prefixedUlid("msg"),
21518
21545
  messages: initialMessages,
@@ -21722,7 +21749,7 @@ function Chat2({
21722
21749
  console.error(e);
21723
21750
  });
21724
21751
  };
21725
- const messagesWithStatuses = (0, import_react19.useMemo)(() => {
21752
+ const messagesWithStatuses = (0, import_react20.useMemo)(() => {
21726
21753
  return messages.map((msg) => {
21727
21754
  return __spreadProps(__spreadValues({}, msg), {
21728
21755
  parts: msg.parts.map((part) => {
@@ -21734,22 +21761,22 @@ function Chat2({
21734
21761
  });
21735
21762
  });
21736
21763
  }, [messages, toolStatus]);
21737
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName16(), ref: pluginRef, children: [
21738
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName16("header"), children: "AI page builder" }),
21739
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21764
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName16(), ref: pluginRef, children: [
21765
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName16("header"), children: "AI page builder" }),
21766
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
21740
21767
  ChatBody,
21741
21768
  {
21742
21769
  messages: messagesWithStatuses,
21743
21770
  handleSubmit,
21744
21771
  inputRef,
21745
21772
  status,
21746
- examplePrompts: examplePrompts == null ? void 0 : examplePrompts.map(({ label, href }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ExamplePrompt, { label, href }, label)),
21773
+ examplePrompts: examplePrompts == null ? void 0 : examplePrompts.map(({ label, href }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ExamplePrompt, { label, href }, label)),
21747
21774
  error: error45,
21748
21775
  handleRetry: () => {
21749
21776
  setError("");
21750
21777
  regenerate();
21751
21778
  },
21752
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21779
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
21753
21780
  Placeholder,
21754
21781
  {
21755
21782
  dispatch: puckDispatch,
@@ -21780,11 +21807,11 @@ function Placeholder({
21780
21807
  }
21781
21808
  }, 10);
21782
21809
  };
21783
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName16("placeholder"), children: [
21784
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Bot, { size: "24" }),
21785
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: "Use AI to build a page using your own components" }),
21786
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: getClassName16("actions"), children: [
21787
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21810
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName16("placeholder"), children: [
21811
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Bot, { size: "24" }),
21812
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "Use AI to build a page using your own components" }),
21813
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName16("actions"), children: [
21814
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
21788
21815
  "button",
21789
21816
  {
21790
21817
  className: getClassName16("action"),
@@ -21792,7 +21819,7 @@ function Placeholder({
21792
21819
  children: "Enter prompt"
21793
21820
  }
21794
21821
  ),
21795
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21822
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
21796
21823
  "button",
21797
21824
  {
21798
21825
  className: getClassName16("actionOutlined"),
@@ -21816,13 +21843,13 @@ function isScrolledIntoView(el) {
21816
21843
  }
21817
21844
 
21818
21845
  // src/index.tsx
21819
- var import_jsx_runtime24 = require("react/jsx-runtime");
21846
+ var import_jsx_runtime26 = require("react/jsx-runtime");
21820
21847
  function createAIPlugin(opts) {
21821
21848
  return {
21822
21849
  label: "AI",
21823
21850
  name: "ai",
21824
- render: () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Chat2, __spreadValues({}, opts)),
21825
- icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Bot, {}),
21851
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Chat2, __spreadValues({}, opts)),
21852
+ icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Bot, {}),
21826
21853
  mobilePanelHeight: "min-content"
21827
21854
  };
21828
21855
  }