@ably/ui 8.7.0-dev.4e08581 → 8.7.0-dev.5e05745

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 (39) hide show
  1. package/README.md +1 -1
  2. package/core/Code/component.css +3 -3
  3. package/core/Code/component.js +1 -1
  4. package/core/Code.jsx +328 -7145
  5. package/core/DropdownMenu/component.js +1 -0
  6. package/core/DropdownMenu.jsx +317 -0
  7. package/core/Meganav.jsx +14 -2
  8. package/core/MeganavContentDevelopers.jsx +13 -1
  9. package/core/MeganavContentUseCases.jsx +1 -1
  10. package/core/MeganavContentWhyAbly/component.js +21 -5
  11. package/core/MeganavContentWhyAbly.jsx +3276 -3
  12. package/core/sprites.svg +9 -0
  13. package/package.json +3 -2
  14. package/src/core/Code/component.css +1 -67
  15. package/src/core/Code/component.js +11 -46
  16. package/src/core/Code/component.jsx +7 -3
  17. package/{preview/vendor/bundle/ruby/3.0.0/bundler/gems/ably-ui-abffd210ec0f/preview/log/.keep → src/core/DropdownMenu/component.js} +0 -0
  18. package/src/core/DropdownMenu/component.jsx +114 -0
  19. package/src/core/FeatureFooter/component.html.erb +1 -1
  20. package/src/core/MeganavContentDevelopers/component.html.erb +9 -0
  21. package/src/core/MeganavContentDevelopers/component.jsx +9 -0
  22. package/src/core/MeganavContentUseCases/component.html.erb +1 -1
  23. package/src/core/MeganavContentUseCases/component.jsx +1 -1
  24. package/src/core/MeganavSearchSuggestions/component.html.erb +1 -1
  25. package/src/core/icons/google.svg +3 -0
  26. package/src/core/icons/icon-display-integrations-col.svg +8 -0
  27. package/src/core/utils/syntax-highlighter-registry.js +61 -0
  28. package/src/core/utils/syntax-highlighter.css +69 -0
  29. package/src/core/utils/syntax-highlighter.js +98 -0
  30. package/core/.DS_Store +0 -0
  31. package/core/fonts/.DS_Store +0 -0
  32. package/core/images/.DS_Store +0 -0
  33. package/preview/vendor/bundle/ruby/3.0.0/bundler/gems/ably-ui-abffd210ec0f/preview/tmp/.keep +0 -0
  34. package/preview/vendor/bundle/ruby/3.0.0/bundler/gems/ably-ui-abffd210ec0f/preview/tmp/pids/.keep +0 -0
  35. package/src/.DS_Store +0 -0
  36. package/src/core/.DS_Store +0 -0
  37. package/src/core/fonts/.DS_Store +0 -0
  38. package/src/core/images/.DS_Store +0 -0
  39. package/src/reset/.DS_Store +0 -0
package/core/sprites.svg CHANGED
@@ -14,6 +14,8 @@
14
14
  <path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C5.4 0 0 5.41945 0 12.0432C0 17.3623 3.4 21.8785 8.2 23.4843C8.8 23.5846 9 23.1832 9 22.8821C9 22.581 9 21.8785 9 20.8749C5.7 21.5774 5 19.2692 5 19.2692C4.5 17.8641 3.7 17.4627 3.7 17.4627C2.6 16.7601 3.8 16.7602 3.8 16.7602C5 16.8605 5.6 17.9645 5.6 17.9645C6.7 19.771 8.4 19.2692 9.1 18.9681C9.2 18.1652 9.5 17.6634 9.9 17.3623C7.1 17.0612 4.3 16.0576 4.3 11.4411C4.3 10.1364 4.8 9.03242 5.5 8.22953C5.5 7.82809 5 6.62377 5.7 5.01801C5.7 5.01801 6.7 4.71693 9 6.22233C10 5.92125 11 5.82089 12 5.82089C13 5.82089 14 5.92125 15 6.22233C17.3 4.71693 18.3 5.01801 18.3 5.01801C19 6.72413 18.5 7.92845 18.4 8.22953C19.2 9.03242 19.6 10.1364 19.6 11.4411C19.6 16.0576 16.8 17.0612 14.1 17.3623C14.5 17.7638 14.9 18.4663 14.9 19.5702C14.9 21.176 14.9 22.4807 14.9 22.8821C14.9 23.1832 15.1 23.5846 15.7 23.4843C20.6 21.8785 24 17.3623 24 12.0432C24 5.41945 18.6 0 12 0Z"/>
15
15
  </symbol><symbol id="sprite-glassdoor" viewBox="0 0 18 24"><title>sprite-glassdoor</title>
16
16
  <path d="M14.122 20.5734H0.5C0.5 22.4677 2.0222 24 3.90634 24H14.122C16.0027 24 17.5249 22.4643 17.5249 20.5734V6.49471C17.5249 6.42706 17.4708 6.36617 17.4032 6.36617H14.2438C14.1761 6.36617 14.122 6.42368 14.122 6.49133V20.57V20.5734ZM14.122 0C16.0027 0 17.5249 1.53573 17.5249 3.43002H3.90634V17.5087C3.90634 17.5763 3.84884 17.6338 3.78118 17.6338H0.625159C0.557505 17.6338 0.5 17.5763 0.5 17.5087V3.43002C0.5 1.53573 2.0222 0 3.90634 0H14.122Z"/>
17
+ </symbol><symbol fill="none" id="sprite-google" viewBox="0 0 18 18"><title>sprite-google</title>
18
+ <path d="M17.6483 7.36875H9.1803V10.8492H14.0178C13.8092 11.9742 13.1764 12.9258 12.2225 13.5633C11.4162 14.1023 10.3873 14.4211 9.17795 14.4211C6.83655 14.4211 4.85608 12.8391 4.14827 10.7133C3.97014 10.1742 3.86702 9.59766 3.86702 9.00469C3.86702 8.41172 3.97014 7.83516 4.14827 7.29609C4.85842 5.17266 6.83889 3.59063 9.1803 3.59063C10.4998 3.59063 11.6834 4.04531 12.6162 4.93594L15.1944 2.35547C13.6358 0.902344 11.6037 0.0117188 9.1803 0.0117188C5.66702 0.0117188 2.62717 2.02734 1.14827 4.96641C0.538892 6.18047 0.192017 7.55391 0.192017 9.00703C0.192017 10.4602 0.538892 11.8312 1.14827 13.0453C2.62717 15.9844 5.66702 18 9.1803 18C11.6084 18 13.6428 17.1938 15.1287 15.8203C16.828 14.2547 17.81 11.9484 17.81 9.20859C17.81 8.57109 17.7537 7.95937 17.6483 7.36875Z" fill="currentColor"/>
17
19
  </symbol><symbol fill="none" id="sprite-icon-display-48hrs" viewBox="0 0 48 48"><title>sprite-icon-display-48hrs</title>
18
20
  <path fill-rule="evenodd" clip-rule="evenodd" d="M4.75 24C4.75 13.3685 13.3685 4.75 24 4.75C24.4142 4.75 24.75 4.41421 24.75 4C24.75 3.58579 24.4142 3.25 24 3.25C12.5401 3.25 3.25 12.5401 3.25 24C3.25 35.4599 12.5401 44.75 24 44.75C35.4599 44.75 44.75 35.4599 44.75 24C44.75 23.5858 44.4142 23.25 44 23.25C43.5858 23.25 43.25 23.5858 43.25 24C43.25 34.6315 34.6315 43.25 24 43.25C13.3685 43.25 4.75 34.6315 4.75 24ZM33.0947 26.36C33.0947 28.682 31.1507 30.212 28.9727 30.212C26.7947 30.212 24.8507 28.682 24.8507 26.36C24.8507 24.884 25.6247 23.75 26.8487 23.138C25.8947 22.58 25.3007 21.626 25.3007 20.402C25.3007 18.35 27.0287 17 28.9727 17C30.9167 17 32.6447 18.35 32.6447 20.402C32.6447 21.626 32.0507 22.58 31.0787 23.138C32.3027 23.75 33.0947 24.884 33.0947 26.36ZM26.3087 26.36C26.3087 27.836 27.4787 28.862 28.9727 28.862C30.4667 28.862 31.6367 27.836 31.6367 26.36C31.6367 24.884 30.4667 23.84 28.9727 23.84C27.4787 23.84 26.3087 24.884 26.3087 26.36ZM26.7587 20.402C26.7587 21.626 27.7307 22.49 28.9727 22.49C30.2147 22.49 31.1867 21.626 31.1867 20.402C31.1867 19.196 30.2147 18.35 28.9727 18.35C27.7307 18.35 26.7587 19.196 26.7587 20.402ZM20.9773 27.008V29.996H19.5193V27.008H14.3533V25.838L19.3753 17.216H21.0493L15.9733 25.64H19.5193V22.778H20.9773V25.64H23.6773V27.008H20.9773Z" fill="currentColor"/>
19
21
  </symbol><symbol fill="none" id="sprite-icon-display-about-ably-col" viewBox="0 0 40 41"><title>sprite-icon-display-about-ably-col</title>
@@ -99,6 +101,13 @@
99
101
  <rect width="48" height="48" fill="white"/>
100
102
  </clipPath>
101
103
  </defs>
104
+ </symbol><symbol fill="none" id="sprite-icon-display-integrations-col" viewBox="0 0 48 48"><title>sprite-icon-display-integrations-col</title>
105
+ <path d="M7.69985 7.70029C3.40409 11.9961 3.18585 18.7426 7.21241 22.7692L11.9425 27.4993L27.4988 11.9429L22.7688 7.21285C18.7422 3.18629 11.9956 3.40453 7.69985 7.70029Z" stroke="#03020D" stroke-width="1.5" stroke-linejoin="round"/>
106
+ <path d="M45.2129 45.2131L42.3844 42.3847" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
107
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M40.4514 40.451C35.8956 45.0068 28.6731 45.2897 24.3219 40.9385L19.5918 36.2084C19.2989 35.9155 19.2989 35.4406 19.5918 35.1477L35.1482 19.5914C35.441 19.2985 35.9159 19.2985 36.2088 19.5914L40.9389 24.3215C45.2902 28.6727 45.0073 35.8952 40.4514 40.451Z" fill="#FF5416"/>
108
+ <path d="M2.78647 2.78662L7.73622 7.73637" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
109
+ <path d="M23.2925 16.2217L28.2423 21.1714" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
110
+ <path d="M16.2215 23.2927L21.1712 28.2425" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
102
111
  </symbol><symbol fill="none" id="sprite-icon-display-it-support-access" viewBox="0 0 48 48"><title>sprite-icon-display-it-support-access</title>
103
112
  <path fill-rule="evenodd" clip-rule="evenodd" d="M46.5 40V12.75H1.5V40C1.5 40.2761 1.72386 40.5 2 40.5H46C46.2761 40.5 46.5 40.2761 46.5 40ZM46.5 8V11.25H1.5V8C1.5 7.72386 1.72386 7.5 2 7.5H46C46.2761 7.5 46.5 7.72386 46.5 8ZM48 8V40C48 41.1046 47.1046 42 46 42H2C0.895432 42 0 41.1046 0 40V8C0 6.89543 0.895431 6 2 6H46C47.1046 6 48 6.89543 48 8ZM4.25 9.25C4.25 9.80228 3.80228 10.25 3.25 10.25C2.69772 10.25 2.25 9.80228 2.25 9.25C2.25 8.69772 2.69772 8.25 3.25 8.25C3.80228 8.25 4.25 8.69772 4.25 9.25ZM6.25 10.25C6.80228 10.25 7.25 9.80228 7.25 9.25C7.25 8.69772 6.80228 8.25 6.25 8.25C5.69772 8.25 5.25 8.69772 5.25 9.25C5.25 9.80228 5.69772 10.25 6.25 10.25ZM10.25 9.25C10.25 9.80228 9.80228 10.25 9.25 10.25C8.69771 10.25 8.25 9.80228 8.25 9.25C8.25 8.69772 8.69771 8.25 9.25 8.25C9.80228 8.25 10.25 8.69772 10.25 9.25ZM24.75 29.7993C25.1984 29.54 25.5 29.0552 25.5 28.5C25.5 27.6716 24.8284 27 24 27C23.1716 27 22.5 27.6716 22.5 28.5C22.5 29.0552 22.8016 29.54 23.25 29.7993V33.5H24.75V29.7993ZM17 24.25C16.5858 24.25 16.25 24.5858 16.25 25V30.205L16.25 30.2421C16.2498 31.0676 16.2495 32.6758 17.0154 34.0849C17.4144 34.8189 18.0189 35.498 18.9172 35.9873C19.81 36.4735 20.9514 36.75 22.3949 36.75H25.6051C27.048 36.75 28.1892 36.4751 29.0819 35.9904C29.9804 35.5025 30.5854 34.8247 30.9846 34.0902C31.7506 32.681 31.7502 31.0674 31.75 30.2226L31.75 30.1839V25C31.75 24.5858 31.4142 24.25 31 24.25H29.75V21.1841C29.75 19.3825 29.1112 18.087 27.9744 17.2764C26.8851 16.4997 25.4495 16.25 24 16.25C22.5484 16.25 21.1133 16.5046 20.0247 17.2833C18.8896 18.0953 18.25 19.3896 18.25 21.1841V24.25H17ZM28.25 21.1841V24.25H19.75V21.1841C19.75 19.7819 20.2251 18.9842 20.8974 18.5033C21.6161 17.9891 22.6811 17.75 24 17.75C25.321 17.75 26.3855 17.9857 27.1035 18.4977C27.7741 18.9758 28.25 19.7723 28.25 21.1841ZM29 25.75H19H17.75V30.205C17.75 31.0561 17.7622 32.3179 18.3333 33.3686C18.6087 33.8753 19.0157 34.3328 19.6347 34.67C20.2593 35.0102 21.141 35.25 22.3949 35.25H25.6051C26.8596 35.25 27.7416 35.0113 28.3662 34.6721C28.985 34.3362 29.3916 33.88 29.6667 33.3739C30.2376 32.3236 30.25 31.0573 30.25 30.1839V25.75H29Z" fill="currentColor"/>
104
113
  </symbol><symbol fill="none" id="sprite-icon-display-it-support-helpdesk" viewBox="0 0 48 48"><title>sprite-icon-display-it-support-helpdesk</title>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ably/ui",
3
- "version": "8.7.0-dev.4e08581",
3
+ "version": "8.7.0-dev.5e05745",
4
4
  "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,6 +34,7 @@
34
34
  "eslint-plugin-cypress": "^2.11.2",
35
35
  "eslint-plugin-react": "^7.21.5",
36
36
  "extra-watch-webpack-plugin": "^1.0.3",
37
+ "find-imports": "^1.1.0",
37
38
  "mini-css-extract-plugin": "^1.2.1",
38
39
  "null-loader": "^4.0.1",
39
40
  "postcss": "^8.1.10",
@@ -68,8 +69,8 @@
68
69
  "array-flat-polyfill": "^1.0.1",
69
70
  "dompurify": "^2.2.9",
70
71
  "highlight.js": "^10.7.2",
72
+ "highlightjs-curl": "^1.3.0",
71
73
  "js-cookie": "^2.2.1",
72
- "lodash.debounce": "^4.0.8",
73
74
  "lodash.throttle": "^4.1.1",
74
75
  "nanoid": "^4.0.0",
75
76
  "prop-types": "^15.7.2",
@@ -1,67 +1 @@
1
- @import "../fonts/source-code-pro.css";
2
-
3
- @layer components {
4
- .hljs {
5
- background: var(--syntax-black);
6
- color: var(--syntax-light-grey);
7
- }
8
-
9
- .hljs-emphasis {
10
- font-style: italic;
11
- }
12
-
13
- .hljs-strong {
14
- font-weight: bold;
15
- }
16
-
17
- .hljs-comment,
18
- .hljs-quote {
19
- color: var(--syntax-dark-grey);
20
- }
21
-
22
- .hljs-variable,
23
- .hljs-template-variable,
24
- .hljs-tag,
25
- .hljs-name,
26
- .hljs-selector-id,
27
- .hljs-selector-class,
28
- .hljs-regexp,
29
- .hljs-deletion {
30
- color: var(--syntax-red);
31
- }
32
-
33
- .hljs-number,
34
- .hljs-built_in,
35
- .hljs-literal,
36
- .hljs-type,
37
- .hljs-params,
38
- .hljs-meta,
39
- .hljs-link {
40
- color: var(--syntax-orange);
41
- }
42
-
43
- .hljs-attribute {
44
- color: var(--syntax-yellow);
45
- }
46
-
47
- .hljs-string,
48
- .hljs-symbol,
49
- .hljs-bullet,
50
- .hljs-addition {
51
- color: var(--syntax-green);
52
- }
53
-
54
- .hljs-title,
55
- .hljs-section {
56
- color: var(--syntax-blue);
57
- }
58
-
59
- .hljs-keyword,
60
- .hljs-selector-tag {
61
- color: var(--syntax-lilac);
62
- }
63
-
64
- .hljs-subst {
65
- color: var(--syntax-mid-grey);
66
- }
67
- }
1
+ @import "../utils/syntax-highlighter.css";
@@ -1,47 +1,17 @@
1
1
  import "./component.css";
2
- import hljs from "highlight.js/lib/core";
3
2
 
4
- import bash from "highlight.js/lib/languages/bash";
5
- import cpp from "highlight.js/lib/languages/cpp";
6
- import csharp from "highlight.js/lib/languages/csharp";
7
- import dart from "highlight.js/lib/languages/dart";
8
- import plaintext from "highlight.js/lib/languages/plaintext";
9
- import go from "highlight.js/lib/languages/go";
10
- import java from "highlight.js/lib/languages/java";
11
- import javascript from "highlight.js/lib/languages/javascript";
12
- import json from "highlight.js/lib/languages/json";
13
- import objectivec from "highlight.js/lib/languages/objectivec";
14
- import php from "highlight.js/lib/languages/php";
15
- import python from "highlight.js/lib/languages/python";
16
- import ruby from "highlight.js/lib/languages/ruby";
17
- import swift from "highlight.js/lib/languages/swift";
18
- import xml from "highlight.js/lib/languages/xml";
3
+ // Note: importing syntax-highlighter here means the component.js file will include
4
+ // all the language dependecies, creating a large a bundle. Prefer using the highlighter serverside.
5
+ import {
6
+ highlightSnippet,
7
+ registerDefaultLanguages,
8
+ } from "../utils/syntax-highlighter";
19
9
 
20
- // Supported languages need to be imported here
21
- // https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md
22
- const register = [
23
- { label: "", key: "plaintext", module: plaintext },
24
- { label: "JS", key: "javascript", module: javascript },
25
- { label: "Java", key: "java", module: java },
26
- { label: "Ruby", key: "ruby", module: ruby },
27
- { label: "Python", key: "python", module: python },
28
- { label: "PHP", key: "php", module: php },
29
- { label: "Shell", key: "bash", module: bash },
30
- { label: "C#", key: "cs", module: csharp },
31
- { label: "Go", key: "go", module: go },
32
- { label: "HTML", key: "xml", module: xml },
33
- { label: "C++", key: "cpp", module: cpp },
34
- { label: "Dart", key: "dart", module: dart },
35
- { label: "Swift", key: "swift", module: swift },
36
- { label: "Objective C", key: "objectivec", module: objectivec },
37
- { label: "Node.js", key: "javascript", module: javascript },
38
- { label: "JSON", key: "json", module: json },
39
- ];
10
+ import languagesRegistry from "../utils/syntax-highlighter-registry";
40
11
 
41
- // Initialize a sub-set of languages as used
42
- register.forEach(({ key, module }) => hljs.registerLanguage(key, module));
12
+ registerDefaultLanguages(languagesRegistry);
43
13
 
44
- function convertCodeToHTML(el) {
14
+ function highlightEl(el) {
45
15
  if (!el) throw "Missing code element";
46
16
 
47
17
  const pre = el.querySelector("pre");
@@ -51,14 +21,9 @@ function convertCodeToHTML(el) {
51
21
  if (!code || !pre || !language) throw "Malformed code element";
52
22
 
53
23
  const { innerHTML } = code;
54
- const html = hljs.highlight(innerHTML, { language }).value;
24
+ const html = highlightSnippet(language, innerHTML);
55
25
 
56
26
  code.innerHTML = html;
57
27
  }
58
28
 
59
- function highlight(language, snippet) {
60
- return hljs.highlight(snippet, { language }).value;
61
- }
62
-
63
- export { highlight };
64
- export default convertCodeToHTML;
29
+ export default highlightEl;
@@ -1,12 +1,16 @@
1
1
  import React from "react";
2
2
  import T from "prop-types";
3
3
 
4
- import "./component.css";
5
- import { highlight } from "./component.js";
4
+ import "../utils/syntax-highlighter.css";
5
+ import { highlightSnippet, registerDefaultLanguages } from "../utils/syntax-highlighter";
6
+ import languagesRegistry from "../utils/syntax-highlighter-registry";
7
+
8
+ registerDefaultLanguages(languagesRegistry);
6
9
 
7
10
  const Code = ({ language, snippet, textSize = "ui-text-code", padding = "p-32", additionalCSS = "" }) => {
8
- const HTMLraw = highlight(language, `${snippet}`.trim());
11
+ const HTMLraw = highlightSnippet(language, `${snippet}`.trim());
9
12
  const className = `language-${language} ${textSize}`;
13
+
10
14
  return (
11
15
  <div className={`hljs overflow-auto ${padding} ${additionalCSS}`} data-id="code">
12
16
  <pre lang={language}>
@@ -0,0 +1,114 @@
1
+ import React, { createContext, useContext, useState, useEffect, useRef } from "react";
2
+ import T from "prop-types";
3
+ import Icon from "../Icon/component.jsx";
4
+
5
+ const DropdownMenuContext = createContext();
6
+
7
+ const DropdownMenu = ({ children }) => {
8
+ const [isOpen, setOpen] = useState(false);
9
+ const ref = useRef(null);
10
+
11
+ useEffect(() => {
12
+ const clickHandler = (e) => {
13
+ if (ref?.current?.contains(e.target)) return;
14
+ setOpen(false);
15
+ };
16
+
17
+ document.addEventListener("click", clickHandler);
18
+
19
+ return () => {
20
+ document.removeEventListener("click", clickHandler);
21
+ };
22
+ }, []);
23
+
24
+ return (
25
+ <DropdownMenuContext.Provider value={{ isOpen, setOpen }}>
26
+ <div id="dropdown-menu" className="relative" ref={ref}>
27
+ {children}
28
+ </div>
29
+ </DropdownMenuContext.Provider>
30
+ );
31
+ };
32
+
33
+ DropdownMenu.propTypes = {
34
+ children: T.node,
35
+ };
36
+
37
+ const Trigger = ({ children, additionalTriggerCSS = "" }) => {
38
+ const { isOpen, setOpen } = useContext(DropdownMenuContext);
39
+
40
+ return (
41
+ <button
42
+ id="menu-trigger"
43
+ onClick={() => setOpen(!isOpen)}
44
+ className={`${additionalTriggerCSS} flex items-center p-8 ml-8 group hover:text-gui-hover hover:bg-light-grey active:text-gui-active focus:text-gui-focus focus:outline-none rounded-lg`}
45
+ >
46
+ <span className="leading-normal">{children}</span>
47
+ <Icon
48
+ name="icon-gui-disclosure-arrow"
49
+ color="text-cool-black"
50
+ size="1.25rem"
51
+ additionalCSS="transform rotate-90 group-hover:text-gui-hover group-active:text-gui-active group-focus:text-gui-focus"
52
+ />
53
+ </button>
54
+ );
55
+ };
56
+
57
+ <DropdownMenu.Trigger className="list of names">Click me</DropdownMenu.Trigger>;
58
+
59
+ Trigger.propTypes = {
60
+ children: T.node,
61
+ additionalTriggerCSS: T.string,
62
+ };
63
+
64
+ const Content = ({ children, anchorPosition = "right", additionalContentCSS }) => {
65
+ const { isOpen } = useContext(DropdownMenuContext);
66
+
67
+ if (!isOpen) {
68
+ return null;
69
+ }
70
+
71
+ const anchorPositionClasses = anchorPosition === "right" ? "right-0" : "left-0";
72
+
73
+ return (
74
+ <div
75
+ id="menu-content"
76
+ className={`${additionalContentCSS} absolute p-8 z-10 border border-mid-grey bg-white rounded shadow-container ${anchorPositionClasses}`}
77
+ style={{ minWidth: 275, top: 44 }}
78
+ >
79
+ {children}
80
+ </div>
81
+ );
82
+ };
83
+
84
+ Content.propTypes = {
85
+ children: T.node,
86
+ anchorPosition: T.string,
87
+ additionalContentCSS: T.string,
88
+ };
89
+
90
+ const Link = ({ url, title, subtitle, iconName, children }) => {
91
+ return (
92
+ <a href={url} className="menu-link group block p-8 hover:bg-light-grey hover:text-cool-black rounded">
93
+ <p className="mb-4">
94
+ {title}
95
+ {iconName ? <Icon name={iconName} size="1rem" color="text-cool-black" additionalCSS="align-middle ml-8 relative -top-1 -left-4" /> : null}
96
+ </p>
97
+ {subtitle ? <p className="text-p3 mb-16 text-dark-grey">{subtitle}</p> : null}
98
+ {children}
99
+ </a>
100
+ );
101
+ };
102
+
103
+ Link.propTypes = {
104
+ url: T.string,
105
+ title: T.string,
106
+ subtitle: T.string,
107
+ iconName: T.string,
108
+ children: T.node,
109
+ };
110
+
111
+ DropdownMenu.Trigger = Trigger;
112
+ DropdownMenu.Content = Content;
113
+ DropdownMenu.Link = Link;
114
+ export default DropdownMenu;
@@ -46,7 +46,7 @@
46
46
  </ul>
47
47
  </span>
48
48
  <span class="flex-0">
49
- <%= link_to 'Start with a free account', abs_url("/sign-up"), class: "ui-btn-secondary self-start mt-24" %>
49
+ <%= link_to 'Start building', abs_url("/sign-up"), class: "ui-btn-secondary self-start mt-24" %>
50
50
  </span>
51
51
  </div>
52
52
  </div>
@@ -56,6 +56,15 @@
56
56
  </div>
57
57
  <% end %>
58
58
  </li>
59
+ <li>
60
+ <%= link_to abs_url("/integrations"), class: "ui-meganav-media-with-image group" do %>
61
+ <%= render(AblyUi::Core::Icon.new(name: "icon-display-integrations-col", size: "2.5rem")) %>
62
+ <div class="flex flex-col justify-center">
63
+ <p class="ui-meganav-media-heading">Integrations</p>
64
+ <p class="ui-meganav-media-copy">Find out more about Ably integrations. </p>
65
+ </div>
66
+ <% end %>
67
+ </li>
59
68
  </ul>
60
69
  </div>
61
70
 
@@ -62,6 +62,15 @@ const MeganavContentDevelopers = ({ absUrl }) => (
62
62
  </div>
63
63
  </a>
64
64
  </li>
65
+ <li>
66
+ <a href={absUrl("/integrations")} className="ui-meganav-media-with-image group">
67
+ <Icon name="icon-display-integrations-col" size="2.5rem" />
68
+ <div className="flex flex-col justify-center">
69
+ <p className="ui-meganav-media-heading">Integrations</p>
70
+ <p className="ui-meganav-media-copy">Find out more about Ably integrations. </p>
71
+ </div>
72
+ </a>
73
+ </li>
65
74
  </ul>
66
75
  </div>
67
76
 
@@ -58,7 +58,7 @@
58
58
  </li>
59
59
  <li>
60
60
  <%= link_to abs_url("/solutions/fintech"), class: "ui-meganav-media group" do %>
61
- <p class="ui-meganav-media-heading">Fintech</p>
61
+ <p class="ui-meganav-media-heading">FinTech</p>
62
62
  <p class="ui-meganav-media-copy">Deliver personalised financial data in realtime.</p>
63
63
  <% end %>
64
64
  </li>
@@ -64,7 +64,7 @@ const MeganavContentUseCases = ({ absUrl }) => (
64
64
  </li>
65
65
  <li>
66
66
  <a href={absUrl("/solutions/fintech")} className="ui-meganav-media group">
67
- <p className="ui-meganav-media-heading">Fintech</p>
67
+ <p className="ui-meganav-media-heading">FinTech</p>
68
68
  <p className="ui-meganav-media-copy">Deliver personalised financial data in realtime.</p>
69
69
  </a>
70
70
  </li>
@@ -12,7 +12,7 @@
12
12
  <%= link_to 'Publish/Subscribe Messaging', abs_url("/docs/core-features/pubsub"), class: "ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus" %>
13
13
  </li>
14
14
  <li class="py-12 pl-8 flex-shrink-0">
15
- <%= link_to 'Platform', abs_url("/docs/how-ably-works"), class: "ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus" %>
15
+ <%= link_to 'Platform', abs_url("/platform"), class: "ui-text-p2 hover:text-gui-hover active:text-gui-active focus:text-gui-focus" %>
16
16
  </li>
17
17
  </ul>
18
18
 
@@ -0,0 +1,3 @@
1
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.6483 7.36875H9.1803V10.8492H14.0178C13.8092 11.9742 13.1764 12.9258 12.2225 13.5633C11.4162 14.1023 10.3873 14.4211 9.17795 14.4211C6.83655 14.4211 4.85608 12.8391 4.14827 10.7133C3.97014 10.1742 3.86702 9.59766 3.86702 9.00469C3.86702 8.41172 3.97014 7.83516 4.14827 7.29609C4.85842 5.17266 6.83889 3.59063 9.1803 3.59063C10.4998 3.59063 11.6834 4.04531 12.6162 4.93594L15.1944 2.35547C13.6358 0.902344 11.6037 0.0117188 9.1803 0.0117188C5.66702 0.0117188 2.62717 2.02734 1.14827 4.96641C0.538892 6.18047 0.192017 7.55391 0.192017 9.00703C0.192017 10.4602 0.538892 11.8312 1.14827 13.0453C2.62717 15.9844 5.66702 18 9.1803 18C11.6084 18 13.6428 17.1938 15.1287 15.8203C16.828 14.2547 17.81 11.9484 17.81 9.20859C17.81 8.57109 17.7537 7.95937 17.6483 7.36875Z" fill="currentColor" />
3
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7.69985 7.70029C3.40409 11.9961 3.18585 18.7426 7.21241 22.7692L11.9425 27.4993L27.4988 11.9429L22.7688 7.21285C18.7422 3.18629 11.9956 3.40453 7.69985 7.70029Z" stroke="#03020D" stroke-width="1.5" stroke-linejoin="round"/>
3
+ <path d="M45.2129 45.2131L42.3844 42.3847" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M40.4514 40.451C35.8956 45.0068 28.6731 45.2897 24.3219 40.9385L19.5918 36.2084C19.2989 35.9155 19.2989 35.4406 19.5918 35.1477L35.1482 19.5914C35.441 19.2985 35.9159 19.2985 36.2088 19.5914L40.9389 24.3215C45.2902 28.6727 45.0073 35.8952 40.4514 40.451Z" fill="#FF5416"/>
5
+ <path d="M2.78647 2.78662L7.73622 7.73637" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M23.2925 16.2217L28.2423 21.1714" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
7
+ <path d="M16.2215 23.2927L21.1712 28.2425" stroke="#03020D" stroke-width="1.37459" stroke-linecap="round" stroke-linejoin="round"/>
8
+ </svg>
@@ -0,0 +1,61 @@
1
+ // This file can be used in the browser, but because of the weight of all the language
2
+ // definitions, preferably it should be used on the server.
3
+
4
+ import bash from "highlight.js/lib/languages/bash";
5
+ import cpp from "highlight.js/lib/languages/cpp";
6
+ import csharp from "highlight.js/lib/languages/csharp";
7
+ import css from "highlight.js/lib/languages/css";
8
+ import dart from "highlight.js/lib/languages/dart";
9
+ import dos from "highlight.js/lib/languages/dos";
10
+ import diff from "highlight.js/lib/languages/diff";
11
+ import erlang from "highlight.js/lib/languages/erlang";
12
+ import elixir from "highlight.js/lib/languages/elixir";
13
+ import plaintext from "highlight.js/lib/languages/plaintext";
14
+ import go from "highlight.js/lib/languages/go";
15
+ import http from "highlight.js/lib/languages/http";
16
+ import java from "highlight.js/lib/languages/java";
17
+ import javascript from "highlight.js/lib/languages/javascript";
18
+ import typescript from "highlight.js/lib/languages/typescript";
19
+ import json from "highlight.js/lib/languages/json";
20
+ import objectivec from "highlight.js/lib/languages/objectivec";
21
+ import php from "highlight.js/lib/languages/php";
22
+ import python from "highlight.js/lib/languages/python";
23
+ import ruby from "highlight.js/lib/languages/ruby";
24
+ import swift from "highlight.js/lib/languages/swift";
25
+ import sql from "highlight.js/lib/languages/sql";
26
+ import xml from "highlight.js/lib/languages/xml";
27
+ import yaml from "highlight.js/lib/languages/yaml";
28
+ import curl from "highlightjs-curl/src/languages/curl";
29
+
30
+ const registry = [
31
+ { label: "Text", key: "text", module: plaintext },
32
+ { label: "JS", key: "javascript", module: javascript },
33
+ { label: "TS", key: "typescript", module: typescript },
34
+ { label: "Java", key: "java", module: java },
35
+ { label: "Ruby", key: "ruby", module: ruby },
36
+ { label: "Python", key: "python", module: python },
37
+ { label: "PHP", key: "php", module: php },
38
+ { label: "Shell", key: "bash", module: bash },
39
+ { label: "C#", key: "cs", module: csharp },
40
+ { label: "CSS", key: "css", module: css },
41
+ { label: "Go", key: "go", module: go },
42
+ { label: "HTML", key: "xml", module: xml },
43
+ { label: "HTTP", key: "http", module: http },
44
+ { label: "C++", key: "cpp", module: cpp },
45
+ { label: "Dart", key: "dart", module: dart },
46
+ { label: "Swift", key: "swift", module: swift },
47
+ { label: "Objective C", key: "objectivec", module: objectivec },
48
+ { label: "Node.js", key: "javascript", module: javascript },
49
+ { label: "JSON", key: "json", module: json },
50
+ { label: "DOS", key: "dos", module: dos },
51
+ { label: "YAML", key: "yaml", module: yaml },
52
+ { label: "Erlang", key: "erlang", module: erlang },
53
+ { label: "Elixir", key: "elixir", module: elixir },
54
+ { label: "Diff", key: "diff", module: diff },
55
+ { label: "SQL", key: "sql", module: sql },
56
+ { label: "cURL", key: "curl", module: curl },
57
+ { label: "HTML", key: "html", module: xml },
58
+ { label: "XML", key: "xml", module: xml },
59
+ ];
60
+
61
+ export default registry;
@@ -0,0 +1,69 @@
1
+ @layer base {
2
+ @import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,600;0,700;1,600;1,700&display=swap");
3
+ }
4
+
5
+ @layer components {
6
+ .hljs {
7
+ background: var(--syntax-black);
8
+ color: var(--syntax-light-grey);
9
+ }
10
+
11
+ .hljs-emphasis {
12
+ @apply italic;
13
+ }
14
+
15
+ .hljs-strong {
16
+ @apply font-bold;
17
+ }
18
+
19
+ .hljs-comment,
20
+ .hljs-quote {
21
+ color: var(--syntax-dark-grey);
22
+ }
23
+
24
+ .hljs-variable,
25
+ .hljs-template-variable,
26
+ .hljs-tag,
27
+ .hljs-name,
28
+ .hljs-selector-id,
29
+ .hljs-selector-class,
30
+ .hljs-regexp,
31
+ .hljs-deletion {
32
+ color: var(--syntax-red);
33
+ }
34
+
35
+ .hljs-number,
36
+ .hljs-built_in,
37
+ .hljs-literal,
38
+ .hljs-type,
39
+ .hljs-params,
40
+ .hljs-meta,
41
+ .hljs-link {
42
+ color: var(--syntax-orange);
43
+ }
44
+
45
+ .hljs-attribute {
46
+ color: var(--syntax-yellow);
47
+ }
48
+
49
+ .hljs-string,
50
+ .hljs-symbol,
51
+ .hljs-bullet,
52
+ .hljs-addition {
53
+ color: var(--syntax-green);
54
+ }
55
+
56
+ .hljs-title,
57
+ .hljs-section {
58
+ color: var(--syntax-blue);
59
+ }
60
+
61
+ .hljs-keyword,
62
+ .hljs-selector-tag {
63
+ color: var(--syntax-lilac);
64
+ }
65
+
66
+ .hljs-subst {
67
+ color: var(--syntax-mid-grey);
68
+ }
69
+ }
@@ -0,0 +1,98 @@
1
+ import hljs from "highlight.js/lib/core";
2
+
3
+ // Map certain frameworks, protocols etc to available langauage packs
4
+ const languageToHighlightKey = (lang) => {
5
+ let id;
6
+
7
+ if (!lang) {
8
+ lang = "text";
9
+ }
10
+
11
+ switch (lang.toLowerCase()) {
12
+ case "android":
13
+ id = "java";
14
+ break;
15
+
16
+ case ".net":
17
+ case "net":
18
+ case "dotnet":
19
+ case "csharp":
20
+ case "c#":
21
+ id = "cs";
22
+ break;
23
+
24
+ case "objc":
25
+ case "objective c":
26
+ id = "objectivec";
27
+ break;
28
+
29
+ case "laravel":
30
+ id = "php";
31
+ break;
32
+
33
+ case "flutter":
34
+ id = "dart";
35
+ break;
36
+
37
+ case "node.js":
38
+ case "js":
39
+ id = "javascript";
40
+ break;
41
+
42
+ case "ts":
43
+ id = "typescript";
44
+ break;
45
+
46
+ case "shell":
47
+ case "fh":
48
+ case "sh":
49
+ id = "bash";
50
+ break;
51
+
52
+ case "https":
53
+ case "http":
54
+ case "txt":
55
+ case "plaintext":
56
+ id = "text";
57
+ break;
58
+
59
+ case "cmd":
60
+ case "bat":
61
+ id = "dos";
62
+ break;
63
+
64
+ case "yml":
65
+ id = "yaml";
66
+ break;
67
+
68
+ case "erl":
69
+ id = "erlang";
70
+ break;
71
+
72
+ case "patch":
73
+ id = "diff";
74
+ break;
75
+
76
+ case "svg":
77
+ id = "xml";
78
+ break;
79
+
80
+ default:
81
+ break;
82
+ }
83
+
84
+ return id || lang;
85
+ };
86
+
87
+ const registerDefaultLanguages = (register) => {
88
+ register.forEach(({ key, module }) => hljs.registerLanguage(key, module));
89
+ };
90
+
91
+ const highlightSnippet = (languageKeyword, snippet) => {
92
+ const language = languageToHighlightKey(languageKeyword);
93
+ if (typeof snippet !== "string" || !snippet || !language) return;
94
+
95
+ return hljs.highlight(snippet, { language }).value;
96
+ };
97
+
98
+ export { highlightSnippet, languageToHighlightKey, registerDefaultLanguages };
package/core/.DS_Store DELETED
Binary file
Binary file