@bettercms-ai/types 1.53.0 → 1.54.0

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.d.ts CHANGED
@@ -4180,8 +4180,11 @@ declare function schemaHashInput(table: SchemaHashTable, def: Readonly<Record<st
4180
4180
 
4181
4181
  /** The always-on inline marks, Lexical-era names kept as written (richtext ALWAYS_ON_FEATURES). */
4182
4182
  declare const RICHTEXT_MARK_FEATURES: readonly ["bold", "italic", "underline", "strikethrough", "code", "highlight"];
4183
- /** The toggleable capabilities stored configs already name, in their order (richtext TOGGLEABLE_FEATURES). */
4184
- declare const RICHTEXT_TOGGLE_FEATURES: readonly ["headings", "blockquote", "horizontalRule", "orderedList", "unorderedList", "checklist", "link", "internalLink", "inlineImage", "videoEmbed", "codeBlock", "table", "columns"];
4183
+ /**
4184
+ * The toggleable capabilities stored configs already name, in their order (richtext
4185
+ * TOGGLEABLE_FEATURES), minus `headings`: that one is an alias for the six levels, not a feature.
4186
+ */
4187
+ declare const RICHTEXT_TOGGLE_FEATURES: readonly ["blockquote", "horizontalRule", "orderedList", "unorderedList", "checklist", "link", "internalLink", "inlineImage", "videoEmbed", "codeBlock", "table", "columns"];
4185
4188
  /** One feature per heading level, so a field can allow h2 and h3 without h1. */
4186
4189
  declare const RICHTEXT_HEADING_FEATURES: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
4187
4190
  /**
@@ -4190,8 +4193,11 @@ declare const RICHTEXT_HEADING_FEATURES: readonly ["h1", "h2", "h3", "h4", "h5",
4190
4193
  * `videoEmbed` stays the video, so a field can take a video without taking an X post.
4191
4194
  */
4192
4195
  declare const RICHTEXT_BLOCK_FEATURES: readonly ["gallery", "embed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
4193
- /** Every name a stored config may carry, in vocabulary order. */
4194
- declare const RICHTEXT_FEATURES: readonly ["bold", "italic", "underline", "strikethrough", "code", "highlight", "headings", "blockquote", "horizontalRule", "orderedList", "unorderedList", "checklist", "link", "internalLink", "inlineImage", "videoEmbed", "codeBlock", "table", "columns", "h1", "h2", "h3", "h4", "h5", "h6", "gallery", "embed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
4196
+ /**
4197
+ * The canonical features, in vocabulary order: what a normalised config holds and the full set
4198
+ * a field can be given. An alias (`headings`) is a name a config may carry but never a feature.
4199
+ */
4200
+ declare const RICHTEXT_FEATURES: readonly ["bold", "italic", "underline", "strikethrough", "code", "highlight", "blockquote", "horizontalRule", "orderedList", "unorderedList", "checklist", "link", "internalLink", "inlineImage", "videoEmbed", "codeBlock", "table", "columns", "h1", "h2", "h3", "h4", "h5", "h6", "gallery", "embed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
4195
4201
  type RichTextFeature = (typeof RICHTEXT_FEATURES)[number];
4196
4202
  /**
4197
4203
  * Legacy names → the canonical features they mean. A read expands them, and a write stores the
@@ -4200,10 +4206,10 @@ type RichTextFeature = (typeof RICHTEXT_FEATURES)[number];
4200
4206
  */
4201
4207
  declare const RICHTEXT_FEATURE_ALIASES: Record<string, readonly RichTextFeature[]>;
4202
4208
  /**
4203
- * A stored or submitted feature list in canonical form: aliases expanded (and never returned),
4204
- * duplicates dropped, VOCABULARY order, so two lists that mean the same thing are equal arrays.
4205
- * `unknown` keeps each name the vocabulary does not hold, as written and once, so a reader can
4206
- * log it and a writer can refuse it by name (`richtext.feature_unknown:<name>`).
4209
+ * A stored or submitted feature list in canonical form: aliases expanded, duplicates dropped,
4210
+ * VOCABULARY order, so two lists that mean the same thing are equal arrays (and RICHTEXT_FEATURES
4211
+ * is its own normal form). `unknown` keeps each name that is neither a feature nor an alias, as
4212
+ * written and once, so a reader can log it and a writer can refuse it (`richtext.feature_unknown:<name>`).
4207
4213
  */
4208
4214
  declare function normaliseRichTextFeatures(names: readonly string[]): {
4209
4215
  features: RichTextFeature[];
package/dist/index.js CHANGED
@@ -4723,7 +4723,6 @@ function schemaHashInput(table, def) {
4723
4723
  // src/richtext-features.ts
4724
4724
  var RICHTEXT_MARK_FEATURES = ["bold", "italic", "underline", "strikethrough", "code", "highlight"];
4725
4725
  var RICHTEXT_TOGGLE_FEATURES = [
4726
- "headings",
4727
4726
  "blockquote",
4728
4727
  "horizontalRule",
4729
4728
  "orderedList",
@@ -4757,16 +4756,15 @@ var RICHTEXT_FEATURE_ALIASES = {
4757
4756
  headings: RICHTEXT_HEADING_FEATURES
4758
4757
  };
4759
4758
  var KNOWN = new Set(RICHTEXT_FEATURES);
4760
- var isAlias = (name) => Object.hasOwn(RICHTEXT_FEATURE_ALIASES, name);
4761
4759
  function normaliseRichTextFeatures(names) {
4762
4760
  const want = /* @__PURE__ */ new Set();
4763
4761
  const unknown = [];
4764
4762
  for (const name of names) {
4765
- if (isAlias(name)) for (const f of RICHTEXT_FEATURE_ALIASES[name]) want.add(f);
4763
+ if (Object.hasOwn(RICHTEXT_FEATURE_ALIASES, name)) for (const f of RICHTEXT_FEATURE_ALIASES[name]) want.add(f);
4766
4764
  else if (KNOWN.has(name)) want.add(name);
4767
4765
  else if (!unknown.includes(name)) unknown.push(name);
4768
4766
  }
4769
- return { features: RICHTEXT_FEATURES.filter((f) => want.has(f) && !isAlias(f)), unknown };
4767
+ return { features: RICHTEXT_FEATURES.filter((f) => want.has(f)), unknown };
4770
4768
  }
4771
4769
  var RICHTEXT_CORE_ELEMENTS = [
4772
4770
  "p",