@portabletext/plugin-emoji-picker 1.0.0 → 1.0.2

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
@@ -63,7 +63,7 @@ The emoji picker activates when users type `:` followed by a keyword (e.g., `:sm
63
63
 
64
64
  **Returns:**
65
65
 
66
- - `keyword`: The matches keyword, including colons.
66
+ - `keyword`: The matched keyword.
67
67
  - `matches`: Emoji matches found for the current keyword.
68
68
  - `selectedIndex`: Index of the selected match
69
69
  - `onNavigateTo(index)`: Navigate to a specific match by index.
package/dist/index.cjs CHANGED
@@ -2633,48 +2633,48 @@ const triggerListenerCallback = ({
2633
2633
  }
2634
2634
  });
2635
2635
  function useEmojiPicker(props) {
2636
- const $ = compilerRuntime.c(17), editor$1 = editor.useEditor(), t0 = props.matchEmojis;
2637
- let t1;
2638
- $[0] !== editor$1 || $[1] !== t0 ? (t1 = {
2636
+ const $ = compilerRuntime.c(17), editor$1 = editor.useEditor();
2637
+ let t0;
2638
+ $[0] !== editor$1 || $[1] !== props.matchEmojis ? (t0 = {
2639
2639
  input: {
2640
2640
  editor: editor$1,
2641
- matchEmojis: t0
2641
+ matchEmojis: props.matchEmojis
2642
2642
  }
2643
- }, $[0] = editor$1, $[1] = t0, $[2] = t1) : t1 = $[2];
2644
- const emojiPickerActor = react.useActorRef(emojiPickerMachine, t1), keyword = react.useSelector(emojiPickerActor, _temp), matches = react.useSelector(emojiPickerActor, _temp2), selectedIndex = react.useSelector(emojiPickerActor, _temp3);
2645
- let t2;
2646
- $[3] !== emojiPickerActor ? (t2 = () => {
2643
+ }, $[0] = editor$1, $[1] = props.matchEmojis, $[2] = t0) : t0 = $[2];
2644
+ const emojiPickerActor = react.useActorRef(emojiPickerMachine, t0), keyword = react.useSelector(emojiPickerActor, _temp), matches = react.useSelector(emojiPickerActor, _temp2), selectedIndex = react.useSelector(emojiPickerActor, _temp3);
2645
+ let t1;
2646
+ $[3] !== emojiPickerActor ? (t1 = () => {
2647
2647
  emojiPickerActor.send({
2648
2648
  type: "dismiss"
2649
2649
  });
2650
- }, $[3] = emojiPickerActor, $[4] = t2) : t2 = $[4];
2651
- const onDismiss = t2;
2652
- let t3;
2653
- $[5] !== emojiPickerActor ? (t3 = (index) => {
2650
+ }, $[3] = emojiPickerActor, $[4] = t1) : t1 = $[4];
2651
+ const onDismiss = t1;
2652
+ let t2;
2653
+ $[5] !== emojiPickerActor ? (t2 = (index) => {
2654
2654
  emojiPickerActor.send({
2655
2655
  type: "navigate to",
2656
2656
  index
2657
2657
  });
2658
- }, $[5] = emojiPickerActor, $[6] = t3) : t3 = $[6];
2659
- const onNavigateTo = t3;
2660
- let t4;
2661
- $[7] !== editor$1 || $[8] !== emojiPickerActor ? (t4 = () => {
2658
+ }, $[5] = emojiPickerActor, $[6] = t2) : t2 = $[6];
2659
+ const onNavigateTo = t2;
2660
+ let t3;
2661
+ $[7] !== editor$1 || $[8] !== emojiPickerActor ? (t3 = () => {
2662
2662
  emojiPickerActor.send({
2663
2663
  type: "insert selected match"
2664
2664
  }), editor$1.send({
2665
2665
  type: "focus"
2666
2666
  });
2667
- }, $[7] = editor$1, $[8] = emojiPickerActor, $[9] = t4) : t4 = $[9];
2668
- const onSelect = t4;
2669
- let t5;
2670
- return $[10] !== keyword || $[11] !== matches || $[12] !== onDismiss || $[13] !== onNavigateTo || $[14] !== onSelect || $[15] !== selectedIndex ? (t5 = {
2667
+ }, $[7] = editor$1, $[8] = emojiPickerActor, $[9] = t3) : t3 = $[9];
2668
+ const onSelect = t3;
2669
+ let t4;
2670
+ return $[10] !== keyword || $[11] !== matches || $[12] !== onDismiss || $[13] !== onNavigateTo || $[14] !== onSelect || $[15] !== selectedIndex ? (t4 = {
2671
2671
  keyword,
2672
2672
  matches,
2673
2673
  selectedIndex,
2674
2674
  onDismiss,
2675
2675
  onNavigateTo,
2676
2676
  onSelect
2677
- }, $[10] = keyword, $[11] = matches, $[12] = onDismiss, $[13] = onNavigateTo, $[14] = onSelect, $[15] = selectedIndex, $[16] = t5) : t5 = $[16], t5;
2677
+ }, $[10] = keyword, $[11] = matches, $[12] = onDismiss, $[13] = onNavigateTo, $[14] = onSelect, $[15] = selectedIndex, $[16] = t4) : t4 = $[16], t4;
2678
2678
  }
2679
2679
  function _temp3(snapshot_1) {
2680
2680
  return snapshot_1.context.selectedIndex;
@@ -2683,7 +2683,8 @@ function _temp2(snapshot_0) {
2683
2683
  return snapshot_0.context.matches;
2684
2684
  }
2685
2685
  function _temp(snapshot) {
2686
- return snapshot.context.keyword;
2686
+ const rawKeyword = snapshot.context.keyword.startsWith(":") ? snapshot.context.keyword.slice(1) : snapshot.context.keyword;
2687
+ return rawKeyword.endsWith(":") ? rawKeyword.slice(0, -1) : rawKeyword;
2687
2688
  }
2688
2689
  exports.createMatchEmojis = createMatchEmojis;
2689
2690
  exports.matchEmojis = matchEmojis;