@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
@@ -18,15 +18,18 @@
18
18
  * "Components" group (V2: "Article" and "Page sections"), and no live preview flyout is drawn beside a row.
19
19
  */
20
20
  import * as React from "react";
21
+ import { type AiCommandKind } from "../../context";
21
22
  import type { RichTextFeature } from "./codec";
22
23
  import type { KitInsertableComponent } from "../component-services";
23
- export type BasicId = "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "quote" | "pullquote" | "callout" | "toggle" | "takeaways" | "ul" | "ol" | "code" | "hr" | "image" | "video" | "file" | "table" | "task" | "button" | "gallery" | "embed" | "toc" | "footnote" | "columns" | "related" | "author";
24
+ export type BasicId = "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "quote" | "pullquote" | "callout" | "toggle" | "takeaways" | "ul" | "ol" | "code" | "hr" | "image" | "video" | "file" | "table" | "task" | "button" | "gallery" | "embed" | "toc" | "footnote" | "columns" | "related" | "author" | "stats";
24
25
  export interface CatalogItem {
25
26
  key: string;
26
27
  /** a basic block (absent on a component, the More components row and the way back) */
27
28
  id?: BasicId;
28
29
  /** component: embeds `component`; folder: opens More components; back: returns to every block */
29
- kind?: "component" | "folder" | "back";
30
+ kind?: "component" | "folder" | "back" | "ai";
31
+ /** look "v16": a "BetterCMS AI" command (the AI view's rows) */
32
+ ai?: AiCommandKind;
30
33
  component?: KitInsertableComponent;
31
34
  /** the folder row's component count */
32
35
  count?: number;
@@ -37,7 +40,11 @@ export interface CatalogItem {
37
40
  aliases?: string[];
38
41
  /** why it can't be picked here (a component this field refuses): shown in place of the description */
39
42
  disabled?: string;
43
+ /** look "v16": what to type in the body to get it ("##", "```"), shown at the end of its row */
44
+ hint?: string;
40
45
  }
46
+ /** A key hint as this platform writes it ("⌘⌥0" → "Ctrl+Alt+0" off Apple; Markdown hints are unchanged). */
47
+ export declare const hintText: (hint: string) => string;
41
48
  /** The components this field may embed, as the host answered (KitServices.useInsertableComponents). */
42
49
  export interface CatalogComponents {
43
50
  components: KitInsertableComponent[];
@@ -54,15 +61,32 @@ export interface CatalogSection {
54
61
  title: string | null;
55
62
  items: CatalogItem[];
56
63
  }
57
- /** `folder`: the More components view (its way back first, then the components, searched by `query`). */
58
- export declare function useCatalog(query: string, allows: (f: RichTextFeature) => boolean, folder?: boolean, own?: CatalogComponents | null): {
64
+ /**
65
+ * `folder`: the More components view (its way back first, then the components, searched by `query`).
66
+ * `aiOffered`: the "BetterCMS AI" Featured row leads the list (look "v16", the host has an AI command service);
67
+ * `aiView`: its view (the way back, then the commands: all seven, or the host's `KitServices.aiCommandKinds` in
68
+ * AI_COMMANDS order; when that leaves none there is no AI row at all).
69
+ */
70
+ export declare function useCatalog(query: string, allows: (f: RichTextFeature) => boolean, folder?: boolean, own?: CatalogComponents | null, aiOffered?: boolean, aiView?: boolean): {
71
+ sections: CatalogSection[];
72
+ flat: CatalogItem[];
73
+ empty: boolean;
74
+ noMatch: boolean;
75
+ emptyText: string;
76
+ };
77
+ /**
78
+ * Look "v16" Insert ▾ (prototype content.jsx:1263-1306): no search. "Site blocks · Sections built for this site" first,
79
+ * only when the host has site blocks (its component list has some, or is still loading); then Media; then Data and
80
+ * layout. Rows the field does not allow are left out.
81
+ */
82
+ export declare function insertCatalog(allows: (f: RichTextFeature) => boolean, lib: CatalogComponents | null): {
59
83
  sections: CatalogSection[];
60
84
  flat: CatalogItem[];
61
85
  empty: boolean;
62
86
  noMatch: boolean;
63
87
  emptyText: string;
64
88
  };
65
- export declare function CatalogList({ sections, flat, active, onHover, onPick, empty, emptyText, noMatch, detail, listId, className, }: {
89
+ export declare function CatalogList({ sections, flat, active, onHover, onPick, empty, emptyText, noMatch, detail, listId, className, query, playIcon, onListKeyDown, listRef, }: {
66
90
  sections: CatalogSection[];
67
91
  flat: CatalogItem[];
68
92
  active: number;
@@ -76,18 +100,32 @@ export declare function CatalogList({ sections, flat, active, onHover, onPick, e
76
100
  detail?: boolean;
77
101
  listId: string;
78
102
  className?: string;
103
+ /** look "v16": the search text, echoed in the empty line (Nothing matches “…”) */
104
+ query?: string;
105
+ /** look "v16": the row whose AI icon plays once now (the row the AI view opens on); hover plays the rest */
106
+ playIcon?: number | null;
107
+ /** a menu with no search box: the list itself takes focus and the keys (it points at the active row) */
108
+ onListKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
109
+ listRef?: React.RefObject<HTMLDivElement | null>;
79
110
  }): import("react/jsx-runtime").JSX.Element;
80
111
  /** Shared keyboard model: ↑↓ wrap, Home/End, Enter / Tab, → into More components. Returns true when handled. */
81
112
  export declare function catalogKey(e: React.KeyboardEvent | KeyboardEvent, flat: CatalogItem[], active: number, setActive: (i: number) => void, pick: (it: CatalogItem) => void, homeEnd?: boolean): boolean;
82
- export declare function InsertMenuContent({ onInsert, allows, keepFocusOnClose, align, side, }: {
113
+ export declare function InsertMenuContent({ onInsert, allows, keepFocusOnClose, align, side, list, }: {
83
114
  onInsert: (it: CatalogItem) => void;
84
115
  allows: (f: RichTextFeature) => boolean;
85
116
  /** after an insert the caret stays in the editor: the menu gives no focus back to its trigger */
86
117
  keepFocusOnClose?: () => boolean;
87
118
  align?: "start" | "center" | "end";
88
119
  side?: "top" | "bottom" | "left" | "right";
120
+ /** look "v16": "curated" is the toolbar's Insert ▾ (prototype content.jsx:1263-1306: no search, Site blocks, Media,
121
+ * Data and layout); "full" (default) is the whole searchable catalogue. Other looks always show the full one. */
122
+ list?: "full" | "curated";
89
123
  }): import("react/jsx-runtime").JSX.Element;
90
- export declare function SlashMenuPanel({ query, folder, active, setActive, onPick, allows, maxHeight, }: {
124
+ export declare function SlashMenuPanel({ query, folder, active, setActive, onPick, allows, maxHeight, aiOffered, aiView, }: {
125
+ /** look "v16": the "BetterCMS AI" Featured row is offered (the host has an AI command service) */
126
+ aiOffered?: boolean;
127
+ /** look "v16": the AI view (the editor keeps it with the rest of the slash state) */
128
+ aiView?: boolean;
91
129
  /** the room the editor found for the menu (collision-aware); the list scrolls inside it */
92
130
  maxHeight?: number;
93
131
  query: string;