@puckeditor/plugin-ai 0.8.0-canary.62b8dc69 → 0.8.0-canary.844eb87d

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
@@ -1916,14 +1916,14 @@ button._Menu-item_1tu16_55:hover {
1916
1916
  }
1917
1917
 
1918
1918
  /* css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/PromptForm/styles.module.css/#css-module-data */
1919
- ._PromptForm_1iqhg_1 {
1919
+ ._PromptForm_16e09_1 {
1920
1920
  --radius: 9px;
1921
1921
  background-color: var(--puck-color-grey-09);
1922
1922
  border-radius: var(--radius);
1923
1923
  position: relative;
1924
1924
  width: 100%;
1925
1925
  }
1926
- ._PromptForm-dropOverlay_1iqhg_9 {
1926
+ ._PromptForm-dropOverlay_16e09_9 {
1927
1927
  align-items: center;
1928
1928
  background: var(--puck-color-azure-12);
1929
1929
  border: 2px dashed var(--puck-color-azure-04);
@@ -1940,16 +1940,16 @@ button._Menu-item_1tu16_55:hover {
1940
1940
  position: absolute;
1941
1941
  z-index: 10;
1942
1942
  }
1943
- ._PromptForm-inner_1iqhg_27 {
1943
+ ._PromptForm-inner_16e09_27 {
1944
1944
  border-radius: var(--radius);
1945
1945
  padding: 1px;
1946
1946
  position: relative;
1947
1947
  }
1948
- ._PromptForm--dark_1iqhg_33 {
1948
+ ._PromptForm--dark_16e09_33 {
1949
1949
  background-color: var(--puck-color-grey-02);
1950
1950
  box-shadow: none;
1951
1951
  }
1952
- ._PromptForm--glow_1iqhg_38 ._PromptForm-glow_1iqhg_38 {
1952
+ ._PromptForm--glow_16e09_38 ._PromptForm-glow_16e09_38 {
1953
1953
  border: 2px solid transparent;
1954
1954
  border-radius: var(--radius);
1955
1955
  mask: linear-gradient(transparent, transparent), linear-gradient(white, white);
@@ -1959,7 +1959,7 @@ button._Menu-item_1tu16_55:hover {
1959
1959
  pointer-events: none;
1960
1960
  inset: 0;
1961
1961
  }
1962
- ._PromptForm--glow_1iqhg_38 ._PromptForm-glow_1iqhg_38::after {
1962
+ ._PromptForm--glow_16e09_38 ._PromptForm-glow_16e09_38::after {
1963
1963
  background:
1964
1964
  radial-gradient(
1965
1965
  circle at center,
@@ -1968,30 +1968,30 @@ button._Menu-item_1tu16_55:hover {
1968
1968
  content: "";
1969
1969
  offset-path: rect(0 100% 100% 0 round 200px);
1970
1970
  offset-anchor: calc(var(--anchor) * 1%) 50%;
1971
- animation: _loop_1iqhg_1 9s infinite linear;
1971
+ animation: _loop_16e09_1 9s infinite linear;
1972
1972
  position: absolute;
1973
1973
  height: 312px;
1974
1974
  aspect-ratio: 1 / 1;
1975
1975
  display: inline-block;
1976
1976
  }
1977
- ._PromptForm--dark_1iqhg_33._PromptForm--glow_1iqhg_38 ._PromptForm-glow_1iqhg_38::after {
1977
+ ._PromptForm--dark_16e09_33._PromptForm--glow_16e09_38 ._PromptForm-glow_16e09_38::after {
1978
1978
  background:
1979
1979
  radial-gradient(
1980
1980
  circle at center,
1981
1981
  var(--puck-color-azure-08),
1982
1982
  transparent 50%);
1983
1983
  }
1984
- @keyframes _loop_1iqhg_1 {
1984
+ @keyframes _loop_16e09_1 {
1985
1985
  to {
1986
1986
  offset-distance: 100%;
1987
1987
  }
1988
1988
  }
1989
- ._PromptForm-formInner_1iqhg_79 {
1989
+ ._PromptForm-formInner_16e09_79 {
1990
1990
  background-color: white;
1991
1991
  border-radius: 8px;
1992
1992
  position: relative;
1993
1993
  }
1994
- ._PromptForm-input_1iqhg_85 {
1994
+ ._PromptForm-input_16e09_85 {
1995
1995
  background-color: transparent;
1996
1996
  border: none;
1997
1997
  display: block;
@@ -2008,21 +2008,26 @@ button._Menu-item_1tu16_55:hover {
2008
2008
  width: 100%;
2009
2009
  box-sizing: border-box;
2010
2010
  }
2011
- ._PromptForm-input_1iqhg_85:focus {
2011
+ @media (min-width: 768px) {
2012
+ ._PromptForm-input_16e09_85 {
2013
+ font-size: var(--puck-font-size-xxs);
2014
+ }
2015
+ }
2016
+ ._PromptForm-input_16e09_85:focus {
2012
2017
  outline: none;
2013
2018
  }
2014
- ._PromptForm-formInner_1iqhg_79:has(._PromptForm-input_1iqhg_85:focus) {
2019
+ ._PromptForm-formInner_16e09_79:has(._PromptForm-input_16e09_85:focus) {
2015
2020
  outline: 2px solid var(--puck-color-azure-04);
2016
2021
  }
2017
- ._PromptForm--dark_1iqhg_33 ._PromptForm-input_1iqhg_85 {
2022
+ ._PromptForm--dark_16e09_33 ._PromptForm-input_16e09_85 {
2018
2023
  background-color: var(--puck-color-grey-01);
2019
2024
  color: var(--puck-color-grey-08);
2020
2025
  }
2021
- ._PromptForm--disabled_1iqhg_116 ._PromptForm-input_1iqhg_85 {
2026
+ ._PromptForm--disabled_16e09_122 ._PromptForm-input_16e09_85 {
2022
2027
  background-color: var(--puck-color-grey-12);
2023
2028
  cursor: not-allowed;
2024
2029
  }
2025
- ._PromptForm-helper_1iqhg_121 {
2030
+ ._PromptForm-helper_16e09_127 {
2026
2031
  align-items: center;
2027
2032
  color: var(--puck-color-grey-04);
2028
2033
  display: flex;
@@ -2031,7 +2036,7 @@ button._Menu-item_1tu16_55:hover {
2031
2036
  font-weight: 500;
2032
2037
  padding: 6px 12px;
2033
2038
  }
2034
- ._PromptForm-actions_1iqhg_131 {
2039
+ ._PromptForm-actions_16e09_137 {
2035
2040
  align-items: flex-end;
2036
2041
  cursor: text;
2037
2042
  display: flex;
@@ -2041,7 +2046,7 @@ button._Menu-item_1tu16_55:hover {
2041
2046
  right: 0;
2042
2047
  padding: 6px;
2043
2048
  }
2044
- ._PromptForm-actionsLeft_1iqhg_142 {
2049
+ ._PromptForm-actionsLeft_16e09_148 {
2045
2050
  align-items: center;
2046
2051
  cursor: auto;
2047
2052
  display: flex;
@@ -2049,11 +2054,11 @@ button._Menu-item_1tu16_55:hover {
2049
2054
  gap: 6px;
2050
2055
  padding-left: 4px;
2051
2056
  }
2052
- ._PromptForm-actionsRight_1iqhg_151 {
2057
+ ._PromptForm-actionsRight_16e09_157 {
2053
2058
  cursor: auto;
2054
2059
  margin-left: auto;
2055
2060
  }
2056
- ._PromptForm-actionSubmit_1iqhg_156 {
2061
+ ._PromptForm-actionSubmit_16e09_162 {
2057
2062
  background: var(--puck-color-azure-04);
2058
2063
  border-radius: 48px;
2059
2064
  color: white;
@@ -2066,34 +2071,35 @@ button._Menu-item_1tu16_55:hover {
2066
2071
  pointer-events: auto;
2067
2072
  cursor: pointer;
2068
2073
  height: 32px;
2069
- width: 32px;
2074
+ width: 100%;
2075
+ min-width: 32px;
2070
2076
  }
2071
- ._PromptForm--userCta_1iqhg_172 ._PromptForm-actionSubmit_1iqhg_156 {
2077
+ ._PromptForm--userCta_16e09_179 ._PromptForm-actionSubmit_16e09_162 {
2072
2078
  padding: 8px 12px;
2073
2079
  }
2074
- ._PromptForm-actionSubmit_1iqhg_156:hover {
2080
+ ._PromptForm-actionSubmit_16e09_162:hover {
2075
2081
  background: var(--puck-color-azure-05);
2076
2082
  }
2077
- ._PromptForm-actionSubmit_1iqhg_156:focus {
2083
+ ._PromptForm-actionSubmit_16e09_162:focus {
2078
2084
  outline: 2px solid var(--puck-color-azure-04);
2079
2085
  outline-offset: 2px;
2080
2086
  }
2081
- ._PromptForm--isDisabled_1iqhg_185 ._PromptForm-actionSubmit_1iqhg_156 {
2087
+ ._PromptForm--isDisabled_16e09_192 ._PromptForm-actionSubmit_16e09_162 {
2082
2088
  background-color: var(--puck-color-grey-06);
2083
2089
  cursor: not-allowed;
2084
2090
  }
2085
- ._PromptForm--isLoading_1iqhg_190 ._PromptForm-actionSubmit_1iqhg_156 {
2091
+ ._PromptForm--isLoading_16e09_197 ._PromptForm-actionSubmit_16e09_162 {
2086
2092
  background-color: var(--puck-color-azure-06);
2087
2093
  cursor: not-allowed;
2088
2094
  }
2089
- ._PromptForm-attachments_1iqhg_195 {
2095
+ ._PromptForm-attachments_16e09_202 {
2090
2096
  display: flex;
2091
2097
  flex-wrap: wrap;
2092
2098
  gap: 8px;
2093
2099
  padding: 8px 12px;
2094
2100
  padding-bottom: 0px;
2095
2101
  }
2096
- ._PromptForm-attachmentChip_1iqhg_203 {
2102
+ ._PromptForm-attachmentChip_16e09_210 {
2097
2103
  align-items: center;
2098
2104
  background: var(--puck-color-grey-12);
2099
2105
  border: 1px solid var(--puck-color-grey-09);
@@ -2107,21 +2113,21 @@ button._Menu-item_1tu16_55:hover {
2107
2113
  padding: 4px 8px;
2108
2114
  text-overflow: ellipsis;
2109
2115
  }
2110
- ._PromptForm-attachmentChipUploading_1iqhg_218 {
2116
+ ._PromptForm-attachmentChipUploading_16e09_225 {
2111
2117
  color: var(--puck-color-grey-05);
2112
2118
  }
2113
- ._PromptForm-attachmentChipFailed_1iqhg_222 {
2119
+ ._PromptForm-attachmentChipFailed_16e09_229 {
2114
2120
  border-color: var(--puck-color-red-08);
2115
2121
  color: var(--puck-color-red-04);
2116
2122
  }
2117
- ._PromptForm-attachmentError_1iqhg_227 {
2123
+ ._PromptForm-attachmentError_16e09_234 {
2118
2124
  color: var(--puck-color-red-04);
2119
2125
  font-size: var(--puck-font-size-xxxs);
2120
2126
  }
2121
- ._PromptForm-attachmentSpinner_1iqhg_232 {
2122
- animation: _PromptForm-attachmentSpin_1iqhg_232 1s linear infinite;
2127
+ ._PromptForm-attachmentSpinner_16e09_239 {
2128
+ animation: _PromptForm-attachmentSpin_16e09_239 1s linear infinite;
2123
2129
  }
2124
- ._PromptForm-attachmentRemove_1iqhg_236 {
2130
+ ._PromptForm-attachmentRemove_16e09_243 {
2125
2131
  align-items: center;
2126
2132
  background: transparent;
2127
2133
  border: 0;
@@ -2131,12 +2137,115 @@ button._Menu-item_1tu16_55:hover {
2131
2137
  margin-left: 2px;
2132
2138
  padding: 0;
2133
2139
  }
2134
- ._PromptForm-attachmentRemove_1iqhg_236:focus-visible {
2140
+ ._PromptForm-attachmentRemove_16e09_243:focus-visible {
2135
2141
  border-radius: 4px;
2136
2142
  outline: 2px solid var(--puck-color-azure-04);
2137
2143
  }
2138
- @keyframes _PromptForm-attachmentSpin_1iqhg_232 {
2144
+ @keyframes _PromptForm-attachmentSpin_16e09_239 {
2139
2145
  to {
2140
2146
  transform: rotate(360deg);
2141
2147
  }
2142
2148
  }
2149
+
2150
+ /* css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/DesignModeToggle/styles.module.css/#css-module-data */
2151
+ ._DesignModeToggle_o5uty_1 {
2152
+ display: flex;
2153
+ align-items: center;
2154
+ gap: 6px;
2155
+ margin-left: auto;
2156
+ }
2157
+ ._DesignModeToggle-button_o5uty_8 {
2158
+ all: unset;
2159
+ box-sizing: border-box;
2160
+ cursor: pointer;
2161
+ display: flex;
2162
+ align-items: center;
2163
+ gap: 4px;
2164
+ padding: 6px 8px;
2165
+ border-radius: 6px;
2166
+ font-size: 12px;
2167
+ font-weight: 500;
2168
+ color: var(--puck-color-grey-04);
2169
+ background: var(--puck-color-grey-11);
2170
+ transition: background 150ms, color 150ms;
2171
+ }
2172
+ ._DesignModeToggle-button_o5uty_8:hover {
2173
+ background: var(--puck-color-grey-10);
2174
+ }
2175
+ ._DesignModeToggle-button--active_o5uty_28 {
2176
+ background: var(--puck-color-azure-09);
2177
+ color: var(--puck-color-azure-03);
2178
+ }
2179
+ ._DesignModeToggle-button_o5uty_8:focus-visible {
2180
+ outline: 2px var(--puck-color-azure-04) solid;
2181
+ }
2182
+ ._DesignModeToggle-button_o5uty_8:disabled {
2183
+ cursor: not-allowed;
2184
+ }
2185
+ ._DesignModeToggle-button--active_o5uty_28:hover {
2186
+ background: var(--puck-color-azure-08);
2187
+ }
2188
+
2189
+ /* css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/ManageComponents/styles.module.css/#css-module-data */
2190
+ ._ManageComponents-cta_xifz3_1 {
2191
+ all: unset;
2192
+ box-sizing: border-box;
2193
+ border-radius: 8px;
2194
+ cursor: pointer;
2195
+ display: flex;
2196
+ align-items: center;
2197
+ justify-content: center;
2198
+ gap: 8px;
2199
+ width: 100%;
2200
+ padding: 8px 12px;
2201
+ font-size: var(--puck-font-size-xs);
2202
+ color: var(--puck-color-grey-04);
2203
+ margin-top: 16px;
2204
+ }
2205
+ ._ManageComponents-cta_xifz3_1:hover {
2206
+ color: var(--puck-color-azure-04);
2207
+ background: var(--puck-color-grey-11);
2208
+ }
2209
+ ._ManageComponents-list_xifz3_22 {
2210
+ display: flex;
2211
+ flex-direction: column;
2212
+ gap: 8px;
2213
+ overflow-y: auto;
2214
+ }
2215
+ ._ManageComponents-item_xifz3_29 {
2216
+ display: flex;
2217
+ align-items: center;
2218
+ border-radius: 4px;
2219
+ justify-content: space-between;
2220
+ padding: 4px 8px;
2221
+ }
2222
+ ._ManageComponents-item_xifz3_29:hover {
2223
+ background-color: var(--puck-color-grey-11);
2224
+ }
2225
+ ._ManageComponents-delete_xifz3_41 {
2226
+ all: unset;
2227
+ cursor: pointer;
2228
+ display: flex;
2229
+ align-items: center;
2230
+ padding: 4px 8px;
2231
+ border-radius: 8px;
2232
+ font-size: var(--puck-font-size-xxs);
2233
+ color: var(--puck-color-red-03);
2234
+ gap: 4px;
2235
+ }
2236
+ ._ManageComponents-delete_xifz3_41:hover {
2237
+ background: var(--puck-color-red-09, #fef2f2);
2238
+ }
2239
+ ._ManageComponents-empty_xifz3_57 {
2240
+ text-align: center;
2241
+ color: var(--puck-color-grey-05);
2242
+ }
2243
+
2244
+ /* css-module:/home/runner/work/platform/platform/packages/plugin-ai/src/components/Drawer/styles.module.css/#css-module-data */
2245
+ ._Drawer--empty_1f4ux_1 {
2246
+ align-items: center;
2247
+ color: var(--puck-color-grey-05);
2248
+ display: flex;
2249
+ justify-content: center;
2250
+ height: 100%;
2251
+ }
package/dist/index.d.mts CHANGED
@@ -122,14 +122,23 @@ type AddOperation = {
122
122
  type: string;
123
123
  props: object;
124
124
  };
125
+ /**
126
+ * Streamed string tails keyed by prop path (e.g. `html`, `cta.label`,
127
+ * `items[2].title`). Each tail is appended to the value currently at that
128
+ * path. A top-level prop is carried either in `props` (full replacement) or
129
+ * in `appends` — never both — so applying them can't double-append.
130
+ */
131
+ type StringAppends = Record<string, string>;
125
132
  type UpdateOperation = {
126
133
  op: "update";
127
134
  id: string;
128
135
  props: object;
136
+ appends?: StringAppends;
129
137
  };
130
138
  type UpdateRootOperation = {
131
139
  op: "updateRoot";
132
140
  props: object;
141
+ appends?: StringAppends;
133
142
  };
134
143
  type MoveOperation = {
135
144
  op: "move";
@@ -229,6 +238,7 @@ type PuckProviderMetadata = {
229
238
 
230
239
  type PuckMessage = UIMessage<PuckProviderMetadata, PuckDataParts>;
231
240
 
241
+ type Mode = "assembly" | "design";
232
242
  type RequestOptions = {
233
243
  body?: {
234
244
  chatId?: string;
@@ -236,6 +246,7 @@ type RequestOptions = {
236
246
  messages?: PuckMessage[];
237
247
  pageData?: Data;
238
248
  config?: Config;
249
+ mode?: Mode;
239
250
  [key: string]: any;
240
251
  };
241
252
  headers?: HeadersInit;
@@ -263,6 +274,10 @@ type AiPluginProps = {
263
274
  };
264
275
  scrollTracking?: boolean;
265
276
  prepareRequest?: (opts: RequestOptions) => RequestOptions | Promise<RequestOptions>;
277
+ designMode?: boolean | {
278
+ visible?: boolean;
279
+ };
280
+ defaultMode?: "assembly" | "design";
266
281
  };
267
282
  declare global {
268
283
  interface Window {
@@ -275,6 +290,7 @@ declare global {
275
290
  }
276
291
  }
277
292
 
293
+ declare function withDynamicConfig(config: Config, data: Data): Config;
278
294
  declare function createAiPlugin(opts?: AiPluginProps): {
279
295
  label: string;
280
296
  name: string;
@@ -282,10 +298,13 @@ declare function createAiPlugin(opts?: AiPluginProps): {
282
298
  icon: react_jsx_runtime.JSX.Element;
283
299
  mobilePanelHeight: "min-content";
284
300
  overrides: {
301
+ drawer: ({ children }: {
302
+ children: react.ReactNode;
303
+ }) => react_jsx_runtime.JSX.Element;
285
304
  preview: ({ children }: {
286
305
  children: react.ReactNode;
287
306
  }) => react_jsx_runtime.JSX.Element;
288
307
  };
289
308
  };
290
309
 
291
- export { type ComponentAiParams, type FieldAiParams, createAiPlugin };
310
+ export { type ComponentAiParams, type FieldAiParams, createAiPlugin, withDynamicConfig };
package/dist/index.d.ts CHANGED
@@ -122,14 +122,23 @@ type AddOperation = {
122
122
  type: string;
123
123
  props: object;
124
124
  };
125
+ /**
126
+ * Streamed string tails keyed by prop path (e.g. `html`, `cta.label`,
127
+ * `items[2].title`). Each tail is appended to the value currently at that
128
+ * path. A top-level prop is carried either in `props` (full replacement) or
129
+ * in `appends` — never both — so applying them can't double-append.
130
+ */
131
+ type StringAppends = Record<string, string>;
125
132
  type UpdateOperation = {
126
133
  op: "update";
127
134
  id: string;
128
135
  props: object;
136
+ appends?: StringAppends;
129
137
  };
130
138
  type UpdateRootOperation = {
131
139
  op: "updateRoot";
132
140
  props: object;
141
+ appends?: StringAppends;
133
142
  };
134
143
  type MoveOperation = {
135
144
  op: "move";
@@ -229,6 +238,7 @@ type PuckProviderMetadata = {
229
238
 
230
239
  type PuckMessage = UIMessage<PuckProviderMetadata, PuckDataParts>;
231
240
 
241
+ type Mode = "assembly" | "design";
232
242
  type RequestOptions = {
233
243
  body?: {
234
244
  chatId?: string;
@@ -236,6 +246,7 @@ type RequestOptions = {
236
246
  messages?: PuckMessage[];
237
247
  pageData?: Data;
238
248
  config?: Config;
249
+ mode?: Mode;
239
250
  [key: string]: any;
240
251
  };
241
252
  headers?: HeadersInit;
@@ -263,6 +274,10 @@ type AiPluginProps = {
263
274
  };
264
275
  scrollTracking?: boolean;
265
276
  prepareRequest?: (opts: RequestOptions) => RequestOptions | Promise<RequestOptions>;
277
+ designMode?: boolean | {
278
+ visible?: boolean;
279
+ };
280
+ defaultMode?: "assembly" | "design";
266
281
  };
267
282
  declare global {
268
283
  interface Window {
@@ -275,6 +290,7 @@ declare global {
275
290
  }
276
291
  }
277
292
 
293
+ declare function withDynamicConfig(config: Config, data: Data): Config;
278
294
  declare function createAiPlugin(opts?: AiPluginProps): {
279
295
  label: string;
280
296
  name: string;
@@ -282,10 +298,13 @@ declare function createAiPlugin(opts?: AiPluginProps): {
282
298
  icon: react_jsx_runtime.JSX.Element;
283
299
  mobilePanelHeight: "min-content";
284
300
  overrides: {
301
+ drawer: ({ children }: {
302
+ children: react.ReactNode;
303
+ }) => react_jsx_runtime.JSX.Element;
285
304
  preview: ({ children }: {
286
305
  children: react.ReactNode;
287
306
  }) => react_jsx_runtime.JSX.Element;
288
307
  };
289
308
  };
290
309
 
291
- export { type ComponentAiParams, type FieldAiParams, createAiPlugin };
310
+ export { type ComponentAiParams, type FieldAiParams, createAiPlugin, withDynamicConfig };