@meowdown/react 0.32.0 → 0.33.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.
package/README.md CHANGED
@@ -54,6 +54,8 @@ export function App() {
54
54
 
55
55
  See the full API reference [here](https://npmx.dev/package-docs/@meowdown%2Freact/).
56
56
 
57
+ Slash menu host items can include `keywords` to match hidden terms without changing the displayed label.
58
+
57
59
  ## Styling
58
60
 
59
61
  Import both stylesheets: `@meowdown/core/style.css` (the editor theme and variables) and `@meowdown/react/style.css` (the component layout). The core theme is documented in [`@meowdown/core`](https://www.npmjs.com/package/@meowdown/core).
package/dist/index.d.ts CHANGED
@@ -24,7 +24,8 @@ interface EditorHandle {
24
24
  setMarkdown: (markdown: string) => void;
25
25
  /**
26
26
  * Parses `markdown` and inserts it at the current selection as a single
27
- * undoable edit, replacing any selected content. A lone paragraph is
27
+ * undoable edit. An active selection collapses first and is never
28
+ * deleted - this is a host-initiated insert, not a paste. A lone paragraph is
28
29
  * inserted inline at the cursor; anything else is inserted as blocks. The
29
30
  * cursor lands at the end of the inserted content. An empty or
30
31
  * whitespace-only string is a no-op. Unlike `setMarkdown`, it fires
@@ -87,6 +88,8 @@ interface SlashMenuItem {
87
88
  id?: string;
88
89
  /** Display text, matched against the typed query like the built-in items. */
89
90
  label: string;
91
+ /** Extra match terms beyond the label; never displayed. */
92
+ keywords?: string[];
90
93
  /** Secondary text shown beside the label. */
91
94
  detail?: string;
92
95
  /** Runs after the menu closes and the typed `/query` text is removed. */
package/dist/index.js CHANGED
@@ -493,11 +493,13 @@ function LinkMenu({ onLinkClick, onLinkCopy }) {
493
493
  let rangeFrom;
494
494
  let rangeTo;
495
495
  if (edit) {
496
- rangeFrom = edit.from;
497
- rangeTo = edit.to;
496
+ const anchorRange = edit.link?.label ?? edit;
497
+ rangeFrom = anchorRange.from;
498
+ rangeTo = anchorRange.to;
498
499
  } else if (hover) {
499
- rangeFrom = hover.unit.from;
500
- rangeTo = hover.unit.to;
500
+ const anchorRange = hover.label ?? hover.unit;
501
+ rangeFrom = anchorRange.from;
502
+ rangeTo = anchorRange.to;
501
503
  }
502
504
  const anchor = useMemo(() => {
503
505
  if (rangeFrom == null || rangeTo == null) return;
@@ -882,9 +884,9 @@ var autocomplete_menu_module_default = {
882
884
  //#endregion
883
885
  //#region src/components/slash-menu.tsx
884
886
  const regex$2 = canUseRegexLookbehind() ? /(?<!\S)\/(\S.*)?$/u : /\/(\S.*)?$/u;
885
- function SlashMenuItem({ label, detail, kbd, onSelect }) {
887
+ function SlashMenuItem({ label, keywords, detail, kbd, onSelect }) {
886
888
  return /* @__PURE__ */ jsxs(AutocompleteItem, {
887
- value: label,
889
+ value: [label, ...keywords ?? []].join(" "),
888
890
  className: autocomplete_menu_module_default.Item,
889
891
  onSelect,
890
892
  children: [
@@ -1005,6 +1007,7 @@ function SlashMenu({ timeFormat = "12", onSlashMenuSearch }) {
1005
1007
  }),
1006
1008
  hostItems.map((item) => /* @__PURE__ */ jsx(SlashMenuItem, {
1007
1009
  label: item.label,
1010
+ keywords: item.keywords,
1008
1011
  detail: item.detail,
1009
1012
  onSelect: item.onSelect
1010
1013
  }, item.id ?? item.label)),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/react",
3
3
  "type": "module",
4
- "version": "0.32.0",
4
+ "version": "0.33.1",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "@prosekit/react": "^0.8.0-beta.15",
26
26
  "clsx": "^2.1.1",
27
27
  "lucide-react": "^1.21.0",
28
- "@meowdown/core": "0.32.0"
28
+ "@meowdown/core": "0.33.1"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": "^19.0.0",