@chayns-components/emoji-input 5.0.0-beta.90 → 5.0.0-beta.901

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 (228) hide show
  1. package/README.md +4 -15
  2. package/lib/{api → cjs/api}/item-storage/get.js +4 -5
  3. package/lib/cjs/api/item-storage/get.js.map +1 -0
  4. package/lib/{api → cjs/api}/item-storage/put.js +5 -6
  5. package/lib/cjs/api/item-storage/put.js.map +1 -0
  6. package/lib/cjs/components/emoji-input/EmojiInput.js +510 -0
  7. package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -0
  8. package/lib/cjs/components/emoji-input/EmojiInput.styles.js +132 -0
  9. package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -0
  10. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js +45 -0
  11. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  12. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js +65 -0
  13. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  14. package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.js +9 -11
  15. package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
  16. package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +3 -5
  17. package/lib/cjs/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  18. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +102 -0
  19. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  20. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +5 -6
  21. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  22. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
  23. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  24. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +69 -0
  25. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  26. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +49 -21
  27. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  28. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +24 -0
  29. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  30. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +130 -0
  31. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  32. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +99 -0
  33. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  34. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js +52 -0
  35. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  36. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js +15 -0
  37. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  38. package/lib/{constants → cjs/constants}/alignment.js +6 -8
  39. package/lib/cjs/constants/alignment.js.map +1 -0
  40. package/lib/{constants → cjs/constants}/categories.js +1 -2
  41. package/lib/cjs/constants/categories.js.map +1 -0
  42. package/lib/cjs/constants/emoji.js +3804 -0
  43. package/lib/cjs/constants/emoji.js.map +1 -0
  44. package/lib/cjs/constants/externalServerUrl.js +8 -0
  45. package/lib/cjs/constants/externalServerUrl.js.map +1 -0
  46. package/lib/cjs/constants/regex.js +15 -0
  47. package/lib/cjs/constants/regex.js.map +1 -0
  48. package/lib/{hooks → cjs/hooks}/emojiHistory.js +13 -15
  49. package/lib/cjs/hooks/emojiHistory.js.map +1 -0
  50. package/lib/{index.js → cjs/index.js} +3 -3
  51. package/lib/cjs/index.js.map +1 -0
  52. package/lib/cjs/types/api.js +2 -0
  53. package/lib/cjs/types/api.js.map +1 -0
  54. package/lib/cjs/types/category.js +2 -0
  55. package/lib/cjs/types/category.js.map +1 -0
  56. package/lib/cjs/utils/emoji.js +104 -0
  57. package/lib/cjs/utils/emoji.js.map +1 -0
  58. package/lib/{utils → cjs/utils}/environment.js +6 -4
  59. package/lib/cjs/utils/environment.js.map +1 -0
  60. package/lib/cjs/utils/font.js +17 -0
  61. package/lib/cjs/utils/font.js.map +1 -0
  62. package/lib/cjs/utils/insert.js +110 -0
  63. package/lib/cjs/utils/insert.js.map +1 -0
  64. package/lib/cjs/utils/number.js +17 -0
  65. package/lib/cjs/utils/number.js.map +1 -0
  66. package/lib/cjs/utils/selection.js +255 -0
  67. package/lib/cjs/utils/selection.js.map +1 -0
  68. package/lib/cjs/utils/text.js +57 -0
  69. package/lib/cjs/utils/text.js.map +1 -0
  70. package/lib/esm/api/item-storage/get.js +30 -0
  71. package/lib/esm/api/item-storage/get.js.map +1 -0
  72. package/lib/esm/api/item-storage/put.js +35 -0
  73. package/lib/esm/api/item-storage/put.js.map +1 -0
  74. package/lib/esm/components/emoji-input/EmojiInput.js +497 -0
  75. package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
  76. package/lib/esm/components/emoji-input/EmojiInput.styles.js +151 -0
  77. package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
  78. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +38 -0
  79. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  80. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +69 -0
  81. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  82. package/lib/esm/components/emoji-picker/EmojiPicker.js +40 -0
  83. package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
  84. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
  85. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  86. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +96 -0
  87. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  88. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
  89. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  90. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
  91. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  92. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +76 -0
  93. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  94. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +136 -0
  95. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  96. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +20 -0
  97. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  98. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +121 -0
  99. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  100. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
  101. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  102. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +43 -0
  103. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  104. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
  105. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  106. package/lib/esm/constants/alignment.js +13 -0
  107. package/lib/esm/constants/alignment.js.map +1 -0
  108. package/lib/esm/constants/categories.js +13 -0
  109. package/lib/esm/constants/categories.js.map +1 -0
  110. package/lib/esm/constants/emoji-de-DE.json +3827 -0
  111. package/lib/esm/constants/emoji.js +3798 -0
  112. package/lib/esm/constants/emoji.js.map +1 -0
  113. package/lib/esm/constants/externalServerUrl.js +2 -0
  114. package/lib/esm/constants/externalServerUrl.js.map +1 -0
  115. package/lib/esm/constants/regex.js +9 -0
  116. package/lib/esm/constants/regex.js.map +1 -0
  117. package/lib/esm/hooks/emojiHistory.js +83 -0
  118. package/lib/esm/hooks/emojiHistory.js.map +1 -0
  119. package/lib/{index.d.ts → esm/index.js} +2 -1
  120. package/lib/esm/index.js.map +1 -0
  121. package/lib/esm/types/api.js +2 -0
  122. package/lib/esm/types/api.js.map +1 -0
  123. package/lib/esm/types/category.js +2 -0
  124. package/lib/esm/types/category.js.map +1 -0
  125. package/lib/esm/utils/emoji.js +92 -0
  126. package/lib/esm/utils/emoji.js.map +1 -0
  127. package/lib/esm/utils/environment.js +24 -0
  128. package/lib/esm/utils/environment.js.map +1 -0
  129. package/lib/esm/utils/font.js +10 -0
  130. package/lib/esm/utils/font.js.map +1 -0
  131. package/lib/esm/utils/insert.js +104 -0
  132. package/lib/esm/utils/insert.js.map +1 -0
  133. package/lib/esm/utils/number.js +10 -0
  134. package/lib/esm/utils/number.js.map +1 -0
  135. package/lib/esm/utils/selection.js +237 -0
  136. package/lib/esm/utils/selection.js.map +1 -0
  137. package/lib/esm/utils/text.js +48 -0
  138. package/lib/esm/utils/text.js.map +1 -0
  139. package/lib/types/components/emoji-input/EmojiInput.d.ts +94 -0
  140. package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +549 -0
  141. package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
  142. package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
  143. package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
  144. package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +267 -0
  145. package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +10 -0
  146. package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +5 -0
  147. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
  148. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +283 -0
  149. package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
  150. package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
  151. package/lib/types/constants/emoji.d.ts +8 -0
  152. package/lib/types/constants/regex.d.ts +8 -0
  153. package/lib/types/index.d.ts +6 -0
  154. package/lib/types/utils/emoji.d.ts +4 -0
  155. package/lib/{utils → types/utils}/environment.d.ts +1 -0
  156. package/lib/types/utils/font.d.ts +1 -0
  157. package/lib/types/utils/insert.d.ts +26 -0
  158. package/lib/types/utils/number.d.ts +1 -0
  159. package/lib/types/utils/selection.d.ts +23 -0
  160. package/lib/types/utils/text.d.ts +3 -0
  161. package/package.json +48 -30
  162. package/lib/api/item-storage/get.js.map +0 -1
  163. package/lib/api/item-storage/put.js.map +0 -1
  164. package/lib/components/emoji-input/EmojiInput.d.ts +0 -49
  165. package/lib/components/emoji-input/EmojiInput.js +0 -168
  166. package/lib/components/emoji-input/EmojiInput.js.map +0 -1
  167. package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -16
  168. package/lib/components/emoji-input/EmojiInput.styles.js +0 -152
  169. package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
  170. package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
  171. package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
  172. package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
  173. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
  174. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
  175. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
  176. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
  177. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
  178. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
  179. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
  180. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
  181. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
  182. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
  183. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
  184. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +0 -20
  185. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
  186. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
  187. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
  188. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
  189. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
  190. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
  191. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
  192. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
  193. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
  194. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
  195. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
  196. package/lib/constants/alignment.js.map +0 -1
  197. package/lib/constants/categories.js.map +0 -1
  198. package/lib/constants/externalServerUrl.js +0 -9
  199. package/lib/constants/externalServerUrl.js.map +0 -1
  200. package/lib/hooks/emojiHistory.js.map +0 -1
  201. package/lib/index.js.map +0 -1
  202. package/lib/types/api.js +0 -6
  203. package/lib/types/api.js.map +0 -1
  204. package/lib/types/category.js +0 -6
  205. package/lib/types/category.js.map +0 -1
  206. package/lib/utils/emoji.d.ts +0 -2
  207. package/lib/utils/emoji.js +0 -205
  208. package/lib/utils/emoji.js.map +0 -1
  209. package/lib/utils/environment.js.map +0 -1
  210. package/lib/utils/font.d.ts +0 -1
  211. package/lib/utils/font.js +0 -15
  212. package/lib/utils/font.js.map +0 -1
  213. package/lib/utils/selection.d.ts +0 -2
  214. package/lib/utils/selection.js +0 -43
  215. package/lib/utils/selection.js.map +0 -1
  216. /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
  217. /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
  218. /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
  219. /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
  220. /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
  221. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
  222. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +0 -0
  223. /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
  224. /package/lib/{constants → types/constants}/categories.d.ts +0 -0
  225. /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
  226. /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
  227. /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
  228. /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ export const ITEM_STORAGE_BASE_URL = 'https://cube.tobit.cloud/item-storage/api/v1.0/schemes';
2
+ //# sourceMappingURL=externalServerUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalServerUrl.js","names":["ITEM_STORAGE_BASE_URL"],"sources":["../../../src/constants/externalServerUrl.ts"],"sourcesContent":["export const ITEM_STORAGE_BASE_URL = 'https://cube.tobit.cloud/item-storage/api/v1.0/schemes';\n"],"mappings":"AAAA,OAAO,MAAMA,qBAAqB,GAAG,wDAAwD","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ export const BB_LC_MENTION_REGEX = /\[lc_mention.+?id="([^"]+?)"](.+?)\[\/lc_mention]/g;
2
+ export const BB_NER_IGNORE_REGEX = /\[nerIgnore](.+?)\[\/nerIgnore]/g;
3
+ export const BB_NER_REPLACE_REGEX = /\[nerReplace\s*(?:prefix="(.*?)")?\s*type="(.*?)"\s*value="(.*?)"](.*?)\[\/nerReplace]/gi;
4
+ export const HTML_LC_MENTION_REGEX = /<lc_mention.+?id="([^"]+?)">(?:<span.*?<\/span>)*(.+?)<\/lc_mention>/g;
5
+ export const HTML_NER_IGNORE_REGEX = /<nerIgnore>(.+?)<\/nerIgnore>/g;
6
+ export const HTML_NER_REPLACE_REGEX = /<nerReplace\s*(?:prefix="(.*?)")?\s*type="(.*?)"\s*value="(.*?)">(.*?)<\/nerReplace>/gi;
7
+ export const HTML_BOLD_REGEX = /<b>(.+?)<\/b>/g;
8
+ export const HTML_A_TAG_REGEX = /(?:<|&lt;)a\b[^>]*?(?:>|&gt;)(.*?)(?:<|&lt;)\/a(?:>|&gt;)/g;
9
+ //# sourceMappingURL=regex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.js","names":["BB_LC_MENTION_REGEX","BB_NER_IGNORE_REGEX","BB_NER_REPLACE_REGEX","HTML_LC_MENTION_REGEX","HTML_NER_IGNORE_REGEX","HTML_NER_REPLACE_REGEX","HTML_BOLD_REGEX","HTML_A_TAG_REGEX"],"sources":["../../../src/constants/regex.ts"],"sourcesContent":["export const BB_LC_MENTION_REGEX = /\\[lc_mention.+?id=\"([^\"]+?)\"](.+?)\\[\\/lc_mention]/g;\nexport const BB_NER_IGNORE_REGEX = /\\[nerIgnore](.+?)\\[\\/nerIgnore]/g;\nexport const BB_NER_REPLACE_REGEX =\n /\\[nerReplace\\s*(?:prefix=\"(.*?)\")?\\s*type=\"(.*?)\"\\s*value=\"(.*?)\"](.*?)\\[\\/nerReplace]/gi;\n\nexport const HTML_LC_MENTION_REGEX =\n /<lc_mention.+?id=\"([^\"]+?)\">(?:<span.*?<\\/span>)*(.+?)<\\/lc_mention>/g;\nexport const HTML_NER_IGNORE_REGEX = /<nerIgnore>(.+?)<\\/nerIgnore>/g;\nexport const HTML_NER_REPLACE_REGEX =\n /<nerReplace\\s*(?:prefix=\"(.*?)\")?\\s*type=\"(.*?)\"\\s*value=\"(.*?)\">(.*?)<\\/nerReplace>/gi;\nexport const HTML_BOLD_REGEX = /<b>(.+?)<\\/b>/g;\nexport const HTML_A_TAG_REGEX = /(?:<|&lt;)a\\b[^>]*?(?:>|&gt;)(.*?)(?:<|&lt;)\\/a(?:>|&gt;)/g;\n"],"mappings":"AAAA,OAAO,MAAMA,mBAAmB,GAAG,oDAAoD;AACvF,OAAO,MAAMC,mBAAmB,GAAG,kCAAkC;AACrE,OAAO,MAAMC,oBAAoB,GAC7B,0FAA0F;AAE9F,OAAO,MAAMC,qBAAqB,GAC9B,uEAAuE;AAC3E,OAAO,MAAMC,qBAAqB,GAAG,gCAAgC;AACrE,OAAO,MAAMC,sBAAsB,GAC/B,wFAAwF;AAC5F,OAAO,MAAMC,eAAe,GAAG,gBAAgB;AAC/C,OAAO,MAAMC,gBAAgB,GAAG,4DAA4D","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { getEmojiHistory } from '../api/item-storage/get';
3
+ import { putEmojiHistory } from '../api/item-storage/put';
4
+ export const useEmojiHistory = _ref => {
5
+ let {
6
+ accessToken,
7
+ personId,
8
+ selectedCategory
9
+ } = _ref;
10
+ const [historyEmojis, setHistoryEmojis] = useState([]);
11
+ const tempHistoryEmojis = useRef(null);
12
+ const addOrUpdateEmojiInHistory = useCallback(async _ref2 => {
13
+ let {
14
+ emoji,
15
+ name,
16
+ skin_tone_support
17
+ } = _ref2;
18
+ if (typeof accessToken !== 'string' || typeof personId !== 'string') {
19
+ return;
20
+ }
21
+ const newHistoryEmojis = Array.from(tempHistoryEmojis.current ?? historyEmojis);
22
+ const historyItemIndex = newHistoryEmojis.findIndex(item => item.emoji === emoji);
23
+ let historyItem;
24
+ if (historyItemIndex > -1) {
25
+ [historyItem] = newHistoryEmojis.splice(historyItemIndex, 1);
26
+ }
27
+ newHistoryEmojis.push({
28
+ count: (historyItem?.count ?? 0) + 1,
29
+ emoji,
30
+ modifiedTime: new Date().toISOString(),
31
+ name,
32
+ skin_tone_support
33
+ });
34
+ newHistoryEmojis.sort((a, b) => {
35
+ if (a.count === b.count) {
36
+ return new Date(b.modifiedTime).getTime() - new Date(a.modifiedTime).getTime();
37
+ }
38
+ return b.count - a.count;
39
+ });
40
+ const {
41
+ data
42
+ } = await putEmojiHistory({
43
+ accessToken,
44
+ personId,
45
+ value: newHistoryEmojis.slice(0, 50)
46
+ });
47
+ if (data) {
48
+ if (selectedCategory === 'history') {
49
+ tempHistoryEmojis.current = data;
50
+ } else {
51
+ tempHistoryEmojis.current = null;
52
+ setHistoryEmojis(data);
53
+ }
54
+ }
55
+ }, [accessToken, historyEmojis, personId, selectedCategory]);
56
+ const loadHistoryEmojis = useCallback(async () => {
57
+ if (typeof accessToken !== 'string' || typeof personId !== 'string') {
58
+ return;
59
+ }
60
+ const {
61
+ data
62
+ } = await getEmojiHistory({
63
+ accessToken,
64
+ personId
65
+ });
66
+ if (data) {
67
+ setHistoryEmojis(data);
68
+ }
69
+ }, [accessToken, personId]);
70
+ useEffect(() => {
71
+ void loadHistoryEmojis();
72
+ }, [loadHistoryEmojis]);
73
+ useEffect(() => {
74
+ if (selectedCategory !== 'history' && tempHistoryEmojis.current) {
75
+ setHistoryEmojis(tempHistoryEmojis.current);
76
+ }
77
+ }, [selectedCategory]);
78
+ return {
79
+ addOrUpdateEmojiInHistory,
80
+ historyEmojis: historyEmojis.slice(0, 25)
81
+ };
82
+ };
83
+ //# sourceMappingURL=emojiHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emojiHistory.js","names":["useCallback","useEffect","useRef","useState","getEmojiHistory","putEmojiHistory","useEmojiHistory","_ref","accessToken","personId","selectedCategory","historyEmojis","setHistoryEmojis","tempHistoryEmojis","addOrUpdateEmojiInHistory","_ref2","emoji","name","skin_tone_support","newHistoryEmojis","Array","from","current","historyItemIndex","findIndex","item","historyItem","splice","push","count","modifiedTime","Date","toISOString","sort","a","b","getTime","data","value","slice","loadHistoryEmojis"],"sources":["../../../src/hooks/emojiHistory.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { getEmojiHistory } from '../api/item-storage/get';\nimport { putEmojiHistory } from '../api/item-storage/put';\nimport type { Category } from '../types/category';\n\nexport interface HistoryItem {\n count: number;\n emoji: string;\n modifiedTime: string;\n name: string;\n skin_tone_support: boolean;\n}\n\ninterface UseEmojiHistoryOptions {\n accessToken?: string;\n personId?: string;\n selectedCategory: Category;\n}\n\nexport const useEmojiHistory = ({\n accessToken,\n personId,\n selectedCategory,\n}: UseEmojiHistoryOptions) => {\n const [historyEmojis, setHistoryEmojis] = useState<HistoryItem[]>([]);\n\n const tempHistoryEmojis = useRef<HistoryItem[] | null>(null);\n\n const addOrUpdateEmojiInHistory = useCallback(\n async ({\n emoji,\n name,\n skin_tone_support,\n }: {\n emoji: string;\n name: string;\n skin_tone_support: boolean;\n }) => {\n if (typeof accessToken !== 'string' || typeof personId !== 'string') {\n return;\n }\n\n const newHistoryEmojis = Array.from(tempHistoryEmojis.current ?? historyEmojis);\n\n const historyItemIndex = newHistoryEmojis.findIndex((item) => item.emoji === emoji);\n\n let historyItem;\n\n if (historyItemIndex > -1) {\n [historyItem] = newHistoryEmojis.splice(historyItemIndex, 1);\n }\n\n newHistoryEmojis.push({\n count: (historyItem?.count ?? 0) + 1,\n emoji,\n modifiedTime: new Date().toISOString(),\n name,\n skin_tone_support,\n });\n\n newHistoryEmojis.sort((a, b) => {\n if (a.count === b.count) {\n return new Date(b.modifiedTime).getTime() - new Date(a.modifiedTime).getTime();\n }\n\n return b.count - a.count;\n });\n\n const { data } = await putEmojiHistory({\n accessToken,\n personId,\n value: newHistoryEmojis.slice(0, 50),\n });\n\n if (data) {\n if (selectedCategory === 'history') {\n tempHistoryEmojis.current = data;\n } else {\n tempHistoryEmojis.current = null;\n\n setHistoryEmojis(data);\n }\n }\n },\n [accessToken, historyEmojis, personId, selectedCategory]\n );\n\n const loadHistoryEmojis = useCallback(async () => {\n if (typeof accessToken !== 'string' || typeof personId !== 'string') {\n return;\n }\n\n const { data } = await getEmojiHistory({ accessToken, personId });\n\n if (data) {\n setHistoryEmojis(data);\n }\n }, [accessToken, personId]);\n\n useEffect(() => {\n void loadHistoryEmojis();\n }, [loadHistoryEmojis]);\n\n useEffect(() => {\n if (selectedCategory !== 'history' && tempHistoryEmojis.current) {\n setHistoryEmojis(tempHistoryEmojis.current);\n }\n }, [selectedCategory]);\n\n return { addOrUpdateEmojiInHistory, historyEmojis: historyEmojis.slice(0, 25) };\n};\n"],"mappings":"AAA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AAE,CAACA,iBAAiB,CAAC,CAAC;EAEvBvC,SAAS,CAAC,MAAM;IACZ,IAAIS,gBAAgB,KAAK,SAAS,IAAIG,iBAAiB,CAACS,OAAO,EAAE;MAC7DV,gBAAgB,CAACC,iBAAiB,CAACS,OAAO,CAAC;IAC/C;EACJ,CAAC,EAAE,CAACZ,gBAAgB,CAAC,CAAC;EAEtB,OAAO;IAAEI,yBAAyB;IAAEH,aAAa,EAAEA,aAAa,CAAC4B,KAAK,CAAC,CAAC,EAAE,EAAE;EAAE,CAAC;AACnF,CAAC","ignoreList":[]}
@@ -2,4 +2,5 @@ export { default as EmojiInput } from './components/emoji-input/EmojiInput';
2
2
  export { default as EmojiPickerPopup } from './components/emoji-picker-popup/EmojiPickerPopup';
3
3
  export { default as EmojiPicker } from './components/emoji-picker/EmojiPicker';
4
4
  export { PopupAlignment } from './constants/alignment';
5
- export { convertAsciiToUnicode } from './utils/emoji';
5
+ export { convertEmojisToUnicode } from './utils/emoji';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["default","EmojiInput","EmojiPickerPopup","EmojiPicker","PopupAlignment","convertEmojisToUnicode"],"sources":["../../src/index.ts"],"sourcesContent":["export { default as EmojiInput } from './components/emoji-input/EmojiInput';\nexport type { EmojiInputRef } from './components/emoji-input/EmojiInput';\nexport { default as EmojiPickerPopup } from './components/emoji-picker-popup/EmojiPickerPopup';\nexport { default as EmojiPicker } from './components/emoji-picker/EmojiPicker';\nexport { PopupAlignment } from './constants/alignment';\nexport { convertEmojisToUnicode } from './utils/emoji';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,UAAU,QAAQ,qCAAqC;AAE3E,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,kDAAkD;AAC9F,SAASF,OAAO,IAAIG,WAAW,QAAQ,uCAAuC;AAC9E,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,sBAAsB,QAAQ,eAAe","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../../src/types/api.ts"],"sourcesContent":["export interface ApiFunctionResult<T = null> {\n data?: T;\n status?: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.js","names":[],"sources":["../../../src/types/category.ts"],"sourcesContent":["export type Category =\n | 'history'\n | 'smileys_emotion'\n | 'people_body'\n | 'animals_nature'\n | 'food_drink'\n | 'travel_places'\n | 'activities'\n | 'objects'\n | 'symbols'\n | 'flags';\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ import emojiList from 'unicode-emoji-json/data-by-emoji.json';
2
+ import { asciiList, regAscii, regShortnames, shortNameList } from '../constants/emoji';
3
+ const convert = unicode => {
4
+ if (unicode.indexOf('-') > -1) {
5
+ const parts = [];
6
+ const s = unicode.split('-');
7
+ for (let i = 0; i < s.length; i++) {
8
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9
+ let part = parseInt(s[i], 16);
10
+ if (part >= 0x10000 && part <= 0x10ffff) {
11
+ const hi = Math.floor((part - 0x10000) / 0x400) + 0xd800;
12
+ const lo = (part - 0x10000) % 0x400 + 0xdc00;
13
+ part = String.fromCharCode(hi) + String.fromCharCode(lo);
14
+ } else {
15
+ part = String.fromCharCode(part);
16
+ }
17
+ parts.push(part);
18
+ }
19
+ return parts.join('');
20
+ }
21
+ const s = parseInt(unicode, 16);
22
+ if (s >= 0x10000 && s <= 0x10ffff) {
23
+ const hi = Math.floor((s - 0x10000) / 0x400) + 0xd800;
24
+ const lo = (s - 0x10000) % 0x400 + 0xdc00;
25
+ return String.fromCharCode(hi) + String.fromCharCode(lo);
26
+ }
27
+ return String.fromCharCode(s);
28
+ };
29
+ export const unescapeHTML = text => {
30
+ const unescaped = {
31
+ '&amp;': '&',
32
+ '&#38;': '&',
33
+ '&#x26;': '&',
34
+ '&lt;': '<',
35
+ '&#60;': '<',
36
+ '&#x3C;': '<',
37
+ '&gt;': '>',
38
+ '&#62;': '>',
39
+ '&#x3E;': '>',
40
+ '&quot;': '"',
41
+ '&#34;': '"',
42
+ '&#x22;': '"',
43
+ '&apos;': "'",
44
+ '&#39;': "'",
45
+ '&#x27;': "'"
46
+ };
47
+ return text.replace(/&(?:amp|#38|#x26|lt|#60|#x3C|gt|#62|#x3E|apos|#39|#x27|quot|#34|#x22);/gi, match => unescaped[match] ?? match);
48
+ };
49
+ export const escapeHTML = text => {
50
+ const escaped = {
51
+ '<': '&lt;',
52
+ '>': '&gt;',
53
+ '"': '&quot;',
54
+ "'": '&apos;'
55
+ };
56
+ return text.replace(/[&<>"']/g, match => escaped[match] ?? match);
57
+ };
58
+ export const convertEmojisToUnicode = text => {
59
+ let result = text;
60
+ result = result.replace(/https?:\/\/.*?(?=$|\s)/gi, fullMatch => fullMatch.replace(/:/g, '%3A'));
61
+ result = result.replace(regShortnames, shortname => {
62
+ if (shortname) {
63
+ const unicode = shortNameList[shortname];
64
+ if (unicode) {
65
+ return convert(unicode.toUpperCase());
66
+ }
67
+ }
68
+ return shortname;
69
+ });
70
+ result = result.replace(/https?%3A\/\/.*?(?=$|\s)/gi, fullMatch => fullMatch.replace(/%3A/g, ':'));
71
+ result = result.replace(regAscii, (fullMatch, m1, m2, m3) => {
72
+ if (typeof m3 === 'string' && m3 !== '') {
73
+ const unicode = asciiList[unescapeHTML(m3)];
74
+ if (unicode) {
75
+ return m2 + convert(unicode.toUpperCase());
76
+ }
77
+ }
78
+ return fullMatch;
79
+ });
80
+ return result;
81
+ };
82
+ export const addSkinToneToEmoji = (emoji, skinTone) => emoji.split('\u{200D}').map(rawEmoji => {
83
+ const parts = [rawEmoji.replace(/\ufe0f/, '')];
84
+
85
+ // @ts-expect-error: Difficult to type external json file
86
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
87
+ if (emojiList[rawEmoji]?.skin_tone_support) {
88
+ parts.push(skinTone);
89
+ }
90
+ return parts.join('');
91
+ }).join('\u{200D}');
92
+ //# sourceMappingURL=emoji.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emoji.js","names":["emojiList","asciiList","regAscii","regShortnames","shortNameList","convert","unicode","indexOf","parts","s","split","i","length","part","parseInt","hi","Math","floor","lo","String","fromCharCode","push","join","unescapeHTML","text","unescaped","replace","match","escapeHTML","escaped","convertEmojisToUnicode","result","fullMatch","shortname","toUpperCase","m1","m2","m3","addSkinToneToEmoji","emoji","skinTone","map","rawEmoji","skin_tone_support"],"sources":["../../../src/utils/emoji.ts"],"sourcesContent":["import emojiList from 'unicode-emoji-json/data-by-emoji.json';\nimport { asciiList, regAscii, regShortnames, shortNameList } from '../constants/emoji';\n\nconst convert = (unicode: string) => {\n if (unicode.indexOf('-') > -1) {\n const parts = [];\n\n const s = unicode.split('-');\n\n for (let i = 0; i < s.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n let part: number | string = parseInt(s[i]!, 16);\n\n if (part >= 0x10000 && part <= 0x10ffff) {\n const hi = Math.floor((part - 0x10000) / 0x400) + 0xd800;\n const lo = ((part - 0x10000) % 0x400) + 0xdc00;\n\n part = String.fromCharCode(hi) + String.fromCharCode(lo);\n } else {\n part = String.fromCharCode(part);\n }\n\n parts.push(part);\n }\n\n return parts.join('');\n }\n\n const s = parseInt(unicode, 16);\n\n if (s >= 0x10000 && s <= 0x10ffff) {\n const hi = Math.floor((s - 0x10000) / 0x400) + 0xd800;\n const lo = ((s - 0x10000) % 0x400) + 0xdc00;\n\n return String.fromCharCode(hi) + String.fromCharCode(lo);\n }\n\n return String.fromCharCode(s);\n};\n\nexport const unescapeHTML = (text: string) => {\n const unescaped: { [key: string]: string } = {\n '&amp;': '&',\n '&#38;': '&',\n '&#x26;': '&',\n '&lt;': '<',\n '&#60;': '<',\n '&#x3C;': '<',\n '&gt;': '>',\n '&#62;': '>',\n '&#x3E;': '>',\n '&quot;': '\"',\n '&#34;': '\"',\n '&#x22;': '\"',\n '&apos;': \"'\",\n '&#39;': \"'\",\n '&#x27;': \"'\",\n };\n\n return text.replace(\n /&(?:amp|#38|#x26|lt|#60|#x3C|gt|#62|#x3E|apos|#39|#x27|quot|#34|#x22);/gi,\n (match) => unescaped[match] ?? match,\n );\n};\n\nexport const escapeHTML = (text: string) => {\n const escaped: { [key: string]: string } = {\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&apos;',\n };\n\n return text.replace(/[&<>\"']/g, (match) => escaped[match] ?? match);\n};\n\nexport const convertEmojisToUnicode = (text: string): string => {\n let result = text;\n\n result = result.replace(/https?:\\/\\/.*?(?=$|\\s)/gi, (fullMatch) =>\n fullMatch.replace(/:/g, '%3A'),\n );\n\n result = result.replace(regShortnames, (shortname) => {\n if (shortname) {\n const unicode = shortNameList[shortname];\n\n if (unicode) {\n return convert(unicode.toUpperCase());\n }\n }\n\n return shortname;\n });\n\n result = result.replace(/https?%3A\\/\\/.*?(?=$|\\s)/gi, (fullMatch) =>\n fullMatch.replace(/%3A/g, ':'),\n );\n\n result = result.replace(regAscii, (fullMatch, m1, m2, m3) => {\n if (typeof m3 === 'string' && m3 !== '') {\n const unicode = asciiList[unescapeHTML(m3)];\n\n if (unicode) {\n return (m2 as string) + convert(unicode.toUpperCase());\n }\n }\n\n return fullMatch;\n });\n\n return result;\n};\n\nexport const addSkinToneToEmoji = (emoji: string, skinTone: string): string =>\n emoji\n .split('\\u{200D}')\n .map((rawEmoji) => {\n const parts = [rawEmoji.replace(/\\ufe0f/, '')];\n\n // @ts-expect-error: Difficult to type external json file\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (emojiList[rawEmoji]?.skin_tone_support) {\n parts.push(skinTone);\n }\n\n return parts.join('');\n })\n .join('\\u{200D}');\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,uCAAuC;AAC7D,SAASC,SAAS,EAAEC,Q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,CAACmB,QAAQ,CAAC;EACxB;EAEA,OAAOhC,KAAK,CAACc,IAAI,CAAC,EAAE,CAAC;AACzB,CAAC,CAAC,CACDA,IAAI,CAAC,UAAU,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ var DeviceType = /*#__PURE__*/function (DeviceType) {
2
+ DeviceType[DeviceType["Desktop"] = 0] = "Desktop";
3
+ DeviceType[DeviceType["Smartphone"] = 1] = "Smartphone";
4
+ DeviceType[DeviceType["Tablet"] = 2] = "Tablet";
5
+ return DeviceType;
6
+ }(DeviceType || {});
7
+ export const getDeviceType = () => {
8
+ const {
9
+ userAgent
10
+ } = navigator;
11
+ if (/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(userAgent)) {
12
+ return DeviceType.Smartphone;
13
+ }
14
+ if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(userAgent)) {
15
+ return DeviceType.Tablet;
16
+ }
17
+ return DeviceType.Desktop;
18
+ };
19
+ export const getIsMacOS = () => /Mac OS X/i.test(navigator.userAgent);
20
+ export const getIsMobile = () => {
21
+ const deviceType = getDeviceType();
22
+ return deviceType === DeviceType.Smartphone || deviceType === DeviceType.Tablet;
23
+ };
24
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","names":["DeviceType","getDeviceType","userAgent","navigator","test","Smartphone","Tablet","Desktop","getIsMacOS","getIsMobile","deviceType"],"sources":["../../../src/utils/environment.ts"],"sourcesContent":["enum DeviceType {\n Desktop,\n Smartphone,\n Tablet,\n}\n\nexport const getDeviceType = (): DeviceType => {\n const { userAgent } = navigator;\n\n if (\n /Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(\n userAgent,\n )\n ) {\n return DeviceType.Smartphone;\n }\n\n if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(userAgent)) {\n return DeviceType.Tablet;\n }\n\n return DeviceType.Desktop;\n};\n\nexport const getIsMacOS = () => /Mac OS X/i.test(navigator.userAgent);\n\nexport const getIsMobile = (): boolean => {\n const deviceType = getDeviceType();\n\n return deviceType === DeviceType.Smartphone || deviceType === DeviceType.Tablet;\n};\n"],"mappings":"IAAKA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA,EAAVA,UAAU;AAMf,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAM;IAAEC;EAAU,CAAC,GAAGC,SAAS;EAE/B,IACI,qGAAqG,CAACC,IAAI,CACtGF,SACJ,CAAC,EACH;IACE,OAAOF,UAAU,CAACK,UAAU;EAChC;EAEA,IAAI,kDAAkD,CAACD,IAAI,CAACF,SAAS,CAAC,EAAE;IACpE,OAAOF,UAAU,CAACM,MAAM;EAC5B;EAEA,OAAON,UAAU,CAACO,OAAO;AAC7B,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAM,WAAW,CAACJ,IAAI,CAACD,SAAS,CAACD,SAAS,CAAC;AAErE,OAAO,MAAMO,WAAW,GAAGA,CAAA,KAAe;EACtC,MAAMC,UAAU,GAAGT,aAAa,CAAC,CAAC;EAElC,OAAOS,UAAU,KAAKV,UAAU,CAACK,UAAU,IAAIK,UAAU,KAAKV,UAAU,CAACM,MAAM;AACnF,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { getIsMacOS, getIsMobile } from './environment';
2
+ const getRootFontFamily = () => {
3
+ const rootElement = document.querySelector(':root');
4
+ if (!rootElement) {
5
+ return '';
6
+ }
7
+ return window.getComputedStyle(rootElement).getPropertyValue('font-family');
8
+ };
9
+ export const getFontFamily = () => `${getRootFontFamily()}${getIsMobile() || getIsMacOS() ? '' : ', Noto Color Emoji'}, serif`;
10
+ //# sourceMappingURL=font.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font.js","names":["getIsMacOS","getIsMobile","getRootFontFamily","rootElement","document","querySelector","window","getComputedStyle","getPropertyValue","getFontFamily"],"sources":["../../../src/utils/font.ts"],"sourcesContent":["import { getIsMacOS, getIsMobile } from './environment';\n\nconst getRootFontFamily = () => {\n const rootElement = document.querySelector(':root');\n\n if (!rootElement) {\n return '';\n }\n\n return window.getComputedStyle(rootElement).getPropertyValue('font-family');\n};\n\nexport const getFontFamily = () =>\n `${getRootFontFamily()}${getIsMobile() || getIsMacOS() ? '' : ', Noto Color Emoji'}, serif`;\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,WAAW,QAAQ,eAAe;AAEvD,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EAC5B,MAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;EAEnD,IAAI,CAACF,WAAW,EAAE;IACd,OAAO,EAAE;EACb;EAEA,OAAOG,MAAM,CAACC,gBAAgB,CAACJ,WAAW,CAAC,CAACK,gBAAgB,CAAC,aAAa,CAAC;AAC/E,CAAC;AAED,OAAO,MAAMC,aAAa,GAAGA,CAAA,KACzB,GAAGP,iBAAiB,CAAC,CAAC,GAAGD,WAAW,CAAC,CAAC,IAAID,UAAU,CAAC,CAAC,GAAG,EAAE,GAAG,oBAAoB,SAAS","ignoreList":[]}
@@ -0,0 +1,104 @@
1
+ import { findAndSelectText, moveSelectionOffset, restoreSelection, saveSelection, setChildIndex } from './selection';
2
+ /**
3
+ * This function inserts the passed text at the correct position in the editor element. If the
4
+ * element has the focus, the new emoji is inserted at the cursor position. If not, the emoji
5
+ * will be appended to the back of the input field content.
6
+ *
7
+ * In addition, this function also sets the cursor to the correct position when the input field
8
+ * has the focus. For this purpose, the current position of the cursor or a selection is read to
9
+ * calculate the cursor position after inserting the text.
10
+ *
11
+ * @param {Object} options - Object with element and text to insert
12
+ * @param {HTMLDivElement} options.editorElement - Element to insert text into
13
+ * @param {string} options.text - Text to insert into element
14
+ */
15
+ export const insertTextAtCursorPosition = _ref => {
16
+ let {
17
+ editorElement,
18
+ text,
19
+ shouldUseSavedSelection = false
20
+ } = _ref;
21
+ if (shouldUseSavedSelection) {
22
+ restoreSelection(editorElement);
23
+ }
24
+ const selection = window.getSelection();
25
+ saveSelection(editorElement);
26
+ if (selection?.anchorNode && editorElement.contains(selection.anchorNode)) {
27
+ let range = selection.getRangeAt(0);
28
+ const parts = text.split(/\r\n|\r|\n/);
29
+ const firstPart = parts.shift();
30
+ const textNodes = parts.map(part => document.createTextNode(part));
31
+ range.deleteContents();
32
+ if (firstPart) {
33
+ if (selection.anchorNode.nodeType === Node.TEXT_NODE) {
34
+ const {
35
+ nodeValue
36
+ } = selection.anchorNode;
37
+ if (typeof nodeValue === 'string') {
38
+ selection.anchorNode.nodeValue = nodeValue.slice(0, range.startOffset) + firstPart + nodeValue.slice(range.startOffset);
39
+ moveSelectionOffset(firstPart.length);
40
+ }
41
+ } else if (selection.anchorNode === editorElement) {
42
+ const textNode = document.createTextNode(firstPart);
43
+
44
+ // Inserts the text node before the node at the anchor offset.
45
+ // If that node doesn't exist, the text node is appended to the editor, as a fallback. I'm not sure if there is any case where this would happen.
46
+ const insertBefore = editorElement.childNodes[selection.anchorOffset];
47
+ if (insertBefore) {
48
+ insertBefore.before(textNode);
49
+ } else {
50
+ editorElement.appendChild(textNode);
51
+ }
52
+ const textNodeIndex = Array.from(editorElement.childNodes).indexOf(textNode);
53
+ moveSelectionOffset(firstPart.length);
54
+ setChildIndex(textNodeIndex);
55
+ }
56
+ }
57
+ restoreSelection(editorElement);
58
+ if (textNodes.length > 0) {
59
+ range = selection.getRangeAt(0);
60
+ let brElement = document.createElement('br');
61
+ range.insertNode(brElement);
62
+ range.setEndAfter(brElement);
63
+ range.setStartAfter(brElement);
64
+ textNodes.forEach((textNode, index) => {
65
+ range.insertNode(textNode);
66
+ range.setEndAfter(textNode);
67
+ range.setStartAfter(textNode);
68
+ if (index !== textNodes.length - 1) {
69
+ brElement = document.createElement('br');
70
+ range.insertNode(brElement);
71
+ range.setEndAfter(brElement);
72
+ range.setStartAfter(brElement);
73
+ }
74
+ });
75
+ range.collapse(false);
76
+ selection.removeAllRanges();
77
+ selection.addRange(range);
78
+ }
79
+ } else {
80
+ // eslint-disable-next-line no-param-reassign
81
+ editorElement.innerText += text;
82
+ }
83
+ };
84
+ export const replaceText = _ref2 => {
85
+ let {
86
+ editorElement,
87
+ searchText,
88
+ pasteText
89
+ } = _ref2;
90
+ const selection = window.getSelection();
91
+ const rangeToReplace = findAndSelectText({
92
+ editorElement,
93
+ searchText
94
+ });
95
+ if (rangeToReplace && selection) {
96
+ selection.removeAllRanges();
97
+ selection.addRange(rangeToReplace);
98
+ insertTextAtCursorPosition({
99
+ editorElement,
100
+ text: pasteText
101
+ });
102
+ }
103
+ };
104
+ //# sourceMappingURL=insert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insert.js","names":["findAndSelectText","moveSelectionOffset","restoreSelection","saveSelection","setChildIndex","insertTextAtCursorPosition","_ref","editorElement","text","shouldUseSavedSelection","selection","window","getSelection","anchorNode","contains","range","getRangeAt","parts","split","firstPart","shift","textNodes","map","part","document","createTextNode","deleteContents","nodeType","Node","TEXT_NODE","nodeValue","slice","startOffset","length","textNode","insertBefore","childNodes","anchorOffset","before","appendChild","textNodeIndex","Array","from","indexOf","brElement","createElement","insertNode","setEndAfter","setStartAfter","forEach","index","collapse","removeAllRanges","addRange","innerText","replaceText","_ref2","searchText","pasteText","rangeToReplace"],"sources":["../../../src/utils/insert.ts"],"sourcesContent":["import {\n findAndSelectText,\n moveSelectionOffset,\n restoreSelection,\n saveSelection,\n setChildIndex,\n} from './selection';\n\ninterface InsertTextAtCursorPositionOptions {\n editorElement: HTMLDivElement;\n text: string;\n shouldUseSavedSelection?: boolean;\n}\n\n/**\n * This function inserts the passed text at the correct position in the editor element. If the\n * element has the focus, the new emoji is inserted at the cursor position. If not, the emoji\n * will be appended to the back of the input field content.\n *\n * In addition, this function also sets the cursor to the correct position when the input field\n * has the focus. For this purpose, the current position of the cursor or a selection is read to\n * calculate the cursor position after inserting the text.\n *\n * @param {Object} options - Object with element and text to insert\n * @param {HTMLDivElement} options.editorElement - Element to insert text into\n * @param {string} options.text - Text to insert into element\n */\nexport const insertTextAtCursorPosition = ({\n editorElement,\n text,\n shouldUseSavedSelection = false,\n}: InsertTextAtCursorPositionOptions) => {\n if (shouldUseSavedSelection) {\n restoreSelection(editorElement);\n }\n\n const selection = window.getSelection();\n\n saveSelection(editorElement);\n\n if (selection?.anchorNode && editorElement.contains(selection.anchorNode)) {\n let range = selection.getRangeAt(0);\n\n const parts = text.split(/\\r\\n|\\r|\\n/);\n\n const firstPart = parts.shift();\n\n const textNodes = parts.map((part) => document.createTextNode(part));\n\n range.deleteContents();\n\n if (firstPart) {\n if (selection.anchorNode.nodeType === Node.TEXT_NODE) {\n const { nodeValue } = selection.anchorNode;\n\n if (typeof nodeValue === 'string') {\n selection.anchorNode.nodeValue =\n nodeValue.slice(0, range.startOffset) +\n firstPart +\n nodeValue.slice(range.startOffset);\n\n moveSelectionOffset(firstPart.length);\n }\n } else if (selection.anchorNode === editorElement) {\n const textNode = document.createTextNode(firstPart);\n\n // Inserts the text node before the node at the anchor offset.\n // If that node doesn't exist, the text node is appended to the editor, as a fallback. I'm not sure if there is any case where this would happen.\n const insertBefore = editorElement.childNodes[selection.anchorOffset];\n if (insertBefore) {\n insertBefore.before(textNode);\n } else {\n editorElement.appendChild(textNode);\n }\n\n const textNodeIndex = Array.from(editorElement.childNodes).indexOf(textNode);\n\n moveSelectionOffset(firstPart.length);\n setChildIndex(textNodeIndex);\n }\n }\n\n restoreSelection(editorElement);\n\n if (textNodes.length > 0) {\n range = selection.getRangeAt(0);\n\n let brElement = document.createElement('br');\n\n range.insertNode(brElement);\n range.setEndAfter(brElement);\n range.setStartAfter(brElement);\n\n textNodes.forEach((textNode, index) => {\n range.insertNode(textNode);\n range.setEndAfter(textNode);\n range.setStartAfter(textNode);\n\n if (index !== textNodes.length - 1) {\n brElement = document.createElement('br');\n\n range.insertNode(brElement);\n range.setEndAfter(brElement);\n range.setStartAfter(brElement);\n }\n });\n\n range.collapse(false);\n\n selection.removeAllRanges();\n selection.addRange(range);\n }\n } else {\n // eslint-disable-next-line no-param-reassign\n editorElement.innerText += text;\n }\n};\n\nexport interface ReplaceTextOptions {\n editorElement: HTMLDivElement;\n searchText: string;\n pasteText: string;\n}\n\nexport const replaceText = ({ editorElement, searchText, pasteText }: ReplaceTextOptions) => {\n const selection = window.getSelection();\n\n const rangeToReplace = findAndSelectText({ editorElement, searchText });\n\n if (rangeToReplace && selection) {\n selection.removeAllRanges();\n selection.addRange(rangeToReplace);\n\n insertTextAtCursorPosition({ editorElement, text: pasteText });\n }\n};\n"],"mappings":"AAAA,SACIA,iBAAiB,EACjBC,mBAAmB,EACnBC,gBAAgB,EAChBC,aAAa,EACbC,aAAa,QACV,aAAa;AAQpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAGC,IAAA,IAID;EAAA,IAJE;IACvCC,aAAa;IACbC,IAAI;IACJC,uBAAuB,GAAG;EACK,CAAC,GAAAH,IAAA;EAChC,IAAIG,uBAAuB,EAAE;IACzBP,gBAAgB,CAACK,aAAa,CAAC;EACnC;EAEA,MAAMG,SAAS,GAAGC,MAAM,CAACC,YAAY,CAAC,CAAC;EAEvCT,aAAa,CAACI,aAAa,CAAC;EAE5B,IAAIG,SAAS,EAAEG,UAAU,IAAIN,aAAa,CAACO,QAAQ,CAACJ,SAAS,CAACG,UAAU,CAAC,EAAE;IACvE,IAAIE,KAAK,GAAGL,SAAS,CAACM,UAAU,CAAC,CAAC,CAAC;IAEnC,MAAMC,KAAK,GAAGT,IAAI,CAACU,KAAK,CAAC,YAAY,CAAC;IAEtC,MAAMC,SAAS,GAAGF,KAAK,CAACG,KAAK,CAAC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AAG3D,iBAAiB,CAAC;IAAEO,aAAa;IAAEkD;EAAW,CAAC,CAAC;EAEvE,IAAIE,cAAc,IAAIjD,SAAS,EAAE;IAC7BA,SAAS,CAAC0C,eAAe,CAAC,CAAC;IAC3B1C,SAAS,CAAC2C,QAAQ,CAACM,cAAc,CAAC;IAElCtD,0BAA0B,CAAC;MAAEE,aAAa;MAAEC,IAAI,EAAEkD;IAAU,CAAC,CAAC;EAClE;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ export const clamp = (value, min, max) => {
2
+ if (value < min) {
3
+ return min;
4
+ }
5
+ if (value > max) {
6
+ return max;
7
+ }
8
+ return value;
9
+ };
10
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","names":["clamp","value","min","max"],"sources":["../../../src/utils/number.ts"],"sourcesContent":["export const clamp = (value: number, min: number, max: number) => {\n if (value < min) {\n return min;\n }\n\n if (value > max) {\n return max;\n }\n\n return value;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,KAAK,GAAGA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,KAAK;EAC9D,IAAIF,KAAK,GAAGC,GAAG,EAAE;IACb,OAAOA,GAAG;EACd;EAEA,IAAID,KAAK,GAAGE,GAAG,EAAE;IACb,OAAOA,GAAG;EACd;EAEA,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}