@exsto/ds 0.0.1-rc.10 → 0.0.1-rc.14

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 (187) hide show
  1. package/dist/date-picker.js +1 -344
  2. package/dist/index.js +75 -4511
  3. package/dist/rich-text-editor.js +3 -904
  4. package/dist/source-hash.txt +1 -0
  5. package/dist/styles.css +36 -28
  6. package/dist/theme.css +2 -1
  7. package/dist/ui/src/components/edyn/animated-number/animated-number.js +108 -0
  8. package/dist/ui/src/components/edyn/animated-number/animated-number.js.map +1 -0
  9. package/dist/ui/src/components/edyn/audio-player/audio-player.js +86 -0
  10. package/dist/ui/src/components/edyn/audio-player/audio-player.js.map +1 -0
  11. package/dist/ui/src/components/edyn/date-picker/date-picker.js +250 -0
  12. package/dist/ui/src/components/edyn/date-picker/date-picker.js.map +1 -0
  13. package/dist/ui/src/components/edyn/date-picker/date-text.js +105 -0
  14. package/dist/ui/src/components/edyn/date-picker/date-text.js.map +1 -0
  15. package/dist/ui/src/components/edyn/date-range-picker/date-range-picker.js +59 -0
  16. package/dist/ui/src/components/edyn/date-range-picker/date-range-picker.js.map +1 -0
  17. package/dist/ui/src/components/edyn/initials-avatar/initials-avatar.js +86 -0
  18. package/dist/ui/src/components/edyn/initials-avatar/initials-avatar.js.map +1 -0
  19. package/dist/ui/src/components/edyn/multi-select/multi-select.js +332 -0
  20. package/dist/ui/src/components/edyn/multi-select/multi-select.js.map +1 -0
  21. package/dist/ui/src/components/edyn/progress-line/progress-line.js +100 -0
  22. package/dist/ui/src/components/edyn/progress-line/progress-line.js.map +1 -0
  23. package/dist/ui/src/components/edyn/rich-text-content/allow-list.js +37 -0
  24. package/dist/ui/src/components/edyn/rich-text-content/allow-list.js.map +1 -0
  25. package/dist/ui/src/components/edyn/rich-text-content/rich-text-content.js +124 -0
  26. package/dist/ui/src/components/edyn/rich-text-content/rich-text-content.js.map +1 -0
  27. package/dist/ui/src/components/edyn/rich-text-editor/extensions.js +124 -0
  28. package/dist/ui/src/components/edyn/rich-text-editor/extensions.js.map +1 -0
  29. package/dist/ui/src/components/edyn/rich-text-editor/mention-list.js +232 -0
  30. package/dist/ui/src/components/edyn/rich-text-editor/mention-list.js.map +1 -0
  31. package/dist/ui/src/components/edyn/rich-text-editor/rich-text-editor.js +244 -0
  32. package/dist/ui/src/components/edyn/rich-text-editor/rich-text-editor.js.map +1 -0
  33. package/dist/ui/src/components/edyn/rich-text-editor/serialize.js +55 -0
  34. package/dist/ui/src/components/edyn/rich-text-editor/serialize.js.map +1 -0
  35. package/dist/ui/src/components/edyn/rich-text-editor/sync.js +34 -0
  36. package/dist/ui/src/components/edyn/rich-text-editor/sync.js.map +1 -0
  37. package/dist/ui/src/components/edyn/rich-text-editor/toolbar.js +235 -0
  38. package/dist/ui/src/components/edyn/rich-text-editor/toolbar.js.map +1 -0
  39. package/dist/ui/src/components/edyn/rich-text-editor/types.js +26 -0
  40. package/dist/ui/src/components/edyn/rich-text-editor/types.js.map +1 -0
  41. package/dist/ui/src/components/edyn/video-player/video-player.js +132 -0
  42. package/dist/ui/src/components/edyn/video-player/video-player.js.map +1 -0
  43. package/dist/ui/src/components/ui/accordion/accordion.js +83 -0
  44. package/dist/ui/src/components/ui/accordion/accordion.js.map +1 -0
  45. package/dist/ui/src/components/ui/alert/alert.js +47 -0
  46. package/dist/ui/src/components/ui/alert/alert.js.map +1 -0
  47. package/dist/ui/src/components/ui/alert-dialog/alert-dialog.js +95 -0
  48. package/dist/ui/src/components/ui/alert-dialog/alert-dialog.js.map +1 -0
  49. package/dist/ui/src/components/ui/aspect-ratio/aspect-ratio.js +15 -0
  50. package/dist/ui/src/components/ui/aspect-ratio/aspect-ratio.js.map +1 -0
  51. package/dist/ui/src/components/ui/attachment/attachment.js +105 -0
  52. package/dist/ui/src/components/ui/attachment/attachment.js.map +1 -0
  53. package/dist/ui/src/components/ui/avatar/avatar.js +51 -0
  54. package/dist/ui/src/components/ui/avatar/avatar.js.map +1 -0
  55. package/dist/ui/src/components/ui/badge/badge.js +47 -0
  56. package/dist/ui/src/components/ui/badge/badge.js.map +1 -0
  57. package/dist/ui/src/components/ui/breadcrumb/breadcrumb.js +73 -0
  58. package/dist/ui/src/components/ui/breadcrumb/breadcrumb.js.map +1 -0
  59. package/dist/ui/src/components/ui/bubble/bubble.js +74 -0
  60. package/dist/ui/src/components/ui/bubble/bubble.js.map +1 -0
  61. package/dist/{chunks/input-syWxjY2U.js → ui/src/components/ui/button/button.js} +3 -82
  62. package/dist/ui/src/components/ui/button/button.js.map +1 -0
  63. package/dist/ui/src/components/ui/button-group/button-group.js +37 -0
  64. package/dist/ui/src/components/ui/button-group/button-group.js.map +1 -0
  65. package/dist/{chunks/date-range-picker-CWVcHgy2.js → ui/src/components/ui/calendar/calendar.js} +6 -100
  66. package/dist/ui/src/components/ui/calendar/calendar.js.map +1 -0
  67. package/dist/ui/src/components/ui/card/card.js +57 -0
  68. package/dist/ui/src/components/ui/card/card.js.map +1 -0
  69. package/dist/ui/src/components/ui/carousel/carousel.js +136 -0
  70. package/dist/ui/src/components/ui/carousel/carousel.js.map +1 -0
  71. package/dist/ui/src/components/ui/chart/chart.js +168 -0
  72. package/dist/ui/src/components/ui/chart/chart.js.map +1 -0
  73. package/dist/ui/src/components/ui/checkbox/checkbox.js +21 -0
  74. package/dist/ui/src/components/ui/checkbox/checkbox.js.map +1 -0
  75. package/dist/ui/src/components/ui/collapsible/collapsible.js +26 -0
  76. package/dist/ui/src/components/ui/collapsible/collapsible.js.map +1 -0
  77. package/dist/ui/src/components/ui/combobox/combobox.js +85 -0
  78. package/dist/ui/src/components/ui/combobox/combobox.js.map +1 -0
  79. package/dist/ui/src/components/ui/command/command.js +118 -0
  80. package/dist/ui/src/components/ui/command/command.js.map +1 -0
  81. package/dist/ui/src/components/ui/context-menu/context-menu.js +134 -0
  82. package/dist/ui/src/components/ui/context-menu/context-menu.js.map +1 -0
  83. package/dist/ui/src/components/ui/dialog/dialog.js +92 -0
  84. package/dist/ui/src/components/ui/dialog/dialog.js.map +1 -0
  85. package/dist/ui/src/components/ui/direction/direction.js +2 -0
  86. package/dist/ui/src/components/ui/drawer/drawer.js +86 -0
  87. package/dist/ui/src/components/ui/drawer/drawer.js.map +1 -0
  88. package/dist/ui/src/components/ui/dropdown-menu/dropdown-menu.js +160 -0
  89. package/dist/ui/src/components/ui/dropdown-menu/dropdown-menu.js.map +1 -0
  90. package/dist/ui/src/components/ui/empty/empty.js +61 -0
  91. package/dist/ui/src/components/ui/empty/empty.js.map +1 -0
  92. package/dist/ui/src/components/ui/field/field.js +36 -0
  93. package/dist/ui/src/components/ui/field/field.js.map +1 -0
  94. package/dist/ui/src/components/ui/hover-card/hover-card.js +38 -0
  95. package/dist/ui/src/components/ui/hover-card/hover-card.js.map +1 -0
  96. package/dist/ui/src/components/ui/indicator/indicator.js +79 -0
  97. package/dist/ui/src/components/ui/indicator/indicator.js.map +1 -0
  98. package/dist/ui/src/components/ui/input/input.js +16 -0
  99. package/dist/ui/src/components/ui/input/input.js.map +1 -0
  100. package/dist/ui/src/components/ui/input-group/input-group.js +77 -0
  101. package/dist/ui/src/components/ui/input-group/input-group.js.map +1 -0
  102. package/dist/ui/src/components/ui/input-otp/input-otp.js +48 -0
  103. package/dist/ui/src/components/ui/input-otp/input-otp.js.map +1 -0
  104. package/dist/ui/src/components/ui/item/item.js +122 -0
  105. package/dist/ui/src/components/ui/item/item.js.map +1 -0
  106. package/dist/ui/src/components/ui/kbd/kbd.js +21 -0
  107. package/dist/ui/src/components/ui/kbd/kbd.js.map +1 -0
  108. package/dist/ui/src/components/ui/label/label.js +14 -0
  109. package/dist/ui/src/components/ui/label/label.js.map +1 -0
  110. package/dist/ui/src/components/ui/marker/marker.js +44 -0
  111. package/dist/ui/src/components/ui/marker/marker.js.map +1 -0
  112. package/dist/ui/src/components/ui/menubar/menubar.js +137 -0
  113. package/dist/ui/src/components/ui/menubar/menubar.js.map +1 -0
  114. package/dist/ui/src/components/ui/message/message.js +50 -0
  115. package/dist/ui/src/components/ui/message/message.js.map +1 -0
  116. package/dist/ui/src/components/ui/message-scroller/message-scroller.js +61 -0
  117. package/dist/ui/src/components/ui/message-scroller/message-scroller.js.map +1 -0
  118. package/dist/ui/src/components/ui/native-select/native-select.js +39 -0
  119. package/dist/ui/src/components/ui/native-select/native-select.js.map +1 -0
  120. package/dist/ui/src/components/ui/navigation-menu/navigation-menu.js +84 -0
  121. package/dist/ui/src/components/ui/navigation-menu/navigation-menu.js.map +1 -0
  122. package/dist/ui/src/components/ui/pagination/pagination.js +104 -0
  123. package/dist/ui/src/components/ui/pagination/pagination.js.map +1 -0
  124. package/dist/ui/src/components/ui/popover/popover.js +56 -0
  125. package/dist/ui/src/components/ui/popover/popover.js.map +1 -0
  126. package/dist/ui/src/components/ui/progress/progress.js +70 -0
  127. package/dist/ui/src/components/ui/progress/progress.js.map +1 -0
  128. package/dist/ui/src/components/ui/questionnaire/questionnaire.js +171 -0
  129. package/dist/ui/src/components/ui/questionnaire/questionnaire.js.map +1 -0
  130. package/dist/ui/src/components/ui/radio-group/radio-group.js +29 -0
  131. package/dist/ui/src/components/ui/radio-group/radio-group.js.map +1 -0
  132. package/dist/ui/src/components/ui/resizable/resizable.js +29 -0
  133. package/dist/ui/src/components/ui/resizable/resizable.js.map +1 -0
  134. package/dist/ui/src/components/ui/scroll-area/scroll-area.js +119 -0
  135. package/dist/ui/src/components/ui/scroll-area/scroll-area.js.map +1 -0
  136. package/dist/ui/src/components/ui/select/select.js +99 -0
  137. package/dist/ui/src/components/ui/select/select.js.map +1 -0
  138. package/dist/ui/src/components/ui/separator/separator.js +30 -0
  139. package/dist/ui/src/components/ui/separator/separator.js.map +1 -0
  140. package/dist/ui/src/components/ui/sheet/sheet.js +89 -0
  141. package/dist/ui/src/components/ui/sheet/sheet.js.map +1 -0
  142. package/dist/ui/src/components/ui/sidebar/sidebar.js +383 -0
  143. package/dist/ui/src/components/ui/sidebar/sidebar.js.map +1 -0
  144. package/dist/ui/src/components/ui/skeleton/skeleton.js +14 -0
  145. package/dist/ui/src/components/ui/skeleton/skeleton.js.map +1 -0
  146. package/dist/ui/src/components/ui/slider/slider.js +49 -0
  147. package/dist/ui/src/components/ui/slider/slider.js.map +1 -0
  148. package/dist/ui/src/components/ui/spinner/spinner.js +28 -0
  149. package/dist/ui/src/components/ui/spinner/spinner.js.map +1 -0
  150. package/dist/ui/src/components/ui/switch/switch.js +20 -0
  151. package/dist/ui/src/components/ui/switch/switch.js.map +1 -0
  152. package/dist/ui/src/components/ui/table/table.d.ts +8 -1
  153. package/dist/ui/src/components/ui/table/table.js +68 -0
  154. package/dist/ui/src/components/ui/table/table.js.map +1 -0
  155. package/dist/ui/src/components/ui/tabs/tabs.js +50 -0
  156. package/dist/ui/src/components/ui/tabs/tabs.js.map +1 -0
  157. package/dist/ui/src/components/ui/textarea/textarea.js +14 -0
  158. package/dist/ui/src/components/ui/textarea/textarea.js.map +1 -0
  159. package/dist/ui/src/components/ui/toast/toast.js +124 -0
  160. package/dist/ui/src/components/ui/toast/toast.js.map +1 -0
  161. package/dist/ui/src/components/ui/toggle/toggle.js +37 -0
  162. package/dist/ui/src/components/ui/toggle/toggle.js.map +1 -0
  163. package/dist/ui/src/components/ui/toggle-group/toggle-group.js +56 -0
  164. package/dist/ui/src/components/ui/toggle-group/toggle-group.js.map +1 -0
  165. package/dist/ui/src/components/ui/tooltip/tooltip.js +42 -0
  166. package/dist/ui/src/components/ui/tooltip/tooltip.js.map +1 -0
  167. package/dist/ui/src/hooks/use-media-player.js +140 -0
  168. package/dist/ui/src/hooks/use-media-player.js.map +1 -0
  169. package/dist/ui/src/hooks/use-merged-refs.js +18 -0
  170. package/dist/ui/src/hooks/use-merged-refs.js.map +1 -0
  171. package/dist/ui/src/hooks/use-mobile.js +20 -0
  172. package/dist/ui/src/hooks/use-mobile.js.map +1 -0
  173. package/dist/ui/src/lib/first-weekday.js +34 -0
  174. package/dist/ui/src/lib/first-weekday.js.map +1 -0
  175. package/dist/ui/src/lib/popup-list.d.ts +6 -0
  176. package/dist/ui/src/lib/popup-list.js +26 -0
  177. package/dist/ui/src/lib/popup-list.js.map +1 -0
  178. package/dist/ui/src/lib/utils.js +21 -0
  179. package/dist/ui/src/lib/utils.js.map +1 -0
  180. package/package.json +2 -1
  181. package/dist/chunks/date-range-picker-CWVcHgy2.js.map +0 -1
  182. package/dist/chunks/input-syWxjY2U.js.map +0 -1
  183. package/dist/chunks/toggle-CVnIkJVC.js +0 -484
  184. package/dist/chunks/toggle-CVnIkJVC.js.map +0 -1
  185. package/dist/date-picker.js.map +0 -1
  186. package/dist/index.js.map +0 -1
  187. package/dist/rich-text-editor.js.map +0 -1
@@ -0,0 +1,124 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { isAllowedRichTextHref } from "./allow-list.js";
3
+ import { createElement, useMemo } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region ../ui/src/components/edyn/rich-text-content/rich-text-content.tsx
6
+ /**
7
+ * How rich text looks, shared by the editor and by RichTextContent so a comment reads the same while it is typed and
8
+ * after it is saved. Descendant selectors rather than classes on the elements, because the HTML that is stored carries
9
+ * no classes.
10
+ */
11
+ var RICH_TEXT_BODY_CLASS = "text-sm leading-6 wrap-break-word [&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2 [&_hr]:my-3 [&_hr]:border-0 [&_hr]:border-t [&_hr]:border-border [&_ol]:list-decimal [&_ol]:ps-5 [&_p+p]:mt-2 [&_ul]:list-disc [&_ul]:ps-5 [&_ul+p]:mt-2 [&_ol+p]:mt-2 [&_p+ul]:mt-2 [&_p+ol]:mt-2";
12
+ var MENTION_PATTERN = /(?<![\w.+-])@(?:assignees\b|[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+)/g;
13
+ var RICH_TEXT_MENTION_CLASS = "rounded-sm bg-primary/10 px-1 py-0.5 font-medium text-primary";
14
+ var TAG_FOR = {
15
+ b: "strong",
16
+ i: "em"
17
+ };
18
+ var KEPT = /* @__PURE__ */ new Set([
19
+ "p",
20
+ "strong",
21
+ "em",
22
+ "u",
23
+ "ul",
24
+ "ol",
25
+ "li",
26
+ "a",
27
+ "br",
28
+ "hr"
29
+ ]);
30
+ var DROPPED_WITH_CONTENT = /* @__PURE__ */ new Set([
31
+ "script",
32
+ "style",
33
+ "template",
34
+ "iframe",
35
+ "object",
36
+ "embed",
37
+ "noscript",
38
+ "svg",
39
+ "math",
40
+ "head",
41
+ "title"
42
+ ]);
43
+ var withMentions = (text, key) => {
44
+ const parts = [];
45
+ let last = 0;
46
+ for (const match of text.matchAll(MENTION_PATTERN)) {
47
+ const start = match.index ?? 0;
48
+ if (start > last) parts.push(text.slice(last, start));
49
+ parts.push(/* @__PURE__ */ jsx("span", {
50
+ "data-slot": "rich-text-mention",
51
+ className: RICH_TEXT_MENTION_CLASS,
52
+ children: match[0]
53
+ }, `${key}-${start}`));
54
+ last = start + match[0].length;
55
+ }
56
+ if (last < text.length) parts.push(text.slice(last));
57
+ return parts;
58
+ };
59
+ var toNodes = (parent, key, insideLink) => {
60
+ const out = [];
61
+ parent.childNodes.forEach((child, index) => {
62
+ const childKey = `${key}.${index}`;
63
+ if (child.nodeType === 3) {
64
+ const text = child.textContent ?? "";
65
+ out.push(...insideLink ? [text] : withMentions(text, childKey));
66
+ return;
67
+ }
68
+ if (child.nodeType !== 1) return;
69
+ const element = child;
70
+ const name = element.tagName.toLowerCase();
71
+ if (DROPPED_WITH_CONTENT.has(name)) return;
72
+ const tag = TAG_FOR[name] ?? name;
73
+ if (!KEPT.has(tag)) {
74
+ out.push(...toNodes(element, childKey, insideLink));
75
+ return;
76
+ }
77
+ if (tag === "br") {
78
+ out.push(/* @__PURE__ */ jsx("br", {}, childKey));
79
+ return;
80
+ }
81
+ if (tag === "hr") {
82
+ out.push(/* @__PURE__ */ jsx("hr", {}, childKey));
83
+ return;
84
+ }
85
+ if (tag === "a") {
86
+ const href = element.getAttribute("href") ?? "";
87
+ const inner = toNodes(element, childKey, true);
88
+ out.push(...isAllowedRichTextHref(href) ? [/* @__PURE__ */ jsx("a", {
89
+ href: href.trim(),
90
+ rel: "noopener noreferrer",
91
+ target: "_blank",
92
+ children: inner
93
+ }, childKey)] : inner);
94
+ return;
95
+ }
96
+ out.push(createElement(tag, { key: childKey }, ...toNodes(element, childKey, insideLink)));
97
+ });
98
+ return out;
99
+ };
100
+ /** The HTML as React elements, keeping only what the editor can produce. Browser only (it needs a DOM parser). */
101
+ var richTextToNodes = (html) => {
102
+ if (typeof DOMParser === "undefined" || html === "") return [];
103
+ return toNodes(new DOMParser().parseFromString(`<body>${html}`, "text/html").body, "r", false);
104
+ };
105
+ /**
106
+ * Shows rich text the editor produced (or any HTML), as the same elements the editor emits and nothing else:
107
+ * `p`, `br`, `hr`, `strong`, `em`, `u`, `ul`, `ol`, `li` and `a` with an `href` (http, https or mailto; it opens in a new tab
108
+ * with `rel="noopener noreferrer"`). Everything else is dropped and its text kept. Built as React elements, not injected
109
+ * as markup, so it is safe on HTML that has not been cleaned. A run like `@name@example.test` or `@assignees` is shown
110
+ * as a chip.
111
+ */
112
+ var RichTextContent = ({ html, className, ...props }) => {
113
+ const nodes = useMemo(() => richTextToNodes(html), [html]);
114
+ return /* @__PURE__ */ jsx("div", {
115
+ "data-slot": "rich-text-content",
116
+ className: cn(RICH_TEXT_BODY_CLASS, className),
117
+ ...props,
118
+ children: nodes
119
+ });
120
+ };
121
+ //#endregion
122
+ export { RICH_TEXT_BODY_CLASS, RICH_TEXT_MENTION_CLASS, RichTextContent, richTextToNodes };
123
+
124
+ //# sourceMappingURL=rich-text-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text-content.js","names":[],"sources":["../../../../../../../ui/src/components/edyn/rich-text-content/rich-text-content.tsx"],"sourcesContent":["import { cn } from '@edyn/ui/lib/utils';\nimport { createElement, type HTMLAttributes, type ReactNode, useMemo } from 'react';\nimport { isAllowedRichTextHref } from './allow-list';\n\n/**\n * How rich text looks, shared by the editor and by RichTextContent so a comment reads the same while it is typed and\n * after it is saved. Descendant selectors rather than classes on the elements, because the HTML that is stored carries\n * no classes.\n */\nexport const RICH_TEXT_BODY_CLASS =\n 'text-sm leading-6 wrap-break-word [&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2 [&_hr]:my-3 [&_hr]:border-0 [&_hr]:border-t [&_hr]:border-border [&_ol]:list-decimal [&_ol]:ps-5 [&_p+p]:mt-2 [&_ul]:list-disc [&_ul]:ps-5 [&_ul+p]:mt-2 [&_ol+p]:mt-2 [&_p+ul]:mt-2 [&_p+ol]:mt-2';\n\nconst MENTION_PATTERN = /(?<![\\w.+-])@(?:assignees\\b|[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)+)/g;\n\nexport const RICH_TEXT_MENTION_CLASS = 'rounded-sm bg-primary/10 px-1 py-0.5 font-medium text-primary';\n\nconst TAG_FOR: Readonly<Record<string, string>> = { b: 'strong', i: 'em' };\nconst KEPT = new Set(['p', 'strong', 'em', 'u', 'ul', 'ol', 'li', 'a', 'br', 'hr']);\nconst DROPPED_WITH_CONTENT = new Set(['script', 'style', 'template', 'iframe', 'object', 'embed', 'noscript', 'svg', 'math', 'head', 'title']);\n\nconst withMentions = (text: string, key: string): ReactNode[] => {\n const parts: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(MENTION_PATTERN)) {\n const start = match.index ?? 0;\n if (start > last) {\n parts.push(text.slice(last, start));\n }\n parts.push(\n <span key={`${key}-${start}`} data-slot=\"rich-text-mention\" className={RICH_TEXT_MENTION_CLASS}>\n {match[0]}\n </span>,\n );\n last = start + match[0].length;\n }\n if (last < text.length) {\n parts.push(text.slice(last));\n }\n return parts;\n};\n\nconst toNodes = (parent: Node, key: string, insideLink: boolean): ReactNode[] => {\n const out: ReactNode[] = [];\n parent.childNodes.forEach((child, index) => {\n const childKey = `${key}.${index}`;\n if (child.nodeType === 3) {\n const text = child.textContent ?? '';\n out.push(...(insideLink ? [text] : withMentions(text, childKey)));\n return;\n }\n if (child.nodeType !== 1) {\n return;\n }\n const element = child as Element;\n const name = element.tagName.toLowerCase();\n if (DROPPED_WITH_CONTENT.has(name)) {\n return;\n }\n const tag = TAG_FOR[name] ?? name;\n if (!KEPT.has(tag)) {\n out.push(...toNodes(element, childKey, insideLink));\n return;\n }\n if (tag === 'br') {\n out.push(<br key={childKey} />);\n return;\n }\n if (tag === 'hr') {\n out.push(<hr key={childKey} />);\n return;\n }\n if (tag === 'a') {\n const href = element.getAttribute('href') ?? '';\n const inner = toNodes(element, childKey, true);\n out.push(\n ...(isAllowedRichTextHref(href)\n ? [\n <a key={childKey} href={href.trim()} rel=\"noopener noreferrer\" target=\"_blank\">\n {inner}\n </a>,\n ]\n : inner),\n );\n return;\n }\n out.push(createElement(tag, { key: childKey }, ...toNodes(element, childKey, insideLink)));\n });\n return out;\n};\n\n/** The HTML as React elements, keeping only what the editor can produce. Browser only (it needs a DOM parser). */\nexport const richTextToNodes = (html: string): ReactNode[] => {\n if (typeof DOMParser === 'undefined' || html === '') {\n return [];\n }\n const parsed = new DOMParser().parseFromString(`<body>${html}`, 'text/html');\n return toNodes(parsed.body, 'r', false);\n};\n\nexport interface IRichTextContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'dangerouslySetInnerHTML'> {\n /** The HTML to show. Only the editor's elements are rendered, whatever else it holds. */\n html: string;\n}\n\n/**\n * Shows rich text the editor produced (or any HTML), as the same elements the editor emits and nothing else:\n * `p`, `br`, `hr`, `strong`, `em`, `u`, `ul`, `ol`, `li` and `a` with an `href` (http, https or mailto; it opens in a new tab\n * with `rel=\"noopener noreferrer\"`). Everything else is dropped and its text kept. Built as React elements, not injected\n * as markup, so it is safe on HTML that has not been cleaned. A run like `@name@example.test` or `@assignees` is shown\n * as a chip.\n */\nexport const RichTextContent = ({ html, className, ...props }: IRichTextContentProps) => {\n const nodes = useMemo(() => richTextToNodes(html), [html]);\n return (\n <div data-slot=\"rich-text-content\" className={c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isAllowedRichTextHref } from "../rich-text-content/allow-list.js";
2
+ import { countCharacters } from "./serialize.js";
3
+ import { Extension, mergeAttributes } from "@tiptap/core";
4
+ import { Bold } from "@tiptap/extension-bold";
5
+ import { Document } from "@tiptap/extension-document";
6
+ import { HardBreak } from "@tiptap/extension-hard-break";
7
+ import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
8
+ import { Italic } from "@tiptap/extension-italic";
9
+ import { Link } from "@tiptap/extension-link";
10
+ import { BulletList, ListItem, OrderedList } from "@tiptap/extension-list";
11
+ import { Mention } from "@tiptap/extension-mention";
12
+ import { Paragraph } from "@tiptap/extension-paragraph";
13
+ import { Text } from "@tiptap/extension-text";
14
+ import { Underline } from "@tiptap/extension-underline";
15
+ import { UndoRedo } from "@tiptap/extensions";
16
+ import { Plugin, PluginKey } from "@tiptap/pm/state";
17
+ //#region ../ui/src/components/edyn/rich-text-editor/extensions.ts
18
+ var MENTION_CHIP_CLASS = "rounded-sm bg-primary/10 px-1 py-0.5 font-medium text-primary";
19
+ var limitKey = new PluginKey("richTextMaxLength");
20
+ /** Refuses an edit that would take the text over the limit (a paste included) and lets one that shortens it through. */
21
+ var maxLengthExtension = (host) => Extension.create({
22
+ name: "maxLength",
23
+ addProseMirrorPlugins() {
24
+ return [new Plugin({
25
+ key: limitKey,
26
+ filterTransaction: (tr, state) => {
27
+ const limit = host.maxLength();
28
+ if (!tr.docChanged || limit === void 0) return true;
29
+ const next = countCharacters(tr.doc, host.toText());
30
+ return next <= limit || next <= countCharacters(state.doc, host.toText());
31
+ }
32
+ })];
33
+ }
34
+ });
35
+ /**
36
+ * The editor's whole schema: paragraph, line break, bold, italic, underline, bullet and numbered lists, link, and the
37
+ * mention chip. Whatever else arrives (a paste, `value`) is not in the schema, so ProseMirror drops the markup and keeps
38
+ * the text.
39
+ */
40
+ var buildExtensions = (host) => [
41
+ Document,
42
+ Paragraph,
43
+ Text,
44
+ HardBreak,
45
+ Bold,
46
+ Italic,
47
+ Underline,
48
+ BulletList,
49
+ OrderedList.extend({ addAttributes() {
50
+ return {};
51
+ } }),
52
+ ListItem,
53
+ HorizontalRule,
54
+ Link.extend({ addAttributes() {
55
+ return { href: {
56
+ default: null,
57
+ parseHTML: (element) => element.getAttribute("href"),
58
+ renderHTML: (attributes) => attributes.href ? { href: attributes.href } : {}
59
+ } };
60
+ } }).configure({
61
+ openOnClick: false,
62
+ autolink: true,
63
+ linkOnPaste: true,
64
+ defaultProtocol: "https",
65
+ protocols: ["mailto"],
66
+ isAllowedUri: (url) => isAllowedRichTextHref(url),
67
+ HTMLAttributes: {
68
+ rel: null,
69
+ target: null,
70
+ class: null
71
+ }
72
+ }),
73
+ UndoRedo,
74
+ maxLengthExtension(host),
75
+ Mention.extend({ addAttributes() {
76
+ return {
77
+ id: {
78
+ default: null,
79
+ parseHTML: (element) => element.getAttribute("data-id"),
80
+ renderHTML: (attributes) => attributes.id ? { "data-id": attributes.id } : {}
81
+ },
82
+ label: {
83
+ default: null,
84
+ parseHTML: (element) => element.getAttribute("data-label"),
85
+ renderHTML: (attributes) => attributes.label ? { "data-label": attributes.label } : {}
86
+ }
87
+ };
88
+ } }).configure({
89
+ HTMLAttributes: { class: MENTION_CHIP_CLASS },
90
+ renderText: ({ node }) => `@${node.attrs.label ?? node.attrs.id}`,
91
+ renderHTML: ({ options, node }) => [
92
+ "span",
93
+ mergeAttributes(options.HTMLAttributes),
94
+ `@${node.attrs.label ?? node.attrs.id}`
95
+ ],
96
+ suggestion: {
97
+ char: "@",
98
+ allow: () => host.mentionEnabled(),
99
+ items: () => [],
100
+ command: ({ editor, range, props }) => {
101
+ editor.chain().focus().insertContentAt(range, [{
102
+ type: "mention",
103
+ attrs: {
104
+ id: props.id,
105
+ label: props.label
106
+ }
107
+ }, {
108
+ type: "text",
109
+ text: " "
110
+ }]).run();
111
+ },
112
+ render: () => ({
113
+ onStart: (props) => host.onSuggestion(props),
114
+ onUpdate: (props) => host.onSuggestion(props),
115
+ onKeyDown: (props) => host.onSuggestionKey(props),
116
+ onExit: () => host.onSuggestion(null)
117
+ })
118
+ }
119
+ })
120
+ ];
121
+ //#endregion
122
+ export { buildExtensions };
123
+
124
+ //# sourceMappingURL=extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.js","names":[],"sources":["../../../../../../../ui/src/components/edyn/rich-text-editor/extensions.ts"],"sourcesContent":["import { isAllowedRichTextHref } from '@edyn/ui/components/edyn/rich-text-content/allow-list';\nimport { Extension, mergeAttributes } from '@tiptap/core';\nimport { Bold } from '@tiptap/extension-bold';\nimport { Document } from '@tiptap/extension-document';\nimport { HardBreak } from '@tiptap/extension-hard-break';\nimport { HorizontalRule } from '@tiptap/extension-horizontal-rule';\nimport { Italic } from '@tiptap/extension-italic';\nimport { Link } from '@tiptap/extension-link';\nimport { BulletList, ListItem, OrderedList } from '@tiptap/extension-list';\nimport { Mention } from '@tiptap/extension-mention';\nimport { Paragraph } from '@tiptap/extension-paragraph';\nimport { Text } from '@tiptap/extension-text';\nimport { Underline } from '@tiptap/extension-underline';\nimport { UndoRedo } from '@tiptap/extensions';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\nimport type { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';\nimport { countCharacters, type TMentionToText } from './serialize';\nimport type { IRichTextMentionItem } from './types';\n\n/** What the editor needs from the component while it runs. Held in a ref, so the extensions are built once. */\nexport interface IEditorHost {\n mentionEnabled: () => boolean;\n maxLength: () => number | undefined;\n toText: () => TMentionToText;\n onSuggestion: (props: SuggestionProps<IRichTextMentionItem, IRichTextMentionItem> | null) => void;\n onSuggestionKey: (props: SuggestionKeyDownProps) => boolean;\n}\n\nconst MENTION_CHIP_CLASS = 'rounded-sm bg-primary/10 px-1 py-0.5 font-medium text-primary';\n\nconst limitKey = new PluginKey('richTextMaxLength');\n\n/** Refuses an edit that would take the text over the limit (a paste included) and lets one that shortens it through. */\nconst maxLengthExtension = (host: IEditorHost) =>\n Extension.create({\n name: 'maxLength',\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key: limitKey,\n filterTransaction: (tr, state) => {\n const limit = host.maxLength();\n if (!tr.docChanged || limit === undefined) {\n return true;\n }\n const next = countCharacters(tr.doc, host.toText());\n return next <= limit || next <= countCharacters(state.doc, host.toText());\n },\n }),\n ];\n },\n });\n\n/**\n * The editor's whole schema: paragraph, line break, bold, italic, underline, bullet and numbered lists, link, and the\n * mention chip. Whatever else arrives (a paste, `value`) is not in the schema, so ProseMirror drops the markup and keeps\n * the text.\n */\nexport const buildExtensions = (host: IEditorHost) => [\n Document,\n Paragraph,\n Text,\n HardBreak,\n Bold,\n Italic,\n Underline,\n BulletList,\n // A list is numbered from 1; the `start` it would otherwise keep is an attribute outside the allow-list.\n OrderedList.extend({\n addAttributes() {\n return {};\n },\n }),\n ListItem,\n HorizontalRule,\n Link.extend({\n addAttributes() {\n return {\n href: {\n default: null,\n parseHTML: (element) => element.getAttribute('href'),\n renderHTML: (attributes) => (attributes.href ? { href: attributes.href } : {}),\n },\n };\n },\n }).configure({\n openOnClick: false,\n autolink: true,\n linkOnPaste: true,\n defaultProtocol: 'https',\n protocols: ['mailto'],\n isAllowedUri: (url) => isAllowedRichTextHref(url),\n HTMLAttributes: { rel: null, target: null, class: null },\n }),\n UndoRedo,\n maxLengthExtension(host),\n Mention.extend({\n addAttributes() {\n return {\n id: {\n default: null,\n parseHTML: (element) => element.getAttribute('data-id'),\n renderHTML: (attributes) => (attributes.id ? { 'data-id': attributes.id } : {}),\n },\n label: {\n default: null,\n parseHTML: (element) => element.getAttribute('data-label'),\n renderHTML: (attributes) => (attributes.label ? { 'data-label': attributes.label } : {}),\n },\n };\n },\n }).configure({\n HTMLAttributes: { class: MENTION_CHIP_CLASS },\n renderText: ({ node }) => `@${node.attrs.label ?? node.attrs.id}`,\n renderHTML: ({ options, node }) => ['span', mergeAttributes(options.HTMLAttributes), `@${node.attrs.label ?? node.attrs.id}`],\n suggestion: {\n char: '@',\n allow: () => host.mentionEnabled(),\n items: () => [],\n command: ({ editor, range, props }) => {\n editor\n .chain()\n .focus()\n .insertContentAt(range, [\n { type: 'mention', attrs: { id: props.id, label: props.label } },\n { type: 'text', text: ' ' },\n ])\n .run();\n },\n render: () => ({\n onStart: (props) => host.onSuggestion(props),\n onUpdate: (props) => host.onSuggestion(props),\n onKeyDown: (props) => host.onSuggestionKey(props),\n onExit: () => host.onSuggestion(null),\n }),\n },\n }),\n];\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,IAAM,qBAAqB;AAE3B,IAAM,WAAW,IAAI,UAAU,mBAAmB;;AAGlD,IAAM,sBAAsB,SAC1B,UAAU,OAAO;CACf,MAAM;CACN,wBAAwB;EACtB,OAAO,CACL,IAAI,OAAO;GACT,KAAK;GACL,oBAAoB,IAAI,UAAU;IAChC,MAAM,QAAQ,KAAK,UAAU;IAC7B,IAAI,CAAC,GAAG,cAAc,UAAU,KAAA,GAC9B,OAAO;IAET,MAAM,OAAO,gBAAgB,GAAG,KAAK,KAAK,OAAO,CAAC;IAClD,OAAO,QAAQ,SAAS,QAAQ,gBAAgB,MAAM,KAAK,KAAK,OAAO,CAAC;GAC1E;EACF,CAAC,CACH;CACF;AACF,CAAC;;;;;;AAOH,IAAa,mBAAmB,SAAsB;CACpD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,OAAO,EACjB,gBAAgB;EACd,OAAO,CAAC;CACV,EACF,CAAC;CACD;CACA;CACA,KAAK,OAAO,EACV,gBAAgB;EACd,OAAO,EACL,MAAM;GACJ,SAAS;GACT,YAAY,YAAY,QAAQ,aAAa,MAAM;GACnD,aAAa,eAAgB,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,IAAI,CAAC;EAC9E,EACF;CACF,EACF,CAAC,CAAC,CAAC,UAAU;EACX,aAAa;EACb,UAAU;EACV,aAAa;EACb,iBAAiB;EACjB,WAAW,CAAC,QAAQ;EACpB,eAAe,QAAQ,sBAAsB,GAAG;EAChD,gBAAgB;GAAE,KAAK;GAAM,QAAQ;GAAM,OAAO;EAAK;CACzD,CAAC;CACD;CACA,mBAAmB,IAAI;CACvB,QAAQ,OAAO,EACb,gBAAgB;EACd,OAAO;GACL,IAAI;IACF,SAAS;IACT,YAAY,YAAY,QAAQ,aAAa,SAAS;IACtD,aAAa,eAAgB,WAAW,KAAK,EAAE,WAAW,WAAW,GAAG,IAAI,CAAC;GAC/E;GACA,OAAO;IACL,SAAS;IACT,YAAY,YAAY,QAAQ,aAAa,YAAY;IACzD,aAAa,eAAgB,WAAW,QAAQ,EAAE,cAAc,WAAW,MAAM,IAAI,CAAC;GACxF;EACF;CACF,EACF,CAAC,CAAC,CAAC,UAAU;EACX,gBAAgB,EAAE,OAAO,mBAAmB;EAC5C,aAAa,EAAE,WAAW,IAAI,KAAK,MAAM,SAAS,KAAK,MAAM;EAC7D,aAAa,EAAE,SAAS,WAAW;GAAC;GAAQ,gBAAgB,QAAQ,cAAc;GAAG,IAAI,KAAK,MAAM,SAAS,KAAK,MAAM;EAAI;EAC5H,YAAY;GACV,MAAM;GACN,aAAa,KAAK,eAAe;GACjC,aAAa,CAAC;GACd,UAAU,EAAE,QAAQ,OAAO,YAAY;IACrC,OACG,MAAM,CAAC,CACP,MAAM,CAAC,CACP,gBAAgB,OAAO,CACtB;KAAE,MAAM;KAAW,OAAO;MAAE,IAAI,MAAM;MAAI,OAAO,MAAM;KAAM;IAAE,GAC/D;KAAE,MAAM;KAAQ,MAAM;IAAI,CAC5B,CAAC,CAAC,CACD,IAAI;GACT;GACA,eAAe;IACb,UAAU,UAAU,KAAK,aAAa,KAAK;IAC3C,WAAW,UAAU,KAAK,aAAa,KAAK;IAC5C,YAAY,UAAU,KAAK,gBAAgB,KAAK;IAChD,cAAc,KAAK,aAAa,IAAI;GACtC;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,232 @@
1
+ import { cn } from "../../../lib/utils.js";
2
+ import { Popover, PopoverContent } from "../../ui/popover/popover.js";
3
+ import { ScrollArea } from "../../ui/scroll-area/scroll-area.js";
4
+ import { popupItemClass } from "../../../lib/popup-list.js";
5
+ import { useCallback, useEffect, useRef, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { IconLoader2 } from "@tabler/icons-react";
8
+ //#region ../ui/src/components/edyn/rich-text-editor/mention-list.tsx
9
+ var FIRST = {
10
+ status: "loading",
11
+ items: [],
12
+ page: 1,
13
+ hasMore: false,
14
+ more: false,
15
+ active: 0
16
+ };
17
+ var toPage = (result) => Array.isArray(result) ? {
18
+ items: result,
19
+ hasMore: false
20
+ } : result;
21
+ var optionId = (listId, index) => `${listId}-${index}`;
22
+ /** The list that opens under the caret when the writer types @. */
23
+ var MentionList = ({ query, rect, config, labels, listId, onPick, keyHandler, onActiveChange }) => {
24
+ const [state, setState] = useState(FIRST);
25
+ const refSearch = useRef(config.search);
26
+ refSearch.current = config.search;
27
+ const refFirst = useRef(true);
28
+ const refController = useRef(null);
29
+ const refViewport = useRef(null);
30
+ const debounce = config.debounce ?? 250;
31
+ useEffect(() => {
32
+ const controller = new AbortController();
33
+ refController.current = controller;
34
+ setState((previous) => ({
35
+ ...previous,
36
+ status: "loading",
37
+ page: 1,
38
+ more: false
39
+ }));
40
+ const timer = setTimeout(async () => {
41
+ try {
42
+ const page = toPage(await refSearch.current(query, {
43
+ page: 1,
44
+ signal: controller.signal
45
+ }));
46
+ if (controller.signal.aborted) return;
47
+ setState({
48
+ status: "ready",
49
+ items: page.items,
50
+ page: 1,
51
+ hasMore: page.hasMore === true,
52
+ more: false,
53
+ active: 0
54
+ });
55
+ } catch {
56
+ if (!controller.signal.aborted) setState((previous) => ({
57
+ ...previous,
58
+ status: "error",
59
+ items: [],
60
+ hasMore: false
61
+ }));
62
+ }
63
+ }, refFirst.current ? 0 : debounce);
64
+ refFirst.current = false;
65
+ return () => {
66
+ clearTimeout(timer);
67
+ controller.abort();
68
+ };
69
+ }, [query, debounce]);
70
+ const loadMore = () => {
71
+ const controller = refController.current;
72
+ if (!controller || state.status !== "ready" || !state.hasMore || state.more) return;
73
+ const next = state.page + 1;
74
+ setState((previous) => ({
75
+ ...previous,
76
+ more: true
77
+ }));
78
+ refSearch.current(query, {
79
+ page: next,
80
+ signal: controller.signal
81
+ }).then((result) => {
82
+ if (controller.signal.aborted) return;
83
+ const page = toPage(result);
84
+ setState((previous) => ({
85
+ ...previous,
86
+ items: [...previous.items, ...page.items.filter((item) => !previous.items.some((known) => known.id === item.id))],
87
+ page: next,
88
+ hasMore: page.hasMore === true,
89
+ more: false
90
+ }));
91
+ }).catch(() => {
92
+ if (!controller.signal.aborted) setState((previous) => ({
93
+ ...previous,
94
+ more: false,
95
+ hasMore: false
96
+ }));
97
+ });
98
+ };
99
+ const refLoadMore = useRef(loadMore);
100
+ refLoadMore.current = loadMore;
101
+ const activeItem = state.items[state.active];
102
+ useEffect(() => {
103
+ onActiveChange(activeItem ? optionId(listId, state.active) : void 0);
104
+ }, [
105
+ activeItem,
106
+ listId,
107
+ onActiveChange,
108
+ state.active
109
+ ]);
110
+ useEffect(() => {
111
+ document.getElementById(optionId(listId, state.active))?.scrollIntoView({ block: "nearest" });
112
+ }, [listId, state.active]);
113
+ const watchSentinel = useCallback((node) => {
114
+ if (!node) return;
115
+ const observer = new IntersectionObserver((entries) => {
116
+ if (entries.some((entry) => entry.isIntersecting)) refLoadMore.current();
117
+ }, { root: refViewport.current });
118
+ observer.observe(node);
119
+ return () => observer.disconnect();
120
+ }, []);
121
+ useEffect(() => {
122
+ keyHandler.current = (event) => {
123
+ const count = state.items.length;
124
+ if (event.key === "Escape") {
125
+ event.stopPropagation();
126
+ return false;
127
+ }
128
+ if (count === 0) return false;
129
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
130
+ const step = event.key === "ArrowDown" ? 1 : -1;
131
+ const next = (state.active + step + count) % count;
132
+ if (step === 1 && state.active === count - 1) refLoadMore.current();
133
+ setState((previous) => ({
134
+ ...previous,
135
+ active: next
136
+ }));
137
+ return true;
138
+ }
139
+ if ((event.key === "Enter" || event.key === "Tab") && activeItem) {
140
+ onPick(activeItem);
141
+ return true;
142
+ }
143
+ return false;
144
+ };
145
+ return () => {
146
+ keyHandler.current = null;
147
+ };
148
+ }, [
149
+ activeItem,
150
+ keyHandler,
151
+ onPick,
152
+ state.active,
153
+ state.items.length
154
+ ]);
155
+ const anchor = { getBoundingClientRect: () => rect?.() ?? new DOMRect(0, 0, 0, 0) };
156
+ const announcement = state.status === "loading" ? labels.mentionSearching : state.status === "error" ? labels.mentionError : state.items.length === 0 ? labels.mentionEmpty : labels.mentionResults.replace("{count}", String(state.items.length));
157
+ return /* @__PURE__ */ jsx(Popover, {
158
+ open: true,
159
+ onOpenChange: () => void 0,
160
+ children: /* @__PURE__ */ jsxs(PopoverContent, {
161
+ anchor,
162
+ align: "start",
163
+ side: "bottom",
164
+ sideOffset: 6,
165
+ initialFocus: false,
166
+ finalFocus: false,
167
+ "data-slot": "rich-text-mention-popup",
168
+ className: "w-72 gap-0 p-1",
169
+ children: [/* @__PURE__ */ jsxs(ScrollArea, {
170
+ className: "max-h-60",
171
+ viewportRef: refViewport,
172
+ children: [
173
+ /* @__PURE__ */ jsx("div", {
174
+ role: "listbox",
175
+ id: listId,
176
+ "aria-label": labels.mentionList,
177
+ className: cn("flex flex-col gap-px", state.items.length === 0 && "hidden"),
178
+ children: state.items.map((item, index) => /* @__PURE__ */ jsxs("div", {
179
+ id: optionId(listId, index),
180
+ role: "option",
181
+ "aria-selected": index === state.active,
182
+ "data-slot": "rich-text-mention-option",
183
+ "data-highlighted": index === state.active ? "" : void 0,
184
+ className: cn(popupItemClass("base-ui"), "h-auto min-h-8 flex-col items-start gap-0"),
185
+ onMouseDown: (event) => event.preventDefault(),
186
+ onMouseMove: () => setState((previous) => previous.active === index ? previous : {
187
+ ...previous,
188
+ active: index
189
+ }),
190
+ onClick: () => onPick(item),
191
+ children: [/* @__PURE__ */ jsx("span", {
192
+ className: "truncate",
193
+ children: item.label
194
+ }), item.secondary ? /* @__PURE__ */ jsx("span", {
195
+ className: "truncate text-xs text-foreground/70",
196
+ children: item.secondary
197
+ }) : null]
198
+ }, item.id))
199
+ }),
200
+ state.status === "loading" && state.items.length === 0 ? /* @__PURE__ */ jsxs("div", {
201
+ className: "flex items-center gap-2 px-2 py-1.5 text-sm text-muted-foreground",
202
+ children: [/* @__PURE__ */ jsx(IconLoader2, {
203
+ className: "size-4 animate-spin motion-reduce:animate-none",
204
+ "aria-hidden": true
205
+ }), labels.mentionSearching]
206
+ }) : null,
207
+ state.status === "ready" && state.items.length === 0 ? /* @__PURE__ */ jsx("div", {
208
+ className: "px-2 py-1.5 text-sm text-muted-foreground",
209
+ children: labels.mentionEmpty
210
+ }) : null,
211
+ state.status === "error" ? /* @__PURE__ */ jsx("div", {
212
+ className: "px-2 py-1.5 text-sm text-destructive",
213
+ children: labels.mentionError
214
+ }) : null,
215
+ state.hasMore ? /* @__PURE__ */ jsx("div", {
216
+ ref: watchSentinel,
217
+ className: "flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground",
218
+ children: state.more ? labels.mentionLoadingMore : null
219
+ }, state.items.length) : null
220
+ ]
221
+ }), /* @__PURE__ */ jsx("div", {
222
+ role: "status",
223
+ className: "sr-only",
224
+ children: announcement
225
+ })]
226
+ })
227
+ });
228
+ };
229
+ //#endregion
230
+ export { MentionList };
231
+
232
+ //# sourceMappingURL=mention-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mention-list.js","names":[],"sources":["../../../../../../../ui/src/components/edyn/rich-text-editor/mention-list.tsx"],"sourcesContent":["import { Popover, PopoverContent } from '@edyn/ui/components/ui/popover';\nimport { ScrollArea } from '@edyn/ui/components/ui/scroll-area';\nimport { popupItemClass } from '@edyn/ui/lib/popup-list';\nimport { cn } from '@edyn/ui/lib/utils';\nimport { IconLoader2 } from '@tabler/icons-react';\nimport { type RefObject, useCallback, useEffect, useRef, useState } from 'react';\nimport type { IRichTextLabels, IRichTextMention, IRichTextMentionItem, IRichTextMentionPage } from './types';\n\ninterface IListState {\n status: 'loading' | 'ready' | 'error';\n items: IRichTextMentionItem[];\n page: number;\n hasMore: boolean;\n more: boolean;\n active: number;\n}\n\nconst FIRST: IListState = { status: 'loading', items: [], page: 1, hasMore: false, more: false, active: 0 };\n\nconst toPage = (result: IRichTextMentionItem[] | IRichTextMentionPage): IRichTextMentionPage =>\n Array.isArray(result) ? { items: result, hasMore: false } : result;\n\nexport interface IMentionListProps {\n query: string;\n /** Where the @ was typed. */\n rect: (() => DOMRect | null) | null;\n config: IRichTextMention;\n labels: IRichTextLabels;\n listId: string;\n onPick: (item: IRichTextMentionItem) => void;\n /** The editor keeps focus, so the list is driven by its keys: the editor calls this one. */\n keyHandler: RefObject<((event: KeyboardEvent) => boolean) | null>;\n /** The id of the option the editor should name as `aria-activedescendant`. */\n onActiveChange: (optionId: string | undefined) => void;\n}\n\nconst optionId = (listId: string, index: number): string => `${listId}-${index}`;\n\n/** The list that opens under the caret when the writer types @. */\nexport const MentionList = ({ query, rect, config, labels, listId, onPick, keyHandler, onActiveChange }: IMentionListProps) => {\n const [state, setState] = useState<IListState>(FIRST);\n const refSearch = useRef(config.search);\n refSearch.current = config.search;\n const refFirst = useRef(true);\n const refController = useRef<AbortController | null>(null);\n const refViewport = useRef<HTMLDivElement | null>(null);\n const debounce = config.debounce ?? 250;\n\n useEffect(() => {\n const controller = new AbortController();\n refController.current = controller;\n setState((previous) => ({ ...previous, status: 'loading', page: 1, more: false }));\n const timer = setTimeout(\n async () => {\n try {\n const page = toPage(await refSearch.current(query, { page: 1, signal: controller.signal }));\n if (controller.signal.aborted) {\n return;\n }\n setState({ status: 'ready', items: page.items, page: 1, hasMore: page.hasMore === true, more: false, active: 0 });\n } catch {\n if (!controller.signal.aborted) {\n setState((previous) => ({ ...previous, status: 'error', items: [], hasMore: false }));\n }\n }\n },\n refFirst.current ? 0 : debounce,\n );\n refFirst.current = false;\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [query, debounce]);\n\n const loadMore = () => {\n const controller = refController.current;\n if (!controller || state.status !== 'ready' || !state.hasMore || state.more) {\n return;\n }\n const next = state.page + 1;\n setState((previous) => ({ ...previous, more: true }));\n refSearch\n .current(query, { page: next, signal: controller.signal })\n .then((result) => {\n if (controller.signal.aborted) {\n return;\n }\n const page = toPage(result);\n setState((previous) => ({\n ...previous,\n items: [...previous.items, ...page.items.filter((item) => !previous.items.some((known) => known.id === item.id))],\n page: next,\n hasMore: page.hasMore === true,\n more: false,\n }));\n })\n .catch(() => {\n if (!controller.signal.aborted) {\n setState((previous) => ({ ...previous, more: false, hasMore: false }));\n }\n });\n };\n const refLoadMore = useRef(loadMore);\n refLoadMore.current = loadMore;\n\n const activeItem = state.items[state.active];\n\n useEffect(() => {\n onActiveChange(activeItem ? optionId(listId, state.active) : undefined);\n }, [activeItem, listId, onActiveChange, state.active]);\n\n useEffect(() => {\n document.getElementById(optionId(listId, state.active))?.scrollIntoView({ block: 'nearest' });\n }, [listId, state.active]);\n\n const watchSentinel = useCallback((node: HTMLDivElement | null) => {\n if (!node) {\n return;\n }\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n refLoadMore.current();\n }\n },\n { root: refViewport.current },\n );\n observer.observe(node);\n return () => observer.disconnect();\n }, []);\n\n useEffect(() => {\n keyHandler.current = (event) => {\n const count = state.items.length;\n if (event.key === 'Escape') {\n event.stopPropagation();\n return false;\n }\n if (count === 0) {\n return false;\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n const step = event.key === 'ArrowDown' ? 1 : -1;\n const next = (state.active + step + count) % count;\n if (step === 1 && state.active === count - 1) {\n refLoadMore.current();\n }\n setState((previous) => ({ ...previous, active: next }));\n return true;\n }\n if ((event.key === 'Enter' || event.key === 'Tab') && activeItem) {\n onPick(activeItem);\n return true;\n }\n return false;\n };\n return () => {\n keyHandler.current = null;\n };\n }, [activeItem, keyHandler, onPick, state.active, state.items.length]);\n\n const anchor = { getBoundingClientRect: () => rect?.() ?? new DOMRect(0, 0, 0, 0) };\n const announcement =\n state.status === 'loading'\n ? labels.mentionSearching\n : state.status === 'error'\n ? labels.mentionError\n : state.items.length === 0\n ? labels.mentionEmpty\n : labels.mentionResults.replace('{count}', String(state.items.length));\n\n return (\n <Popover open onOpenChange={() => undefined}>\n <PopoverContent\n anchor={anchor}\n align=\"start\"\n side=\"bottom\"\n sideOffset={6}\n initialFocus={false}\n finalFocus={false}\n data-slot=\"rich-text-mention-popup\"\n className=\"w-72 gap-0 p-1\"\n >\n <ScrollArea className=\"max-h-60\" viewportRef={refViewport}>\n <div\n role=\"listbox\"\n id={listId}\n aria-label={labels.mentionList}\n className={cn('flex flex-col gap-px', state.items.length === 0 && 'hidden')}\n >\n {state.items.map((item, index) => (\n // biome-ignore lint/a11y/useKeyWithClickEvents: the editor keeps focus and drives the list with its own keys\n // biome-ignore lint/a11y/useFocusableInteractive: options are named by aria-activedescendant on the editor, never focused\n <div\n key={item.id}\n id={optionId(listId, index)}\n role=\"option\"\n aria-selected={index === state.active}\n data-slot=\"rich-text-mention-option\"\n data-highlighted={index === state.active ? '' : undefined}\n className={cn(popupItemClass('base-ui'), 'h-auto min-h-8 flex-col items-start gap-0')}\n onMouseDown={(event) => event.preventDefault()}\n onMouseMove={() => setState((previous) => (previous.active === index ? previous : { ...previous, active: index }))}\n onClick={() => onPick(item)}\n >\n <span className=\"truncate\">{item.label}</span>\n {item.secondary ? <span className=\"truncate text-xs text-foreground/70\">{item.secondary}</span> : null}\n </div>\n ))}\n </div>\n {state.status === 'loading' && state.items.length === 0 ? (\n <div className=\"flex items-center gap-2 px-2 py-1.5 text-sm text-muted-foreground\">\n <IconLoader2 className=\"size-4 animate-spin motion-reduce:animate-none\" aria-hidden />\n {labels.mentionSearching}\n </div>\n ) : null}\n {state.status === 'ready' && state.items.length === 0 ? (\n <div className=\"px-2 py-1.5 text-sm text-muted-foreground\">{labels.mentionEmpty}</div>\n ) : null}\n {state.status === 'error' ? <div className=\"px-2 py-1.5 text-sm text-destructive\">{labels.mentionError}</div> : null}\n {state.hasMore ? (\n <div key={state.items.length} ref={watchSentinel} className=\"flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground\">\n {state.more ? labels.mentionLoadingMore : null}\n </div>\n ) : null}\n </ScrollArea>\n <div role=\"status\" className=\"sr-only\">\n {announcement}\n </div>\n </PopoverContent>\n </Popover>\n );\n};\n"],"mappings":";;;;;;;;AAiBA,IAAM,QAAoB;CAAE,QAAQ;CAAW,OAAO,CAAC;CAAG,MAAM;CAAG,SAAS;CAAO,MAAM;CAAO,QAAQ;AAAE;AAE1G,IAAM,UAAU,WACd,MAAM,QAAQ,MAAM,IAAI;CAAE,OAAO;CAAQ,SAAS;AAAM,IAAI;AAgB9D,IAAM,YAAY,QAAgB,UAA0B,GAAG,OAAO,GAAG;;AAGzE,IAAa,eAAe,EAAE,OAAO,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,YAAY,qBAAwC;CAC7H,MAAM,CAAC,OAAO,YAAY,SAAqB,KAAK;CACpD,MAAM,YAAY,OAAO,OAAO,MAAM;CACtC,UAAU,UAAU,OAAO;CAC3B,MAAM,WAAW,OAAO,IAAI;CAC5B,MAAM,gBAAgB,OAA+B,IAAI;CACzD,MAAM,cAAc,OAA8B,IAAI;CACtD,MAAM,WAAW,OAAO,YAAY;CAEpC,gBAAgB;EACd,MAAM,aAAa,IAAI,gBAAgB;EACvC,cAAc,UAAU;EACxB,UAAU,cAAc;GAAE,GAAG;GAAU,QAAQ;GAAW,MAAM;GAAG,MAAM;EAAM,EAAE;EACjF,MAAM,QAAQ,WACZ,YAAY;GACV,IAAI;IACF,MAAM,OAAO,OAAO,MAAM,UAAU,QAAQ,OAAO;KAAE,MAAM;KAAG,QAAQ,WAAW;IAAO,CAAC,CAAC;IAC1F,IAAI,WAAW,OAAO,SACpB;IAEF,SAAS;KAAE,QAAQ;KAAS,OAAO,KAAK;KAAO,MAAM;KAAG,SAAS,KAAK,YAAY;KAAM,MAAM;KAAO,QAAQ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