@puckeditor/plugin-ai 0.1.0-canary.ab95935e → 0.1.0-canary.b477dbbe

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 CHANGED
@@ -234,7 +234,7 @@ p {
234
234
  }
235
235
 
236
236
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Modal/Modal.module.css/#css-module-data */
237
- ._Modal-background_874yi_1 {
237
+ ._Modal-background_1bedq_1 {
238
238
  align-items: center;
239
239
  display: flex;
240
240
  justify-content: center;
@@ -248,24 +248,26 @@ p {
248
248
  opacity: 0;
249
249
  pointer-events: none;
250
250
  }
251
- ._Modal--visible_874yi_16 ._Modal-background_874yi_1 {
251
+ ._Modal--visible_1bedq_16 ._Modal-background_1bedq_1 {
252
252
  opacity: 1;
253
253
  transition: opacity ease 100ms;
254
254
  pointer-events: auto;
255
255
  }
256
- ._Modal-modal_874yi_22 {
256
+ ._Modal-modal_1bedq_22 {
257
257
  background: white;
258
- border-radius: 8px;
258
+ border-radius: 16px;
259
259
  display: block;
260
- overflow: hidden;
260
+ max-height: calc(100vh - 24px);
261
+ margin-inline: 24px;
262
+ overflow: auto;
261
263
  }
262
264
 
263
265
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Button/Button.module.css/#css-module-data */
264
- ._Button_w2ngt_1 {
266
+ ._Button_1wyvm_1 {
265
267
  appearance: none;
266
268
  background: none;
267
269
  border: 1px solid transparent;
268
- border-radius: 4px;
270
+ border-radius: 8px;
269
271
  color: var(--puck-color-white);
270
272
  display: inline-flex;
271
273
  align-items: center;
@@ -283,69 +285,80 @@ p {
283
285
  white-space: nowrap;
284
286
  margin: 0;
285
287
  }
286
- ._Button_w2ngt_1:hover,
287
- ._Button_w2ngt_1:active {
288
+ ._Button_1wyvm_1:hover,
289
+ ._Button_1wyvm_1:active {
288
290
  transition: none;
289
291
  }
290
- ._Button--medium_w2ngt_29 {
292
+ ._Button--medium_1wyvm_29 {
291
293
  min-height: 34px;
292
294
  padding-bottom: 7px;
293
295
  padding-left: 19px;
294
296
  padding-right: 19px;
295
297
  padding-top: 7px;
296
298
  }
297
- ._Button--large_w2ngt_37 {
299
+ ._Button--large_1wyvm_37 {
298
300
  padding-bottom: 11px;
299
301
  padding-left: 19px;
300
302
  padding-right: 19px;
301
303
  padding-top: 11px;
302
304
  }
303
- ._Button-icon_w2ngt_44 {
305
+ ._Button-icon_1wyvm_44 {
304
306
  margin-top: 2px;
305
307
  }
306
- ._Button--primary_w2ngt_48 {
308
+ ._Button--primary_1wyvm_48 {
307
309
  background: var(--puck-color-azure-04);
308
310
  }
309
- ._Button_w2ngt_1:focus-visible {
311
+ ._Button_1wyvm_1:focus-visible {
310
312
  outline: 2px solid var(--puck-color-azure-05);
311
313
  outline-offset: 2px;
312
314
  }
313
315
  @media (hover: hover) and (pointer: fine) {
314
- ._Button--primary_w2ngt_48:hover {
316
+ ._Button--primary_1wyvm_48:hover {
315
317
  background-color: var(--puck-color-azure-03);
316
318
  }
317
319
  }
318
- ._Button--primary_w2ngt_48:active {
320
+ ._Button--primary_1wyvm_48:active {
319
321
  background-color: var(--puck-color-azure-02);
320
322
  }
321
- ._Button--secondary_w2ngt_67 {
323
+ ._Button--secondary_1wyvm_67 {
322
324
  border: 1px solid currentColor;
323
325
  color: currentColor;
324
326
  }
325
327
  @media (hover: hover) and (pointer: fine) {
326
- ._Button--secondary_w2ngt_67:hover {
328
+ ._Button--secondary_1wyvm_67:hover {
327
329
  background-color: var(--puck-color-azure-12);
328
330
  color: var(--puck-color-black);
329
331
  }
330
332
  }
331
- ._Button--secondary_w2ngt_67:active {
333
+ ._Button--secondary_1wyvm_67:active {
332
334
  background-color: var(--puck-color-azure-11);
333
335
  color: var(--puck-color-black);
334
336
  }
335
- ._Button--flush_w2ngt_84 {
337
+ ._Button--danger_1wyvm_84 {
338
+ background: var(--puck-color-red-04);
339
+ }
340
+ @media (hover: hover) and (pointer: fine) {
341
+ ._Button--danger_1wyvm_84:hover {
342
+ background-color: var(--puck-color-red-03);
343
+ }
344
+ }
345
+ ._Button--danger_1wyvm_84:active {
346
+ background-color: var(--puck-color-red-02);
347
+ }
348
+ ._Button--flush_1wyvm_98 {
336
349
  border-radius: 0;
337
350
  }
338
- ._Button--disabled_w2ngt_88,
339
- ._Button--disabled_w2ngt_88:hover {
351
+ ._Button--disabled_1wyvm_102,
352
+ ._Button--disabled_1wyvm_102:hover {
340
353
  background-color: var(--puck-color-grey-09);
341
354
  color: var(--puck-color-grey-03);
342
355
  cursor: not-allowed;
343
356
  }
344
- ._Button--fullWidth_w2ngt_95 {
357
+ ._Button--fullWidth_1wyvm_109 {
345
358
  justify-content: center;
346
359
  width: 100%;
347
360
  }
348
- ._Button-spinner_w2ngt_100 {
361
+ ._Button-spinner_1wyvm_114 {
349
362
  padding-left: 8px;
350
363
  }
351
364
 
@@ -800,26 +813,26 @@ p {
800
813
  }
801
814
 
802
815
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Table/Table.module.css/#css-module-data */
803
- ._Table_1w0os_1 {
816
+ ._Table_1bbu5_1 {
804
817
  color: black;
805
818
  display: flex;
806
819
  flex-direction: column;
807
820
  flex-grow: 1;
808
821
  overflow-y: auto;
809
822
  }
810
- ._Table-filters_1w0os_9 {
823
+ ._Table-filters_1bbu5_9 {
811
824
  margin: 16px;
812
825
  }
813
- ._Table-inner_1w0os_13 {
826
+ ._Table-inner_1bbu5_13 {
814
827
  text-align: left;
815
828
  }
816
- ._Table-table_1w0os_17 {
829
+ ._Table-table_1bbu5_17 {
817
830
  color: var(--puck-color-grey-02);
818
831
  font-size: var(--puck-font-size-xxs);
819
832
  position: relative;
820
833
  width: 100%;
821
834
  }
822
- ._Table_1w0os_1 thead {
835
+ ._Table_1bbu5_1 thead {
823
836
  background: white;
824
837
  font-size: var(--puck-font-size-xxs);
825
838
  position: sticky;
@@ -827,17 +840,20 @@ p {
827
840
  white-space: nowrap;
828
841
  z-index: 1;
829
842
  }
830
- ._Table_1w0os_1 thead::after {
843
+ ._Table_1bbu5_1 thead::after {
831
844
  content: "";
832
845
  position: absolute;
833
846
  height: 1px;
834
847
  width: 100%;
835
848
  background-color: var(--puck-color-grey-10);
836
849
  }
837
- ._Table_1w0os_1 tbody tr {
850
+ ._Table--hideHeader_1bbu5_41 thead {
851
+ display: none;
852
+ }
853
+ ._Table_1bbu5_1 tbody tr {
838
854
  z-index: 0;
839
855
  }
840
- ._Table_1w0os_1 th {
856
+ ._Table_1bbu5_1 th {
841
857
  background: var(--puck-color-grey-12);
842
858
  font-weight: 400;
843
859
  padding-left: 24px;
@@ -846,12 +862,12 @@ p {
846
862
  padding-top: 12px;
847
863
  }
848
864
  @media (--standard-viewport) {
849
- ._Table_1w0os_1 th {
865
+ ._Table_1bbu5_1 th {
850
866
  padding-left: 32px;
851
867
  padding-right: 32px;
852
868
  }
853
869
  }
854
- ._Table_1w0os_1 td {
870
+ ._Table_1bbu5_1 td {
855
871
  border-bottom: 1px solid var(--puck-color-grey-10);
856
872
  padding-left: 24px;
857
873
  padding-right: 24px;
@@ -859,26 +875,26 @@ p {
859
875
  padding-top: 16px;
860
876
  white-space: nowrap;
861
877
  }
862
- ._Table_1w0os_1 td:not(:first-of-type) {
878
+ ._Table_1bbu5_1 td:not(:first-of-type) {
863
879
  color: var(--puck-color-grey-05);
864
880
  }
865
- ._Table_1w0os_1 tbody tr:last-of-type td {
881
+ ._Table_1bbu5_1 tbody tr:last-of-type td {
866
882
  border-bottom: none;
867
883
  }
868
884
  @media (--standard-viewport) {
869
- ._Table_1w0os_1 td {
885
+ ._Table_1bbu5_1 td {
870
886
  padding-left: 32px;
871
887
  padding-right: 32px;
872
888
  }
873
889
  }
874
- ._Table-footer_1w0os_85 {
890
+ ._Table-footer_1bbu5_89 {
875
891
  border-top: 1px solid var(--puck-color-grey-09);
876
892
  }
877
- ._Table--clickableRows_1w0os_89 tbody tr:hover {
893
+ ._Table--clickableRows_1bbu5_93 tbody tr:hover {
878
894
  background: var(--puck-color-azure-12);
879
895
  cursor: pointer;
880
896
  }
881
- ._Table-placeholder_1w0os_94 {
897
+ ._Table-placeholder_1bbu5_98 {
882
898
  align-items: center;
883
899
  color: var(--puck-color-grey-06);
884
900
  justify-content: center;
@@ -888,9 +904,12 @@ p {
888
904
  width: 100%;
889
905
  height: 100%;
890
906
  }
891
- ._Table-loader_1w0os_105 {
907
+ ._Table-loader_1bbu5_109 {
892
908
  padding: 16px 24px;
893
909
  }
910
+ ._TableRow--highlightRow_1bbu5_113 {
911
+ background-color: var(--puck-color-grey-12);
912
+ }
894
913
 
895
914
  /* css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/VerticalSpace/VerticalSpace.module.css/#css-module-data */
896
915
  ._VerticalSpace_1tjaw_1 {
package/dist/index.d.mts CHANGED
@@ -1,22 +1,115 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { UIMessage, ChatStatus } from 'ai';
3
- import { PuckProviderMetadata, PuckDataParts } from '@puckeditor/platform-types';
4
- import { ReactNode, RefObject } from 'react';
5
2
 
6
- type PuckMessage = UIMessage<PuckProviderMetadata, PuckDataParts>;
3
+ type _JSONSchema = boolean | JSONSchema;
4
+ type JSONSchema = {
5
+ [k: string]: unknown;
6
+ $schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
7
+ $id?: string;
8
+ $anchor?: string;
9
+ $ref?: string;
10
+ $dynamicRef?: string;
11
+ $dynamicAnchor?: string;
12
+ $vocabulary?: Record<string, boolean>;
13
+ $comment?: string;
14
+ $defs?: Record<string, JSONSchema>;
15
+ type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
16
+ additionalItems?: _JSONSchema;
17
+ unevaluatedItems?: _JSONSchema;
18
+ prefixItems?: _JSONSchema[];
19
+ items?: _JSONSchema | _JSONSchema[];
20
+ contains?: _JSONSchema;
21
+ additionalProperties?: _JSONSchema;
22
+ unevaluatedProperties?: _JSONSchema;
23
+ properties?: Record<string, _JSONSchema>;
24
+ patternProperties?: Record<string, _JSONSchema>;
25
+ dependentSchemas?: Record<string, _JSONSchema>;
26
+ propertyNames?: _JSONSchema;
27
+ if?: _JSONSchema;
28
+ then?: _JSONSchema;
29
+ else?: _JSONSchema;
30
+ allOf?: JSONSchema[];
31
+ anyOf?: JSONSchema[];
32
+ oneOf?: JSONSchema[];
33
+ not?: _JSONSchema;
34
+ multipleOf?: number;
35
+ maximum?: number;
36
+ exclusiveMaximum?: number | boolean;
37
+ minimum?: number;
38
+ exclusiveMinimum?: number | boolean;
39
+ maxLength?: number;
40
+ minLength?: number;
41
+ pattern?: string;
42
+ maxItems?: number;
43
+ minItems?: number;
44
+ uniqueItems?: boolean;
45
+ maxContains?: number;
46
+ minContains?: number;
47
+ maxProperties?: number;
48
+ minProperties?: number;
49
+ required?: string[];
50
+ dependentRequired?: Record<string, string[]>;
51
+ enum?: Array<string | number | boolean | null>;
52
+ const?: string | number | boolean | null;
53
+ id?: string;
54
+ title?: string;
55
+ description?: string;
56
+ default?: unknown;
57
+ deprecated?: boolean;
58
+ readOnly?: boolean;
59
+ writeOnly?: boolean;
60
+ nullable?: boolean;
61
+ examples?: unknown[];
62
+ format?: string;
63
+ contentMediaType?: string;
64
+ contentEncoding?: string;
65
+ contentSchema?: JSONSchema;
66
+ _prefault?: unknown;
67
+ };
68
+
69
+ type ComponentAiParams = {
70
+ instructions?: string;
71
+ schema?: JSONSchema;
72
+ defaultZone?: { allow?: string[]; disallow?: string[]; disabled?: boolean };
73
+ };
74
+
75
+ type FieldAiParams = {
76
+ instructions?: string;
77
+ exclude?: boolean;
78
+ required?: boolean;
79
+ stream?: boolean;
80
+ schema?: JSONSchema;
81
+ };
82
+
83
+ declare module "@measured/puck" {
84
+ export interface ComponentMetadata {
85
+ ai?: ComponentAiParams;
86
+ }
7
87
 
8
- type ChatProps$1 = {
88
+ export interface ComponentConfigExtensions {
89
+ ai?: ComponentAiParams;
90
+ }
91
+
92
+ export interface FieldMetadata {
93
+ ai?: FieldAiParams;
94
+ }
95
+
96
+ export interface BaseField {
97
+ ai?: FieldAiParams;
98
+ }
99
+ }
100
+
101
+ type AiPluginProps = {
9
102
  host?: string;
10
- onSubmit?: (prompt: string) => void;
11
- examplePrompts?: {
12
- href: string;
13
- label: string;
14
- }[];
15
- chatId?: string;
16
- initialMessages?: PuckMessage[];
103
+ chat?: {
104
+ onSubmit?: (prompt: string) => void;
105
+ examplePrompts?: {
106
+ href: string;
107
+ label: string;
108
+ }[];
109
+ };
17
110
  };
18
111
 
19
- declare function createAIPlugin(opts?: ChatProps$1): {
112
+ declare function createAiPlugin(opts?: AiPluginProps): {
20
113
  label: string;
21
114
  name: string;
22
115
  render: () => react_jsx_runtime.JSX.Element;
@@ -24,17 +117,4 @@ declare function createAIPlugin(opts?: ChatProps$1): {
24
117
  mobilePanelHeight: "min-content";
25
118
  };
26
119
 
27
- type ChatProps = {
28
- children?: ReactNode;
29
- examplePrompts?: ReactNode;
30
- handleSubmit?: (prompt: string) => void;
31
- hideInput?: boolean;
32
- inputRef?: RefObject<HTMLTextAreaElement | null>;
33
- status?: ChatStatus;
34
- messages?: PuckMessage[];
35
- error?: string;
36
- handleRetry?: () => void;
37
- };
38
- declare function ChatBody({ children, examplePrompts, handleSubmit, hideInput, inputRef, messages, status, error, handleRetry, }: ChatProps): react_jsx_runtime.JSX.Element;
39
-
40
- export { ChatBody, createAIPlugin as default };
120
+ export { createAiPlugin };
package/dist/index.d.ts CHANGED
@@ -1,22 +1,115 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { UIMessage, ChatStatus } from 'ai';
3
- import { PuckProviderMetadata, PuckDataParts } from '@puckeditor/platform-types';
4
- import { ReactNode, RefObject } from 'react';
5
2
 
6
- type PuckMessage = UIMessage<PuckProviderMetadata, PuckDataParts>;
3
+ type _JSONSchema = boolean | JSONSchema;
4
+ type JSONSchema = {
5
+ [k: string]: unknown;
6
+ $schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
7
+ $id?: string;
8
+ $anchor?: string;
9
+ $ref?: string;
10
+ $dynamicRef?: string;
11
+ $dynamicAnchor?: string;
12
+ $vocabulary?: Record<string, boolean>;
13
+ $comment?: string;
14
+ $defs?: Record<string, JSONSchema>;
15
+ type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
16
+ additionalItems?: _JSONSchema;
17
+ unevaluatedItems?: _JSONSchema;
18
+ prefixItems?: _JSONSchema[];
19
+ items?: _JSONSchema | _JSONSchema[];
20
+ contains?: _JSONSchema;
21
+ additionalProperties?: _JSONSchema;
22
+ unevaluatedProperties?: _JSONSchema;
23
+ properties?: Record<string, _JSONSchema>;
24
+ patternProperties?: Record<string, _JSONSchema>;
25
+ dependentSchemas?: Record<string, _JSONSchema>;
26
+ propertyNames?: _JSONSchema;
27
+ if?: _JSONSchema;
28
+ then?: _JSONSchema;
29
+ else?: _JSONSchema;
30
+ allOf?: JSONSchema[];
31
+ anyOf?: JSONSchema[];
32
+ oneOf?: JSONSchema[];
33
+ not?: _JSONSchema;
34
+ multipleOf?: number;
35
+ maximum?: number;
36
+ exclusiveMaximum?: number | boolean;
37
+ minimum?: number;
38
+ exclusiveMinimum?: number | boolean;
39
+ maxLength?: number;
40
+ minLength?: number;
41
+ pattern?: string;
42
+ maxItems?: number;
43
+ minItems?: number;
44
+ uniqueItems?: boolean;
45
+ maxContains?: number;
46
+ minContains?: number;
47
+ maxProperties?: number;
48
+ minProperties?: number;
49
+ required?: string[];
50
+ dependentRequired?: Record<string, string[]>;
51
+ enum?: Array<string | number | boolean | null>;
52
+ const?: string | number | boolean | null;
53
+ id?: string;
54
+ title?: string;
55
+ description?: string;
56
+ default?: unknown;
57
+ deprecated?: boolean;
58
+ readOnly?: boolean;
59
+ writeOnly?: boolean;
60
+ nullable?: boolean;
61
+ examples?: unknown[];
62
+ format?: string;
63
+ contentMediaType?: string;
64
+ contentEncoding?: string;
65
+ contentSchema?: JSONSchema;
66
+ _prefault?: unknown;
67
+ };
68
+
69
+ type ComponentAiParams = {
70
+ instructions?: string;
71
+ schema?: JSONSchema;
72
+ defaultZone?: { allow?: string[]; disallow?: string[]; disabled?: boolean };
73
+ };
74
+
75
+ type FieldAiParams = {
76
+ instructions?: string;
77
+ exclude?: boolean;
78
+ required?: boolean;
79
+ stream?: boolean;
80
+ schema?: JSONSchema;
81
+ };
82
+
83
+ declare module "@measured/puck" {
84
+ export interface ComponentMetadata {
85
+ ai?: ComponentAiParams;
86
+ }
7
87
 
8
- type ChatProps$1 = {
88
+ export interface ComponentConfigExtensions {
89
+ ai?: ComponentAiParams;
90
+ }
91
+
92
+ export interface FieldMetadata {
93
+ ai?: FieldAiParams;
94
+ }
95
+
96
+ export interface BaseField {
97
+ ai?: FieldAiParams;
98
+ }
99
+ }
100
+
101
+ type AiPluginProps = {
9
102
  host?: string;
10
- onSubmit?: (prompt: string) => void;
11
- examplePrompts?: {
12
- href: string;
13
- label: string;
14
- }[];
15
- chatId?: string;
16
- initialMessages?: PuckMessage[];
103
+ chat?: {
104
+ onSubmit?: (prompt: string) => void;
105
+ examplePrompts?: {
106
+ href: string;
107
+ label: string;
108
+ }[];
109
+ };
17
110
  };
18
111
 
19
- declare function createAIPlugin(opts?: ChatProps$1): {
112
+ declare function createAiPlugin(opts?: AiPluginProps): {
20
113
  label: string;
21
114
  name: string;
22
115
  render: () => react_jsx_runtime.JSX.Element;
@@ -24,17 +117,4 @@ declare function createAIPlugin(opts?: ChatProps$1): {
24
117
  mobilePanelHeight: "min-content";
25
118
  };
26
119
 
27
- type ChatProps = {
28
- children?: ReactNode;
29
- examplePrompts?: ReactNode;
30
- handleSubmit?: (prompt: string) => void;
31
- hideInput?: boolean;
32
- inputRef?: RefObject<HTMLTextAreaElement | null>;
33
- status?: ChatStatus;
34
- messages?: PuckMessage[];
35
- error?: string;
36
- handleRetry?: () => void;
37
- };
38
- declare function ChatBody({ children, examplePrompts, handleSubmit, hideInput, inputRef, messages, status, error, handleRetry, }: ChatProps): react_jsx_runtime.JSX.Element;
39
-
40
- export { ChatBody, createAIPlugin as default };
120
+ export { createAiPlugin };
package/dist/index.js CHANGED
@@ -189,8 +189,7 @@ var require_classnames = __commonJS({
189
189
  // index.ts
190
190
  var index_exports = {};
191
191
  __export(index_exports, {
192
- ChatBody: () => ChatBody,
193
- default: () => src_default
192
+ createAiPlugin: () => createAiPlugin
194
193
  });
195
194
  module.exports = __toCommonJS(index_exports);
196
195
  init_react_import();
@@ -20911,7 +20910,7 @@ init_react_import();
20911
20910
 
20912
20911
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Modal/Modal.module.css#css-module
20913
20912
  init_react_import();
20914
- var Modal_module_default = { "Modal-background": "_Modal-background_874yi_1", "Modal--visible": "_Modal--visible_874yi_16", "Modal-modal": "_Modal-modal_874yi_22" };
20913
+ var Modal_module_default = { "Modal-background": "_Modal-background_1bedq_1", "Modal--visible": "_Modal--visible_1bedq_16", "Modal-modal": "_Modal-modal_1bedq_22" };
20915
20914
 
20916
20915
  // ../platform-client/components/Modal/Modal.tsx
20917
20916
  var import_react9 = require("react");
@@ -20929,7 +20928,7 @@ var import_react8 = require("react");
20929
20928
 
20930
20929
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Button/Button.module.css#css-module
20931
20930
  init_react_import();
20932
- 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" };
20931
+ var Button_module_default = { "Button": "_Button_1wyvm_1", "Button--medium": "_Button--medium_1wyvm_29", "Button--large": "_Button--large_1wyvm_37", "Button-icon": "_Button-icon_1wyvm_44", "Button--primary": "_Button--primary_1wyvm_48", "Button--secondary": "_Button--secondary_1wyvm_67", "Button--danger": "_Button--danger_1wyvm_84", "Button--flush": "_Button--flush_1wyvm_98", "Button--disabled": "_Button--disabled_1wyvm_102", "Button--fullWidth": "_Button--fullWidth_1wyvm_109", "Button-spinner": "_Button-spinner_1wyvm_114" };
20933
20932
 
20934
20933
  // ../platform-client/components/Loader/index.tsx
20935
20934
  init_react_import();
@@ -20989,6 +20988,7 @@ var Button = ({
20989
20988
  className: getClassName2({
20990
20989
  primary: variant === "primary",
20991
20990
  secondary: variant === "secondary",
20991
+ danger: variant === "danger",
20992
20992
  disabled,
20993
20993
  fullWidth,
20994
20994
  [size]: true
@@ -21010,7 +21010,7 @@ var Button = ({
21010
21010
  children: [
21011
21011
  icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("icon"), children: icon }),
21012
21012
  children,
21013
- loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 14 }) })
21013
+ loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { size: 12 }) })
21014
21014
  ]
21015
21015
  }
21016
21016
  );
@@ -21020,18 +21020,24 @@ var Button = ({
21020
21020
  // ../platform-client/components/Modal/Modal.tsx
21021
21021
  var import_jsx_runtime3 = require("react/jsx-runtime");
21022
21022
  var getClassName3 = getClassNameFactory2("Modal", Modal_module_default);
21023
- var modalContext = (0, import_react9.createContext)({ visible: false, setVisible: () => {
21024
- }, ref: null });
21023
+ var modalContext = (0, import_react9.createContext)({
21024
+ buttonVariant: "primary",
21025
+ visible: false,
21026
+ setVisible: () => {
21027
+ },
21028
+ ref: null
21029
+ });
21025
21030
  var Modal = ({
21026
21031
  actionLabel = "Open",
21027
- children
21032
+ children,
21033
+ hideButton = false
21028
21034
  }) => {
21029
- const { visible, setVisible, ref } = (0, import_react9.useContext)(modalContext);
21035
+ const { visible, setVisible, buttonVariant, ref } = (0, import_react9.useContext)(modalContext);
21030
21036
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3({ visible }), children: [
21031
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("button"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
21037
+ !hideButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("button"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
21032
21038
  Button,
21033
21039
  {
21034
- variant: "secondary",
21040
+ variant: buttonVariant,
21035
21041
  onClick: () => {
21036
21042
  setVisible(!visible);
21037
21043
  },
@@ -21077,9 +21083,10 @@ var ActionModal = ({
21077
21083
  children,
21078
21084
  title,
21079
21085
  description,
21080
- actions
21086
+ actions,
21087
+ hideButton
21081
21088
  }) => {
21082
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Modal, { actionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
21089
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
21083
21090
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5("header"), children: [
21084
21091
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Heading, { size: "s", children: title }),
21085
21092
  description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("small", { children: description })
@@ -21383,11 +21390,12 @@ var import_react14 = require("react");
21383
21390
 
21384
21391
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Table/Table.module.css#css-module
21385
21392
  init_react_import();
21386
- 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" };
21393
+ var Table_module_default = { "Table": "_Table_1bbu5_1", "Table-filters": "_Table-filters_1bbu5_9", "Table-inner": "_Table-inner_1bbu5_13", "Table-table": "_Table-table_1bbu5_17", "Table--hideHeader": "_Table--hideHeader_1bbu5_41", "Table-footer": "_Table-footer_1bbu5_89", "Table--clickableRows": "_Table--clickableRows_1bbu5_93", "Table-placeholder": "_Table-placeholder_1bbu5_98", "Table-loader": "_Table-loader_1bbu5_109", "TableRow--highlightRow": "_TableRow--highlightRow_1bbu5_113" };
21387
21394
 
21388
21395
  // ../platform-client/components/Table/Table.tsx
21389
21396
  var import_jsx_runtime19 = require("react/jsx-runtime");
21390
21397
  var getClassName14 = get_class_name_factory_default("Table", Table_module_default);
21398
+ var getRowClassName = get_class_name_factory_default("TableRow", Table_module_default);
21391
21399
 
21392
21400
  // ../platform-client/components/Textarea/index.tsx
21393
21401
  init_react_import();
@@ -21660,22 +21668,18 @@ var BENCHMARK = false;
21660
21668
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
21661
21669
  var getClassName16 = getClassNameFactory("Chat", styles_module_default);
21662
21670
  var usePuck = (0, import_puck2.createUsePuck)();
21663
- function Chat2({
21664
- chatId,
21665
- examplePrompts,
21666
- host = "/api/puck/chat",
21667
- initialMessages = []
21668
- }) {
21671
+ function Chat2({ chat, host = "/api/puck/chat" }) {
21672
+ const { examplePrompts } = chat != null ? chat : {};
21669
21673
  const puckDispatch = usePuck((s) => s.dispatch);
21670
21674
  const getPuck = (0, import_puck2.useGetPuck)();
21671
- const localChatId = (0, import_react20.useRef)(chatId);
21675
+ const localChatId = (0, import_react20.useRef)("");
21672
21676
  const inputRef = (0, import_react20.useRef)(null);
21673
21677
  const pluginRef = (0, import_react20.useRef)(null);
21674
21678
  const [error46, setError] = (0, import_react20.useState)();
21675
21679
  const [toolStatus, setToolStatus] = (0, import_react20.useState)({});
21676
21680
  const { messages, status, sendMessage, regenerate } = useChat({
21677
21681
  generateId: () => prefixedUlid("msg"),
21678
- messages: initialMessages,
21682
+ messages: [],
21679
21683
  transport: new DefaultChatTransport({
21680
21684
  api: host,
21681
21685
  prepareSendMessagesRequest: (opts) => {
@@ -21977,7 +21981,7 @@ function isScrolledIntoView(el) {
21977
21981
 
21978
21982
  // src/index.tsx
21979
21983
  var import_jsx_runtime26 = require("react/jsx-runtime");
21980
- function createAIPlugin(opts) {
21984
+ function createAiPlugin(opts) {
21981
21985
  return {
21982
21986
  label: "AI",
21983
21987
  name: "ai",
@@ -21986,10 +21990,9 @@ function createAIPlugin(opts) {
21986
21990
  mobilePanelHeight: "min-content"
21987
21991
  };
21988
21992
  }
21989
- var src_default = createAIPlugin;
21990
21993
  // Annotate the CommonJS export names for ESM import in node:
21991
21994
  0 && (module.exports = {
21992
- ChatBody
21995
+ createAiPlugin
21993
21996
  });
21994
21997
  /*! Bundled license information:
21995
21998
 
package/dist/index.mjs CHANGED
@@ -20902,7 +20902,7 @@ init_react_import();
20902
20902
 
20903
20903
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Modal/Modal.module.css#css-module
20904
20904
  init_react_import();
20905
- var Modal_module_default = { "Modal-background": "_Modal-background_874yi_1", "Modal--visible": "_Modal--visible_874yi_16", "Modal-modal": "_Modal-modal_874yi_22" };
20905
+ var Modal_module_default = { "Modal-background": "_Modal-background_1bedq_1", "Modal--visible": "_Modal--visible_1bedq_16", "Modal-modal": "_Modal-modal_1bedq_22" };
20906
20906
 
20907
20907
  // ../platform-client/components/Modal/Modal.tsx
20908
20908
  import { createContext, useContext } from "react";
@@ -20920,7 +20920,7 @@ import { useEffect as useEffect4, useState as useState4 } from "react";
20920
20920
 
20921
20921
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Button/Button.module.css#css-module
20922
20922
  init_react_import();
20923
- 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" };
20923
+ var Button_module_default = { "Button": "_Button_1wyvm_1", "Button--medium": "_Button--medium_1wyvm_29", "Button--large": "_Button--large_1wyvm_37", "Button-icon": "_Button-icon_1wyvm_44", "Button--primary": "_Button--primary_1wyvm_48", "Button--secondary": "_Button--secondary_1wyvm_67", "Button--danger": "_Button--danger_1wyvm_84", "Button--flush": "_Button--flush_1wyvm_98", "Button--disabled": "_Button--disabled_1wyvm_102", "Button--fullWidth": "_Button--fullWidth_1wyvm_109", "Button-spinner": "_Button-spinner_1wyvm_114" };
20924
20924
 
20925
20925
  // ../platform-client/components/Loader/index.tsx
20926
20926
  init_react_import();
@@ -20980,6 +20980,7 @@ var Button = ({
20980
20980
  className: getClassName2({
20981
20981
  primary: variant === "primary",
20982
20982
  secondary: variant === "secondary",
20983
+ danger: variant === "danger",
20983
20984
  disabled,
20984
20985
  fullWidth,
20985
20986
  [size]: true
@@ -21001,7 +21002,7 @@ var Button = ({
21001
21002
  children: [
21002
21003
  icon && /* @__PURE__ */ jsx2("div", { className: getClassName2("icon"), children: icon }),
21003
21004
  children,
21004
- loading && /* @__PURE__ */ jsx2("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ jsx2(Loader, { size: 14 }) })
21005
+ loading && /* @__PURE__ */ jsx2("div", { className: getClassName2("spinner"), children: /* @__PURE__ */ jsx2(Loader, { size: 12 }) })
21005
21006
  ]
21006
21007
  }
21007
21008
  );
@@ -21011,18 +21012,24 @@ var Button = ({
21011
21012
  // ../platform-client/components/Modal/Modal.tsx
21012
21013
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
21013
21014
  var getClassName3 = getClassNameFactory2("Modal", Modal_module_default);
21014
- var modalContext = createContext({ visible: false, setVisible: () => {
21015
- }, ref: null });
21015
+ var modalContext = createContext({
21016
+ buttonVariant: "primary",
21017
+ visible: false,
21018
+ setVisible: () => {
21019
+ },
21020
+ ref: null
21021
+ });
21016
21022
  var Modal = ({
21017
21023
  actionLabel = "Open",
21018
- children
21024
+ children,
21025
+ hideButton = false
21019
21026
  }) => {
21020
- const { visible, setVisible, ref } = useContext(modalContext);
21027
+ const { visible, setVisible, buttonVariant, ref } = useContext(modalContext);
21021
21028
  return /* @__PURE__ */ jsxs2("div", { className: getClassName3({ visible }), children: [
21022
- /* @__PURE__ */ jsx3("div", { className: getClassName3("button"), children: /* @__PURE__ */ jsx3(
21029
+ !hideButton && /* @__PURE__ */ jsx3("div", { className: getClassName3("button"), children: /* @__PURE__ */ jsx3(
21023
21030
  Button,
21024
21031
  {
21025
- variant: "secondary",
21032
+ variant: buttonVariant,
21026
21033
  onClick: () => {
21027
21034
  setVisible(!visible);
21028
21035
  },
@@ -21068,9 +21075,10 @@ var ActionModal = ({
21068
21075
  children,
21069
21076
  title,
21070
21077
  description,
21071
- actions
21078
+ actions,
21079
+ hideButton
21072
21080
  }) => {
21073
- return /* @__PURE__ */ jsx5(Modal, { actionLabel, children: /* @__PURE__ */ jsxs3("div", { className: getClassName5(), children: [
21081
+ return /* @__PURE__ */ jsx5(Modal, { actionLabel, hideButton, children: /* @__PURE__ */ jsxs3("div", { className: getClassName5(), children: [
21074
21082
  /* @__PURE__ */ jsxs3("div", { className: getClassName5("header"), children: [
21075
21083
  /* @__PURE__ */ jsx5(Heading, { size: "s", children: title }),
21076
21084
  description && /* @__PURE__ */ jsx5("small", { children: description })
@@ -21374,11 +21382,12 @@ import { useEffect as useEffect6, useMemo as useMemo2, useRef as useRef5, useSta
21374
21382
 
21375
21383
  // css-module:/home/runner/work/puck-platform/puck-platform/packages/platform-client/components/Table/Table.module.css#css-module
21376
21384
  init_react_import();
21377
- 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" };
21385
+ var Table_module_default = { "Table": "_Table_1bbu5_1", "Table-filters": "_Table-filters_1bbu5_9", "Table-inner": "_Table-inner_1bbu5_13", "Table-table": "_Table-table_1bbu5_17", "Table--hideHeader": "_Table--hideHeader_1bbu5_41", "Table-footer": "_Table-footer_1bbu5_89", "Table--clickableRows": "_Table--clickableRows_1bbu5_93", "Table-placeholder": "_Table-placeholder_1bbu5_98", "Table-loader": "_Table-loader_1bbu5_109", "TableRow--highlightRow": "_TableRow--highlightRow_1bbu5_113" };
21378
21386
 
21379
21387
  // ../platform-client/components/Table/Table.tsx
21380
21388
  import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
21381
21389
  var getClassName14 = get_class_name_factory_default("Table", Table_module_default);
21390
+ var getRowClassName = get_class_name_factory_default("TableRow", Table_module_default);
21382
21391
 
21383
21392
  // ../platform-client/components/Textarea/index.tsx
21384
21393
  init_react_import();
@@ -21655,22 +21664,18 @@ var BENCHMARK = false;
21655
21664
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid3()}`;
21656
21665
  var getClassName16 = getClassNameFactory("Chat", styles_module_default);
21657
21666
  var usePuck = createUsePuck();
21658
- function Chat2({
21659
- chatId,
21660
- examplePrompts,
21661
- host = "/api/puck/chat",
21662
- initialMessages = []
21663
- }) {
21667
+ function Chat2({ chat, host = "/api/puck/chat" }) {
21668
+ const { examplePrompts } = chat != null ? chat : {};
21664
21669
  const puckDispatch = usePuck((s) => s.dispatch);
21665
21670
  const getPuck = useGetPuck();
21666
- const localChatId = useRef7(chatId);
21671
+ const localChatId = useRef7("");
21667
21672
  const inputRef = useRef7(null);
21668
21673
  const pluginRef = useRef7(null);
21669
21674
  const [error46, setError] = useState10();
21670
21675
  const [toolStatus, setToolStatus] = useState10({});
21671
21676
  const { messages, status, sendMessage, regenerate } = useChat({
21672
21677
  generateId: () => prefixedUlid("msg"),
21673
- messages: initialMessages,
21678
+ messages: [],
21674
21679
  transport: new DefaultChatTransport({
21675
21680
  api: host,
21676
21681
  prepareSendMessagesRequest: (opts) => {
@@ -21972,7 +21977,7 @@ function isScrolledIntoView(el) {
21972
21977
 
21973
21978
  // src/index.tsx
21974
21979
  import { jsx as jsx26 } from "react/jsx-runtime";
21975
- function createAIPlugin(opts) {
21980
+ function createAiPlugin(opts) {
21976
21981
  return {
21977
21982
  label: "AI",
21978
21983
  name: "ai",
@@ -21981,10 +21986,8 @@ function createAIPlugin(opts) {
21981
21986
  mobilePanelHeight: "min-content"
21982
21987
  };
21983
21988
  }
21984
- var src_default = createAIPlugin;
21985
21989
  export {
21986
- ChatBody,
21987
- src_default as default
21990
+ createAiPlugin
21988
21991
  };
21989
21992
  /*! Bundled license information:
21990
21993
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/plugin-ai",
3
- "version": "0.1.0-canary.ab95935e",
3
+ "version": "0.1.0-canary.b477dbbe",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "puckeditor/puck",
6
6
  "bugs": "https://github.com/puckeditor/puck/issues",
@@ -23,8 +23,6 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "html2canvas-pro": "^1.5.11",
27
- "jsonrepair": "^3.12.0",
28
26
  "qler": "^0.6.2",
29
27
  "react-markdown": "^10.1.0",
30
28
  "react-textarea-autosize": "^8.5.9",