PoweredByUtil.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. * This file must not be changed or exchanged.
  3. *
  4. * @see http://bpmn.io/license for more information.
  5. */
  6. import {
  7. assignStyle,
  8. domify,
  9. delegate as domDelegate,
  10. query as domQuery
  11. } from 'min-dom';
  12. // inlined ../../resources/logo.svg
  13. var BPMNIO_LOGO_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>';
  14. export var BPMNIO_IMG = BPMNIO_LOGO_SVG;
  15. export var LOGO_STYLES = {
  16. verticalAlign: 'middle'
  17. };
  18. export var LINK_STYLES = {
  19. 'color': '#404040'
  20. };
  21. var LIGHTBOX_STYLES = {
  22. 'zIndex': '1001',
  23. 'position': 'fixed',
  24. 'top': '0',
  25. 'left': '0',
  26. 'right': '0',
  27. 'bottom': '0'
  28. };
  29. var BACKDROP_STYLES = {
  30. 'width': '100%',
  31. 'height': '100%',
  32. 'background': 'rgba(40,40,40,0.2)'
  33. };
  34. var NOTICE_STYLES = {
  35. 'position': 'absolute',
  36. 'left': '50%',
  37. 'top': '40%',
  38. 'transform': 'translate(-50%)',
  39. 'width': '260px',
  40. 'padding': '10px',
  41. 'background': 'white',
  42. 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',
  43. 'fontFamily': 'Helvetica, Arial, sans-serif',
  44. 'fontSize': '14px',
  45. 'display': 'flex',
  46. 'lineHeight': '1.3'
  47. };
  48. var LIGHTBOX_MARKUP =
  49. '<div class="bjs-powered-by-lightbox">' +
  50. '<div class="backdrop"></div>' +
  51. '<div class="notice">' +
  52. '<a href="https://bpmn.io" target="_blank" rel="noopener" class="link">' +
  53. BPMNIO_IMG +
  54. '</a>' +
  55. '<span>' +
  56. 'Web-based tooling for BPMN, DMN and forms ' +
  57. 'powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.' +
  58. '</span>' +
  59. '</div>' +
  60. '</div>';
  61. var lightbox;
  62. function createLightbox() {
  63. lightbox = domify(LIGHTBOX_MARKUP);
  64. assignStyle(lightbox, LIGHTBOX_STYLES);
  65. assignStyle(domQuery('svg', lightbox), LOGO_STYLES);
  66. assignStyle(domQuery('.backdrop', lightbox), BACKDROP_STYLES);
  67. assignStyle(domQuery('.notice', lightbox), NOTICE_STYLES);
  68. assignStyle(domQuery('.link', lightbox), LINK_STYLES, {
  69. 'margin': '15px 20px 15px 10px',
  70. 'alignSelf': 'center'
  71. });
  72. }
  73. export function open() {
  74. if (!lightbox) {
  75. createLightbox();
  76. domDelegate.bind(lightbox, '.backdrop', 'click', function(event) {
  77. document.body.removeChild(lightbox);
  78. });
  79. }
  80. document.body.appendChild(lightbox);
  81. }