apiuikit 0.3.0 → 1.0.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 (149) hide show
  1. package/README.md +66 -7
  2. package/dist/LinkedInExtension-6xekO5bX.cjs +1 -0
  3. package/dist/LinkedInExtension-BL-4T9tt.js +21 -0
  4. package/dist/LogoExtension-BOYrY_RE.cjs +1 -0
  5. package/dist/LogoExtension-HOlSsQf-.js +27 -0
  6. package/dist/XExtension-GyRtdHLL.js +23 -0
  7. package/dist/XExtension-jAiATfg-.cjs +1 -0
  8. package/dist/apiuikit.cjs.js +1 -1
  9. package/dist/apiuikit.css +1 -1
  10. package/dist/apiuikit.es.js +24 -17
  11. package/dist/c-Bz1-FJiA.js +277 -0
  12. package/dist/c-C_Sx7N-F.cjs +1 -0
  13. package/dist/clojure-DWYEZwCD.cjs +1 -0
  14. package/dist/clojure-aY2138WD.js +135 -0
  15. package/dist/components/Authorization.d.ts +28 -17
  16. package/dist/components/ChannelAddress.d.ts +8 -2
  17. package/dist/components/CodeBlock.d.ts +4 -1
  18. package/dist/components/CodeSamples.d.ts +12 -0
  19. package/dist/components/CollapsiblePanel.d.ts +24 -0
  20. package/dist/components/CopyMarkdownButton.d.ts +15 -0
  21. package/dist/components/Examples.d.ts +4 -2
  22. package/dist/components/InfoMetadata.d.ts +21 -2
  23. package/dist/components/Markdown.d.ts +2 -0
  24. package/dist/components/MarkdownExportMenu.d.ts +13 -0
  25. package/dist/components/MethodBadge.d.ts +14 -0
  26. package/dist/components/Navigation/AsyncAPINavigation.d.ts +28 -0
  27. package/dist/components/Navigation/Navigation.d.ts +58 -0
  28. package/dist/components/Navigation/OpenAPINavigation.d.ts +22 -0
  29. package/dist/components/Navigation/SpecNavigation.d.ts +25 -0
  30. package/dist/components/Navigation/index.d.ts +4 -0
  31. package/dist/components/Navigation/sharedSections.d.ts +10 -0
  32. package/dist/components/RenderExtensions.d.ts +28 -0
  33. package/dist/components/Section.d.ts +3 -1
  34. package/dist/components/ServerAddressBanner.d.ts +16 -0
  35. package/dist/components/SidePanel.d.ts +2 -0
  36. package/dist/components/Tabs.d.ts +3 -1
  37. package/dist/components/schema/SchemaTab.d.ts +24 -3
  38. package/dist/components/tests/Authorization.test.d.ts +1 -0
  39. package/dist/components/tests/Bindings.test.d.ts +1 -0
  40. package/dist/components/tests/CodeBlock.test.d.ts +1 -0
  41. package/dist/components/tests/CodeSamples.test.d.ts +1 -0
  42. package/dist/components/tests/CopyMarkdownButton.test.d.ts +1 -0
  43. package/dist/components/tests/MarkdownExportMenu.test.d.ts +1 -0
  44. package/dist/components/tests/RenderExtensions.test.d.ts +1 -0
  45. package/dist/config/config.d.ts +10 -0
  46. package/dist/containers/AsyncAPI/AsyncAPI.d.ts +12 -6
  47. package/dist/containers/AsyncAPI/AsyncAPIRenderer.d.ts +9 -0
  48. package/dist/containers/Information/InformationSection.d.ts +22 -0
  49. package/dist/containers/Information/OpenAPIInformation.d.ts +9 -0
  50. package/dist/containers/OpenAPI/Layout.d.ts +7 -0
  51. package/dist/containers/OpenAPI/OpenAPI.d.ts +18 -0
  52. package/dist/containers/OpenAPI/OpenAPIDocumentProvider.d.ts +13 -0
  53. package/dist/containers/OpenAPI/OpenAPIRenderer.d.ts +17 -0
  54. package/dist/containers/OpenAPI/tests/OpenAPI.test.d.ts +1 -0
  55. package/dist/containers/OpenAPI/tests/OpenAPIRenderer.test.d.ts +1 -0
  56. package/dist/containers/Operation/Operations.d.ts +2 -1
  57. package/dist/containers/Path/OperationCallbacks.d.ts +37 -0
  58. package/dist/containers/Path/PathOperation.d.ts +21 -0
  59. package/dist/containers/Path/Paths.d.ts +16 -0
  60. package/dist/containers/Path/ResponseLinks.d.ts +21 -0
  61. package/dist/containers/Path/tests/PathOperation.test.d.ts +1 -0
  62. package/dist/containers/Server/OpenAPIServer.d.ts +4 -0
  63. package/dist/containers/Server/OpenAPIServers.d.ts +13 -0
  64. package/dist/contants.d.ts +7 -0
  65. package/dist/contexts/useSpec.d.ts +30 -6
  66. package/dist/crystal-BcGgviMR.cjs +1 -0
  67. package/dist/crystal-BtD5fR4q.js +283 -0
  68. package/dist/csharp-AnFv7wyC.js +382 -0
  69. package/dist/csharp-yuAGIuP4.cjs +1 -0
  70. package/dist/go-BpetKc7b.cjs +1 -0
  71. package/dist/go-CkZ9_bn0.js +151 -0
  72. package/dist/helpers/codeSamples.d.ts +92 -0
  73. package/dist/helpers/exampleSchema.d.ts +19 -0
  74. package/dist/helpers/hljsLanguages.d.ts +6 -0
  75. package/dist/helpers/openapiParser.d.ts +10 -0
  76. package/dist/helpers/openapiSearchIndex.d.ts +3 -0
  77. package/dist/helpers/resolveDocument.d.ts +8 -0
  78. package/dist/helpers/runtimeExpression.d.ts +15 -0
  79. package/dist/helpers/schemaExample.d.ts +9 -0
  80. package/dist/helpers/searchIndex.d.ts +5 -2
  81. package/dist/helpers/tests/codeSamples.test.d.ts +1 -0
  82. package/dist/helpers/tests/exampleSchema.test.d.ts +1 -0
  83. package/dist/helpers/tests/openapiSearchIndex.test.d.ts +1 -0
  84. package/dist/helpers/tests/toMarkdown.test.d.ts +1 -0
  85. package/dist/helpers/toMarkdown.d.ts +20 -0
  86. package/dist/hooks/useDocumentProviderValue.d.ts +27 -0
  87. package/dist/hooks/useFuseSearch.d.ts +14 -0
  88. package/dist/hooks/useOpenAPISearch.d.ts +9 -0
  89. package/dist/hooks/useSearchResultFocus.d.ts +18 -0
  90. package/dist/hooks/useSpecLayoutController.d.ts +51 -0
  91. package/dist/hooks/useSpecSearch.d.ts +2 -6
  92. package/dist/http--XH4hLDt.cjs +1 -0
  93. package/dist/http-DKeNlJKS.js +85 -0
  94. package/dist/icons/Copy.d.ts +6 -0
  95. package/dist/icons/Info.d.ts +5 -0
  96. package/dist/icons/Search.d.ts +3 -0
  97. package/dist/{index-D7GelPk0.cjs → index-ArzwV232.cjs} +6 -6
  98. package/dist/index-Bh4OKjMA.js +25412 -0
  99. package/dist/index-C278WDNb.cjs +139 -0
  100. package/dist/index-C4I0xC5G.js +17544 -0
  101. package/dist/index-DuW5iShy.cjs +177 -0
  102. package/dist/index-PtAFPDfk.js +18851 -0
  103. package/dist/index.d.ts +7 -0
  104. package/dist/java-BIk0G-rH.cjs +1 -0
  105. package/dist/java-BicX26Pg.js +240 -0
  106. package/dist/kotlin-BwB8b-YX.js +242 -0
  107. package/dist/kotlin-kGuORR5a.cjs +2 -0
  108. package/dist/objectivec-CnyrJ13Z.js +237 -0
  109. package/dist/objectivec-CoeV81Tz.cjs +1 -0
  110. package/dist/ocaml-0j7KDjso.cjs +1 -0
  111. package/dist/ocaml-T8IqWCjo.js +67 -0
  112. package/dist/php-BL35ZHWM.js +566 -0
  113. package/dist/php-DF4zG2hq.cjs +2 -0
  114. package/dist/powershell-CvydS3ek.cjs +1 -0
  115. package/dist/powershell-DuhUKWoO.js +236 -0
  116. package/dist/protoToJsonSchema-AciPTlBK.cjs +83 -0
  117. package/dist/protoToJsonSchema-D1lojrO3.js +6131 -0
  118. package/dist/{protobufSchemaParser-D_2rEsD4.cjs → protobufSchemaParser-7SgmMhQd.cjs} +1 -1
  119. package/dist/{protobufSchemaParser-Cj2WOp05.js → protobufSchemaParser-BohWo_pY.js} +2 -2
  120. package/dist/public/createSectionRoot.d.ts +30 -0
  121. package/dist/public/openapiSections.d.ts +26 -0
  122. package/dist/public/sections.d.ts +6 -3
  123. package/dist/r-B8fCBydS.js +207 -0
  124. package/dist/r-CYaZnHkA.cjs +1 -0
  125. package/dist/ruby-CvOid-1s.js +388 -0
  126. package/dist/ruby-nPcbuC2a.cjs +1 -0
  127. package/dist/rust-BocnJ3Ns.js +305 -0
  128. package/dist/rust-DKnYCg2f.cjs +1 -0
  129. package/dist/stories/AsyncAPI.stories.d.ts +6 -0
  130. package/dist/stories/AsyncAPIRenderer.stories.d.ts +6 -0
  131. package/dist/stories/Messages.stories.d.ts +1 -0
  132. package/dist/stories/Operations.stories.d.ts +6 -0
  133. package/dist/stories/SchemaTab.stories.d.ts +1 -0
  134. package/dist/stories/SchemaTree.stories.d.ts +1 -0
  135. package/dist/stories/Server.stories.d.ts +1 -0
  136. package/dist/stories/documentContextDecorator.d.ts +2 -2
  137. package/dist/stories/noCanvasDocsPage.d.ts +9 -0
  138. package/dist/swift-C35Eof-I.js +799 -0
  139. package/dist/swift-CAnH__EC.cjs +1 -0
  140. package/dist/types/openapi.d.ts +85 -0
  141. package/package.json +16 -3
  142. package/dist/components/Navigation.d.ts +0 -28
  143. package/dist/icons/SideBar.d.ts +0 -6
  144. package/dist/index-Bad1aEIj.js +0 -11352
  145. package/dist/index-CzcxQGxP.js +0 -25414
  146. package/dist/index-gn5KpvCL.cjs +0 -73
  147. package/dist/protoToJsonSchema-8Mm10CIx.cjs +0 -83
  148. package/dist/protoToJsonSchema-BJpwl2Am.js +0 -6174
  149. package/dist/vite.svg +0 -1
@@ -1,16 +1,40 @@
1
- type AsyncAPIDocument = Record<string, unknown>;
2
- interface AsyncAPIContextValue {
3
- document: AsyncAPIDocument;
1
+ import { AsyncAPIDocumentData } from '../types/schema';
2
+ import { OpenAPIDocumentData } from '../types/openapi';
3
+ /** Which spec produced the ambient document. The discriminant of DocumentContextValue. */
4
+ export type SpecType = "asyncapi" | "openapi";
5
+ interface DocumentContextBase {
4
6
  /** Resolves a JSON Pointer $ref string to the object it references in the document. */
5
7
  deref: (ref: string) => unknown;
6
8
  portalHost: HTMLElement | null;
7
- /** The Layout component's own root element used to scope viewport-fixed overlays (e.g. SidePanel) to where <AsyncAPI> is actually embedded, rather than the full browser viewport. */
9
+ /** The Layout component's own root element, used to scope viewport-fixed overlays (e.g. SidePanel) to where the <AsyncAPI> or <OpenAPI> widget is actually embedded, rather than the full browser viewport. */
8
10
  rootElement: HTMLElement | null;
9
11
  /** Whether schema tree nodes start expanded by default. Defaults to false. */
10
12
  defaultSchemaExpanded?: boolean;
11
13
  /** Resolved schema tree depth-line colors (config-provided or default), cycled by nesting depth. */
12
14
  depthColors: string[];
15
+ /** Whether to render known x-* spec extensions (see the `x-tensions` catalog). Defaults to true. */
16
+ showExtensions: boolean;
17
+ /** OpenAPI only: whether to render per-operation code samples (cURL/JS/Python). Defaults to true. */
18
+ showCodeSamples: boolean;
13
19
  }
14
- export declare const AsyncAPIDocumentContext: import('react').Context<AsyncAPIContextValue | null>;
15
- export declare const useAsyncAPIDocument: () => AsyncAPIContextValue;
20
+ export interface AsyncAPIDocumentContextValue extends DocumentContextBase {
21
+ specType: "asyncapi";
22
+ document: AsyncAPIDocumentData;
23
+ }
24
+ export interface OpenAPIDocumentContextValue extends DocumentContextBase {
25
+ specType: "openapi";
26
+ document: OpenAPIDocumentData;
27
+ }
28
+ /**
29
+ * Discriminated on `specType`: checking it narrows `document` to the matching
30
+ * spec's shape, so spec-specific consumers don't need to cast. Spec-agnostic
31
+ * consumers that only need deref/portalHost/rootElement/depthColors (SidePanel,
32
+ * SearchPanel, SchemaTree, ExpandToggle, ...) work under any provider without
33
+ * looking at the discriminant.
34
+ */
35
+ export type DocumentContextValue = AsyncAPIDocumentContextValue | OpenAPIDocumentContextValue;
36
+ export declare const DocumentContext: import('react').Context<DocumentContextValue | null>;
37
+ export declare const useDocumentContext: () => DocumentContextValue;
38
+ export declare const AsyncAPIDocumentContext: import('react').Context<DocumentContextValue | null>;
39
+ export declare const useAsyncAPIDocument: () => DocumentContextValue;
16
40
  export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(e){const i="(_?[ui](8|16|32|64|128))?",l="(_?f(32|64))?",g="[a-zA-Z_]\\w*[!?=]?",s="[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?",t="[A-Za-z_]\\w*(::\\w+)*(\\?|!)?",c={$pattern:g,keyword:"abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? return require select self sizeof struct super then type typeof union uninitialized unless until verbatim when while with yield __DIR__ __END_LINE__ __FILE__ __LINE__",literal:"false nil true"},a={className:"subst",begin:/#\{/,end:/\}/,keywords:c},d={className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},b={className:"template-variable",variants:[{begin:"\\{\\{",end:"\\}\\}"},{begin:"\\{%",end:"%\\}"}],keywords:c};function n(S,A){const r=[{begin:S,end:A}];return r[0].contains=r,r}const _={className:"string",contains:[e.BACKSLASH_ESCAPE,a],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:"%[Qwi]?\\(",end:"\\)",contains:n("\\(","\\)")},{begin:"%[Qwi]?\\[",end:"\\]",contains:n("\\[","\\]")},{begin:"%[Qwi]?\\{",end:/\}/,contains:n(/\{/,/\}/)},{begin:"%[Qwi]?<",end:">",contains:n("<",">")},{begin:"%[Qwi]?\\|",end:"\\|"},{begin:/<<-\w+$/,end:/^\s*\w+$/}],relevance:0},E={className:"string",variants:[{begin:"%q\\(",end:"\\)",contains:n("\\(","\\)")},{begin:"%q\\[",end:"\\]",contains:n("\\[","\\]")},{begin:"%q\\{",end:/\}/,contains:n(/\{/,/\}/)},{begin:"%q<",end:">",contains:n("<",">")},{begin:"%q\\|",end:"\\|"},{begin:/<<-'\w+'$/,end:/^\s*\w+$/}],relevance:0},u={begin:"(?!%\\})("+e.RE_STARTERS_RE+"|\\n|\\b(case|if|select|unless|until|when|while)\\b)\\s*",keywords:"case if select unless until when while",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,a],variants:[{begin:"//[a-z]*",relevance:0},{begin:"/(?!\\/)",end:"/[a-z]*"}]}],relevance:0},T={className:"regexp",contains:[e.BACKSLASH_ESCAPE,a],variants:[{begin:"%r\\(",end:"\\)",contains:n("\\(","\\)")},{begin:"%r\\[",end:"\\]",contains:n("\\[","\\]")},{begin:"%r\\{",end:/\}/,contains:n(/\{/,/\}/)},{begin:"%r<",end:">",contains:n("<",">")},{begin:"%r\\|",end:"\\|"}],relevance:0},N={className:"meta",begin:"@\\[",end:"\\]",contains:[e.inherit(e.QUOTE_STRING_MODE,{className:"string"})]},o=[b,_,E,T,u,N,d,e.HASH_COMMENT_MODE,{className:"class",beginKeywords:"class module struct",end:"$|;",illegal:/=/,contains:[e.HASH_COMMENT_MODE,e.inherit(e.TITLE_MODE,{begin:t}),{begin:"<"}]},{className:"class",beginKeywords:"lib enum union",end:"$|;",illegal:/=/,contains:[e.HASH_COMMENT_MODE,e.inherit(e.TITLE_MODE,{begin:t})]},{beginKeywords:"annotation",end:"$|;",illegal:/=/,contains:[e.HASH_COMMENT_MODE,e.inherit(e.TITLE_MODE,{begin:t})],relevance:2},{className:"function",beginKeywords:"def",end:/\B\b/,contains:[e.inherit(e.TITLE_MODE,{begin:s,endsParent:!0})]},{className:"function",beginKeywords:"fun macro",end:/\B\b/,contains:[e.inherit(e.TITLE_MODE,{begin:s,endsParent:!0})],relevance:2},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":",contains:[_,{begin:s}],relevance:0},{className:"number",variants:[{begin:"\\b0b([01_]+)"+i},{begin:"\\b0o([0-7_]+)"+i},{begin:"\\b0x([A-Fa-f0-9_]+)"+i},{begin:"\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?"+l+"(?!_)"},{begin:"\\b([1-9][0-9_]*|0)"+i}],relevance:0}];return a.contains=o,b.contains=o.slice(1),{name:"Crystal",aliases:["cr"],keywords:c,contains:o}}exports.default=m;
@@ -0,0 +1,283 @@
1
+ function S(n) {
2
+ const i = "(_?[ui](8|16|32|64|128))?", g = "(_?f(32|64))?", l = "[a-zA-Z_]\\w*[!?=]?", s = "[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?", t = "[A-Za-z_]\\w*(::\\w+)*(\\?|!)?", c = {
3
+ $pattern: l,
4
+ keyword: "abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? return require select self sizeof struct super then type typeof union uninitialized unless until verbatim when while with yield __DIR__ __END_LINE__ __FILE__ __LINE__",
5
+ literal: "false nil true"
6
+ }, a = {
7
+ className: "subst",
8
+ begin: /#\{/,
9
+ end: /\}/,
10
+ keywords: c
11
+ }, d = {
12
+ // negative-look forward attemps to prevent false matches like:
13
+ // @ident@ or $ident$ that might indicate this is not ruby at all
14
+ className: "variable",
15
+ begin: "(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"
16
+ }, b = {
17
+ className: "template-variable",
18
+ variants: [
19
+ {
20
+ begin: "\\{\\{",
21
+ end: "\\}\\}"
22
+ },
23
+ {
24
+ begin: "\\{%",
25
+ end: "%\\}"
26
+ }
27
+ ],
28
+ keywords: c
29
+ };
30
+ function e(A, w) {
31
+ const r = [
32
+ {
33
+ begin: A,
34
+ end: w
35
+ }
36
+ ];
37
+ return r[0].contains = r, r;
38
+ }
39
+ const _ = {
40
+ className: "string",
41
+ contains: [
42
+ n.BACKSLASH_ESCAPE,
43
+ a
44
+ ],
45
+ variants: [
46
+ {
47
+ begin: /'/,
48
+ end: /'/
49
+ },
50
+ {
51
+ begin: /"/,
52
+ end: /"/
53
+ },
54
+ {
55
+ begin: /`/,
56
+ end: /`/
57
+ },
58
+ {
59
+ begin: "%[Qwi]?\\(",
60
+ end: "\\)",
61
+ contains: e("\\(", "\\)")
62
+ },
63
+ {
64
+ begin: "%[Qwi]?\\[",
65
+ end: "\\]",
66
+ contains: e("\\[", "\\]")
67
+ },
68
+ {
69
+ begin: "%[Qwi]?\\{",
70
+ end: /\}/,
71
+ contains: e(/\{/, /\}/)
72
+ },
73
+ {
74
+ begin: "%[Qwi]?<",
75
+ end: ">",
76
+ contains: e("<", ">")
77
+ },
78
+ {
79
+ begin: "%[Qwi]?\\|",
80
+ end: "\\|"
81
+ },
82
+ {
83
+ begin: /<<-\w+$/,
84
+ end: /^\s*\w+$/
85
+ }
86
+ ],
87
+ relevance: 0
88
+ }, E = {
89
+ className: "string",
90
+ variants: [
91
+ {
92
+ begin: "%q\\(",
93
+ end: "\\)",
94
+ contains: e("\\(", "\\)")
95
+ },
96
+ {
97
+ begin: "%q\\[",
98
+ end: "\\]",
99
+ contains: e("\\[", "\\]")
100
+ },
101
+ {
102
+ begin: "%q\\{",
103
+ end: /\}/,
104
+ contains: e(/\{/, /\}/)
105
+ },
106
+ {
107
+ begin: "%q<",
108
+ end: ">",
109
+ contains: e("<", ">")
110
+ },
111
+ {
112
+ begin: "%q\\|",
113
+ end: "\\|"
114
+ },
115
+ {
116
+ begin: /<<-'\w+'$/,
117
+ end: /^\s*\w+$/
118
+ }
119
+ ],
120
+ relevance: 0
121
+ }, u = {
122
+ begin: "(?!%\\})(" + n.RE_STARTERS_RE + "|\\n|\\b(case|if|select|unless|until|when|while)\\b)\\s*",
123
+ keywords: "case if select unless until when while",
124
+ contains: [
125
+ {
126
+ className: "regexp",
127
+ contains: [
128
+ n.BACKSLASH_ESCAPE,
129
+ a
130
+ ],
131
+ variants: [
132
+ {
133
+ begin: "//[a-z]*",
134
+ relevance: 0
135
+ },
136
+ {
137
+ begin: "/(?!\\/)",
138
+ end: "/[a-z]*"
139
+ }
140
+ ]
141
+ }
142
+ ],
143
+ relevance: 0
144
+ }, T = {
145
+ className: "regexp",
146
+ contains: [
147
+ n.BACKSLASH_ESCAPE,
148
+ a
149
+ ],
150
+ variants: [
151
+ {
152
+ begin: "%r\\(",
153
+ end: "\\)",
154
+ contains: e("\\(", "\\)")
155
+ },
156
+ {
157
+ begin: "%r\\[",
158
+ end: "\\]",
159
+ contains: e("\\[", "\\]")
160
+ },
161
+ {
162
+ begin: "%r\\{",
163
+ end: /\}/,
164
+ contains: e(/\{/, /\}/)
165
+ },
166
+ {
167
+ begin: "%r<",
168
+ end: ">",
169
+ contains: e("<", ">")
170
+ },
171
+ {
172
+ begin: "%r\\|",
173
+ end: "\\|"
174
+ }
175
+ ],
176
+ relevance: 0
177
+ }, N = {
178
+ className: "meta",
179
+ begin: "@\\[",
180
+ end: "\\]",
181
+ contains: [n.inherit(n.QUOTE_STRING_MODE, { className: "string" })]
182
+ }, o = [
183
+ b,
184
+ _,
185
+ E,
186
+ T,
187
+ u,
188
+ N,
189
+ d,
190
+ n.HASH_COMMENT_MODE,
191
+ {
192
+ className: "class",
193
+ beginKeywords: "class module struct",
194
+ end: "$|;",
195
+ illegal: /=/,
196
+ contains: [
197
+ n.HASH_COMMENT_MODE,
198
+ n.inherit(n.TITLE_MODE, { begin: t }),
199
+ {
200
+ // relevance booster for inheritance
201
+ begin: "<"
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ className: "class",
207
+ beginKeywords: "lib enum union",
208
+ end: "$|;",
209
+ illegal: /=/,
210
+ contains: [
211
+ n.HASH_COMMENT_MODE,
212
+ n.inherit(n.TITLE_MODE, { begin: t })
213
+ ]
214
+ },
215
+ {
216
+ beginKeywords: "annotation",
217
+ end: "$|;",
218
+ illegal: /=/,
219
+ contains: [
220
+ n.HASH_COMMENT_MODE,
221
+ n.inherit(n.TITLE_MODE, { begin: t })
222
+ ],
223
+ relevance: 2
224
+ },
225
+ {
226
+ className: "function",
227
+ beginKeywords: "def",
228
+ end: /\B\b/,
229
+ contains: [
230
+ n.inherit(n.TITLE_MODE, {
231
+ begin: s,
232
+ endsParent: !0
233
+ })
234
+ ]
235
+ },
236
+ {
237
+ className: "function",
238
+ beginKeywords: "fun macro",
239
+ end: /\B\b/,
240
+ contains: [
241
+ n.inherit(n.TITLE_MODE, {
242
+ begin: s,
243
+ endsParent: !0
244
+ })
245
+ ],
246
+ relevance: 2
247
+ },
248
+ {
249
+ className: "symbol",
250
+ begin: n.UNDERSCORE_IDENT_RE + "(!|\\?)?:",
251
+ relevance: 0
252
+ },
253
+ {
254
+ className: "symbol",
255
+ begin: ":",
256
+ contains: [
257
+ _,
258
+ { begin: s }
259
+ ],
260
+ relevance: 0
261
+ },
262
+ {
263
+ className: "number",
264
+ variants: [
265
+ { begin: "\\b0b([01_]+)" + i },
266
+ { begin: "\\b0o([0-7_]+)" + i },
267
+ { begin: "\\b0x([A-Fa-f0-9_]+)" + i },
268
+ { begin: "\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?" + g + "(?!_)" },
269
+ { begin: "\\b([1-9][0-9_]*|0)" + i }
270
+ ],
271
+ relevance: 0
272
+ }
273
+ ];
274
+ return a.contains = o, b.contains = o.slice(1), {
275
+ name: "Crystal",
276
+ aliases: ["cr"],
277
+ keywords: c,
278
+ contains: o
279
+ };
280
+ }
281
+ export {
282
+ S as default
283
+ };