@ebrains/components 2.0.0 → 2.1.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 (603) hide show
  1. package/dist/cjs/clone-846acfdd.js +5 -0
  2. package/dist/cjs/color-primary-palette_6.cjs.entry.js +15 -15
  3. package/dist/cjs/components-section.cjs.entry.js +2 -2
  4. package/dist/cjs/components.cjs.js +2 -2
  5. package/dist/cjs/correct-use-of-colors.cjs.entry.js +2 -2
  6. package/dist/cjs/docs-palettes.cjs.entry.js +2 -2
  7. package/dist/cjs/docs-tokens.cjs.entry.js +2 -2
  8. package/dist/cjs/edit-ff5b84d8.js +5 -0
  9. package/dist/cjs/{eds-avatar_26.cjs.entry.js → eds-accordion_33.cjs.entry.js} +3467 -157
  10. package/dist/cjs/eds-app-root.cjs.entry.js +2 -2
  11. package/dist/cjs/eds-card-desc_2.cjs.entry.js +3 -3
  12. package/dist/cjs/eds-card-generic.cjs.entry.js +1 -1
  13. package/dist/cjs/eds-card-project.cjs.entry.js +2 -2
  14. package/dist/cjs/eds-card-section.cjs.entry.js +1 -1
  15. package/dist/cjs/eds-card-tags.cjs.entry.js +2 -2
  16. package/dist/cjs/eds-card-tool.cjs.entry.js +2 -2
  17. package/dist/cjs/eds-cookies-preference.cjs.entry.js +2 -2
  18. package/dist/cjs/eds-feedback.cjs.entry.js +2 -2
  19. package/dist/cjs/eds-footer.cjs.entry.js +9 -3
  20. package/dist/cjs/eds-frame.cjs.entry.js +2 -2
  21. package/dist/cjs/eds-fullscreen-menu.cjs.entry.js +1 -1
  22. package/dist/cjs/eds-gauge.cjs.entry.js +2 -2
  23. package/dist/cjs/eds-icon-arrow-diagonal.cjs.entry.js +2 -2
  24. package/dist/cjs/eds-icon-arrow-right.cjs.entry.js +2 -2
  25. package/dist/cjs/eds-icon-bin.cjs.entry.js +2 -2
  26. package/dist/cjs/eds-icon-bluesky.cjs.entry.js +2 -2
  27. package/dist/cjs/eds-icon-bookmark.cjs.entry.js +2 -2
  28. package/dist/cjs/eds-icon-chevron-down.cjs.entry.js +2 -2
  29. package/dist/cjs/eds-icon-chevron-left.cjs.entry.js +2 -2
  30. package/dist/cjs/eds-icon-chevron-right.cjs.entry.js +2 -2
  31. package/dist/cjs/eds-icon-chevron-up.cjs.entry.js +2 -2
  32. package/dist/cjs/eds-icon-clone.cjs.entry.js +18 -0
  33. package/dist/cjs/eds-icon-close.cjs.entry.js +2 -2
  34. package/dist/cjs/eds-icon-copy.cjs.entry.js +2 -2
  35. package/dist/cjs/eds-icon-draft.cjs.entry.js +2 -2
  36. package/dist/cjs/eds-icon-edit.cjs.entry.js +3 -3
  37. package/dist/cjs/eds-icon-eu.cjs.entry.js +2 -2
  38. package/dist/cjs/eds-icon-external.cjs.entry.js +2 -2
  39. package/dist/cjs/eds-icon-facebook.cjs.entry.js +2 -2
  40. package/dist/cjs/eds-icon-gitlab.cjs.entry.js +2 -2
  41. package/dist/cjs/eds-icon-linkedin.cjs.entry.js +2 -2
  42. package/dist/cjs/eds-icon-loader.cjs.entry.js +2 -2
  43. package/dist/cjs/eds-icon-mastodon.cjs.entry.js +2 -2
  44. package/dist/cjs/eds-icon-menu.cjs.entry.js +2 -2
  45. package/dist/cjs/eds-icon-minus.cjs.entry.js +2 -2
  46. package/dist/cjs/eds-icon-more.cjs.entry.js +2 -2
  47. package/dist/cjs/eds-icon-paper.cjs.entry.js +2 -2
  48. package/dist/cjs/eds-icon-plus.cjs.entry.js +2 -2
  49. package/dist/cjs/eds-icon-portal.cjs.entry.js +2 -2
  50. package/dist/cjs/eds-icon-private.cjs.entry.js +2 -2
  51. package/dist/cjs/eds-icon-public.cjs.entry.js +2 -2
  52. package/dist/cjs/eds-icon-search.cjs.entry.js +2 -2
  53. package/dist/cjs/eds-icon-star.cjs.entry.js +2 -2
  54. package/dist/cjs/eds-icon-start.cjs.entry.js +2 -2
  55. package/dist/cjs/eds-icon-success.cjs.entry.js +2 -2
  56. package/dist/cjs/eds-icon-thumbs-down.cjs.entry.js +2 -2
  57. package/dist/cjs/eds-icon-thumbs-up.cjs.entry.js +2 -2
  58. package/dist/cjs/eds-icon-tutorial.cjs.entry.js +2 -2
  59. package/dist/cjs/eds-icon-twitter.cjs.entry.js +2 -2
  60. package/dist/cjs/eds-icon-unknown.cjs.entry.js +2 -2
  61. package/dist/cjs/eds-icon-updown.cjs.entry.js +2 -2
  62. package/dist/cjs/eds-icon-user.cjs.entry.js +2 -2
  63. package/dist/cjs/eds-icon-view.cjs.entry.js +18 -0
  64. package/dist/cjs/eds-icon-youtube.cjs.entry.js +2 -2
  65. package/dist/cjs/eds-modal.cjs.entry.js +3 -3
  66. package/dist/cjs/eds-pie.cjs.entry.js +1 -1
  67. package/dist/cjs/eds-progress-bar.cjs.entry.js +2 -2
  68. package/dist/cjs/eds-section-core_2.cjs.entry.js +4 -4
  69. package/dist/cjs/eds-social-networks.cjs.entry.js +2 -2
  70. package/dist/cjs/eds-spinner.cjs.entry.js +2 -2
  71. package/dist/cjs/eds-splash-screen.cjs.entry.js +1 -1
  72. package/dist/cjs/eds-timeline.cjs.entry.js +2 -2
  73. package/dist/cjs/eds-toast-manager.cjs.entry.js +2 -2
  74. package/dist/cjs/eds-tooltip.cjs.entry.js +2 -2
  75. package/dist/cjs/eds-trl.cjs.entry.js +2 -2
  76. package/dist/cjs/incorrect-use-of-colors.cjs.entry.js +2 -2
  77. package/dist/cjs/{index-88c8039f.js → index-0249a32e.js} +15 -28
  78. package/dist/cjs/loader.cjs.js +2 -2
  79. package/dist/cjs/logo-space.cjs.entry.js +2 -2
  80. package/dist/cjs/logo-variations-horizontal_2.cjs.entry.js +3 -3
  81. package/dist/cjs/logo-variations-tabs.cjs.entry.js +2 -2
  82. package/dist/cjs/logo-wrong-usage.cjs.entry.js +2 -2
  83. package/dist/cjs/svg-repository.cjs.entry.js +8 -4
  84. package/dist/cjs/token-list_3.cjs.entry.js +4 -4
  85. package/dist/cjs/token-ratios.cjs.entry.js +2 -2
  86. package/dist/cjs/token-spacing.cjs.entry.js +2 -2
  87. package/dist/cjs/token-typography.cjs.entry.js +2 -2
  88. package/dist/cjs/view-80d5c6c8.js +5 -0
  89. package/dist/collection/collection-manifest.json +3 -0
  90. package/dist/collection/components/eds-accordion/eds-accordion.js +1 -1
  91. package/dist/collection/components/eds-alert/eds-alert.js +30 -3
  92. package/dist/collection/components/eds-avatar/eds-avatar.js +1 -1
  93. package/dist/collection/components/eds-block-break/eds-block-break.js +1 -1
  94. package/dist/collection/components/eds-breadcrump/eds-breadcrump.js +1 -1
  95. package/dist/collection/components/eds-button/eds-button.css +4 -0
  96. package/dist/collection/components/eds-button/eds-button.js +19 -8
  97. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.js +1 -1
  98. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js +1 -1
  99. package/dist/collection/components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js +1 -1
  100. package/dist/collection/components/eds-cards/eds-card-project/eds-card-project.js +1 -1
  101. package/dist/collection/components/eds-cards/eds-card-tool/eds-card-tool.js +1 -1
  102. package/dist/collection/components/eds-charts/eds-gauge/eds-gauge.js +1 -1
  103. package/dist/collection/components/eds-code-block/eds-code-block.js +1 -1
  104. package/dist/collection/components/eds-dropdown/eds-dropdown.js +2 -2
  105. package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-down/eds-icon-chevron-down.js +1 -1
  106. package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-left/eds-icon-chevron-left.js +1 -1
  107. package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-right/eds-icon-chevron-right.js +1 -1
  108. package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-up/eds-icon-chevron-up.js +1 -1
  109. package/dist/collection/components/eds-icons/eds-icon-arrow-diagonal/eds-icon-arrow-diagonal.js +1 -1
  110. package/dist/collection/components/eds-icons/eds-icon-arrow-right/eds-icon-arrow-right.js +1 -1
  111. package/dist/collection/components/eds-icons/eds-icon-bin/eds-icon-bin.js +1 -1
  112. package/dist/collection/components/eds-icons/eds-icon-bookmark/eds-icon-bookmark.js +1 -1
  113. package/dist/collection/components/eds-icons/eds-icon-clone/eds-icon-clone.js +36 -0
  114. package/dist/collection/components/eds-icons/eds-icon-close/eds-icon-close.js +1 -1
  115. package/dist/collection/components/eds-icons/eds-icon-copy/eds-icon-copy.js +1 -1
  116. package/dist/collection/components/eds-icons/eds-icon-draft/eds-icon-draft.js +1 -1
  117. package/dist/collection/components/eds-icons/eds-icon-edit/eds-icon-edit.js +1 -1
  118. package/dist/collection/components/eds-icons/eds-icon-eu/eds-icon-eu.js +1 -1
  119. package/dist/collection/components/eds-icons/eds-icon-external/eds-icon-external.js +1 -1
  120. package/dist/collection/components/eds-icons/eds-icon-gitlab/eds-icon-gitlab.js +1 -1
  121. package/dist/collection/components/eds-icons/eds-icon-loader/eds-icon-loader.js +1 -1
  122. package/dist/collection/components/eds-icons/eds-icon-menu/eds-icon-menu.js +1 -1
  123. package/dist/collection/components/eds-icons/eds-icon-minus/eds-icon-minus.js +1 -1
  124. package/dist/collection/components/eds-icons/eds-icon-more/eds-icon-more.js +1 -1
  125. package/dist/collection/components/eds-icons/eds-icon-paper/eds-icon-paper.js +1 -1
  126. package/dist/collection/components/eds-icons/eds-icon-plus/eds-icon-plus.js +1 -1
  127. package/dist/collection/components/eds-icons/eds-icon-portal/eds-icon-portal.js +1 -1
  128. package/dist/collection/components/eds-icons/eds-icon-private/eds-icon-private.js +1 -1
  129. package/dist/collection/components/eds-icons/eds-icon-public/eds-icon-public.js +1 -1
  130. package/dist/collection/components/eds-icons/eds-icon-search/eds-icon-search.js +1 -1
  131. package/dist/collection/components/eds-icons/eds-icon-star/eds-icon-star.js +1 -1
  132. package/dist/collection/components/eds-icons/eds-icon-start/eds-icon-start.js +1 -1
  133. package/dist/collection/components/eds-icons/eds-icon-success/eds-icon-success.js +1 -1
  134. package/dist/collection/components/eds-icons/eds-icon-thumbs-down/eds-icon-thumbs-down.js +1 -1
  135. package/dist/collection/components/eds-icons/eds-icon-thumbs-up/eds-icon-thumbs-up.js +1 -1
  136. package/dist/collection/components/eds-icons/eds-icon-tutorial/eds-icon-tutorial.js +1 -1
  137. package/dist/collection/components/eds-icons/eds-icon-unknown/eds-icon-unknown.js +1 -1
  138. package/dist/collection/components/eds-icons/eds-icon-updown/eds-icon-updown.js +1 -1
  139. package/dist/collection/components/eds-icons/eds-icon-user/eds-icon-user.js +1 -1
  140. package/dist/collection/components/eds-icons/eds-icon-view/eds-icon-view.js +36 -0
  141. package/dist/collection/components/eds-icons/social/eds-icon-bluesky/eds-icon-bluesky.js +1 -1
  142. package/dist/collection/components/eds-icons/social/eds-icon-facebook/eds-icon-facebook.js +1 -1
  143. package/dist/collection/components/eds-icons/social/eds-icon-linkedin/eds-icon-linkedin.js +1 -1
  144. package/dist/collection/components/eds-icons/social/eds-icon-mastodon/eds-icon-mastodon.js +1 -1
  145. package/dist/collection/components/eds-icons/social/eds-icon-twitter/eds-icon-twitter.js +1 -1
  146. package/dist/collection/components/eds-icons/social/eds-icon-youtube/eds-icon-youtube.js +1 -1
  147. package/dist/collection/components/eds-img/eds-img.js +2 -2
  148. package/dist/collection/components/eds-input-elements/eds-input/eds-input.js +2 -2
  149. package/dist/collection/components/eds-input-elements/eds-input-footer/eds-input-footer.js +1 -1
  150. package/dist/collection/components/eds-input-elements/eds-input-label/eds-input-label.js +1 -1
  151. package/dist/collection/components/eds-input-elements/eds-input-range/eds-input-range.js +1 -1
  152. package/dist/collection/components/eds-input-elements/eds-input-search/eds-input-search.js +1 -1
  153. package/dist/collection/components/eds-input-elements/eds-input-select/eds-input-select.js +2 -2
  154. package/dist/collection/components/eds-input-field/eds-input-field.js +3 -2
  155. package/dist/collection/components/eds-link/eds-link.js +27 -7
  156. package/dist/collection/components/eds-link/eds-link.stories.js +3 -1
  157. package/dist/collection/components/eds-logo/eds-logo.js +1 -1
  158. package/dist/collection/components/eds-modal/eds-modal.js +2 -2
  159. package/dist/collection/components/eds-nps/eds-npm.stories.js +36 -0
  160. package/dist/collection/components/eds-nps/eds-nps.css +73 -0
  161. package/dist/collection/components/eds-nps/eds-nps.js +163 -0
  162. package/dist/collection/components/eds-pagination/eds-pagination.css +4 -0
  163. package/dist/collection/components/eds-pagination/eds-pagination.js +130 -50
  164. package/dist/collection/components/eds-progress-bar/eds-progress-bar.js +1 -1
  165. package/dist/collection/components/eds-rating/eds-rating.js +25 -3
  166. package/dist/collection/components/eds-section/eds-section-core/eds-section-core.js +1 -1
  167. package/dist/collection/components/eds-section/eds-section-heading/eds-section-heading.js +2 -2
  168. package/dist/collection/components/eds-spinner/eds-spinner.js +1 -1
  169. package/dist/collection/components/eds-switch/eds-switch.css +15 -5
  170. package/dist/collection/components/eds-switch/eds-switch.js +26 -4
  171. package/dist/collection/components/eds-table/eds-table.js +38 -37
  172. package/dist/collection/components/eds-table/eds-table.stories.js +1 -1
  173. package/dist/collection/components/eds-tag/eds-tag.js +1 -1
  174. package/dist/collection/components/eds-timeline/eds-timeline.js +1 -1
  175. package/dist/collection/components/eds-tooltip/eds-tooltip.js +1 -1
  176. package/dist/collection/components/eds-trl/eds-trl.js +1 -1
  177. package/dist/collection/eds-docs-ui/colors/color-palette/primary.js +1 -1
  178. package/dist/collection/eds-docs-ui/colors/color-palette/secondary.js +1 -1
  179. package/dist/collection/eds-docs-ui/colors/color-palette/support.js +1 -1
  180. package/dist/collection/eds-docs-ui/colors/gradient-palette/primary.js +1 -1
  181. package/dist/collection/eds-docs-ui/colors/gradient-palette/secondary.js +7 -7
  182. package/dist/collection/eds-docs-ui/colors/gradient-palette/support.js +3 -3
  183. package/dist/collection/eds-docs-ui/colors/use-of-colors/correct-use-of-colors.js +1 -1
  184. package/dist/collection/eds-docs-ui/colors/use-of-colors/incorrect-use-of-colors.js +1 -1
  185. package/dist/collection/eds-docs-ui/components-section/components-section.js +1 -1
  186. package/dist/collection/eds-docs-ui/design-tokens/docs-tokens/docs-tokens.js +1 -1
  187. package/dist/collection/eds-docs-ui/design-tokens/token-list/token-list.js +1 -1
  188. package/dist/collection/eds-docs-ui/design-tokens/token-radii/token-radii.js +1 -1
  189. package/dist/collection/eds-docs-ui/design-tokens/token-ratios/token-ratios.js +1 -1
  190. package/dist/collection/eds-docs-ui/design-tokens/token-shadows/token-shadows.js +1 -1
  191. package/dist/collection/eds-docs-ui/design-tokens/token-spacing/token-spacing.js +1 -1
  192. package/dist/collection/eds-docs-ui/design-tokens/token-typography/token-typography.js +1 -1
  193. package/dist/collection/eds-docs-ui/docs-palettes/docs-palettes.js +1 -1
  194. package/dist/collection/eds-docs-ui/logo/logo-space/logo-space.js +1 -1
  195. package/dist/collection/eds-docs-ui/logo/logo-variations/horizontal/logo-variations-horizontal.js +1 -1
  196. package/dist/collection/eds-docs-ui/logo/logo-variations/vertical/logo-variations-vertical.js +1 -1
  197. package/dist/collection/eds-docs-ui/logo/logo-variations-tabs/logo-variations.js +1 -1
  198. package/dist/collection/eds-docs-ui/logo/logo-wrong-usage/logo-wrong-usage.js +1 -1
  199. package/dist/collection/eds-docs-ui/svg-repository/svg-repository.js +1 -1
  200. package/dist/collection/shared-ui/eds-cookies-preference/eds-cookies-preference.js +1 -1
  201. package/dist/collection/shared-ui/eds-feedback/eds-feedback.js +1 -1
  202. package/dist/collection/shared-ui/eds-footer/eds-footer.js +8 -2
  203. package/dist/collection/shared-ui/eds-form/eds-form.js +26 -4
  204. package/dist/collection/shared-ui/eds-form/eds-form.stories.js +1 -1
  205. package/dist/collection/shared-ui/eds-frame/eds-frame.js +1 -1
  206. package/dist/collection/shared-ui/eds-header/eds-header.js +1 -1
  207. package/dist/collection/shared-ui/eds-social-networks/eds-social-networks.js +1 -1
  208. package/dist/collection/shared-ui/eds-tabs/eds-tabs.css +26 -5
  209. package/dist/collection/shared-ui/eds-tabs/eds-tabs.js +89 -31
  210. package/dist/collection/shared-ui/eds-toast-manager/eds-toast-manager.js +1 -1
  211. package/dist/collection/shared-ui/eds-user/eds-user.js +1 -1
  212. package/dist/collection/shared-ui/examples/eds-app-root/eds-app-root.js +1 -1
  213. package/dist/collection/utils/eds-form/formValidators.js +33 -0
  214. package/dist/components/clone.js +3 -0
  215. package/dist/components/components-section.js +1 -1
  216. package/dist/components/components.css +7 -9
  217. package/dist/components/components.esm.js +1 -1
  218. package/dist/components/correct-use-of-colors.js +1 -1
  219. package/dist/components/docs-palettes.js +1 -1
  220. package/dist/components/docs-tokens.js +1 -1
  221. package/dist/components/edit.js +1 -1
  222. package/dist/components/eds-accordion2.js +1 -1
  223. package/dist/components/eds-alert2.js +21 -5
  224. package/dist/components/eds-app-root.js +1 -1
  225. package/dist/components/eds-avatar2.js +1 -1
  226. package/dist/components/eds-block-break2.js +1 -1
  227. package/dist/components/eds-breadcrumb.js +1 -1
  228. package/dist/components/eds-button2.js +21 -10
  229. package/dist/components/eds-card-desc2.js +1 -1
  230. package/dist/components/eds-card-project.js +1 -1
  231. package/dist/components/eds-card-tags.js +1 -1
  232. package/dist/components/eds-card-title2.js +1 -1
  233. package/dist/components/eds-card-tool.js +1 -1
  234. package/dist/components/eds-code-block2.js +1 -1
  235. package/dist/components/eds-cookies-preference.js +1 -1
  236. package/dist/components/eds-dropdown2.js +2 -2
  237. package/dist/components/eds-feedback.js +1 -1
  238. package/dist/components/eds-footer2.js +8 -2
  239. package/dist/components/eds-form.js +80 -22
  240. package/dist/components/eds-frame.js +1 -1
  241. package/dist/components/eds-gauge.js +1 -1
  242. package/dist/components/eds-header.js +1 -1
  243. package/dist/components/eds-icon-arrow-diagonal.js +1 -1
  244. package/dist/components/eds-icon-arrow-right.js +1 -1
  245. package/dist/components/eds-icon-bin.js +1 -1
  246. package/dist/components/eds-icon-bluesky.js +1 -1
  247. package/dist/components/eds-icon-bookmark.js +1 -1
  248. package/dist/components/eds-icon-chevron-down.js +1 -1
  249. package/dist/components/eds-icon-chevron-left.js +1 -1
  250. package/dist/components/eds-icon-chevron-right.js +1 -1
  251. package/dist/components/eds-icon-chevron-up.js +1 -1
  252. package/dist/components/eds-icon-clone.d.ts +11 -0
  253. package/dist/components/eds-icon-clone.js +33 -0
  254. package/dist/components/eds-icon-close.js +1 -1
  255. package/dist/components/eds-icon-copy.js +1 -1
  256. package/dist/components/eds-icon-draft.js +1 -1
  257. package/dist/components/eds-icon-edit.js +1 -1
  258. package/dist/components/eds-icon-eu.js +1 -1
  259. package/dist/components/eds-icon-external.js +1 -1
  260. package/dist/components/eds-icon-facebook.js +1 -1
  261. package/dist/components/eds-icon-gitlab.js +1 -1
  262. package/dist/components/eds-icon-linkedin.js +1 -1
  263. package/dist/components/eds-icon-loader.js +1 -1
  264. package/dist/components/eds-icon-mastodon.js +1 -1
  265. package/dist/components/eds-icon-menu.js +1 -1
  266. package/dist/components/eds-icon-minus.js +1 -1
  267. package/dist/components/eds-icon-more.js +1 -1
  268. package/dist/components/eds-icon-paper.js +1 -1
  269. package/dist/components/eds-icon-plus.js +1 -1
  270. package/dist/components/eds-icon-portal.js +1 -1
  271. package/dist/components/eds-icon-private.js +1 -1
  272. package/dist/components/eds-icon-public.js +1 -1
  273. package/dist/components/eds-icon-search.js +1 -1
  274. package/dist/components/eds-icon-star.js +1 -1
  275. package/dist/components/eds-icon-start.js +1 -1
  276. package/dist/components/eds-icon-success.js +1 -1
  277. package/dist/components/eds-icon-thumbs-down.js +1 -1
  278. package/dist/components/eds-icon-thumbs-up.js +1 -1
  279. package/dist/components/eds-icon-tutorial.js +1 -1
  280. package/dist/components/eds-icon-twitter.js +1 -1
  281. package/dist/components/eds-icon-unknown.js +1 -1
  282. package/dist/components/eds-icon-updown.js +1 -1
  283. package/dist/components/eds-icon-user.js +1 -1
  284. package/dist/components/eds-icon-view.d.ts +11 -0
  285. package/dist/components/eds-icon-view.js +33 -0
  286. package/dist/components/eds-icon-youtube.js +1 -1
  287. package/dist/components/eds-img2.js +2 -2
  288. package/dist/components/eds-input-field2.js +4 -3
  289. package/dist/components/eds-input-footer2.js +1 -1
  290. package/dist/components/eds-input-label2.js +1 -1
  291. package/dist/components/eds-input-range2.js +1 -1
  292. package/dist/components/eds-input-search2.js +1 -1
  293. package/dist/components/eds-input-select2.js +2 -2
  294. package/dist/components/eds-input2.js +2 -2
  295. package/dist/components/eds-link2.js +27 -7
  296. package/dist/components/eds-logo2.js +1 -1
  297. package/dist/components/eds-modal.js +2 -2
  298. package/dist/components/eds-nps.d.ts +11 -0
  299. package/dist/components/eds-nps.js +6 -0
  300. package/dist/components/eds-nps2.js +120 -0
  301. package/dist/components/eds-pagination2.js +119 -52
  302. package/dist/components/eds-progress-bar2.js +1 -1
  303. package/dist/components/eds-rating2.js +25 -3
  304. package/dist/components/eds-section-core2.js +1 -1
  305. package/dist/components/eds-section-heading2.js +2 -2
  306. package/dist/components/eds-social-networks2.js +1 -1
  307. package/dist/components/eds-spinner2.js +1 -1
  308. package/dist/components/eds-switch.js +27 -5
  309. package/dist/components/eds-table2.js +45 -20
  310. package/dist/components/eds-tabs.js +90 -32
  311. package/dist/components/eds-tag2.js +1 -1
  312. package/dist/components/eds-timeline.js +1 -1
  313. package/dist/components/eds-toast-manager.js +1 -1
  314. package/dist/components/eds-tooltip.js +1 -1
  315. package/dist/components/eds-trl.js +8 -2
  316. package/dist/components/eds-user.js +3 -9
  317. package/dist/components/incorrect-use-of-colors.js +9 -3
  318. package/dist/components/logo-space.js +8 -2
  319. package/dist/components/logo-variations-horizontal2.js +1 -1
  320. package/dist/components/logo-variations-tabs.js +1 -1
  321. package/dist/components/logo-variations-vertical2.js +1 -1
  322. package/dist/components/logo-wrong-usage.js +1 -1
  323. package/dist/components/p-05654483.entry.js +1 -0
  324. package/dist/components/{p-9e53eca3.entry.js → p-09079c5c.entry.js} +1 -1
  325. package/dist/components/p-10997947.entry.js +1 -0
  326. package/dist/components/p-19e69c03.entry.js +1 -0
  327. package/dist/components/p-1ab1ea29.entry.js +1 -0
  328. package/dist/components/p-1bcf743d.entry.js +1 -0
  329. package/dist/components/{p-9d18d7b1.entry.js → p-1d18106d.entry.js} +1 -1
  330. package/dist/components/{p-adbd0d7b.entry.js → p-265150a1.entry.js} +1 -1
  331. package/dist/components/p-27c4a06e.js +1 -0
  332. package/dist/components/{p-e35e156d.entry.js → p-2e0c3fc4.entry.js} +1 -1
  333. package/dist/components/{p-6d3b5818.entry.js → p-2ef4dd11.entry.js} +1 -1
  334. package/dist/components/p-3360e1e2.entry.js +1 -0
  335. package/dist/components/{p-93e6ba0f.entry.js → p-38bc21e9.entry.js} +1 -1
  336. package/dist/components/p-3b29e0fd.entry.js +1 -0
  337. package/dist/components/p-42457a0f.entry.js +1 -0
  338. package/dist/components/p-4a6a72db.entry.js +1 -0
  339. package/dist/components/p-4b33909d.entry.js +1 -0
  340. package/dist/components/p-4bf4bc93.entry.js +1 -0
  341. package/dist/components/{p-773a119a.entry.js → p-4c84fcf4.entry.js} +1 -1
  342. package/dist/components/p-4eb2cf7f.js +1 -0
  343. package/dist/components/p-5367bb59.entry.js +1 -0
  344. package/dist/components/p-547a53d6.entry.js +1 -0
  345. package/dist/components/p-560fc3a4.entry.js +1 -0
  346. package/dist/components/p-5a58f1c1.entry.js +1 -0
  347. package/dist/components/p-5b55f951.entry.js +1 -0
  348. package/dist/components/p-5ba49cf2.entry.js +1 -0
  349. package/dist/components/p-5dd85979.entry.js +1 -0
  350. package/dist/components/{p-356846cd.entry.js → p-5f348b0e.entry.js} +1 -1
  351. package/dist/components/p-634b6ca2.entry.js +1 -0
  352. package/dist/components/{p-b073d78f.entry.js → p-64b7a6fc.entry.js} +1 -1
  353. package/dist/components/{p-02d94d2d.entry.js → p-6614881d.entry.js} +1 -1
  354. package/dist/components/{p-2839899a.entry.js → p-67ec46b4.entry.js} +1 -1
  355. package/dist/components/p-6b988c76.entry.js +1 -0
  356. package/dist/components/p-6cd6ff0c.entry.js +1 -0
  357. package/dist/components/{p-f6ca2aa6.entry.js → p-706a106c.entry.js} +1 -1
  358. package/dist/components/p-71ee4af2.entry.js +1 -0
  359. package/dist/components/{p-794f11e7.entry.js → p-743f9f8f.entry.js} +1 -1
  360. package/dist/components/p-789f54cb.entry.js +1 -0
  361. package/dist/components/{p-8c0b0121.entry.js → p-79afd8aa.entry.js} +1 -1
  362. package/dist/components/{p-b3a40663.entry.js → p-7a3f2576.entry.js} +1 -1
  363. package/dist/components/p-7a5623b5.entry.js +1 -0
  364. package/dist/components/p-7ca6db64.entry.js +1 -0
  365. package/dist/components/p-7fa46b01.entry.js +1 -0
  366. package/dist/components/{p-3e183368.entry.js → p-8627afc0.entry.js} +1 -1
  367. package/dist/components/p-86eff0cb.entry.js +1 -0
  368. package/dist/components/p-89048f87.entry.js +1 -0
  369. package/dist/components/p-8cf98230.entry.js +1 -0
  370. package/dist/components/{p-8dee879d.entry.js → p-8d363a3c.entry.js} +1 -1
  371. package/dist/components/p-9261d27c.entry.js +1 -0
  372. package/dist/components/p-97323c46.entry.js +1 -0
  373. package/dist/components/p-9b90296c.entry.js +1 -0
  374. package/dist/components/{p-1f5c19b9.entry.js → p-9c1c5e8d.entry.js} +1 -1
  375. package/dist/components/p-9cb14b1f.entry.js +1 -0
  376. package/dist/components/p-9f0a34b4.entry.js +1 -0
  377. package/dist/components/p-a8ca8346.entry.js +1 -0
  378. package/dist/components/{p-43468b0f.entry.js → p-ab3b0a53.entry.js} +1 -1
  379. package/dist/components/p-b0d38b78.entry.js +1 -0
  380. package/dist/components/{p-66f4cdd9.entry.js → p-b31babda.entry.js} +1 -1
  381. package/dist/components/p-b6ee4250.entry.js +1 -0
  382. package/dist/components/{p-0687532c.entry.js → p-b88a2267.entry.js} +1 -1
  383. package/dist/components/{p-024789cc.entry.js → p-b9a1aba3.entry.js} +1 -1
  384. package/dist/components/p-b9fdcb1b.entry.js +1 -0
  385. package/dist/components/{p-73c74835.entry.js → p-ba9f41de.entry.js} +1 -1
  386. package/dist/components/p-beacaa4f.entry.js +1 -0
  387. package/dist/components/p-bfa23535.entry.js +1 -0
  388. package/dist/components/p-c4ac0528.entry.js +1 -0
  389. package/dist/components/p-cb114bf4.entry.js +1 -0
  390. package/dist/components/p-cd05a97b.entry.js +1 -0
  391. package/dist/components/{p-3a331c68.entry.js → p-cd787744.entry.js} +1 -1
  392. package/dist/components/p-cdc1c8e8.entry.js +1 -0
  393. package/dist/components/{p-4e473b4e.entry.js → p-d1927da7.entry.js} +1 -1
  394. package/dist/components/{p-564431ad.entry.js → p-d1d1943b.entry.js} +1 -1
  395. package/dist/components/{p-543f2347.entry.js → p-d2e485a1.entry.js} +1 -1
  396. package/dist/components/{p-e2e7250a.entry.js → p-d95d7353.entry.js} +1 -1
  397. package/dist/components/{p-76905315.entry.js → p-e0ada7e0.entry.js} +1 -1
  398. package/dist/components/{p-70e8e66f.entry.js → p-e210ddbb.entry.js} +1 -1
  399. package/dist/components/p-e5892379.entry.js +1 -0
  400. package/dist/components/p-e8374410.entry.js +1 -0
  401. package/dist/components/p-e90da4ba.entry.js +1 -0
  402. package/dist/components/p-ec706eed.entry.js +1 -0
  403. package/dist/components/{p-28ae3f3a.js → p-efbc374c.js} +2 -2
  404. package/dist/components/p-f2abe4d8.js +1 -0
  405. package/dist/components/p-f32963ff.entry.js +9 -0
  406. package/dist/components/p-f40dd50d.entry.js +1 -0
  407. package/dist/components/p-f6012c17.entry.js +1 -0
  408. package/dist/components/p-fcba31fa.entry.js +1 -0
  409. package/dist/components/primary.js +1 -1
  410. package/dist/components/primary2.js +1 -1
  411. package/dist/components/secondary.js +1 -1
  412. package/dist/components/secondary2.js +7 -7
  413. package/dist/components/support.js +1 -1
  414. package/dist/components/support2.js +3 -3
  415. package/dist/components/svg-repository.js +13 -3
  416. package/dist/components/token-list2.js +1 -1
  417. package/dist/components/token-radii2.js +1 -1
  418. package/dist/components/token-ratios.js +1 -1
  419. package/dist/components/token-shadows2.js +1 -1
  420. package/dist/components/token-spacing.js +1 -1
  421. package/dist/components/token-typography.js +1 -1
  422. package/dist/components/view.js +3 -0
  423. package/dist/esm/clone-dab56639.js +3 -0
  424. package/dist/esm/color-primary-palette_6.entry.js +15 -15
  425. package/dist/esm/components-section.entry.js +2 -2
  426. package/dist/esm/components.js +3 -3
  427. package/dist/esm/correct-use-of-colors.entry.js +2 -2
  428. package/dist/esm/docs-palettes.entry.js +2 -2
  429. package/dist/esm/docs-tokens.entry.js +2 -2
  430. package/dist/esm/edit-3893a517.js +3 -0
  431. package/dist/esm/{eds-avatar_26.entry.js → eds-accordion_33.entry.js} +3462 -159
  432. package/dist/esm/eds-app-root.entry.js +2 -2
  433. package/dist/esm/eds-card-desc_2.entry.js +3 -3
  434. package/dist/esm/eds-card-generic.entry.js +1 -1
  435. package/dist/esm/eds-card-project.entry.js +2 -2
  436. package/dist/esm/eds-card-section.entry.js +1 -1
  437. package/dist/esm/eds-card-tags.entry.js +2 -2
  438. package/dist/esm/eds-card-tool.entry.js +2 -2
  439. package/dist/esm/eds-cookies-preference.entry.js +2 -2
  440. package/dist/esm/eds-feedback.entry.js +2 -2
  441. package/dist/esm/eds-footer.entry.js +9 -3
  442. package/dist/esm/eds-frame.entry.js +2 -2
  443. package/dist/esm/eds-fullscreen-menu.entry.js +1 -1
  444. package/dist/esm/eds-gauge.entry.js +2 -2
  445. package/dist/esm/eds-icon-arrow-diagonal.entry.js +2 -2
  446. package/dist/esm/eds-icon-arrow-right.entry.js +2 -2
  447. package/dist/esm/eds-icon-bin.entry.js +2 -2
  448. package/dist/esm/eds-icon-bluesky.entry.js +2 -2
  449. package/dist/esm/eds-icon-bookmark.entry.js +2 -2
  450. package/dist/esm/eds-icon-chevron-down.entry.js +2 -2
  451. package/dist/esm/eds-icon-chevron-left.entry.js +2 -2
  452. package/dist/esm/eds-icon-chevron-right.entry.js +2 -2
  453. package/dist/esm/eds-icon-chevron-up.entry.js +2 -2
  454. package/dist/esm/eds-icon-clone.entry.js +14 -0
  455. package/dist/esm/eds-icon-close.entry.js +2 -2
  456. package/dist/esm/eds-icon-copy.entry.js +2 -2
  457. package/dist/esm/eds-icon-draft.entry.js +2 -2
  458. package/dist/esm/eds-icon-edit.entry.js +3 -3
  459. package/dist/esm/eds-icon-eu.entry.js +2 -2
  460. package/dist/esm/eds-icon-external.entry.js +2 -2
  461. package/dist/esm/eds-icon-facebook.entry.js +2 -2
  462. package/dist/esm/eds-icon-gitlab.entry.js +2 -2
  463. package/dist/esm/eds-icon-linkedin.entry.js +2 -2
  464. package/dist/esm/eds-icon-loader.entry.js +2 -2
  465. package/dist/esm/eds-icon-mastodon.entry.js +2 -2
  466. package/dist/esm/eds-icon-menu.entry.js +2 -2
  467. package/dist/esm/eds-icon-minus.entry.js +2 -2
  468. package/dist/esm/eds-icon-more.entry.js +2 -2
  469. package/dist/esm/eds-icon-paper.entry.js +2 -2
  470. package/dist/esm/eds-icon-plus.entry.js +2 -2
  471. package/dist/esm/eds-icon-portal.entry.js +2 -2
  472. package/dist/esm/eds-icon-private.entry.js +2 -2
  473. package/dist/esm/eds-icon-public.entry.js +2 -2
  474. package/dist/esm/eds-icon-search.entry.js +2 -2
  475. package/dist/esm/eds-icon-star.entry.js +2 -2
  476. package/dist/esm/eds-icon-start.entry.js +2 -2
  477. package/dist/esm/eds-icon-success.entry.js +2 -2
  478. package/dist/esm/eds-icon-thumbs-down.entry.js +2 -2
  479. package/dist/esm/eds-icon-thumbs-up.entry.js +2 -2
  480. package/dist/esm/eds-icon-tutorial.entry.js +2 -2
  481. package/dist/esm/eds-icon-twitter.entry.js +2 -2
  482. package/dist/esm/eds-icon-unknown.entry.js +2 -2
  483. package/dist/esm/eds-icon-updown.entry.js +2 -2
  484. package/dist/esm/eds-icon-user.entry.js +2 -2
  485. package/dist/esm/eds-icon-view.entry.js +14 -0
  486. package/dist/esm/eds-icon-youtube.entry.js +2 -2
  487. package/dist/esm/eds-modal.entry.js +3 -3
  488. package/dist/esm/eds-pie.entry.js +1 -1
  489. package/dist/esm/eds-progress-bar.entry.js +2 -2
  490. package/dist/esm/eds-section-core_2.entry.js +4 -4
  491. package/dist/esm/eds-social-networks.entry.js +2 -2
  492. package/dist/esm/eds-spinner.entry.js +2 -2
  493. package/dist/esm/eds-splash-screen.entry.js +1 -1
  494. package/dist/esm/eds-timeline.entry.js +2 -2
  495. package/dist/esm/eds-toast-manager.entry.js +2 -2
  496. package/dist/esm/eds-tooltip.entry.js +2 -2
  497. package/dist/esm/eds-trl.entry.js +2 -2
  498. package/dist/esm/incorrect-use-of-colors.entry.js +2 -2
  499. package/dist/esm/{index-fdb33359.js → index-e84b871c.js} +15 -28
  500. package/dist/esm/loader.js +3 -3
  501. package/dist/esm/logo-space.entry.js +2 -2
  502. package/dist/esm/logo-variations-horizontal_2.entry.js +3 -3
  503. package/dist/esm/logo-variations-tabs.entry.js +2 -2
  504. package/dist/esm/logo-wrong-usage.entry.js +2 -2
  505. package/dist/esm/svg-repository.entry.js +8 -4
  506. package/dist/esm/token-list_3.entry.js +4 -4
  507. package/dist/esm/token-ratios.entry.js +2 -2
  508. package/dist/esm/token-spacing.entry.js +2 -2
  509. package/dist/esm/token-typography.entry.js +2 -2
  510. package/dist/esm/view-e900f2d4.js +3 -0
  511. package/dist/hydrate/index.js +690 -257
  512. package/dist/hydrate/index.mjs +690 -257
  513. package/dist/types/Users/nigeor/Documents/Projects/EBRAINS/ebrains-ui-ecosystem/packages/components/.stencil/packages/svgs/src/lib/svgs.d.ts +3 -1
  514. package/dist/types/components/eds-alert/eds-alert.d.ts +6 -0
  515. package/dist/types/components/eds-button/eds-button.d.ts +1 -0
  516. package/dist/types/components/eds-icons/eds-icon-clone/eds-icon-clone.d.ts +10 -0
  517. package/dist/types/components/eds-icons/eds-icon-view/eds-icon-view.d.ts +10 -0
  518. package/dist/types/components/eds-link/eds-link.d.ts +1 -0
  519. package/dist/types/components/eds-nps/eds-npm.stories.d.ts +28 -0
  520. package/dist/types/components/eds-nps/eds-nps.d.ts +20 -0
  521. package/dist/types/components/eds-pagination/eds-pagination.d.ts +23 -2
  522. package/dist/types/components/eds-rating/eds-rating.d.ts +3 -1
  523. package/dist/types/components/eds-switch/eds-switch.d.ts +1 -0
  524. package/dist/types/components/eds-table/eds-table.d.ts +3 -4
  525. package/dist/types/components/eds-table/eds-table.stories.d.ts +7 -2
  526. package/dist/types/components.d.ts +133 -12
  527. package/dist/types/shared-ui/eds-form/eds-form.d.ts +1 -0
  528. package/dist/types/shared-ui/eds-tabs/eds-tabs.d.ts +7 -9
  529. package/dist/types/utils/eds-form/formValidators.d.ts +1 -0
  530. package/package.json +1 -1
  531. package/dist/cjs/edit-5714c144.js +0 -5
  532. package/dist/cjs/eds-accordion.cjs.entry.js +0 -87
  533. package/dist/cjs/eds-alert.cjs.entry.js +0 -104
  534. package/dist/cjs/eds-breadcrumb.cjs.entry.js +0 -145
  535. package/dist/cjs/eds-code-block.cjs.entry.js +0 -2489
  536. package/dist/cjs/eds-matomo-notice.cjs.entry.js +0 -125
  537. package/dist/cjs/eds-switch.cjs.entry.js +0 -46
  538. package/dist/components/p-023bc47c.entry.js +0 -1
  539. package/dist/components/p-02df910c.entry.js +0 -1
  540. package/dist/components/p-0be79e08.entry.js +0 -1
  541. package/dist/components/p-0e74d8b4.entry.js +0 -1
  542. package/dist/components/p-11efb1d1.entry.js +0 -1
  543. package/dist/components/p-1791ce82.entry.js +0 -1
  544. package/dist/components/p-19d586e6.entry.js +0 -1
  545. package/dist/components/p-2679926c.entry.js +0 -1
  546. package/dist/components/p-2d1a7471.entry.js +0 -1
  547. package/dist/components/p-2ff16a39.entry.js +0 -1
  548. package/dist/components/p-32e18e48.entry.js +0 -1
  549. package/dist/components/p-38e99d4b.entry.js +0 -1
  550. package/dist/components/p-4088ae0e.entry.js +0 -1
  551. package/dist/components/p-4277fb1a.entry.js +0 -1
  552. package/dist/components/p-42a73db4.entry.js +0 -1
  553. package/dist/components/p-44055e68.entry.js +0 -1
  554. package/dist/components/p-4a5d0dcd.entry.js +0 -1
  555. package/dist/components/p-4a7412ec.entry.js +0 -1
  556. package/dist/components/p-4b88d84c.entry.js +0 -1
  557. package/dist/components/p-50f43dfd.entry.js +0 -1
  558. package/dist/components/p-562afa88.entry.js +0 -1
  559. package/dist/components/p-5aa4065a.entry.js +0 -1
  560. package/dist/components/p-5ae1c931.entry.js +0 -1
  561. package/dist/components/p-634258e6.entry.js +0 -1
  562. package/dist/components/p-68f45098.entry.js +0 -1
  563. package/dist/components/p-73a44c48.entry.js +0 -1
  564. package/dist/components/p-7dbe791f.entry.js +0 -1
  565. package/dist/components/p-7ec52188.entry.js +0 -1
  566. package/dist/components/p-7fc84bb2.js +0 -1
  567. package/dist/components/p-82559816.entry.js +0 -1
  568. package/dist/components/p-85683b18.entry.js +0 -1
  569. package/dist/components/p-8681e5d8.entry.js +0 -1
  570. package/dist/components/p-877d13d9.entry.js +0 -1
  571. package/dist/components/p-911b1c0b.entry.js +0 -1
  572. package/dist/components/p-960aa103.entry.js +0 -1
  573. package/dist/components/p-996005b7.entry.js +0 -1
  574. package/dist/components/p-aa5e75b4.entry.js +0 -1
  575. package/dist/components/p-ae9393b6.entry.js +0 -1
  576. package/dist/components/p-af137162.entry.js +0 -1
  577. package/dist/components/p-b630e51a.entry.js +0 -1
  578. package/dist/components/p-bb9af709.entry.js +0 -1
  579. package/dist/components/p-c2dc3692.entry.js +0 -1
  580. package/dist/components/p-c91b4eec.entry.js +0 -1
  581. package/dist/components/p-caff3355.entry.js +0 -1
  582. package/dist/components/p-ce66ea37.entry.js +0 -1
  583. package/dist/components/p-d4f239d7.entry.js +0 -1
  584. package/dist/components/p-d7251d4d.entry.js +0 -1
  585. package/dist/components/p-deb9bbed.entry.js +0 -1
  586. package/dist/components/p-ed4d9bf5.entry.js +0 -1
  587. package/dist/components/p-ed7696a2.entry.js +0 -1
  588. package/dist/components/p-f2416727.entry.js +0 -1
  589. package/dist/components/p-f28b5da7.entry.js +0 -1
  590. package/dist/components/p-f3839914.entry.js +0 -1
  591. package/dist/components/p-f42b6251.entry.js +0 -1
  592. package/dist/components/p-f7a31196.entry.js +0 -1
  593. package/dist/components/p-f973c83b.entry.js +0 -1
  594. package/dist/components/p-fe167c78.entry.js +0 -9
  595. package/dist/esm/edit-1dc8d11b.js +0 -3
  596. package/dist/esm/eds-accordion.entry.js +0 -83
  597. package/dist/esm/eds-alert.entry.js +0 -100
  598. package/dist/esm/eds-breadcrumb.entry.js +0 -141
  599. package/dist/esm/eds-code-block.entry.js +0 -2485
  600. package/dist/esm/eds-matomo-notice.entry.js +0 -121
  601. package/dist/esm/eds-switch.entry.js +0 -42
  602. /package/dist/collection/shared-ui/eds-toast-manager/{eds-toast-manager.stories.js → eds-toast-manager.st.js} +0 -0
  603. /package/dist/types/shared-ui/eds-toast-manager/{eds-toast-manager.stories.d.ts → eds-toast-manager.st.d.ts} +0 -0
@@ -1,2489 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-88c8039f.js');
6
-
7
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
-
9
- var prism = {exports: {}};
10
-
11
- (function (module) {
12
- /* **********************************************
13
- Begin prism-core.js
14
- ********************************************** */
15
-
16
- /// <reference lib="WebWorker"/>
17
-
18
- var _self = (typeof window !== 'undefined')
19
- ? window // if in browser
20
- : (
21
- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
22
- ? self // if in worker
23
- : {} // if in node js
24
- );
25
-
26
- /**
27
- * Prism: Lightweight, robust, elegant syntax highlighting
28
- *
29
- * @license MIT <https://opensource.org/licenses/MIT>
30
- * @author Lea Verou <https://lea.verou.me>
31
- * @namespace
32
- * @public
33
- */
34
- var Prism = (function (_self) {
35
-
36
- // Private helper vars
37
- var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
38
- var uniqueId = 0;
39
-
40
- // The grammar object for plaintext
41
- var plainTextGrammar = {};
42
-
43
-
44
- var _ = {
45
- /**
46
- * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
47
- * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
48
- * additional languages or plugins yourself.
49
- *
50
- * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
51
- *
52
- * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
53
- * empty Prism object into the global scope before loading the Prism script like this:
54
- *
55
- * ```js
56
- * window.Prism = window.Prism || {};
57
- * Prism.manual = true;
58
- * // add a new <script> to load Prism's script
59
- * ```
60
- *
61
- * @default false
62
- * @type {boolean}
63
- * @memberof Prism
64
- * @public
65
- */
66
- manual: _self.Prism && _self.Prism.manual,
67
- /**
68
- * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
69
- * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
70
- * own worker, you don't want it to do this.
71
- *
72
- * By setting this value to `true`, Prism will not add its own listeners to the worker.
73
- *
74
- * You obviously have to change this value before Prism executes. To do this, you can add an
75
- * empty Prism object into the global scope before loading the Prism script like this:
76
- *
77
- * ```js
78
- * window.Prism = window.Prism || {};
79
- * Prism.disableWorkerMessageHandler = true;
80
- * // Load Prism's script
81
- * ```
82
- *
83
- * @default false
84
- * @type {boolean}
85
- * @memberof Prism
86
- * @public
87
- */
88
- disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
89
-
90
- /**
91
- * A namespace for utility methods.
92
- *
93
- * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
94
- * change or disappear at any time.
95
- *
96
- * @namespace
97
- * @memberof Prism
98
- */
99
- util: {
100
- encode: function encode(tokens) {
101
- if (tokens instanceof Token) {
102
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
103
- } else if (Array.isArray(tokens)) {
104
- return tokens.map(encode);
105
- } else {
106
- return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
107
- }
108
- },
109
-
110
- /**
111
- * Returns the name of the type of the given value.
112
- *
113
- * @param {any} o
114
- * @returns {string}
115
- * @example
116
- * type(null) === 'Null'
117
- * type(undefined) === 'Undefined'
118
- * type(123) === 'Number'
119
- * type('foo') === 'String'
120
- * type(true) === 'Boolean'
121
- * type([1, 2]) === 'Array'
122
- * type({}) === 'Object'
123
- * type(String) === 'Function'
124
- * type(/abc+/) === 'RegExp'
125
- */
126
- type: function (o) {
127
- return Object.prototype.toString.call(o).slice(8, -1);
128
- },
129
-
130
- /**
131
- * Returns a unique number for the given object. Later calls will still return the same number.
132
- *
133
- * @param {Object} obj
134
- * @returns {number}
135
- */
136
- objId: function (obj) {
137
- if (!obj['__id']) {
138
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
139
- }
140
- return obj['__id'];
141
- },
142
-
143
- /**
144
- * Creates a deep clone of the given object.
145
- *
146
- * The main intended use of this function is to clone language definitions.
147
- *
148
- * @param {T} o
149
- * @param {Record<number, any>} [visited]
150
- * @returns {T}
151
- * @template T
152
- */
153
- clone: function deepClone(o, visited) {
154
- visited = visited || {};
155
-
156
- var clone; var id;
157
- switch (_.util.type(o)) {
158
- case 'Object':
159
- id = _.util.objId(o);
160
- if (visited[id]) {
161
- return visited[id];
162
- }
163
- clone = /** @type {Record<string, any>} */ ({});
164
- visited[id] = clone;
165
-
166
- for (var key in o) {
167
- if (o.hasOwnProperty(key)) {
168
- clone[key] = deepClone(o[key], visited);
169
- }
170
- }
171
-
172
- return /** @type {any} */ (clone);
173
-
174
- case 'Array':
175
- id = _.util.objId(o);
176
- if (visited[id]) {
177
- return visited[id];
178
- }
179
- clone = [];
180
- visited[id] = clone;
181
-
182
- (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
183
- clone[i] = deepClone(v, visited);
184
- });
185
-
186
- return /** @type {any} */ (clone);
187
-
188
- default:
189
- return o;
190
- }
191
- },
192
-
193
- /**
194
- * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
195
- *
196
- * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
197
- *
198
- * @param {Element} element
199
- * @returns {string}
200
- */
201
- getLanguage: function (element) {
202
- while (element) {
203
- var m = lang.exec(element.className);
204
- if (m) {
205
- return m[1].toLowerCase();
206
- }
207
- element = element.parentElement;
208
- }
209
- return 'none';
210
- },
211
-
212
- /**
213
- * Sets the Prism `language-xxxx` class of the given element.
214
- *
215
- * @param {Element} element
216
- * @param {string} language
217
- * @returns {void}
218
- */
219
- setLanguage: function (element, language) {
220
- // remove all `language-xxxx` classes
221
- // (this might leave behind a leading space)
222
- element.className = element.className.replace(RegExp(lang, 'gi'), '');
223
-
224
- // add the new `language-xxxx` class
225
- // (using `classList` will automatically clean up spaces for us)
226
- element.classList.add('language-' + language);
227
- },
228
-
229
- /**
230
- * Returns the script element that is currently executing.
231
- *
232
- * This does __not__ work for line script element.
233
- *
234
- * @returns {HTMLScriptElement | null}
235
- */
236
- currentScript: function () {
237
- if (typeof document === 'undefined') {
238
- return null;
239
- }
240
- if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
241
- return /** @type {any} */ (document.currentScript);
242
- }
243
-
244
- // IE11 workaround
245
- // we'll get the src of the current script by parsing IE11's error stack trace
246
- // this will not work for inline scripts
247
-
248
- try {
249
- throw new Error();
250
- } catch (err) {
251
- // Get file src url from stack. Specifically works with the format of stack traces in IE.
252
- // A stack will look like this:
253
- //
254
- // Error
255
- // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
256
- // at Global code (http://localhost/components/prism-core.js:606:1)
257
-
258
- var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
259
- if (src) {
260
- var scripts = document.getElementsByTagName('script');
261
- for (var i in scripts) {
262
- if (scripts[i].src == src) {
263
- return scripts[i];
264
- }
265
- }
266
- }
267
- return null;
268
- }
269
- },
270
-
271
- /**
272
- * Returns whether a given class is active for `element`.
273
- *
274
- * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
275
- * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
276
- * given class is just the given class with a `no-` prefix.
277
- *
278
- * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
279
- * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
280
- * ancestors have the given class or the negated version of it, then the default activation will be returned.
281
- *
282
- * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
283
- * version of it, the class is considered active.
284
- *
285
- * @param {Element} element
286
- * @param {string} className
287
- * @param {boolean} [defaultActivation=false]
288
- * @returns {boolean}
289
- */
290
- isActive: function (element, className, defaultActivation) {
291
- var no = 'no-' + className;
292
-
293
- while (element) {
294
- var classList = element.classList;
295
- if (classList.contains(className)) {
296
- return true;
297
- }
298
- if (classList.contains(no)) {
299
- return false;
300
- }
301
- element = element.parentElement;
302
- }
303
- return !!defaultActivation;
304
- }
305
- },
306
-
307
- /**
308
- * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
309
- *
310
- * @namespace
311
- * @memberof Prism
312
- * @public
313
- */
314
- languages: {
315
- /**
316
- * The grammar for plain, unformatted text.
317
- */
318
- plain: plainTextGrammar,
319
- plaintext: plainTextGrammar,
320
- text: plainTextGrammar,
321
- txt: plainTextGrammar,
322
-
323
- /**
324
- * Creates a deep copy of the language with the given id and appends the given tokens.
325
- *
326
- * If a token in `redef` also appears in the copied language, then the existing token in the copied language
327
- * will be overwritten at its original position.
328
- *
329
- * ## Best practices
330
- *
331
- * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
332
- * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
333
- * understand the language definition because, normally, the order of tokens matters in Prism grammars.
334
- *
335
- * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
336
- * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
337
- *
338
- * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
339
- * @param {Grammar} redef The new tokens to append.
340
- * @returns {Grammar} The new language created.
341
- * @public
342
- * @example
343
- * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
344
- * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
345
- * // at its original position
346
- * 'comment': { ... },
347
- * // CSS doesn't have a 'color' token, so this token will be appended
348
- * 'color': /\b(?:red|green|blue)\b/
349
- * });
350
- */
351
- extend: function (id, redef) {
352
- var lang = _.util.clone(_.languages[id]);
353
-
354
- for (var key in redef) {
355
- lang[key] = redef[key];
356
- }
357
-
358
- return lang;
359
- },
360
-
361
- /**
362
- * Inserts tokens _before_ another token in a language definition or any other grammar.
363
- *
364
- * ## Usage
365
- *
366
- * This helper method makes it easy to modify existing languages. For example, the CSS language definition
367
- * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
368
- * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
369
- * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
370
- * this:
371
- *
372
- * ```js
373
- * Prism.languages.markup.style = {
374
- * // token
375
- * };
376
- * ```
377
- *
378
- * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
379
- * before existing tokens. For the CSS example above, you would use it like this:
380
- *
381
- * ```js
382
- * Prism.languages.insertBefore('markup', 'cdata', {
383
- * 'style': {
384
- * // token
385
- * }
386
- * });
387
- * ```
388
- *
389
- * ## Special cases
390
- *
391
- * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
392
- * will be ignored.
393
- *
394
- * This behavior can be used to insert tokens after `before`:
395
- *
396
- * ```js
397
- * Prism.languages.insertBefore('markup', 'comment', {
398
- * 'comment': Prism.languages.markup.comment,
399
- * // tokens after 'comment'
400
- * });
401
- * ```
402
- *
403
- * ## Limitations
404
- *
405
- * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
406
- * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
407
- * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
408
- * deleting properties which is necessary to insert at arbitrary positions.
409
- *
410
- * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
411
- * Instead, it will create a new object and replace all references to the target object with the new one. This
412
- * can be done without temporarily deleting properties, so the iteration order is well-defined.
413
- *
414
- * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
415
- * you hold the target object in a variable, then the value of the variable will not change.
416
- *
417
- * ```js
418
- * var oldMarkup = Prism.languages.markup;
419
- * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
420
- *
421
- * assert(oldMarkup !== Prism.languages.markup);
422
- * assert(newMarkup === Prism.languages.markup);
423
- * ```
424
- *
425
- * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
426
- * object to be modified.
427
- * @param {string} before The key to insert before.
428
- * @param {Grammar} insert An object containing the key-value pairs to be inserted.
429
- * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
430
- * object to be modified.
431
- *
432
- * Defaults to `Prism.languages`.
433
- * @returns {Grammar} The new grammar object.
434
- * @public
435
- */
436
- insertBefore: function (inside, before, insert, root) {
437
- root = root || /** @type {any} */ (_.languages);
438
- var grammar = root[inside];
439
- /** @type {Grammar} */
440
- var ret = {};
441
-
442
- for (var token in grammar) {
443
- if (grammar.hasOwnProperty(token)) {
444
-
445
- if (token == before) {
446
- for (var newToken in insert) {
447
- if (insert.hasOwnProperty(newToken)) {
448
- ret[newToken] = insert[newToken];
449
- }
450
- }
451
- }
452
-
453
- // Do not insert token which also occur in insert. See #1525
454
- if (!insert.hasOwnProperty(token)) {
455
- ret[token] = grammar[token];
456
- }
457
- }
458
- }
459
-
460
- var old = root[inside];
461
- root[inside] = ret;
462
-
463
- // Update references in other language definitions
464
- _.languages.DFS(_.languages, function (key, value) {
465
- if (value === old && key != inside) {
466
- this[key] = ret;
467
- }
468
- });
469
-
470
- return ret;
471
- },
472
-
473
- // Traverse a language definition with Depth First Search
474
- DFS: function DFS(o, callback, type, visited) {
475
- visited = visited || {};
476
-
477
- var objId = _.util.objId;
478
-
479
- for (var i in o) {
480
- if (o.hasOwnProperty(i)) {
481
- callback.call(o, i, o[i], type || i);
482
-
483
- var property = o[i];
484
- var propertyType = _.util.type(property);
485
-
486
- if (propertyType === 'Object' && !visited[objId(property)]) {
487
- visited[objId(property)] = true;
488
- DFS(property, callback, null, visited);
489
- } else if (propertyType === 'Array' && !visited[objId(property)]) {
490
- visited[objId(property)] = true;
491
- DFS(property, callback, i, visited);
492
- }
493
- }
494
- }
495
- }
496
- },
497
-
498
- plugins: {},
499
-
500
- /**
501
- * This is the most high-level function in Prism’s API.
502
- * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
503
- * each one of them.
504
- *
505
- * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
506
- *
507
- * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
508
- * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
509
- * @memberof Prism
510
- * @public
511
- */
512
- highlightAll: function (async, callback) {
513
- _.highlightAllUnder(document, async, callback);
514
- },
515
-
516
- /**
517
- * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
518
- * {@link Prism.highlightElement} on each one of them.
519
- *
520
- * The following hooks will be run:
521
- * 1. `before-highlightall`
522
- * 2. `before-all-elements-highlight`
523
- * 3. All hooks of {@link Prism.highlightElement} for each element.
524
- *
525
- * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
526
- * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
527
- * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
528
- * @memberof Prism
529
- * @public
530
- */
531
- highlightAllUnder: function (container, async, callback) {
532
- var env = {
533
- callback: callback,
534
- container: container,
535
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
536
- };
537
-
538
- _.hooks.run('before-highlightall', env);
539
-
540
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
541
-
542
- _.hooks.run('before-all-elements-highlight', env);
543
-
544
- for (var i = 0, element; (element = env.elements[i++]);) {
545
- _.highlightElement(element, async === true, env.callback);
546
- }
547
- },
548
-
549
- /**
550
- * Highlights the code inside a single element.
551
- *
552
- * The following hooks will be run:
553
- * 1. `before-sanity-check`
554
- * 2. `before-highlight`
555
- * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
556
- * 4. `before-insert`
557
- * 5. `after-highlight`
558
- * 6. `complete`
559
- *
560
- * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
561
- * the element's language.
562
- *
563
- * @param {Element} element The element containing the code.
564
- * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
565
- * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
566
- * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
567
- * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
568
- *
569
- * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
570
- * asynchronous highlighting to work. You can build your own bundle on the
571
- * [Download page](https://prismjs.com/download.html).
572
- * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
573
- * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
574
- * @memberof Prism
575
- * @public
576
- */
577
- highlightElement: function (element, async, callback) {
578
- // Find language
579
- var language = _.util.getLanguage(element);
580
- var grammar = _.languages[language];
581
-
582
- // Set language on the element, if not present
583
- _.util.setLanguage(element, language);
584
-
585
- // Set language on the parent, for styling
586
- var parent = element.parentElement;
587
- if (parent && parent.nodeName.toLowerCase() === 'pre') {
588
- _.util.setLanguage(parent, language);
589
- }
590
-
591
- var code = element.textContent;
592
-
593
- var env = {
594
- element: element,
595
- language: language,
596
- grammar: grammar,
597
- code: code
598
- };
599
-
600
- function insertHighlightedCode(highlightedCode) {
601
- env.highlightedCode = highlightedCode;
602
-
603
- _.hooks.run('before-insert', env);
604
-
605
- env.element.innerHTML = env.highlightedCode;
606
-
607
- _.hooks.run('after-highlight', env);
608
- _.hooks.run('complete', env);
609
- callback && callback.call(env.element);
610
- }
611
-
612
- _.hooks.run('before-sanity-check', env);
613
-
614
- // plugins may change/add the parent/element
615
- parent = env.element.parentElement;
616
- if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
617
- parent.setAttribute('tabindex', '0');
618
- }
619
-
620
- if (!env.code) {
621
- _.hooks.run('complete', env);
622
- callback && callback.call(env.element);
623
- return;
624
- }
625
-
626
- _.hooks.run('before-highlight', env);
627
-
628
- if (!env.grammar) {
629
- insertHighlightedCode(_.util.encode(env.code));
630
- return;
631
- }
632
-
633
- if (async && _self.Worker) {
634
- var worker = new Worker(_.filename);
635
-
636
- worker.onmessage = function (evt) {
637
- insertHighlightedCode(evt.data);
638
- };
639
-
640
- worker.postMessage(JSON.stringify({
641
- language: env.language,
642
- code: env.code,
643
- immediateClose: true
644
- }));
645
- } else {
646
- insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
647
- }
648
- },
649
-
650
- /**
651
- * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
652
- * and the language definitions to use, and returns a string with the HTML produced.
653
- *
654
- * The following hooks will be run:
655
- * 1. `before-tokenize`
656
- * 2. `after-tokenize`
657
- * 3. `wrap`: On each {@link Token}.
658
- *
659
- * @param {string} text A string with the code to be highlighted.
660
- * @param {Grammar} grammar An object containing the tokens to use.
661
- *
662
- * Usually a language definition like `Prism.languages.markup`.
663
- * @param {string} language The name of the language definition passed to `grammar`.
664
- * @returns {string} The highlighted HTML.
665
- * @memberof Prism
666
- * @public
667
- * @example
668
- * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
669
- */
670
- highlight: function (text, grammar, language) {
671
- var env = {
672
- code: text,
673
- grammar: grammar,
674
- language: language
675
- };
676
- _.hooks.run('before-tokenize', env);
677
- if (!env.grammar) {
678
- throw new Error('The language "' + env.language + '" has no grammar.');
679
- }
680
- env.tokens = _.tokenize(env.code, env.grammar);
681
- _.hooks.run('after-tokenize', env);
682
- return Token.stringify(_.util.encode(env.tokens), env.language);
683
- },
684
-
685
- /**
686
- * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
687
- * and the language definitions to use, and returns an array with the tokenized code.
688
- *
689
- * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
690
- *
691
- * This method could be useful in other contexts as well, as a very crude parser.
692
- *
693
- * @param {string} text A string with the code to be highlighted.
694
- * @param {Grammar} grammar An object containing the tokens to use.
695
- *
696
- * Usually a language definition like `Prism.languages.markup`.
697
- * @returns {TokenStream} An array of strings and tokens, a token stream.
698
- * @memberof Prism
699
- * @public
700
- * @example
701
- * let code = `var foo = 0;`;
702
- * let tokens = Prism.tokenize(code, Prism.languages.javascript);
703
- * tokens.forEach(token => {
704
- * if (token instanceof Prism.Token && token.type === 'number') {
705
- * console.log(`Found numeric literal: ${token.content}`);
706
- * }
707
- * });
708
- */
709
- tokenize: function (text, grammar) {
710
- var rest = grammar.rest;
711
- if (rest) {
712
- for (var token in rest) {
713
- grammar[token] = rest[token];
714
- }
715
-
716
- delete grammar.rest;
717
- }
718
-
719
- var tokenList = new LinkedList();
720
- addAfter(tokenList, tokenList.head, text);
721
-
722
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
723
-
724
- return toArray(tokenList);
725
- },
726
-
727
- /**
728
- * @namespace
729
- * @memberof Prism
730
- * @public
731
- */
732
- hooks: {
733
- all: {},
734
-
735
- /**
736
- * Adds the given callback to the list of callbacks for the given hook.
737
- *
738
- * The callback will be invoked when the hook it is registered for is run.
739
- * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
740
- *
741
- * One callback function can be registered to multiple hooks and the same hook multiple times.
742
- *
743
- * @param {string} name The name of the hook.
744
- * @param {HookCallback} callback The callback function which is given environment variables.
745
- * @public
746
- */
747
- add: function (name, callback) {
748
- var hooks = _.hooks.all;
749
-
750
- hooks[name] = hooks[name] || [];
751
-
752
- hooks[name].push(callback);
753
- },
754
-
755
- /**
756
- * Runs a hook invoking all registered callbacks with the given environment variables.
757
- *
758
- * Callbacks will be invoked synchronously and in the order in which they were registered.
759
- *
760
- * @param {string} name The name of the hook.
761
- * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
762
- * @public
763
- */
764
- run: function (name, env) {
765
- var callbacks = _.hooks.all[name];
766
-
767
- if (!callbacks || !callbacks.length) {
768
- return;
769
- }
770
-
771
- for (var i = 0, callback; (callback = callbacks[i++]);) {
772
- callback(env);
773
- }
774
- }
775
- },
776
-
777
- Token: Token
778
- };
779
- _self.Prism = _;
780
-
781
-
782
- // Typescript note:
783
- // The following can be used to import the Token type in JSDoc:
784
- //
785
- // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
786
-
787
- /**
788
- * Creates a new token.
789
- *
790
- * @param {string} type See {@link Token#type type}
791
- * @param {string | TokenStream} content See {@link Token#content content}
792
- * @param {string|string[]} [alias] The alias(es) of the token.
793
- * @param {string} [matchedStr=""] A copy of the full string this token was created from.
794
- * @class
795
- * @global
796
- * @public
797
- */
798
- function Token(type, content, alias, matchedStr) {
799
- /**
800
- * The type of the token.
801
- *
802
- * This is usually the key of a pattern in a {@link Grammar}.
803
- *
804
- * @type {string}
805
- * @see GrammarToken
806
- * @public
807
- */
808
- this.type = type;
809
- /**
810
- * The strings or tokens contained by this token.
811
- *
812
- * This will be a token stream if the pattern matched also defined an `inside` grammar.
813
- *
814
- * @type {string | TokenStream}
815
- * @public
816
- */
817
- this.content = content;
818
- /**
819
- * The alias(es) of the token.
820
- *
821
- * @type {string|string[]}
822
- * @see GrammarToken
823
- * @public
824
- */
825
- this.alias = alias;
826
- // Copy of the full string this token was created from
827
- this.length = (matchedStr || '').length | 0;
828
- }
829
-
830
- /**
831
- * A token stream is an array of strings and {@link Token Token} objects.
832
- *
833
- * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
834
- * them.
835
- *
836
- * 1. No adjacent strings.
837
- * 2. No empty strings.
838
- *
839
- * The only exception here is the token stream that only contains the empty string and nothing else.
840
- *
841
- * @typedef {Array<string | Token>} TokenStream
842
- * @global
843
- * @public
844
- */
845
-
846
- /**
847
- * Converts the given token or token stream to an HTML representation.
848
- *
849
- * The following hooks will be run:
850
- * 1. `wrap`: On each {@link Token}.
851
- *
852
- * @param {string | Token | TokenStream} o The token or token stream to be converted.
853
- * @param {string} language The name of current language.
854
- * @returns {string} The HTML representation of the token or token stream.
855
- * @memberof Token
856
- * @static
857
- */
858
- Token.stringify = function stringify(o, language) {
859
- if (typeof o == 'string') {
860
- return o;
861
- }
862
- if (Array.isArray(o)) {
863
- var s = '';
864
- o.forEach(function (e) {
865
- s += stringify(e, language);
866
- });
867
- return s;
868
- }
869
-
870
- var env = {
871
- type: o.type,
872
- content: stringify(o.content, language),
873
- tag: 'span',
874
- classes: ['token', o.type],
875
- attributes: {},
876
- language: language
877
- };
878
-
879
- var aliases = o.alias;
880
- if (aliases) {
881
- if (Array.isArray(aliases)) {
882
- Array.prototype.push.apply(env.classes, aliases);
883
- } else {
884
- env.classes.push(aliases);
885
- }
886
- }
887
-
888
- _.hooks.run('wrap', env);
889
-
890
- var attributes = '';
891
- for (var name in env.attributes) {
892
- attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
893
- }
894
-
895
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
896
- };
897
-
898
- /**
899
- * @param {RegExp} pattern
900
- * @param {number} pos
901
- * @param {string} text
902
- * @param {boolean} lookbehind
903
- * @returns {RegExpExecArray | null}
904
- */
905
- function matchPattern(pattern, pos, text, lookbehind) {
906
- pattern.lastIndex = pos;
907
- var match = pattern.exec(text);
908
- if (match && lookbehind && match[1]) {
909
- // change the match to remove the text matched by the Prism lookbehind group
910
- var lookbehindLength = match[1].length;
911
- match.index += lookbehindLength;
912
- match[0] = match[0].slice(lookbehindLength);
913
- }
914
- return match;
915
- }
916
-
917
- /**
918
- * @param {string} text
919
- * @param {LinkedList<string | Token>} tokenList
920
- * @param {any} grammar
921
- * @param {LinkedListNode<string | Token>} startNode
922
- * @param {number} startPos
923
- * @param {RematchOptions} [rematch]
924
- * @returns {void}
925
- * @private
926
- *
927
- * @typedef RematchOptions
928
- * @property {string} cause
929
- * @property {number} reach
930
- */
931
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
932
- for (var token in grammar) {
933
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
934
- continue;
935
- }
936
-
937
- var patterns = grammar[token];
938
- patterns = Array.isArray(patterns) ? patterns : [patterns];
939
-
940
- for (var j = 0; j < patterns.length; ++j) {
941
- if (rematch && rematch.cause == token + ',' + j) {
942
- return;
943
- }
944
-
945
- var patternObj = patterns[j];
946
- var inside = patternObj.inside;
947
- var lookbehind = !!patternObj.lookbehind;
948
- var greedy = !!patternObj.greedy;
949
- var alias = patternObj.alias;
950
-
951
- if (greedy && !patternObj.pattern.global) {
952
- // Without the global flag, lastIndex won't work
953
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
954
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
955
- }
956
-
957
- /** @type {RegExp} */
958
- var pattern = patternObj.pattern || patternObj;
959
-
960
- for ( // iterate the token list and keep track of the current token/string position
961
- var currentNode = startNode.next, pos = startPos;
962
- currentNode !== tokenList.tail;
963
- pos += currentNode.value.length, currentNode = currentNode.next
964
- ) {
965
-
966
- if (rematch && pos >= rematch.reach) {
967
- break;
968
- }
969
-
970
- var str = currentNode.value;
971
-
972
- if (tokenList.length > text.length) {
973
- // Something went terribly wrong, ABORT, ABORT!
974
- return;
975
- }
976
-
977
- if (str instanceof Token) {
978
- continue;
979
- }
980
-
981
- var removeCount = 1; // this is the to parameter of removeBetween
982
- var match;
983
-
984
- if (greedy) {
985
- match = matchPattern(pattern, pos, text, lookbehind);
986
- if (!match || match.index >= text.length) {
987
- break;
988
- }
989
-
990
- var from = match.index;
991
- var to = match.index + match[0].length;
992
- var p = pos;
993
-
994
- // find the node that contains the match
995
- p += currentNode.value.length;
996
- while (from >= p) {
997
- currentNode = currentNode.next;
998
- p += currentNode.value.length;
999
- }
1000
- // adjust pos (and p)
1001
- p -= currentNode.value.length;
1002
- pos = p;
1003
-
1004
- // the current node is a Token, then the match starts inside another Token, which is invalid
1005
- if (currentNode.value instanceof Token) {
1006
- continue;
1007
- }
1008
-
1009
- // find the last node which is affected by this match
1010
- for (
1011
- var k = currentNode;
1012
- k !== tokenList.tail && (p < to || typeof k.value === 'string');
1013
- k = k.next
1014
- ) {
1015
- removeCount++;
1016
- p += k.value.length;
1017
- }
1018
- removeCount--;
1019
-
1020
- // replace with the new match
1021
- str = text.slice(pos, p);
1022
- match.index -= pos;
1023
- } else {
1024
- match = matchPattern(pattern, 0, str, lookbehind);
1025
- if (!match) {
1026
- continue;
1027
- }
1028
- }
1029
-
1030
- // eslint-disable-next-line no-redeclare
1031
- var from = match.index;
1032
- var matchStr = match[0];
1033
- var before = str.slice(0, from);
1034
- var after = str.slice(from + matchStr.length);
1035
-
1036
- var reach = pos + str.length;
1037
- if (rematch && reach > rematch.reach) {
1038
- rematch.reach = reach;
1039
- }
1040
-
1041
- var removeFrom = currentNode.prev;
1042
-
1043
- if (before) {
1044
- removeFrom = addAfter(tokenList, removeFrom, before);
1045
- pos += before.length;
1046
- }
1047
-
1048
- removeRange(tokenList, removeFrom, removeCount);
1049
-
1050
- var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1051
- currentNode = addAfter(tokenList, removeFrom, wrapped);
1052
-
1053
- if (after) {
1054
- addAfter(tokenList, currentNode, after);
1055
- }
1056
-
1057
- if (removeCount > 1) {
1058
- // at least one Token object was removed, so we have to do some rematching
1059
- // this can only happen if the current pattern is greedy
1060
-
1061
- /** @type {RematchOptions} */
1062
- var nestedRematch = {
1063
- cause: token + ',' + j,
1064
- reach: reach
1065
- };
1066
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1067
-
1068
- // the reach might have been extended because of the rematching
1069
- if (rematch && nestedRematch.reach > rematch.reach) {
1070
- rematch.reach = nestedRematch.reach;
1071
- }
1072
- }
1073
- }
1074
- }
1075
- }
1076
- }
1077
-
1078
- /**
1079
- * @typedef LinkedListNode
1080
- * @property {T} value
1081
- * @property {LinkedListNode<T> | null} prev The previous node.
1082
- * @property {LinkedListNode<T> | null} next The next node.
1083
- * @template T
1084
- * @private
1085
- */
1086
-
1087
- /**
1088
- * @template T
1089
- * @private
1090
- */
1091
- function LinkedList() {
1092
- /** @type {LinkedListNode<T>} */
1093
- var head = { value: null, prev: null, next: null };
1094
- /** @type {LinkedListNode<T>} */
1095
- var tail = { value: null, prev: head, next: null };
1096
- head.next = tail;
1097
-
1098
- /** @type {LinkedListNode<T>} */
1099
- this.head = head;
1100
- /** @type {LinkedListNode<T>} */
1101
- this.tail = tail;
1102
- this.length = 0;
1103
- }
1104
-
1105
- /**
1106
- * Adds a new node with the given value to the list.
1107
- *
1108
- * @param {LinkedList<T>} list
1109
- * @param {LinkedListNode<T>} node
1110
- * @param {T} value
1111
- * @returns {LinkedListNode<T>} The added node.
1112
- * @template T
1113
- */
1114
- function addAfter(list, node, value) {
1115
- // assumes that node != list.tail && values.length >= 0
1116
- var next = node.next;
1117
-
1118
- var newNode = { value: value, prev: node, next: next };
1119
- node.next = newNode;
1120
- next.prev = newNode;
1121
- list.length++;
1122
-
1123
- return newNode;
1124
- }
1125
- /**
1126
- * Removes `count` nodes after the given node. The given node will not be removed.
1127
- *
1128
- * @param {LinkedList<T>} list
1129
- * @param {LinkedListNode<T>} node
1130
- * @param {number} count
1131
- * @template T
1132
- */
1133
- function removeRange(list, node, count) {
1134
- var next = node.next;
1135
- for (var i = 0; i < count && next !== list.tail; i++) {
1136
- next = next.next;
1137
- }
1138
- node.next = next;
1139
- next.prev = node;
1140
- list.length -= i;
1141
- }
1142
- /**
1143
- * @param {LinkedList<T>} list
1144
- * @returns {T[]}
1145
- * @template T
1146
- */
1147
- function toArray(list) {
1148
- var array = [];
1149
- var node = list.head.next;
1150
- while (node !== list.tail) {
1151
- array.push(node.value);
1152
- node = node.next;
1153
- }
1154
- return array;
1155
- }
1156
-
1157
-
1158
- if (!_self.document) {
1159
- if (!_self.addEventListener) {
1160
- // in Node.js
1161
- return _;
1162
- }
1163
-
1164
- if (!_.disableWorkerMessageHandler) {
1165
- // In worker
1166
- _self.addEventListener('message', function (evt) {
1167
- var message = JSON.parse(evt.data);
1168
- var lang = message.language;
1169
- var code = message.code;
1170
- var immediateClose = message.immediateClose;
1171
-
1172
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
1173
- if (immediateClose) {
1174
- _self.close();
1175
- }
1176
- }, false);
1177
- }
1178
-
1179
- return _;
1180
- }
1181
-
1182
- // Get current script and highlight
1183
- var script = _.util.currentScript();
1184
-
1185
- if (script) {
1186
- _.filename = script.src;
1187
-
1188
- if (script.hasAttribute('data-manual')) {
1189
- _.manual = true;
1190
- }
1191
- }
1192
-
1193
- function highlightAutomaticallyCallback() {
1194
- if (!_.manual) {
1195
- _.highlightAll();
1196
- }
1197
- }
1198
-
1199
- if (!_.manual) {
1200
- // If the document state is "loading", then we'll use DOMContentLoaded.
1201
- // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1202
- // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1203
- // might take longer one animation frame to execute which can create a race condition where only some plugins have
1204
- // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1205
- // See https://github.com/PrismJS/prism/issues/2102
1206
- var readyState = document.readyState;
1207
- if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
1208
- document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
1209
- } else {
1210
- if (window.requestAnimationFrame) {
1211
- window.requestAnimationFrame(highlightAutomaticallyCallback);
1212
- } else {
1213
- window.setTimeout(highlightAutomaticallyCallback, 16);
1214
- }
1215
- }
1216
- }
1217
-
1218
- return _;
1219
-
1220
- }(_self));
1221
-
1222
- if (module.exports) {
1223
- module.exports = Prism;
1224
- }
1225
-
1226
- // hack for components to work correctly in node.js
1227
- if (typeof commonjsGlobal !== 'undefined') {
1228
- commonjsGlobal.Prism = Prism;
1229
- }
1230
-
1231
- // some additional documentation/types
1232
-
1233
- /**
1234
- * The expansion of a simple `RegExp` literal to support additional properties.
1235
- *
1236
- * @typedef GrammarToken
1237
- * @property {RegExp} pattern The regular expression of the token.
1238
- * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
1239
- * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
1240
- * @property {boolean} [greedy=false] Whether the token is greedy.
1241
- * @property {string|string[]} [alias] An optional alias or list of aliases.
1242
- * @property {Grammar} [inside] The nested grammar of this token.
1243
- *
1244
- * The `inside` grammar will be used to tokenize the text value of each token of this kind.
1245
- *
1246
- * This can be used to make nested and even recursive language definitions.
1247
- *
1248
- * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
1249
- * each another.
1250
- * @global
1251
- * @public
1252
- */
1253
-
1254
- /**
1255
- * @typedef Grammar
1256
- * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
1257
- * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
1258
- * @global
1259
- * @public
1260
- */
1261
-
1262
- /**
1263
- * A function which will invoked after an element was successfully highlighted.
1264
- *
1265
- * @callback HighlightCallback
1266
- * @param {Element} element The element successfully highlighted.
1267
- * @returns {void}
1268
- * @global
1269
- * @public
1270
- */
1271
-
1272
- /**
1273
- * @callback HookCallback
1274
- * @param {Object<string, any>} env The environment variables of the hook.
1275
- * @returns {void}
1276
- * @global
1277
- * @public
1278
- */
1279
-
1280
-
1281
- /* **********************************************
1282
- Begin prism-markup.js
1283
- ********************************************** */
1284
-
1285
- Prism.languages.markup = {
1286
- 'comment': {
1287
- pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1288
- greedy: true
1289
- },
1290
- 'prolog': {
1291
- pattern: /<\?[\s\S]+?\?>/,
1292
- greedy: true
1293
- },
1294
- 'doctype': {
1295
- // https://www.w3.org/TR/xml/#NT-doctypedecl
1296
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1297
- greedy: true,
1298
- inside: {
1299
- 'internal-subset': {
1300
- pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1301
- lookbehind: true,
1302
- greedy: true,
1303
- inside: null // see below
1304
- },
1305
- 'string': {
1306
- pattern: /"[^"]*"|'[^']*'/,
1307
- greedy: true
1308
- },
1309
- 'punctuation': /^<!|>$|[[\]]/,
1310
- 'doctype-tag': /^DOCTYPE/i,
1311
- 'name': /[^\s<>'"]+/
1312
- }
1313
- },
1314
- 'cdata': {
1315
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1316
- greedy: true
1317
- },
1318
- 'tag': {
1319
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1320
- greedy: true,
1321
- inside: {
1322
- 'tag': {
1323
- pattern: /^<\/?[^\s>\/]+/,
1324
- inside: {
1325
- 'punctuation': /^<\/?/,
1326
- 'namespace': /^[^\s>\/:]+:/
1327
- }
1328
- },
1329
- 'special-attr': [],
1330
- 'attr-value': {
1331
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1332
- inside: {
1333
- 'punctuation': [
1334
- {
1335
- pattern: /^=/,
1336
- alias: 'attr-equals'
1337
- },
1338
- {
1339
- pattern: /^(\s*)["']|["']$/,
1340
- lookbehind: true
1341
- }
1342
- ]
1343
- }
1344
- },
1345
- 'punctuation': /\/?>/,
1346
- 'attr-name': {
1347
- pattern: /[^\s>\/]+/,
1348
- inside: {
1349
- 'namespace': /^[^\s>\/:]+:/
1350
- }
1351
- }
1352
-
1353
- }
1354
- },
1355
- 'entity': [
1356
- {
1357
- pattern: /&[\da-z]{1,8};/i,
1358
- alias: 'named-entity'
1359
- },
1360
- /&#x?[\da-f]{1,8};/i
1361
- ]
1362
- };
1363
-
1364
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
1365
- Prism.languages.markup['entity'];
1366
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1367
-
1368
- // Plugin to make entity title show the real entity, idea by Roman Komarov
1369
- Prism.hooks.add('wrap', function (env) {
1370
-
1371
- if (env.type === 'entity') {
1372
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
1373
- }
1374
- });
1375
-
1376
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1377
- /**
1378
- * Adds an inlined language to markup.
1379
- *
1380
- * An example of an inlined language is CSS with `<style>` tags.
1381
- *
1382
- * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1383
- * case insensitive.
1384
- * @param {string} lang The language key.
1385
- * @example
1386
- * addInlined('style', 'css');
1387
- */
1388
- value: function addInlined(tagName, lang) {
1389
- var includedCdataInside = {};
1390
- includedCdataInside['language-' + lang] = {
1391
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1392
- lookbehind: true,
1393
- inside: Prism.languages[lang]
1394
- };
1395
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1396
-
1397
- var inside = {
1398
- 'included-cdata': {
1399
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1400
- inside: includedCdataInside
1401
- }
1402
- };
1403
- inside['language-' + lang] = {
1404
- pattern: /[\s\S]+/,
1405
- inside: Prism.languages[lang]
1406
- };
1407
-
1408
- var def = {};
1409
- def[tagName] = {
1410
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
1411
- lookbehind: true,
1412
- greedy: true,
1413
- inside: inside
1414
- };
1415
-
1416
- Prism.languages.insertBefore('markup', 'cdata', def);
1417
- }
1418
- });
1419
- Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1420
- /**
1421
- * Adds an pattern to highlight languages embedded in HTML attributes.
1422
- *
1423
- * An example of an inlined language is CSS with `style` attributes.
1424
- *
1425
- * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1426
- * case insensitive.
1427
- * @param {string} lang The language key.
1428
- * @example
1429
- * addAttribute('style', 'css');
1430
- */
1431
- value: function (attrName, lang) {
1432
- Prism.languages.markup.tag.inside['special-attr'].push({
1433
- pattern: RegExp(
1434
- /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1435
- 'i'
1436
- ),
1437
- lookbehind: true,
1438
- inside: {
1439
- 'attr-name': /^[^\s=]+/,
1440
- 'attr-value': {
1441
- pattern: /=[\s\S]+/,
1442
- inside: {
1443
- 'value': {
1444
- pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1445
- lookbehind: true,
1446
- alias: [lang, 'language-' + lang],
1447
- inside: Prism.languages[lang]
1448
- },
1449
- 'punctuation': [
1450
- {
1451
- pattern: /^=/,
1452
- alias: 'attr-equals'
1453
- },
1454
- /"|'/
1455
- ]
1456
- }
1457
- }
1458
- }
1459
- });
1460
- }
1461
- });
1462
-
1463
- Prism.languages.html = Prism.languages.markup;
1464
- Prism.languages.mathml = Prism.languages.markup;
1465
- Prism.languages.svg = Prism.languages.markup;
1466
-
1467
- Prism.languages.xml = Prism.languages.extend('markup', {});
1468
- Prism.languages.ssml = Prism.languages.xml;
1469
- Prism.languages.atom = Prism.languages.xml;
1470
- Prism.languages.rss = Prism.languages.xml;
1471
-
1472
-
1473
- /* **********************************************
1474
- Begin prism-css.js
1475
- ********************************************** */
1476
-
1477
- (function (Prism) {
1478
-
1479
- var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1480
-
1481
- Prism.languages.css = {
1482
- 'comment': /\/\*[\s\S]*?\*\//,
1483
- 'atrule': {
1484
- pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
1485
- inside: {
1486
- 'rule': /^@[\w-]+/,
1487
- 'selector-function-argument': {
1488
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1489
- lookbehind: true,
1490
- alias: 'selector'
1491
- },
1492
- 'keyword': {
1493
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1494
- lookbehind: true
1495
- }
1496
- // See rest below
1497
- }
1498
- },
1499
- 'url': {
1500
- // https://drafts.csswg.org/css-values-3/#urls
1501
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1502
- greedy: true,
1503
- inside: {
1504
- 'function': /^url/i,
1505
- 'punctuation': /^\(|\)$/,
1506
- 'string': {
1507
- pattern: RegExp('^' + string.source + '$'),
1508
- alias: 'url'
1509
- }
1510
- }
1511
- },
1512
- 'selector': {
1513
- pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1514
- lookbehind: true
1515
- },
1516
- 'string': {
1517
- pattern: string,
1518
- greedy: true
1519
- },
1520
- 'property': {
1521
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1522
- lookbehind: true
1523
- },
1524
- 'important': /!important\b/i,
1525
- 'function': {
1526
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1527
- lookbehind: true
1528
- },
1529
- 'punctuation': /[(){};:,]/
1530
- };
1531
-
1532
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1533
-
1534
- var markup = Prism.languages.markup;
1535
- if (markup) {
1536
- markup.tag.addInlined('style', 'css');
1537
- markup.tag.addAttribute('style', 'css');
1538
- }
1539
-
1540
- }(Prism));
1541
-
1542
-
1543
- /* **********************************************
1544
- Begin prism-clike.js
1545
- ********************************************** */
1546
-
1547
- Prism.languages.clike = {
1548
- 'comment': [
1549
- {
1550
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1551
- lookbehind: true,
1552
- greedy: true
1553
- },
1554
- {
1555
- pattern: /(^|[^\\:])\/\/.*/,
1556
- lookbehind: true,
1557
- greedy: true
1558
- }
1559
- ],
1560
- 'string': {
1561
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1562
- greedy: true
1563
- },
1564
- 'class-name': {
1565
- pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1566
- lookbehind: true,
1567
- inside: {
1568
- 'punctuation': /[.\\]/
1569
- }
1570
- },
1571
- 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1572
- 'boolean': /\b(?:false|true)\b/,
1573
- 'function': /\b\w+(?=\()/,
1574
- 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1575
- 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1576
- 'punctuation': /[{}[\];(),.:]/
1577
- };
1578
-
1579
-
1580
- /* **********************************************
1581
- Begin prism-javascript.js
1582
- ********************************************** */
1583
-
1584
- Prism.languages.javascript = Prism.languages.extend('clike', {
1585
- 'class-name': [
1586
- Prism.languages.clike['class-name'],
1587
- {
1588
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1589
- lookbehind: true
1590
- }
1591
- ],
1592
- 'keyword': [
1593
- {
1594
- pattern: /((?:^|\})\s*)catch\b/,
1595
- lookbehind: true
1596
- },
1597
- {
1598
- pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1599
- lookbehind: true
1600
- },
1601
- ],
1602
- // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1603
- 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1604
- 'number': {
1605
- pattern: RegExp(
1606
- /(^|[^\w$])/.source +
1607
- '(?:' +
1608
- (
1609
- // constant
1610
- /NaN|Infinity/.source +
1611
- '|' +
1612
- // binary integer
1613
- /0[bB][01]+(?:_[01]+)*n?/.source +
1614
- '|' +
1615
- // octal integer
1616
- /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
1617
- '|' +
1618
- // hexadecimal integer
1619
- /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
1620
- '|' +
1621
- // decimal bigint
1622
- /\d+(?:_\d+)*n/.source +
1623
- '|' +
1624
- // decimal number (integer or float) but no bigint
1625
- /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
1626
- ) +
1627
- ')' +
1628
- /(?![\w$])/.source
1629
- ),
1630
- lookbehind: true
1631
- },
1632
- 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1633
- });
1634
-
1635
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1636
-
1637
- Prism.languages.insertBefore('javascript', 'keyword', {
1638
- 'regex': {
1639
- pattern: RegExp(
1640
- // lookbehind
1641
- // eslint-disable-next-line regexp/no-dupe-characters-character-class
1642
- /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
1643
- // Regex pattern:
1644
- // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1645
- // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1646
- // with the only syntax, so we have to define 2 different regex patterns.
1647
- /\//.source +
1648
- '(?:' +
1649
- /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
1650
- '|' +
1651
- // `v` flag syntax. This supports 3 levels of nested character classes.
1652
- /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
1653
- ')' +
1654
- // lookahead
1655
- /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1656
- ),
1657
- lookbehind: true,
1658
- greedy: true,
1659
- inside: {
1660
- 'regex-source': {
1661
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1662
- lookbehind: true,
1663
- alias: 'language-regex',
1664
- inside: Prism.languages.regex
1665
- },
1666
- 'regex-delimiter': /^\/|\/$/,
1667
- 'regex-flags': /^[a-z]+$/,
1668
- }
1669
- },
1670
- // This must be declared before keyword because we use "function" inside the look-forward
1671
- 'function-variable': {
1672
- pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1673
- alias: 'function'
1674
- },
1675
- 'parameter': [
1676
- {
1677
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1678
- lookbehind: true,
1679
- inside: Prism.languages.javascript
1680
- },
1681
- {
1682
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1683
- lookbehind: true,
1684
- inside: Prism.languages.javascript
1685
- },
1686
- {
1687
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1688
- lookbehind: true,
1689
- inside: Prism.languages.javascript
1690
- },
1691
- {
1692
- pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1693
- lookbehind: true,
1694
- inside: Prism.languages.javascript
1695
- }
1696
- ],
1697
- 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1698
- });
1699
-
1700
- Prism.languages.insertBefore('javascript', 'string', {
1701
- 'hashbang': {
1702
- pattern: /^#!.*/,
1703
- greedy: true,
1704
- alias: 'comment'
1705
- },
1706
- 'template-string': {
1707
- pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1708
- greedy: true,
1709
- inside: {
1710
- 'template-punctuation': {
1711
- pattern: /^`|`$/,
1712
- alias: 'string'
1713
- },
1714
- 'interpolation': {
1715
- pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1716
- lookbehind: true,
1717
- inside: {
1718
- 'interpolation-punctuation': {
1719
- pattern: /^\$\{|\}$/,
1720
- alias: 'punctuation'
1721
- },
1722
- rest: Prism.languages.javascript
1723
- }
1724
- },
1725
- 'string': /[\s\S]+/
1726
- }
1727
- },
1728
- 'string-property': {
1729
- pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1730
- lookbehind: true,
1731
- greedy: true,
1732
- alias: 'property'
1733
- }
1734
- });
1735
-
1736
- Prism.languages.insertBefore('javascript', 'operator', {
1737
- 'literal-property': {
1738
- pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1739
- lookbehind: true,
1740
- alias: 'property'
1741
- },
1742
- });
1743
-
1744
- if (Prism.languages.markup) {
1745
- Prism.languages.markup.tag.addInlined('script', 'javascript');
1746
-
1747
- // add attribute support for all DOM events.
1748
- // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1749
- Prism.languages.markup.tag.addAttribute(
1750
- /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1751
- 'javascript'
1752
- );
1753
- }
1754
-
1755
- Prism.languages.js = Prism.languages.javascript;
1756
-
1757
-
1758
- /* **********************************************
1759
- Begin prism-file-highlight.js
1760
- ********************************************** */
1761
-
1762
- (function () {
1763
-
1764
- if (typeof Prism === 'undefined' || typeof document === 'undefined') {
1765
- return;
1766
- }
1767
-
1768
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
1769
- if (!Element.prototype.matches) {
1770
- Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1771
- }
1772
-
1773
- var LOADING_MESSAGE = 'Loading…';
1774
- var FAILURE_MESSAGE = function (status, message) {
1775
- return '✖ Error ' + status + ' while fetching file: ' + message;
1776
- };
1777
- var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
1778
-
1779
- var EXTENSIONS = {
1780
- 'js': 'javascript',
1781
- 'py': 'python',
1782
- 'rb': 'ruby',
1783
- 'ps1': 'powershell',
1784
- 'psm1': 'powershell',
1785
- 'sh': 'bash',
1786
- 'bat': 'batch',
1787
- 'h': 'c',
1788
- 'tex': 'latex'
1789
- };
1790
-
1791
- var STATUS_ATTR = 'data-src-status';
1792
- var STATUS_LOADING = 'loading';
1793
- var STATUS_LOADED = 'loaded';
1794
- var STATUS_FAILED = 'failed';
1795
-
1796
- var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
1797
- + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1798
-
1799
- /**
1800
- * Loads the given file.
1801
- *
1802
- * @param {string} src The URL or path of the source file to load.
1803
- * @param {(result: string) => void} success
1804
- * @param {(reason: string) => void} error
1805
- */
1806
- function loadFile(src, success, error) {
1807
- var xhr = new XMLHttpRequest();
1808
- xhr.open('GET', src, true);
1809
- xhr.onreadystatechange = function () {
1810
- if (xhr.readyState == 4) {
1811
- if (xhr.status < 400 && xhr.responseText) {
1812
- success(xhr.responseText);
1813
- } else {
1814
- if (xhr.status >= 400) {
1815
- error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1816
- } else {
1817
- error(FAILURE_EMPTY_MESSAGE);
1818
- }
1819
- }
1820
- }
1821
- };
1822
- xhr.send(null);
1823
- }
1824
-
1825
- /**
1826
- * Parses the given range.
1827
- *
1828
- * This returns a range with inclusive ends.
1829
- *
1830
- * @param {string | null | undefined} range
1831
- * @returns {[number, number | undefined] | undefined}
1832
- */
1833
- function parseRange(range) {
1834
- var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
1835
- if (m) {
1836
- var start = Number(m[1]);
1837
- var comma = m[2];
1838
- var end = m[3];
1839
-
1840
- if (!comma) {
1841
- return [start, start];
1842
- }
1843
- if (!end) {
1844
- return [start, undefined];
1845
- }
1846
- return [start, Number(end)];
1847
- }
1848
- return undefined;
1849
- }
1850
-
1851
- Prism.hooks.add('before-highlightall', function (env) {
1852
- env.selector += ', ' + SELECTOR;
1853
- });
1854
-
1855
- Prism.hooks.add('before-sanity-check', function (env) {
1856
- var pre = /** @type {HTMLPreElement} */ (env.element);
1857
- if (pre.matches(SELECTOR)) {
1858
- env.code = ''; // fast-path the whole thing and go to complete
1859
-
1860
- pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
1861
-
1862
- // add code element with loading message
1863
- var code = pre.appendChild(document.createElement('CODE'));
1864
- code.textContent = LOADING_MESSAGE;
1865
-
1866
- var src = pre.getAttribute('data-src');
1867
-
1868
- var language = env.language;
1869
- if (language === 'none') {
1870
- // the language might be 'none' because there is no language set;
1871
- // in this case, we want to use the extension as the language
1872
- var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
1873
- language = EXTENSIONS[extension] || extension;
1874
- }
1875
-
1876
- // set language classes
1877
- Prism.util.setLanguage(code, language);
1878
- Prism.util.setLanguage(pre, language);
1879
-
1880
- // preload the language
1881
- var autoloader = Prism.plugins.autoloader;
1882
- if (autoloader) {
1883
- autoloader.loadLanguages(language);
1884
- }
1885
-
1886
- // load file
1887
- loadFile(
1888
- src,
1889
- function (text) {
1890
- // mark as loaded
1891
- pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
1892
-
1893
- // handle data-range
1894
- var range = parseRange(pre.getAttribute('data-range'));
1895
- if (range) {
1896
- var lines = text.split(/\r\n?|\n/g);
1897
-
1898
- // the range is one-based and inclusive on both ends
1899
- var start = range[0];
1900
- var end = range[1] == null ? lines.length : range[1];
1901
-
1902
- if (start < 0) { start += lines.length; }
1903
- start = Math.max(0, Math.min(start - 1, lines.length));
1904
- if (end < 0) { end += lines.length; }
1905
- end = Math.max(0, Math.min(end, lines.length));
1906
-
1907
- text = lines.slice(start, end).join('\n');
1908
-
1909
- // add data-start for line numbers
1910
- if (!pre.hasAttribute('data-start')) {
1911
- pre.setAttribute('data-start', String(start + 1));
1912
- }
1913
- }
1914
-
1915
- // highlight code
1916
- code.textContent = text;
1917
- Prism.highlightElement(code);
1918
- },
1919
- function (error) {
1920
- // mark as failed
1921
- pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
1922
-
1923
- code.textContent = error;
1924
- }
1925
- );
1926
- }
1927
- });
1928
-
1929
- Prism.plugins.fileHighlight = {
1930
- /**
1931
- * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1932
- *
1933
- * Note: Elements which are already loaded or currently loading will not be touched by this method.
1934
- *
1935
- * @param {ParentNode} [container=document]
1936
- */
1937
- highlight: function highlight(container) {
1938
- var elements = (container || document).querySelectorAll(SELECTOR);
1939
-
1940
- for (var i = 0, element; (element = elements[i++]);) {
1941
- Prism.highlightElement(element);
1942
- }
1943
- }
1944
- };
1945
-
1946
- var logged = false;
1947
- /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
1948
- Prism.fileHighlight = function () {
1949
- if (!logged) {
1950
- console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
1951
- logged = true;
1952
- }
1953
- Prism.plugins.fileHighlight.highlight.apply(this, arguments);
1954
- };
1955
-
1956
- }());
1957
- }(prism));
1958
-
1959
- const Prism$1 = prism.exports;
1960
-
1961
- Prism.languages.python = {
1962
- 'comment': {
1963
- pattern: /(^|[^\\])#.*/,
1964
- lookbehind: true,
1965
- greedy: true
1966
- },
1967
- 'string-interpolation': {
1968
- pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1969
- greedy: true,
1970
- inside: {
1971
- 'interpolation': {
1972
- // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
1973
- pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1974
- lookbehind: true,
1975
- inside: {
1976
- 'format-spec': {
1977
- pattern: /(:)[^:(){}]+(?=\}$)/,
1978
- lookbehind: true
1979
- },
1980
- 'conversion-option': {
1981
- pattern: /![sra](?=[:}]$)/,
1982
- alias: 'punctuation'
1983
- },
1984
- rest: null
1985
- }
1986
- },
1987
- 'string': /[\s\S]+/
1988
- }
1989
- },
1990
- 'triple-quoted-string': {
1991
- pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1992
- greedy: true,
1993
- alias: 'string'
1994
- },
1995
- 'string': {
1996
- pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1997
- greedy: true
1998
- },
1999
- 'function': {
2000
- pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2001
- lookbehind: true
2002
- },
2003
- 'class-name': {
2004
- pattern: /(\bclass\s+)\w+/i,
2005
- lookbehind: true
2006
- },
2007
- 'decorator': {
2008
- pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
2009
- lookbehind: true,
2010
- alias: ['annotation', 'punctuation'],
2011
- inside: {
2012
- 'punctuation': /\./
2013
- }
2014
- },
2015
- 'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
2016
- 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
2017
- 'boolean': /\b(?:False|None|True)\b/,
2018
- 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
2019
- 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2020
- 'punctuation': /[{}[\];(),.:]/
2021
- };
2022
-
2023
- Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
2024
-
2025
- Prism.languages.py = Prism.languages.python;
2026
-
2027
- (function (Prism) {
2028
- // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
2029
- // + LC_ALL, RANDOM, REPLY, SECONDS.
2030
- // + make sure PS1..4 are here as they are not always set,
2031
- // - some useless things.
2032
- var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
2033
-
2034
- var commandAfterHeredoc = {
2035
- pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
2036
- lookbehind: true,
2037
- alias: 'punctuation', // this looks reasonably well in all themes
2038
- inside: null // see below
2039
- };
2040
-
2041
- var insideString = {
2042
- 'bash': commandAfterHeredoc,
2043
- 'environment': {
2044
- pattern: RegExp('\\$' + envVars),
2045
- alias: 'constant'
2046
- },
2047
- 'variable': [
2048
- // [0]: Arithmetic Environment
2049
- {
2050
- pattern: /\$?\(\([\s\S]+?\)\)/,
2051
- greedy: true,
2052
- inside: {
2053
- // If there is a $ sign at the beginning highlight $(( and )) as variable
2054
- 'variable': [
2055
- {
2056
- pattern: /(^\$\(\([\s\S]+)\)\)/,
2057
- lookbehind: true
2058
- },
2059
- /^\$\(\(/
2060
- ],
2061
- 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
2062
- // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
2063
- 'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
2064
- // If there is no $ sign at the beginning highlight (( and )) as punctuation
2065
- 'punctuation': /\(\(?|\)\)?|,|;/
2066
- }
2067
- },
2068
- // [1]: Command Substitution
2069
- {
2070
- pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
2071
- greedy: true,
2072
- inside: {
2073
- 'variable': /^\$\(|^`|\)$|`$/
2074
- }
2075
- },
2076
- // [2]: Brace expansion
2077
- {
2078
- pattern: /\$\{[^}]+\}/,
2079
- greedy: true,
2080
- inside: {
2081
- 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
2082
- 'punctuation': /[\[\]]/,
2083
- 'environment': {
2084
- pattern: RegExp('(\\{)' + envVars),
2085
- lookbehind: true,
2086
- alias: 'constant'
2087
- }
2088
- }
2089
- },
2090
- /\$(?:\w+|[#?*!@$])/
2091
- ],
2092
- // Escape sequences from echo and printf's manuals, and escaped quotes.
2093
- 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
2094
- };
2095
-
2096
- Prism.languages.bash = {
2097
- 'shebang': {
2098
- pattern: /^#!\s*\/.*/,
2099
- alias: 'important'
2100
- },
2101
- 'comment': {
2102
- pattern: /(^|[^"{\\$])#.*/,
2103
- lookbehind: true
2104
- },
2105
- 'function-name': [
2106
- // a) function foo {
2107
- // b) foo() {
2108
- // c) function foo() {
2109
- // but not “foo {”
2110
- {
2111
- // a) and c)
2112
- pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
2113
- lookbehind: true,
2114
- alias: 'function'
2115
- },
2116
- {
2117
- // b)
2118
- pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
2119
- alias: 'function'
2120
- }
2121
- ],
2122
- // Highlight variable names as variables in for and select beginnings.
2123
- 'for-or-select': {
2124
- pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
2125
- alias: 'variable',
2126
- lookbehind: true
2127
- },
2128
- // Highlight variable names as variables in the left-hand part
2129
- // of assignments (“=” and “+=”).
2130
- 'assign-left': {
2131
- pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
2132
- inside: {
2133
- 'environment': {
2134
- pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
2135
- lookbehind: true,
2136
- alias: 'constant'
2137
- }
2138
- },
2139
- alias: 'variable',
2140
- lookbehind: true
2141
- },
2142
- // Highlight parameter names as variables
2143
- 'parameter': {
2144
- pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
2145
- alias: 'variable',
2146
- lookbehind: true
2147
- },
2148
- 'string': [
2149
- // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
2150
- {
2151
- pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
2152
- lookbehind: true,
2153
- greedy: true,
2154
- inside: insideString
2155
- },
2156
- // Here-document with quotes around the tag
2157
- // → No expansion (so no “inside”).
2158
- {
2159
- pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
2160
- lookbehind: true,
2161
- greedy: true,
2162
- inside: {
2163
- 'bash': commandAfterHeredoc
2164
- }
2165
- },
2166
- // “Normal” string
2167
- {
2168
- // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
2169
- pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
2170
- lookbehind: true,
2171
- greedy: true,
2172
- inside: insideString
2173
- },
2174
- {
2175
- // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
2176
- pattern: /(^|[^$\\])'[^']*'/,
2177
- lookbehind: true,
2178
- greedy: true
2179
- },
2180
- {
2181
- // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
2182
- pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
2183
- greedy: true,
2184
- inside: {
2185
- 'entity': insideString.entity
2186
- }
2187
- }
2188
- ],
2189
- 'environment': {
2190
- pattern: RegExp('\\$?' + envVars),
2191
- alias: 'constant'
2192
- },
2193
- 'variable': insideString.variable,
2194
- 'function': {
2195
- pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
2196
- lookbehind: true
2197
- },
2198
- 'keyword': {
2199
- pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
2200
- lookbehind: true
2201
- },
2202
- // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
2203
- 'builtin': {
2204
- pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
2205
- lookbehind: true,
2206
- // Alias added to make those easier to distinguish from strings.
2207
- alias: 'class-name'
2208
- },
2209
- 'boolean': {
2210
- pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
2211
- lookbehind: true
2212
- },
2213
- 'file-descriptor': {
2214
- pattern: /\B&\d\b/,
2215
- alias: 'important'
2216
- },
2217
- 'operator': {
2218
- // Lots of redirections here, but not just that.
2219
- pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
2220
- inside: {
2221
- 'file-descriptor': {
2222
- pattern: /^\d/,
2223
- alias: 'important'
2224
- }
2225
- }
2226
- },
2227
- 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
2228
- 'number': {
2229
- pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
2230
- lookbehind: true
2231
- }
2232
- };
2233
-
2234
- commandAfterHeredoc.inside = Prism.languages.bash;
2235
-
2236
- /* Patterns in command substitution. */
2237
- var toBeCopied = [
2238
- 'comment',
2239
- 'function-name',
2240
- 'for-or-select',
2241
- 'assign-left',
2242
- 'parameter',
2243
- 'string',
2244
- 'environment',
2245
- 'function',
2246
- 'keyword',
2247
- 'builtin',
2248
- 'boolean',
2249
- 'file-descriptor',
2250
- 'operator',
2251
- 'punctuation',
2252
- 'number'
2253
- ];
2254
- var inside = insideString.variable[1].inside;
2255
- for (var i = 0; i < toBeCopied.length; i++) {
2256
- inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
2257
- }
2258
-
2259
- Prism.languages.sh = Prism.languages.bash;
2260
- Prism.languages.shell = Prism.languages.bash;
2261
- }(Prism));
2262
-
2263
- (function (Prism) {
2264
-
2265
- // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
2266
- // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
2267
- var anchorOrAlias = /[*&][^\s[\]{},]+/;
2268
- // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
2269
- var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
2270
- // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
2271
- var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
2272
- + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
2273
- // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
2274
- // This is a simplified version that doesn't support "#" and multiline keys
2275
- // All these long scarry character classes are simplified versions of YAML's characters
2276
- var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
2277
- .replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
2278
- var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
2279
-
2280
- /**
2281
- *
2282
- * @param {string} value
2283
- * @param {string} [flags]
2284
- * @returns {RegExp}
2285
- */
2286
- function createValuePattern(value, flags) {
2287
- flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
2288
- var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
2289
- .replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
2290
- return RegExp(pattern, flags);
2291
- }
2292
-
2293
- Prism.languages.yaml = {
2294
- 'scalar': {
2295
- pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
2296
- .replace(/<<prop>>/g, function () { return properties; })),
2297
- lookbehind: true,
2298
- alias: 'string'
2299
- },
2300
- 'comment': /#.*/,
2301
- 'key': {
2302
- pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
2303
- .replace(/<<prop>>/g, function () { return properties; })
2304
- .replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
2305
- lookbehind: true,
2306
- greedy: true,
2307
- alias: 'atrule'
2308
- },
2309
- 'directive': {
2310
- pattern: /(^[ \t]*)%.+/m,
2311
- lookbehind: true,
2312
- alias: 'important'
2313
- },
2314
- 'datetime': {
2315
- pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
2316
- lookbehind: true,
2317
- alias: 'number'
2318
- },
2319
- 'boolean': {
2320
- pattern: createValuePattern(/false|true/.source, 'i'),
2321
- lookbehind: true,
2322
- alias: 'important'
2323
- },
2324
- 'null': {
2325
- pattern: createValuePattern(/null|~/.source, 'i'),
2326
- lookbehind: true,
2327
- alias: 'important'
2328
- },
2329
- 'string': {
2330
- pattern: createValuePattern(string),
2331
- lookbehind: true,
2332
- greedy: true
2333
- },
2334
- 'number': {
2335
- pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
2336
- lookbehind: true
2337
- },
2338
- 'tag': tag,
2339
- 'important': anchorOrAlias,
2340
- 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
2341
- };
2342
-
2343
- Prism.languages.yml = Prism.languages.yaml;
2344
-
2345
- }(Prism));
2346
-
2347
- (function (Prism) {
2348
-
2349
- var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
2350
-
2351
- Prism.languages.css = {
2352
- 'comment': /\/\*[\s\S]*?\*\//,
2353
- 'atrule': {
2354
- pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
2355
- inside: {
2356
- 'rule': /^@[\w-]+/,
2357
- 'selector-function-argument': {
2358
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
2359
- lookbehind: true,
2360
- alias: 'selector'
2361
- },
2362
- 'keyword': {
2363
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
2364
- lookbehind: true
2365
- }
2366
- // See rest below
2367
- }
2368
- },
2369
- 'url': {
2370
- // https://drafts.csswg.org/css-values-3/#urls
2371
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
2372
- greedy: true,
2373
- inside: {
2374
- 'function': /^url/i,
2375
- 'punctuation': /^\(|\)$/,
2376
- 'string': {
2377
- pattern: RegExp('^' + string.source + '$'),
2378
- alias: 'url'
2379
- }
2380
- }
2381
- },
2382
- 'selector': {
2383
- pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
2384
- lookbehind: true
2385
- },
2386
- 'string': {
2387
- pattern: string,
2388
- greedy: true
2389
- },
2390
- 'property': {
2391
- pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
2392
- lookbehind: true
2393
- },
2394
- 'important': /!important\b/i,
2395
- 'function': {
2396
- pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
2397
- lookbehind: true
2398
- },
2399
- 'punctuation': /[(){};:,]/
2400
- };
2401
-
2402
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
2403
-
2404
- var markup = Prism.languages.markup;
2405
- if (markup) {
2406
- markup.tag.addInlined('style', 'css');
2407
- markup.tag.addAttribute('style', 'css');
2408
- }
2409
-
2410
- }(Prism));
2411
-
2412
- const edsCodeBlockCss = ":host{display:block;font-family:var(--font-family, 'Courier New', monospace)}pre[class*=\"language-\"]{white-space:pre-wrap;word-break:break-word;}.language{font-weight:bold;text-transform:uppercase}pre{margin:0;border-radius:8px;color:var(--purple-200);overflow:auto}code{font-family:'Courier New', monospace}.token.keyword{color:var(--purple-500)}.token.string{color:var(--green-500)}.token.function{color:var(--cyan-500)}.token.comment{color:var(--grey-700)}.relative{position:relative}.bg-stronger{background-color:var(--grey-900)}.rounded-sm{border-radius:8px}.rounded-xs{border-radius:4px}.text-inverse{color:var(--white)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.p-0{padding:0rem}.p-12{padding:0.75rem}.p-16{padding:1rem}.p-20{padding:1.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.pl-8{padding-left:0.5rem}.mb-10{margin-bottom:0.625rem}.mb-12{margin-bottom:0.75rem}.mb-28{margin-bottom:1.75rem}.pb-16{padding-bottom:1rem}.pb-20{padding-bottom:1.25rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.pb-8{padding-bottom:0.5rem}.mt-16{margin-top:1rem}.mt-2{margin-top:0.125rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.w-20{width:1.25rem}.h-20{height:1.25rem}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}";
2413
- const EdsCodeBlockStyle0 = edsCodeBlockCss;
2414
-
2415
- const EdsCodeBlock = class {
2416
- constructor(hostRef) {
2417
- index.registerInstance(this, hostRef);
2418
- this.code = undefined;
2419
- this.language = undefined;
2420
- this.copied = false;
2421
- }
2422
- /**
2423
- * Copies the current code content to the clipboard and sets a temporary copied state.
2424
- *
2425
- * @private
2426
- * @returns {void}
2427
- */
2428
- copyToClipboard() {
2429
- navigator.clipboard.writeText(this.code).then(() => {
2430
- this.copied = true;
2431
- /*const analyticsName = this.createHumanFriendlyAnalyticsName(this.code, this.language);
2432
- sendAnalytics({
2433
- category: 'ui-component',
2434
- parentContext: null,
2435
- tag: this.el.tagName.toLowerCase(),
2436
- name: analyticsName || '',
2437
- action: 'copy'
2438
- });*/
2439
- setTimeout(() => (this.copied = false), 2000);
2440
- });
2441
- }
2442
- /**
2443
- * Utility function that creates a human-friendly analytics name based on the code and language.
2444
- * It uses:
2445
- * - The language (in uppercase)
2446
- * - The number of non-empty lines in the code
2447
- * - The first non-empty line of code (truncated to 30 characters, if needed)
2448
- *
2449
- * returns A descriptive analytics name.
2450
- */
2451
- /*private createHumanFriendlyAnalyticsName(code: string, language: string): string {
2452
- // Count non-empty lines
2453
- const lines = code.split('\n').filter(line => line.trim() !== '').length;
2454
-
2455
- // Find the first non-empty line and trim it
2456
- let firstNonEmptyLine = code.split('\n').find(line => line.trim() !== '');
2457
- firstNonEmptyLine = firstNonEmptyLine ? firstNonEmptyLine.trim() : '';
2458
-
2459
- // Truncate the snippet if it’s too long
2460
- if (firstNonEmptyLine.length > 30) {
2461
- firstNonEmptyLine = firstNonEmptyLine.substring(0, 30) + '...';
2462
- }
2463
-
2464
- return `CodeBlock:${language.toLowerCase()}|${lines}-line(s)|${firstNonEmptyLine.toLowerCase()}`;
2465
- }*/
2466
- /**
2467
- * Returns the syntax-highlighted HTML for the code.
2468
- * If the provided language is supported by Prism, this method returns the highlighted code.
2469
- * Otherwise, it logs a warning and returns the raw code.
2470
- *
2471
- * @private
2472
- * @returns {string} The highlighted HTML string for the code block.
2473
- */
2474
- getHighlightedCode() {
2475
- if (this.language && Prism$1.languages[this.language]) {
2476
- return Prism$1.highlight(this.code, Prism$1.languages[this.language], this.language);
2477
- }
2478
- // eslint-disable-next-line
2479
- //console.warn(`Unsupported or missing language: ${this.language}`);
2480
- return this.code; // Fallback if language is not provided or unsupported
2481
- }
2482
- render() {
2483
- return (index.h("div", { key: '7550f1c5e29a9be39614404d51dfec9a7aa194a9', class: "relative bg-stronger rounded-sm" }, index.h("div", { key: '8e654051ec6105e051af723e056b4151afc4305c', class: "text-inverse flex justify-between items-center p-8" }, this.language ? (index.h("span", { class: "f-ui-03" }, this.language.toUpperCase())) : (index.h("pre", { class: "bg-stronger pl-8", role: "region", "aria-label": "Code block without language" }, index.h("code", { innerHTML: this.getHighlightedCode() }))), index.h("span", { key: '1f558301727adb451524850b352844d7658f33a8', "aria-hidden": "true", class: "w-20 h-20 mt-8" }, index.h("eds-icon-wrapper", { key: '7def1f38f949c32d6138d88a0a7edf9655852491', icon: this.copied ? 'success' : 'copy', onClick: () => this.copyToClipboard() })), index.h("span", { key: '9eabcd54f3bcdc1c4627a7ca7e22fd38e9755ca6', class: "sr-only" }, "Copy Code")), this.language && (index.h("pre", { key: 'd15dce4b1692bf1956e1b3cb3586dde4d9561f1b', class: `language-${this.language} bg-stronger pl-8 pb-8`, role: "region", "aria-label": `Code block in ${this.language}` }, index.h("code", { key: 'ad7eb7b40aaab69b6bc929c632ce4736fe3c39a5', innerHTML: this.getHighlightedCode() })))));
2484
- }
2485
- get el() { return index.getElement(this); }
2486
- };
2487
- EdsCodeBlock.style = EdsCodeBlockStyle0;
2488
-
2489
- exports.eds_code_block = EdsCodeBlock;