@d4gger/design-system 3.0.1 → 4.0.0

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 (450) hide show
  1. package/README.md +19 -0
  2. package/dist/components/accordion.css +9 -2
  3. package/dist/components/alert/Alert.cjs +11 -7
  4. package/dist/components/alert/Alert.cjs.map +2 -2
  5. package/dist/components/alert/Alert.d.cts.map +1 -1
  6. package/dist/components/alert/Alert.d.mts.map +1 -1
  7. package/dist/components/alert/Alert.d.ts.map +1 -1
  8. package/dist/components/alert/Alert.js +12 -8
  9. package/dist/components/alert/Alert.js.map +2 -2
  10. package/dist/components/alert.css +13 -0
  11. package/dist/components/article-nodes.css +16 -1
  12. package/dist/components/articleNodes/ArticleNodes.cjs +46 -5
  13. package/dist/components/articleNodes/ArticleNodes.cjs.map +2 -2
  14. package/dist/components/articleNodes/ArticleNodes.d.cts +7 -3
  15. package/dist/components/articleNodes/ArticleNodes.d.cts.map +1 -1
  16. package/dist/components/articleNodes/ArticleNodes.d.mts +7 -3
  17. package/dist/components/articleNodes/ArticleNodes.d.mts.map +1 -1
  18. package/dist/components/articleNodes/ArticleNodes.d.ts +7 -3
  19. package/dist/components/articleNodes/ArticleNodes.d.ts.map +1 -1
  20. package/dist/components/articleNodes/ArticleNodes.js +46 -5
  21. package/dist/components/articleNodes/ArticleNodes.js.map +2 -2
  22. package/dist/components/articleNodes/articleExtensions.cjs +21 -4
  23. package/dist/components/articleNodes/articleExtensions.cjs.map +2 -2
  24. package/dist/components/articleNodes/articleExtensions.d.cts +8 -2
  25. package/dist/components/articleNodes/articleExtensions.d.cts.map +1 -1
  26. package/dist/components/articleNodes/articleExtensions.d.mts +8 -2
  27. package/dist/components/articleNodes/articleExtensions.d.mts.map +1 -1
  28. package/dist/components/articleNodes/articleExtensions.d.ts +8 -2
  29. package/dist/components/articleNodes/articleExtensions.d.ts.map +1 -1
  30. package/dist/components/articleNodes/articleExtensions.js +21 -4
  31. package/dist/components/articleNodes/articleExtensions.js.map +2 -2
  32. package/dist/components/articleNodes/articleNodeViews.cjs +154 -0
  33. package/dist/components/articleNodes/articleNodeViews.cjs.map +7 -0
  34. package/dist/components/articleNodes/articleNodeViews.d.cts +3 -0
  35. package/dist/components/articleNodes/articleNodeViews.d.cts.map +1 -0
  36. package/dist/components/articleNodes/articleNodeViews.d.mts +3 -0
  37. package/dist/components/articleNodes/articleNodeViews.d.mts.map +1 -0
  38. package/dist/components/articleNodes/articleNodeViews.d.ts +3 -0
  39. package/dist/components/articleNodes/articleNodeViews.d.ts.map +1 -0
  40. package/dist/components/articleNodes/articleNodeViews.js +124 -0
  41. package/dist/components/articleNodes/articleNodeViews.js.map +7 -0
  42. package/dist/components/articleNodes/articleNodes.props.cjs.map +1 -1
  43. package/dist/components/articleNodes/articleNodes.props.d.cts +25 -2
  44. package/dist/components/articleNodes/articleNodes.props.d.cts.map +1 -1
  45. package/dist/components/articleNodes/articleNodes.props.d.mts +25 -2
  46. package/dist/components/articleNodes/articleNodes.props.d.mts.map +1 -1
  47. package/dist/components/articleNodes/articleNodes.props.d.ts +25 -2
  48. package/dist/components/articleNodes/articleNodes.props.d.ts.map +1 -1
  49. package/dist/components/banner.css +5 -4
  50. package/dist/components/blockquote.css +7 -4
  51. package/dist/components/bottom-dock.css +132 -0
  52. package/dist/components/bottomDock/BottomDock.cjs +140 -0
  53. package/dist/components/bottomDock/BottomDock.cjs.map +7 -0
  54. package/dist/components/bottomDock/BottomDock.d.cts +25 -0
  55. package/dist/components/bottomDock/BottomDock.d.cts.map +1 -0
  56. package/dist/components/bottomDock/BottomDock.d.mts +25 -0
  57. package/dist/components/bottomDock/BottomDock.d.mts.map +1 -0
  58. package/dist/components/bottomDock/BottomDock.d.ts +25 -0
  59. package/dist/components/bottomDock/BottomDock.d.ts.map +1 -0
  60. package/dist/components/bottomDock/BottomDock.js +110 -0
  61. package/dist/components/bottomDock/BottomDock.js.map +7 -0
  62. package/dist/components/bottomDock/bottomDock.props.cjs +49 -0
  63. package/dist/components/bottomDock/bottomDock.props.cjs.map +7 -0
  64. package/dist/components/bottomDock/bottomDock.props.d.cts +29 -0
  65. package/dist/components/bottomDock/bottomDock.props.d.cts.map +1 -0
  66. package/dist/components/bottomDock/bottomDock.props.d.mts +29 -0
  67. package/dist/components/bottomDock/bottomDock.props.d.mts.map +1 -0
  68. package/dist/components/bottomDock/bottomDock.props.d.ts +29 -0
  69. package/dist/components/bottomDock/bottomDock.props.d.ts.map +1 -0
  70. package/dist/components/bottomDock/bottomDock.props.js +29 -0
  71. package/dist/components/bottomDock/bottomDock.props.js.map +7 -0
  72. package/dist/components/breadcrumb.css +24 -3
  73. package/dist/components/callout.css +20 -7
  74. package/dist/components/card.css +8 -0
  75. package/dist/components/code.css +29 -13
  76. package/dist/components/collapsible/Collapsible.cjs +4 -0
  77. package/dist/components/collapsible/Collapsible.cjs.map +2 -2
  78. package/dist/components/collapsible/Collapsible.d.cts.map +1 -1
  79. package/dist/components/collapsible/Collapsible.d.mts.map +1 -1
  80. package/dist/components/collapsible/Collapsible.d.ts.map +1 -1
  81. package/dist/components/collapsible/Collapsible.js +4 -0
  82. package/dist/components/collapsible/Collapsible.js.map +2 -2
  83. package/dist/components/collapsible.css +10 -1
  84. package/dist/components/command.css +0 -2
  85. package/dist/components/comment-thread.css +15 -7
  86. package/dist/components/commentThread/CommentThread.cjs +45 -17
  87. package/dist/components/commentThread/CommentThread.cjs.map +2 -2
  88. package/dist/components/commentThread/CommentThread.d.cts +6 -6
  89. package/dist/components/commentThread/CommentThread.d.cts.map +1 -1
  90. package/dist/components/commentThread/CommentThread.d.mts +6 -6
  91. package/dist/components/commentThread/CommentThread.d.mts.map +1 -1
  92. package/dist/components/commentThread/CommentThread.d.ts +6 -6
  93. package/dist/components/commentThread/CommentThread.d.ts.map +1 -1
  94. package/dist/components/commentThread/CommentThread.js +45 -17
  95. package/dist/components/commentThread/CommentThread.js.map +2 -2
  96. package/dist/components/commentThread/commentThread.props.cjs.map +1 -1
  97. package/dist/components/commentThread/commentThread.props.d.cts +24 -0
  98. package/dist/components/commentThread/commentThread.props.d.cts.map +1 -1
  99. package/dist/components/commentThread/commentThread.props.d.mts +24 -0
  100. package/dist/components/commentThread/commentThread.props.d.mts.map +1 -1
  101. package/dist/components/commentThread/commentThread.props.d.ts +24 -0
  102. package/dist/components/commentThread/commentThread.props.d.ts.map +1 -1
  103. package/dist/components/config-drawer.css +7 -3
  104. package/dist/components/configDrawer/ConfigDrawer.cjs +1 -1
  105. package/dist/components/configDrawer/ConfigDrawer.cjs.map +2 -2
  106. package/dist/components/configDrawer/ConfigDrawer.js +1 -1
  107. package/dist/components/configDrawer/ConfigDrawer.js.map +2 -2
  108. package/dist/components/context-menu.css +3 -1
  109. package/dist/components/contextMenu/ContextMenu.cjs +37 -6
  110. package/dist/components/contextMenu/ContextMenu.cjs.map +2 -2
  111. package/dist/components/contextMenu/ContextMenu.d.cts +1 -1
  112. package/dist/components/contextMenu/ContextMenu.d.cts.map +1 -1
  113. package/dist/components/contextMenu/ContextMenu.d.mts +1 -1
  114. package/dist/components/contextMenu/ContextMenu.d.mts.map +1 -1
  115. package/dist/components/contextMenu/ContextMenu.d.ts +1 -1
  116. package/dist/components/contextMenu/ContextMenu.d.ts.map +1 -1
  117. package/dist/components/contextMenu/ContextMenu.js +37 -6
  118. package/dist/components/contextMenu/ContextMenu.js.map +2 -2
  119. package/dist/components/drawer.css +23 -6
  120. package/dist/components/dropdownMenu/DropdownMenu.cjs +10 -5
  121. package/dist/components/dropdownMenu/DropdownMenu.cjs.map +2 -2
  122. package/dist/components/dropdownMenu/DropdownMenu.d.cts.map +1 -1
  123. package/dist/components/dropdownMenu/DropdownMenu.d.mts.map +1 -1
  124. package/dist/components/dropdownMenu/DropdownMenu.d.ts.map +1 -1
  125. package/dist/components/dropdownMenu/DropdownMenu.js +10 -5
  126. package/dist/components/dropdownMenu/DropdownMenu.js.map +2 -2
  127. package/dist/components/file-upload.css +36 -9
  128. package/dist/components/floating-panel.css +49 -18
  129. package/dist/components/floatingPanel/FloatingPanel.cjs +156 -58
  130. package/dist/components/floatingPanel/FloatingPanel.cjs.map +2 -2
  131. package/dist/components/floatingPanel/FloatingPanel.d.cts.map +1 -1
  132. package/dist/components/floatingPanel/FloatingPanel.d.mts.map +1 -1
  133. package/dist/components/floatingPanel/FloatingPanel.d.ts.map +1 -1
  134. package/dist/components/floatingPanel/FloatingPanel.js +156 -58
  135. package/dist/components/floatingPanel/FloatingPanel.js.map +2 -2
  136. package/dist/components/grid/Grid.cjs +24 -35
  137. package/dist/components/grid/Grid.cjs.map +2 -2
  138. package/dist/components/grid/Grid.d.cts.map +1 -1
  139. package/dist/components/grid/Grid.d.mts.map +1 -1
  140. package/dist/components/grid/Grid.d.ts.map +1 -1
  141. package/dist/components/grid/Grid.js +24 -35
  142. package/dist/components/grid/Grid.js.map +2 -2
  143. package/dist/components/heading/Heading.cjs +1 -8
  144. package/dist/components/heading/Heading.cjs.map +2 -2
  145. package/dist/components/heading/Heading.d.cts.map +1 -1
  146. package/dist/components/heading/Heading.d.mts.map +1 -1
  147. package/dist/components/heading/Heading.d.ts.map +1 -1
  148. package/dist/components/heading/Heading.js +1 -8
  149. package/dist/components/heading/Heading.js.map +2 -2
  150. package/dist/components/heading/heading.props.cjs +9 -9
  151. package/dist/components/heading/heading.props.cjs.map +2 -2
  152. package/dist/components/heading/heading.props.d.cts +42 -43
  153. package/dist/components/heading/heading.props.d.cts.map +1 -1
  154. package/dist/components/heading/heading.props.d.mts +42 -43
  155. package/dist/components/heading/heading.props.d.mts.map +1 -1
  156. package/dist/components/heading/heading.props.d.ts +42 -43
  157. package/dist/components/heading/heading.props.d.ts.map +1 -1
  158. package/dist/components/heading/heading.props.js +9 -9
  159. package/dist/components/heading/heading.props.js.map +2 -2
  160. package/dist/components/heading.css +127 -104
  161. package/dist/components/hover-card.css +5 -2
  162. package/dist/components/icon/Icon.cjs +3 -0
  163. package/dist/components/icon/Icon.cjs.map +2 -2
  164. package/dist/components/icon/Icon.d.cts +5 -1
  165. package/dist/components/icon/Icon.d.cts.map +1 -1
  166. package/dist/components/icon/Icon.d.mts +5 -1
  167. package/dist/components/icon/Icon.d.mts.map +1 -1
  168. package/dist/components/icon/Icon.d.ts +5 -1
  169. package/dist/components/icon/Icon.d.ts.map +1 -1
  170. package/dist/components/icon/Icon.js +4 -0
  171. package/dist/components/icon/Icon.js.map +2 -2
  172. package/dist/components/icon/icons.cjs +2 -0
  173. package/dist/components/icon/icons.cjs.map +2 -2
  174. package/dist/components/icon/icons.d.cts +5 -0
  175. package/dist/components/icon/icons.d.cts.map +1 -1
  176. package/dist/components/icon/icons.d.mts +5 -0
  177. package/dist/components/icon/icons.d.mts.map +1 -1
  178. package/dist/components/icon/icons.d.ts +5 -0
  179. package/dist/components/icon/icons.d.ts.map +1 -1
  180. package/dist/components/icon/icons.js +2 -0
  181. package/dist/components/icon/icons.js.map +2 -2
  182. package/dist/components/index.cjs +1 -0
  183. package/dist/components/index.cjs.map +2 -2
  184. package/dist/components/index.d.cts +1 -0
  185. package/dist/components/index.d.cts.map +1 -1
  186. package/dist/components/index.d.mts +1 -0
  187. package/dist/components/index.d.mts.map +1 -1
  188. package/dist/components/index.d.ts +1 -0
  189. package/dist/components/index.d.ts.map +1 -1
  190. package/dist/components/index.js +1 -0
  191. package/dist/components/index.js.map +2 -2
  192. package/dist/components/label.css +3 -0
  193. package/dist/components/link.css +33 -97
  194. package/dist/components/notification-center.css +49 -9
  195. package/dist/components/notificationCenter/NotificationCenter.cjs +21 -16
  196. package/dist/components/notificationCenter/NotificationCenter.cjs.map +2 -2
  197. package/dist/components/notificationCenter/NotificationCenter.d.cts.map +1 -1
  198. package/dist/components/notificationCenter/NotificationCenter.d.mts.map +1 -1
  199. package/dist/components/notificationCenter/NotificationCenter.d.ts.map +1 -1
  200. package/dist/components/notificationCenter/NotificationCenter.js +22 -17
  201. package/dist/components/notificationCenter/NotificationCenter.js.map +2 -2
  202. package/dist/components/pills/Pills.cjs +1 -1
  203. package/dist/components/pills/Pills.cjs.map +2 -2
  204. package/dist/components/pills/Pills.js +2 -2
  205. package/dist/components/pills/Pills.js.map +2 -2
  206. package/dist/components/pills.css +6 -0
  207. package/dist/components/popover.css +45 -6
  208. package/dist/components/prose.css +3 -3
  209. package/dist/components/qr-code.css +5 -2
  210. package/dist/components/qrCode/QrCode.cjs +14 -11
  211. package/dist/components/qrCode/QrCode.cjs.map +2 -2
  212. package/dist/components/qrCode/QrCode.d.cts.map +1 -1
  213. package/dist/components/qrCode/QrCode.d.mts.map +1 -1
  214. package/dist/components/qrCode/QrCode.d.ts.map +1 -1
  215. package/dist/components/qrCode/QrCode.js +14 -11
  216. package/dist/components/qrCode/QrCode.js.map +2 -2
  217. package/dist/components/resizable.css +20 -4
  218. package/dist/components/rich-text-editor.css +50 -14
  219. package/dist/components/richTextEditor/EditorTools.cjs +226 -0
  220. package/dist/components/richTextEditor/EditorTools.cjs.map +7 -0
  221. package/dist/components/richTextEditor/EditorTools.d.cts +22 -0
  222. package/dist/components/richTextEditor/EditorTools.d.cts.map +1 -0
  223. package/dist/components/richTextEditor/EditorTools.d.mts +22 -0
  224. package/dist/components/richTextEditor/EditorTools.d.mts.map +1 -0
  225. package/dist/components/richTextEditor/EditorTools.d.ts +22 -0
  226. package/dist/components/richTextEditor/EditorTools.d.ts.map +1 -0
  227. package/dist/components/richTextEditor/EditorTools.js +196 -0
  228. package/dist/components/richTextEditor/EditorTools.js.map +7 -0
  229. package/dist/components/richTextEditor/MentionSuggestions.cjs +96 -0
  230. package/dist/components/richTextEditor/MentionSuggestions.cjs.map +7 -0
  231. package/dist/components/richTextEditor/MentionSuggestions.d.cts +7 -0
  232. package/dist/components/richTextEditor/MentionSuggestions.d.cts.map +1 -0
  233. package/dist/components/richTextEditor/MentionSuggestions.d.mts +7 -0
  234. package/dist/components/richTextEditor/MentionSuggestions.d.mts.map +1 -0
  235. package/dist/components/richTextEditor/MentionSuggestions.d.ts +7 -0
  236. package/dist/components/richTextEditor/MentionSuggestions.d.ts.map +1 -0
  237. package/dist/components/richTextEditor/MentionSuggestions.js +66 -0
  238. package/dist/components/richTextEditor/MentionSuggestions.js.map +7 -0
  239. package/dist/components/richTextEditor/RichTextEditor.cjs +53 -206
  240. package/dist/components/richTextEditor/RichTextEditor.cjs.map +3 -3
  241. package/dist/components/richTextEditor/RichTextEditor.d.cts +17 -7
  242. package/dist/components/richTextEditor/RichTextEditor.d.cts.map +1 -1
  243. package/dist/components/richTextEditor/RichTextEditor.d.mts +17 -7
  244. package/dist/components/richTextEditor/RichTextEditor.d.mts.map +1 -1
  245. package/dist/components/richTextEditor/RichTextEditor.d.ts +17 -7
  246. package/dist/components/richTextEditor/RichTextEditor.d.ts.map +1 -1
  247. package/dist/components/richTextEditor/RichTextEditor.js +53 -206
  248. package/dist/components/richTextEditor/RichTextEditor.js.map +3 -3
  249. package/dist/components/richTextEditor/editorTokens.cjs +75 -0
  250. package/dist/components/richTextEditor/editorTokens.cjs.map +7 -0
  251. package/dist/components/richTextEditor/editorTokens.d.cts +21 -0
  252. package/dist/components/richTextEditor/editorTokens.d.cts.map +1 -0
  253. package/dist/components/richTextEditor/editorTokens.d.mts +21 -0
  254. package/dist/components/richTextEditor/editorTokens.d.mts.map +1 -0
  255. package/dist/components/richTextEditor/editorTokens.d.ts +21 -0
  256. package/dist/components/richTextEditor/editorTokens.d.ts.map +1 -0
  257. package/dist/components/richTextEditor/editorTokens.js +55 -0
  258. package/dist/components/richTextEditor/editorTokens.js.map +7 -0
  259. package/dist/components/scroll-area.css +12 -0
  260. package/dist/components/scrollArea/ScrollArea.cjs +12 -1
  261. package/dist/components/scrollArea/ScrollArea.cjs.map +2 -2
  262. package/dist/components/scrollArea/ScrollArea.d.cts.map +1 -1
  263. package/dist/components/scrollArea/ScrollArea.d.mts.map +1 -1
  264. package/dist/components/scrollArea/ScrollArea.d.ts.map +1 -1
  265. package/dist/components/scrollArea/ScrollArea.js +12 -1
  266. package/dist/components/scrollArea/ScrollArea.js.map +2 -2
  267. package/dist/components/segmentedControl/SegmentedControl.cjs +2 -2
  268. package/dist/components/segmentedControl/SegmentedControl.cjs.map +2 -2
  269. package/dist/components/segmentedControl/SegmentedControl.d.cts.map +1 -1
  270. package/dist/components/segmentedControl/SegmentedControl.d.mts.map +1 -1
  271. package/dist/components/segmentedControl/SegmentedControl.d.ts.map +1 -1
  272. package/dist/components/segmentedControl/SegmentedControl.js +2 -2
  273. package/dist/components/segmentedControl/SegmentedControl.js.map +2 -2
  274. package/dist/components/separator.css +3 -9
  275. package/dist/components/sidebar/Sidebar.cjs +12 -4
  276. package/dist/components/sidebar/Sidebar.cjs.map +2 -2
  277. package/dist/components/sidebar/Sidebar.d.cts +4 -1
  278. package/dist/components/sidebar/Sidebar.d.cts.map +1 -1
  279. package/dist/components/sidebar/Sidebar.d.mts +4 -1
  280. package/dist/components/sidebar/Sidebar.d.mts.map +1 -1
  281. package/dist/components/sidebar/Sidebar.d.ts +4 -1
  282. package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
  283. package/dist/components/sidebar/Sidebar.js +12 -4
  284. package/dist/components/sidebar/Sidebar.js.map +2 -2
  285. package/dist/components/sidebar/sidebar.props.cjs +8 -1
  286. package/dist/components/sidebar/sidebar.props.cjs.map +2 -2
  287. package/dist/components/sidebar/sidebar.props.d.cts +9 -1
  288. package/dist/components/sidebar/sidebar.props.d.cts.map +1 -1
  289. package/dist/components/sidebar/sidebar.props.d.mts +9 -1
  290. package/dist/components/sidebar/sidebar.props.d.mts.map +1 -1
  291. package/dist/components/sidebar/sidebar.props.d.ts +9 -1
  292. package/dist/components/sidebar/sidebar.props.d.ts.map +1 -1
  293. package/dist/components/sidebar/sidebar.props.js +8 -1
  294. package/dist/components/sidebar/sidebar.props.js.map +2 -2
  295. package/dist/components/sidebar.css +28 -0
  296. package/dist/components/sonner.css +78 -16
  297. package/dist/components/stepper.css +23 -12
  298. package/dist/components/tab-nav.css +25 -13
  299. package/dist/components/tabNav/TabNav.cjs +1 -4
  300. package/dist/components/tabNav/TabNav.cjs.map +2 -2
  301. package/dist/components/tabNav/TabNav.d.cts.map +1 -1
  302. package/dist/components/tabNav/TabNav.d.mts.map +1 -1
  303. package/dist/components/tabNav/TabNav.d.ts.map +1 -1
  304. package/dist/components/tabNav/TabNav.js +1 -4
  305. package/dist/components/tabNav/TabNav.js.map +2 -2
  306. package/dist/components/table-of-contents.css +12 -2
  307. package/dist/components/tableOfContents/TableOfContents.cjs +11 -4
  308. package/dist/components/tableOfContents/TableOfContents.cjs.map +2 -2
  309. package/dist/components/tableOfContents/TableOfContents.d.cts.map +1 -1
  310. package/dist/components/tableOfContents/TableOfContents.d.mts.map +1 -1
  311. package/dist/components/tableOfContents/TableOfContents.d.ts.map +1 -1
  312. package/dist/components/tableOfContents/TableOfContents.js +11 -4
  313. package/dist/components/tableOfContents/TableOfContents.js.map +2 -2
  314. package/dist/components/tabs/Tabs.cjs +39 -54
  315. package/dist/components/tabs/Tabs.cjs.map +2 -2
  316. package/dist/components/tabs/Tabs.d.cts.map +1 -1
  317. package/dist/components/tabs/Tabs.d.mts.map +1 -1
  318. package/dist/components/tabs/Tabs.d.ts.map +1 -1
  319. package/dist/components/tabs/Tabs.js +39 -54
  320. package/dist/components/tabs/Tabs.js.map +2 -2
  321. package/dist/components/tabs.css +52 -7
  322. package/dist/components/text/text.props.cjs +9 -9
  323. package/dist/components/text/text.props.cjs.map +2 -2
  324. package/dist/components/text/text.props.d.cts +42 -43
  325. package/dist/components/text/text.props.d.cts.map +1 -1
  326. package/dist/components/text/text.props.d.mts +42 -43
  327. package/dist/components/text/text.props.d.mts.map +1 -1
  328. package/dist/components/text/text.props.d.ts +42 -43
  329. package/dist/components/text/text.props.d.ts.map +1 -1
  330. package/dist/components/text/text.props.js +9 -9
  331. package/dist/components/text/text.props.js.map +2 -2
  332. package/dist/components/text/typography.props.cjs +32 -0
  333. package/dist/components/text/typography.props.cjs.map +7 -0
  334. package/dist/components/text/typography.props.d.cts +3 -0
  335. package/dist/components/text/typography.props.d.cts.map +1 -0
  336. package/dist/components/text/typography.props.d.mts +3 -0
  337. package/dist/components/text/typography.props.d.mts.map +1 -0
  338. package/dist/components/text/typography.props.d.ts +3 -0
  339. package/dist/components/text/typography.props.d.ts.map +1 -0
  340. package/dist/components/text/typography.props.js +12 -0
  341. package/dist/components/text/typography.props.js.map +7 -0
  342. package/dist/components/text-field.css +1 -0
  343. package/dist/components/text.css +41 -6
  344. package/dist/components/theme-panel.css +6 -0
  345. package/dist/components/toast/Toast.cjs +3 -1
  346. package/dist/components/toast/Toast.cjs.map +2 -2
  347. package/dist/components/toast/Toast.d.cts.map +1 -1
  348. package/dist/components/toast/Toast.d.mts.map +1 -1
  349. package/dist/components/toast/Toast.d.ts.map +1 -1
  350. package/dist/components/toast/Toast.js +3 -1
  351. package/dist/components/toast/Toast.js.map +2 -2
  352. package/dist/components/toast.css +36 -36
  353. package/dist/components/toggle-tip.css +58 -9
  354. package/dist/components/toggleTip/ToggleTip.cjs +9 -5
  355. package/dist/components/toggleTip/ToggleTip.cjs.map +2 -2
  356. package/dist/components/toggleTip/ToggleTip.d.cts.map +1 -1
  357. package/dist/components/toggleTip/ToggleTip.d.mts.map +1 -1
  358. package/dist/components/toggleTip/ToggleTip.d.ts.map +1 -1
  359. package/dist/components/toggleTip/ToggleTip.js +9 -5
  360. package/dist/components/toggleTip/ToggleTip.js.map +2 -2
  361. package/dist/components/toolbar/Toolbar.cjs +10 -7
  362. package/dist/components/toolbar/Toolbar.cjs.map +2 -2
  363. package/dist/components/toolbar/Toolbar.js +10 -7
  364. package/dist/components/toolbar/Toolbar.js.map +2 -2
  365. package/dist/components/toolbar.css +58 -4
  366. package/dist/components/tooltip.css +9 -5
  367. package/dist/components/tree-view.css +17 -3
  368. package/dist/components/treeView/TreeView.cjs +76 -21
  369. package/dist/components/treeView/TreeView.cjs.map +2 -2
  370. package/dist/components/treeView/TreeView.d.cts.map +1 -1
  371. package/dist/components/treeView/TreeView.d.mts.map +1 -1
  372. package/dist/components/treeView/TreeView.d.ts.map +1 -1
  373. package/dist/components/treeView/TreeView.js +76 -21
  374. package/dist/components/treeView/TreeView.js.map +2 -2
  375. package/dist/components.css +1 -0
  376. package/dist/docs/README.md +1 -0
  377. package/dist/docs/component-contract.md +4 -3
  378. package/dist/docs/component-index.json +9 -1
  379. package/dist/docs/components/accordion.md +5 -36
  380. package/dist/docs/components/alert.md +17 -10
  381. package/dist/docs/components/article-nodes.md +59 -2
  382. package/dist/docs/components/aspect-ratio.md +3 -26
  383. package/dist/docs/components/banner.md +7 -7
  384. package/dist/docs/components/blockquote.md +15 -14
  385. package/dist/docs/components/bottom-dock.md +146 -0
  386. package/dist/docs/components/box.md +3 -34
  387. package/dist/docs/components/breadcrumb.md +13 -8
  388. package/dist/docs/components/callout.md +18 -7
  389. package/dist/docs/components/card.md +9 -2
  390. package/dist/docs/components/code.md +33 -220
  391. package/dist/docs/components/collapsible.md +11 -35
  392. package/dist/docs/components/command.md +2 -0
  393. package/dist/docs/components/comment-thread.md +51 -1
  394. package/dist/docs/components/config-drawer.md +72 -171
  395. package/dist/docs/components/container.md +2 -0
  396. package/dist/docs/components/context-menu.md +19 -5
  397. package/dist/docs/components/dialog.md +3 -1
  398. package/dist/docs/components/drawer.md +17 -6
  399. package/dist/docs/components/dropdown-menu.md +11 -2
  400. package/dist/docs/components/em.md +1 -1
  401. package/dist/docs/components/file-upload.md +13 -7
  402. package/dist/docs/components/floating-panel.md +79 -285
  403. package/dist/docs/components/form.md +4 -0
  404. package/dist/docs/components/grid.md +11 -60
  405. package/dist/docs/components/heading.md +35 -32
  406. package/dist/docs/components/hover-card.md +9 -1
  407. package/dist/docs/components/kbd.md +2 -0
  408. package/dist/docs/components/label.md +11 -9
  409. package/dist/docs/components/link.md +31 -209
  410. package/dist/docs/components/notification-center.md +24 -14
  411. package/dist/docs/components/page-header.md +2 -0
  412. package/dist/docs/components/pagination.md +4 -0
  413. package/dist/docs/components/pills.md +13 -4
  414. package/dist/docs/components/popover.md +10 -3
  415. package/dist/docs/components/prose.md +9 -0
  416. package/dist/docs/components/qr-code.md +12 -12
  417. package/dist/docs/components/quote.md +9 -4
  418. package/dist/docs/components/resizable.md +26 -18
  419. package/dist/docs/components/rich-text-editor.md +68 -18
  420. package/dist/docs/components/scroll-area.md +17 -9
  421. package/dist/docs/components/section.md +3 -38
  422. package/dist/docs/components/segmented-control.md +1 -1
  423. package/dist/docs/components/segmented-meter.md +9 -0
  424. package/dist/docs/components/separator.md +10 -46
  425. package/dist/docs/components/sidebar.md +17 -3
  426. package/dist/docs/components/sonner.md +25 -16
  427. package/dist/docs/components/stepper.md +8 -33
  428. package/dist/docs/components/strong.md +1 -1
  429. package/dist/docs/components/tab-nav.md +33 -96
  430. package/dist/docs/components/table-of-contents.md +8 -2
  431. package/dist/docs/components/tabs.md +19 -50
  432. package/dist/docs/components/text-field.md +1 -0
  433. package/dist/docs/components/text.md +34 -28
  434. package/dist/docs/components/theme-panel.md +3 -28
  435. package/dist/docs/components/theme.md +7 -3
  436. package/dist/docs/components/toast.md +27 -13
  437. package/dist/docs/components/toggle-tip.md +58 -241
  438. package/dist/docs/components/toolbar.md +16 -39
  439. package/dist/docs/components/tooltip.md +13 -7
  440. package/dist/docs/components/tree-view.md +22 -55
  441. package/dist/generated/tokens.cjs +1 -0
  442. package/dist/generated/tokens.cjs.map +2 -2
  443. package/dist/generated/tokens.d.cts.map +1 -1
  444. package/dist/generated/tokens.d.mts.map +1 -1
  445. package/dist/generated/tokens.d.ts.map +1 -1
  446. package/dist/generated/tokens.js +1 -0
  447. package/dist/generated/tokens.js.map +2 -2
  448. package/dist/styles.css +1632 -1300
  449. package/dist/tokens.css +344 -362
  450. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  import * as React from "react";
2
2
  import classNames from "classnames";
3
+ import { Button } from "../button/Button.js";
4
+ import { Tabs } from "../tabs/Tabs.js";
3
5
  import { jsx, jsxs } from "react/jsx-runtime";
4
6
  const ArticleImage = ({ caption, className, alt = "", ...props }) => /* @__PURE__ */ jsxs("figure", { className: "dsx-article-image", children: [
5
7
  /* @__PURE__ */ jsx("img", { ...props, alt, className: classNames("dsx-article-image__media", className) }),
@@ -25,22 +27,61 @@ const BeforeAfterComparison = ({ beforeSrc, afterSrc, beforeAlt, afterAlt, befor
25
27
  /* @__PURE__ */ jsx("span", { children: afterLabel })
26
28
  ] })
27
29
  ] });
28
- const ArticlePoll = ({ pollId, question, options = [], state = "ready", onLoad, onVote, className, ...props }) => {
30
+ const ArticleVideo = ({ caption, className, controls = true, ...props }) => /* @__PURE__ */ jsxs("figure", { className: "dsx-article-video", children: [
31
+ /* @__PURE__ */ jsx("video", { ...props, controls, className: classNames("dsx-article-video__media", className) }),
32
+ caption ? /* @__PURE__ */ jsx("figcaption", { children: caption }) : null
33
+ ] });
34
+ const ArticleMaterialLink = ({ materialId, href, children, unavailableLabel = "Material unavailable", ...props }) => {
35
+ let allowed = false;
36
+ try {
37
+ allowed = ["http:", "https:"].includes(new URL(href ?? "", "https://example.invalid").protocol);
38
+ } catch {
39
+ }
40
+ return href && allowed ? /* @__PURE__ */ jsx("a", { ...props, href, "data-dsx-material-id": materialId, children }) : /* @__PURE__ */ jsx("span", { role: "status", "data-dsx-material-id": materialId, children: unavailableLabel });
41
+ };
42
+ const ArticlePlatformTabs = ({ tabs, value, onValueChange, className, dir, ...props }) => /* @__PURE__ */ jsxs(Tabs, { ...props, dir: dir === "rtl" || dir === "ltr" ? dir : void 0, className: classNames("dsx-article-platform-tabs", className), defaultValue: tabs[0]?.platform, value, onValueChange, children: [
43
+ /* @__PURE__ */ jsxs(Tabs.List, { "aria-label": "Platform instructions", children: [
44
+ tabs.map((tab) => /* @__PURE__ */ jsx(Tabs.Trigger, { value: tab.platform, children: tab.label }, tab.platform)),
45
+ /* @__PURE__ */ jsx(Tabs.Indicator, {})
46
+ ] }),
47
+ tabs.map((tab) => /* @__PURE__ */ jsx(Tabs.Content, { value: tab.platform, children: tab.content }, tab.platform))
48
+ ] });
49
+ const ArticlePoll = ({ pollId, question, options = [], state = "ready", onLoad, onVote, selection, multiple = false, onSelectionChange, onSubmit, onRetract, totalVotes, className, ...props }) => {
29
50
  React.useEffect(() => {
30
51
  onLoad?.(pollId);
31
52
  }, [pollId, onLoad]);
53
+ const controlled = selection !== void 0;
54
+ const total = totalVotes ?? options.reduce((sum, option) => sum + (option.votes ?? 0), 0);
55
+ const inert = state === "closed" || state === "loading" || state === "error" || !controlled && state !== "ready";
32
56
  return /* @__PURE__ */ jsxs("div", { ...props, className: classNames("dsx-article-poll", className), "data-dsx-poll-id": pollId, "data-state": state, "aria-busy": state === "loading" || void 0, children: [
33
57
  question ? /* @__PURE__ */ jsx("strong", { children: question }) : null,
34
- state === "error" ? /* @__PURE__ */ jsx("span", { role: "alert", children: "Poll unavailable" }) : options.map((option) => /* @__PURE__ */ jsxs("button", { type: "button", disabled: state !== "ready", onClick: () => onVote?.(pollId, option.id), children: [
35
- option.label,
36
- option.votes === void 0 ? null : ` (${option.votes})`
37
- ] }, option.id))
58
+ state === "closed" ? /* @__PURE__ */ jsx("span", { role: "status", children: "Poll closed" }) : null,
59
+ state === "error" ? /* @__PURE__ */ jsx("span", { role: "alert", children: "Poll unavailable" }) : options.map((option) => /* @__PURE__ */ jsxs("div", { className: "dsx-article-poll__result", children: [
60
+ /* @__PURE__ */ jsxs(Button, { className: "dsx-article-poll__option", type: "button", size: "lg", variant: selection?.includes(option.id) ? "secondary" : "outline", "aria-pressed": controlled ? selection.includes(option.id) : void 0, disabled: inert, onClick: () => {
61
+ if (!controlled) {
62
+ onVote?.(pollId, option.id);
63
+ return;
64
+ }
65
+ onSelectionChange?.(multiple ? selection.includes(option.id) ? selection.filter((id) => id !== option.id) : [...selection, option.id] : [option.id]);
66
+ }, children: [
67
+ option.label,
68
+ option.votes === void 0 ? null : ` (${option.votes})`
69
+ ] }),
70
+ option.votes !== void 0 ? /* @__PURE__ */ jsx("progress", { "aria-label": `${String(option.label)} results`, value: option.votes, max: Math.max(total, 1) }) : null
71
+ ] }, option.id)),
72
+ controlled && !inert ? /* @__PURE__ */ jsxs("div", { className: "dsx-article-poll__actions", children: [
73
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "lg", disabled: !selection.length || !onSubmit, onClick: () => onSubmit?.(pollId, selection), children: state === "voted" ? "Change vote" : "Vote" }),
74
+ state === "voted" && onRetract ? /* @__PURE__ */ jsx(Button, { type: "button", size: "lg", variant: "outline", onClick: () => onRetract(pollId), children: "Retract vote" }) : null
75
+ ] }) : null
38
76
  ] });
39
77
  };
40
78
  export {
41
79
  ArticleEmbed,
42
80
  ArticleImage,
81
+ ArticleMaterialLink,
82
+ ArticlePlatformTabs,
43
83
  ArticlePoll,
84
+ ArticleVideo,
44
85
  BeforeAfterComparison
45
86
  };
46
87
  //# sourceMappingURL=ArticleNodes.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/articleNodes/ArticleNodes.tsx"],
4
- "sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\n\nimport type {\n ArticleEmbedProps,\n ArticleImageProps,\n ArticlePollProps,\n BeforeAfterComparisonProps,\n} from './articleNodes.props'\n\nconst ArticleImage = ({ caption, className, alt = '', ...props }: ArticleImageProps) => <figure className=\"dsx-article-image\"><img {...props} alt={alt} className={classNames('dsx-article-image__media', className)} />{caption ? <figcaption>{caption}</figcaption> : null}</figure>\n\nconst ArticleEmbed = ({ url, render, isAllowed, className, ...props }: ArticleEmbedProps) => {\n let canonical: string | undefined\n try { const parsed = new URL(url); if (parsed.protocol === 'https:' || parsed.protocol === 'http:') canonical = parsed.href } catch {}\n const allowed = Boolean(canonical && (isAllowed?.(canonical) ?? true))\n return <div {...props} className={classNames('dsx-article-embed', className)} data-dsx-url={allowed ? canonical : undefined}>{allowed && canonical ? (render?.(canonical) ?? <a href={canonical}>{canonical}</a>) : <span role=\"alert\">Embed unavailable</span>}</div>\n}\n\nconst BeforeAfterComparison = ({ beforeSrc, afterSrc, beforeAlt, afterAlt, beforeLabel = 'Before', afterLabel = 'After', className, ...props }: BeforeAfterComparisonProps) => <figure {...props} className={classNames('dsx-before-after', className)}><div><img src={beforeSrc} alt={beforeAlt}/><span>{beforeLabel}</span></div><div><img src={afterSrc} alt={afterAlt}/><span>{afterLabel}</span></div></figure>\n\nconst ArticlePoll = ({ pollId, question, options = [], state = 'ready', onLoad, onVote, className, ...props }: ArticlePollProps) => {\n React.useEffect(() => { onLoad?.(pollId) }, [pollId, onLoad])\n return <div {...props} className={classNames('dsx-article-poll', className)} data-dsx-poll-id={pollId} data-state={state} aria-busy={state === 'loading' || undefined}>{question ? <strong>{question}</strong> : null}{state === 'error' ? <span role=\"alert\">Poll unavailable</span> : options.map((option) => <button key={option.id} type=\"button\" disabled={state !== 'ready'} onClick={() => onVote?.(pollId, option.id)}>{option.label}{option.votes === undefined ? null : ` (${option.votes})`}</button>)}</div>\n}\n\nexport { ArticleEmbed, ArticleImage, ArticlePoll, BeforeAfterComparison }\nexport type {\n ArticleEmbedProps,\n ArticleImageProps,\n ArticlePollProps,\n BeforeAfterComparisonProps,\n PollState,\n} from './articleNodes.props'\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AASiE,SAAsC,KAAtC;AAAxF,MAAM,eAAe,CAAC,EAAE,SAAS,WAAW,MAAM,IAAI,GAAG,MAAM,MAAyB,qBAAC,YAAO,WAAU,qBAAoB;AAAA,sBAAC,SAAK,GAAG,OAAO,KAAU,WAAW,WAAW,4BAA4B,SAAS,GAAG;AAAA,EAAG,UAAU,oBAAC,gBAAY,mBAAQ,IAAgB;AAAA,GAAK;AAE7Q,MAAM,eAAe,CAAC,EAAE,KAAK,QAAQ,WAAW,WAAW,GAAG,MAAM,MAAyB;AAC3F,MAAI;AACJ,MAAI;AAAE,UAAM,SAAS,IAAI,IAAI,GAAG;AAAG,QAAI,OAAO,aAAa,YAAY,OAAO,aAAa,QAAS,aAAY,OAAO;AAAA,EAAK,QAAQ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AO;AAAA,MAAO,OAAO,UAAU,SAAY,OAAO,KAAK,OAAO,KAAK;AAAA,SAAtK,OAAO,EAAmK,CAAS;AAAA,KAAE;AACpf;",
4
+ "sourcesContent": ["import * as React from 'react'\nimport classNames from 'classnames'\nimport { Button } from '../button/Button'\nimport { Tabs } from '../tabs/Tabs'\nimport type { ArticleVideoProps, ArticleMaterialLinkProps, ArticlePlatformTabsProps } from './articleNodes.props'\n\nimport type {\n ArticleEmbedProps,\n ArticleImageProps,\n ArticlePollProps,\n BeforeAfterComparisonProps,\n} from './articleNodes.props'\n\nconst ArticleImage = ({ caption, className, alt = '', ...props }: ArticleImageProps) => <figure className=\"dsx-article-image\"><img {...props} alt={alt} className={classNames('dsx-article-image__media', className)} />{caption ? <figcaption>{caption}</figcaption> : null}</figure>\n\nconst ArticleEmbed = ({ url, render, isAllowed, className, ...props }: ArticleEmbedProps) => {\n let canonical: string | undefined\n try { const parsed = new URL(url); if (parsed.protocol === 'https:' || parsed.protocol === 'http:') canonical = parsed.href } catch {}\n const allowed = Boolean(canonical && (isAllowed?.(canonical) ?? true))\n return <div {...props} className={classNames('dsx-article-embed', className)} data-dsx-url={allowed ? canonical : undefined}>{allowed && canonical ? (render?.(canonical) ?? <a href={canonical}>{canonical}</a>) : <span role=\"alert\">Embed unavailable</span>}</div>\n}\n\nconst BeforeAfterComparison = ({ beforeSrc, afterSrc, beforeAlt, afterAlt, beforeLabel = 'Before', afterLabel = 'After', className, ...props }: BeforeAfterComparisonProps) => <figure {...props} className={classNames('dsx-before-after', className)}><div><img src={beforeSrc} alt={beforeAlt}/><span>{beforeLabel}</span></div><div><img src={afterSrc} alt={afterAlt}/><span>{afterLabel}</span></div></figure>\n\nconst ArticleVideo = ({ caption, className, controls = true, ...props }: ArticleVideoProps) => <figure className=\"dsx-article-video\"><video {...props} controls={controls} className={classNames('dsx-article-video__media', className)} />{caption ? <figcaption>{caption}</figcaption> : null}</figure>\nconst ArticleMaterialLink = ({ materialId, href, children, unavailableLabel = 'Material unavailable', ...props }: ArticleMaterialLinkProps) => {\n let allowed = false\n try { allowed = ['http:', 'https:'].includes(new URL(href ?? '', 'https://example.invalid').protocol) } catch {}\n return href && allowed ? <a {...props} href={href} data-dsx-material-id={materialId}>{children}</a> : <span role=\"status\" data-dsx-material-id={materialId}>{unavailableLabel}</span>\n}\nconst ArticlePlatformTabs = ({ tabs, value, onValueChange, className, dir, ...props }: ArticlePlatformTabsProps) => <Tabs {...props} dir={dir === 'rtl' || dir === 'ltr' ? dir : undefined} className={classNames('dsx-article-platform-tabs', className)} defaultValue={tabs[0]?.platform} value={value} onValueChange={onValueChange}>\n <Tabs.List aria-label=\"Platform instructions\">{tabs.map(tab => <Tabs.Trigger key={tab.platform} value={tab.platform}>{tab.label}</Tabs.Trigger>)}<Tabs.Indicator /></Tabs.List>\n {tabs.map(tab => <Tabs.Content key={tab.platform} value={tab.platform}>{tab.content}</Tabs.Content>)}\n</Tabs>\nconst ArticlePoll = ({ pollId, question, options = [], state = 'ready', onLoad, onVote, selection, multiple = false, onSelectionChange, onSubmit, onRetract, totalVotes, className, ...props }: ArticlePollProps) => {\n React.useEffect(() => { onLoad?.(pollId) }, [pollId, onLoad])\n const controlled = selection !== undefined\n const total = totalVotes ?? options.reduce((sum, option) => sum + (option.votes ?? 0), 0)\n const inert = state === 'closed' || state === 'loading' || state === 'error' || (!controlled && state !== 'ready')\n return <div {...props} className={classNames('dsx-article-poll', className)} data-dsx-poll-id={pollId} data-state={state} aria-busy={state === 'loading' || undefined}>\n {question ? <strong>{question}</strong> : null}\n {state === 'closed' ? <span role=\"status\">Poll closed</span> : null}\n {state === 'error' ? <span role=\"alert\">Poll unavailable</span> : options.map(option => <div className=\"dsx-article-poll__result\" key={option.id}>\n <Button className=\"dsx-article-poll__option\" type=\"button\" size=\"lg\" variant={selection?.includes(option.id) ? 'secondary' : 'outline'} aria-pressed={controlled ? selection.includes(option.id) : undefined} disabled={inert} onClick={() => {\n if (!controlled) { onVote?.(pollId, option.id); return }\n onSelectionChange?.(multiple ? selection.includes(option.id) ? selection.filter(id => id !== option.id) : [...selection, option.id] : [option.id])\n }}>{option.label}{option.votes === undefined ? null : ` (${option.votes})`}</Button>\n {option.votes !== undefined ? <progress aria-label={`${String(option.label)} results`} value={option.votes} max={Math.max(total, 1)} /> : null}\n </div>)}\n {controlled && !inert ? <div className=\"dsx-article-poll__actions\"><Button type=\"button\" size=\"lg\" disabled={!selection.length || !onSubmit} onClick={() => onSubmit?.(pollId, selection)}>{state === 'voted' ? 'Change vote' : 'Vote'}</Button>{state === 'voted' && onRetract ? <Button type=\"button\" size=\"lg\" variant=\"outline\" onClick={() => onRetract(pollId)}>Retract vote</Button> : null}</div> : null}\n </div>\n}\n\nexport { ArticleEmbed, ArticleImage, ArticlePoll, BeforeAfterComparison, ArticleVideo, ArticleMaterialLink, ArticlePlatformTabs }\nexport type {\n ArticleEmbedProps,\n ArticleImageProps,\n ArticlePollProps,\n BeforeAfterComparisonProps,\n PollState, ArticleVideoProps, ArticleMaterialLinkProps, ArticlePlatformTabsProps,\n} from './articleNodes.props'\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AACvB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AACvB,SAAS,YAAY;AAUmE,SAAsC,KAAtC;AAAxF,MAAM,eAAe,CAAC,EAAE,SAAS,WAAW,MAAM,IAAI,GAAG,MAAM,MAAyB,qBAAC,YAAO,WAAU,qBAAoB;AAAA,sBAAC,SAAK,GAAG,OAAO,KAAU,WAAW,WAAW,4BAA4B,SAAS,GAAG;AAAA,EAAG,UAAU,oBAAC,gBAAY,mBAAQ,IAAgB;AAAA,GAAK;AAE7Q,MAAM,eAAe,CAAC,EAAE,KAAK,QAAQ,WAAW,WAAW,GAAG,MAAM,MAAyB;AAC3F,MAAI;AACJ,MAAI;AAAE,UAAM,SAAS,IAAI,IAAI,GAAG;AAAG,QAAI,OAAO,aAAa,YAAY,OAAO,aAAa,QAAS,aAAY,OAAO;AAAA,EAAK,QAAQ;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ions_exports, {
32
32
  CalloutExtension: () => CalloutExtension,
33
33
  ComparisonExtension: () => ComparisonExtension,
34
34
  EmbedExtension: () => EmbedExtension,
35
+ MaterialLinkExtension: () => MaterialLinkExtension,
36
+ PlatformTabExtension: () => PlatformTabExtension,
37
+ PlatformTabsExtension: () => PlatformTabsExtension,
35
38
  PollExtension: () => PollExtension,
39
+ VideoExtension: () => VideoExtension,
36
40
  createArticleExtensions: () => createArticleExtensions
37
41
  });
38
42
  module.exports = __toCommonJS(articleExtensions_exports);
@@ -41,6 +45,8 @@ var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
41
45
  var import_extension_table = require("@tiptap/extension-table");
42
46
  var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
43
47
  var import_lowlight = require("lowlight");
48
+ var import_react = require("@tiptap/react");
49
+ var import_articleNodeViews = require("./articleNodeViews");
44
50
  const lowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
45
51
  const dataAttributes = (attributes) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value != null));
46
52
  const attribute = (key, htmlName = key, defaultValue = null) => ({ default: defaultValue, parseHTML: (element) => element.getAttribute(`data-dsx-${htmlName}`), renderHTML: (attributes) => attributes[key] == null ? {} : { [`data-dsx-${htmlName}`]: attributes[key] } });
@@ -54,7 +60,7 @@ const canonicalUrl = (value) => {
54
60
  };
55
61
  const ArticleImageExtension = import_extension_image.default.extend({
56
62
  addAttributes() {
57
- return { ...this.parent?.(), caption: { default: null, parseHTML: (element) => element.getAttribute("data-dsx-caption"), renderHTML: ({ caption }) => caption ? { "data-dsx-caption": caption } : {} } };
63
+ return { ...this.parent?.(), mediaId: attribute("mediaId", "media-id"), caption: { default: null, parseHTML: (element) => element.getAttribute("data-dsx-caption"), renderHTML: ({ caption }) => caption ? { "data-dsx-caption": caption } : {} } };
58
64
  }
59
65
  });
60
66
  const EmbedExtension = import_core.Node.create({ name: "dsxEmbed", group: "block", atom: true, addAttributes: () => ({ url: attribute("url") }), parseHTML: () => [{ tag: 'div[data-dsx-node="embed"]' }], renderHTML: ({ HTMLAttributes }) => {
@@ -63,8 +69,19 @@ const EmbedExtension = import_core.Node.create({ name: "dsxEmbed", group: "block
63
69
  } });
64
70
  const CalloutExtension = import_core.Node.create({ name: "dsxCallout", group: "block", content: "block+", defining: true, addAttributes: () => ({ tone: attribute("tone", "tone", "info"), title: attribute("title") }), parseHTML: () => [{ tag: 'aside[data-dsx-node="callout"]' }], renderHTML: ({ HTMLAttributes }) => ["aside", (0, import_core.mergeAttributes)({ "data-dsx-node": "callout" }, dataAttributes(HTMLAttributes)), 0] });
65
71
  const ComparisonExtension = import_core.Node.create({ name: "dsxComparison", group: "block", atom: true, addAttributes: () => ({ beforeSrc: attribute("beforeSrc", "before-src"), afterSrc: attribute("afterSrc", "after-src"), beforeAlt: attribute("beforeAlt", "before-alt", ""), afterAlt: attribute("afterAlt", "after-alt", ""), beforeLabel: attribute("beforeLabel", "before-label"), afterLabel: attribute("afterLabel", "after-label") }), parseHTML: () => [{ tag: 'figure[data-dsx-node="comparison"]' }], renderHTML: ({ HTMLAttributes }) => ["figure", (0, import_core.mergeAttributes)({ "data-dsx-node": "comparison" }, dataAttributes(HTMLAttributes))] });
66
- const PollExtension = import_core.Node.create({ name: "dsxPoll", group: "block", atom: true, addAttributes: () => ({ pollId: attribute("pollId", "poll-id"), question: attribute("question") }), parseHTML: () => [{ tag: 'div[data-dsx-node="poll"]' }], renderHTML: ({ HTMLAttributes }) => ["div", (0, import_core.mergeAttributes)({ "data-dsx-node": "poll" }, dataAttributes(HTMLAttributes))] });
67
- function createArticleExtensions() {
68
- return [ArticleImageExtension, EmbedExtension, CalloutExtension, import_extension_code_block_lowlight.default.configure({ lowlight }), import_extension_table.Table.configure({ resizable: true }), import_extension_table.TableRow, import_extension_table.TableHeader, import_extension_table.TableCell, ComparisonExtension, PollExtension];
72
+ const PollExtension = import_core.Node.create({ name: "dsxPoll", group: "block", atom: true, addAttributes: () => ({ pollId: attribute("pollId", "poll-id"), question: attribute("question"), multiple: { default: false, parseHTML: (element) => element.getAttribute("data-dsx-multiple") === "true", renderHTML: (attrs) => ({ "data-dsx-multiple": String(attrs.multiple) }) }, options: { default: [], parseHTML: (element) => {
73
+ try {
74
+ return JSON.parse(element.getAttribute("data-dsx-options") ?? "[]");
75
+ } catch {
76
+ return [];
77
+ }
78
+ }, renderHTML: (attrs) => ({ "data-dsx-options": JSON.stringify(attrs.options) }) } }), parseHTML: () => [{ tag: 'div[data-dsx-node="poll"]' }], renderHTML: ({ HTMLAttributes }) => ["div", (0, import_core.mergeAttributes)({ "data-dsx-node": "poll" }, dataAttributes(HTMLAttributes))] });
79
+ const VideoExtension = import_core.Node.create({ name: "dsxVideo", group: "block", atom: true, addAttributes: () => ({ src: attribute("src"), caption: attribute("caption"), mediaId: attribute("mediaId", "media-id") }), parseHTML: () => [{ tag: 'figure[data-dsx-node="video"]' }], renderHTML: ({ HTMLAttributes }) => ["figure", (0, import_core.mergeAttributes)({ "data-dsx-node": "video" }, dataAttributes(HTMLAttributes))] });
80
+ const MaterialLinkExtension = import_core.Node.create({ name: "dsxMaterialLink", group: "block", atom: true, addAttributes: () => ({ materialId: attribute("materialId", "material-id"), label: attribute("label"), href: attribute("href") }), parseHTML: () => [{ tag: 'div[data-dsx-node="material-link"]' }], renderHTML: ({ HTMLAttributes }) => ["div", (0, import_core.mergeAttributes)({ "data-dsx-node": "material-link" }, dataAttributes(HTMLAttributes))] });
81
+ const PlatformTabsExtension = import_core.Node.create({ name: "dsxTabs", group: "block", content: "dsxTab+", defining: true, parseHTML: () => [{ tag: 'div[data-dsx-node="tabs"]' }], renderHTML: () => ["div", { "data-dsx-node": "tabs" }, 0] });
82
+ const PlatformTabExtension = import_core.Node.create({ name: "dsxTab", content: "block+", defining: true, addAttributes: () => ({ platform: attribute("platform"), label: attribute("label") }), parseHTML: () => [{ tag: 'section[data-dsx-node="tab"]' }], renderHTML: ({ HTMLAttributes }) => ["section", (0, import_core.mergeAttributes)({ "data-dsx-node": "tab" }, dataAttributes(HTMLAttributes)), 0] });
83
+ function createArticleExtensions({ editable = true } = {}) {
84
+ const blocks = [ArticleImageExtension, EmbedExtension, CalloutExtension, ComparisonExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension];
85
+ return [...blocks.map((extension) => editable ? extension.extend({ addNodeView: () => (0, import_react.ReactNodeViewRenderer)(import_articleNodeViews.ArticleBlockView) }) : extension), import_extension_code_block_lowlight.default.configure({ lowlight }), import_extension_table.Table.configure({ resizable: true }), import_extension_table.TableRow, import_extension_table.TableHeader, import_extension_table.TableCell];
69
86
  }
70
87
  //# sourceMappingURL=articleExtensions.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/articleNodes/articleExtensions.ts"],
4
- "sourcesContent": ["import { Node, mergeAttributes, type Extensions } from '@tiptap/core'\nimport Image from '@tiptap/extension-image'\nimport { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'\nimport CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'\nimport { common, createLowlight } from 'lowlight'\n\nconst lowlight = createLowlight(common)\nconst dataAttributes = (attributes: Record<string, unknown>) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value != null))\nconst attribute = (key: string, htmlName = key, defaultValue: unknown = null) => ({ default: defaultValue, parseHTML: (element: HTMLElement) => element.getAttribute(`data-dsx-${htmlName}`), renderHTML: (attributes: Record<string, unknown>) => attributes[key] == null ? {} : { [`data-dsx-${htmlName}`]: attributes[key] } })\nconst canonicalUrl = (value: unknown) => { try { const url = new URL(String(value)); return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : null } catch { return null } }\n\nconst ArticleImageExtension = Image.extend({\n addAttributes() { return { ...this.parent?.(), caption: { default: null, parseHTML: (element) => element.getAttribute('data-dsx-caption'), renderHTML: ({ caption }) => caption ? { 'data-dsx-caption': caption } : {} } } },\n})\nconst EmbedExtension = Node.create({ name: 'dsxEmbed', group: 'block', atom: true, addAttributes: () => ({ url: attribute('url') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"embed\"]' }], renderHTML: ({ HTMLAttributes }) => { const url = canonicalUrl(HTMLAttributes['data-dsx-url']); return ['div', { 'data-dsx-node': 'embed', ...(url ? { 'data-dsx-url': url } : { 'data-dsx-invalid': 'true' }) }] } })\nconst CalloutExtension = Node.create({ name: 'dsxCallout', group: 'block', content: 'block+', defining: true, addAttributes: () => ({ tone: attribute('tone', 'tone', 'info'), title: attribute('title') }), parseHTML: () => [{ tag: 'aside[data-dsx-node=\"callout\"]' }], renderHTML: ({ HTMLAttributes }) => ['aside', mergeAttributes({ 'data-dsx-node': 'callout' }, dataAttributes(HTMLAttributes)), 0] })\nconst ComparisonExtension = Node.create({ name: 'dsxComparison', group: 'block', atom: true, addAttributes: () => ({ beforeSrc: attribute('beforeSrc', 'before-src'), afterSrc: attribute('afterSrc', 'after-src'), beforeAlt: attribute('beforeAlt', 'before-alt', ''), afterAlt: attribute('afterAlt', 'after-alt', ''), beforeLabel: attribute('beforeLabel', 'before-label'), afterLabel: attribute('afterLabel', 'after-label') }), parseHTML: () => [{ tag: 'figure[data-dsx-node=\"comparison\"]' }], renderHTML: ({ HTMLAttributes }) => ['figure', mergeAttributes({ 'data-dsx-node': 'comparison' }, dataAttributes(HTMLAttributes))] })\nconst PollExtension = Node.create({ name: 'dsxPoll', group: 'block', atom: true, addAttributes: () => ({ pollId: attribute('pollId', 'poll-id'), question: attribute('question') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"poll\"]' }], renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes({ 'data-dsx-node': 'poll' }, dataAttributes(HTMLAttributes))] })\n\nfunction createArticleExtensions(): Extensions {\n return [ArticleImageExtension, EmbedExtension, CalloutExtension, CodeBlockLowlight.configure({ lowlight }), Table.configure({ resizable: true }), TableRow, TableHeader, TableCell, ComparisonExtension, PollExtension]\n}\n\nexport { ArticleImage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,IAAI,WAAW,MAAM,CAAC,EAAE,KAAK,4BAA4B,CAAC,GAAG,YAAY,CAAC,EAAE,eAAe,MAAM,CAAC,WAAO,6BAAgB,EAAE,iBAAiB,OAAO,GAAG,eAAe,cAAc,CAAC,CAAC,EAAE,CAAC;AAEzW,SAAS,0BAAsC;AAC7C,SAAO,CAAC,uBAAuB,gBAAgB,kBAAkB,qCAAAC,QAAkB,UAAU,EAAE,SAAS,CAAC,GAAG,6BAAM,UAAU,EAAE,WAAW,KAAK,CAAC,GAAG,iCAAU,oCAAa,kCAAW,qBAAqB,aAAa;AACxN;",
4
+ "sourcesContent": ["import { Node, mergeAttributes, type Extensions } from '@tiptap/core'\nimport Image from '@tiptap/extension-image'\nimport { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'\nimport CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'\nimport { common, createLowlight } from 'lowlight'\nimport { ReactNodeViewRenderer } from '@tiptap/react'\nimport { ArticleBlockView } from './articleNodeViews'\n\nconst lowlight = createLowlight(common)\nconst dataAttributes = (attributes: Record<string, unknown>) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value != null))\nconst attribute = (key: string, htmlName = key, defaultValue: unknown = null) => ({ default: defaultValue, parseHTML: (element: HTMLElement) => element.getAttribute(`data-dsx-${htmlName}`), renderHTML: (attributes: Record<string, unknown>) => attributes[key] == null ? {} : { [`data-dsx-${htmlName}`]: attributes[key] } })\nconst canonicalUrl = (value: unknown) => { try { const url = new URL(String(value)); return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : null } catch { return null } }\n\nconst ArticleImageExtension = Image.extend({\n addAttributes() { return { ...this.parent?.(), mediaId: attribute('mediaId', 'media-id'), caption: { default: null, parseHTML: (element) => element.getAttribute('data-dsx-caption'), renderHTML: ({ caption }) => caption ? { 'data-dsx-caption': caption } : {} } } },\n})\nconst EmbedExtension = Node.create({ name: 'dsxEmbed', group: 'block', atom: true, addAttributes: () => ({ url: attribute('url') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"embed\"]' }], renderHTML: ({ HTMLAttributes }) => { const url = canonicalUrl(HTMLAttributes['data-dsx-url']); return ['div', { 'data-dsx-node': 'embed', ...(url ? { 'data-dsx-url': url } : { 'data-dsx-invalid': 'true' }) }] } })\nconst CalloutExtension = Node.create({ name: 'dsxCallout', group: 'block', content: 'block+', defining: true, addAttributes: () => ({ tone: attribute('tone', 'tone', 'info'), title: attribute('title') }), parseHTML: () => [{ tag: 'aside[data-dsx-node=\"callout\"]' }], renderHTML: ({ HTMLAttributes }) => ['aside', mergeAttributes({ 'data-dsx-node': 'callout' }, dataAttributes(HTMLAttributes)), 0] })\nconst ComparisonExtension = Node.create({ name: 'dsxComparison', group: 'block', atom: true, addAttributes: () => ({ beforeSrc: attribute('beforeSrc', 'before-src'), afterSrc: attribute('afterSrc', 'after-src'), beforeAlt: attribute('beforeAlt', 'before-alt', ''), afterAlt: attribute('afterAlt', 'after-alt', ''), beforeLabel: attribute('beforeLabel', 'before-label'), afterLabel: attribute('afterLabel', 'after-label') }), parseHTML: () => [{ tag: 'figure[data-dsx-node=\"comparison\"]' }], renderHTML: ({ HTMLAttributes }) => ['figure', mergeAttributes({ 'data-dsx-node': 'comparison' }, dataAttributes(HTMLAttributes))] })\nconst PollExtension = Node.create({ name: 'dsxPoll', group: 'block', atom: true, addAttributes: () => ({ pollId: attribute('pollId', 'poll-id'), question: attribute('question'), multiple: { default: false, parseHTML: element => element.getAttribute('data-dsx-multiple') === 'true', renderHTML: attrs => ({ 'data-dsx-multiple': String(attrs.multiple) }) }, options: { default: [], parseHTML: element => { try { return JSON.parse(element.getAttribute('data-dsx-options') ?? '[]') } catch { return [] } }, renderHTML: attrs => ({ 'data-dsx-options': JSON.stringify(attrs.options) }) } }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"poll\"]' }], renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes({ 'data-dsx-node': 'poll' }, dataAttributes(HTMLAttributes))] })\n\nconst VideoExtension = Node.create({ name: 'dsxVideo', group: 'block', atom: true, addAttributes: () => ({ src: attribute('src'), caption: attribute('caption'), mediaId: attribute('mediaId', 'media-id') }), parseHTML: () => [{ tag: 'figure[data-dsx-node=\"video\"]' }], renderHTML: ({ HTMLAttributes }) => ['figure', mergeAttributes({ 'data-dsx-node': 'video' }, dataAttributes(HTMLAttributes))] })\nconst MaterialLinkExtension = Node.create({ name: 'dsxMaterialLink', group: 'block', atom: true, addAttributes: () => ({ materialId: attribute('materialId', 'material-id'), label: attribute('label'), href: attribute('href') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"material-link\"]' }], renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes({ 'data-dsx-node': 'material-link' }, dataAttributes(HTMLAttributes))] })\nconst PlatformTabsExtension = Node.create({ name: 'dsxTabs', group: 'block', content: 'dsxTab+', defining: true, parseHTML: () => [{ tag: 'div[data-dsx-node=\"tabs\"]' }], renderHTML: () => ['div', { 'data-dsx-node': 'tabs' }, 0] })\nconst PlatformTabExtension = Node.create({ name: 'dsxTab', content: 'block+', defining: true, addAttributes: () => ({ platform: attribute('platform'), label: attribute('label') }), parseHTML: () => [{ tag: 'section[data-dsx-node=\"tab\"]' }], renderHTML: ({ HTMLAttributes }) => ['section', mergeAttributes({ 'data-dsx-node': 'tab' }, dataAttributes(HTMLAttributes)), 0] })\n\nfunction createArticleExtensions({ editable = true }: { editable?: boolean } = {}): Extensions {\n const blocks = [ArticleImageExtension, EmbedExtension, CalloutExtension, ComparisonExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension]\n return [...blocks.map(extension => editable ? extension.extend({ addNodeView: () => ReactNodeViewRenderer(ArticleBlockView) }) : extension), CodeBlockLowlight.configure({ lowlight }), Table.configure({ resizable: true }), TableRow, TableHeader, TableCell]\n}\n\nexport { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension,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,gBAAgB,GAAG,eAAe,cAAc,CAAC,CAAC,EAAE,CAAC;AAC1a,MAAM,wBAAwB,iBAAK,OAAO,EAAE,MAAM,WAAW,OAAO,SAAS,SAAS,WAAW,UAAU,MAAM,WAAW,MAAM,CAAC,EAAE,KAAK,4BAA4B,CAAC,GAAG,YAAY,MAAM,CAAC,OAAO,EAAE,iBAAiB,OAAO,GAAG,CAAC,EAAE,CAAC;AACrO,MAAM,uBAAuB,iBAAK,OAAO,EAAE,MAAM,UAAU,SAAS,UAAU,UAAU,MAAM,eAAe,OAAO,EAAE,UAAU,UAAU,UAAU,GAAG,OAAO,UAAU,OAAO,EAAE,IAAI,WAAW,MAAM,CAAC,EAAE,KAAK,+BAA+B,CAAC,GAAG,YAAY,CAAC,EAAE,eAAe,MAAM,CAAC,eAAW,6BAAgB,EAAE,iBAAiB,MAAM,GAAG,eAAe,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;AAElX,SAAS,wBAAwB,EAAE,WAAW,KAAK,IAA4B,CAAC,GAAe;AAC7F,QAAM,SAAS,CAAC,uBAAuB,gBAAgB,kBAAkB,qBAAqB,eAAe,gBAAgB,uBAAuB,uBAAuB,oBAAoB;AAC/L,SAAO,CAAC,GAAG,OAAO,IAAI,eAAa,WAAW,UAAU,OAAO,EAAE,aAAa,UAAM,oCAAsB,wCAAgB,EAAE,CAAC,IAAI,SAAS,GAAG,qCAAAC,QAAkB,UAAU,EAAE,SAAS,CAAC,GAAG,6BAAM,UAAU,EAAE,WAAW,KAAK,CAAC,GAAG,iCAAU,oCAAa,gCAAS;AAChQ;",
6
6
  "names": ["Image", "CodeBlockLowlight"]
7
7
  }
@@ -4,6 +4,12 @@ declare const EmbedExtension: Node<any, any>;
4
4
  declare const CalloutExtension: Node<any, any>;
5
5
  declare const ComparisonExtension: Node<any, any>;
6
6
  declare const PollExtension: Node<any, any>;
7
- declare function createArticleExtensions(): Extensions;
8
- export { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, createArticleExtensions };
7
+ declare const VideoExtension: Node<any, any>;
8
+ declare const MaterialLinkExtension: Node<any, any>;
9
+ declare const PlatformTabsExtension: Node<any, any>;
10
+ declare const PlatformTabExtension: Node<any, any>;
11
+ declare function createArticleExtensions({ editable }?: {
12
+ editable?: boolean;
13
+ }): Extensions;
14
+ export { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension, createArticleExtensions };
9
15
  //# sourceMappingURL=articleExtensions.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"articleExtensions.d.cts","sourceRoot":"","sources":["../../../src/components/articleNodes/articleExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAWrE,QAAA,MAAM,qBAAqB,2DAEzB,CAAA;AACF,QAAA,MAAM,cAAc,gBAAiY,CAAA;AACrZ,QAAA,MAAM,gBAAgB,gBAAyX,CAAA;AAC/Y,QAAA,MAAM,mBAAmB,gBAAulB,CAAA;AAChnB,QAAA,MAAM,aAAa,gBAAuV,CAAA;AAE1W,iBAAS,uBAAuB,IAAI,UAAU,CAE7C;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,uBAAuB,EAAE,CAAA"}
1
+ {"version":3,"file":"articleExtensions.d.cts","sourceRoot":"","sources":["../../../src/components/articleNodes/articleExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAarE,QAAA,MAAM,qBAAqB,2DAEzB,CAAA;AACF,QAAA,MAAM,cAAc,gBAAiY,CAAA;AACrZ,QAAA,MAAM,gBAAgB,gBAAyX,CAAA;AAC/Y,QAAA,MAAM,mBAAmB,gBAAulB,CAAA;AAChnB,QAAA,MAAM,aAAa,gBAA4uB,CAAA;AAE/vB,QAAA,MAAM,cAAc,gBAAwX,CAAA;AAC5Y,QAAA,MAAM,qBAAqB,gBAAgZ,CAAA;AAC3a,QAAA,MAAM,qBAAqB,gBAA2M,CAAA;AACtO,QAAA,MAAM,oBAAoB,gBAAyV,CAAA;AAEnX,iBAAS,uBAAuB,CAAC,EAAE,QAAe,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,UAAU,CAG7F;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,CAAA"}
@@ -4,6 +4,12 @@ declare const EmbedExtension: Node<any, any>;
4
4
  declare const CalloutExtension: Node<any, any>;
5
5
  declare const ComparisonExtension: Node<any, any>;
6
6
  declare const PollExtension: Node<any, any>;
7
- declare function createArticleExtensions(): Extensions;
8
- export { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, createArticleExtensions };
7
+ declare const VideoExtension: Node<any, any>;
8
+ declare const MaterialLinkExtension: Node<any, any>;
9
+ declare const PlatformTabsExtension: Node<any, any>;
10
+ declare const PlatformTabExtension: Node<any, any>;
11
+ declare function createArticleExtensions({ editable }?: {
12
+ editable?: boolean;
13
+ }): Extensions;
14
+ export { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension, createArticleExtensions };
9
15
  //# sourceMappingURL=articleExtensions.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"articleExtensions.d.mts","sourceRoot":"","sources":["../../../src/components/articleNodes/articleExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAWrE,QAAA,MAAM,qBAAqB,2DAEzB,CAAA;AACF,QAAA,MAAM,cAAc,gBAAiY,CAAA;AACrZ,QAAA,MAAM,gBAAgB,gBAAyX,CAAA;AAC/Y,QAAA,MAAM,mBAAmB,gBAAulB,CAAA;AAChnB,QAAA,MAAM,aAAa,gBAAuV,CAAA;AAE1W,iBAAS,uBAAuB,IAAI,UAAU,CAE7C;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,uBAAuB,EAAE,CAAA"}
1
+ {"version":3,"file":"articleExtensions.d.mts","sourceRoot":"","sources":["../../../src/components/articleNodes/articleExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAarE,QAAA,MAAM,qBAAqB,2DAEzB,CAAA;AACF,QAAA,MAAM,cAAc,gBAAiY,CAAA;AACrZ,QAAA,MAAM,gBAAgB,gBAAyX,CAAA;AAC/Y,QAAA,MAAM,mBAAmB,gBAAulB,CAAA;AAChnB,QAAA,MAAM,aAAa,gBAA4uB,CAAA;AAE/vB,QAAA,MAAM,cAAc,gBAAwX,CAAA;AAC5Y,QAAA,MAAM,qBAAqB,gBAAgZ,CAAA;AAC3a,QAAA,MAAM,qBAAqB,gBAA2M,CAAA;AACtO,QAAA,MAAM,oBAAoB,gBAAyV,CAAA;AAEnX,iBAAS,uBAAuB,CAAC,EAAE,QAAe,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,UAAU,CAG7F;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,CAAA"}
@@ -4,6 +4,12 @@ declare const EmbedExtension: Node<any, any>;
4
4
  declare const CalloutExtension: Node<any, any>;
5
5
  declare const ComparisonExtension: Node<any, any>;
6
6
  declare const PollExtension: Node<any, any>;
7
- declare function createArticleExtensions(): Extensions;
8
- export { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, createArticleExtensions };
7
+ declare const VideoExtension: Node<any, any>;
8
+ declare const MaterialLinkExtension: Node<any, any>;
9
+ declare const PlatformTabsExtension: Node<any, any>;
10
+ declare const PlatformTabExtension: Node<any, any>;
11
+ declare function createArticleExtensions({ editable }?: {
12
+ editable?: boolean;
13
+ }): Extensions;
14
+ export { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension, createArticleExtensions };
9
15
  //# sourceMappingURL=articleExtensions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"articleExtensions.d.ts","sourceRoot":"","sources":["../../../src/components/articleNodes/articleExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAWrE,QAAA,MAAM,qBAAqB,2DAEzB,CAAA;AACF,QAAA,MAAM,cAAc,gBAAiY,CAAA;AACrZ,QAAA,MAAM,gBAAgB,gBAAyX,CAAA;AAC/Y,QAAA,MAAM,mBAAmB,gBAAulB,CAAA;AAChnB,QAAA,MAAM,aAAa,gBAAuV,CAAA;AAE1W,iBAAS,uBAAuB,IAAI,UAAU,CAE7C;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,uBAAuB,EAAE,CAAA"}
1
+ {"version":3,"file":"articleExtensions.d.ts","sourceRoot":"","sources":["../../../src/components/articleNodes/articleExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAarE,QAAA,MAAM,qBAAqB,2DAEzB,CAAA;AACF,QAAA,MAAM,cAAc,gBAAiY,CAAA;AACrZ,QAAA,MAAM,gBAAgB,gBAAyX,CAAA;AAC/Y,QAAA,MAAM,mBAAmB,gBAAulB,CAAA;AAChnB,QAAA,MAAM,aAAa,gBAA4uB,CAAA;AAE/vB,QAAA,MAAM,cAAc,gBAAwX,CAAA;AAC5Y,QAAA,MAAM,qBAAqB,gBAAgZ,CAAA;AAC3a,QAAA,MAAM,qBAAqB,gBAA2M,CAAA;AACtO,QAAA,MAAM,oBAAoB,gBAAyV,CAAA;AAEnX,iBAAS,uBAAuB,CAAC,EAAE,QAAe,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,UAAU,CAG7F;AAED,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,CAAA"}
@@ -3,6 +3,8 @@ import Image from "@tiptap/extension-image";
3
3
  import { Table, TableCell, TableHeader, TableRow } from "@tiptap/extension-table";
4
4
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
5
5
  import { common, createLowlight } from "lowlight";
6
+ import { ReactNodeViewRenderer } from "@tiptap/react";
7
+ import { ArticleBlockView } from "./articleNodeViews.js";
6
8
  const lowlight = createLowlight(common);
7
9
  const dataAttributes = (attributes) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value != null));
8
10
  const attribute = (key, htmlName = key, defaultValue = null) => ({ default: defaultValue, parseHTML: (element) => element.getAttribute(`data-dsx-${htmlName}`), renderHTML: (attributes) => attributes[key] == null ? {} : { [`data-dsx-${htmlName}`]: attributes[key] } });
@@ -16,7 +18,7 @@ const canonicalUrl = (value) => {
16
18
  };
17
19
  const ArticleImageExtension = Image.extend({
18
20
  addAttributes() {
19
- return { ...this.parent?.(), caption: { default: null, parseHTML: (element) => element.getAttribute("data-dsx-caption"), renderHTML: ({ caption }) => caption ? { "data-dsx-caption": caption } : {} } };
21
+ return { ...this.parent?.(), mediaId: attribute("mediaId", "media-id"), caption: { default: null, parseHTML: (element) => element.getAttribute("data-dsx-caption"), renderHTML: ({ caption }) => caption ? { "data-dsx-caption": caption } : {} } };
20
22
  }
21
23
  });
22
24
  const EmbedExtension = Node.create({ name: "dsxEmbed", group: "block", atom: true, addAttributes: () => ({ url: attribute("url") }), parseHTML: () => [{ tag: 'div[data-dsx-node="embed"]' }], renderHTML: ({ HTMLAttributes }) => {
@@ -25,16 +27,31 @@ const EmbedExtension = Node.create({ name: "dsxEmbed", group: "block", atom: tru
25
27
  } });
26
28
  const CalloutExtension = Node.create({ name: "dsxCallout", group: "block", content: "block+", defining: true, addAttributes: () => ({ tone: attribute("tone", "tone", "info"), title: attribute("title") }), parseHTML: () => [{ tag: 'aside[data-dsx-node="callout"]' }], renderHTML: ({ HTMLAttributes }) => ["aside", mergeAttributes({ "data-dsx-node": "callout" }, dataAttributes(HTMLAttributes)), 0] });
27
29
  const ComparisonExtension = Node.create({ name: "dsxComparison", group: "block", atom: true, addAttributes: () => ({ beforeSrc: attribute("beforeSrc", "before-src"), afterSrc: attribute("afterSrc", "after-src"), beforeAlt: attribute("beforeAlt", "before-alt", ""), afterAlt: attribute("afterAlt", "after-alt", ""), beforeLabel: attribute("beforeLabel", "before-label"), afterLabel: attribute("afterLabel", "after-label") }), parseHTML: () => [{ tag: 'figure[data-dsx-node="comparison"]' }], renderHTML: ({ HTMLAttributes }) => ["figure", mergeAttributes({ "data-dsx-node": "comparison" }, dataAttributes(HTMLAttributes))] });
28
- const PollExtension = Node.create({ name: "dsxPoll", group: "block", atom: true, addAttributes: () => ({ pollId: attribute("pollId", "poll-id"), question: attribute("question") }), parseHTML: () => [{ tag: 'div[data-dsx-node="poll"]' }], renderHTML: ({ HTMLAttributes }) => ["div", mergeAttributes({ "data-dsx-node": "poll" }, dataAttributes(HTMLAttributes))] });
29
- function createArticleExtensions() {
30
- return [ArticleImageExtension, EmbedExtension, CalloutExtension, CodeBlockLowlight.configure({ lowlight }), Table.configure({ resizable: true }), TableRow, TableHeader, TableCell, ComparisonExtension, PollExtension];
30
+ const PollExtension = Node.create({ name: "dsxPoll", group: "block", atom: true, addAttributes: () => ({ pollId: attribute("pollId", "poll-id"), question: attribute("question"), multiple: { default: false, parseHTML: (element) => element.getAttribute("data-dsx-multiple") === "true", renderHTML: (attrs) => ({ "data-dsx-multiple": String(attrs.multiple) }) }, options: { default: [], parseHTML: (element) => {
31
+ try {
32
+ return JSON.parse(element.getAttribute("data-dsx-options") ?? "[]");
33
+ } catch {
34
+ return [];
35
+ }
36
+ }, renderHTML: (attrs) => ({ "data-dsx-options": JSON.stringify(attrs.options) }) } }), parseHTML: () => [{ tag: 'div[data-dsx-node="poll"]' }], renderHTML: ({ HTMLAttributes }) => ["div", mergeAttributes({ "data-dsx-node": "poll" }, dataAttributes(HTMLAttributes))] });
37
+ const VideoExtension = Node.create({ name: "dsxVideo", group: "block", atom: true, addAttributes: () => ({ src: attribute("src"), caption: attribute("caption"), mediaId: attribute("mediaId", "media-id") }), parseHTML: () => [{ tag: 'figure[data-dsx-node="video"]' }], renderHTML: ({ HTMLAttributes }) => ["figure", mergeAttributes({ "data-dsx-node": "video" }, dataAttributes(HTMLAttributes))] });
38
+ const MaterialLinkExtension = Node.create({ name: "dsxMaterialLink", group: "block", atom: true, addAttributes: () => ({ materialId: attribute("materialId", "material-id"), label: attribute("label"), href: attribute("href") }), parseHTML: () => [{ tag: 'div[data-dsx-node="material-link"]' }], renderHTML: ({ HTMLAttributes }) => ["div", mergeAttributes({ "data-dsx-node": "material-link" }, dataAttributes(HTMLAttributes))] });
39
+ const PlatformTabsExtension = Node.create({ name: "dsxTabs", group: "block", content: "dsxTab+", defining: true, parseHTML: () => [{ tag: 'div[data-dsx-node="tabs"]' }], renderHTML: () => ["div", { "data-dsx-node": "tabs" }, 0] });
40
+ const PlatformTabExtension = Node.create({ name: "dsxTab", content: "block+", defining: true, addAttributes: () => ({ platform: attribute("platform"), label: attribute("label") }), parseHTML: () => [{ tag: 'section[data-dsx-node="tab"]' }], renderHTML: ({ HTMLAttributes }) => ["section", mergeAttributes({ "data-dsx-node": "tab" }, dataAttributes(HTMLAttributes)), 0] });
41
+ function createArticleExtensions({ editable = true } = {}) {
42
+ const blocks = [ArticleImageExtension, EmbedExtension, CalloutExtension, ComparisonExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension];
43
+ return [...blocks.map((extension) => editable ? extension.extend({ addNodeView: () => ReactNodeViewRenderer(ArticleBlockView) }) : extension), CodeBlockLowlight.configure({ lowlight }), Table.configure({ resizable: true }), TableRow, TableHeader, TableCell];
31
44
  }
32
45
  export {
33
46
  ArticleImageExtension,
34
47
  CalloutExtension,
35
48
  ComparisonExtension,
36
49
  EmbedExtension,
50
+ MaterialLinkExtension,
51
+ PlatformTabExtension,
52
+ PlatformTabsExtension,
37
53
  PollExtension,
54
+ VideoExtension,
38
55
  createArticleExtensions
39
56
  };
40
57
  //# sourceMappingURL=articleExtensions.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/articleNodes/articleExtensions.ts"],
4
- "sourcesContent": ["import { Node, mergeAttributes, type Extensions } from '@tiptap/core'\nimport Image from '@tiptap/extension-image'\nimport { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'\nimport CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'\nimport { common, createLowlight } from 'lowlight'\n\nconst lowlight = createLowlight(common)\nconst dataAttributes = (attributes: Record<string, unknown>) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value != null))\nconst attribute = (key: string, htmlName = key, defaultValue: unknown = null) => ({ default: defaultValue, parseHTML: (element: HTMLElement) => element.getAttribute(`data-dsx-${htmlName}`), renderHTML: (attributes: Record<string, unknown>) => attributes[key] == null ? {} : { [`data-dsx-${htmlName}`]: attributes[key] } })\nconst canonicalUrl = (value: unknown) => { try { const url = new URL(String(value)); return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : null } catch { return null } }\n\nconst ArticleImageExtension = Image.extend({\n addAttributes() { return { ...this.parent?.(), caption: { default: null, parseHTML: (element) => element.getAttribute('data-dsx-caption'), renderHTML: ({ caption }) => caption ? { 'data-dsx-caption': caption } : {} } } },\n})\nconst EmbedExtension = Node.create({ name: 'dsxEmbed', group: 'block', atom: true, addAttributes: () => ({ url: attribute('url') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"embed\"]' }], renderHTML: ({ HTMLAttributes }) => { const url = canonicalUrl(HTMLAttributes['data-dsx-url']); return ['div', { 'data-dsx-node': 'embed', ...(url ? { 'data-dsx-url': url } : { 'data-dsx-invalid': 'true' }) }] } })\nconst CalloutExtension = Node.create({ name: 'dsxCallout', group: 'block', content: 'block+', defining: true, addAttributes: () => ({ tone: attribute('tone', 'tone', 'info'), title: attribute('title') }), parseHTML: () => [{ tag: 'aside[data-dsx-node=\"callout\"]' }], renderHTML: ({ HTMLAttributes }) => ['aside', mergeAttributes({ 'data-dsx-node': 'callout' }, dataAttributes(HTMLAttributes)), 0] })\nconst ComparisonExtension = Node.create({ name: 'dsxComparison', group: 'block', atom: true, addAttributes: () => ({ beforeSrc: attribute('beforeSrc', 'before-src'), afterSrc: attribute('afterSrc', 'after-src'), beforeAlt: attribute('beforeAlt', 'before-alt', ''), afterAlt: attribute('afterAlt', 'after-alt', ''), beforeLabel: attribute('beforeLabel', 'before-label'), afterLabel: attribute('afterLabel', 'after-label') }), parseHTML: () => [{ tag: 'figure[data-dsx-node=\"comparison\"]' }], renderHTML: ({ HTMLAttributes }) => ['figure', mergeAttributes({ 'data-dsx-node': 'comparison' }, dataAttributes(HTMLAttributes))] })\nconst PollExtension = Node.create({ name: 'dsxPoll', group: 'block', atom: true, addAttributes: () => ({ pollId: attribute('pollId', 'poll-id'), question: attribute('question') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"poll\"]' }], renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes({ 'data-dsx-node': 'poll' }, dataAttributes(HTMLAttributes))] })\n\nfunction createArticleExtensions(): Extensions {\n return [ArticleImageExtension, EmbedExtension, CalloutExtension, CodeBlockLowlight.configure({ lowlight }), Table.configure({ resizable: true }), TableRow, TableHeader, TableCell, ComparisonExtension, PollExtension]\n}\n\nexport { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, createArticleExtensions }\n"],
5
- "mappings": "AAAA,SAAS,MAAM,uBAAwC;AACvD,OAAO,WAAW;AAClB,SAAS,OAAO,WAAW,aAAa,gBAAgB;AACxD,OAAO,uBAAuB;AAC9B,SAAS,QAAQ,sBAAsB;AAEvC,MAAM,WAAW,eAAe,MAAM;AACtC,MAAM,iBAAiB,CAAC,eAAwC,OAAO,YAAY,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,SAAS,IAAI,CAAC;AAClJ,MAAM,YAAY,CAAC,KAAa,WAAW,KAAK,eAAwB,UAAU,EAAE,SAAS,cAAc,WAAW,CAAC,YAAyB,QAAQ,aAAa,YAAY,QAAQ,EAAE,GAAG,YAAY,CAAC,eAAwC,WAAW,GAAG,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,YAAY,QAAQ,EAAE,GAAG,WAAW,GAAG,EAAE,EAAE;AAChU,MAAM,eAAe,CAAC,UAAmB;AAAE,MAAI;AAAE,UAAM,MAAM,IAAI,IAAI,OAAO,KAAK,CAAC;AAAG,WAAO,IAAI,aAAa,YAAY,IAAI,aAAa,UAAU,IAAI,OAAO;AAAA,EAAK,QAAQ;AAAE,WAAO;AAAA,EAAK;AAAE;AAE5L,MAAM,wBAAwB,MAAM,OAAO;AAAA,EACzC,gBAAgB;AAAE,WAAO,EAAE,GAAG,KAAK,SAAS,GAAG,SAAS,EAAE,SAAS,MAAM,WAAW,CAAC,YAAY,QAAQ,aAAa,kBAAkB,GAAG,YAAY,CAAC,EAAE,QAAQ,MAAM,UAAU,EAAE,oBAAoB,QAAQ,IAAI,CAAC,EAAE,EAAE;AAAA,EAAE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AAE,MAAM,WAAW,OAAO,SAAS,MAAM,MAAM,eAAe,OAAO,EAAE,QAAQ,UAAU,UAAU,SAAS,GAAG,UAAU,UAAU,UAAU,EAAE,IAAI,WAAW,MAAM,CAAC,EAAE,KAAK,4BAA4B,CAAC,GAAG,YAAY,CAAC,EAAE,eAAe,MAAM,CAAC,OAAO,gBAAgB,EAAE,iBAAiB,OAAO,GAAG,eAAe,cAAc,CAAC,CAAC,EAAE,CAAC;AAEzW,SAAS,0BAAsC;AAC7C,SAAO,CAAC,uBAAuB,gBAAgB,kBAAkB,kBAAkB,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,UAAU,EAAE,WAAW,KAAK,CAAC,GAAG,UAAU,aAAa,WAAW,qBAAqB,aAAa;AACxN;",
4
+ "sourcesContent": ["import { Node, mergeAttributes, type Extensions } from '@tiptap/core'\nimport Image from '@tiptap/extension-image'\nimport { Table, TableCell, TableHeader, TableRow } from '@tiptap/extension-table'\nimport CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'\nimport { common, createLowlight } from 'lowlight'\nimport { ReactNodeViewRenderer } from '@tiptap/react'\nimport { ArticleBlockView } from './articleNodeViews'\n\nconst lowlight = createLowlight(common)\nconst dataAttributes = (attributes: Record<string, unknown>) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value != null))\nconst attribute = (key: string, htmlName = key, defaultValue: unknown = null) => ({ default: defaultValue, parseHTML: (element: HTMLElement) => element.getAttribute(`data-dsx-${htmlName}`), renderHTML: (attributes: Record<string, unknown>) => attributes[key] == null ? {} : { [`data-dsx-${htmlName}`]: attributes[key] } })\nconst canonicalUrl = (value: unknown) => { try { const url = new URL(String(value)); return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : null } catch { return null } }\n\nconst ArticleImageExtension = Image.extend({\n addAttributes() { return { ...this.parent?.(), mediaId: attribute('mediaId', 'media-id'), caption: { default: null, parseHTML: (element) => element.getAttribute('data-dsx-caption'), renderHTML: ({ caption }) => caption ? { 'data-dsx-caption': caption } : {} } } },\n})\nconst EmbedExtension = Node.create({ name: 'dsxEmbed', group: 'block', atom: true, addAttributes: () => ({ url: attribute('url') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"embed\"]' }], renderHTML: ({ HTMLAttributes }) => { const url = canonicalUrl(HTMLAttributes['data-dsx-url']); return ['div', { 'data-dsx-node': 'embed', ...(url ? { 'data-dsx-url': url } : { 'data-dsx-invalid': 'true' }) }] } })\nconst CalloutExtension = Node.create({ name: 'dsxCallout', group: 'block', content: 'block+', defining: true, addAttributes: () => ({ tone: attribute('tone', 'tone', 'info'), title: attribute('title') }), parseHTML: () => [{ tag: 'aside[data-dsx-node=\"callout\"]' }], renderHTML: ({ HTMLAttributes }) => ['aside', mergeAttributes({ 'data-dsx-node': 'callout' }, dataAttributes(HTMLAttributes)), 0] })\nconst ComparisonExtension = Node.create({ name: 'dsxComparison', group: 'block', atom: true, addAttributes: () => ({ beforeSrc: attribute('beforeSrc', 'before-src'), afterSrc: attribute('afterSrc', 'after-src'), beforeAlt: attribute('beforeAlt', 'before-alt', ''), afterAlt: attribute('afterAlt', 'after-alt', ''), beforeLabel: attribute('beforeLabel', 'before-label'), afterLabel: attribute('afterLabel', 'after-label') }), parseHTML: () => [{ tag: 'figure[data-dsx-node=\"comparison\"]' }], renderHTML: ({ HTMLAttributes }) => ['figure', mergeAttributes({ 'data-dsx-node': 'comparison' }, dataAttributes(HTMLAttributes))] })\nconst PollExtension = Node.create({ name: 'dsxPoll', group: 'block', atom: true, addAttributes: () => ({ pollId: attribute('pollId', 'poll-id'), question: attribute('question'), multiple: { default: false, parseHTML: element => element.getAttribute('data-dsx-multiple') === 'true', renderHTML: attrs => ({ 'data-dsx-multiple': String(attrs.multiple) }) }, options: { default: [], parseHTML: element => { try { return JSON.parse(element.getAttribute('data-dsx-options') ?? '[]') } catch { return [] } }, renderHTML: attrs => ({ 'data-dsx-options': JSON.stringify(attrs.options) }) } }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"poll\"]' }], renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes({ 'data-dsx-node': 'poll' }, dataAttributes(HTMLAttributes))] })\n\nconst VideoExtension = Node.create({ name: 'dsxVideo', group: 'block', atom: true, addAttributes: () => ({ src: attribute('src'), caption: attribute('caption'), mediaId: attribute('mediaId', 'media-id') }), parseHTML: () => [{ tag: 'figure[data-dsx-node=\"video\"]' }], renderHTML: ({ HTMLAttributes }) => ['figure', mergeAttributes({ 'data-dsx-node': 'video' }, dataAttributes(HTMLAttributes))] })\nconst MaterialLinkExtension = Node.create({ name: 'dsxMaterialLink', group: 'block', atom: true, addAttributes: () => ({ materialId: attribute('materialId', 'material-id'), label: attribute('label'), href: attribute('href') }), parseHTML: () => [{ tag: 'div[data-dsx-node=\"material-link\"]' }], renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes({ 'data-dsx-node': 'material-link' }, dataAttributes(HTMLAttributes))] })\nconst PlatformTabsExtension = Node.create({ name: 'dsxTabs', group: 'block', content: 'dsxTab+', defining: true, parseHTML: () => [{ tag: 'div[data-dsx-node=\"tabs\"]' }], renderHTML: () => ['div', { 'data-dsx-node': 'tabs' }, 0] })\nconst PlatformTabExtension = Node.create({ name: 'dsxTab', content: 'block+', defining: true, addAttributes: () => ({ platform: attribute('platform'), label: attribute('label') }), parseHTML: () => [{ tag: 'section[data-dsx-node=\"tab\"]' }], renderHTML: ({ HTMLAttributes }) => ['section', mergeAttributes({ 'data-dsx-node': 'tab' }, dataAttributes(HTMLAttributes)), 0] })\n\nfunction createArticleExtensions({ editable = true }: { editable?: boolean } = {}): Extensions {\n const blocks = [ArticleImageExtension, EmbedExtension, CalloutExtension, ComparisonExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension]\n return [...blocks.map(extension => editable ? extension.extend({ addNodeView: () => ReactNodeViewRenderer(ArticleBlockView) }) : extension), CodeBlockLowlight.configure({ lowlight }), Table.configure({ resizable: true }), TableRow, TableHeader, TableCell]\n}\n\nexport { ArticleImageExtension, CalloutExtension, ComparisonExtension, EmbedExtension, PollExtension, VideoExtension, MaterialLinkExtension, PlatformTabsExtension, PlatformTabExtension, createArticleExtensions }\n"],
5
+ "mappings": "AAAA,SAAS,MAAM,uBAAwC;AACvD,OAAO,WAAW;AAClB,SAAS,OAAO,WAAW,aAAa,gBAAgB;AACxD,OAAO,uBAAuB;AAC9B,SAAS,QAAQ,sBAAsB;AACvC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AAEjC,MAAM,WAAW,eAAe,MAAM;AACtC,MAAM,iBAAiB,CAAC,eAAwC,OAAO,YAAY,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,SAAS,IAAI,CAAC;AAClJ,MAAM,YAAY,CAAC,KAAa,WAAW,KAAK,eAAwB,UAAU,EAAE,SAAS,cAAc,WAAW,CAAC,YAAyB,QAAQ,aAAa,YAAY,QAAQ,EAAE,GAAG,YAAY,CAAC,eAAwC,WAAW,GAAG,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,YAAY,QAAQ,EAAE,GAAG,WAAW,GAAG,EAAE,EAAE;AAChU,MAAM,eAAe,CAAC,UAAmB;AAAE,MAAI;AAAE,UAAM,MAAM,IAAI,IAAI,OAAO,KAAK,CAAC;AAAG,WAAO,IAAI,aAAa,YAAY,IAAI,aAAa,UAAU,IAAI,OAAO;AAAA,EAAK,QAAQ;AAAE,WAAO;AAAA,EAAK;AAAE;AAE5L,MAAM,wBAAwB,MAAM,OAAO;AAAA,EACzC,gBAAgB;AAAE,WAAO,EAAE,GAAG,KAAK,SAAS,GAAG,SAAS,UAAU,WAAW,UAAU,GAAG,SAAS,EAAE,SAAS,MAAM,WAAW,CAAC,YAAY,QAAQ,aAAa,kBAAkB,GAAG,YAAY,CAAC,EAAE,QAAQ,MAAM,UAAU,EAAE,oBAAoB,QAAQ,IAAI,CAAC,EAAE,EAAE;AAAA,EAAE;AACxQ,CAAC;AACD,MAAM,iBAAiB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M,CAAC,OAAO,gBAAgB,EAAE,iBAAiB,gBAAgB,GAAG,eAAe,cAAc,CAAC,CAAC,EAAE,CAAC;AAC1a,MAAM,wBAAwB,KAAK,OAAO,EAAE,MAAM,WAAW,OAAO,SAAS,SAAS,WAAW,UAAU,MAAM,WAAW,MAAM,CAAC,EAAE,KAAK,4BAA4B,CAAC,GAAG,YAAY,MAAM,CAAC,OAAO,EAAE,iBAAiB,OAAO,GAAG,CAAC,EAAE,CAAC;AACrO,MAAM,uBAAuB,KAAK,OAAO,EAAE,MAAM,UAAU,SAAS,UAAU,UAAU,MAAM,eAAe,OAAO,EAAE,UAAU,UAAU,UAAU,GAAG,OAAO,UAAU,OAAO,EAAE,IAAI,WAAW,MAAM,CAAC,EAAE,KAAK,+BAA+B,CAAC,GAAG,YAAY,CAAC,EAAE,eAAe,MAAM,CAAC,WAAW,gBAAgB,EAAE,iBAAiB,MAAM,GAAG,eAAe,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;AAElX,SAAS,wBAAwB,EAAE,WAAW,KAAK,IAA4B,CAAC,GAAe;AAC7F,QAAM,SAAS,CAAC,uBAAuB,gBAAgB,kBAAkB,qBAAqB,eAAe,gBAAgB,uBAAuB,uBAAuB,oBAAoB;AAC/L,SAAO,CAAC,GAAG,OAAO,IAAI,eAAa,WAAW,UAAU,OAAO,EAAE,aAAa,MAAM,sBAAsB,gBAAgB,EAAE,CAAC,IAAI,SAAS,GAAG,kBAAkB,UAAU,EAAE,SAAS,CAAC,GAAG,MAAM,UAAU,EAAE,WAAW,KAAK,CAAC,GAAG,UAAU,aAAa,SAAS;AAChQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var articleNodeViews_exports = {};
30
+ __export(articleNodeViews_exports, {
31
+ ArticleBlockView: () => ArticleBlockView
32
+ });
33
+ module.exports = __toCommonJS(articleNodeViews_exports);
34
+ var React = __toESM(require("react"), 1);
35
+ var import_react = require("@tiptap/react");
36
+ var import_Button = require("../button/Button");
37
+ var import_TextField = require("../textField/TextField");
38
+ var import_ArticleNodes = require("./ArticleNodes");
39
+ var import_jsx_runtime = require("react/jsx-runtime");
40
+ const fields = {
41
+ image: [["src", "Image URL"], ["alt", "Alternative text"], ["caption", "Caption"], ["mediaId", "Media ID"]],
42
+ dsxVideo: [["src", "Video URL"], ["caption", "Caption"], ["mediaId", "Media ID"]],
43
+ dsxEmbed: [["url", "Embed URL"]],
44
+ dsxComparison: [["beforeSrc", "Before image URL"], ["beforeAlt", "Before alternative text"], ["afterSrc", "After image URL"], ["afterAlt", "After alternative text"]],
45
+ dsxCallout: [["title", "Callout title"], ["tone", "Tone"]],
46
+ dsxPoll: [["pollId", "Poll ID"], ["question", "Question"]],
47
+ dsxMaterialLink: [["materialId", "Material ID"], ["label", "Link label"], ["href", "Resolved URL"]],
48
+ dsxTab: [["platform", "Platform key"], ["label", "Tab label"]]
49
+ };
50
+ const titles = { image: "Image", dsxVideo: "Video", dsxEmbed: "Embed", dsxComparison: "Comparison", dsxCallout: "Callout", dsxPoll: "Poll", dsxMaterialLink: "Material reference", dsxTabs: "Platform tabs", dsxTab: "Platform" };
51
+ function ArticleBlockView({ node, editor, getPos, updateAttributes, deleteNode, selected }) {
52
+ const [editing, setEditing] = React.useState(false);
53
+ const [draft, setDraft] = React.useState(node.attrs);
54
+ const [error, setError] = React.useState("");
55
+ const fieldsId = React.useId();
56
+ const name = node.type.name;
57
+ const pos = getPos();
58
+ const $pos = typeof pos === "number" ? editor.state.doc.resolve(pos) : null;
59
+ const index = $pos?.index() ?? 0;
60
+ const parent = $pos?.parent;
61
+ const [editable, setEditable] = React.useState(editor.isEditable);
62
+ React.useEffect(() => {
63
+ const refresh = () => {
64
+ setEditable(editor.isEditable);
65
+ if (!editor.isEditable) setEditing(false);
66
+ };
67
+ editor.on("update", refresh);
68
+ editor.on("transaction", refresh);
69
+ refresh();
70
+ return () => {
71
+ editor.off("update", refresh);
72
+ editor.off("transaction", refresh);
73
+ };
74
+ }, [editor]);
75
+ const move = (direction) => {
76
+ if (!editor.isEditable || typeof pos !== "number" || !parent) return;
77
+ const neighbor = parent.maybeChild(index + direction);
78
+ if (!neighbor) return;
79
+ editor.commands.command(({ tr }) => {
80
+ tr.delete(pos, pos + node.nodeSize).insert(direction === -1 ? pos - neighbor.nodeSize : pos + neighbor.nodeSize, node);
81
+ return true;
82
+ });
83
+ editor.commands.focus();
84
+ };
85
+ const save = () => {
86
+ if (!editor.isEditable) return;
87
+ if (name === "dsxPoll") {
88
+ const options = draft.options;
89
+ if (!String(draft.pollId ?? "").trim() || !String(draft.question ?? "").trim() || options.length < 2 || options.some((option) => !option.id.trim() || !option.label.trim()) || new Set(options.map((option) => option.id)).size !== options.length) {
90
+ setError("Supply a poll ID, question and at least two options with unique IDs.");
91
+ return;
92
+ }
93
+ }
94
+ for (const key of ["src", "url", "href", "beforeSrc", "afterSrc"]) {
95
+ if (!draft[key]) continue;
96
+ try {
97
+ const url = new URL(String(draft[key]), window.location.href);
98
+ if (!["http:", "https:"].includes(url.protocol)) throw new Error();
99
+ } catch {
100
+ setError("Use an http or https media/link URL.");
101
+ return;
102
+ }
103
+ }
104
+ updateAttributes(draft);
105
+ setEditing(false);
106
+ editor.commands.focus();
107
+ };
108
+ const preview = name === "image" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ArticleNodes.ArticleImage, { src: node.attrs.src, alt: node.attrs.alt, caption: node.attrs.caption }) : name === "dsxVideo" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ArticleNodes.ArticleVideo, { src: node.attrs.src, caption: node.attrs.caption }) : name === "dsxEmbed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ArticleNodes.ArticleEmbed, { url: node.attrs.url ?? "" }) : name === "dsxComparison" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ArticleNodes.BeforeAfterComparison, { ...node.attrs }) : name === "dsxPoll" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: node.attrs.question || "Untitled poll" }),
110
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { children: node.attrs.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: option.label }, option.id)) }),
111
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: [
112
+ node.attrs.multiple ? "Multiple choices" : "Single choice",
113
+ " \xB7 ",
114
+ node.attrs.pollId || "Missing poll ID"
115
+ ] })
116
+ ] }) : name === "dsxMaterialLink" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: node.attrs.label || node.attrs.materialId || "Material reference" }) : null;
117
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.NodeViewWrapper, { className: "dsx-article-editor-block", "aria-label": `${titles[name] ?? name} block`, "aria-current": selected || void 0, children: [
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { contentEditable: false, className: "dsx-article-editor-block__controls", children: [
119
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: name === "dsxTab" ? node.attrs.label || titles[name] : titles[name] }),
120
+ editable ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsx-article-editor-block__actions", children: [
121
+ fields[name] ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "lg", variant: "ghost", onClick: () => {
122
+ setDraft({ ...node.attrs });
123
+ setError("");
124
+ setEditing((value) => !value);
125
+ }, children: editing ? "Cancel" : "Edit" }) : null,
126
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "lg", variant: "ghost", "aria-label": `Move ${titles[name]} up`, disabled: !parent?.maybeChild(index - 1), onClick: () => move(-1), children: "\u2191" }),
127
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "lg", variant: "ghost", "aria-label": `Move ${titles[name]} down`, disabled: !parent?.maybeChild(index + 1), onClick: () => move(1), children: "\u2193" }),
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "lg", variant: "ghost", "aria-label": `Remove ${titles[name]}`, onClick: () => {
129
+ if (editor.isEditable) {
130
+ deleteNode();
131
+ editor.commands.focus();
132
+ }
133
+ }, children: "Remove" })
134
+ ] }) : null
135
+ ] }),
136
+ editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { contentEditable: false, className: "dsx-article-editor-block__fields", children: [
137
+ fields[name]?.map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField, { id: `${fieldsId}-${key}`, label, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TextField.TextField.Input, { value: String(draft[key] ?? ""), onChange: (event) => setDraft((current) => ({ ...current, [key]: event.target.value })) }) }, key)),
138
+ name === "dsxPoll" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
140
+ "Options \u2014 one stable ID | label per line",
141
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { className: "dsx-article-editor-block__textarea", value: draft.options.map((option) => `${option.id}|${option.label}`).join("\n"), onChange: (event) => setDraft((current) => ({ ...current, options: event.target.value.split("\n").map((line) => {
142
+ const divider = line.indexOf("|");
143
+ return { id: divider < 0 ? "" : line.slice(0, divider), label: divider < 0 ? line : line.slice(divider + 1) };
144
+ }) })) })
145
+ ] }),
146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "lg", variant: "outline", "aria-pressed": Boolean(draft.multiple), onClick: () => setDraft((current) => ({ ...current, multiple: !current.multiple })), children: "Allow multiple choices" })
147
+ ] }) : null,
148
+ error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { role: "alert", children: error }) : null,
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Button.Button, { type: "button", size: "lg", onClick: save, children: "Save block" })
150
+ ] }) : null,
151
+ !node.isAtom ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.NodeViewContent, { className: "dsx-article-editor-block__content" }) : !editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { contentEditable: false, children: preview }) : null
152
+ ] });
153
+ }
154
+ //# sourceMappingURL=articleNodeViews.cjs.map