apiuikit 0.5.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 (129) hide show
  1. package/README.md +20 -5
  2. package/dist/apiuikit.cjs.js +1 -1
  3. package/dist/apiuikit.css +1 -1
  4. package/dist/apiuikit.es.js +24 -17
  5. package/dist/c-Bz1-FJiA.js +277 -0
  6. package/dist/c-C_Sx7N-F.cjs +1 -0
  7. package/dist/clojure-DWYEZwCD.cjs +1 -0
  8. package/dist/clojure-aY2138WD.js +135 -0
  9. package/dist/components/Authorization.d.ts +28 -17
  10. package/dist/components/ChannelAddress.d.ts +8 -2
  11. package/dist/components/CodeBlock.d.ts +4 -1
  12. package/dist/components/CodeSamples.d.ts +12 -0
  13. package/dist/components/CollapsiblePanel.d.ts +24 -0
  14. package/dist/components/CopyMarkdownButton.d.ts +15 -0
  15. package/dist/components/Examples.d.ts +4 -2
  16. package/dist/components/InfoMetadata.d.ts +15 -2
  17. package/dist/components/Markdown.d.ts +2 -0
  18. package/dist/components/MarkdownExportMenu.d.ts +13 -0
  19. package/dist/components/MethodBadge.d.ts +14 -0
  20. package/dist/components/Navigation/AsyncAPINavigation.d.ts +28 -0
  21. package/dist/components/Navigation/Navigation.d.ts +58 -0
  22. package/dist/components/Navigation/OpenAPINavigation.d.ts +22 -0
  23. package/dist/components/Navigation/SpecNavigation.d.ts +25 -0
  24. package/dist/components/Navigation/index.d.ts +4 -0
  25. package/dist/components/Navigation/sharedSections.d.ts +10 -0
  26. package/dist/components/RenderExtensions.d.ts +14 -1
  27. package/dist/components/Section.d.ts +3 -1
  28. package/dist/components/ServerAddressBanner.d.ts +16 -0
  29. package/dist/components/SidePanel.d.ts +2 -0
  30. package/dist/components/Tabs.d.ts +3 -1
  31. package/dist/components/schema/SchemaTab.d.ts +19 -3
  32. package/dist/components/tests/Bindings.test.d.ts +1 -0
  33. package/dist/components/tests/CodeBlock.test.d.ts +1 -0
  34. package/dist/components/tests/CodeSamples.test.d.ts +1 -0
  35. package/dist/components/tests/CopyMarkdownButton.test.d.ts +1 -0
  36. package/dist/components/tests/MarkdownExportMenu.test.d.ts +1 -0
  37. package/dist/config/config.d.ts +8 -0
  38. package/dist/containers/AsyncAPI/AsyncAPI.d.ts +1 -1
  39. package/dist/containers/Information/InformationSection.d.ts +22 -0
  40. package/dist/containers/Information/OpenAPIInformation.d.ts +9 -0
  41. package/dist/containers/OpenAPI/Layout.d.ts +7 -0
  42. package/dist/containers/OpenAPI/OpenAPI.d.ts +18 -0
  43. package/dist/containers/OpenAPI/OpenAPIDocumentProvider.d.ts +13 -0
  44. package/dist/containers/OpenAPI/OpenAPIRenderer.d.ts +17 -0
  45. package/dist/containers/OpenAPI/tests/OpenAPI.test.d.ts +1 -0
  46. package/dist/containers/OpenAPI/tests/OpenAPIRenderer.test.d.ts +1 -0
  47. package/dist/containers/Operation/Operations.d.ts +2 -1
  48. package/dist/containers/Path/OperationCallbacks.d.ts +37 -0
  49. package/dist/containers/Path/PathOperation.d.ts +21 -0
  50. package/dist/containers/Path/Paths.d.ts +16 -0
  51. package/dist/containers/Path/ResponseLinks.d.ts +21 -0
  52. package/dist/containers/Path/tests/PathOperation.test.d.ts +1 -0
  53. package/dist/containers/Server/OpenAPIServer.d.ts +4 -0
  54. package/dist/containers/Server/OpenAPIServers.d.ts +13 -0
  55. package/dist/contants.d.ts +7 -0
  56. package/dist/contexts/useSpec.d.ts +28 -6
  57. package/dist/crystal-BcGgviMR.cjs +1 -0
  58. package/dist/crystal-BtD5fR4q.js +283 -0
  59. package/dist/csharp-AnFv7wyC.js +382 -0
  60. package/dist/csharp-yuAGIuP4.cjs +1 -0
  61. package/dist/go-BpetKc7b.cjs +1 -0
  62. package/dist/go-CkZ9_bn0.js +151 -0
  63. package/dist/helpers/codeSamples.d.ts +92 -0
  64. package/dist/helpers/exampleSchema.d.ts +19 -0
  65. package/dist/helpers/hljsLanguages.d.ts +6 -0
  66. package/dist/helpers/openapiParser.d.ts +10 -0
  67. package/dist/helpers/openapiSearchIndex.d.ts +3 -0
  68. package/dist/helpers/resolveDocument.d.ts +8 -0
  69. package/dist/helpers/runtimeExpression.d.ts +15 -0
  70. package/dist/helpers/schemaExample.d.ts +9 -0
  71. package/dist/helpers/searchIndex.d.ts +5 -2
  72. package/dist/helpers/tests/codeSamples.test.d.ts +1 -0
  73. package/dist/helpers/tests/exampleSchema.test.d.ts +1 -0
  74. package/dist/helpers/tests/openapiSearchIndex.test.d.ts +1 -0
  75. package/dist/helpers/tests/toMarkdown.test.d.ts +1 -0
  76. package/dist/helpers/toMarkdown.d.ts +20 -0
  77. package/dist/hooks/useDocumentProviderValue.d.ts +27 -0
  78. package/dist/hooks/useFuseSearch.d.ts +14 -0
  79. package/dist/hooks/useOpenAPISearch.d.ts +9 -0
  80. package/dist/hooks/useSearchResultFocus.d.ts +18 -0
  81. package/dist/hooks/useSpecLayoutController.d.ts +51 -0
  82. package/dist/hooks/useSpecSearch.d.ts +2 -6
  83. package/dist/http--XH4hLDt.cjs +1 -0
  84. package/dist/http-DKeNlJKS.js +85 -0
  85. package/dist/icons/Copy.d.ts +6 -0
  86. package/dist/icons/Info.d.ts +5 -0
  87. package/dist/{index-BcNlIoEF.cjs → index-ArzwV232.cjs} +6 -6
  88. package/dist/index-Bh4OKjMA.js +25412 -0
  89. package/dist/index-C278WDNb.cjs +139 -0
  90. package/dist/index-C4I0xC5G.js +17544 -0
  91. package/dist/index-DuW5iShy.cjs +177 -0
  92. package/dist/index-PtAFPDfk.js +18851 -0
  93. package/dist/index.d.ts +7 -0
  94. package/dist/java-BIk0G-rH.cjs +1 -0
  95. package/dist/java-BicX26Pg.js +240 -0
  96. package/dist/kotlin-BwB8b-YX.js +242 -0
  97. package/dist/kotlin-kGuORR5a.cjs +2 -0
  98. package/dist/objectivec-CnyrJ13Z.js +237 -0
  99. package/dist/objectivec-CoeV81Tz.cjs +1 -0
  100. package/dist/ocaml-0j7KDjso.cjs +1 -0
  101. package/dist/ocaml-T8IqWCjo.js +67 -0
  102. package/dist/php-BL35ZHWM.js +566 -0
  103. package/dist/php-DF4zG2hq.cjs +2 -0
  104. package/dist/powershell-CvydS3ek.cjs +1 -0
  105. package/dist/powershell-DuhUKWoO.js +236 -0
  106. package/dist/protoToJsonSchema-AciPTlBK.cjs +83 -0
  107. package/dist/protoToJsonSchema-D1lojrO3.js +6131 -0
  108. package/dist/{protobufSchemaParser-sEw46uRx.cjs → protobufSchemaParser-7SgmMhQd.cjs} +1 -1
  109. package/dist/{protobufSchemaParser-BQVXzHsQ.js → protobufSchemaParser-BohWo_pY.js} +2 -2
  110. package/dist/public/createSectionRoot.d.ts +30 -0
  111. package/dist/public/openapiSections.d.ts +26 -0
  112. package/dist/r-B8fCBydS.js +207 -0
  113. package/dist/r-CYaZnHkA.cjs +1 -0
  114. package/dist/ruby-CvOid-1s.js +388 -0
  115. package/dist/ruby-nPcbuC2a.cjs +1 -0
  116. package/dist/rust-BocnJ3Ns.js +305 -0
  117. package/dist/rust-DKnYCg2f.cjs +1 -0
  118. package/dist/swift-C35Eof-I.js +799 -0
  119. package/dist/swift-CAnH__EC.cjs +1 -0
  120. package/dist/types/openapi.d.ts +85 -0
  121. package/package.json +13 -2
  122. package/dist/components/Navigation.d.ts +0 -28
  123. package/dist/icons/SideBar.d.ts +0 -6
  124. package/dist/index-BG6colCU.js +0 -11473
  125. package/dist/index-Bmw7IyyF.cjs +0 -73
  126. package/dist/index-CEf0X0H_.js +0 -25414
  127. package/dist/protoToJsonSchema-BcqPKXqK.js +0 -6174
  128. package/dist/protoToJsonSchema-C43lKcgx.cjs +0 -83
  129. package/dist/vite.svg +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./protoToJsonSchema-C43lKcgx.cjs"),e=require("./index-Bmw7IyyF.cjs");function n(r){if(typeof r!="string")return["Protobuf schema must be a string of .proto source"];try{return t.protoToJsonSchema(r),[]}catch(o){return[o instanceof Error?o.message:"Failed to parse protobuf schema"]}}const s=["application/vnd.google.protobuf","application/vnd.google.protobuf;version=2","application/vnd.google.protobuf;version=3"];function a(){return{validate:u,parse:i,getMimeTypes:()=>s}}function c(r){e.registerSchemaParserWithFallback(r,a(),e.isProtobufSchemaFormat)}function u(r){return n(r.data).map(o=>({message:o,path:r.path}))}function i(r){if(typeof r.data!="string")return{[e.X_LIB_CONVERSION_ERROR]:"Protobuf schema must be a string of .proto source"};try{return t.protoToJsonSchema(r.data)}catch(o){return{[e.X_LIB_CONVERSION_ERROR]:o instanceof Error?o.message:"Failed to convert Protobuf schema"}}}exports.ProtobufSchemaParser=a;exports.registerProtobufSchemaParser=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./protoToJsonSchema-AciPTlBK.cjs"),e=require("./index-DuW5iShy.cjs");function n(r){if(typeof r!="string")return["Protobuf schema must be a string of .proto source"];try{return t.protoToJsonSchema(r),[]}catch(o){return[o instanceof Error?o.message:"Failed to parse protobuf schema"]}}const s=["application/vnd.google.protobuf","application/vnd.google.protobuf;version=2","application/vnd.google.protobuf;version=3"];function a(){return{validate:u,parse:i,getMimeTypes:()=>s}}function c(r){e.registerSchemaParserWithFallback(r,a(),e.isProtobufSchemaFormat)}function u(r){return n(r.data).map(o=>({message:o,path:r.path}))}function i(r){if(typeof r.data!="string")return{[e.X_LIB_CONVERSION_ERROR]:"Protobuf schema must be a string of .proto source"};try{return t.protoToJsonSchema(r.data)}catch(o){return{[e.X_LIB_CONVERSION_ERROR]:o instanceof Error?o.message:"Failed to convert Protobuf schema"}}}exports.ProtobufSchemaParser=a;exports.registerProtobufSchemaParser=c;
@@ -1,5 +1,5 @@
1
- import { protoToJsonSchema as e } from "./protoToJsonSchema-BcqPKXqK.js";
2
- import { r as a, i as s, X as t } from "./index-BG6colCU.js";
1
+ import { protoToJsonSchema as e } from "./protoToJsonSchema-D1lojrO3.js";
2
+ import { r as a, X as t, i as s } from "./index-PtAFPDfk.js";
3
3
  function n(r) {
4
4
  if (typeof r != "string")
5
5
  return ["Protobuf schema must be a string of .proto source"];
@@ -0,0 +1,30 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ import { SpecType } from '../contexts';
3
+ import { ConfigInterface } from '../config';
4
+ export interface GenericSectionProps<T> {
5
+ /** The document. Required standalone; unnecessary (and ignored) when rendered inside the matching provider. */
6
+ document?: T;
7
+ config?: ConfigInterface;
8
+ }
9
+ /**
10
+ * Builds a `SectionRoot`: renders `children` inside the ambient document
11
+ * context if there is one of the matching spec type (composed mode, e.g.
12
+ * under <AsyncAPIProvider>), otherwise resolves the `document` prop and sets
13
+ * up `Provider` itself (standalone mode). Shared behind both
14
+ * public/sections.tsx (AsyncAPI) and public/openapiSections.tsx (OpenAPI),
15
+ * which differ only in which document provider component backs them, the
16
+ * label used in messages, and the spec type they expect.
17
+ *
18
+ * A mismatched ambient provider (an OpenAPI section under <AsyncAPIProvider>,
19
+ * or vice versa) can't supply the section's document. When that happens the
20
+ * section warns, then falls back to its own `document` prop if one was given;
21
+ * without one it renders under the mismatched context anyway (typically
22
+ * empty) rather than crashing the tree.
23
+ */
24
+ export declare function createSectionRoot<T>(Provider: ComponentType<{
25
+ document: T;
26
+ config?: ConfigInterface;
27
+ children: ReactNode;
28
+ }>, specLabel: string, specType: SpecType): ({ document, config, children, }: GenericSectionProps<T> & {
29
+ children: ReactNode;
30
+ }) => import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from 'react';
2
+ import { ConfigInterface } from '../config';
3
+ import { OpenAPIDocumentData } from '../types/openapi';
4
+ /**
5
+ * Standalone, composable OpenAPI section components — mirrors public/sections.tsx
6
+ * (AsyncAPI). Each renders one part of an OpenAPI document (servers, endpoints,
7
+ * schemas, info) on its own, dual-mode:
8
+ * - Standalone: <OpenAPIEndpoints document={doc} />
9
+ * - Composed: <OpenAPIProvider document={doc}><OpenAPIServers /><OpenAPIEndpoints /></OpenAPIProvider>
10
+ */
11
+ export interface OpenAPISectionProps {
12
+ /** The OpenAPI document. Required standalone; unnecessary (and ignored) when rendered inside <OpenAPIProvider>. */
13
+ document?: OpenAPIDocumentData;
14
+ config?: ConfigInterface;
15
+ }
16
+ export declare function OpenAPIProvider({ document, config, children, }: {
17
+ document: OpenAPIDocumentData;
18
+ config?: ConfigInterface;
19
+ children: ReactNode;
20
+ }): import("react").JSX.Element;
21
+ export declare function OpenAPIServers(props: OpenAPISectionProps): import("react").JSX.Element;
22
+ export declare function OpenAPIEndpoints(props: OpenAPISectionProps): import("react").JSX.Element;
23
+ /** OpenAPI 3.1 `webhooks`. Renders nothing for a document that declares none. */
24
+ export declare function OpenAPIWebhooks(props: OpenAPISectionProps): import("react").JSX.Element;
25
+ export declare function OpenAPISchemas(props: OpenAPISectionProps): import("react").JSX.Element;
26
+ export declare function OpenAPIInfo(props: OpenAPISectionProps): import("react").JSX.Element;
@@ -0,0 +1,207 @@
1
+ function r(e) {
2
+ const a = e.regex, i = /(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/, n = a.either(
3
+ // Special case: only hexadecimal binary powers can contain fractions
4
+ /0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,
5
+ // Hexadecimal numbers without fraction and optional binary power
6
+ /0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,
7
+ // Decimal numbers
8
+ /(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/
9
+ ), s = /[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/, t = a.either(
10
+ /[()]/,
11
+ /[{}]/,
12
+ /\[\[/,
13
+ /[[\]]/,
14
+ /\\/,
15
+ /,/
16
+ );
17
+ return {
18
+ name: "R",
19
+ keywords: {
20
+ $pattern: i,
21
+ keyword: "function if in break next repeat else for while",
22
+ literal: "NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",
23
+ built_in: (
24
+ // Builtin constants
25
+ "LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"
26
+ )
27
+ },
28
+ contains: [
29
+ // Roxygen comments
30
+ e.COMMENT(
31
+ /#'/,
32
+ /$/,
33
+ { contains: [
34
+ {
35
+ // Handle `@examples` separately to cause all subsequent code
36
+ // until the next `@`-tag on its own line to be kept as-is,
37
+ // preventing highlighting. This code is example R code, so nested
38
+ // doctags shouldn’t be treated as such. See
39
+ // `test/markup/r/roxygen.txt` for an example.
40
+ scope: "doctag",
41
+ match: /@examples/,
42
+ starts: {
43
+ end: a.lookahead(a.either(
44
+ // end if another doc comment
45
+ /\n^#'\s*(?=@[a-zA-Z]+)/,
46
+ // or a line with no comment
47
+ /\n^(?!#')/
48
+ )),
49
+ endsParent: !0
50
+ }
51
+ },
52
+ {
53
+ // Handle `@param` to highlight the parameter name following
54
+ // after.
55
+ scope: "doctag",
56
+ begin: "@param",
57
+ end: /$/,
58
+ contains: [
59
+ {
60
+ scope: "variable",
61
+ variants: [
62
+ { match: i },
63
+ { match: /`(?:\\.|[^`\\])+`/ }
64
+ ],
65
+ endsParent: !0
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ scope: "doctag",
71
+ match: /@[a-zA-Z]+/
72
+ },
73
+ {
74
+ scope: "keyword",
75
+ match: /\\[a-zA-Z]+/
76
+ }
77
+ ] }
78
+ ),
79
+ e.HASH_COMMENT_MODE,
80
+ {
81
+ scope: "string",
82
+ contains: [e.BACKSLASH_ESCAPE],
83
+ variants: [
84
+ e.END_SAME_AS_BEGIN({
85
+ begin: /[rR]"(-*)\(/,
86
+ end: /\)(-*)"/
87
+ }),
88
+ e.END_SAME_AS_BEGIN({
89
+ begin: /[rR]"(-*)\{/,
90
+ end: /\}(-*)"/
91
+ }),
92
+ e.END_SAME_AS_BEGIN({
93
+ begin: /[rR]"(-*)\[/,
94
+ end: /\](-*)"/
95
+ }),
96
+ e.END_SAME_AS_BEGIN({
97
+ begin: /[rR]'(-*)\(/,
98
+ end: /\)(-*)'/
99
+ }),
100
+ e.END_SAME_AS_BEGIN({
101
+ begin: /[rR]'(-*)\{/,
102
+ end: /\}(-*)'/
103
+ }),
104
+ e.END_SAME_AS_BEGIN({
105
+ begin: /[rR]'(-*)\[/,
106
+ end: /\](-*)'/
107
+ }),
108
+ {
109
+ begin: '"',
110
+ end: '"',
111
+ relevance: 0
112
+ },
113
+ {
114
+ begin: "'",
115
+ end: "'",
116
+ relevance: 0
117
+ }
118
+ ]
119
+ },
120
+ // Matching numbers immediately following punctuation and operators is
121
+ // tricky since we need to look at the character ahead of a number to
122
+ // ensure the number is not part of an identifier, and we cannot use
123
+ // negative look-behind assertions. So instead we explicitly handle all
124
+ // possible combinations of (operator|punctuation), number.
125
+ // TODO: replace with negative look-behind when available
126
+ // { begin: /(?<![a-zA-Z0-9._])0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/ },
127
+ // { begin: /(?<![a-zA-Z0-9._])0[xX][0-9a-fA-F]+([pP][+-]?\d+)?[Li]?/ },
128
+ // { begin: /(?<![a-zA-Z0-9._])(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[Li]?/ }
129
+ {
130
+ relevance: 0,
131
+ variants: [
132
+ {
133
+ scope: {
134
+ 1: "operator",
135
+ 2: "number"
136
+ },
137
+ match: [
138
+ s,
139
+ n
140
+ ]
141
+ },
142
+ {
143
+ scope: {
144
+ 1: "operator",
145
+ 2: "number"
146
+ },
147
+ match: [
148
+ /%[^%]*%/,
149
+ n
150
+ ]
151
+ },
152
+ {
153
+ scope: {
154
+ 1: "punctuation",
155
+ 2: "number"
156
+ },
157
+ match: [
158
+ t,
159
+ n
160
+ ]
161
+ },
162
+ {
163
+ scope: { 2: "number" },
164
+ match: [
165
+ /[^a-zA-Z0-9._]|^/,
166
+ // not part of an identifier, or start of document
167
+ n
168
+ ]
169
+ }
170
+ ]
171
+ },
172
+ // Operators/punctuation when they're not directly followed by numbers
173
+ {
174
+ // Relevance boost for the most common assignment form.
175
+ scope: { 3: "operator" },
176
+ match: [
177
+ i,
178
+ /\s+/,
179
+ /<-/,
180
+ /\s+/
181
+ ]
182
+ },
183
+ {
184
+ scope: "operator",
185
+ relevance: 0,
186
+ variants: [
187
+ { match: s },
188
+ { match: /%[^%]*%/ }
189
+ ]
190
+ },
191
+ {
192
+ scope: "punctuation",
193
+ relevance: 0,
194
+ match: t
195
+ },
196
+ {
197
+ // Escaped identifier
198
+ begin: "`",
199
+ end: "`",
200
+ contains: [{ begin: /\\./ }]
201
+ }
202
+ ]
203
+ };
204
+ }
205
+ export {
206
+ r as default
207
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){const a=e.regex,i=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,n=a.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),t=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=a.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:i,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:a.lookahead(a.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:i},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[t,n]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,n]},{scope:{1:"punctuation",2:"number"},match:[s,n]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,n]}]},{scope:{3:"operator"},match:[i,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:t},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}exports.default=r;
@@ -0,0 +1,388 @@
1
+ function D(e) {
2
+ const t = e.regex, o = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)", b = t.either(
3
+ /\b([A-Z]+[a-z0-9]+)+/,
4
+ // ends in caps
5
+ /\b([A-Z]+[a-z0-9]+)+[A-Z]+/
6
+ ), a = t.concat(b, /(::\w+)*/), n = {
7
+ "variable.constant": [
8
+ "__FILE__",
9
+ "__LINE__",
10
+ "__ENCODING__"
11
+ ],
12
+ "variable.language": [
13
+ "self",
14
+ "super"
15
+ ],
16
+ keyword: [
17
+ "alias",
18
+ "and",
19
+ "begin",
20
+ "BEGIN",
21
+ "break",
22
+ "case",
23
+ "class",
24
+ "defined",
25
+ "do",
26
+ "else",
27
+ "elsif",
28
+ "end",
29
+ "END",
30
+ "ensure",
31
+ "for",
32
+ "if",
33
+ "in",
34
+ "module",
35
+ "next",
36
+ "not",
37
+ "or",
38
+ "redo",
39
+ "require",
40
+ "rescue",
41
+ "retry",
42
+ "return",
43
+ "then",
44
+ "undef",
45
+ "unless",
46
+ "until",
47
+ "when",
48
+ "while",
49
+ "yield",
50
+ ...[
51
+ "include",
52
+ "extend",
53
+ "prepend",
54
+ "public",
55
+ "private",
56
+ "protected",
57
+ "raise",
58
+ "throw"
59
+ ]
60
+ ],
61
+ built_in: [
62
+ "proc",
63
+ "lambda",
64
+ "attr_accessor",
65
+ "attr_reader",
66
+ "attr_writer",
67
+ "define_method",
68
+ "private_constant",
69
+ "module_function"
70
+ ],
71
+ literal: [
72
+ "true",
73
+ "false",
74
+ "nil"
75
+ ]
76
+ }, _ = {
77
+ className: "doctag",
78
+ begin: "@[A-Za-z]+"
79
+ }, r = {
80
+ begin: "#<",
81
+ end: ">"
82
+ }, c = [
83
+ e.COMMENT(
84
+ "#",
85
+ "$",
86
+ { contains: [_] }
87
+ ),
88
+ e.COMMENT(
89
+ "^=begin",
90
+ "^=end",
91
+ {
92
+ contains: [_],
93
+ relevance: 10
94
+ }
95
+ ),
96
+ e.COMMENT("^__END__", e.MATCH_NOTHING_RE)
97
+ ], i = {
98
+ className: "subst",
99
+ begin: /#\{/,
100
+ end: /\}/,
101
+ keywords: n
102
+ }, E = {
103
+ className: "string",
104
+ contains: [
105
+ e.BACKSLASH_ESCAPE,
106
+ i
107
+ ],
108
+ variants: [
109
+ {
110
+ begin: /'/,
111
+ end: /'/
112
+ },
113
+ {
114
+ begin: /"/,
115
+ end: /"/
116
+ },
117
+ {
118
+ begin: /`/,
119
+ end: /`/
120
+ },
121
+ {
122
+ begin: /%[qQwWx]?\(/,
123
+ end: /\)/
124
+ },
125
+ {
126
+ begin: /%[qQwWx]?\[/,
127
+ end: /\]/
128
+ },
129
+ {
130
+ begin: /%[qQwWx]?\{/,
131
+ end: /\}/
132
+ },
133
+ {
134
+ begin: /%[qQwWx]?</,
135
+ end: />/
136
+ },
137
+ {
138
+ begin: /%[qQwWx]?\//,
139
+ end: /\//
140
+ },
141
+ {
142
+ begin: /%[qQwWx]?%/,
143
+ end: /%/
144
+ },
145
+ {
146
+ begin: /%[qQwWx]?-/,
147
+ end: /-/
148
+ },
149
+ {
150
+ begin: /%[qQwWx]?\|/,
151
+ end: /\|/
152
+ },
153
+ // in the following expressions, \B in the beginning suppresses recognition of ?-sequences
154
+ // where ? is the last character of a preceding identifier, as in: `func?4`
155
+ { begin: /\B\?(\\\d{1,3})/ },
156
+ { begin: /\B\?(\\x[A-Fa-f0-9]{1,2})/ },
157
+ { begin: /\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/ },
158
+ { begin: /\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/ },
159
+ { begin: /\B\?\\(c|C-)[\x20-\x7e]/ },
160
+ { begin: /\B\?\\?\S/ },
161
+ // heredocs
162
+ {
163
+ // this guard makes sure that we have an entire heredoc and not a false
164
+ // positive (auto-detect, etc.)
165
+ begin: t.concat(
166
+ /<<[-~]?'?/,
167
+ t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)
168
+ ),
169
+ contains: [
170
+ e.END_SAME_AS_BEGIN({
171
+ begin: /(\w+)/,
172
+ end: /(\w+)/,
173
+ contains: [
174
+ e.BACKSLASH_ESCAPE,
175
+ i
176
+ ]
177
+ })
178
+ ]
179
+ }
180
+ ]
181
+ }, g = "[1-9](_?[0-9])*|0", d = "[0-9](_?[0-9])*", N = {
182
+ className: "number",
183
+ relevance: 0,
184
+ variants: [
185
+ // decimal integer/float, optionally exponential or rational, optionally imaginary
186
+ { begin: `\\b(${g})(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b` },
187
+ // explicit decimal/binary/octal/hexadecimal integer,
188
+ // optionally rational and/or imaginary
189
+ { begin: "\\b0[dD][0-9](_?[0-9])*r?i?\\b" },
190
+ { begin: "\\b0[bB][0-1](_?[0-1])*r?i?\\b" },
191
+ { begin: "\\b0[oO][0-7](_?[0-7])*r?i?\\b" },
192
+ { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b" },
193
+ // 0-prefixed implicit octal integer, optionally rational and/or imaginary
194
+ { begin: "\\b0(_?[0-7])+r?i?\\b" }
195
+ ]
196
+ }, l = {
197
+ variants: [
198
+ {
199
+ match: /\(\)/
200
+ },
201
+ {
202
+ className: "params",
203
+ begin: /\(/,
204
+ end: /(?=\))/,
205
+ excludeBegin: !0,
206
+ endsParent: !0,
207
+ keywords: n
208
+ }
209
+ ]
210
+ }, s = [
211
+ E,
212
+ {
213
+ variants: [
214
+ {
215
+ match: [
216
+ /class\s+/,
217
+ a,
218
+ /\s+<\s+/,
219
+ a
220
+ ]
221
+ },
222
+ {
223
+ match: [
224
+ /\b(class|module)\s+/,
225
+ a
226
+ ]
227
+ }
228
+ ],
229
+ scope: {
230
+ 2: "title.class",
231
+ 4: "title.class.inherited"
232
+ },
233
+ keywords: n
234
+ },
235
+ {
236
+ match: [
237
+ /(include|extend)\s+/,
238
+ a
239
+ ],
240
+ scope: {
241
+ 2: "title.class"
242
+ },
243
+ keywords: n
244
+ },
245
+ {
246
+ relevance: 0,
247
+ match: [
248
+ a,
249
+ /\.new[. (]/
250
+ ],
251
+ scope: {
252
+ 1: "title.class"
253
+ }
254
+ },
255
+ {
256
+ relevance: 0,
257
+ match: /\b[A-Z][A-Z_0-9]+\b/,
258
+ className: "variable.constant"
259
+ },
260
+ {
261
+ relevance: 0,
262
+ match: b,
263
+ scope: "title.class"
264
+ },
265
+ {
266
+ match: [
267
+ /def/,
268
+ /\s+/,
269
+ o
270
+ ],
271
+ scope: {
272
+ 1: "keyword",
273
+ 3: "title.function"
274
+ },
275
+ contains: [
276
+ l
277
+ ]
278
+ },
279
+ {
280
+ // swallow namespace qualifiers before symbols
281
+ begin: e.IDENT_RE + "::"
282
+ },
283
+ {
284
+ className: "symbol",
285
+ begin: e.UNDERSCORE_IDENT_RE + "(!|\\?)?:",
286
+ relevance: 0
287
+ },
288
+ {
289
+ className: "symbol",
290
+ begin: ":(?!\\s)",
291
+ contains: [
292
+ E,
293
+ { begin: o }
294
+ ],
295
+ relevance: 0
296
+ },
297
+ N,
298
+ {
299
+ // negative-look forward attempts to prevent false matches like:
300
+ // @ident@ or $ident$ that might indicate this is not ruby at all
301
+ className: "variable",
302
+ begin: "(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"
303
+ },
304
+ {
305
+ className: "params",
306
+ begin: /\|(?!=)/,
307
+ end: /\|/,
308
+ excludeBegin: !0,
309
+ excludeEnd: !0,
310
+ relevance: 0,
311
+ // this could be a lot of things (in other languages) other than params
312
+ keywords: n
313
+ },
314
+ {
315
+ // regexp container
316
+ begin: "(" + e.RE_STARTERS_RE + "|unless)\\s*",
317
+ keywords: "unless",
318
+ contains: [
319
+ {
320
+ className: "regexp",
321
+ contains: [
322
+ e.BACKSLASH_ESCAPE,
323
+ i
324
+ ],
325
+ illegal: /\n/,
326
+ variants: [
327
+ {
328
+ begin: "/",
329
+ end: "/[a-z]*"
330
+ },
331
+ {
332
+ begin: /%r\{/,
333
+ end: /\}[a-z]*/
334
+ },
335
+ {
336
+ begin: "%r\\(",
337
+ end: "\\)[a-z]*"
338
+ },
339
+ {
340
+ begin: "%r!",
341
+ end: "![a-z]*"
342
+ },
343
+ {
344
+ begin: "%r\\[",
345
+ end: "\\][a-z]*"
346
+ }
347
+ ]
348
+ }
349
+ ].concat(r, c),
350
+ relevance: 0
351
+ }
352
+ ].concat(r, c);
353
+ i.contains = s, l.contains = s;
354
+ const A = [
355
+ {
356
+ begin: /^\s*=>/,
357
+ starts: {
358
+ end: "$",
359
+ contains: s
360
+ }
361
+ },
362
+ {
363
+ className: "meta.prompt",
364
+ begin: "^(" + "[>?]>" + "|" + "[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]" + "|" + "(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>" + ")(?=[ ])",
365
+ starts: {
366
+ end: "$",
367
+ keywords: n,
368
+ contains: s
369
+ }
370
+ }
371
+ ];
372
+ return c.unshift(r), {
373
+ name: "Ruby",
374
+ aliases: [
375
+ "rb",
376
+ "gemspec",
377
+ "podspec",
378
+ "thor",
379
+ "irb"
380
+ ],
381
+ keywords: n,
382
+ illegal: /\/\*/,
383
+ contains: [e.SHEBANG({ binary: "ruby" })].concat(A).concat(c).concat(s)
384
+ };
385
+ }
386
+ export {
387
+ D as default
388
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function S(e){const t=e.regex,o="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",b=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=t.concat(b,/(::\w+)*/),n={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},_={className:"doctag",begin:"@[A-Za-z]+"},r={begin:"#<",end:">"},c=[e.COMMENT("#","$",{contains:[_]}),e.COMMENT("^=begin","^=end",{contains:[_],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],i={className:"subst",begin:/#\{/,end:/\}/,keywords:n},E={className:"string",contains:[e.BACKSLASH_ESCAPE,i],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,i]})]}]},g="[1-9](_?[0-9])*|0",d="[0-9](_?[0-9])*",N={className:"number",relevance:0,variants:[{begin:`\\b(${g})(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},l={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:n}]},s=[E,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:n},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:n},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:b,scope:"title.class"},{match:[/def/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[l]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[E,{begin:o}],relevance:0},N,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:n},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,i],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(r,c),relevance:0}].concat(r,c);i.contains=s,l.contains=s;const A=[{begin:/^\s*=>/,starts:{end:"$",contains:s}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:n,contains:s}}];return c.unshift(r),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:n,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(A).concat(c).concat(s)}}exports.default=S;