@bettercms-ai/kit 4.0.0 → 4.1.1

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.
Files changed (125) hide show
  1. package/dist/adapters/lossy.d.ts +4 -0
  2. package/dist/adapters/lossy.js +4 -0
  3. package/dist/adapters/lossy.js.map +1 -1
  4. package/dist/adapters/prod-types.d.ts +4 -0
  5. package/dist/adapters/prod-types.js +4 -1
  6. package/dist/adapters/prod-types.js.map +1 -1
  7. package/dist/adapters/schema.js +7 -0
  8. package/dist/adapters/schema.js.map +1 -1
  9. package/dist/context.d.ts +83 -0
  10. package/dist/context.js +58 -1
  11. package/dist/context.js.map +1 -1
  12. package/dist/controls/choice.d.ts +1 -1
  13. package/dist/controls/choice.js +21 -2
  14. package/dist/controls/choice.js.map +1 -1
  15. package/dist/controls/index.d.ts +1 -0
  16. package/dist/controls/index.js +3 -2
  17. package/dist/controls/index.js.map +1 -1
  18. package/dist/controls/link.d.ts +23 -2
  19. package/dist/controls/link.js +456 -4
  20. package/dist/controls/link.js.map +1 -1
  21. package/dist/controls/media-v16.d.ts +27 -0
  22. package/dist/controls/media-v16.js +261 -0
  23. package/dist/controls/media-v16.js.map +1 -0
  24. package/dist/controls/media.js +63 -1
  25. package/dist/controls/media.js.map +1 -1
  26. package/dist/controls/reference-services.d.ts +8 -0
  27. package/dist/controls/reference.js +78 -2
  28. package/dist/controls/reference.js.map +1 -1
  29. package/dist/controls/rich-text/ai-runs.d.ts +13 -0
  30. package/dist/controls/rich-text/ai-runs.js +71 -0
  31. package/dist/controls/rich-text/ai-runs.js.map +1 -0
  32. package/dist/controls/rich-text/block-tool.d.ts +31 -0
  33. package/dist/controls/rich-text/block-tool.js +62 -0
  34. package/dist/controls/rich-text/block-tool.js.map +1 -0
  35. package/dist/controls/rich-text/blocks.d.ts +6 -1
  36. package/dist/controls/rich-text/blocks.js +404 -24
  37. package/dist/controls/rich-text/blocks.js.map +1 -1
  38. package/dist/controls/rich-text/catalog.d.ts +21 -6
  39. package/dist/controls/rich-text/catalog.js +312 -23
  40. package/dist/controls/rich-text/catalog.js.map +1 -1
  41. package/dist/controls/rich-text/code-head.d.ts +30 -0
  42. package/dist/controls/rich-text/code-head.js +230 -0
  43. package/dist/controls/rich-text/code-head.js.map +1 -0
  44. package/dist/controls/rich-text/codec.d.ts +1 -1
  45. package/dist/controls/rich-text/codec.js +3 -1
  46. package/dist/controls/rich-text/codec.js.map +1 -1
  47. package/dist/controls/rich-text/dom.d.ts +27 -0
  48. package/dist/controls/rich-text/dom.js +69 -4
  49. package/dist/controls/rich-text/dom.js.map +1 -1
  50. package/dist/controls/rich-text/editor.js +212 -50
  51. package/dist/controls/rich-text/editor.js.map +1 -1
  52. package/dist/controls/rich-text/ops.js +1 -0
  53. package/dist/controls/rich-text/ops.js.map +1 -1
  54. package/dist/controls/rich-text/slash-preview.d.ts +8 -0
  55. package/dist/controls/rich-text/slash-preview.js +287 -0
  56. package/dist/controls/rich-text/slash-preview.js.map +1 -0
  57. package/dist/controls/rich-text/table-grid.d.ts +22 -0
  58. package/dist/controls/rich-text/table-grid.js +1052 -0
  59. package/dist/controls/rich-text/table-grid.js.map +1 -0
  60. package/dist/controls/rich-text/toolbar.js +60 -18
  61. package/dist/controls/rich-text/toolbar.js.map +1 -1
  62. package/dist/controls/text.d.ts +6 -0
  63. package/dist/controls/text.js +95 -5
  64. package/dist/controls/text.js.map +1 -1
  65. package/dist/core/facets.d.ts +1 -0
  66. package/dist/core/facets.js +1 -0
  67. package/dist/core/facets.js.map +1 -1
  68. package/dist/engine/array.d.ts +7 -0
  69. package/dist/engine/array.js +164 -45
  70. package/dist/engine/array.js.map +1 -1
  71. package/dist/engine/field-shell.d.ts +12 -0
  72. package/dist/engine/field-shell.js +217 -63
  73. package/dist/engine/field-shell.js.map +1 -1
  74. package/dist/engine/frame.js +39 -2
  75. package/dist/engine/frame.js.map +1 -1
  76. package/dist/engine/grouping.d.ts +71 -10
  77. package/dist/engine/grouping.js +223 -26
  78. package/dist/engine/grouping.js.map +1 -1
  79. package/dist/engine/kit-field.js +38 -4
  80. package/dist/engine/kit-field.js.map +1 -1
  81. package/dist/engine/schema-form.js +7 -2
  82. package/dist/engine/schema-form.js.map +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +13 -6
  85. package/dist/index.js.map +1 -1
  86. package/dist/kit.css +85 -0
  87. package/dist/schema/table.d.ts +2 -1
  88. package/dist/schema/table.js +5 -0
  89. package/dist/schema/table.js.map +1 -1
  90. package/dist/schema/types.d.ts +6 -0
  91. package/dist/schema/types.js.map +1 -1
  92. package/dist/styles.css +1 -1
  93. package/dist/theme.css +115 -0
  94. package/dist/tokens.css +268 -0
  95. package/dist/ui/block-icon-picker.d.ts +38 -0
  96. package/dist/ui/block-icon-picker.js +141 -0
  97. package/dist/ui/block-icon-picker.js.map +1 -0
  98. package/dist/ui/button.js +1 -0
  99. package/dist/ui/button.js.map +1 -1
  100. package/dist/ui/code-language-menu.d.ts +24 -0
  101. package/dist/ui/code-language-menu.js +123 -0
  102. package/dist/ui/code-language-menu.js.map +1 -0
  103. package/dist/ui/content-fields.d.ts +47 -0
  104. package/dist/ui/content-fields.js +278 -0
  105. package/dist/ui/content-fields.js.map +1 -0
  106. package/dist/ui/foundations.d.ts +118 -0
  107. package/dist/ui/foundations.js +564 -0
  108. package/dist/ui/foundations.js.map +1 -0
  109. package/dist/ui/index.d.ts +6 -0
  110. package/dist/ui/index.js +7 -1
  111. package/dist/ui/inspector.d.ts +394 -0
  112. package/dist/ui/inspector.js +1173 -0
  113. package/dist/ui/inspector.js.map +1 -0
  114. package/dist/ui/overlay.d.ts +7 -2
  115. package/dist/ui/overlay.js +55 -20
  116. package/dist/ui/overlay.js.map +1 -1
  117. package/dist/ui/shortcut-hint.js +1 -1
  118. package/dist/ui/shortcut-hint.js.map +1 -1
  119. package/dist/ui/toast.d.ts +5 -3
  120. package/dist/ui/toast.js +83 -11
  121. package/dist/ui/toast.js.map +1 -1
  122. package/dist/ui/tooltip-card.d.ts +45 -0
  123. package/dist/ui/tooltip-card.js +135 -0
  124. package/dist/ui/tooltip-card.js.map +1 -0
  125. package/package.json +1 -1
@@ -38,6 +38,10 @@
38
38
  * `data-detached="true" data-props data-blocks data-source-published-at`, and carries no overrides.
39
39
  * "Show on site" is {visible} (`data-visible`): false keeps the place in the body and off the published
40
40
  * page; absent reads as shown.
41
+ * stats prototype editor-v16 Stats (content.jsx:194, 1162-1163, content.css:348-352, 585): a row of cards, each
42
+ * {label, value, note}, in 2-4 columns, outlined or filled: `<div data-rt="stats" data-cols data-style>
43
+ * <div data-stat><small>…</small><b>…</b><span>…</span></div>…` (feature "stats"; the host stores it as
44
+ * `bcmsBlock` builtin:stats {columns, style, items}, REQ-KIT-1).
41
45
  * A key the stored block holds is an attribute or element that is present; a key it lacks is absent, so an untouched
42
46
  * block reads back exactly as stored.
43
47
  * V2's gallery, columns, footnotes, contents, related posts and author bio have no stored form in production and are
@@ -111,8 +115,15 @@ export interface CalloutModel {
111
115
  title?: string;
112
116
  /** plain text: paragraphs split by a blank line, line breaks kept */
113
117
  body?: string;
118
+ /** look v16 (prototype content.jsx:1183): "No icon" stores `data-icon="none"`; absent = the tone's icon (REQ-KIT-1) */
119
+ icon?: "none";
114
120
  extra?: string;
115
121
  }
122
+ /** look v16 (prototype content.jsx:1164): Note (stored "note"), Info, Tip, Warning */
123
+ export declare const V16_CALLOUT_TONES: readonly {
124
+ tone: string;
125
+ label: string;
126
+ }[];
116
127
  export interface ToggleModel {
117
128
  title?: string;
118
129
  body?: string;
@@ -217,6 +228,21 @@ export interface ComponentModel {
217
228
  visible?: boolean;
218
229
  extra?: string;
219
230
  }
231
+ /** Prototype editor-v16 Stats block: cards of {label, value, note}; 3 columns and outlined when absent. */
232
+ export interface StatsModel {
233
+ cols?: 2 | 3 | 4;
234
+ style?: "outlined" | "filled";
235
+ /** `_key` is the editor's own */
236
+ items: {
237
+ _key: string;
238
+ label: string;
239
+ value: string;
240
+ note: string;
241
+ }[];
242
+ extra?: string;
243
+ }
244
+ /** content.jsx:194: a new card reads "Label / 0 / What it measures" */
245
+ export declare const newStat: () => StatsModel["items"][number];
220
246
  export interface IslandModels {
221
247
  image: ImageModel;
222
248
  table: TableModel;
@@ -233,6 +259,7 @@ export interface IslandModels {
233
259
  columns: ColumnsIslandModel;
234
260
  author: AuthorIslandModel;
235
261
  related: RelatedIslandModel;
262
+ stats: StatsModel;
236
263
  }
237
264
  export type IslandKind = keyof IslandModels;
238
265
  export declare const ISLAND_KINDS: IslandKind[];
@@ -40,6 +40,10 @@ import { boolLabels, cellText, cellValue, emptyTable, formatNumber, isCellObject
40
40
  * `data-detached="true" data-props data-blocks data-source-published-at`, and carries no overrides.
41
41
  * "Show on site" is {visible} (`data-visible`): false keeps the place in the body and off the published
42
42
  * page; absent reads as shown.
43
+ * stats prototype editor-v16 Stats (content.jsx:194, 1162-1163, content.css:348-352, 585): a row of cards, each
44
+ * {label, value, note}, in 2-4 columns, outlined or filled: `<div data-rt="stats" data-cols data-style>
45
+ * <div data-stat><small>…</small><b>…</b><span>…</span></div>…` (feature "stats"; the host stores it as
46
+ * `bcmsBlock` builtin:stats {columns, style, items}, REQ-KIT-1).
43
47
  * A key the stored block holds is an attribute or element that is present; a key it lacks is absent, so an untouched
44
48
  * block reads back exactly as stored.
45
49
  * V2's gallery, columns, footnotes, contents, related posts and author bio have no stored form in production and are
@@ -98,6 +102,25 @@ var CALLOUT_TONES = [
98
102
  "tip",
99
103
  "warning"
100
104
  ];
105
+ /** look v16 (prototype content.jsx:1164): Note (stored "note"), Info, Tip, Warning */
106
+ var V16_CALLOUT_TONES = [
107
+ {
108
+ tone: "note",
109
+ label: "Note"
110
+ },
111
+ {
112
+ tone: "info",
113
+ label: "Info"
114
+ },
115
+ {
116
+ tone: "tip",
117
+ label: "Tip"
118
+ },
119
+ {
120
+ tone: "warning",
121
+ label: "Warning"
122
+ }
123
+ ];
101
124
  var EMBED_ASPECT_VALUES = [
102
125
  "16:9",
103
126
  "4:3",
@@ -176,6 +199,13 @@ function detectEmbed(url) {
176
199
  host
177
200
  };
178
201
  }
202
+ /** content.jsx:194: a new card reads "Label / 0 / What it measures" */
203
+ var newStat = () => ({
204
+ _key: rid("st"),
205
+ label: "Label",
206
+ value: "0",
207
+ note: "What it measures"
208
+ });
179
209
  var ISLAND_KINDS = [
180
210
  "image",
181
211
  "table",
@@ -191,7 +221,8 @@ var ISLAND_KINDS = [
191
221
  "toc",
192
222
  "columns",
193
223
  "author",
194
- "related"
224
+ "related",
225
+ "stats"
195
226
  ];
196
227
  function defaultModel(kind, extra) {
197
228
  const base = {
@@ -258,7 +289,15 @@ function defaultModel(kind, extra) {
258
289
  mode: "topic",
259
290
  count: 3,
260
291
  posts: []
261
- })
292
+ }),
293
+ stats: () => ({ items: [
294
+ {
295
+ ...newStat(),
296
+ value: "0%"
297
+ },
298
+ newStat(),
299
+ newStat()
300
+ ] })
262
301
  };
263
302
  if (kind === "table") return {
264
303
  ...base.table(),
@@ -318,7 +357,7 @@ function renderStatic(kind, model) {
318
357
  const m = model;
319
358
  const title = m.title !== void 0 ? `<p data-title="true">${esc(m.title)}</p>` : "";
320
359
  const body = m.body !== void 0 ? `<div data-body="true">${textToParas(m.body)}</div>` : "";
321
- return `<div data-rt="callout"${attr("data-callout", m.tone)}${xAttr(m.extra)}>${title}${body}</div>`;
360
+ return `<div data-rt="callout"${attr("data-callout", m.tone)}${attr("data-icon", m.icon)}${xAttr(m.extra)}>${title}${body}</div>`;
322
361
  }
323
362
  case "toggle": {
324
363
  const m = model;
@@ -356,6 +395,11 @@ function renderStatic(kind, model) {
356
395
  const m = model;
357
396
  return `<aside data-rt="related"${attr("data-mode", m.mode)}${attr("data-count", m.count)} data-posts="${escAttr(m.posts.join(","))}"${xAttr(m.extra)}>${m.title ? `<p data-title>${esc(m.title)}</p>` : ""}</aside>`;
358
397
  }
398
+ case "stats": {
399
+ const m = model;
400
+ const card = (c) => `<div data-stat="true"><small>${esc(c.label)}</small><b>${esc(c.value)}</b><span>${esc(c.note)}</span></div>`;
401
+ return `<div data-rt="stats"${attr("data-cols", m.cols)}${attr("data-style", m.style)}${xAttr(m.extra)}>${m.items.map(card).join("")}</div>`;
402
+ }
359
403
  case "file": {
360
404
  const m = model;
361
405
  const link = m.url && m.name ? `<a href="${escAttr(m.url)}" download>${esc(m.name)}</a>` : "";
@@ -877,6 +921,7 @@ function parseIsland(kind, el) {
877
921
  const m = {};
878
922
  const tone = attrOf(el, "data-callout");
879
923
  if (tone !== void 0) m.tone = tone;
924
+ if (attrOf(el, "data-icon") === "none") m.icon = "none";
880
925
  if (title) m.title = (title.textContent ?? "").replace(/\u200b/g, "");
881
926
  if (body) m.body = parasToText(body);
882
927
  const extra = attrOf(el, "data-extra");
@@ -979,6 +1024,23 @@ function parseIsland(kind, el) {
979
1024
  if (extra) m.extra = extra;
980
1025
  return m;
981
1026
  }
1027
+ case "stats": {
1028
+ const text = (n) => (n?.textContent ?? "").replace(/\u200b/g, "").replace(/\s+/g, " ").trim();
1029
+ const items = Array.from(el.querySelectorAll(":scope > [data-stat]")).map((c) => ({
1030
+ _key: rid("st"),
1031
+ label: text(c.querySelector(":scope > small")),
1032
+ value: text(c.querySelector(":scope > b")),
1033
+ note: text(c.querySelector(":scope > span"))
1034
+ }));
1035
+ const m = { items: items.length ? items : [newStat()] };
1036
+ const cols = Number(attrOf(el, "data-cols"));
1037
+ if (cols === 2 || cols === 3 || cols === 4) m.cols = cols;
1038
+ const style = attrOf(el, "data-style");
1039
+ if (style === "outlined" || style === "filled") m.style = style;
1040
+ const extra = attrOf(el, "data-extra");
1041
+ if (extra) m.extra = extra;
1042
+ return m;
1043
+ }
982
1044
  case "file": {
983
1045
  const m = {};
984
1046
  const url = attrOf(el, "data-url");
@@ -1090,6 +1152,9 @@ function serialize(root) {
1090
1152
  c.replaceWith(tpl.content);
1091
1153
  });
1092
1154
  clone.querySelectorAll("[data-hint]").forEach((n) => n.removeAttribute("data-hint"));
1155
+ clone.querySelectorAll("[data-rt-wrap]").forEach((n) => n.removeAttribute("data-rt-wrap"));
1156
+ clone.querySelectorAll("span[data-rt-hl]").forEach((n) => n.replaceWith(n.textContent ?? ""));
1157
+ clone.querySelectorAll("pre").forEach((n) => n.normalize());
1093
1158
  clone.querySelectorAll("ul[data-task] > li").forEach((li) => (li.removeAttribute("role"), li.removeAttribute("aria-checked")));
1094
1159
  while (clone.children.length > 1 && clone.lastElementChild && isEmptyP(clone.lastElementChild)) clone.lastElementChild.remove();
1095
1160
  const html = clone.innerHTML.replace(/​/g, "");
@@ -1185,6 +1250,6 @@ function ownsMenu(menu, roots) {
1185
1250
  }
1186
1251
  var isEmptyHtml = (html) => !html.replace(/<(?!img|hr|figure|table|details|div data-rt)[^>]*>/g, "").replace(/&nbsp;/g, "").trim();
1187
1252
  //#endregion
1188
- export { CALLOUT_TONES, IMAGE_ALIGNS, IMAGE_SIZES, ISLAND_KINDS, STORED_COLUMN_TYPES, TEXT_BLOCKS, cloneModel, closestBlock, colAttrs, colSettingsOf, columnSettings, createIsland, defaultModel, detectEmbed, detectKind, editingHost, editorRoundTrip, esc, escAttr, hydrate, isEmptyHtml, isValueType, ownsMenu, parasToText, parseIsland, parseStoredTable, placeCaret, rangeRect, readImageFrame, renderStatic, renderStoredTable, rid, sanitize, serialize, textBeforeCaret, textToParas, topBlock, typeAttrOf, typedCellView, typedValueOf, typedWords };
1253
+ export { CALLOUT_TONES, IMAGE_ALIGNS, IMAGE_SIZES, ISLAND_KINDS, STORED_COLUMN_TYPES, TEXT_BLOCKS, V16_CALLOUT_TONES, cloneModel, closestBlock, colAttrs, colSettingsOf, columnSettings, createIsland, defaultModel, detectEmbed, detectKind, editingHost, editorRoundTrip, esc, escAttr, hydrate, isEmptyHtml, isValueType, newStat, ownsMenu, parasToText, parseIsland, parseStoredTable, placeCaret, rangeRect, readImageFrame, renderStatic, renderStoredTable, rid, sanitize, serialize, textBeforeCaret, textToParas, topBlock, typeAttrOf, typedCellView, typedValueOf, typedWords };
1189
1254
 
1190
1255
  //# sourceMappingURL=dom.js.map