@homecode/ui 5.3.7 → 5.3.8

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 (135) hide show
  1. package/dist/esm/index.js +1 -1
  2. package/dist/esm/src/components/PromptComposer/PromptComposer.js +3 -1
  3. package/dist/esm/src/components/PromptComposer/promptComposerInsert.js +18 -1
  4. package/dist/esm/src/components/PromptComposer/usePromptComposerEditor.js +9 -4
  5. package/dist/esm/src/hooks/useListKeyboardControl.js +4 -0
  6. package/dist/esm/src/tiptap/slash-mention/SlashSuggestionList.js +2 -1
  7. package/dist/esm/src/tiptap/slash-mention/createSlashMentionExtension.js +10 -4
  8. package/dist/esm/types/src/components/PromptComposer/PromptComposer.d.ts +2 -1
  9. package/dist/esm/types/src/components/PromptComposer/PromptComposer.types.d.ts +3 -1
  10. package/dist/esm/types/src/components/PromptComposer/index.d.ts +1 -1
  11. package/dist/esm/types/src/components/PromptComposer/promptComposerInsert.d.ts +3 -0
  12. package/dist/esm/types/src/components/PromptComposer/usePromptComposerEditor.d.ts +3 -2
  13. package/graphify-out/.graphify_labels.json +1 -0
  14. package/graphify-out/.graphify_python +1 -0
  15. package/graphify-out/.graphify_root +1 -0
  16. package/graphify-out/GRAPH_REPORT.md +750 -0
  17. package/graphify-out/cache/ast/00346d96a76a1f06ea9bc36ab1d0e12681a94e47a7c65ef93f5e2f1751b009ca.json +1 -0
  18. package/graphify-out/cache/ast/14988f05c120c67aaaf89402115ac549696b70918f71f5452fcb487cf88a3e78.json +1 -0
  19. package/graphify-out/cache/ast/1abef75ab6fbd60f67ffc8f02d7754a8d17f5f8aaff67431ef17ef91d0b19293.json +1 -0
  20. package/graphify-out/cache/ast/42bf1e462fac54def8ffb8ac0d2815f50a9b0153253b989db83a73c129550108.json +1 -0
  21. package/graphify-out/cache/ast/64dfe527ce1f7047bf3626b788b056b8541dd3b49f4067f978da9d845df2852d.json +1 -0
  22. package/graphify-out/cache/ast/b0183d2742b6512fad31da35ebb8e6af9599e614d7f085e986daf10ce11bd614.json +1 -0
  23. package/graphify-out/cache/ast/bdfba7e439d8215261b9abab976ea9b018a0947580ed37c46a61113e90ddde95.json +1 -0
  24. package/graphify-out/cache/ast/bfb8fd3a37bd702d28e1ec5d651be8cf421ef1ccc0952b7ca86f82612f1ac855.json +1 -0
  25. package/graphify-out/cache/semantic/015f234a8437b74659356b0c7cf8e93f8eff41ca3104f7925e3bffcae47f3c72.json +1 -0
  26. package/graphify-out/cache/semantic/046a46acc84330d3b7a64b11577ae374cb7c561aac396c622d288ed4ee85b873.json +1 -0
  27. package/graphify-out/cache/semantic/04fa096cde049f636eb4e483e2ee7cc188a18f1b1de12f11681fe43241134e06.json +1 -0
  28. package/graphify-out/cache/semantic/052873cbc2d4a1760c2cedba851afd43b53895be4b8c1eeda1a86cf532ef4a9d.json +1 -0
  29. package/graphify-out/cache/semantic/0afebf341ec4de64948fb4ba7047121637233380f69b829ec38e14b7b2cfbf76.json +1 -0
  30. package/graphify-out/cache/semantic/0bc94d402610976edc02c8b8fe1df6012a7246f47ae75e94810e4716f5788dc0.json +1 -0
  31. package/graphify-out/cache/semantic/0fdeea4db8e141ebab07bf243987272f54facc2456c38a7a307a51349b0cd614.json +1 -0
  32. package/graphify-out/cache/semantic/199cac5b62378221d8f26f85f9ddf562f4bd59c06ee0259affbae994323b4031.json +1 -0
  33. package/graphify-out/cache/semantic/1fc9c9e36dedd810d8845f96a6781152481344e01f53c7095eec2d5afd3f7769.json +1 -0
  34. package/graphify-out/cache/semantic/20f558bf7b782614829802a8c1460dad9c0c5e53a16c426937804710c86e04e6.json +1 -0
  35. package/graphify-out/cache/semantic/26d475e8b831b100a4ab3ea3ce8e013c370a16147a15fdf61d40f496da8489db.json +1 -0
  36. package/graphify-out/cache/semantic/2946657a126b41149c3582a068ef3480ce7c977546d94b825d204fe2accceb8a.json +1 -0
  37. package/graphify-out/cache/semantic/29e9ac0ff47578aeb03bbeb9dc9970ef2f92513c16c9451d1bf020ebb5727d83.json +1 -0
  38. package/graphify-out/cache/semantic/2a1164e229054695f9bafb93e04c334c29ffedfa4969d327cc8feb91a107a464.json +1 -0
  39. package/graphify-out/cache/semantic/2f4bffad646428447919313cb61e2b1240234053128cc78498e960109174aef4.json +1 -0
  40. package/graphify-out/cache/semantic/305f670d07659733e228abe6e79e5e42d8f0b2b1825abda5bb9b944c91a63976.json +1 -0
  41. package/graphify-out/cache/semantic/4038cbf93d048b57b03fa8d2606a44c2e4cec947f1b8c464263a4ba8d6df24e8.json +1 -0
  42. package/graphify-out/cache/semantic/40b29be54a920198a3a3f720ea44ce8599c0641b4db7199a2815b9686de3edb1.json +1 -0
  43. package/graphify-out/cache/semantic/41962b28af47a037208fc80a409314c9ae5a5c5a726ea913134c38f4d748015a.json +1 -0
  44. package/graphify-out/cache/semantic/41b108238ab072aa4b39e5f271ff625f3f273b1742027595d1732029b2da7c83.json +1 -0
  45. package/graphify-out/cache/semantic/41cd712038a93ea27d3729b394b12f64a6e64daa36a20162ed1e3e8acddae4c3.json +1 -0
  46. package/graphify-out/cache/semantic/437df45b75a68c9952dcd61fda7642dcbe2d9a7ac7d318086efe6ecd739ba991.json +1 -0
  47. package/graphify-out/cache/semantic/48e4ee5bd85d3a18e98b3e9f6915ec15f60ecb422100931bc1acf6a737f4fa4d.json +1 -0
  48. package/graphify-out/cache/semantic/4ab88d3f555a3241cec0ff801f5d2ca28ecb8463e2b03fbe05e62233c2ef65a7.json +1 -0
  49. package/graphify-out/cache/semantic/4def2888ec417f9936441998b8c0e21feb5f9f2bded6c1cc4aaaccb1aaed7756.json +1 -0
  50. package/graphify-out/cache/semantic/5465e865a7ccf7df8938e341597e8d4222f6230b01df40a8e516918db20ae8fa.json +1 -0
  51. package/graphify-out/cache/semantic/547235ff1f7a65ae5b0216d8869e2deff3e2d1767142bc2b2e6720cf80451c1c.json +1 -0
  52. package/graphify-out/cache/semantic/5973310dcf9b1314c6372847614e2ee10c2277b95a7cc9662fe5ddb5c4175858.json +1 -0
  53. package/graphify-out/cache/semantic/5d030e47120503defde17c904de484e32ac7bcd219c1fd2a746c36ff76821249.json +1 -0
  54. package/graphify-out/cache/semantic/5e8027c02a797dd984c245c9cb3d2a487bea7b2f172b63477dd1242e066f3bcd.json +1 -0
  55. package/graphify-out/cache/semantic/5f4a70a338c123e7886c29afa8f53730c02706fd294b6aa9fb4b3a36155c70cd.json +1 -0
  56. package/graphify-out/cache/semantic/60233df9b32ea458c4a1955f08234e2468dee893537b014cf611b7f70e99b2cc.json +1 -0
  57. package/graphify-out/cache/semantic/60a7a206457546b362df11b1fb0574fcffa9aef15ea634770e10fb3bd10318b4.json +1 -0
  58. package/graphify-out/cache/semantic/63480e84144afdb2d52824745423c11c5b1be382af8c2ff41d59dc6cb19162c7.json +1 -0
  59. package/graphify-out/cache/semantic/63683ed092288dd5efab32f115e2b5a5cc9237d18bedeb0e0254d25665472161.json +1 -0
  60. package/graphify-out/cache/semantic/65b29460c6daea292031ac815e82d56de9622f9ec13519424aaf1e69c9547945.json +1 -0
  61. package/graphify-out/cache/semantic/67b08fc0156de884418c6db4f006c7339aa6bd77b616e58192f845455f4caa1f.json +1 -0
  62. package/graphify-out/cache/semantic/697849a9ef29f1ab7a3419cd8f51f95697a82338fbdb1c19cb39471576d220f6.json +1 -0
  63. package/graphify-out/cache/semantic/6addf1cfd544bb2f4b50373446481115e1a82c35ff0728c1aa2cdbbf79f781f8.json +1 -0
  64. package/graphify-out/cache/semantic/6c91f59da0baa5be4f2830ba1bcb5566168fa95ac29519af26872f46a6787d23.json +1 -0
  65. package/graphify-out/cache/semantic/6f7d7e9162d521d3bdee5046e53d770cda25bfc99831c59287a973a81f59667e.json +1 -0
  66. package/graphify-out/cache/semantic/70493d07c6879f209a7a4c91a94048085979f6e286c2ffe8f58994b3fe3be652.json +1 -0
  67. package/graphify-out/cache/semantic/71b30a36162a55f7dbe8ff20a34da79618ffa70e1bcbe5ba3f8077f6f840173f.json +1 -0
  68. package/graphify-out/cache/semantic/71ed746eb0c550874e6effce0af4ecf17e683b0dbcb303808d493a1b02803111.json +1 -0
  69. package/graphify-out/cache/semantic/7561f78cc00b76e25fd37de39b6c700e1d09da8ce056f0c7428e4568fd681786.json +1 -0
  70. package/graphify-out/cache/semantic/77a8a2e9c0596b440279167560f6f11cc25b63c07d0313169cad28a3a55214cc.json +1 -0
  71. package/graphify-out/cache/semantic/7ab7f6f8dec9b6505f5a1ccc3a9b8211d808ff387e0d5e493907e2ef77968f65.json +1 -0
  72. package/graphify-out/cache/semantic/7d2bc6ec28b494d581cc059125218e23e5a01cbca01a383e02ae66292b5671aa.json +1 -0
  73. package/graphify-out/cache/semantic/7d8851929ecb0b7634e6fbf6a1e9518b40b5ba55d84c7b87f9921c0b76d28b68.json +1 -0
  74. package/graphify-out/cache/semantic/7fabc8ec7f6abf3c9d32f48c1b96148b1b238485510f1bf8f604904e5e9b7640.json +1 -0
  75. package/graphify-out/cache/semantic/825a5f5e545cb7b33a550a8dc396e082ef79a46973556dfe83a42ab8b04fc8ad.json +1 -0
  76. package/graphify-out/cache/semantic/83f8b730266d7ad38ce226c24e12921b8f6179470d8eaf3ad969b35930508a1b.json +1 -0
  77. package/graphify-out/cache/semantic/87b463fb0697667c7b3f9857f1e5507d79f41ca62295255f953481b58f95c97d.json +1 -0
  78. package/graphify-out/cache/semantic/88f01bfa0e795399148476fe7da92f06d6cf1cfd1904d13b0d23d4f8f1549bbb.json +1 -0
  79. package/graphify-out/cache/semantic/89c9af422deed22cf3fcd273c80423e70d585b6d75dddc67aab761f9ab038370.json +1 -0
  80. package/graphify-out/cache/semantic/8fec9bc14c17533cb1f3fd0b3d3e753c84d41ec1bfc5fa26d37de9138829908e.json +1 -0
  81. package/graphify-out/cache/semantic/94854def2ce6ba82bbf802acf63e41a518cf33693a2abf65966cac6b63aa6872.json +1 -0
  82. package/graphify-out/cache/semantic/9616ede4f0dba798e38970e707b96d54c92fdf14bbf98d725f778612cadfc809.json +1 -0
  83. package/graphify-out/cache/semantic/9863045ab7773fe3e393a0d14520e05220c107ad66c22ef76d584526fc394c7c.json +1 -0
  84. package/graphify-out/cache/semantic/99e248f766d6f88dfb2cd75388e8f6d2913b8215823c74bfb30a3de29a3938f7.json +1 -0
  85. package/graphify-out/cache/semantic/9e145d7b658d5b0aa5dcfd02ed3656bd2b16b2266f964c65ed09e55ab09133a5.json +1 -0
  86. package/graphify-out/cache/semantic/9eae2d0eb2e11ad9797c5cc8c690024fa06510fb93318f2a67412ea61c879597.json +1 -0
  87. package/graphify-out/cache/semantic/a29bda455dec5f719a56663638ec554474c2ba450f8f67bd9706fe397b7bc1e2.json +1 -0
  88. package/graphify-out/cache/semantic/a4fae20e66e60fee154de812889afebd9a8d03b9f88a4bb9128e97bc01308eaa.json +1 -0
  89. package/graphify-out/cache/semantic/a7e57a10bb40c4475113d1d3519ce3aa6c9a9733fd9c526d69f8f5ff913f7af2.json +1 -0
  90. package/graphify-out/cache/semantic/a8932fc483ae4a5ef68c4d0ad120446caab4ff2321dfaf133c008b504cba4882.json +1 -0
  91. package/graphify-out/cache/semantic/a8ecf3963b40fb444d84ab704f60752adc505d66b1786b5cac5aeebab0bbb113.json +1 -0
  92. package/graphify-out/cache/semantic/af227629246e8de493f1917ea85b59199adb979a658e9c67923e5e96b397ec2e.json +1 -0
  93. package/graphify-out/cache/semantic/b3632333adc154f84b4a87f02ec9b7623636f5483a6d3e8a6fb3829399e859af.json +1 -0
  94. package/graphify-out/cache/semantic/b68b1208f92257bd0426dfddfc4e91021e5d4a21e7346134c60b7deb2663caac.json +1 -0
  95. package/graphify-out/cache/semantic/b7463dc58034edd1c1e22ea69648cc22a595d4a447514c88bffdb8df653b3e09.json +1 -0
  96. package/graphify-out/cache/semantic/b860d0f96eba65111665f02f6950557434ecc21928fc6974092db7d379096e58.json +1 -0
  97. package/graphify-out/cache/semantic/b905ecd7078e176f5cfc01e7025a4a600e249cdcdcb07c86a22f14b14f5c7479.json +1 -0
  98. package/graphify-out/cache/semantic/ba3108bde1b64238e6ea6e230a833bc2aa42c2692e3727fbd85d7718bf8191cf.json +1 -0
  99. package/graphify-out/cache/semantic/bc02ab95207a45cbfde472019776126d4c3be04106bcc77f0fbeadef330add5d.json +1 -0
  100. package/graphify-out/cache/semantic/bdae5143204a52383c727d505e5fba4f19e9de230ae850a54e44211979f47a74.json +1 -0
  101. package/graphify-out/cache/semantic/c2251f1e6bb132b6c56c73471786696e3bf60fe06a961d809745c3c3edacf1d4.json +1 -0
  102. package/graphify-out/cache/semantic/c4e6a7e0854bdd5dcf7892a256c410b2742852b47cc8ab486bb7bd1fdfa02b9a.json +1 -0
  103. package/graphify-out/cache/semantic/c4f7e2cc8a84b3960456eacde3203ec00fd898340ad2a5048f4ebd071e0d3908.json +1 -0
  104. package/graphify-out/cache/semantic/c70af08c8276e4c6eb2fe56987f29ef924e72a519bc6b982a15f70f956c2faa8.json +1 -0
  105. package/graphify-out/cache/semantic/c7faa8fe895d781405cde44d570cfa494b224a8283c583c5f1e76bc619af6625.json +1 -0
  106. package/graphify-out/cache/semantic/c967c2c75ae4491d4e598eed580e10b2de0b9fba25d0d31b2a01b62d7cf466d0.json +1 -0
  107. package/graphify-out/cache/semantic/cc1c5a027b1f4c478d8c9e5274599d08394635bdfd02db0ec3aa2cf10e442314.json +1 -0
  108. package/graphify-out/cache/semantic/ce7eebac88eec9bc4db10875391349e227352340ae7f9c030c791ed43bbb4975.json +1 -0
  109. package/graphify-out/cache/semantic/cf9d24720de3bf51d46009431d6cdaf208eefeb86e29083e755367c3ca514f27.json +1 -0
  110. package/graphify-out/cache/semantic/d03454d523b284ed22ac4c324c1493f7a87e620670ea10cb07d4d69f930d1e90.json +1 -0
  111. package/graphify-out/cache/semantic/d5c3fa4e182e24466af1ee5a2468d7b1312fa50379f6237dfe7e6939eecf6426.json +1 -0
  112. package/graphify-out/cache/semantic/d96df693960ceb28c9622f887920d2f358d94656baa4b3006c9a2b63fdb80cbd.json +1 -0
  113. package/graphify-out/cache/semantic/df0c4dc80f448b4e0483dad1c564cde7b2cd5f62924d2315c6edd8efae0d03af.json +1 -0
  114. package/graphify-out/cache/semantic/e007f51abbdda39f46b16f67d88b9ca986ad0de003fdee4c6deb2e8053b6bc6a.json +1 -0
  115. package/graphify-out/cache/semantic/e6a7860db84b96816f7b4ef24d962e483b1cc58d04d1c9b9781dcddb3dd47d4e.json +1 -0
  116. package/graphify-out/cache/semantic/e9542b76568732b92e08324fd71b4a65cec5b8c4d93251d478c826490ac339b9.json +1 -0
  117. package/graphify-out/cache/semantic/e9a768ff72b8d89f18d08bccd9997ff97b3b403ea9c12d71c6bdb1b1a2cb9aae.json +1 -0
  118. package/graphify-out/cache/semantic/eb43c20f3dc8139aaabbc9b060650dbb3c7722d7e5e5be52076e1a1513628228.json +1 -0
  119. package/graphify-out/cache/semantic/eea4f455cf1bed5405ceea550a487e987c426529f607f5c73a46db13a2c42159.json +1 -0
  120. package/graphify-out/cache/semantic/efcc09a4efc4df5902c45ecd52fa7c4c325bb39c97fe96166a39c44005d6b8be.json +1 -0
  121. package/graphify-out/cache/semantic/f2ddc79ae916a38409e7024575bf2759951e5d42b088053beaed67c32f6afcec.json +1 -0
  122. package/graphify-out/cache/semantic/f3b3a6416b6f59b0e4a567b9d0a8931b2c16c9f99e90627dba86728f317e9e25.json +1 -0
  123. package/graphify-out/cache/semantic/f58974b4ecd93b9a8e615b4ca158d56a06717906f2ce5a1137ba8bf7d1dc9e3d.json +1 -0
  124. package/graphify-out/cache/semantic/f5e83a9e5d525dc1b0dd012e21529e9e8f32a839747437455d924b7b4e9429eb.json +1 -0
  125. package/graphify-out/cache/semantic/f699ccc92e85b7689c2f513df7050ae18b7a8f7381df404fb0d461a99f93c8c4.json +1 -0
  126. package/graphify-out/cache/semantic/f7b9fe8a41b2521598e81c6dc4fac9506c52e261c830b6bdb01f6a40e6dc7fa0.json +1 -0
  127. package/graphify-out/cache/semantic/f8f3b0e7242143f49cfd0858d7602b9d278aa74bcaa400e2cf9cbad17814522d.json +1 -0
  128. package/graphify-out/cache/semantic/fae9f5d8f53678ce29603705d74849af51a6d83d7b7ffb033d701845b95e6d94.json +1 -0
  129. package/graphify-out/cache/semantic/fb66ac4a7f0fbf6db84ef6d52d6e26afd22b86a7167ed0703aae5d3859951e75.json +1 -0
  130. package/graphify-out/cache/stat-index.json +1 -0
  131. package/graphify-out/cost.json +12 -0
  132. package/graphify-out/graph.html +307 -0
  133. package/graphify-out/graph.json +51680 -0
  134. package/graphify-out/manifest.json +2262 -0
  135. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -35,7 +35,7 @@ export { Progress } from './src/components/Progress/Progress.js';
35
35
  export { ProgressCircular } from './src/components/ProgressCircular/ProgressCircular.js';
36
36
  export { PromptComposer } from './src/components/PromptComposer/PromptComposer.js';
37
37
  export { usePromptComposerEditor } from './src/components/PromptComposer/usePromptComposerEditor.js';
38
- export { PROMPT_COMPOSER_COMMAND_CHIP_CLASS, createPromptComposerHandle, getPromptComposerTokenRangeBeforePos, insertPromptComposerContentAtCaret, promptComposerChipHtml, promptComposerMentionNode } from './src/components/PromptComposer/promptComposerInsert.js';
38
+ export { PROMPT_COMPOSER_COMMAND_CHIP_CLASS, createPromptComposerHandle, getPromptComposerTokenRangeBeforePos, insertPromptComposerContentAtCaret, openPromptComposerSlashSuggestion, promptComposerChipHtml, promptComposerMentionNode } from './src/components/PromptComposer/promptComposerInsert.js';
39
39
  export { RadioButton } from './src/components/RadioButton/RadioButton.js';
40
40
  export { RadioGroup } from './src/components/RadioGroup/RadioGroup.js';
41
41
  export { Router, RouterContext, RouterStore } from './src/components/Router/Router.js';
@@ -7,11 +7,12 @@ import S from './PromptComposer.styl.js';
7
7
  import { createPromptComposerHandle } from './promptComposerInsert.js';
8
8
  import { usePromptComposerEditor } from './usePromptComposerEditor.js';
9
9
 
10
- const PromptComposer = forwardRef(function PromptComposer({ disabled = false, placeholder, className, slashCommandItems, onSlashItemCommand, prefillMessage, attachmentsCount = 0, allowEnterSubmit = true, onSubmit, onChange, scrollProps = {}, }, ref) {
10
+ const PromptComposer = forwardRef(function PromptComposer({ disabled = false, placeholder, className, slashCommandItems, slashSuggestionPlacement, onSlashItemCommand, prefillMessage, attachmentsCount = 0, allowEnterSubmit = true, onSubmit, onChange, scrollProps = {}, }, ref) {
11
11
  const { editor } = usePromptComposerEditor({
12
12
  disabled,
13
13
  placeholder,
14
14
  slashCommandItems,
15
+ slashSuggestionPlacement,
15
16
  onSlashItemCommand,
16
17
  prefillMessage,
17
18
  attachmentsCount,
@@ -28,6 +29,7 @@ const PromptComposer = forwardRef(function PromptComposer({ disabled = false, pl
28
29
  getEditor: () => {
29
30
  throw new Error('PromptComposer editor is not ready yet');
30
31
  },
32
+ openSlashSuggestion: () => undefined,
31
33
  }), []);
32
34
  useImperativeHandle(ref, () => (editor ? createPromptComposerHandle(editor) : unavailableHandle), [editor, unavailableHandle]);
33
35
  return (jsx("div", { className: cn(S.root, className), "data-disabled": disabled ? 'true' : 'false', children: jsx(Scroll, { y: true, fadeSize: "s", ...scrollProps, className: S.scroller, children: jsx(EditorContent, { editor: editor, className: S.editorMount }) }) }));
@@ -81,6 +81,22 @@ function setPromptComposerEditorText(editor, text, options) {
81
81
  });
82
82
  }
83
83
  }
84
+ function openPromptComposerSlashSuggestion(editor, slashChar = '/') {
85
+ if (editor.isDestroyed)
86
+ return;
87
+ editor.chain().focus('end').run();
88
+ const { doc, selection } = editor.state;
89
+ const pos = selection.to;
90
+ const $pos = doc.resolve(pos);
91
+ let insert = slashChar;
92
+ if ($pos.parentOffset > 0) {
93
+ const before = doc.textBetween(pos - 1, pos);
94
+ if (!/\s/.test(before)) {
95
+ insert = ` ${slashChar}`;
96
+ }
97
+ }
98
+ editor.chain().focus('end').insertContent(insert).run();
99
+ }
84
100
  function createPromptComposerHandle(editor) {
85
101
  return {
86
102
  insertAtCaret: (content, options) => insertPromptComposerContentAtCaret(editor, content, options),
@@ -99,7 +115,8 @@ function createPromptComposerHandle(editor) {
99
115
  setPromptComposerEditorText(editor, text, options);
100
116
  },
101
117
  getEditor: () => editor,
118
+ openSlashSuggestion: slashChar => openPromptComposerSlashSuggestion(editor, slashChar),
102
119
  };
103
120
  }
104
121
 
105
- export { PROMPT_COMPOSER_COMMAND_CHIP_CLASS, createPromptComposerHandle, getPromptComposerTokenRangeBeforePos, insertPromptComposerContentAtCaret, promptComposerChipHtml, promptComposerMentionNode };
122
+ export { PROMPT_COMPOSER_COMMAND_CHIP_CLASS, createPromptComposerHandle, getPromptComposerTokenRangeBeforePos, insertPromptComposerContentAtCaret, openPromptComposerSlashSuggestion, promptComposerChipHtml, promptComposerMentionNode };
@@ -10,7 +10,7 @@ import { PROMPT_COMPOSER_EMPTY_DOC, promptComposerParagraphDoc } from './promptC
10
10
  const PROMPT_COMPOSER_EDITOR_CLASS = 'promptComposerEditor';
11
11
  const PROMPT_COMPOSER_EMPTY_EDITOR_CLASS = 'promptComposerEmptyEditor';
12
12
  const PROMPT_COMPOSER_EMPTY_NODE_CLASS = 'promptComposerEmptyNode';
13
- function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, onSlashItemCommand, prefillMessage, attachmentsCount = 0, allowEnterSubmit, onSubmit, onChange, }) {
13
+ function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, slashSuggestionPlacement = 'above', onSlashItemCommand, prefillMessage, attachmentsCount = 0, allowEnterSubmit, onSubmit, onChange, }) {
14
14
  const slashOpenRef = useRef(false);
15
15
  const onSlashItemCommandRef = useRef(onSlashItemCommand);
16
16
  onSlashItemCommandRef.current = onSlashItemCommand;
@@ -23,7 +23,7 @@ function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, onS
23
23
  slashOpenRef.current = active;
24
24
  }, []);
25
25
  const slashItemsFingerprint = JSON.stringify(slashCommandItems ?? null);
26
- const slashItemsStable = useMemo(() => slashCommandItems ?? DEFAULT_CHAT_SLASH_ITEMS, [slashCommandItems, slashItemsFingerprint]);
26
+ const slashItemsStable = useMemo(() => slashCommandItems ?? DEFAULT_CHAT_SLASH_ITEMS, [slashItemsFingerprint]);
27
27
  const placeholderText = useMemo(() => {
28
28
  if (placeholder === undefined || placeholder === null) {
29
29
  return 'Type a message...';
@@ -57,13 +57,18 @@ function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, onS
57
57
  if (slashItemsStable.length > 0) {
58
58
  exts.push(createSlashMentionExtension({
59
59
  items: slashItemsStable,
60
- suggestionPlacement: 'above',
60
+ suggestionPlacement: slashSuggestionPlacement,
61
61
  onSuggestionUiActiveChange: suggestionActiveUpdater,
62
62
  onItemCommand: ctx => onSlashItemCommandRef.current?.(ctx) === true,
63
63
  }));
64
64
  }
65
65
  return exts;
66
- }, [placeholderText, slashItemsStable, suggestionActiveUpdater]);
66
+ }, [
67
+ placeholderText,
68
+ slashItemsStable,
69
+ slashSuggestionPlacement,
70
+ suggestionActiveUpdater,
71
+ ]);
67
72
  const [text, setText] = useState('');
68
73
  const editorDomRef = useRef(null);
69
74
  const bindEditorDom = useCallback(({ editor }) => {
@@ -28,6 +28,10 @@ const useListKeyboardControl = ({ isActive, itemsCount, onSelect, }) => {
28
28
  if (e.key === 'Enter') {
29
29
  if (newIndex < 0 || newIndex >= itemsCount)
30
30
  return;
31
+ const active = document.activeElement;
32
+ if (active?.closest('.promptComposerEditor, .ProseMirror, [contenteditable="true"], [aria-label="Slash commands"]')) {
33
+ return;
34
+ }
31
35
  e.preventDefault();
32
36
  e.stopPropagation();
33
37
  onSelect?.(newIndex);
@@ -31,6 +31,7 @@ function SlashSuggestionListInner({ items, command, listHandleRef, }) {
31
31
  }
32
32
  if (event.key === 'Enter') {
33
33
  event.preventDefault();
34
+ event.stopPropagation();
34
35
  const max = Math.max(items.length - 1, 0);
35
36
  const idx = Math.min(selected, max);
36
37
  const item = items[idx];
@@ -46,7 +47,7 @@ function SlashSuggestionListInner({ items, command, listHandleRef, }) {
46
47
  useImperativeHandle(listHandleRef, () => ({ onKeyboardEvent }), [
47
48
  onKeyboardEvent,
48
49
  ]);
49
- return (jsx("div", { className: S.root, children: jsx(Menu, { className: S.menu, role: "listbox", "aria-label": "Slash commands", children: items.map((item, idx) => (jsxs(Menu.Item, { role: "option", "aria-selected": idx === safeSel, className: cn(S.item, idx === safeSel && S.itemHighlighted, item.className), onMouseDown: e => e.preventDefault(), onMouseEnter: () => setSelected(idx), onClick: () => onPick(idx), textOverflow: true, children: [jsxs("span", { className: S.itemLabel, children: ["/", item.label] }), item.description ? (jsx("span", { className: S.itemDesc, children: item.description })) : null] }, `${item.id}-${idx}`))) }) }));
50
+ return (jsx("div", { className: S.root, children: jsx(Menu, { className: S.menu, role: "listbox", "aria-label": "Slash commands", children: items.map((item, idx) => (jsxs(Menu.Item, { role: "option", "aria-selected": idx === safeSel, className: cn(S.item, idx === safeSel && S.itemHighlighted, item.className), onMouseDown: e => e.preventDefault(), onMouseEnter: () => setSelected(idx), onClick: () => onPick(idx), textOverflow: true, children: [jsx("span", { className: S.itemLabel, children: item.label }), item.description ? (jsx("span", { className: S.itemDesc, children: item.description })) : null] }, `${item.id}-${idx}`))) }) }));
50
51
  }
51
52
  function SlashSuggestionList(props) {
52
53
  if (props.items.length === 0)
@@ -31,11 +31,13 @@ const SlashMention = Mention.extend({
31
31
  },
32
32
  });
33
33
  const SUGGESTION_GAP_PX = 4;
34
- function placeSlashSuggestionPopup(popupElement, clientRect, placement) {
34
+ function placeSlashSuggestionPopup(popupElement, clientRect, placement, editorElement) {
35
35
  if (!clientRect)
36
36
  return;
37
37
  const el = popupElement;
38
- const popupHeight = el.getBoundingClientRect().height;
38
+ const popupRect = el.getBoundingClientRect();
39
+ const popupHeight = popupRect.height;
40
+ const popupWidth = popupRect.width;
39
41
  const spaceBelow = window.innerHeight - clientRect.bottom - SUGGESTION_GAP_PX;
40
42
  const spaceAbove = clientRect.top - SUGGESTION_GAP_PX;
41
43
  let showAbove = placement === 'above';
@@ -45,7 +47,11 @@ function placeSlashSuggestionPopup(popupElement, clientRect, placement) {
45
47
  const top = showAbove
46
48
  ? Math.max(SUGGESTION_GAP_PX, clientRect.top - popupHeight - SUGGESTION_GAP_PX)
47
49
  : clientRect.bottom + SUGGESTION_GAP_PX;
48
- el.style.left = `${clientRect.left}px`;
50
+ const editorRect = editorElement?.getBoundingClientRect();
51
+ let left = editorRect ? editorRect.left : clientRect.left;
52
+ const maxLeft = window.innerWidth - popupWidth - SUGGESTION_GAP_PX;
53
+ left = Math.max(SUGGESTION_GAP_PX, Math.min(left, maxLeft));
54
+ el.style.left = `${left}px`;
49
55
  el.style.top = `${top}px`;
50
56
  }
51
57
  function slashMentionSuggestionRender(uiRef, placement = 'below') {
@@ -53,7 +59,7 @@ function slashMentionSuggestionRender(uiRef, placement = 'below') {
53
59
  const place = (props) => {
54
60
  if (!popup?.element)
55
61
  return;
56
- placeSlashSuggestionPopup(popup.element, props.clientRect?.() ?? null, placement);
62
+ placeSlashSuggestionPopup(popup.element, props.clientRect?.() ?? null, placement, props.editor.view.dom);
57
63
  };
58
64
  return {
59
65
  onStart: props => {
@@ -1,9 +1,10 @@
1
1
  import { type PromptComposerHandle } from './promptComposerInsert';
2
2
  export type { PromptComposerHandle, PromptComposerInsertOptions, } from './promptComposerInsert';
3
- export declare const PromptComposer: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLDivElement> & {
3
+ export declare const PromptComposer: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "onSubmit" | "onChange"> & {
4
4
  disabled?: boolean;
5
5
  placeholder?: string;
6
6
  slashCommandItems?: import(".").SlashCommandItem[];
7
+ slashSuggestionPlacement?: import(".").SlashSuggestionPlacement;
7
8
  onSlashItemCommand?: import(".").SlashOnItemCommand;
8
9
  prefillMessage?: string;
9
10
  attachmentsCount?: number;
@@ -1,11 +1,13 @@
1
1
  import type { Editor } from '@tiptap/core';
2
2
  import type { HTMLAttributes } from 'react';
3
- import type { SlashCommandItem, SlashOnItemCommand } from '../../tiptap/slash-mention';
3
+ import type { SlashCommandItem, SlashOnItemCommand, SlashSuggestionPlacement } from '../../tiptap/slash-mention';
4
4
  import type { Props as ScrollProps } from '../Scroll/Scroll.types';
5
5
  export type Props = Omit<HTMLAttributes<HTMLDivElement>, 'onSubmit' | 'onChange'> & {
6
6
  disabled?: boolean;
7
7
  placeholder?: string;
8
8
  slashCommandItems?: SlashCommandItem[];
9
+ /** Slash menu vertical placement; defaults to above chat input. */
10
+ slashSuggestionPlacement?: SlashSuggestionPlacement;
9
11
  onSlashItemCommand?: SlashOnItemCommand;
10
12
  prefillMessage?: string | null;
11
13
  /** Staged attachment count - Enter can submit even when text empty. */
@@ -2,6 +2,6 @@ export { PromptComposer } from './PromptComposer';
2
2
  export type { PromptComposerProps } from './PromptComposer.types';
3
3
  export { usePromptComposerEditor } from './usePromptComposerEditor';
4
4
  export type { UsePromptComposerEditorOptions } from './usePromptComposerEditor';
5
- export { getPromptComposerTokenRangeBeforePos, createPromptComposerHandle, insertPromptComposerContentAtCaret, promptComposerChipHtml, promptComposerMentionNode, PROMPT_COMPOSER_COMMAND_CHIP_CLASS, } from './promptComposerInsert';
5
+ export { getPromptComposerTokenRangeBeforePos, createPromptComposerHandle, insertPromptComposerContentAtCaret, openPromptComposerSlashSuggestion, promptComposerChipHtml, promptComposerMentionNode, PROMPT_COMPOSER_COMMAND_CHIP_CLASS, } from './promptComposerInsert';
6
6
  export type { PromptComposerHandle, PromptComposerInsertOptions, PromptComposerMentionNodeInput, } from './promptComposerInsert';
7
7
  export type { SlashCommandItem, SlashItemCommandContext, SlashOnItemCommand, SlashSuggestionPlacement, } from '../../tiptap/slash-mention';
@@ -24,6 +24,8 @@ export type PromptComposerHandle = {
24
24
  atEnd?: boolean;
25
25
  }) => void;
26
26
  getEditor: () => Editor;
27
+ /** Inserts `/` (with leading space when needed) to open slash suggestions. */
28
+ openSlashSuggestion: (slashChar?: string) => void;
27
29
  };
28
30
  export declare function getPromptComposerTokenRangeBeforePos(editor: Editor, pos: number): {
29
31
  from: number;
@@ -39,4 +41,5 @@ export type PromptComposerMentionNodeInput = {
39
41
  };
40
42
  export declare function promptComposerMentionNode(input: PromptComposerMentionNodeInput): JSONContent;
41
43
  export declare function insertPromptComposerContentAtCaret(editor: Editor, content: string | JSONContent, options?: PromptComposerInsertOptions): void;
44
+ export declare function openPromptComposerSlashSuggestion(editor: Editor, slashChar?: string): void;
42
45
  export declare function createPromptComposerHandle(editor: Editor): PromptComposerHandle;
@@ -1,9 +1,10 @@
1
1
  import { type Editor } from '@tiptap/core';
2
- import type { SlashCommandItem, SlashOnItemCommand } from '../../tiptap/slash-mention';
2
+ import type { SlashCommandItem, SlashOnItemCommand, SlashSuggestionPlacement } from '../../tiptap/slash-mention';
3
3
  export type UsePromptComposerEditorOptions = {
4
4
  disabled: boolean;
5
5
  placeholder?: string;
6
6
  slashCommandItems?: SlashCommandItem[];
7
+ slashSuggestionPlacement?: SlashSuggestionPlacement;
7
8
  onSlashItemCommand?: SlashOnItemCommand;
8
9
  prefillMessage?: string | null;
9
10
  attachmentsCount?: number;
@@ -16,4 +17,4 @@ export type UsePromptComposerEditorResult = {
16
17
  text: string;
17
18
  trimmedText: string;
18
19
  };
19
- export declare function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, onSlashItemCommand, prefillMessage, attachmentsCount, allowEnterSubmit, onSubmit, onChange, }: UsePromptComposerEditorOptions): UsePromptComposerEditorResult;
20
+ export declare function usePromptComposerEditor({ disabled, placeholder, slashCommandItems, slashSuggestionPlacement, onSlashItemCommand, prefillMessage, attachmentsCount, allowEnterSubmit, onSubmit, onChange, }: UsePromptComposerEditorOptions): UsePromptComposerEditorResult;
@@ -0,0 +1 @@
1
+ {"0": "Docs Examples Index", "1": "PromptComposer", "2": "Build Toolchain", "3": "Form Examples", "4": "Autocomplete Examples", "5": "Checkbox Showcase", "6": "Theme Config", "7": "Type Props Schema", "8": "Notifications System", "9": "Button Checkbox Core", "10": "Optional Value Props", "11": "Select Component", "12": "Input AssistiveText", "13": "Gallery Component", "14": "Virtualized Examples", "15": "TypeScript Config", "16": "Package Dependencies", "17": "Card Component", "18": "Debounce Paranja", "19": "UILIB Docs Assets", "20": "Component Type Props", "21": "Flex Gallery", "22": "DatePicker Examples", "23": "Comment Value Props", "24": "Docs Index Pages", "25": "i18n LangSelector", "26": "Package Metadata", "27": "Popup Positioning", "28": "Popup Component", "29": "Docs Code Layout", "30": "Draggable Types", "31": "Slider Component", "32": "Small Component Props", "33": "Select Popup Types", "34": "Router Core", "35": "Calendar Helpers", "36": "AssistiveText Menu", "37": "Button DatePicker Types", "38": "Container Icon", "39": "Checkbox Props", "40": "NPM Scripts", "41": "Calendar DatePicker", "42": "DateTime Types", "43": "Autocomplete Core", "44": "Global Type Kinds", "45": "Date Type Fields", "46": "Form Types", "47": "Docs App Store", "48": "Component Types JSON", "49": "Option Value Types", "50": "Generic Props", "51": "Draggable Component", "52": "Heading Scroll", "53": "Progress Indicators", "54": "Table Virtualized", "55": "Virtualized Lifecycle", "56": "Docs Pages", "57": "Code Example Helpers", "58": "Media Control Icons", "59": "Text Heading", "60": "Type Parser Script", "61": "ButtonGroup Tabs", "62": "DateTime Component", "63": "Display Format Props", "64": "Calendar Day Props", "65": "Dialogue Props", "66": "Arrow Chevron Icons", "67": "InputFile Upload", "68": "InputFile Types", "69": "Virtualized List", "70": "List Lifecycle", "71": "Icon Index Exports", "72": "Webpack Paths Config", "73": "DatePicker Helpers", "74": "Calendar Day", "75": "Calendar Pointer Props", "76": "Size Enum Props", "77": "Code Editor", "78": "Communication Icons", "79": "Select Constants", "80": "TextShimmer", "81": "Virtualized Cards", "82": "ClassName Props", "83": "Ukrainian i18n", "84": "Icon RequiredStar Types", "85": "Navigation Icons", "86": "File Action Icons", "87": "Label Helpers", "88": "Lazy Types", "89": "Select Example Helpers", "90": "Menu More Icons", "91": "Social Media Icons", "92": "Rollup Build Config", "93": "Tabs Types", "94": "VH Component", "95": "Docs Navigation", "96": "Footer Alignment", "97": "Calendar Day Disabled", "98": "Render Day Props", "99": "Render Months Label", "100": "Render Month Label", "101": "Render Weekday Label", "102": "Render Year Label", "103": "Start Of Week", "104": "Weekend ClassName", "105": "Weekend Styling", "106": "Icon Name Helpers", "107": "Media Placeholder Icons", "108": "Utility Icons", "109": "Commerce Icons", "110": "Data Usage Icons", "111": "Peer Dependencies", "112": "Table Render", "113": "Theme Docs", "114": "Number Formatting", "115": "Virtualized Index Helpers", "116": "Docs Scope", "117": "Auto Scroll Props", "118": "Content Props", "119": "Content ClassName", "120": "Footer Props", "121": "Icon Props", "122": "Max Height Props", "123": "No Scroll Props", "124": "Subtitle Props", "125": "Subtitle ClassName", "126": "Title Props", "127": "Title ClassName", "128": "Trigger Props", "129": "Trigger ClassName", "130": "Width Props", "131": "Docs Examples", "132": "Expand Types", "133": "Brand Avatar Icons", "134": "Communication Action Icons", "135": "Status Action Icons", "136": "OAuth Brand Icons", "137": "View Fullscreen Icons", "138": "Add Remove Icons", "139": "Route Navigation Icons", "140": "Settings Tool Icons", "141": "Input Label Constants", "142": "Lazy Docs Example", "143": "More Docs Examples", "144": "Docs Scope Pages", "145": "Additional Docs Examples", "146": "Brand Logo Assets", "147": "Test Utilities", "148": "PostCSS Config", "149": "Single Doc Page", "150": "Gallery Dots", "151": "Docs Entry Point", "152": "Bookmark Icons", "153": "Drag Handler Icons", "154": "Lock Security Icons", "155": "Save Undo Icons", "156": "SVG Test Mock", "157": "Store Declarations", "158": "Global Window Types", "159": "Gallery Singleton", "160": "Minimize Prop", "161": "Forward Icon", "162": "Router Context", "163": "Router Store", "164": "Select Helpers", "165": "Theme Styl Types", "166": "Test Setup"}
@@ -0,0 +1 @@
1
+ /Users/oleh_1/.local/pipx/venvs/graphifyy/bin/python
@@ -0,0 +1 @@
1
+ /Users/oleh_1/prj/ui