@caribeng/ui 22.1.1 → 22.4.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 (305) hide show
  1. package/README.md +134 -12
  2. package/fesm2022/caribeng-ui-accordion.mjs +4 -4
  3. package/fesm2022/caribeng-ui-anchor.mjs +169 -0
  4. package/fesm2022/caribeng-ui-autocomplete.mjs +10 -8
  5. package/fesm2022/caribeng-ui-avatar.mjs +2 -2
  6. package/fesm2022/caribeng-ui-avatargroup.mjs +9 -3
  7. package/fesm2022/caribeng-ui-badge.mjs +8 -2
  8. package/fesm2022/caribeng-ui-blockui.mjs +12 -4
  9. package/fesm2022/caribeng-ui-breadcrumb.mjs +17 -7
  10. package/fesm2022/caribeng-ui-button.mjs +22 -2
  11. package/fesm2022/caribeng-ui-caribe-alert.mjs +5 -2
  12. package/fesm2022/caribeng-ui-caribe-animation-lottie.mjs +6 -3
  13. package/fesm2022/caribeng-ui-caribe-button-group.mjs +6 -3
  14. package/fesm2022/caribeng-ui-caribe-calendar.mjs +11 -6
  15. package/fesm2022/caribeng-ui-caribe-card-content.mjs +6 -3
  16. package/fesm2022/caribeng-ui-caribe-card-move.mjs +29 -7
  17. package/fesm2022/caribeng-ui-caribe-card-select.mjs +56 -14
  18. package/fesm2022/caribeng-ui-caribe-circle-loading.mjs +10 -7
  19. package/fesm2022/caribeng-ui-caribe-coachmark.mjs +42 -19
  20. package/fesm2022/caribeng-ui-caribe-data-table.mjs +15 -9
  21. package/fesm2022/caribeng-ui-caribe-dots-indicator.mjs +38 -5
  22. package/fesm2022/caribeng-ui-caribe-expansion-panel.mjs +16 -5
  23. package/fesm2022/caribeng-ui-caribe-fab-menu.mjs +56 -7
  24. package/fesm2022/caribeng-ui-caribe-file-download.mjs +68 -27
  25. package/fesm2022/caribeng-ui-caribe-file-select.mjs +22 -17
  26. package/fesm2022/caribeng-ui-caribe-float-menu.mjs +6 -3
  27. package/fesm2022/caribeng-ui-caribe-footer.mjs +8 -4
  28. package/fesm2022/caribeng-ui-caribe-header.mjs +6 -3
  29. package/fesm2022/caribeng-ui-caribe-icon-button.mjs +6 -3
  30. package/fesm2022/caribeng-ui-caribe-illustration.mjs +6 -3
  31. package/fesm2022/caribeng-ui-caribe-inline-alert.mjs +5 -2
  32. package/fesm2022/caribeng-ui-caribe-input-search.mjs +14 -10
  33. package/fesm2022/caribeng-ui-caribe-input-select.mjs +12 -10
  34. package/fesm2022/caribeng-ui-caribe-input-token.mjs +61 -11
  35. package/fesm2022/caribeng-ui-caribe-link.mjs +7 -2
  36. package/fesm2022/caribeng-ui-caribe-loader.mjs +8 -5
  37. package/fesm2022/caribeng-ui-caribe-modal.mjs +32 -16
  38. package/fesm2022/caribeng-ui-caribe-off-canvas.mjs +26 -12
  39. package/fesm2022/caribeng-ui-caribe-onboarding.mjs +44 -19
  40. package/fesm2022/caribeng-ui-caribe-pictogram.mjs +6 -3
  41. package/fesm2022/caribeng-ui-caribe-pop-over.mjs +34 -10
  42. package/fesm2022/caribeng-ui-caribe-preloader.mjs +9 -6
  43. package/fesm2022/caribeng-ui-caribe-progress-bar.mjs +5 -2
  44. package/fesm2022/caribeng-ui-caribe-shortcut.mjs +8 -3
  45. package/fesm2022/caribeng-ui-caribe-step-indicator.mjs +12 -5
  46. package/fesm2022/caribeng-ui-caribe-stroke.mjs +6 -3
  47. package/fesm2022/caribeng-ui-caribe-switch.mjs +5 -3
  48. package/fesm2022/caribeng-ui-caribe-tag-button.mjs +1 -1
  49. package/fesm2022/caribeng-ui-caribe-tracker.mjs +5 -2
  50. package/fesm2022/caribeng-ui-caribe-transaction-status.mjs +1 -1
  51. package/fesm2022/caribeng-ui-caribe-voucher.mjs +11 -8
  52. package/fesm2022/caribeng-ui-carousel.mjs +49 -14
  53. package/fesm2022/caribeng-ui-cascadeselect.mjs +22 -8
  54. package/fesm2022/caribeng-ui-chart.mjs +2601 -303
  55. package/fesm2022/caribeng-ui-chat.mjs +1303 -0
  56. package/fesm2022/caribeng-ui-chip.mjs +9 -4
  57. package/fesm2022/caribeng-ui-chips.mjs +9 -5
  58. package/fesm2022/caribeng-ui-code-block.mjs +332 -0
  59. package/fesm2022/caribeng-ui-colorpicker.mjs +107 -11
  60. package/fesm2022/caribeng-ui-command-palette.mjs +476 -0
  61. package/fesm2022/caribeng-ui-confirmdialog.mjs +140 -10
  62. package/fesm2022/caribeng-ui-confirmpopup.mjs +209 -9
  63. package/fesm2022/caribeng-ui-contextmenu.mjs +13 -6
  64. package/fesm2022/caribeng-ui-copy-button.mjs +230 -0
  65. package/fesm2022/caribeng-ui-dataview.mjs +214 -6
  66. package/fesm2022/caribeng-ui-datepicker.mjs +1630 -393
  67. package/fesm2022/caribeng-ui-descriptions.mjs +124 -0
  68. package/fesm2022/caribeng-ui-dialog.mjs +10 -7
  69. package/fesm2022/caribeng-ui-dock.mjs +58 -15
  70. package/fesm2022/caribeng-ui-drawer.mjs +17 -9
  71. package/fesm2022/caribeng-ui-dynamicdialog.mjs +210 -6
  72. package/fesm2022/caribeng-ui-editor.mjs +4413 -243
  73. package/fesm2022/caribeng-ui-empty.mjs +80 -0
  74. package/fesm2022/caribeng-ui-fieldset.mjs +2 -2
  75. package/fesm2022/caribeng-ui-file-card.mjs +136 -19
  76. package/fesm2022/caribeng-ui-fileupload.mjs +96 -19
  77. package/fesm2022/caribeng-ui-floatlabel.mjs +4 -2
  78. package/fesm2022/caribeng-ui-folder-card.mjs +132 -15
  79. package/fesm2022/caribeng-ui-galleria.mjs +76 -45
  80. package/fesm2022/caribeng-ui-image.mjs +52 -29
  81. package/fesm2022/caribeng-ui-inlinemessage.mjs +2 -2
  82. package/fesm2022/caribeng-ui-inplace.mjs +22 -6
  83. package/fesm2022/caribeng-ui-input-number.mjs +9 -7
  84. package/fesm2022/caribeng-ui-inputgroup.mjs +2 -2
  85. package/fesm2022/caribeng-ui-inputmask.mjs +22 -13
  86. package/fesm2022/caribeng-ui-inputotp.mjs +12 -6
  87. package/fesm2022/caribeng-ui-kanban.mjs +4612 -0
  88. package/fesm2022/caribeng-ui-kbd.mjs +122 -0
  89. package/fesm2022/caribeng-ui-keyfilter.mjs +72 -0
  90. package/fesm2022/caribeng-ui-listbox.mjs +13 -11
  91. package/fesm2022/caribeng-ui-megamenu.mjs +228 -32
  92. package/fesm2022/caribeng-ui-mentions.mjs +495 -0
  93. package/fesm2022/caribeng-ui-menu.mjs +18 -8
  94. package/fesm2022/caribeng-ui-menubar.mjs +17 -8
  95. package/fesm2022/caribeng-ui-message.mjs +13 -7
  96. package/fesm2022/caribeng-ui-metergroup.mjs +29 -11
  97. package/fesm2022/caribeng-ui-multiselect.mjs +399 -97
  98. package/fesm2022/caribeng-ui-orderlist.mjs +230 -11
  99. package/fesm2022/caribeng-ui-organizationchart.mjs +16 -15
  100. package/fesm2022/caribeng-ui-paginator.mjs +18 -15
  101. package/fesm2022/caribeng-ui-panel.mjs +11 -8
  102. package/fesm2022/caribeng-ui-panelmenu.mjs +14 -8
  103. package/fesm2022/caribeng-ui-password.mjs +8 -6
  104. package/fesm2022/caribeng-ui-pdfviewer.mjs +1553 -0
  105. package/fesm2022/caribeng-ui-phone-input.mjs +688 -0
  106. package/fesm2022/caribeng-ui-picklist.mjs +251 -14
  107. package/fesm2022/caribeng-ui-pricing.mjs +272 -75
  108. package/fesm2022/caribeng-ui-qrcode.mjs +564 -0
  109. package/fesm2022/caribeng-ui-rating.mjs +7 -3
  110. package/fesm2022/caribeng-ui-repeater.mjs +223 -0
  111. package/fesm2022/caribeng-ui-result.mjs +91 -0
  112. package/fesm2022/caribeng-ui-ripple.mjs +2 -0
  113. package/fesm2022/caribeng-ui-scrollpanel.mjs +6 -3
  114. package/fesm2022/caribeng-ui-scrolltop.mjs +9 -4
  115. package/fesm2022/caribeng-ui-select.mjs +379 -87
  116. package/fesm2022/caribeng-ui-selectbutton.mjs +2 -2
  117. package/fesm2022/caribeng-ui-sidebar.mjs +573 -0
  118. package/fesm2022/caribeng-ui-slider.mjs +171 -75
  119. package/fesm2022/caribeng-ui-speeddial.mjs +7 -4
  120. package/fesm2022/caribeng-ui-spinner.mjs +5 -2
  121. package/fesm2022/caribeng-ui-splitbutton.mjs +163 -0
  122. package/fesm2022/caribeng-ui-splitter.mjs +5 -2
  123. package/fesm2022/caribeng-ui-statistic.mjs +183 -0
  124. package/fesm2022/caribeng-ui-stepper.mjs +17 -7
  125. package/fesm2022/caribeng-ui-steps.mjs +6 -3
  126. package/fesm2022/caribeng-ui-table.mjs +716 -84
  127. package/fesm2022/caribeng-ui-tabmenu.mjs +13 -6
  128. package/fesm2022/caribeng-ui-tag.mjs +2 -2
  129. package/fesm2022/caribeng-ui-terminal.mjs +45 -9
  130. package/fesm2022/caribeng-ui-themetoggle.mjs +82 -0
  131. package/fesm2022/caribeng-ui-tieredmenu.mjs +113 -20
  132. package/fesm2022/caribeng-ui-timeline.mjs +175 -6
  133. package/fesm2022/caribeng-ui-toast.mjs +7 -4
  134. package/fesm2022/caribeng-ui-togglebutton.mjs +8 -6
  135. package/fesm2022/caribeng-ui-toolbar.mjs +6 -3
  136. package/fesm2022/caribeng-ui-tree.mjs +302 -6
  137. package/fesm2022/caribeng-ui-treeselect.mjs +26 -10
  138. package/fesm2022/caribeng-ui-treetable.mjs +269 -6
  139. package/fesm2022/caribeng-ui-virtualscroller.mjs +123 -10
  140. package/fesm2022/caribeng-ui.mjs +1216 -6
  141. package/package.json +93 -3
  142. package/schematics/collection.json +15 -0
  143. package/schematics/migrate-from-primeng/core-icons.json +1 -0
  144. package/schematics/migrate-from-primeng/icons.js +269 -0
  145. package/schematics/migrate-from-primeng/index.js +290 -0
  146. package/schematics/migrate-from-primeng/mappings/button.js +93 -0
  147. package/schematics/migrate-from-primeng/mappings/card.js +33 -0
  148. package/schematics/migrate-from-primeng/mappings/checkbox.js +44 -0
  149. package/schematics/migrate-from-primeng/mappings/confirm.js +221 -0
  150. package/schematics/migrate-from-primeng/mappings/datepicker.js +121 -0
  151. package/schematics/migrate-from-primeng/mappings/dialog.js +84 -0
  152. package/schematics/migrate-from-primeng/mappings/index.js +88 -0
  153. package/schematics/migrate-from-primeng/mappings/inputnumber.js +62 -0
  154. package/schematics/migrate-from-primeng/mappings/inputtext.js +60 -0
  155. package/schematics/migrate-from-primeng/mappings/menu.js +468 -0
  156. package/schematics/migrate-from-primeng/mappings/multiselect.js +49 -0
  157. package/schematics/migrate-from-primeng/mappings/radiobutton.js +22 -0
  158. package/schematics/migrate-from-primeng/mappings/rules.js +206 -0
  159. package/schematics/migrate-from-primeng/mappings/select.js +97 -0
  160. package/schematics/migrate-from-primeng/mappings/service-calls.js +100 -0
  161. package/schematics/migrate-from-primeng/mappings/table.js +613 -0
  162. package/schematics/migrate-from-primeng/mappings/tabs.js +225 -0
  163. package/schematics/migrate-from-primeng/mappings/tag.js +29 -0
  164. package/schematics/migrate-from-primeng/mappings/textarea.js +44 -0
  165. package/schematics/migrate-from-primeng/mappings/toast.js +173 -0
  166. package/schematics/migrate-from-primeng/mappings/toggleswitch.js +37 -0
  167. package/schematics/migrate-from-primeng/mappings/tooltip.js +44 -0
  168. package/schematics/migrate-from-primeng/mappings/types.js +10 -0
  169. package/schematics/migrate-from-primeng/report.js +79 -0
  170. package/schematics/migrate-from-primeng/schema.js +2 -0
  171. package/schematics/migrate-from-primeng/schema.json +34 -0
  172. package/schematics/migrate-from-primeng/template.js +387 -0
  173. package/schematics/migrate-from-primeng/todo.js +5 -0
  174. package/schematics/migrate-from-primeng/typescript.js +442 -0
  175. package/schematics/migrate-from-primeng/workspace.js +117 -0
  176. package/schematics/ng-add/index.js +140 -0
  177. package/schematics/ng-add/schema.js +2 -0
  178. package/schematics/ng-add/schema.json +66 -0
  179. package/types/caribeng-ui-anchor.d.ts +50 -0
  180. package/types/caribeng-ui-autocomplete.d.ts +4 -2
  181. package/types/caribeng-ui-avatargroup.d.ts +3 -1
  182. package/types/caribeng-ui-badge.d.ts +3 -1
  183. package/types/caribeng-ui-blockui.d.ts +9 -4
  184. package/types/caribeng-ui-breadcrumb.d.ts +11 -0
  185. package/types/caribeng-ui-button.d.ts +9 -1
  186. package/types/caribeng-ui-caribe-alert.d.ts +3 -0
  187. package/types/caribeng-ui-caribe-animation-lottie.d.ts +4 -1
  188. package/types/caribeng-ui-caribe-button-group.d.ts +4 -1
  189. package/types/caribeng-ui-caribe-calendar.d.ts +5 -1
  190. package/types/caribeng-ui-caribe-card-content.d.ts +4 -1
  191. package/types/caribeng-ui-caribe-card-move.d.ts +13 -13
  192. package/types/caribeng-ui-caribe-card-select.d.ts +10 -1
  193. package/types/caribeng-ui-caribe-circle-loading.d.ts +4 -1
  194. package/types/caribeng-ui-caribe-coachmark.d.ts +6 -0
  195. package/types/caribeng-ui-caribe-data-table.d.ts +7 -2
  196. package/types/caribeng-ui-caribe-dots-indicator.d.ts +9 -0
  197. package/types/caribeng-ui-caribe-expansion-panel.d.ts +7 -10
  198. package/types/caribeng-ui-caribe-fab-menu.d.ts +10 -1
  199. package/types/caribeng-ui-caribe-file-download.d.ts +8 -10
  200. package/types/caribeng-ui-caribe-file-select.d.ts +7 -1
  201. package/types/caribeng-ui-caribe-float-menu.d.ts +4 -1
  202. package/types/caribeng-ui-caribe-header.d.ts +3 -0
  203. package/types/caribeng-ui-caribe-icon-button.d.ts +4 -1
  204. package/types/caribeng-ui-caribe-illustration.d.ts +4 -1
  205. package/types/caribeng-ui-caribe-inline-alert.d.ts +3 -0
  206. package/types/caribeng-ui-caribe-input-search.d.ts +4 -2
  207. package/types/caribeng-ui-caribe-input-select.d.ts +4 -2
  208. package/types/caribeng-ui-caribe-input-token.d.ts +16 -1
  209. package/types/caribeng-ui-caribe-link.d.ts +3 -0
  210. package/types/caribeng-ui-caribe-loader.d.ts +4 -1
  211. package/types/caribeng-ui-caribe-modal.d.ts +7 -10
  212. package/types/caribeng-ui-caribe-off-canvas.d.ts +6 -1
  213. package/types/caribeng-ui-caribe-onboarding.d.ts +6 -0
  214. package/types/caribeng-ui-caribe-pictogram.d.ts +4 -1
  215. package/types/caribeng-ui-caribe-pop-over.d.ts +7 -10
  216. package/types/caribeng-ui-caribe-preloader.d.ts +4 -1
  217. package/types/caribeng-ui-caribe-progress-bar.d.ts +3 -0
  218. package/types/caribeng-ui-caribe-shortcut.d.ts +3 -1
  219. package/types/caribeng-ui-caribe-step-indicator.d.ts +6 -0
  220. package/types/caribeng-ui-caribe-stroke.d.ts +4 -1
  221. package/types/caribeng-ui-caribe-switch.d.ts +3 -1
  222. package/types/caribeng-ui-caribe-tracker.d.ts +3 -0
  223. package/types/caribeng-ui-caribe-voucher.d.ts +5 -2
  224. package/types/caribeng-ui-carousel.d.ts +10 -1
  225. package/types/caribeng-ui-cascadeselect.d.ts +7 -2
  226. package/types/caribeng-ui-chart.d.ts +471 -44
  227. package/types/caribeng-ui-chat.d.ts +299 -0
  228. package/types/caribeng-ui-chip.d.ts +6 -0
  229. package/types/caribeng-ui-chips.d.ts +6 -2
  230. package/types/caribeng-ui-code-block.d.ts +65 -0
  231. package/types/caribeng-ui-colorpicker.d.ts +8 -2
  232. package/types/caribeng-ui-command-palette.d.ts +133 -0
  233. package/types/caribeng-ui-confirmdialog.d.ts +57 -6
  234. package/types/caribeng-ui-confirmpopup.d.ts +74 -5
  235. package/types/caribeng-ui-contextmenu.d.ts +11 -1
  236. package/types/caribeng-ui-copy-button.d.ts +90 -0
  237. package/types/caribeng-ui-dataview.d.ts +65 -5
  238. package/types/caribeng-ui-datepicker.d.ts +186 -21
  239. package/types/caribeng-ui-descriptions.d.ts +63 -0
  240. package/types/caribeng-ui-dialog.d.ts +4 -1
  241. package/types/caribeng-ui-dock.d.ts +17 -2
  242. package/types/caribeng-ui-drawer.d.ts +7 -2
  243. package/types/caribeng-ui-dynamicdialog.d.ts +93 -3
  244. package/types/caribeng-ui-editor.d.ts +486 -13
  245. package/types/caribeng-ui-empty.d.ts +34 -0
  246. package/types/caribeng-ui-file-card.d.ts +28 -3
  247. package/types/caribeng-ui-fileupload.d.ts +27 -4
  248. package/types/caribeng-ui-folder-card.d.ts +31 -6
  249. package/types/caribeng-ui-galleria.d.ts +9 -0
  250. package/types/caribeng-ui-image.d.ts +10 -0
  251. package/types/caribeng-ui-inplace.d.ts +8 -0
  252. package/types/caribeng-ui-input-number.d.ts +3 -1
  253. package/types/caribeng-ui-inputmask.d.ts +8 -1
  254. package/types/caribeng-ui-inputotp.d.ts +7 -2
  255. package/types/caribeng-ui-kanban.d.ts +783 -0
  256. package/types/caribeng-ui-kbd.d.ts +36 -0
  257. package/types/caribeng-ui-keyfilter.d.ts +30 -0
  258. package/types/caribeng-ui-listbox.d.ts +5 -3
  259. package/types/caribeng-ui-megamenu.d.ts +37 -2
  260. package/types/caribeng-ui-mentions.d.ts +127 -0
  261. package/types/caribeng-ui-menu.d.ts +14 -2
  262. package/types/caribeng-ui-menubar.d.ts +12 -1
  263. package/types/caribeng-ui-message.d.ts +5 -0
  264. package/types/caribeng-ui-metergroup.d.ts +9 -1
  265. package/types/caribeng-ui-multiselect.d.ts +71 -10
  266. package/types/caribeng-ui-orderlist.d.ts +58 -6
  267. package/types/caribeng-ui-organizationchart.d.ts +7 -1
  268. package/types/caribeng-ui-paginator.d.ts +3 -0
  269. package/types/caribeng-ui-panel.d.ts +3 -0
  270. package/types/caribeng-ui-panelmenu.d.ts +11 -1
  271. package/types/caribeng-ui-password.d.ts +4 -2
  272. package/types/caribeng-ui-pdfviewer.d.ts +258 -0
  273. package/types/caribeng-ui-phone-input.d.ts +168 -0
  274. package/types/caribeng-ui-picklist.d.ts +67 -7
  275. package/types/caribeng-ui-pricing.d.ts +49 -9
  276. package/types/caribeng-ui-qrcode.d.ts +88 -0
  277. package/types/caribeng-ui-rating.d.ts +6 -2
  278. package/types/caribeng-ui-repeater.d.ts +79 -0
  279. package/types/caribeng-ui-result.d.ts +35 -0
  280. package/types/caribeng-ui-scrollpanel.d.ts +4 -1
  281. package/types/caribeng-ui-scrolltop.d.ts +4 -1
  282. package/types/caribeng-ui-select.d.ts +73 -9
  283. package/types/caribeng-ui-sidebar.d.ts +167 -0
  284. package/types/caribeng-ui-slider.d.ts +63 -10
  285. package/types/caribeng-ui-speeddial.d.ts +5 -2
  286. package/types/caribeng-ui-spinner.d.ts +3 -0
  287. package/types/caribeng-ui-splitbutton.d.ts +49 -0
  288. package/types/caribeng-ui-splitter.d.ts +3 -0
  289. package/types/caribeng-ui-statistic.d.ts +65 -0
  290. package/types/caribeng-ui-stepper.d.ts +5 -0
  291. package/types/caribeng-ui-steps.d.ts +4 -1
  292. package/types/caribeng-ui-table.d.ts +185 -17
  293. package/types/caribeng-ui-tabmenu.d.ts +11 -1
  294. package/types/caribeng-ui-terminal.d.ts +10 -0
  295. package/types/caribeng-ui-themetoggle.d.ts +32 -0
  296. package/types/caribeng-ui-tieredmenu.d.ts +22 -3
  297. package/types/caribeng-ui-timeline.d.ts +63 -4
  298. package/types/caribeng-ui-toast.d.ts +3 -0
  299. package/types/caribeng-ui-togglebutton.d.ts +5 -3
  300. package/types/caribeng-ui-toolbar.d.ts +7 -4
  301. package/types/caribeng-ui-tree.d.ts +76 -4
  302. package/types/caribeng-ui-treeselect.d.ts +10 -2
  303. package/types/caribeng-ui-treetable.d.ts +68 -4
  304. package/types/caribeng-ui-virtualscroller.d.ts +45 -5
  305. package/types/caribeng-ui.d.ts +775 -12
@@ -1,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, output, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { CbIcon } from '@caribeng/ui/icon';
4
+ import { injectCbTranslation, cbFormat } from '@caribeng/ui';
4
5
 
5
6
  /**
6
7
  * Chip de CaribeNG: píldora compacta para representar entidades, filtros o etiquetas
@@ -8,6 +9,10 @@ import { CbIcon } from '@caribeng/ui/icon';
8
9
  */
9
10
  class CbChip {
10
11
  constructor() {
12
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
13
+ this.t = injectCbTranslation();
14
+ /** Rellena `{0}`, `{1}`… de un texto traducido. */
15
+ this.fmt = cbFormat;
11
16
  this.label = input('', /* @ts-ignore */
12
17
  ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
13
18
  this.icon = input('', /* @ts-ignore */
@@ -27,7 +32,7 @@ class CbChip {
27
32
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbChip, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
28
33
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbChip, isStandalone: true, selector: "cb-chip", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { removed: "removed" }, host: { properties: { "style.display": "visible() ? \"inline-flex\" : \"none\"" }, classAttribute: "cb-chip" }, ngImport: i0, template: `
29
34
  @if (image()) {
30
- <img class="cb-chip__img" [src]="image()" [alt]="label()" />
35
+ <img class="cb-chip__img" [src]="image()" alt="" />
31
36
  } @else if (icon()) {
32
37
  <cb-icon class="cb-chip__icon" [name]="icon()" [size]="14" aria-hidden="true" />
33
38
  }
@@ -36,7 +41,7 @@ class CbChip {
36
41
  <button
37
42
  type="button"
38
43
  class="cb-chip__remove"
39
- [attr.aria-label]="'Quitar ' + label()"
44
+ [attr.aria-label]="fmt(t().removeItem, label())"
40
45
  (click)="onRemove($event)"
41
46
  >
42
47
  <cb-icon name="x" [size]="13" aria-hidden="true" />
@@ -51,7 +56,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
51
56
  '[style.display]': 'visible() ? "inline-flex" : "none"',
52
57
  }, template: `
53
58
  @if (image()) {
54
- <img class="cb-chip__img" [src]="image()" [alt]="label()" />
59
+ <img class="cb-chip__img" [src]="image()" alt="" />
55
60
  } @else if (icon()) {
56
61
  <cb-icon class="cb-chip__icon" [name]="icon()" [size]="14" aria-hidden="true" />
57
62
  }
@@ -60,7 +65,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
60
65
  <button
61
66
  type="button"
62
67
  class="cb-chip__remove"
63
- [attr.aria-label]="'Quitar ' + label()"
68
+ [attr.aria-label]="fmt(t().removeItem, label())"
64
69
  (click)="onRemove($event)"
65
70
  >
66
71
  <cb-icon name="x" [size]="13" aria-hidden="true" />
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { model, input, output, viewChild, signal, computed, forwardRef, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
  import { CbIcon } from '@caribeng/ui/icon';
5
- import { cbFieldState } from '@caribeng/ui';
5
+ import { injectCbTranslation, cbFormat, cbFieldState } from '@caribeng/ui';
6
6
 
7
7
  let nextUid = 0;
8
8
  /**
@@ -16,6 +16,10 @@ let nextUid = 0;
16
16
  */
17
17
  class CbChips {
18
18
  constructor() {
19
+ /** Textos de interfaz en el idioma activo (`provideCaribeNG({ locale })`). */
20
+ this.t = injectCbTranslation();
21
+ /** Rellena `{0}`, `{1}`… de un texto traducido. */
22
+ this.fmt = cbFormat;
19
23
  this.value = model([], /* @ts-ignore */
20
24
  ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
21
25
  this.placeholder = input('', /* @ts-ignore */
@@ -127,7 +131,7 @@ class CbChips {
127
131
  <button
128
132
  type="button"
129
133
  class="cb-chips__remove"
130
- [attr.aria-label]="'Quitar ' + chip"
134
+ [attr.aria-label]="fmt(t().removeItem, chip)"
131
135
  (click)="remove($index); $event.stopPropagation()"
132
136
  >
133
137
  <cb-icon name="x" [size]="14" aria-hidden="true" />
@@ -151,7 +155,7 @@ class CbChips {
151
155
  (blur)="onBlur()"
152
156
  />
153
157
  </div>
154
- `, isInline: true, styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface-100)}:host-context([data-theme=\"dark\"]) .cb-chips__chip{background-color:color-mix(in srgb,var(--cb-color-primary-500) 22%,transparent);color:var(--cb-color-primary-200)}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
158
+ `, isInline: true, styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface)}:host-context([data-theme=\"dark\"]) .cb-chips__chip{background-color:color-mix(in srgb,var(--cb-color-primary-500) 22%,transparent);color:var(--cb-color-primary-200)}\n"], dependencies: [{ kind: "component", type: CbIcon, selector: "cb-icon", inputs: ["name", "size", "spin", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
155
159
  }
156
160
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbChips, decorators: [{
157
161
  type: Component,
@@ -170,7 +174,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
170
174
  <button
171
175
  type="button"
172
176
  class="cb-chips__remove"
173
- [attr.aria-label]="'Quitar ' + chip"
177
+ [attr.aria-label]="fmt(t().removeItem, chip)"
174
178
  (click)="remove($index); $event.stopPropagation()"
175
179
  >
176
180
  <cb-icon name="x" [size]="14" aria-hidden="true" />
@@ -200,7 +204,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
200
204
  useExisting: forwardRef(() => CbChips),
201
205
  multi: true,
202
206
  },
203
- ], styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface-100)}:host-context([data-theme=\"dark\"]) .cb-chips__chip{background-color:color-mix(in srgb,var(--cb-color-primary-500) 22%,transparent);color:var(--cb-color-primary-200)}\n"] }]
207
+ ], styles: [":host{display:block}.cb-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cb-space-2);width:100%;min-height:2.5rem;padding:var(--cb-space-1) var(--cb-space-2);background-color:var(--cb-color-bg);border:var(--cb-border-width) solid var(--cb-color-border-strong);border-radius:var(--cb-radius-md);cursor:text;transition:border-color var(--cb-duration-fast) var(--cb-ease),box-shadow var(--cb-duration-fast) var(--cb-ease)}.cb-chips:focus-within{border-color:var(--cb-color-primary-500);box-shadow:0 0 0 3px var(--cb-color-focus-ring)}.cb-chips--sm{min-height:2.125rem;font-size:var(--cb-text-sm)}.cb-chips--lg{min-height:2.875rem;font-size:var(--cb-text-lg)}.cb-chips__chip{display:inline-flex;align-items:center;gap:var(--cb-space-1);padding:.125rem .25rem .125rem .5rem;background-color:var(--cb-color-primary-50);color:var(--cb-color-primary-700);border-radius:var(--cb-radius-sm);font-size:.875em}.cb-chips__remove{display:inline-flex;padding:1px;border:none;background:transparent;color:inherit;border-radius:var(--cb-radius-full);cursor:pointer;opacity:.7}.cb-chips__remove:hover{opacity:1;background-color:color-mix(in srgb,var(--cb-color-primary-500) 20%,transparent)}.cb-chips__input{flex:1 1 60px;min-width:60px;border:none;outline:none;background:transparent;color:var(--cb-color-text);font:inherit;padding:var(--cb-space-1) 0}.cb-chips.cb-is-invalid{border-color:var(--cb-color-danger)}.cb-chips.cb-is-disabled{opacity:var(--cb-opacity-disabled, .55);cursor:default;background-color:var(--cb-color-surface)}:host-context([data-theme=\"dark\"]) .cb-chips__chip{background-color:color-mix(in srgb,var(--cb-color-primary-500) 22%,transparent);color:var(--cb-color-primary-200)}\n"] }]
204
208
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], allowDuplicate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowDuplicate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], added: [{ type: i0.Output, args: ["added"] }], removed: [{ type: i0.Output, args: ["removed"] }], field: [{ type: i0.ViewChild, args: ['field', { isSignal: true }] }] } });
205
209
  function toBoolean(value) {
206
210
  return value !== false && value != null && `${value}` !== 'false';
@@ -0,0 +1,332 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, booleanAttribute, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { CbCopyButton } from '@caribeng/ui/copy-button';
4
+
5
+ /*
6
+ * Resaltado de sintaxis propio de CaribeNG, ligero y sin dependencias.
7
+ * Devuelve tokens (no HTML): quien los pinta decide cómo, sin innerHTML.
8
+ * Lenguajes: TypeScript/JavaScript, HTML/XML (y plantillas Angular), CSS/SCSS,
9
+ * JSON, Bash, Python y SQL. Un lenguaje desconocido se devuelve como texto.
10
+ */
11
+ const words = (list) => new RegExp(`\\b(?:${list.trim().split(/\s+/).join('|')})\\b`, 'y');
12
+ const STRING_DQ = /"(?:\\.|[^"\\\n])*"?/y;
13
+ const STRING_SQ = /'(?:\\.|[^'\\\n])*'?/y;
14
+ const NUMBER = /\b(?:0x[\da-fA-F_]+|0b[01_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?n?)\b/y;
15
+ const SPACE = /\s+/y;
16
+ const JS = [
17
+ ['comment', /\/\/.*/y],
18
+ ['comment', /\/\*[\s\S]*?(?:\*\/|$)/y],
19
+ ['string', /`(?:\\[\s\S]|[^`\\])*`?/y],
20
+ ['string', STRING_DQ],
21
+ ['string', STRING_SQ],
22
+ ['keyword', /@[A-Za-z_]\w*/y],
23
+ [
24
+ 'keyword',
25
+ words(`abstract as async await break case catch class const constructor continue debugger declare default delete do else enum
26
+ export extends finally for from function get if implements import in instanceof interface is keyof let namespace new of
27
+ override private protected public readonly return satisfies set static super switch throw try type typeof var void while with yield`),
28
+ ],
29
+ ['builtin', words('true false null undefined this NaN Infinity console window document Math JSON Promise Array Object String Number Boolean Date Map Set Error any unknown never string number boolean symbol bigint')],
30
+ ['number', NUMBER],
31
+ ['function', /[A-Za-z_$][\w$]*(?=\s*(?:<[^>()]*>)?\()/y],
32
+ ['variable', /[A-Za-z_$][\w$]*/y],
33
+ ['operator', /=>|\?\?=?|\?\.|\.{3}|[=!]==?|[<>]=?|&&|\|\||[-+*/%&|^~!?:=]+/y],
34
+ ['punctuation', /[{}()[\];,.<>]/y],
35
+ ];
36
+ const HTML = [
37
+ // Dentro de una etiqueta: atributos, valores y cierre.
38
+ ['tag', /\/?>/y, { in: 'tag', exit: true }],
39
+ ['string', /"[^"]*"?/y, { in: 'tag' }],
40
+ ['string', /'[^']*'?/y, { in: 'tag' }],
41
+ ['operator', /=/y, { in: 'tag' }],
42
+ ['attr', /[^\s=/>"']+/y, { in: 'tag' }],
43
+ // Fuera: comentarios, etiquetas, interpolación y bloques de control de Angular.
44
+ ['comment', /<!--[\s\S]*?(?:-->|$)/y],
45
+ ['keyword', /<!DOCTYPE[^>]*>/iy],
46
+ ['tag', /<\/?[A-Za-z][\w:.-]*/y, { enter: 'tag' }],
47
+ ['variable', /\{\{[\s\S]*?(?:\}\}|$)/y],
48
+ ['keyword', /@(?:if|else if|else|for|empty|switch|case|default|defer|placeholder|loading|let)\b/y],
49
+ ['plain', /[^<{@\s]+/y],
50
+ ];
51
+ const CSS = [
52
+ ['comment', /\/\*[\s\S]*?(?:\*\/|$)/y],
53
+ ['comment', /\/\/.*/y],
54
+ ['string', STRING_DQ],
55
+ ['string', STRING_SQ],
56
+ ['keyword', /@[\w-]+/y],
57
+ ['variable', /--[\w-]+|\$[\w-]+/y],
58
+ ['number', /#[\da-fA-F]{3,8}\b/y],
59
+ ['number', /-?(?:\d+\.?\d*|\.\d+)(?:px|rem|em|%|vh|vw|vmin|vmax|s|ms|deg|fr|ch|ex|dvh|svh|lh)?\b/y],
60
+ ['function', /[\w-]+(?=\()/y],
61
+ ['property', /[\w-]+(?=\s*:(?!:))/y],
62
+ ['keyword', words('!important important')],
63
+ ['punctuation', /[{}()[\];:,>+~*]/y],
64
+ ['plain', /[\w-]+|[.#&]/y],
65
+ ];
66
+ const JSON_RULES = [
67
+ ['property', /"(?:\\.|[^"\\\n])*"(?=\s*:)/y],
68
+ ['string', STRING_DQ],
69
+ ['number', /-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/y],
70
+ ['builtin', words('true false null')],
71
+ ['punctuation', /[{}[\]:,]/y],
72
+ ];
73
+ const BASH = [
74
+ ['comment', /#.*/y],
75
+ ['string', STRING_DQ],
76
+ ['string', STRING_SQ],
77
+ ['variable', /\$\{[^}]*\}?|\$[\w@#?*!$-]/y],
78
+ ['keyword', words('if then else elif fi for while until do done case esac in function return export local readonly unset source exit')],
79
+ ['builtin', words('echo cd ls cat cp mv rm mkdir touch grep sed awk curl wget sudo npm npx pnpm yarn node ng nx git docker kubectl')],
80
+ ['attr', /(?<=\s)--?[\w-]+/y],
81
+ ['number', /\b\d+\b/y],
82
+ ['operator', /&&|\|\||[|&;<>]+|=/y],
83
+ ];
84
+ const PYTHON = [
85
+ ['comment', /#.*/y],
86
+ ['string', /[rbfu]{0,2}(?:"""[\s\S]*?(?:"""|$)|'''[\s\S]*?(?:'''|$))/iy],
87
+ ['string', /[rbfu]{0,2}(?:"(?:\\.|[^"\\\n])*"?|'(?:\\.|[^'\\\n])*'?)/iy],
88
+ ['keyword', /@[A-Za-z_][\w.]*/y],
89
+ ['keyword', words('and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case')],
90
+ ['builtin', words('True False None self print len range dict list set tuple str int float bool open super isinstance enumerate zip map filter')],
91
+ ['number', NUMBER],
92
+ ['function', /[A-Za-z_]\w*(?=\s*\()/y],
93
+ ['variable', /[A-Za-z_]\w*/y],
94
+ ['operator', /\*\*=?|\/\/=?|->|[-+*/%@&|^~<>!=]=?/y],
95
+ ['punctuation', /[{}()[\];,.:]/y],
96
+ ];
97
+ const SQL = [
98
+ ['comment', /--.*/y],
99
+ ['comment', /\/\*[\s\S]*?(?:\*\/|$)/y],
100
+ ['string', STRING_SQ],
101
+ ['property', /"(?:[^"]|"")*"?/y],
102
+ [
103
+ 'keyword',
104
+ new RegExp(`\\b(?:${'select from where and or not insert into values update set delete create table alter drop index view join left right inner outer full on as group by order having limit offset distinct union all case when then else end is null in between like exists primary key foreign references default returning with desc asc'.split(' ').join('|')})\\b`, 'iy'),
105
+ ],
106
+ ['function', /[A-Za-z_]\w*(?=\s*\()/y],
107
+ ['number', /\b\d+(?:\.\d+)?\b/y],
108
+ ['operator', /<>|[<>!]=?|[-+*/%=|]+/y],
109
+ ['punctuation', /[(),;.]/y],
110
+ ];
111
+ const LANGUAGES = {
112
+ ts: JS,
113
+ typescript: JS,
114
+ js: JS,
115
+ javascript: JS,
116
+ jsx: JS,
117
+ tsx: JS,
118
+ mjs: JS,
119
+ html: HTML,
120
+ xml: HTML,
121
+ svg: HTML,
122
+ angular: HTML,
123
+ css: CSS,
124
+ scss: CSS,
125
+ sass: CSS,
126
+ less: CSS,
127
+ json: JSON_RULES,
128
+ jsonc: JSON_RULES,
129
+ bash: BASH,
130
+ sh: BASH,
131
+ shell: BASH,
132
+ zsh: BASH,
133
+ console: BASH,
134
+ py: PYTHON,
135
+ python: PYTHON,
136
+ sql: SQL,
137
+ };
138
+ /** Nombre visible de un lenguaje ("ts" → "TypeScript"). */
139
+ function cbCodeLanguageLabel(language) {
140
+ const key = language.toLowerCase();
141
+ const names = {
142
+ ts: 'TypeScript', typescript: 'TypeScript', tsx: 'TSX', js: 'JavaScript', javascript: 'JavaScript', jsx: 'JSX', mjs: 'JavaScript',
143
+ html: 'HTML', xml: 'XML', svg: 'SVG', angular: 'Angular', css: 'CSS', scss: 'SCSS', sass: 'Sass', less: 'Less',
144
+ json: 'JSON', jsonc: 'JSON', bash: 'Bash', sh: 'Shell', shell: 'Shell', zsh: 'Zsh', console: 'Consola',
145
+ py: 'Python', python: 'Python', sql: 'SQL', text: 'Texto', txt: 'Texto', plaintext: 'Texto',
146
+ };
147
+ return names[key] ?? language;
148
+ }
149
+ /** Si hay reglas de resaltado para el lenguaje. */
150
+ function cbCodeSupports(language) {
151
+ return !!LANGUAGES[language.toLowerCase()];
152
+ }
153
+ function tokenize(code, rules) {
154
+ const tokens = [];
155
+ const push = (type, text) => {
156
+ const last = tokens[tokens.length - 1];
157
+ if (last && last.type === type && (type === 'plain' || type === 'punctuation'))
158
+ tokens[tokens.length - 1] = { type, text: last.text + text };
159
+ else
160
+ tokens.push({ type, text });
161
+ };
162
+ let pos = 0;
163
+ let state = null;
164
+ outer: while (pos < code.length) {
165
+ SPACE.lastIndex = pos;
166
+ const space = SPACE.exec(code);
167
+ if (space) {
168
+ push('plain', space[0]);
169
+ pos += space[0].length;
170
+ continue;
171
+ }
172
+ for (const [type, re, opts] of rules) {
173
+ // Las reglas sin `in` solo valen en el estado inicial.
174
+ if ((opts?.in ?? null) !== state)
175
+ continue;
176
+ re.lastIndex = pos;
177
+ const m = re.exec(code);
178
+ if (m && m[0].length) {
179
+ push(type, m[0]);
180
+ pos += m[0].length;
181
+ if (opts?.enter)
182
+ state = opts.enter;
183
+ if (opts?.exit)
184
+ state = null;
185
+ continue outer;
186
+ }
187
+ }
188
+ push('plain', code[pos]);
189
+ pos++;
190
+ }
191
+ return tokens;
192
+ }
193
+ /**
194
+ * Tokeniza `code` y lo reparte en líneas (los comentarios y strings de varias
195
+ * líneas se parten en cada salto). Lenguaje desconocido = texto plano.
196
+ */
197
+ function cbHighlight(code, language = '') {
198
+ const source = (code ?? '').replace(/\r\n?/g, '\n');
199
+ const rules = LANGUAGES[language.toLowerCase()];
200
+ const tokens = rules ? tokenize(source, rules) : [{ type: 'plain', text: source }];
201
+ const lines = [[]];
202
+ for (const token of tokens) {
203
+ const parts = token.text.split('\n');
204
+ parts.forEach((part, i) => {
205
+ if (i > 0)
206
+ lines.push([]);
207
+ if (part)
208
+ lines[lines.length - 1].push({ type: token.type, text: part });
209
+ });
210
+ }
211
+ return lines;
212
+ }
213
+ /** Interpreta `"1,3-5"` o `[1, 3, 4, 5]` como conjunto de números de línea. */
214
+ function cbParseLineSet(value) {
215
+ if (!value)
216
+ return new Set();
217
+ if (Array.isArray(value))
218
+ return new Set(value);
219
+ const set = new Set();
220
+ for (const part of String(value).split(',')) {
221
+ const [a, b] = part.split('-').map((n) => Number(n.trim()));
222
+ if (!Number.isFinite(a))
223
+ continue;
224
+ const end = Number.isFinite(b) ? b : a;
225
+ for (let n = Math.min(a, end); n <= Math.max(a, end); n++)
226
+ set.add(n);
227
+ }
228
+ return set;
229
+ }
230
+
231
+ /**
232
+ * Bloque de código de CaribeNG con resaltado de sintaxis propio (sin
233
+ * dependencias), nombre de archivo o lenguaje, botón de copiar, números de
234
+ * línea y líneas destacadas. Sigue el tema claro u oscuro.
235
+ *
236
+ * El código se pinta como texto (tokens), nunca como HTML.
237
+ *
238
+ * @example
239
+ * ```html
240
+ * <cb-code-block language="ts" filename="app.config.ts" [code]="codigo" lineNumbers highlightLines="3-4" />
241
+ * ```
242
+ */
243
+ class CbCodeBlock {
244
+ constructor() {
245
+ /** Código a mostrar. */
246
+ this.code = input('', /* @ts-ignore */
247
+ ...(ngDevMode ? [{ debugName: "code" }] : /* istanbul ignore next */ []));
248
+ /** Lenguaje (`ts`, `html`, `css`, `json`, `bash`, `python`, `sql`…). Desconocido = texto. */
249
+ this.language = input('', /* @ts-ignore */
250
+ ...(ngDevMode ? [{ debugName: "language" }] : /* istanbul ignore next */ []));
251
+ /** Nombre de archivo en la cabecera (en lugar del lenguaje). */
252
+ this.filename = input('', /* @ts-ignore */
253
+ ...(ngDevMode ? [{ debugName: "filename" }] : /* istanbul ignore next */ []));
254
+ this.lineNumbers = input(false, { ...(ngDevMode ? { debugName: "lineNumbers" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
255
+ /** Número de la primera línea. */
256
+ this.startLine = input(1, /* @ts-ignore */
257
+ ...(ngDevMode ? [{ debugName: "startLine" }] : /* istanbul ignore next */ []));
258
+ /** Líneas destacadas: `"2,5-7"` o `[2, 5, 6, 7]`. */
259
+ this.highlightLines = input('', /* @ts-ignore */
260
+ ...(ngDevMode ? [{ debugName: "highlightLines" }] : /* istanbul ignore next */ []));
261
+ /** Parte las líneas largas en lugar de hacer scroll horizontal. */
262
+ this.wrap = input(false, { ...(ngDevMode ? { debugName: "wrap" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
263
+ this.copyable = input(true, { ...(ngDevMode ? { debugName: "copyable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
264
+ /** Muestra la cabecera (lenguaje o archivo y copiar). */
265
+ this.header = input(true, { ...(ngDevMode ? { debugName: "header" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
266
+ /** Alto máximo con scroll (`20rem`). */
267
+ this.maxHeight = input('', /* @ts-ignore */
268
+ ...(ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []));
269
+ /** Nombre del bloque. Por defecto, el archivo o el lenguaje. */
270
+ this.ariaLabel = input(undefined, /* @ts-ignore */
271
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
272
+ /** Tokens por línea (sin la línea vacía final que deja un salto de línea al terminar). */
273
+ this.lines = computed(() => cbHighlight(this.code().replace(/\n$/, ''), this.language()), /* @ts-ignore */
274
+ ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
275
+ this.highlighted = computed(() => cbParseLineSet(this.highlightLines()), /* @ts-ignore */
276
+ ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
277
+ this.languageLabel = computed(() => (this.language() ? cbCodeLanguageLabel(this.language()) : ''), /* @ts-ignore */
278
+ ...(ngDevMode ? [{ debugName: "languageLabel" }] : /* istanbul ignore next */ []));
279
+ this.showHeader = computed(() => this.header() && (!!this.filename() || !!this.language() || this.copyable()), /* @ts-ignore */
280
+ ...(ngDevMode ? [{ debugName: "showHeader" }] : /* istanbul ignore next */ []));
281
+ }
282
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCodeBlock, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
283
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: CbCodeBlock, isStandalone: true, selector: "cb-code-block", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, filename: { classPropertyName: "filename", publicName: "filename", isSignal: true, isRequired: false, transformFunction: null }, lineNumbers: { classPropertyName: "lineNumbers", publicName: "lineNumbers", isSignal: true, isRequired: false, transformFunction: null }, startLine: { classPropertyName: "startLine", publicName: "startLine", isSignal: true, isRequired: false, transformFunction: null }, highlightLines: { classPropertyName: "highlightLines", publicName: "highlightLines", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, copyable: { classPropertyName: "copyable", publicName: "copyable", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cb-code-block--wrap": "wrap()", "class.cb-code-block--numbers": "lineNumbers()" }, classAttribute: "cb-code-block" }, ngImport: i0, template: `
284
+ @if (showHeader()) {
285
+ <div class="cb-code-block__header">
286
+ <span class="cb-code-block__title">{{ filename() || languageLabel() }}</span>
287
+ @if (copyable()) {
288
+ <cb-copy-button class="cb-code-block__copy" [value]="code()" size="sm" />
289
+ }
290
+ </div>
291
+ }
292
+ <pre
293
+ class="cb-code-block__pre"
294
+ tabindex="0"
295
+ [style.max-height]="maxHeight() || null"
296
+ [attr.aria-label]="ariaLabel() ?? (filename() || languageLabel() || null)"
297
+ ><!-- En una línea: dentro de <pre> cada espacio cuenta. --><code class="cb-code-block__code">@for (line of lines(); track $index; let i = $index) {<span class="cb-code-block__line" [class.cb-code-block__line--hl]="highlighted().has(i + startLine())">@if (lineNumbers()) {<span class="cb-code-block__ln" aria-hidden="true">{{ i + startLine() }}</span>}<span class="cb-code-block__text">@for (token of line; track $index) {<span [class]="token.type === 'plain' ? null : 'cb-tok cb-tok-' + token.type">{{ token.text }}</span>}</span></span>}</code></pre>
298
+ `, isInline: true, styles: [":host{--cb-code-bg: #f6f8fa;--cb-code-fg: #1f2328;--cb-code-border: var(--cb-color-border);--cb-code-muted: #6e7781;--cb-code-hl: rgb(234 179 8 / .16);--cb-tok-keyword: #cf222e;--cb-tok-builtin: #0550ae;--cb-tok-string: #0a3069;--cb-tok-number: #0550ae;--cb-tok-comment: #6e7781;--cb-tok-function: #8250df;--cb-tok-operator: #cf222e;--cb-tok-punctuation: #57606a;--cb-tok-tag: #116329;--cb-tok-attr: #0550ae;--cb-tok-property: #0550ae;--cb-tok-variable: #1f2328;display:block;overflow:hidden;border:1px solid var(--cb-code-border);border-radius:var(--cb-radius-md, 8px);background:var(--cb-code-bg);color:var(--cb-code-fg);font-family:var(--cb-font-sans)}:host-context([data-theme=\"dark\"]){--cb-code-bg: #0d1117;--cb-code-fg: #e6edf3;--cb-code-muted: #8b949e;--cb-code-hl: rgb(234 179 8 / .14);--cb-tok-keyword: #ff7b72;--cb-tok-builtin: #79c0ff;--cb-tok-string: #a5d6ff;--cb-tok-number: #79c0ff;--cb-tok-comment: #8b949e;--cb-tok-function: #d2a8ff;--cb-tok-operator: #ff7b72;--cb-tok-punctuation: #b1bac4;--cb-tok-tag: #7ee787;--cb-tok-attr: #79c0ff;--cb-tok-property: #79c0ff;--cb-tok-variable: #e6edf3}.cb-code-block__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:2.25rem;padding:.125rem .25rem .125rem .875rem;border-bottom:1px solid var(--cb-code-border);color:var(--cb-code-muted);font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500)}.cb-code-block__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cb-code-block__pre{margin:0;padding:.75rem 0;overflow:auto;font-family:var(--cb-font-mono);font-size:.8125rem;line-height:1.6;tab-size:2}.cb-code-block__pre:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:-2px}.cb-code-block__code{display:block;min-width:fit-content;font:inherit}.cb-code-block__line{display:flex;padding:0 1rem}.cb-code-block__line--hl{background:var(--cb-code-hl);box-shadow:inset 3px 0 #eab308cc}.cb-code-block__ln{flex:none;min-width:2ch;margin-right:1rem;color:var(--cb-code-muted);text-align:right;-webkit-user-select:none;user-select:none}.cb-code-block__text{white-space:pre}.cb-code-block__text:empty:before{content:\" \"}:host(.cb-code-block--wrap) .cb-code-block__code{min-width:0}:host(.cb-code-block--wrap) .cb-code-block__text{white-space:pre-wrap;overflow-wrap:anywhere}.cb-tok-keyword{color:var(--cb-tok-keyword)}.cb-tok-builtin{color:var(--cb-tok-builtin)}.cb-tok-string{color:var(--cb-tok-string)}.cb-tok-number{color:var(--cb-tok-number)}.cb-tok-comment{color:var(--cb-tok-comment);font-style:italic}.cb-tok-function{color:var(--cb-tok-function)}.cb-tok-operator{color:var(--cb-tok-operator)}.cb-tok-punctuation{color:var(--cb-tok-punctuation)}.cb-tok-tag{color:var(--cb-tok-tag)}.cb-tok-attr{color:var(--cb-tok-attr)}.cb-tok-property{color:var(--cb-tok-property)}.cb-tok-variable{color:var(--cb-tok-variable)}\n"], dependencies: [{ kind: "component", type: CbCopyButton, selector: "cb-copy-button", inputs: ["value", "showLabel", "label", "copiedLabel", "timeout", "variant", "severity", "size", "disabled"], outputs: ["copied", "copyError"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
299
+ }
300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: CbCodeBlock, decorators: [{
301
+ type: Component,
302
+ args: [{ selector: 'cb-code-block', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, imports: [CbCopyButton], host: {
303
+ class: 'cb-code-block',
304
+ '[class.cb-code-block--wrap]': 'wrap()',
305
+ '[class.cb-code-block--numbers]': 'lineNumbers()',
306
+ }, template: `
307
+ @if (showHeader()) {
308
+ <div class="cb-code-block__header">
309
+ <span class="cb-code-block__title">{{ filename() || languageLabel() }}</span>
310
+ @if (copyable()) {
311
+ <cb-copy-button class="cb-code-block__copy" [value]="code()" size="sm" />
312
+ }
313
+ </div>
314
+ }
315
+ <pre
316
+ class="cb-code-block__pre"
317
+ tabindex="0"
318
+ [style.max-height]="maxHeight() || null"
319
+ [attr.aria-label]="ariaLabel() ?? (filename() || languageLabel() || null)"
320
+ ><!-- En una línea: dentro de <pre> cada espacio cuenta. --><code class="cb-code-block__code">@for (line of lines(); track $index; let i = $index) {<span class="cb-code-block__line" [class.cb-code-block__line--hl]="highlighted().has(i + startLine())">@if (lineNumbers()) {<span class="cb-code-block__ln" aria-hidden="true">{{ i + startLine() }}</span>}<span class="cb-code-block__text">@for (token of line; track $index) {<span [class]="token.type === 'plain' ? null : 'cb-tok cb-tok-' + token.type">{{ token.text }}</span>}</span></span>}</code></pre>
321
+ `, styles: [":host{--cb-code-bg: #f6f8fa;--cb-code-fg: #1f2328;--cb-code-border: var(--cb-color-border);--cb-code-muted: #6e7781;--cb-code-hl: rgb(234 179 8 / .16);--cb-tok-keyword: #cf222e;--cb-tok-builtin: #0550ae;--cb-tok-string: #0a3069;--cb-tok-number: #0550ae;--cb-tok-comment: #6e7781;--cb-tok-function: #8250df;--cb-tok-operator: #cf222e;--cb-tok-punctuation: #57606a;--cb-tok-tag: #116329;--cb-tok-attr: #0550ae;--cb-tok-property: #0550ae;--cb-tok-variable: #1f2328;display:block;overflow:hidden;border:1px solid var(--cb-code-border);border-radius:var(--cb-radius-md, 8px);background:var(--cb-code-bg);color:var(--cb-code-fg);font-family:var(--cb-font-sans)}:host-context([data-theme=\"dark\"]){--cb-code-bg: #0d1117;--cb-code-fg: #e6edf3;--cb-code-muted: #8b949e;--cb-code-hl: rgb(234 179 8 / .14);--cb-tok-keyword: #ff7b72;--cb-tok-builtin: #79c0ff;--cb-tok-string: #a5d6ff;--cb-tok-number: #79c0ff;--cb-tok-comment: #8b949e;--cb-tok-function: #d2a8ff;--cb-tok-operator: #ff7b72;--cb-tok-punctuation: #b1bac4;--cb-tok-tag: #7ee787;--cb-tok-attr: #79c0ff;--cb-tok-property: #79c0ff;--cb-tok-variable: #e6edf3}.cb-code-block__header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-height:2.25rem;padding:.125rem .25rem .125rem .875rem;border-bottom:1px solid var(--cb-code-border);color:var(--cb-code-muted);font-size:var(--cb-text-xs, .75rem);font-weight:var(--cb-font-weight-medium, 500)}.cb-code-block__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cb-code-block__pre{margin:0;padding:.75rem 0;overflow:auto;font-family:var(--cb-font-mono);font-size:.8125rem;line-height:1.6;tab-size:2}.cb-code-block__pre:focus-visible{outline:2px solid var(--cb-color-focus-ring);outline-offset:-2px}.cb-code-block__code{display:block;min-width:fit-content;font:inherit}.cb-code-block__line{display:flex;padding:0 1rem}.cb-code-block__line--hl{background:var(--cb-code-hl);box-shadow:inset 3px 0 #eab308cc}.cb-code-block__ln{flex:none;min-width:2ch;margin-right:1rem;color:var(--cb-code-muted);text-align:right;-webkit-user-select:none;user-select:none}.cb-code-block__text{white-space:pre}.cb-code-block__text:empty:before{content:\" \"}:host(.cb-code-block--wrap) .cb-code-block__code{min-width:0}:host(.cb-code-block--wrap) .cb-code-block__text{white-space:pre-wrap;overflow-wrap:anywhere}.cb-tok-keyword{color:var(--cb-tok-keyword)}.cb-tok-builtin{color:var(--cb-tok-builtin)}.cb-tok-string{color:var(--cb-tok-string)}.cb-tok-number{color:var(--cb-tok-number)}.cb-tok-comment{color:var(--cb-tok-comment);font-style:italic}.cb-tok-function{color:var(--cb-tok-function)}.cb-tok-operator{color:var(--cb-tok-operator)}.cb-tok-punctuation{color:var(--cb-tok-punctuation)}.cb-tok-tag{color:var(--cb-tok-tag)}.cb-tok-attr{color:var(--cb-tok-attr)}.cb-tok-property{color:var(--cb-tok-property)}.cb-tok-variable{color:var(--cb-tok-variable)}\n"] }]
322
+ }], propDecorators: { code: [{ type: i0.Input, args: [{ isSignal: true, alias: "code", required: false }] }], language: [{ type: i0.Input, args: [{ isSignal: true, alias: "language", required: false }] }], filename: [{ type: i0.Input, args: [{ isSignal: true, alias: "filename", required: false }] }], lineNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineNumbers", required: false }] }], startLine: [{ type: i0.Input, args: [{ isSignal: true, alias: "startLine", required: false }] }], highlightLines: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightLines", required: false }] }], wrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "wrap", required: false }] }], copyable: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyable", required: false }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
323
+
324
+ /*
325
+ * Public API Surface de @caribeng/ui/code-block
326
+ */
327
+
328
+ /**
329
+ * Generated bundle index. Do not edit.
330
+ */
331
+
332
+ export { CbCodeBlock, cbCodeLanguageLabel, cbCodeSupports, cbHighlight, cbParseLineSet };