@bettercms-ai/kit 4.0.0 → 4.2.0-next.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.
Files changed (140) 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 +91 -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 +406 -24
  37. package/dist/controls/rich-text/blocks.js.map +1 -1
  38. package/dist/controls/rich-text/catalog.d.ts +45 -7
  39. package/dist/controls/rich-text/catalog.js +507 -37
  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 +4 -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 +77 -7
  49. package/dist/controls/rich-text/dom.js.map +1 -1
  50. package/dist/controls/rich-text/editor.js +243 -55
  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/rewriteSelection.d.ts +25 -0
  55. package/dist/controls/rich-text/rewriteSelection.js +28 -0
  56. package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
  57. package/dist/controls/rich-text/slash-preview.d.ts +8 -0
  58. package/dist/controls/rich-text/slash-preview.js +300 -0
  59. package/dist/controls/rich-text/slash-preview.js.map +1 -0
  60. package/dist/controls/rich-text/table-grid.d.ts +22 -0
  61. package/dist/controls/rich-text/table-grid.js +1057 -0
  62. package/dist/controls/rich-text/table-grid.js.map +1 -0
  63. package/dist/controls/rich-text/toolbar.js +61 -18
  64. package/dist/controls/rich-text/toolbar.js.map +1 -1
  65. package/dist/controls/text.d.ts +6 -0
  66. package/dist/controls/text.js +95 -5
  67. package/dist/controls/text.js.map +1 -1
  68. package/dist/core/facets.d.ts +1 -0
  69. package/dist/core/facets.js +1 -0
  70. package/dist/core/facets.js.map +1 -1
  71. package/dist/engine/array.d.ts +7 -0
  72. package/dist/engine/array.js +164 -45
  73. package/dist/engine/array.js.map +1 -1
  74. package/dist/engine/field-shell.d.ts +12 -0
  75. package/dist/engine/field-shell.js +222 -64
  76. package/dist/engine/field-shell.js.map +1 -1
  77. package/dist/engine/frame.js +42 -4
  78. package/dist/engine/frame.js.map +1 -1
  79. package/dist/engine/grouping.d.ts +71 -10
  80. package/dist/engine/grouping.js +227 -29
  81. package/dist/engine/grouping.js.map +1 -1
  82. package/dist/engine/item-list.js +2 -2
  83. package/dist/engine/item-list.js.map +1 -1
  84. package/dist/engine/kit-field.js +38 -4
  85. package/dist/engine/kit-field.js.map +1 -1
  86. package/dist/engine/schema-form.d.ts +2 -0
  87. package/dist/engine/schema-form.js +9 -2
  88. package/dist/engine/schema-form.js.map +1 -1
  89. package/dist/index.d.ts +1 -1
  90. package/dist/index.js +13 -6
  91. package/dist/index.js.map +1 -1
  92. package/dist/kit.css +59 -0
  93. package/dist/lib/reduced-motion.d.ts +1 -0
  94. package/dist/lib/reduced-motion.js +19 -0
  95. package/dist/lib/reduced-motion.js.map +1 -0
  96. package/dist/schema/table.d.ts +2 -1
  97. package/dist/schema/table.js +5 -0
  98. package/dist/schema/table.js.map +1 -1
  99. package/dist/schema/types.d.ts +6 -0
  100. package/dist/schema/types.js.map +1 -1
  101. package/dist/styles.css +1 -1
  102. package/dist/theme.css +215 -0
  103. package/dist/tokens.css +274 -0
  104. package/dist/ui/block-icon-picker.d.ts +38 -0
  105. package/dist/ui/block-icon-picker.js +141 -0
  106. package/dist/ui/block-icon-picker.js.map +1 -0
  107. package/dist/ui/button.js +1 -0
  108. package/dist/ui/button.js.map +1 -1
  109. package/dist/ui/code-language-menu.d.ts +24 -0
  110. package/dist/ui/code-language-menu.js +123 -0
  111. package/dist/ui/code-language-menu.js.map +1 -0
  112. package/dist/ui/content-fields.d.ts +47 -0
  113. package/dist/ui/content-fields.js +279 -0
  114. package/dist/ui/content-fields.js.map +1 -0
  115. package/dist/ui/controls.js +3 -2
  116. package/dist/ui/controls.js.map +1 -1
  117. package/dist/ui/floating-panel.js +3 -2
  118. package/dist/ui/floating-panel.js.map +1 -1
  119. package/dist/ui/foundations.d.ts +118 -0
  120. package/dist/ui/foundations.js +565 -0
  121. package/dist/ui/foundations.js.map +1 -0
  122. package/dist/ui/index.d.ts +6 -0
  123. package/dist/ui/index.js +7 -1
  124. package/dist/ui/inspector.d.ts +412 -0
  125. package/dist/ui/inspector.js +1218 -0
  126. package/dist/ui/inspector.js.map +1 -0
  127. package/dist/ui/overlay.d.ts +7 -2
  128. package/dist/ui/overlay.js +55 -20
  129. package/dist/ui/overlay.js.map +1 -1
  130. package/dist/ui/shortcut-hint.js +1 -1
  131. package/dist/ui/shortcut-hint.js.map +1 -1
  132. package/dist/ui/tab.js +3 -2
  133. package/dist/ui/tab.js.map +1 -1
  134. package/dist/ui/toast.d.ts +5 -3
  135. package/dist/ui/toast.js +83 -11
  136. package/dist/ui/toast.js.map +1 -1
  137. package/dist/ui/tooltip-card.d.ts +45 -0
  138. package/dist/ui/tooltip-card.js +135 -0
  139. package/dist/ui/tooltip-card.js.map +1 -0
  140. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","names":[],"sources":["../../../src/controls/rich-text/codec.ts"],"sourcesContent":["/**\n * RICH TEXT · the storage contract between the kit editor and its host.\n *\n * The V2 editor edits HTML (contentEditable). Production stores Portable Text, in the shape the classic editor of the\n * same surface writes (a block array for an entry field, the `{ content, html }` envelope for a component prop). The\n * conversion lives in the host, which owns the real converters, schema conformance and the field's Accept config; the\n * kit never imports them. A host with no codec gets a held field (read-only, with the reason), never a guess.\n *\n * The control opens a value only when it survives the trip editor → codec unchanged (`same`), so nothing the HTML\n * editor cannot hold (a checklist's ticks, a link's rel, an image's layout) is dropped by a first keystroke: such a\n * value is edited by the host's own control instead, with the reason named.\n */\nimport type { FieldPath, FieldSchema } from \"../../schema/types\";\nimport type { UnknownValue } from \"../unknown-value\";\n\n/** What a field may hold, in the editor's vocabulary. The editor offers nothing outside it. */\nexport type RichTextFeature =\n | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\n | \"blockquote\" | \"ul\" | \"ol\" | \"pre\" | \"hr\"\n | \"bold\" | \"italic\" | \"underline\" | \"strike\" | \"sup\" | \"sub\" | \"code\"\n | \"link\" | \"image\"\n /* blocks, each stored as its own Portable Text block (see dom.ts) */\n | \"table\" | \"pullquote\" | \"takeaways\" | \"callout\" | \"toggle\" | \"video\" | \"file\"\n /* a task list (PT listItem \"check\" + checked) and a call-to-action link (the link markDef with button: true) */\n | \"checklist\" | \"button\"\n /* V2's article blocks, each a Portable Text block of its own (plan RT3–RT5): embed, gallery, table of contents */\n | \"embed\" | \"gallery\" | \"toc\"\n /* plan RT6–RT8: a footnote (inline, in the text), columns of text, an author bio and related posts (references) */\n | \"footnote\" | \"columns\" | \"author\" | \"related\"\n /* an embed's Shape (aspect): the host declares it once its stored embed keeps one (plan RT3) */\n | \"embedAspect\";\n\nexport const ALL_FEATURES: readonly RichTextFeature[] = [\n \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"blockquote\", \"ul\", \"ol\", \"pre\", \"hr\", \"bold\", \"italic\", \"underline\", \"strike\", \"sup\", \"sub\", \"code\", \"link\", \"image\",\n \"table\", \"pullquote\", \"takeaways\", \"callout\", \"toggle\", \"video\", \"file\", \"checklist\", \"button\", \"embed\", \"gallery\", \"toc\", \"footnote\", \"columns\", \"author\", \"related\", \"embedAspect\",\n];\n\nexport interface RichTextRead {\n /** the HTML the editor opens on */\n html: string;\n /** the stored value as the classic editor would open it (compared against the editor's round trip) */\n seed: unknown;\n /** what this value already cannot carry from an earlier editor, in words (\"2 links\"); shown before the first edit */\n losses: string[];\n /** what the field accepts */\n features: RichTextFeature[];\n /** one paragraph, stored inline (allowMultipleParagraphs: false) */\n single: boolean;\n /** links may open in a new tab */\n newTab: boolean;\n /**\n * the styles, marks and lists the value holds that the field no longer declares: kept by every write, flagged above\n * the editor with change-to and remove (H4; see `remap`). Absent or empty = none.\n */\n undeclared?: UnknownValue[];\n /**\n * Where an author bio and related posts point (plan RT8), from the field's config: the authors and posts collections,\n * and the entry being edited (left out of the automatic related modes). Author bio is offered only with `authors`.\n * `topic: false`: the posts collection has no tags or category field, so \"Same topic\" cannot rank there (the entry\n * write refuses it, relatedPosts.no_topic_field); a new block is Newest and Same topic is not offered. Absent = has one.\n */\n /** `postsNoun`: what one post is called (the posts collection's singular, \"story\"), so Hand-picked says \"Create new story\" */\n references?: { authors?: string; posts?: string; entryId?: string; topic?: boolean; postsNoun?: string };\n}\n\nexport interface RichTextWrite {\n /** the value to store, in the surface's own shape */\n value: unknown;\n /** what the stored shape would drop from this HTML, in words; non-empty = the write is refused */\n losses: string[];\n}\n\nexport interface RichTextAt {\n field: FieldSchema;\n path: FieldPath;\n}\n\nexport interface KitRichTextCodec {\n read(value: unknown, at: RichTextAt): RichTextRead;\n /** `prev` is the stored value being replaced (its keys are reused so an edit does not re-key the document) */\n write(html: string, at: RichTextAt, prev: unknown): RichTextWrite;\n /** the same document, ignoring keys, span splits and storage wrapper */\n same(a: unknown, b: unknown): boolean;\n /** the stored value with one `undeclared` value (its `key`) changed to `to`, or removed (`to` null); the words stay */\n remap?(value: unknown, at: RichTextAt, key: string, to: string | null): unknown;\n}\n\ndeclare module \"../../context\" {\n interface KitServices {\n /**\n * Stored rich text ↔ the HTML the kit editor edits (see controls/rich-text/codec.ts). Absent → a rich text field\n * is held (read-only, with the reason).\n */\n richText?: KitRichTextCodec;\n }\n}\n"],"mappings":";AAgCA,IAAa,eAA2C;CACtD;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAc;CAAM;CAAM;CAAO;CAAM;CAAQ;CAAU;CAAa;CAAU;CAAO;CAAO;CAAQ;CAAQ;CAClJ;CAAS;CAAa;CAAa;CAAW;CAAU;CAAS;CAAQ;CAAa;CAAU;CAAS;CAAW;CAAO;CAAY;CAAW;CAAU;CAAW;AACzK"}
1
+ {"version":3,"file":"codec.js","names":[],"sources":["../../../src/controls/rich-text/codec.ts"],"sourcesContent":["/**\n * RICH TEXT · the storage contract between the kit editor and its host.\n *\n * The V2 editor edits HTML (contentEditable). Production stores Portable Text, in the shape the classic editor of the\n * same surface writes (a block array for an entry field, the `{ content, html }` envelope for a component prop). The\n * conversion lives in the host, which owns the real converters, schema conformance and the field's Accept config; the\n * kit never imports them. A host with no codec gets a held field (read-only, with the reason), never a guess.\n *\n * The control opens a value only when it survives the trip editor → codec unchanged (`same`), so nothing the HTML\n * editor cannot hold (a checklist's ticks, a link's rel, an image's layout) is dropped by a first keystroke: such a\n * value is edited by the host's own control instead, with the reason named.\n */\nimport type { FieldPath, FieldSchema } from \"../../schema/types\";\nimport type { UnknownValue } from \"../unknown-value\";\n\n/** What a field may hold, in the editor's vocabulary. The editor offers nothing outside it. */\nexport type RichTextFeature =\n | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"\n | \"blockquote\" | \"ul\" | \"ol\" | \"pre\" | \"hr\"\n | \"bold\" | \"italic\" | \"underline\" | \"strike\" | \"sup\" | \"sub\" | \"code\"\n | \"link\" | \"image\"\n /* blocks, each stored as its own Portable Text block (see dom.ts) */\n | \"table\" | \"pullquote\" | \"takeaways\" | \"callout\" | \"toggle\" | \"video\" | \"file\"\n /* a task list (PT listItem \"check\" + checked) and a call-to-action link (the link markDef with button: true) */\n | \"checklist\" | \"button\"\n /* V2's article blocks, each a Portable Text block of its own (plan RT3–RT5): embed, gallery, table of contents */\n | \"embed\" | \"gallery\" | \"toc\"\n /* plan RT6–RT8: a footnote (inline, in the text), columns of text, an author bio and related posts (references) */\n | \"footnote\" | \"columns\" | \"author\" | \"related\"\n /* an embed's Shape (aspect): the host declares it once its stored embed keeps one (plan RT3) */\n | \"embedAspect\"\n /* prototype editor-v16 Stats: a row of number cards (dom.ts StatsModel; the host declares it once it stores one) */\n | \"stats\"\n /* look v16 callout: the \"note\" tone and \"No icon\" (`data-icon=\"none\"`), declared once the stored callout keeps them */\n | \"calloutStyle\"\n /* the table's \"Fit to width\" (`design.fit`, `data-fit=\"true\"`), declared once the stored table keeps it (REQ-KIT-3).\n Absent: the toggle hides; a stored data-fit still passes through untouched. */\n | \"tableFit\";\n\nexport const ALL_FEATURES: readonly RichTextFeature[] = [\n \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"blockquote\", \"ul\", \"ol\", \"pre\", \"hr\", \"bold\", \"italic\", \"underline\", \"strike\", \"sup\", \"sub\", \"code\", \"link\", \"image\",\n \"table\", \"pullquote\", \"takeaways\", \"callout\", \"toggle\", \"video\", \"file\", \"checklist\", \"button\", \"embed\", \"gallery\", \"toc\", \"footnote\", \"columns\", \"author\", \"related\", \"embedAspect\", \"stats\", \"calloutStyle\", \"tableFit\",\n];\n\nexport interface RichTextRead {\n /** the HTML the editor opens on */\n html: string;\n /** the stored value as the classic editor would open it (compared against the editor's round trip) */\n seed: unknown;\n /** what this value already cannot carry from an earlier editor, in words (\"2 links\"); shown before the first edit */\n losses: string[];\n /** what the field accepts */\n features: RichTextFeature[];\n /** one paragraph, stored inline (allowMultipleParagraphs: false) */\n single: boolean;\n /** links may open in a new tab */\n newTab: boolean;\n /**\n * the styles, marks and lists the value holds that the field no longer declares: kept by every write, flagged above\n * the editor with change-to and remove (H4; see `remap`). Absent or empty = none.\n */\n undeclared?: UnknownValue[];\n /**\n * Where an author bio and related posts point (plan RT8), from the field's config: the authors and posts collections,\n * and the entry being edited (left out of the automatic related modes). Author bio is offered only with `authors`.\n * `topic: false`: the posts collection has no tags or category field, so \"Same topic\" cannot rank there (the entry\n * write refuses it, relatedPosts.no_topic_field); a new block is Newest and Same topic is not offered. Absent = has one.\n */\n /** `postsNoun`: what one post is called (the posts collection's singular, \"story\"), so Hand-picked says \"Create new story\" */\n references?: { authors?: string; posts?: string; entryId?: string; topic?: boolean; postsNoun?: string };\n}\n\nexport interface RichTextWrite {\n /** the value to store, in the surface's own shape */\n value: unknown;\n /** what the stored shape would drop from this HTML, in words; non-empty = the write is refused */\n losses: string[];\n}\n\nexport interface RichTextAt {\n field: FieldSchema;\n path: FieldPath;\n}\n\nexport interface KitRichTextCodec {\n read(value: unknown, at: RichTextAt): RichTextRead;\n /** `prev` is the stored value being replaced (its keys are reused so an edit does not re-key the document) */\n write(html: string, at: RichTextAt, prev: unknown): RichTextWrite;\n /** the same document, ignoring keys, span splits and storage wrapper */\n same(a: unknown, b: unknown): boolean;\n /** the stored value with one `undeclared` value (its `key`) changed to `to`, or removed (`to` null); the words stay */\n remap?(value: unknown, at: RichTextAt, key: string, to: string | null): unknown;\n}\n\ndeclare module \"../../context\" {\n interface KitServices {\n /**\n * Stored rich text ↔ the HTML the kit editor edits (see controls/rich-text/codec.ts). Absent → a rich text field\n * is held (read-only, with the reason).\n */\n richText?: KitRichTextCodec;\n }\n}\n"],"mappings":";AAuCA,IAAa,eAA2C;CACtD;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAc;CAAM;CAAM;CAAO;CAAM;CAAQ;CAAU;CAAa;CAAU;CAAO;CAAO;CAAQ;CAAQ;CAClJ;CAAS;CAAa;CAAa;CAAW;CAAU;CAAS;CAAQ;CAAa;CAAU;CAAS;CAAW;CAAO;CAAY;CAAW;CAAU;CAAW;CAAe;CAAS;CAAgB;AACjN"}
@@ -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>` : "";
@@ -557,6 +601,10 @@ function parseStoredTable(src) {
557
601
  ...t.design,
558
602
  sticky: true
559
603
  };
604
+ if (fig?.getAttribute("data-fit") === "true") t.design = {
605
+ ...t.design,
606
+ fit: true
607
+ };
560
608
  const ld = fig?.getAttribute("data-jsonld");
561
609
  if (ld === "ItemList" || ld === "Dataset" || ld === "Offers") {
562
610
  const axis = fig?.getAttribute("data-jsonld-axis");
@@ -760,7 +808,8 @@ function renderStoredTable(input) {
760
808
  const ld = t.jsonLd && t.jsonLd.type !== "none" ? t.jsonLd : null;
761
809
  const resp = t.design?.responsive === "stack" || t.design?.responsive === "cards" ? t.design.responsive : null;
762
810
  const sticky = !!t.design?.sticky;
763
- if (!caption && !notes && !footnotes.length && !colRuns.length && !rowRuns.length && !sortable && !filter && !ld && !resp && !sticky && !typed) {
811
+ const fit = !!t.design?.fit;
812
+ if (!caption && !notes && !footnotes.length && !colRuns.length && !rowRuns.length && !sortable && !filter && !ld && !resp && !sticky && !fit && !typed) {
764
813
  const out = ["<table>"];
765
814
  if (t.headerRow) out.push(`<thead>${headRow}</thead>`);
766
815
  out.push(`${body.length || !tfoot ? `<tbody>${body.map(rowHtml).join("")}</tbody>` : ""}${tfoot}</table>`);
@@ -780,8 +829,8 @@ function renderStoredTable(input) {
780
829
  else if (body.length) out.push(`<tbody>${body.map(rowHtml).join("")}</tbody>`);
781
830
  out.push(`${tfoot}</table>`);
782
831
  const html = out.join("");
783
- if (!notes && !footnotes.length && !filter && !ld && !resp && !sticky) return html;
784
- const designAttrs = `${resp ? ` data-responsive="${resp}"` : ""}${sticky ? " data-sticky=\"true\"" : ""}`;
832
+ if (!notes && !footnotes.length && !filter && !ld && !resp && !sticky && !fit) return html;
833
+ const designAttrs = `${resp ? ` data-responsive="${resp}"` : ""}${sticky ? " data-sticky=\"true\"" : ""}${fit ? " data-fit=\"true\"" : ""}`;
785
834
  const ldAttrs = ld ? ` data-jsonld="${ld.type}"${ld.axis ? ` data-jsonld-axis="${ld.axis}"` : ""}${ld.priceRow ? ` data-jsonld-price="${escAttr(ld.priceRow)}"` : ""}` : "";
786
835
  return `<figure data-rt="table"${designAttrs}${filter ? " data-filter=\"true\"" : ""}${ldAttrs}>${html}${footnotes.length ? `<div class="bt-notes" id="${escAttr(notesId)}">${notes ? `<p data-notes>${esc(notes)}</p>` : ""}<ol data-footnotes>${footnotes.map((f, i) => `<li id="${escAttr(t.id ?? "tbl")}-fn-${i + 1}" data-key="${escAttr(f._key)}">${esc(f.text)}</li>`).join("")}</ol></div>` : notes ? `<p data-notes id="${escAttr(notesId)}">${esc(notes)}</p>` : ""}</figure>`;
787
836
  }
@@ -877,6 +926,7 @@ function parseIsland(kind, el) {
877
926
  const m = {};
878
927
  const tone = attrOf(el, "data-callout");
879
928
  if (tone !== void 0) m.tone = tone;
929
+ if (attrOf(el, "data-icon") === "none") m.icon = "none";
880
930
  if (title) m.title = (title.textContent ?? "").replace(/\u200b/g, "");
881
931
  if (body) m.body = parasToText(body);
882
932
  const extra = attrOf(el, "data-extra");
@@ -979,6 +1029,23 @@ function parseIsland(kind, el) {
979
1029
  if (extra) m.extra = extra;
980
1030
  return m;
981
1031
  }
1032
+ case "stats": {
1033
+ const text = (n) => (n?.textContent ?? "").replace(/\u200b/g, "").replace(/\s+/g, " ").trim();
1034
+ const items = Array.from(el.querySelectorAll(":scope > [data-stat]")).map((c) => ({
1035
+ _key: rid("st"),
1036
+ label: text(c.querySelector(":scope > small")),
1037
+ value: text(c.querySelector(":scope > b")),
1038
+ note: text(c.querySelector(":scope > span"))
1039
+ }));
1040
+ const m = { items: items.length ? items : [newStat()] };
1041
+ const cols = Number(attrOf(el, "data-cols"));
1042
+ if (cols === 2 || cols === 3 || cols === 4) m.cols = cols;
1043
+ const style = attrOf(el, "data-style");
1044
+ if (style === "outlined" || style === "filled") m.style = style;
1045
+ const extra = attrOf(el, "data-extra");
1046
+ if (extra) m.extra = extra;
1047
+ return m;
1048
+ }
982
1049
  case "file": {
983
1050
  const m = {};
984
1051
  const url = attrOf(el, "data-url");
@@ -1090,6 +1157,9 @@ function serialize(root) {
1090
1157
  c.replaceWith(tpl.content);
1091
1158
  });
1092
1159
  clone.querySelectorAll("[data-hint]").forEach((n) => n.removeAttribute("data-hint"));
1160
+ clone.querySelectorAll("[data-rt-wrap]").forEach((n) => n.removeAttribute("data-rt-wrap"));
1161
+ clone.querySelectorAll("span[data-rt-hl]").forEach((n) => n.replaceWith(n.textContent ?? ""));
1162
+ clone.querySelectorAll("pre").forEach((n) => n.normalize());
1093
1163
  clone.querySelectorAll("ul[data-task] > li").forEach((li) => (li.removeAttribute("role"), li.removeAttribute("aria-checked")));
1094
1164
  while (clone.children.length > 1 && clone.lastElementChild && isEmptyP(clone.lastElementChild)) clone.lastElementChild.remove();
1095
1165
  const html = clone.innerHTML.replace(/​/g, "");
@@ -1185,6 +1255,6 @@ function ownsMenu(menu, roots) {
1185
1255
  }
1186
1256
  var isEmptyHtml = (html) => !html.replace(/<(?!img|hr|figure|table|details|div data-rt)[^>]*>/g, "").replace(/&nbsp;/g, "").trim();
1187
1257
  //#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 };
1258
+ 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
1259
 
1190
1260
  //# sourceMappingURL=dom.js.map