@puckeditor/plugin-ai 0.8.3-canary.def86203 → 0.8.3-canary.dffec47d

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
@@ -4180,25 +4180,19 @@ function getRequestComponentConfigs(data) {
4180
4180
  }
4181
4181
  return components;
4182
4182
  }
4183
- function syncComponentList(getPuck, add, remove) {
4183
+ function syncDesignedComponentsCategory(getPuck, designedComponents, hadRemovals) {
4184
4184
  const { appState, dispatch } = getPuck();
4185
4185
  const componentList = { ...appState.ui.componentList };
4186
4186
  const existing = componentList[DESIGNED_CATEGORY];
4187
4187
  const current = existing?.components ?? [];
4188
- const removeSet = new Set(remove);
4189
- const newNames = add.filter((name) => !current.includes(name));
4190
- const hasRemovals = current.some((name) => removeSet.has(name));
4191
- if (newNames.length === 0 && !hasRemovals) return;
4192
- const components = [
4193
- ...current.filter((name) => !removeSet.has(name)),
4194
- ...newNames
4195
- ];
4188
+ const unchanged = current.length === designedComponents.length && current.every((name, i) => name === designedComponents[i]);
4189
+ if (unchanged && !hadRemovals) return;
4196
4190
  componentList[DESIGNED_CATEGORY] = {
4197
4191
  title: "Generated",
4198
4192
  expanded: true,
4199
4193
  ...existing,
4200
- components,
4201
- visible: components.length > 0
4194
+ components: designedComponents,
4195
+ visible: designedComponents.length > 0
4202
4196
  };
4203
4197
  dispatch({ type: "setUi", ui: { componentList } });
4204
4198
  }
@@ -4212,12 +4206,10 @@ function syncDesignComponents(getPuck) {
4212
4206
  }
4213
4207
  let createdSettled = ensureDesignGlobalsRoot(config);
4214
4208
  ensureDynamicConfigField(config);
4215
- const settledNames = [];
4216
4209
  for (const [name, persistedReg] of Object.entries(persisted)) {
4217
4210
  const prev = lastSynced.get(name);
4218
4211
  if (registrationStore.has(name) && (prev === persistedReg || registrationContentEqual(prev, persistedReg))) {
4219
4212
  lastSynced.set(name, persistedReg);
4220
- if (!persistedReg.streaming) settledNames.push(name);
4221
4213
  continue;
4222
4214
  }
4223
4215
  lastSynced.set(name, persistedReg);
@@ -4241,23 +4233,23 @@ function syncDesignComponents(getPuck) {
4241
4233
  }
4242
4234
  }
4243
4235
  config.components[name].fields = getSlotFields(registration.html ?? "");
4244
- if (isSettled) settledNames.push(name);
4245
4236
  }
4246
- const removedNames = [];
4237
+ let hasRemovals = false;
4247
4238
  for (const [name] of registrationStore.getAll()) {
4248
4239
  if (!(name in persisted)) {
4249
4240
  registrationStore.delete(name);
4250
4241
  lastSynced.delete(name);
4251
4242
  delete config.components[name];
4252
- removedNames.push(name);
4243
+ hasRemovals = true;
4253
4244
  }
4254
4245
  }
4255
4246
  if (createdSettled) {
4256
4247
  dispatch({ type: "setData", data: appState.data, recordHistory: false });
4257
4248
  }
4258
- if (settledNames.length > 0 || removedNames.length > 0) {
4259
- syncComponentList(getPuck, settledNames, removedNames);
4260
- }
4249
+ const designedComponents = Object.keys(persisted).filter(
4250
+ (name) => name in config.components
4251
+ );
4252
+ syncDesignedComponentsCategory(getPuck, designedComponents, hasRemovals);
4261
4253
  }
4262
4254
  function deleteDesignComponent(getPuck, name) {
4263
4255
  const { appState, config, dispatch } = getPuck();
@@ -4373,7 +4365,7 @@ var import_jsx_runtime35 = require("react/jsx-runtime");
4373
4365
  var q = (0, import_qler.default)();
4374
4366
  var DEFAULT_API_VERSION = "v2";
4375
4367
  var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
4376
- var PLUGIN_AI_VERSION = true ? "0.8.3-canary.def86203" : "unknown";
4368
+ var PLUGIN_AI_VERSION = true ? "0.8.3-canary.dffec47d" : "unknown";
4377
4369
  var BENCHMARK = false;
4378
4370
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
4379
4371
  var getClassName18 = getClassNameFactory("Chat", styles_module_default);
package/dist/index.mjs CHANGED
@@ -4212,25 +4212,19 @@ function getRequestComponentConfigs(data) {
4212
4212
  }
4213
4213
  return components;
4214
4214
  }
4215
- function syncComponentList(getPuck, add, remove) {
4215
+ function syncDesignedComponentsCategory(getPuck, designedComponents, hadRemovals) {
4216
4216
  const { appState, dispatch } = getPuck();
4217
4217
  const componentList = { ...appState.ui.componentList };
4218
4218
  const existing = componentList[DESIGNED_CATEGORY];
4219
4219
  const current = existing?.components ?? [];
4220
- const removeSet = new Set(remove);
4221
- const newNames = add.filter((name) => !current.includes(name));
4222
- const hasRemovals = current.some((name) => removeSet.has(name));
4223
- if (newNames.length === 0 && !hasRemovals) return;
4224
- const components = [
4225
- ...current.filter((name) => !removeSet.has(name)),
4226
- ...newNames
4227
- ];
4220
+ const unchanged = current.length === designedComponents.length && current.every((name, i) => name === designedComponents[i]);
4221
+ if (unchanged && !hadRemovals) return;
4228
4222
  componentList[DESIGNED_CATEGORY] = {
4229
4223
  title: "Generated",
4230
4224
  expanded: true,
4231
4225
  ...existing,
4232
- components,
4233
- visible: components.length > 0
4226
+ components: designedComponents,
4227
+ visible: designedComponents.length > 0
4234
4228
  };
4235
4229
  dispatch({ type: "setUi", ui: { componentList } });
4236
4230
  }
@@ -4244,12 +4238,10 @@ function syncDesignComponents(getPuck) {
4244
4238
  }
4245
4239
  let createdSettled = ensureDesignGlobalsRoot(config);
4246
4240
  ensureDynamicConfigField(config);
4247
- const settledNames = [];
4248
4241
  for (const [name, persistedReg] of Object.entries(persisted)) {
4249
4242
  const prev = lastSynced.get(name);
4250
4243
  if (registrationStore.has(name) && (prev === persistedReg || registrationContentEqual(prev, persistedReg))) {
4251
4244
  lastSynced.set(name, persistedReg);
4252
- if (!persistedReg.streaming) settledNames.push(name);
4253
4245
  continue;
4254
4246
  }
4255
4247
  lastSynced.set(name, persistedReg);
@@ -4273,23 +4265,23 @@ function syncDesignComponents(getPuck) {
4273
4265
  }
4274
4266
  }
4275
4267
  config.components[name].fields = getSlotFields(registration.html ?? "");
4276
- if (isSettled) settledNames.push(name);
4277
4268
  }
4278
- const removedNames = [];
4269
+ let hasRemovals = false;
4279
4270
  for (const [name] of registrationStore.getAll()) {
4280
4271
  if (!(name in persisted)) {
4281
4272
  registrationStore.delete(name);
4282
4273
  lastSynced.delete(name);
4283
4274
  delete config.components[name];
4284
- removedNames.push(name);
4275
+ hasRemovals = true;
4285
4276
  }
4286
4277
  }
4287
4278
  if (createdSettled) {
4288
4279
  dispatch({ type: "setData", data: appState.data, recordHistory: false });
4289
4280
  }
4290
- if (settledNames.length > 0 || removedNames.length > 0) {
4291
- syncComponentList(getPuck, settledNames, removedNames);
4292
- }
4281
+ const designedComponents = Object.keys(persisted).filter(
4282
+ (name) => name in config.components
4283
+ );
4284
+ syncDesignedComponentsCategory(getPuck, designedComponents, hasRemovals);
4293
4285
  }
4294
4286
  function deleteDesignComponent(getPuck, name) {
4295
4287
  const { appState, config, dispatch } = getPuck();
@@ -4405,7 +4397,7 @@ import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs20 } from "react/jsx-r
4405
4397
  var q = qler();
4406
4398
  var DEFAULT_API_VERSION = "v2";
4407
4399
  var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
4408
- var PLUGIN_AI_VERSION = true ? "0.8.3-canary.def86203" : "unknown";
4400
+ var PLUGIN_AI_VERSION = true ? "0.8.3-canary.dffec47d" : "unknown";
4409
4401
  var BENCHMARK = false;
4410
4402
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
4411
4403
  var getClassName18 = getClassNameFactory("Chat", styles_module_default);
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@puckeditor/plugin-ai",
3
- "version": "0.8.3-canary.def86203",
3
+ "version": "0.8.3-canary.dffec47d",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
- "repository": "puckeditor/puck",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "puckeditor/puck"
8
+ },
6
9
  "bugs": "https://github.com/puckeditor/puck/issues",
7
10
  "homepage": "https://puckeditor.com",
8
11
  "keywords": [
@@ -49,12 +52,12 @@
49
52
  "tsup": "^8.2.4",
50
53
  "typescript": "^5.5.4",
51
54
  "vitest": "^4.1.0",
52
- "@puckeditor/platform-types": "0.8.3-canary.def86203",
53
- "eslint-config-custom": "0.8.3-canary.def86203",
54
- "@puckeditor/ai-types": "0.8.3-canary.def86203",
55
- "reducer": "0.8.3-canary.def86203",
56
- "tsconfig": "0.8.3-canary.def86203",
57
- "tsup-config": "0.8.3-canary.def86203"
55
+ "tsconfig": "0.8.3-canary.dffec47d",
56
+ "tsup-config": "0.8.3-canary.dffec47d",
57
+ "@puckeditor/platform-types": "0.8.3-canary.dffec47d",
58
+ "eslint-config-custom": "0.8.3-canary.dffec47d",
59
+ "reducer": "0.8.3-canary.dffec47d",
60
+ "@puckeditor/ai-types": "0.8.3-canary.dffec47d"
58
61
  },
59
62
  "peerDependencies": {
60
63
  "@puckeditor/core": "^0",