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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./protoToJsonSchema-8Mm10CIx.cjs"),e=require("./index-gn5KpvCL.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-BJpwl2Am.js";
2
- import { r as a, i as s, X as t } from "./index-Bad1aEIj.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;
@@ -8,10 +8,10 @@ import { AsyncAPIDocumentData } from '../types/schema';
8
8
  * `<AsyncAPI>` widget.
9
9
  *
10
10
  * They're dual-mode:
11
- * - Standalone pass a `document` (and optional `config`); the section
11
+ * - Standalone: pass a `document` (and optional `config`); the section
12
12
  * resolves it and sets up its own context.
13
13
  * <Operations document={doc} />
14
- * - Composed render several under one <AsyncAPIProvider> (resolves once,
14
+ * - Composed: render several under one <AsyncAPIProvider> (resolves once,
15
15
  * shares context); sections then read from it and their own `document`
16
16
  * prop is unnecessary.
17
17
  * <AsyncAPIProvider document={doc}>
@@ -28,11 +28,14 @@ export interface SectionProps {
28
28
  }
29
29
  /**
30
30
  * Provider that resolves a document once and shares it with any section
31
- * components rendered inside the composition entry point.
31
+ * components rendered inside: the composition entry point.
32
32
  */
33
33
  export declare function AsyncAPIProvider({ document, config, children, }: {
34
+ /** The AsyncAPI document to resolve and share with sections inside. */
34
35
  document: AsyncAPIDocumentData;
36
+ /** UI configuration (theme, schema expansion defaults) shared with sections inside. */
35
37
  config?: ConfigInterface;
38
+ /** Section components (or your own), rendered with access to the shared document context. */
36
39
  children: ReactNode;
37
40
  }): import("react").JSX.Element;
38
41
  export declare function Servers(props: SectionProps): 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;