@ojiepermana/angular 21.3.4 → 22.0.1

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 (290) hide show
  1. package/README.md +10 -6
  2. package/component/accordion/README.md +195 -0
  3. package/component/alert/README.md +182 -0
  4. package/component/alert-dialog/README.md +239 -0
  5. package/component/aspect-ratio/README.md +112 -0
  6. package/component/avatar/README.md +176 -0
  7. package/component/badge/README.md +133 -0
  8. package/component/breadcrumb/README.md +216 -0
  9. package/component/button/README.md +139 -0
  10. package/component/button-group/README.md +208 -0
  11. package/component/calendar/README.md +132 -0
  12. package/component/card/README.md +220 -0
  13. package/component/carousel/README.md +276 -0
  14. package/component/checkbox/README.md +149 -0
  15. package/component/collapsible/README.md +195 -0
  16. package/component/combobox/README.md +198 -0
  17. package/component/command/README.md +275 -0
  18. package/component/composer/README.md +235 -0
  19. package/component/composer/package.json +4 -0
  20. package/component/context-menu/README.md +267 -0
  21. package/component/date-picker/README.md +177 -0
  22. package/component/dialog/README.md +237 -0
  23. package/component/drawer/README.md +145 -0
  24. package/component/dropdown-menu/README.md +311 -0
  25. package/component/editor/README.md +136 -0
  26. package/component/editor/package.json +4 -0
  27. package/component/empty/README.md +183 -0
  28. package/component/empty/package.json +4 -0
  29. package/component/form/README.md +210 -0
  30. package/component/hover-card/README.md +146 -0
  31. package/component/hover-card/package.json +4 -0
  32. package/component/input/README.md +159 -0
  33. package/component/input-group/README.md +239 -0
  34. package/component/input-otp/README.md +278 -0
  35. package/component/input-otp/package.json +4 -0
  36. package/component/item/README.md +247 -0
  37. package/component/kanban/README.md +81 -0
  38. package/component/kanban/package.json +4 -0
  39. package/component/kbd/README.md +139 -0
  40. package/component/kbd/package.json +4 -0
  41. package/component/label/README.md +136 -0
  42. package/component/menubar/README.md +269 -0
  43. package/component/menubar/package.json +4 -0
  44. package/component/native-select/README.md +176 -0
  45. package/component/native-select/package.json +4 -0
  46. package/component/navigation-menu/README.md +160 -0
  47. package/component/navigation-menu/package.json +4 -0
  48. package/component/pagination/README.md +144 -0
  49. package/component/pillbox/README.md +67 -0
  50. package/component/pillbox/package.json +4 -0
  51. package/component/popover/README.md +43 -0
  52. package/component/progress/README.md +160 -0
  53. package/component/radio/README.md +209 -0
  54. package/component/resizable/README.md +168 -0
  55. package/component/resizable/package.json +4 -0
  56. package/component/scroll-area/README.md +143 -0
  57. package/component/select/README.md +174 -0
  58. package/component/separator/README.md +170 -0
  59. package/component/sheet/README.md +183 -0
  60. package/component/skeleton/README.md +158 -0
  61. package/component/slider/README.md +207 -0
  62. package/component/spinner/README.md +160 -0
  63. package/component/spinner/package.json +4 -0
  64. package/component/switch/README.md +166 -0
  65. package/component/table/README.md +291 -0
  66. package/component/tabs/README.md +219 -0
  67. package/component/textarea/README.md +154 -0
  68. package/component/timeline/README.md +94 -0
  69. package/component/timeline/package.json +4 -0
  70. package/component/toast/README.md +321 -0
  71. package/component/toggle/README.md +131 -0
  72. package/component/toggle/package.json +4 -0
  73. package/component/toggle-group/README.md +206 -0
  74. package/component/toggle-group/package.json +4 -0
  75. package/component/tooltip/README.md +211 -0
  76. package/fesm2022/ojiepermana-angular-component-accordion.mjs +45 -30
  77. package/fesm2022/ojiepermana-angular-component-accordion.mjs.map +1 -1
  78. package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +95 -61
  79. package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs.map +1 -1
  80. package/fesm2022/ojiepermana-angular-component-alert.mjs +30 -21
  81. package/fesm2022/ojiepermana-angular-component-alert.mjs.map +1 -1
  82. package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +11 -7
  83. package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs.map +1 -1
  84. package/fesm2022/ojiepermana-angular-component-avatar.mjs +50 -34
  85. package/fesm2022/ojiepermana-angular-component-avatar.mjs.map +1 -1
  86. package/fesm2022/ojiepermana-angular-component-badge.mjs +9 -6
  87. package/fesm2022/ojiepermana-angular-component-badge.mjs.map +1 -1
  88. package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +49 -35
  89. package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs.map +1 -1
  90. package/fesm2022/ojiepermana-angular-component-button-group.mjs +25 -17
  91. package/fesm2022/ojiepermana-angular-component-button-group.mjs.map +1 -1
  92. package/fesm2022/ojiepermana-angular-component-button.mjs +11 -7
  93. package/fesm2022/ojiepermana-angular-component-button.mjs.map +1 -1
  94. package/fesm2022/ojiepermana-angular-component-calendar.mjs +23 -13
  95. package/fesm2022/ojiepermana-angular-component-calendar.mjs.map +1 -1
  96. package/fesm2022/ojiepermana-angular-component-card.mjs +51 -36
  97. package/fesm2022/ojiepermana-angular-component-card.mjs.map +1 -1
  98. package/fesm2022/ojiepermana-angular-component-carousel.mjs +66 -42
  99. package/fesm2022/ojiepermana-angular-component-carousel.mjs.map +1 -1
  100. package/fesm2022/ojiepermana-angular-component-chart.mjs +494 -283
  101. package/fesm2022/ojiepermana-angular-component-chart.mjs.map +1 -1
  102. package/fesm2022/ojiepermana-angular-component-checkbox.mjs +23 -13
  103. package/fesm2022/ojiepermana-angular-component-checkbox.mjs.map +1 -1
  104. package/fesm2022/ojiepermana-angular-component-collapsible.mjs +28 -20
  105. package/fesm2022/ojiepermana-angular-component-collapsible.mjs.map +1 -1
  106. package/fesm2022/ojiepermana-angular-component-combobox.mjs +27 -18
  107. package/fesm2022/ojiepermana-angular-component-combobox.mjs.map +1 -1
  108. package/fesm2022/ojiepermana-angular-component-command.mjs +77 -52
  109. package/fesm2022/ojiepermana-angular-component-command.mjs.map +1 -1
  110. package/fesm2022/ojiepermana-angular-component-composer.mjs +352 -0
  111. package/fesm2022/ojiepermana-angular-component-composer.mjs.map +1 -0
  112. package/fesm2022/ojiepermana-angular-component-context-menu.mjs +9 -6
  113. package/fesm2022/ojiepermana-angular-component-context-menu.mjs.map +1 -1
  114. package/fesm2022/ojiepermana-angular-component-date-picker.mjs +34 -19
  115. package/fesm2022/ojiepermana-angular-component-date-picker.mjs.map +1 -1
  116. package/fesm2022/ojiepermana-angular-component-dialog.mjs +55 -38
  117. package/fesm2022/ojiepermana-angular-component-dialog.mjs.map +1 -1
  118. package/fesm2022/ojiepermana-angular-component-drawer.mjs.map +1 -1
  119. package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +108 -74
  120. package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs.map +1 -1
  121. package/fesm2022/ojiepermana-angular-component-editor.mjs +717 -0
  122. package/fesm2022/ojiepermana-angular-component-editor.mjs.map +1 -0
  123. package/fesm2022/ojiepermana-angular-component-empty.mjs +145 -0
  124. package/fesm2022/ojiepermana-angular-component-empty.mjs.map +1 -0
  125. package/fesm2022/ojiepermana-angular-component-form.mjs +200 -42
  126. package/fesm2022/ojiepermana-angular-component-form.mjs.map +1 -1
  127. package/fesm2022/ojiepermana-angular-component-hover-card.mjs +297 -0
  128. package/fesm2022/ojiepermana-angular-component-hover-card.mjs.map +1 -0
  129. package/fesm2022/ojiepermana-angular-component-input-group.mjs +48 -33
  130. package/fesm2022/ojiepermana-angular-component-input-group.mjs.map +1 -1
  131. package/fesm2022/ojiepermana-angular-component-input-otp.mjs +514 -0
  132. package/fesm2022/ojiepermana-angular-component-input-otp.mjs.map +1 -0
  133. package/fesm2022/ojiepermana-angular-component-input.mjs +7 -5
  134. package/fesm2022/ojiepermana-angular-component-input.mjs.map +1 -1
  135. package/fesm2022/ojiepermana-angular-component-item.mjs +76 -53
  136. package/fesm2022/ojiepermana-angular-component-item.mjs.map +1 -1
  137. package/fesm2022/ojiepermana-angular-component-kanban.mjs +314 -0
  138. package/fesm2022/ojiepermana-angular-component-kanban.mjs.map +1 -0
  139. package/fesm2022/ojiepermana-angular-component-kbd.mjs +55 -0
  140. package/fesm2022/ojiepermana-angular-component-kbd.mjs.map +1 -0
  141. package/fesm2022/ojiepermana-angular-component-label.mjs +9 -6
  142. package/fesm2022/ojiepermana-angular-component-label.mjs.map +1 -1
  143. package/fesm2022/ojiepermana-angular-component-menubar.mjs +308 -0
  144. package/fesm2022/ojiepermana-angular-component-menubar.mjs.map +1 -0
  145. package/fesm2022/ojiepermana-angular-component-native-select.mjs +67 -0
  146. package/fesm2022/ojiepermana-angular-component-native-select.mjs.map +1 -0
  147. package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +413 -0
  148. package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs.map +1 -0
  149. package/fesm2022/ojiepermana-angular-component-pagination.mjs +65 -31
  150. package/fesm2022/ojiepermana-angular-component-pagination.mjs.map +1 -1
  151. package/fesm2022/ojiepermana-angular-component-pillbox.mjs +812 -0
  152. package/fesm2022/ojiepermana-angular-component-pillbox.mjs.map +1 -0
  153. package/fesm2022/ojiepermana-angular-component-popover.mjs +18 -12
  154. package/fesm2022/ojiepermana-angular-component-popover.mjs.map +1 -1
  155. package/fesm2022/ojiepermana-angular-component-progress.mjs +17 -10
  156. package/fesm2022/ojiepermana-angular-component-progress.mjs.map +1 -1
  157. package/fesm2022/ojiepermana-angular-component-radio.mjs +47 -17
  158. package/fesm2022/ojiepermana-angular-component-radio.mjs.map +1 -1
  159. package/fesm2022/ojiepermana-angular-component-resizable.mjs +481 -0
  160. package/fesm2022/ojiepermana-angular-component-resizable.mjs.map +1 -0
  161. package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +15 -9
  162. package/fesm2022/ojiepermana-angular-component-scroll-area.mjs.map +1 -1
  163. package/fesm2022/ojiepermana-angular-component-select.mjs +71 -26
  164. package/fesm2022/ojiepermana-angular-component-select.mjs.map +1 -1
  165. package/fesm2022/ojiepermana-angular-component-separator.mjs +11 -7
  166. package/fesm2022/ojiepermana-angular-component-separator.mjs.map +1 -1
  167. package/fesm2022/ojiepermana-angular-component-sheet.mjs +91 -42
  168. package/fesm2022/ojiepermana-angular-component-sheet.mjs.map +1 -1
  169. package/fesm2022/ojiepermana-angular-component-skeleton.mjs +7 -5
  170. package/fesm2022/ojiepermana-angular-component-skeleton.mjs.map +1 -1
  171. package/fesm2022/ojiepermana-angular-component-slider.mjs +401 -7
  172. package/fesm2022/ojiepermana-angular-component-slider.mjs.map +1 -1
  173. package/fesm2022/ojiepermana-angular-component-spinner.mjs +60 -0
  174. package/fesm2022/ojiepermana-angular-component-spinner.mjs.map +1 -0
  175. package/fesm2022/ojiepermana-angular-component-switch.mjs +47 -15
  176. package/fesm2022/ojiepermana-angular-component-switch.mjs.map +1 -1
  177. package/fesm2022/ojiepermana-angular-component-table.mjs +56 -40
  178. package/fesm2022/ojiepermana-angular-component-table.mjs.map +1 -1
  179. package/fesm2022/ojiepermana-angular-component-tabs.mjs +58 -38
  180. package/fesm2022/ojiepermana-angular-component-tabs.mjs.map +1 -1
  181. package/fesm2022/ojiepermana-angular-component-textarea.mjs +8 -6
  182. package/fesm2022/ojiepermana-angular-component-textarea.mjs.map +1 -1
  183. package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -0
  184. package/fesm2022/ojiepermana-angular-component-timeline.mjs.map +1 -0
  185. package/fesm2022/ojiepermana-angular-component-toast.mjs +28 -4
  186. package/fesm2022/ojiepermana-angular-component-toast.mjs.map +1 -1
  187. package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +289 -0
  188. package/fesm2022/ojiepermana-angular-component-toggle-group.mjs.map +1 -0
  189. package/fesm2022/ojiepermana-angular-component-toggle.mjs +82 -0
  190. package/fesm2022/ojiepermana-angular-component-toggle.mjs.map +1 -0
  191. package/fesm2022/ojiepermana-angular-component-tooltip.mjs +304 -6
  192. package/fesm2022/ojiepermana-angular-component-tooltip.mjs.map +1 -1
  193. package/fesm2022/ojiepermana-angular-component-utils.mjs.map +1 -1
  194. package/fesm2022/ojiepermana-angular-layout-component.mjs +45 -24
  195. package/fesm2022/ojiepermana-angular-layout-component.mjs.map +1 -1
  196. package/fesm2022/ojiepermana-angular-layout-provider.mjs.map +1 -1
  197. package/fesm2022/ojiepermana-angular-layout-services.mjs +7 -5
  198. package/fesm2022/ojiepermana-angular-layout-services.mjs.map +1 -1
  199. package/fesm2022/ojiepermana-angular-layout-shell.mjs +3 -3
  200. package/fesm2022/ojiepermana-angular-layout-shell.mjs.map +1 -1
  201. package/fesm2022/ojiepermana-angular-layout-token-directive.mjs +9 -6
  202. package/fesm2022/ojiepermana-angular-layout-token-directive.mjs.map +1 -1
  203. package/fesm2022/ojiepermana-angular-layout-token.mjs.map +1 -1
  204. package/fesm2022/{ojiepermana-angular-layout-empty.mjs → ojiepermana-angular-layout-type-empty.mjs} +4 -4
  205. package/fesm2022/ojiepermana-angular-layout-type-empty.mjs.map +1 -0
  206. package/fesm2022/{ojiepermana-angular-layout-horizontal.mjs → ojiepermana-angular-layout-type-horizontal.mjs} +26 -17
  207. package/fesm2022/ojiepermana-angular-layout-type-horizontal.mjs.map +1 -0
  208. package/fesm2022/{ojiepermana-angular-layout-vertical.mjs → ojiepermana-angular-layout-type-vertical.mjs} +28 -18
  209. package/fesm2022/ojiepermana-angular-layout-type-vertical.mjs.map +1 -0
  210. package/fesm2022/ojiepermana-angular-layout.mjs +74 -50
  211. package/fesm2022/ojiepermana-angular-layout.mjs.map +1 -1
  212. package/fesm2022/ojiepermana-angular-navigation-demo-data.mjs.map +1 -1
  213. package/fesm2022/ojiepermana-angular-navigation-icon.mjs +11 -7
  214. package/fesm2022/ojiepermana-angular-navigation-icon.mjs.map +1 -1
  215. package/fesm2022/ojiepermana-angular-navigation-item.mjs +27 -16
  216. package/fesm2022/ojiepermana-angular-navigation-item.mjs.map +1 -1
  217. package/fesm2022/ojiepermana-angular-navigation-service.mjs +29 -20
  218. package/fesm2022/ojiepermana-angular-navigation-service.mjs.map +1 -1
  219. package/fesm2022/ojiepermana-angular-navigation-sidebar.mjs +71 -43
  220. package/fesm2022/ojiepermana-angular-navigation-sidebar.mjs.map +1 -1
  221. package/fesm2022/ojiepermana-angular-navigation-topbar.mjs +261 -24
  222. package/fesm2022/ojiepermana-angular-navigation-topbar.mjs.map +1 -1
  223. package/fesm2022/ojiepermana-angular-theme-provider.mjs.map +1 -1
  224. package/fesm2022/ojiepermana-angular-theme-services.mjs +19 -11
  225. package/fesm2022/ojiepermana-angular-theme-services.mjs.map +1 -1
  226. package/fesm2022/ojiepermana-angular-theme-token.mjs.map +1 -1
  227. package/fesm2022/ojiepermana-angular-theme.mjs +19 -11
  228. package/fesm2022/ojiepermana-angular-theme.mjs.map +1 -1
  229. package/generator/api/bin/src/emit/client.js +4 -2
  230. package/generator/api/bin/src/writer/index.js +2 -2
  231. package/generator/guide/bin/schematics/build/index.js +3 -2
  232. package/generator/guide/bin/src/engine/component.js +2 -2
  233. package/generator/guide/bin/src/engine/index.js +3 -3
  234. package/generator/guide/bin/src/engine/render.js +10 -5
  235. package/layout/type/empty/package.json +4 -0
  236. package/layout/type/horizontal/package.json +4 -0
  237. package/layout/type/vertical/package.json +4 -0
  238. package/navigation/topbar/README.md +196 -0
  239. package/package.json +89 -25
  240. package/theme/README.md +110 -3
  241. package/theme/styles/integrations/material/autocomplete.css +178 -0
  242. package/theme/styles/integrations/material/button.css +468 -0
  243. package/theme/styles/integrations/material/dialog.css +152 -0
  244. package/theme/styles/integrations/material/select.css +175 -0
  245. package/theme/styles/integrations/material/slide-toggle.css +234 -0
  246. package/theme/styles/integrations/material/slider.css +194 -0
  247. package/theme/styles/integrations/material/tabs.css +229 -0
  248. package/theme/styles/integrations/material.css +70 -60
  249. package/types/ojiepermana-angular-component-combobox.d.ts +1 -2
  250. package/types/ojiepermana-angular-component-composer.d.ts +90 -0
  251. package/types/ojiepermana-angular-component-dropdown-menu.d.ts +2 -0
  252. package/types/ojiepermana-angular-component-editor.d.ts +123 -0
  253. package/types/ojiepermana-angular-component-empty.d.ts +50 -0
  254. package/types/ojiepermana-angular-component-form.d.ts +52 -3
  255. package/types/ojiepermana-angular-component-hover-card.d.ts +74 -0
  256. package/types/ojiepermana-angular-component-input-otp.d.ts +136 -0
  257. package/types/ojiepermana-angular-component-kanban.d.ts +70 -0
  258. package/types/ojiepermana-angular-component-kbd.d.ts +16 -0
  259. package/types/ojiepermana-angular-component-menubar.d.ts +67 -0
  260. package/types/ojiepermana-angular-component-native-select.d.ts +26 -0
  261. package/types/ojiepermana-angular-component-navigation-menu.d.ts +96 -0
  262. package/types/ojiepermana-angular-component-pagination.d.ts +10 -4
  263. package/types/ojiepermana-angular-component-pillbox.d.ts +157 -0
  264. package/types/ojiepermana-angular-component-radio.d.ts +7 -1
  265. package/types/ojiepermana-angular-component-resizable.d.ts +99 -0
  266. package/types/ojiepermana-angular-component-select.d.ts +17 -5
  267. package/types/ojiepermana-angular-component-sheet.d.ts +3 -1
  268. package/types/ojiepermana-angular-component-slider.d.ts +59 -1
  269. package/types/ojiepermana-angular-component-spinner.d.ts +13 -0
  270. package/types/ojiepermana-angular-component-switch.d.ts +13 -3
  271. package/types/ojiepermana-angular-component-timeline.d.ts +63 -0
  272. package/types/ojiepermana-angular-component-toast.d.ts +12 -3
  273. package/types/ojiepermana-angular-component-toggle-group.d.ts +89 -0
  274. package/types/ojiepermana-angular-component-toggle.d.ts +25 -0
  275. package/types/ojiepermana-angular-component-tooltip.d.ts +72 -5
  276. package/types/{ojiepermana-angular-layout-horizontal.d.ts → ojiepermana-angular-layout-type-horizontal.d.ts} +3 -3
  277. package/types/{ojiepermana-angular-layout-vertical.d.ts → ojiepermana-angular-layout-type-vertical.d.ts} +3 -3
  278. package/types/ojiepermana-angular-layout.d.ts +5 -5
  279. package/types/ojiepermana-angular-navigation-item.d.ts +1 -1
  280. package/types/ojiepermana-angular-navigation-service.d.ts +7 -7
  281. package/types/ojiepermana-angular-navigation-sidebar.d.ts +8 -8
  282. package/types/ojiepermana-angular-navigation-topbar.d.ts +24 -4
  283. package/types/ojiepermana-angular-navigation-types.d.ts +14 -8
  284. package/fesm2022/ojiepermana-angular-layout-empty.mjs.map +0 -1
  285. package/fesm2022/ojiepermana-angular-layout-horizontal.mjs.map +0 -1
  286. package/fesm2022/ojiepermana-angular-layout-vertical.mjs.map +0 -1
  287. package/layout/empty/package.json +0 -4
  288. package/layout/horizontal/package.json +0 -4
  289. package/layout/vertical/package.json +0 -4
  290. /package/types/{ojiepermana-angular-layout-empty.d.ts → ojiepermana-angular-layout-type-empty.d.ts} +0 -0
@@ -0,0 +1,717 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { input, booleanAttribute, output, computed, ChangeDetectionStrategy, Component, inject, ElementRef, signal, forwardRef } from '@angular/core';
4
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
+ import { cn } from '@ojiepermana/angular/component/utils';
6
+
7
+ const DEFAULT_EDITOR_TOOLBAR = 'heading | bold italic underline strike | bullet ordered blockquote link align ~ undo redo';
8
+ const EDITOR_BASE = 'block w-full min-w-0 text-sm text-foreground';
9
+ const EDITOR_SHELL_BASE = [
10
+ 'relative min-w-0 overflow-hidden rounded-md border border-input bg-background shadow-sm',
11
+ 'transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-1 focus-within:ring-ring',
12
+ 'aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-within:ring-destructive',
13
+ 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
14
+ ].join(' ');
15
+ const EDITOR_TOOLBAR_BASE = [
16
+ 'flex min-h-11 min-w-0 flex-wrap items-center gap-1 border-b border-border/70 bg-muted/30 px-2 py-1.5',
17
+ 'data-[disabled=true]:pointer-events-none',
18
+ ].join(' ');
19
+ const EDITOR_TOOL_BUTTON_BASE = [
20
+ 'inline-flex size-8 shrink-0 items-center justify-center rounded-md text-sm font-medium text-muted-foreground',
21
+ 'transition-colors hover:bg-accent hover:text-accent-foreground',
22
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
23
+ 'disabled:pointer-events-none disabled:opacity-50',
24
+ 'aria-pressed:bg-accent aria-pressed:text-accent-foreground',
25
+ ].join(' ');
26
+ const EDITOR_SELECT_BASE = [
27
+ 'h-8 rounded-md border border-transparent bg-transparent px-2 text-sm font-medium text-muted-foreground outline-none',
28
+ 'transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring',
29
+ 'disabled:pointer-events-none disabled:opacity-50',
30
+ ].join(' ');
31
+ const EDITOR_CONTENT_BASE = [
32
+ 'block min-h-[200px] max-h-[500px] w-full overflow-y-auto px-4 py-3 text-sm leading-6 outline-none',
33
+ '[&_p]:my-2 [&_h1]:mb-2 [&_h1]:mt-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:mb-2 [&_h2]:mt-4 [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:text-lg [&_h3]:font-semibold',
34
+ '[&_blockquote]:my-3 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-6 [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-xs',
35
+ 'data-[empty=true]:before:pointer-events-none data-[empty=true]:before:text-muted-foreground data-[empty=true]:before:content-[attr(data-placeholder)]',
36
+ 'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
37
+ ].join(' ');
38
+ const toolbarButtons = {
39
+ bold: { label: 'B', ariaLabel: 'Bold' },
40
+ italic: { label: 'I', ariaLabel: 'Italic' },
41
+ underline: { label: 'U', ariaLabel: 'Underline' },
42
+ strike: { label: 'S', ariaLabel: 'Strikethrough' },
43
+ bullet: { label: 'UL', ariaLabel: 'Bulleted list' },
44
+ ordered: { label: '1.', ariaLabel: 'Numbered list' },
45
+ blockquote: { label: 'Q', ariaLabel: 'Block quote' },
46
+ subscript: { label: 'Sub', ariaLabel: 'Subscript' },
47
+ superscript: { label: 'Sup', ariaLabel: 'Superscript' },
48
+ highlight: { label: 'H', ariaLabel: 'Highlight' },
49
+ link: { label: 'Link', ariaLabel: 'Insert link' },
50
+ code: { label: '</>', ariaLabel: 'Code block' },
51
+ undo: { label: 'Undo', ariaLabel: 'Undo' },
52
+ redo: { label: 'Redo', ariaLabel: 'Redo' },
53
+ };
54
+ const toolbarItemAliases = {
55
+ bold: 'bold',
56
+ italic: 'italic',
57
+ strike: 'strike',
58
+ underline: 'underline',
59
+ bullet: 'bullet',
60
+ ordered: 'ordered',
61
+ blockquote: 'blockquote',
62
+ subscript: 'subscript',
63
+ superscript: 'superscript',
64
+ highlight: 'highlight',
65
+ link: 'link',
66
+ code: 'code',
67
+ undo: 'undo',
68
+ redo: 'redo',
69
+ };
70
+ const parseToolbarItems = (items) => {
71
+ const tokens = items.split(/\s+/).filter(Boolean);
72
+ return tokens.flatMap((token, index) => {
73
+ if (token === '|') {
74
+ return [{ type: 'separator', track: `separator-${index}` }];
75
+ }
76
+ if (token === '~') {
77
+ return [{ type: 'spacer', track: `spacer-${index}` }];
78
+ }
79
+ if (token === 'heading') {
80
+ return [{ type: 'heading', track: `heading-${index}` }];
81
+ }
82
+ if (token === 'align') {
83
+ return [{ type: 'align', track: `align-${index}` }];
84
+ }
85
+ const command = toolbarItemAliases[token];
86
+ const button = command ? toolbarButtons[command] : undefined;
87
+ if (!command || !button) {
88
+ return [];
89
+ }
90
+ return [{ type: 'button', command, label: button.label, ariaLabel: button.ariaLabel }];
91
+ });
92
+ };
93
+ class EditorComponent {
94
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
95
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
96
+ class = input('', /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
98
+ commandSelected = output();
99
+ content = null;
100
+ classes = computed(() => cn(EDITOR_BASE, this.class()), /* @ts-ignore */
101
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
102
+ shellClasses = computed(() => cn(EDITOR_SHELL_BASE), /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "shellClasses" }] : /* istanbul ignore next */ []));
104
+ execute(command, source = 'api', originalEvent) {
105
+ if (this.disabled()) {
106
+ return;
107
+ }
108
+ this.content?.execute(command);
109
+ this.commandSelected.emit({ command, source, originalEvent });
110
+ }
111
+ registerContent(content) {
112
+ this.content = content;
113
+ }
114
+ unregisterContent(content) {
115
+ if (this.content === content) {
116
+ this.content = null;
117
+ }
118
+ }
119
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
120
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: EditorComponent, isStandalone: true, selector: "ui-editor", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { commandSelected: "commandSelected" }, host: { properties: { "class": "classes()", "attr.data-slot": "\"editor\"", "attr.data-disabled": "disabled() ? \"true\" : null", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "invalid() ? \"true\" : null", "attr.inert": "disabled() ? \"\" : null" } }, ngImport: i0, template: `
121
+ <div
122
+ data-slot="editor-shell"
123
+ [class]="shellClasses()"
124
+ [attr.data-disabled]="disabled() ? 'true' : null"
125
+ [attr.aria-invalid]="invalid() ? 'true' : null">
126
+ <ng-content select="ui-editor-toolbar" />
127
+ <ng-content select="ui-editor-content" />
128
+ </div>
129
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
130
+ }
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorComponent, decorators: [{
132
+ type: Component,
133
+ args: [{
134
+ selector: 'ui-editor',
135
+ changeDetection: ChangeDetectionStrategy.OnPush,
136
+ host: {
137
+ '[class]': 'classes()',
138
+ '[attr.data-slot]': '"editor"',
139
+ '[attr.data-disabled]': 'disabled() ? "true" : null',
140
+ '[attr.aria-disabled]': 'disabled() ? "true" : null',
141
+ '[attr.aria-invalid]': 'invalid() ? "true" : null',
142
+ '[attr.inert]': 'disabled() ? "" : null',
143
+ },
144
+ template: `
145
+ <div
146
+ data-slot="editor-shell"
147
+ [class]="shellClasses()"
148
+ [attr.data-disabled]="disabled() ? 'true' : null"
149
+ [attr.aria-invalid]="invalid() ? 'true' : null">
150
+ <ng-content select="ui-editor-toolbar" />
151
+ <ng-content select="ui-editor-content" />
152
+ </div>
153
+ `,
154
+ }]
155
+ }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], commandSelected: [{ type: i0.Output, args: ["commandSelected"] }] } });
156
+ class EditorToolbarComponent {
157
+ editor = inject(EditorComponent, { optional: true });
158
+ items = input(DEFAULT_EDITOR_TOOLBAR, /* @ts-ignore */
159
+ ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
160
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
161
+ ariaLabel = input('Formatting', { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
162
+ class = input('', /* @ts-ignore */
163
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
164
+ buttonClasses = EDITOR_TOOL_BUTTON_BASE;
165
+ selectClasses = EDITOR_SELECT_BASE;
166
+ disabled = computed(() => this.disabledInput() || this.editor?.disabled() === true, /* @ts-ignore */
167
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
168
+ parts = computed(() => parseToolbarItems(this.items()), /* @ts-ignore */
169
+ ...(ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []));
170
+ classes = computed(() => cn(EDITOR_TOOLBAR_BASE, this.class()), /* @ts-ignore */
171
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
172
+ execute(command, event) {
173
+ this.editor?.execute(command, 'toolbar', event);
174
+ }
175
+ handleSelect(event) {
176
+ const select = event.target;
177
+ this.editor?.execute(select.value, 'toolbar', event);
178
+ select.selectedIndex = 0;
179
+ }
180
+ preserveSelection(event) {
181
+ event.preventDefault();
182
+ }
183
+ trackPart(part, index) {
184
+ if (part.type === 'button') {
185
+ return `${part.command}-${index}`;
186
+ }
187
+ return part.track;
188
+ }
189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
190
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: EditorToolbarComponent, isStandalone: true, selector: "ui-editor-toolbar", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "toolbar" }, properties: { "class": "classes()", "attr.data-slot": "\"editor-toolbar\"", "attr.aria-label": "ariaLabel()", "attr.data-disabled": "disabled() ? \"true\" : null" } }, ngImport: i0, template: `
191
+ @for (part of parts(); track trackPart(part, $index)) {
192
+ @switch (part.type) {
193
+ @case ('heading') {
194
+ <select
195
+ [class]="selectClasses"
196
+ [disabled]="disabled()"
197
+ aria-label="Text style"
198
+ (change)="handleSelect($event)">
199
+ <option value="paragraph">Text</option>
200
+ <option value="heading-1">Heading 1</option>
201
+ <option value="heading-2">Heading 2</option>
202
+ <option value="heading-3">Heading 3</option>
203
+ </select>
204
+ }
205
+ @case ('align') {
206
+ <select
207
+ [class]="selectClasses"
208
+ [disabled]="disabled()"
209
+ aria-label="Text alignment"
210
+ (change)="handleSelect($event)">
211
+ <option value="align-left">Left</option>
212
+ <option value="align-center">Center</option>
213
+ <option value="align-right">Right</option>
214
+ </select>
215
+ }
216
+ @case ('separator') {
217
+ <span
218
+ data-slot="editor-separator"
219
+ class="mx-1 h-6 w-px shrink-0 bg-border"
220
+ role="separator"
221
+ aria-orientation="vertical"></span>
222
+ }
223
+ @case ('spacer') {
224
+ <span data-slot="editor-spacer" class="min-w-2 flex-1"></span>
225
+ }
226
+ @case ('button') {
227
+ <button
228
+ type="button"
229
+ data-slot="editor-button"
230
+ [class]="buttonClasses"
231
+ [disabled]="disabled()"
232
+ [attr.aria-label]="part.ariaLabel"
233
+ [attr.title]="part.ariaLabel"
234
+ (mousedown)="preserveSelection($event)"
235
+ (click)="execute(part.command, $event)">
236
+ @if (part.command === 'undo') {
237
+ <svg
238
+ aria-hidden="true"
239
+ class="size-4"
240
+ viewBox="0 0 24 24"
241
+ fill="none"
242
+ stroke="currentColor"
243
+ stroke-width="1.75"
244
+ stroke-linecap="round"
245
+ stroke-linejoin="round">
246
+ <path d="M9 14 4 9l5-5" />
247
+ <path d="M4 9h10a6 6 0 0 1 0 12h-2" />
248
+ </svg>
249
+ } @else if (part.command === 'redo') {
250
+ <svg
251
+ aria-hidden="true"
252
+ class="size-4"
253
+ viewBox="0 0 24 24"
254
+ fill="none"
255
+ stroke="currentColor"
256
+ stroke-width="1.75"
257
+ stroke-linecap="round"
258
+ stroke-linejoin="round">
259
+ <path d="m15 14 5-5-5-5" />
260
+ <path d="M20 9H10a6 6 0 0 0 0 12h2" />
261
+ </svg>
262
+ } @else {
263
+ <span aria-hidden="true">{{ part.label }}</span>
264
+ }
265
+ </button>
266
+ }
267
+ }
268
+ }
269
+ <ng-content />
270
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
271
+ }
272
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorToolbarComponent, decorators: [{
273
+ type: Component,
274
+ args: [{
275
+ selector: 'ui-editor-toolbar',
276
+ changeDetection: ChangeDetectionStrategy.OnPush,
277
+ host: {
278
+ '[class]': 'classes()',
279
+ '[attr.data-slot]': '"editor-toolbar"',
280
+ role: 'toolbar',
281
+ '[attr.aria-label]': 'ariaLabel()',
282
+ '[attr.data-disabled]': 'disabled() ? "true" : null',
283
+ },
284
+ template: `
285
+ @for (part of parts(); track trackPart(part, $index)) {
286
+ @switch (part.type) {
287
+ @case ('heading') {
288
+ <select
289
+ [class]="selectClasses"
290
+ [disabled]="disabled()"
291
+ aria-label="Text style"
292
+ (change)="handleSelect($event)">
293
+ <option value="paragraph">Text</option>
294
+ <option value="heading-1">Heading 1</option>
295
+ <option value="heading-2">Heading 2</option>
296
+ <option value="heading-3">Heading 3</option>
297
+ </select>
298
+ }
299
+ @case ('align') {
300
+ <select
301
+ [class]="selectClasses"
302
+ [disabled]="disabled()"
303
+ aria-label="Text alignment"
304
+ (change)="handleSelect($event)">
305
+ <option value="align-left">Left</option>
306
+ <option value="align-center">Center</option>
307
+ <option value="align-right">Right</option>
308
+ </select>
309
+ }
310
+ @case ('separator') {
311
+ <span
312
+ data-slot="editor-separator"
313
+ class="mx-1 h-6 w-px shrink-0 bg-border"
314
+ role="separator"
315
+ aria-orientation="vertical"></span>
316
+ }
317
+ @case ('spacer') {
318
+ <span data-slot="editor-spacer" class="min-w-2 flex-1"></span>
319
+ }
320
+ @case ('button') {
321
+ <button
322
+ type="button"
323
+ data-slot="editor-button"
324
+ [class]="buttonClasses"
325
+ [disabled]="disabled()"
326
+ [attr.aria-label]="part.ariaLabel"
327
+ [attr.title]="part.ariaLabel"
328
+ (mousedown)="preserveSelection($event)"
329
+ (click)="execute(part.command, $event)">
330
+ @if (part.command === 'undo') {
331
+ <svg
332
+ aria-hidden="true"
333
+ class="size-4"
334
+ viewBox="0 0 24 24"
335
+ fill="none"
336
+ stroke="currentColor"
337
+ stroke-width="1.75"
338
+ stroke-linecap="round"
339
+ stroke-linejoin="round">
340
+ <path d="M9 14 4 9l5-5" />
341
+ <path d="M4 9h10a6 6 0 0 1 0 12h-2" />
342
+ </svg>
343
+ } @else if (part.command === 'redo') {
344
+ <svg
345
+ aria-hidden="true"
346
+ class="size-4"
347
+ viewBox="0 0 24 24"
348
+ fill="none"
349
+ stroke="currentColor"
350
+ stroke-width="1.75"
351
+ stroke-linecap="round"
352
+ stroke-linejoin="round">
353
+ <path d="m15 14 5-5-5-5" />
354
+ <path d="M20 9H10a6 6 0 0 0 0 12h2" />
355
+ </svg>
356
+ } @else {
357
+ <span aria-hidden="true">{{ part.label }}</span>
358
+ }
359
+ </button>
360
+ }
361
+ }
362
+ }
363
+ <ng-content />
364
+ `,
365
+ }]
366
+ }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
367
+ class EditorButtonComponent {
368
+ editor = inject(EditorComponent, { optional: true });
369
+ command = input(null, /* @ts-ignore */
370
+ ...(ngDevMode ? [{ debugName: "command" }] : /* istanbul ignore next */ []));
371
+ pressed = input(null, /* @ts-ignore */
372
+ ...(ngDevMode ? [{ debugName: "pressed" }] : /* istanbul ignore next */ []));
373
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
374
+ tooltip = input('', /* @ts-ignore */
375
+ ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
376
+ class = input('', /* @ts-ignore */
377
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
378
+ disabled = computed(() => this.disabledInput() || this.editor?.disabled() === true, /* @ts-ignore */
379
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
380
+ classes = computed(() => cn(EDITOR_TOOL_BUTTON_BASE, this.class()), /* @ts-ignore */
381
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
382
+ handleClick(event) {
383
+ const command = this.command();
384
+ if (!command) {
385
+ return;
386
+ }
387
+ this.editor?.execute(command, 'toolbar', event);
388
+ }
389
+ preserveSelection(event) {
390
+ event.preventDefault();
391
+ }
392
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
393
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: EditorButtonComponent, isStandalone: true, selector: "button[ui-editor-button]", inputs: { command: { classPropertyName: "command", publicName: "command", isSignal: true, isRequired: false, transformFunction: null }, pressed: { classPropertyName: "pressed", publicName: "pressed", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, listeners: { "mousedown": "preserveSelection($event)", "click": "handleClick($event)" }, properties: { "class": "classes()", "attr.data-slot": "\"editor-button\"", "attr.title": "tooltip() || null", "attr.aria-pressed": "pressed() === null ? null : pressed()", "disabled": "disabled() || null" } }, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
394
+ }
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorButtonComponent, decorators: [{
396
+ type: Component,
397
+ args: [{
398
+ selector: 'button[ui-editor-button]',
399
+ changeDetection: ChangeDetectionStrategy.OnPush,
400
+ host: {
401
+ '[class]': 'classes()',
402
+ '[attr.data-slot]': '"editor-button"',
403
+ '[attr.title]': 'tooltip() || null',
404
+ '[attr.aria-pressed]': 'pressed() === null ? null : pressed()',
405
+ '[disabled]': 'disabled() || null',
406
+ type: 'button',
407
+ '(mousedown)': 'preserveSelection($event)',
408
+ '(click)': 'handleClick($event)',
409
+ },
410
+ template: `<ng-content />`,
411
+ }]
412
+ }], propDecorators: { command: [{ type: i0.Input, args: [{ isSignal: true, alias: "command", required: false }] }], pressed: [{ type: i0.Input, args: [{ isSignal: true, alias: "pressed", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
413
+ class EditorSeparatorComponent {
414
+ class = input('', /* @ts-ignore */
415
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
416
+ classes = computed(() => cn('mx-1 h-6 w-px shrink-0 bg-border', this.class()), /* @ts-ignore */
417
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
418
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
419
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: EditorSeparatorComponent, isStandalone: true, selector: "ui-editor-separator", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator", "aria-orientation": "vertical" }, properties: { "class": "classes()", "attr.data-slot": "\"editor-separator\"" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
420
+ }
421
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorSeparatorComponent, decorators: [{
422
+ type: Component,
423
+ args: [{
424
+ selector: 'ui-editor-separator',
425
+ changeDetection: ChangeDetectionStrategy.OnPush,
426
+ host: {
427
+ '[class]': 'classes()',
428
+ '[attr.data-slot]': '"editor-separator"',
429
+ role: 'separator',
430
+ 'aria-orientation': 'vertical',
431
+ },
432
+ template: '',
433
+ }]
434
+ }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
435
+ class EditorSpacerComponent {
436
+ class = input('', /* @ts-ignore */
437
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
438
+ classes = computed(() => cn('min-w-2 flex-1', this.class()), /* @ts-ignore */
439
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
440
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorSpacerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
441
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: EditorSpacerComponent, isStandalone: true, selector: "ui-editor-spacer", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"editor-spacer\"" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
442
+ }
443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorSpacerComponent, decorators: [{
444
+ type: Component,
445
+ args: [{
446
+ selector: 'ui-editor-spacer',
447
+ changeDetection: ChangeDetectionStrategy.OnPush,
448
+ host: {
449
+ '[class]': 'classes()',
450
+ '[attr.data-slot]': '"editor-spacer"',
451
+ },
452
+ template: '',
453
+ }]
454
+ }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
455
+ class EditorContentComponent {
456
+ el = inject(ElementRef);
457
+ editor = inject(EditorComponent, { optional: true });
458
+ document = inject(DOCUMENT);
459
+ placeholder = input('Write something...', /* @ts-ignore */
460
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
461
+ ariaLabel = input('Rich text editor', { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
462
+ disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
463
+ invalidInput = input(false, { ...(ngDevMode ? { debugName: "invalidInput" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
464
+ class = input('', /* @ts-ignore */
465
+ ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
466
+ disabledState = signal(false, /* @ts-ignore */
467
+ ...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
468
+ empty = signal(true, /* @ts-ignore */
469
+ ...(ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []));
470
+ disabled = computed(() => this.disabledInput() || this.disabledState() || this.editor?.disabled() === true, /* @ts-ignore */
471
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
472
+ invalid = computed(() => this.invalidInput() || this.editor?.invalid() === true, /* @ts-ignore */
473
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
474
+ classes = computed(() => cn(EDITOR_CONTENT_BASE, this.class()), /* @ts-ignore */
475
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
476
+ onChange = () => { };
477
+ onTouched = () => { };
478
+ ngAfterViewInit() {
479
+ this.editor?.registerContent(this);
480
+ queueMicrotask(() => this.syncEmptyState());
481
+ }
482
+ ngOnDestroy() {
483
+ this.editor?.unregisterContent(this);
484
+ }
485
+ writeValue(value) {
486
+ this.el.nativeElement.innerHTML = value ?? '';
487
+ queueMicrotask(() => this.syncEmptyState());
488
+ }
489
+ registerOnChange(fn) {
490
+ this.onChange = fn;
491
+ }
492
+ registerOnTouched(fn) {
493
+ this.onTouched = fn;
494
+ }
495
+ setDisabledState(isDisabled) {
496
+ this.disabledState.set(isDisabled);
497
+ }
498
+ execute(command) {
499
+ if (this.disabled()) {
500
+ return;
501
+ }
502
+ this.el.nativeElement.focus();
503
+ switch (command) {
504
+ case 'paragraph':
505
+ this.exec('formatBlock', 'p');
506
+ break;
507
+ case 'heading-1':
508
+ this.exec('formatBlock', 'h1');
509
+ break;
510
+ case 'heading-2':
511
+ this.exec('formatBlock', 'h2');
512
+ break;
513
+ case 'heading-3':
514
+ this.exec('formatBlock', 'h3');
515
+ break;
516
+ case 'bold':
517
+ this.exec('bold');
518
+ break;
519
+ case 'italic':
520
+ this.exec('italic');
521
+ break;
522
+ case 'underline':
523
+ this.exec('underline');
524
+ break;
525
+ case 'strike':
526
+ this.exec('strikeThrough');
527
+ break;
528
+ case 'bullet':
529
+ this.exec('insertUnorderedList');
530
+ break;
531
+ case 'ordered':
532
+ this.exec('insertOrderedList');
533
+ break;
534
+ case 'blockquote':
535
+ this.exec('formatBlock', 'blockquote');
536
+ break;
537
+ case 'subscript':
538
+ this.exec('subscript');
539
+ break;
540
+ case 'superscript':
541
+ this.exec('superscript');
542
+ break;
543
+ case 'highlight':
544
+ this.exec('backColor', '#fef08a');
545
+ break;
546
+ case 'link':
547
+ this.exec('createLink', '#');
548
+ break;
549
+ case 'code':
550
+ this.exec('formatBlock', 'pre');
551
+ break;
552
+ case 'align-left':
553
+ this.exec('justifyLeft');
554
+ break;
555
+ case 'align-center':
556
+ this.exec('justifyCenter');
557
+ break;
558
+ case 'align-right':
559
+ this.exec('justifyRight');
560
+ break;
561
+ case 'undo':
562
+ this.exec('undo');
563
+ break;
564
+ case 'redo':
565
+ this.exec('redo');
566
+ break;
567
+ }
568
+ this.handleInput();
569
+ }
570
+ focus() {
571
+ this.el.nativeElement.focus();
572
+ }
573
+ handleInput() {
574
+ this.syncEmptyState();
575
+ this.onChange(this.el.nativeElement.innerHTML);
576
+ }
577
+ handleBlur() {
578
+ this.onTouched();
579
+ }
580
+ handleKeydown(event) {
581
+ if (this.disabled()) {
582
+ return;
583
+ }
584
+ const command = this.shortcutCommand(event);
585
+ if (!command) {
586
+ return;
587
+ }
588
+ event.preventDefault();
589
+ if (this.editor) {
590
+ this.editor.execute(command, 'shortcut', event);
591
+ return;
592
+ }
593
+ this.execute(command);
594
+ }
595
+ exec(command, value) {
596
+ if (typeof this.document.execCommand !== 'function') {
597
+ return;
598
+ }
599
+ this.document.execCommand(command, false, value);
600
+ }
601
+ syncEmptyState() {
602
+ const element = this.el.nativeElement;
603
+ const html = element.innerHTML
604
+ .replace(/<br\s*\/?\>/gi, '')
605
+ .replace(/&nbsp;/g, '')
606
+ .trim();
607
+ const text = element.textContent?.replace(/\u00a0/g, '').trim() ?? '';
608
+ this.empty.set(html.length === 0 && text.length === 0);
609
+ }
610
+ shortcutCommand(event) {
611
+ const modifier = event.metaKey || event.ctrlKey;
612
+ if (!modifier) {
613
+ return null;
614
+ }
615
+ const key = event.key.toLowerCase();
616
+ if (event.altKey && !event.shiftKey) {
617
+ if (key === '0') {
618
+ return 'paragraph';
619
+ }
620
+ if (key === '1') {
621
+ return 'heading-1';
622
+ }
623
+ if (key === '2') {
624
+ return 'heading-2';
625
+ }
626
+ if (key === '3') {
627
+ return 'heading-3';
628
+ }
629
+ }
630
+ if (event.shiftKey && !event.altKey) {
631
+ switch (key) {
632
+ case 'x':
633
+ return 'strike';
634
+ case '7':
635
+ return 'ordered';
636
+ case '8':
637
+ return 'bullet';
638
+ case 'b':
639
+ return 'blockquote';
640
+ case 'h':
641
+ return 'highlight';
642
+ case 'l':
643
+ return 'align-left';
644
+ case 'e':
645
+ return 'align-center';
646
+ case 'r':
647
+ return 'align-right';
648
+ case 'z':
649
+ return 'redo';
650
+ }
651
+ }
652
+ if (event.altKey || event.shiftKey) {
653
+ return null;
654
+ }
655
+ switch (key) {
656
+ case 'b':
657
+ return 'bold';
658
+ case 'i':
659
+ return 'italic';
660
+ case 'u':
661
+ return 'underline';
662
+ case 'e':
663
+ return 'code';
664
+ case 'z':
665
+ return 'undo';
666
+ default:
667
+ return null;
668
+ }
669
+ }
670
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
671
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: EditorContentComponent, isStandalone: true, selector: "ui-editor-content", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalidInput: { classPropertyName: "invalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "handleInput()", "blur": "handleBlur()", "keydown": "handleKeydown($event)" }, properties: { "class": "classes()", "attr.data-slot": "\"editor-content\"", "attr.contenteditable": "disabled() ? \"false\" : \"true\"", "attr.role": "\"textbox\"", "attr.aria-multiline": "\"true\"", "attr.aria-label": "ariaLabel()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "invalid() ? \"true\" : null", "attr.data-disabled": "disabled() ? \"true\" : null", "attr.data-empty": "empty() ? \"true\" : null", "attr.data-placeholder": "placeholder()", "attr.tabindex": "disabled() ? null : \"0\"" } }, providers: [
672
+ {
673
+ provide: NG_VALUE_ACCESSOR,
674
+ useExisting: forwardRef(() => EditorContentComponent),
675
+ multi: true,
676
+ },
677
+ ], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
678
+ }
679
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: EditorContentComponent, decorators: [{
680
+ type: Component,
681
+ args: [{
682
+ selector: 'ui-editor-content',
683
+ changeDetection: ChangeDetectionStrategy.OnPush,
684
+ providers: [
685
+ {
686
+ provide: NG_VALUE_ACCESSOR,
687
+ useExisting: forwardRef(() => EditorContentComponent),
688
+ multi: true,
689
+ },
690
+ ],
691
+ host: {
692
+ '[class]': 'classes()',
693
+ '[attr.data-slot]': '"editor-content"',
694
+ '[attr.contenteditable]': 'disabled() ? "false" : "true"',
695
+ '[attr.role]': '"textbox"',
696
+ '[attr.aria-multiline]': '"true"',
697
+ '[attr.aria-label]': 'ariaLabel()',
698
+ '[attr.aria-disabled]': 'disabled() ? "true" : null',
699
+ '[attr.aria-invalid]': 'invalid() ? "true" : null',
700
+ '[attr.data-disabled]': 'disabled() ? "true" : null',
701
+ '[attr.data-empty]': 'empty() ? "true" : null',
702
+ '[attr.data-placeholder]': 'placeholder()',
703
+ '[attr.tabindex]': 'disabled() ? null : "0"',
704
+ '(input)': 'handleInput()',
705
+ '(blur)': 'handleBlur()',
706
+ '(keydown)': 'handleKeydown($event)',
707
+ },
708
+ template: `<ng-content />`,
709
+ }]
710
+ }], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalidInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
711
+
712
+ /**
713
+ * Generated bundle index. Do not edit.
714
+ */
715
+
716
+ export { EditorButtonComponent, EditorComponent, EditorContentComponent, EditorSeparatorComponent, EditorSpacerComponent, EditorToolbarComponent };
717
+ //# sourceMappingURL=ojiepermana-angular-component-editor.mjs.map