@puckeditor/plugin-ai 0.8.3 → 0.8.4-canary.4bdaedc6

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
@@ -3800,6 +3800,8 @@ var SlotPortal = ({
3800
3800
 
3801
3801
  // src/lib/design/component.tsx
3802
3802
  var import_jsx_runtime32 = require("react/jsx-runtime");
3803
+ var DESIGN_COMPONENT = Symbol("puck-ai.designComponent");
3804
+ var isDesignComponent = (config) => !!config?.[DESIGN_COMPONENT];
3803
3805
  var streamingValues = /* @__PURE__ */ new Map();
3804
3806
  var instanceKey = (name, instanceId) => `${name}:${typeof instanceId === "string" ? instanceId : ""}`;
3805
3807
  var getRegistrationSlotFields = (reg) => {
@@ -3824,7 +3826,7 @@ function createDesignComponentConfig(registration) {
3824
3826
  registrationStore.apply(registration);
3825
3827
  }
3826
3828
  const slotFields = getRegistrationSlotFields(registration);
3827
- return {
3829
+ const componentConfig = {
3828
3830
  ...registration.label ? { label: registration.label } : {},
3829
3831
  fields: { ...slotFields },
3830
3832
  defaultProps: { ...registration.defaultProps ?? {} },
@@ -3885,6 +3887,8 @@ function createDesignComponentConfig(registration) {
3885
3887
  },
3886
3888
  render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EditorEntry, { ...renderProps }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Entry, { ...renderProps, getPuck: null })
3887
3889
  };
3890
+ componentConfig[DESIGN_COMPONENT] = true;
3891
+ return componentConfig;
3888
3892
  function EditorEntry(renderProps) {
3889
3893
  const getPuck = (0, import_core3.useGetPuck)();
3890
3894
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Entry, { ...renderProps, getPuck });
@@ -4279,7 +4283,7 @@ function syncDesignComponents(getPuck) {
4279
4283
  ensureDynamicConfigField(config);
4280
4284
  for (const [name, persistedReg] of Object.entries(persisted)) {
4281
4285
  const prev = lastSynced.get(name);
4282
- if (registrationStore.has(name) && (prev === persistedReg || registrationContentEqual(prev, persistedReg))) {
4286
+ if (registrationStore.has(name) && config.components[name] && (prev === persistedReg || registrationContentEqual(prev, persistedReg))) {
4283
4287
  lastSynced.set(name, persistedReg);
4284
4288
  continue;
4285
4289
  }
@@ -4310,8 +4314,10 @@ function syncDesignComponents(getPuck) {
4310
4314
  if (!(name in persisted)) {
4311
4315
  registrationStore.delete(name);
4312
4316
  lastSynced.delete(name);
4313
- delete config.components[name];
4314
- hasRemovals = true;
4317
+ if (isDesignComponent(config.components[name])) {
4318
+ delete config.components[name];
4319
+ hasRemovals = true;
4320
+ }
4315
4321
  }
4316
4322
  }
4317
4323
  if (createdSettled) {
@@ -4569,7 +4575,7 @@ var q = (0, import_qler.default)();
4569
4575
  var DEFAULT_API_VERSION = "v2";
4570
4576
  var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
4571
4577
  var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
4572
- var PLUGIN_AI_VERSION = true ? "0.8.3" : "unknown";
4578
+ var PLUGIN_AI_VERSION = true ? "0.8.4-canary.4bdaedc6" : "unknown";
4573
4579
  var BENCHMARK = false;
4574
4580
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${(0, import_ulid.ulid)()}`;
4575
4581
  var getClassName18 = getClassNameFactory("Chat", styles_module_default);
package/dist/index.mjs CHANGED
@@ -3832,6 +3832,8 @@ var SlotPortal = ({
3832
3832
 
3833
3833
  // src/lib/design/component.tsx
3834
3834
  import { Fragment as Fragment7, jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
3835
+ var DESIGN_COMPONENT = Symbol("puck-ai.designComponent");
3836
+ var isDesignComponent = (config) => !!config?.[DESIGN_COMPONENT];
3835
3837
  var streamingValues = /* @__PURE__ */ new Map();
3836
3838
  var instanceKey = (name, instanceId) => `${name}:${typeof instanceId === "string" ? instanceId : ""}`;
3837
3839
  var getRegistrationSlotFields = (reg) => {
@@ -3856,7 +3858,7 @@ function createDesignComponentConfig(registration) {
3856
3858
  registrationStore.apply(registration);
3857
3859
  }
3858
3860
  const slotFields = getRegistrationSlotFields(registration);
3859
- return {
3861
+ const componentConfig = {
3860
3862
  ...registration.label ? { label: registration.label } : {},
3861
3863
  fields: { ...slotFields },
3862
3864
  defaultProps: { ...registration.defaultProps ?? {} },
@@ -3917,6 +3919,8 @@ function createDesignComponentConfig(registration) {
3917
3919
  },
3918
3920
  render: (renderProps) => renderProps.puck?.isEditing ? /* @__PURE__ */ jsx32(EditorEntry, { ...renderProps }) : /* @__PURE__ */ jsx32(Entry, { ...renderProps, getPuck: null })
3919
3921
  };
3922
+ componentConfig[DESIGN_COMPONENT] = true;
3923
+ return componentConfig;
3920
3924
  function EditorEntry(renderProps) {
3921
3925
  const getPuck = useGetPuck2();
3922
3926
  return /* @__PURE__ */ jsx32(Entry, { ...renderProps, getPuck });
@@ -4311,7 +4315,7 @@ function syncDesignComponents(getPuck) {
4311
4315
  ensureDynamicConfigField(config);
4312
4316
  for (const [name, persistedReg] of Object.entries(persisted)) {
4313
4317
  const prev = lastSynced.get(name);
4314
- if (registrationStore.has(name) && (prev === persistedReg || registrationContentEqual(prev, persistedReg))) {
4318
+ if (registrationStore.has(name) && config.components[name] && (prev === persistedReg || registrationContentEqual(prev, persistedReg))) {
4315
4319
  lastSynced.set(name, persistedReg);
4316
4320
  continue;
4317
4321
  }
@@ -4342,8 +4346,10 @@ function syncDesignComponents(getPuck) {
4342
4346
  if (!(name in persisted)) {
4343
4347
  registrationStore.delete(name);
4344
4348
  lastSynced.delete(name);
4345
- delete config.components[name];
4346
- hasRemovals = true;
4349
+ if (isDesignComponent(config.components[name])) {
4350
+ delete config.components[name];
4351
+ hasRemovals = true;
4352
+ }
4347
4353
  }
4348
4354
  }
4349
4355
  if (createdSettled) {
@@ -4601,7 +4607,7 @@ var q = qler();
4601
4607
  var DEFAULT_API_VERSION = "v2";
4602
4608
  var BUILD_OP_DEBOUNCE_MS = 1e3 / 60;
4603
4609
  var CLIENT_TOOL_ENDPOINT_UNAVAILABLE_ERROR_MESSAGE = "Unable to verify the page data. Please enable the `/chat/tool` endpoint on the server and try again.";
4604
- var PLUGIN_AI_VERSION = true ? "0.8.3" : "unknown";
4610
+ var PLUGIN_AI_VERSION = true ? "0.8.4-canary.4bdaedc6" : "unknown";
4605
4611
  var BENCHMARK = false;
4606
4612
  var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
4607
4613
  var getClassName18 = getClassNameFactory("Chat", styles_module_default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/plugin-ai",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-canary.4bdaedc6",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,13 +51,13 @@
51
51
  "react-dom": "^19.2.0",
52
52
  "tsup": "^8.2.4",
53
53
  "typescript": "^5.5.4",
54
- "vitest": "^4.1.0",
55
- "@puckeditor/ai-types": "0.8.3",
56
- "@puckeditor/platform-types": "0.8.3",
57
- "eslint-config-custom": "0.8.3",
58
- "reducer": "0.8.3",
59
- "tsconfig": "0.8.3",
60
- "tsup-config": "0.8.3"
54
+ "vitest": "^4.1.11",
55
+ "@puckeditor/ai-types": "0.8.4-canary.4bdaedc6",
56
+ "@puckeditor/platform-types": "0.8.4-canary.4bdaedc6",
57
+ "eslint-config-custom": "0.8.4-canary.4bdaedc6",
58
+ "reducer": "0.8.4-canary.4bdaedc6",
59
+ "tsconfig": "0.8.4-canary.4bdaedc6",
60
+ "tsup-config": "0.8.4-canary.4bdaedc6"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@puckeditor/core": "^0",