@asyncapi/react-component 2.6.4 → 3.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.
- package/LICENSE +201 -202
- package/README.md +15 -9
- package/browser/index.js +1 -1
- package/browser/standalone/index.js +1 -1
- package/browser/standalone/without-parser.js +1 -1
- package/browser/without-parser.js +1 -1
- package/lib/cjs/components/CollapseButton.js +4 -4
- package/lib/cjs/components/CollapseButton.js.map +1 -1
- package/lib/cjs/components/PluginSlotRenderer.js +21 -0
- package/lib/cjs/components/PluginSlotRenderer.js.map +1 -0
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/AsyncApi.js +2 -2
- package/lib/cjs/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Layout.js +15 -13
- package/lib/cjs/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/cjs/containers/AsyncApi/Standalone.js +99 -3
- package/lib/cjs/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/cjs/containers/Info/Info.js +9 -1
- package/lib/cjs/containers/Info/Info.js.map +1 -1
- package/lib/cjs/containers/Operations/Operation.js +8 -1
- package/lib/cjs/containers/Operations/Operation.js.map +1 -1
- package/lib/cjs/containers/Sidebar/Sidebar.js +6 -7
- package/lib/cjs/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/cjs/contexts/usePlugin.js +10 -0
- package/lib/cjs/contexts/usePlugin.js.map +1 -0
- package/lib/cjs/helpers/pluginManager.js +116 -0
- package/lib/cjs/helpers/pluginManager.js.map +1 -0
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.js +6 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/components/CollapseButton.js +4 -4
- package/lib/esm/components/CollapseButton.js.map +1 -1
- package/lib/esm/components/PluginSlotRenderer.js +15 -0
- package/lib/esm/components/PluginSlotRenderer.js.map +1 -0
- package/lib/esm/constants.js +1 -0
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/containers/AsyncApi/AsyncApi.js +2 -2
- package/lib/esm/containers/AsyncApi/AsyncApi.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Layout.js +15 -13
- package/lib/esm/containers/AsyncApi/Layout.js.map +1 -1
- package/lib/esm/containers/AsyncApi/Standalone.js +99 -3
- package/lib/esm/containers/AsyncApi/Standalone.js.map +1 -1
- package/lib/esm/containers/Info/Info.js +9 -1
- package/lib/esm/containers/Info/Info.js.map +1 -1
- package/lib/esm/containers/Operations/Operation.js +9 -2
- package/lib/esm/containers/Operations/Operation.js.map +1 -1
- package/lib/esm/containers/Sidebar/Sidebar.js +6 -7
- package/lib/esm/containers/Sidebar/Sidebar.js.map +1 -1
- package/lib/esm/contexts/usePlugin.js +6 -0
- package/lib/esm/contexts/usePlugin.js.map +1 -0
- package/lib/esm/helpers/pluginManager.js +113 -0
- package/lib/esm/helpers/pluginManager.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.js +5 -0
- package/lib/esm/types.js.map +1 -1
- package/lib/types/components/PluginSlotRenderer.d.ts +11 -0
- package/lib/types/components/PluginSlotRenderer.d.ts.map +1 -0
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/constants.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts +5 -1
- package/lib/types/containers/AsyncApi/AsyncApi.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/Layout.d.ts +2 -0
- package/lib/types/containers/AsyncApi/Layout.d.ts.map +1 -1
- package/lib/types/containers/AsyncApi/Standalone.d.ts +13 -1
- package/lib/types/containers/AsyncApi/Standalone.d.ts.map +1 -1
- package/lib/types/containers/Info/Info.d.ts.map +1 -1
- package/lib/types/containers/Operations/Operation.d.ts.map +1 -1
- package/lib/types/containers/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/types/contexts/usePlugin.d.ts +5 -0
- package/lib/types/contexts/usePlugin.d.ts.map +1 -0
- package/lib/types/helpers/pluginManager.d.ts +26 -0
- package/lib/types/helpers/pluginManager.d.ts.map +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/types.d.ts +38 -0
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/styles/default.css +15 -0
- package/styles/default.min.css +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../../src/containers/Operations/Operation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAExC,+CAA8C;AAC9C,gDAA+C;AAC/C,+CAO0B;AAC1B,8CAA6C;AAC7C,2CAAoD;AACpD,yCAA6D;AAC7D,6CAA6D;AAC7D,qCAA0C;AASnC,IAAM,SAAS,GAAmC,UAAC,KAAK;IACrD,IAAA,KAA6D,KAAK,KAA3C,EAAvB,IAAI,mBAAG,mBAAW,CAAC,IAAI,KAAA,EAAE,SAAS,GAA2B,KAAK,UAAhC,EAAE,WAAW,GAAc,KAAK,YAAnB,EAAE,OAAO,GAAK,KAAK,QAAV,CAAW;IAC3E,IAAM,MAAM,GAAG,IAAA,oBAAS,GAAE,CAAC;IAC3B,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE;QAC1B,OAAO,IAAI,CAAC;KACb;IAGD,IAAM,OAAO,GACX,OAAO,OAAO,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC;IAEnE,IAAM,QAAQ,GACZ,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnE,IAAM,UAAU,GACd,OAAO,CAAC,UAAU,EAAE,KAAK,SAAS;QAChC,CAAC,CAAC,uBAAa,CAAC,kBAAkB,CAAC,OAAO,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ACjE,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,yBAAyB,6BAiDpC","sourcesContent":["import React, { useState } from 'react';\nimport { ChannelInterface, OperationInterface } from '@asyncapi/parser';\nimport { Message } from '../Messages/Message';\nimport { Security } from '../Servers/Security';\nimport {\n Markdown,\n Schema,\n Bindings,\n Tags,\n Extensions,\n CollapseButton,\n} from '../../components';\nimport { Href } from '../../components/Href';\nimport { useConfig, useSpec } from '../../contexts';\nimport { CommonHelpers, SchemaHelpers } from '../../helpers';\nimport { EXTERAL_DOCUMENTATION_TEXT } from '../../constants';\nimport { PayloadType } from '../../types';\n\ninterface Props {\n type: PayloadType;\n operation: OperationInterface;\n channelName: string;\n channel: ChannelInterface;\n}\n\nexport const Operation: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n if (!operation || !channel) {\n return null;\n }\n\n // check typeof as fallback for older version than `2.2.0`\n const servers =\n typeof channel.servers === 'function' && channel.servers().all();\n // check typeof as fallback for older version than `2.4.0`\n const security =\n typeof operation.security === 'function' && operation.security();\n const parameters =\n channel.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n return (\n <div>\n <div className=\"panel-item--center px-8\">\n <OperationInfo {...props} />\n\n {servers && servers.length > 0 ? (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${window.location.pathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\n className=\"border border-solid border-blue-300 hover:bg-blue-300 hover:text-blue-600 text-blue-500 font-bold no-underline text-xs rounded px-3 py-1 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n\n {security && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-security`,\n config,\n )}\n >\n <Security\n security={security}\n header=\"Additional security requirements\"\n />\n </div>\n )}\n\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Channel specific information\"\n bindings={channel.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Channel Extensions\" item={channel} />\n\n {operation.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Operation specific information\"\n bindings={operation.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Operation Extensions\" item={operation} />\n\n {operation.tags() && (\n <div className=\"mt-2\">\n <Tags tags={operation.tags()} />\n </div>\n )}\n </div>\n\n <div\n className=\"w-full mt-4\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-message`,\n config,\n )}\n >\n {operation.messages().length > 1 ? (\n <div className=\"mt-2\">\n <p className=\"px-8\">\n Accepts <strong>one of</strong> the following messages:\n </p>\n <ul>\n {operation\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <p className=\"px-8\">Accepts the following message:</p>\n <div className=\"mt-2\">\n <Message message={operation.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n </div>\n\n <OperationReplyInfo {...props} />\n </div>\n );\n};\n\nexport const OperationInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n const operationSummary = operation.summary();\n const externalDocs = operation.externalDocs();\n const operationId = operation.id();\n const specV = useSpec().version();\n const version = specV.localeCompare('2.6.0', undefined, { numeric: true });\n const isAsyncAPIv2 = version === 0;\n const { backgroundColor, typeLabel } =\n CommonHelpers.getOperationDesignInformation({\n type,\n config,\n isAsyncAPIv2,\n });\n return (\n <>\n <div className=\"mb-4\">\n <h3>\n <span\n className={`font-mono text-white uppercase p-1 rounded mr-2 ${backgroundColor}`}\n title={type}\n >\n {typeLabel}\n </span>{' '}\n <span className=\"font-mono text-base\">{channelName}</span>\n </h3>\n </div>\n\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {operationSummary && (\n <p className=\"text-gray-600 text-sm mt-2\">{operationSummary}</p>\n )}\n {operation.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{operation.description()}</Markdown>\n </div>\n )}\n\n {externalDocs && (\n <ul className=\"leading-normal mt-2 mb-4 space-x-2 space-y-2\">\n {externalDocs && (\n <li className=\"inline-block\">\n <Href\n className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={externalDocs.url()}\n >\n <span>{EXTERAL_DOCUMENTATION_TEXT}</span>\n </Href>\n </li>\n )}\n </ul>\n )}\n\n {operationId && (\n <div className=\"border bg-gray-100 rounded px-4 py-2 mt-2\">\n <div className=\"text-sm text-gray-700\">\n Operation ID\n <span className=\"bg-orange-600 text-white rounded text-xs ml-2 py-0 px-2\">\n {operationId}\n </span>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport const OperationReplyInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation } = props;\n const [showMessages, setShowMessages] = useState(false);\n const [showChannel, setShowChannel] = useState(false);\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (reply === undefined) {\n return <></>;\n }\n\n const replyMessages = reply.messages();\n const explicitChannel = reply.channel();\n\n const replyAddress = reply.address()?.location();\n\n return (\n <div className=\"panel-item\">\n <div className=\"panel-item--center\">\n <div className=\"font-mono px-8 py-4\">\n <div className=\"border rounded\">\n <div\n className={`w-full ${\n type === PayloadType.REPLY\n ? 'bg-green-600 border-green-600'\n : 'bg-blue-600 border-blue-600'\n } text-sm rounded-t h-8 px-4 border text-white flex items-center`}\n >\n <strong>REPLY INFORMATION</strong>\n </div>\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2\" title={type}>\n REPLY CHANNEL INFORMATION\n </span>\n </h3>\n {explicitChannel?.address() ? (\n <div className=\"text-xs text-gray-700\">\n Reply will be provided via this designated address:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {explicitChannel.address()}{' '}\n </span>\n </div>\n ) : (\n replyAddress != null && (\n <div className=\"text-xs text-gray-700\">\n Reply will be directed to the address specified at this\n location:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddress}\n </span>\n </div>\n )\n )}\n <div className=\"mt-2\">\n {explicitChannel && (\n <CollapseButton\n onClick={() => setShowChannel((prev) => !prev)}\n expanded={showChannel}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n View channel details\n </span>\n </CollapseButton>\n )}\n {explicitChannel && (\n <div\n className={`w-full mt-4 ${\n showChannel ? 'block' : 'hidden'\n }`}\n >\n <OperationReplyChannelInfo {...props} />{' '}\n </div>\n )}\n </div>\n </div>\n </div>\n <OperationReplyAddressInfo {...props} />\n {replyMessages.isEmpty() === false && (\n <div className=\"p-4\">\n <CollapseButton\n onClick={() => setShowMessages((prev) => !prev)}\n expanded={showMessages}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n Expected Reply{' '}\n {replyMessages.length > 1 ? 'Messages' : 'Message'}\n </span>\n </CollapseButton>\n <div\n className={`w-full mt-4 ${showMessages ? 'block' : 'hidden'}`}\n >\n {replyMessages.length > 1 ? (\n <div className=\"mt-2\">\n <ul>\n {replyMessages.all().map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <div className=\"mt-2\">\n <Message\n message={replyMessages.all()[0]}\n showExamples\n />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </div>\n\n <Extensions name=\"Operation Reply Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n\nexport const OperationReplyChannelInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n const reply = operation.reply();\n const channel = reply?.channel();\n const channelName = channel?.address() ?? '';\n\n const config = useConfig();\n const servers =\n typeof channel?.servers === 'function' && channel.servers().all();\n const parameters =\n channel?.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n if (!channel) {\n return <></>;\n }\n\n return (\n <div>\n {channel.address() && (\n <div className=\"mt-2 text-xs text-gray-700\">\n Address:{' '}\n <span className=\"border text-orange-600 rounded text-xs py-0 px-2\">\n {channel.address()}\n </span>\n </div>\n )}\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {servers && servers.length > 0 ? (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${window.location.pathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\n className=\"border border-solid border-blue-300 hover:bg-blue-300 hover:text-blue-600 text-blue-500 font-bold no-underline text-xs rounded px-3 py-1 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {channel.messages().all().length > 1 ? (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Messages:</span>\n <ul>\n {channel\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Message:</span>\n <div className=\"mt-2\">\n <Message message={channel.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings name=\"Bindings\" bindings={channel.bindings()} />\n </div>\n )}\n </div>\n );\n};\n\nexport const OperationReplyAddressInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (!reply?.address) {\n return <></>;\n }\n const replyAddress = reply.address();\n\n if (!replyAddress) {\n return <></>;\n }\n\n const replyAddressLocation = replyAddress.location();\n\n return (\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2 uppercase\" title={type}>\n REPLY address information\n </span>\n </h3>\n {replyAddressLocation && (\n <div className=\"text-xs text-gray-700\">\n REPLY will be sent to the address provided in:\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddressLocation}\n </span>\n </div>\n )}\n {replyAddress.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{replyAddress.description()}</Markdown>\n </div>\n )}\n <Extensions name=\"Operation Reply Address Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../../src/containers/Oper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ChannelInterface, OperationInterface } from '@asyncapi/parser';\nimport { Message } from '../Messages/Message';\nimport { Security } from '../Servers/Security';\nimport {\n Markdown,\n Schema,\n Bindings,\n Tags,\n Extensions,\n CollapseButton,\n} from '../../components';\nimport { Href } from '../../components/Href';\nimport { useConfig, useSpec } from '../../contexts';\nimport { CommonHelpers, SchemaHelpers } from '../../helpers';\nimport { EXTERAL_DOCUMENTATION_TEXT } from '../../constants';\nimport { PayloadType, PluginSlot } from '../../types';\nimport { PluginManager } from '../../helpers/pluginManager';\nimport { SlotRenderer } from '../../components/PluginSlotRenderer';\nimport { usePlugin } from '../../contexts/usePlugin';\n\ninterface Props {\n type: PayloadType;\n operation: OperationInterface;\n channelName: string;\n channel: ChannelInterface;\n}\n\nexport const Operation: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n if (!operation || !channel) {\n return null;\n }\n\n // check typeof as fallback for older version than `2.2.0`\n const servers =\n typeof channel.servers === 'function' && channel.servers().all();\n // check typeof as fallback for older version than `2.4.0`\n const security =\n typeof operation.security === 'function' && operation.security();\n const parameters =\n channel.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n return (\n <div>\n <div className=\"panel-item--center px-8\">\n <OperationInfo {...props} />\n {servers && servers.length > 0 ? (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${window.location.pathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\n className=\"border border-solid border-blue-300 hover:bg-blue-300 hover:text-blue-600 text-blue-500 font-bold no-underline text-xs rounded px-3 py-1 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n\n {security && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-security`,\n config,\n )}\n >\n <Security\n security={security}\n header=\"Additional security requirements\"\n />\n </div>\n )}\n\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Channel specific information\"\n bindings={channel.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Channel Extensions\" item={channel} />\n\n {operation.bindings() && (\n <div className=\"mt-2\">\n <Bindings\n name=\"Operation specific information\"\n bindings={operation.bindings()}\n />\n </div>\n )}\n\n <Extensions name=\"Operation Extensions\" item={operation} />\n\n {operation.tags() && (\n <div className=\"mt-2\">\n <Tags tags={operation.tags()} />\n </div>\n )}\n </div>\n\n <div\n className=\"w-full mt-4\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-message`,\n config,\n )}\n >\n {operation.messages().length > 1 ? (\n <div className=\"mt-2\">\n <p className=\"px-8\">\n Accepts <strong>one of</strong> the following messages:\n </p>\n <ul>\n {operation\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <p className=\"px-8\">Accepts the following message:</p>\n <div className=\"mt-2\">\n <Message message={operation.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n </div>\n\n <OperationReplyInfo {...props} />\n </div>\n );\n};\n\nexport const OperationInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation, channelName, channel } = props;\n const config = useConfig();\n const pluginManager = usePlugin();\n const operationSummary = operation.summary();\n const externalDocs = operation.externalDocs();\n const operationId = operation.id();\n const specV = useSpec().version();\n const version = specV.localeCompare('2.6.0', undefined, { numeric: true });\n const isAsyncAPIv2 = version === 0;\n const { backgroundColor, typeLabel } =\n CommonHelpers.getOperationDesignInformation({\n type,\n config,\n isAsyncAPIv2,\n });\n return (\n <>\n <div className=\"mb-4\">\n <h3>\n <span\n className={`font-mono text-white uppercase p-1 rounded mr-2 ${backgroundColor}`}\n title={type}\n >\n {typeLabel}\n </span>{' '}\n <span className=\"font-mono text-base\">{channelName}</span>\n </h3>\n </div>\n\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {operationSummary && (\n <p className=\"text-gray-600 text-sm mt-2\">{operationSummary}</p>\n )}\n {operation.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{operation.description()}</Markdown>\n </div>\n )}\n\n {externalDocs && (\n <ul className=\"leading-normal mt-2 mb-4 space-x-2 space-y-2\">\n {externalDocs && (\n <li className=\"inline-block\">\n <Href\n className=\"border border-solid border-orange-300 hover:bg-orange-300 hover:text-orange-600 text-orange-500 font-bold no-underline text-xs uppercase rounded px-3 py-1\"\n href={externalDocs.url()}\n >\n <span>{EXTERAL_DOCUMENTATION_TEXT}</span>\n </Href>\n </li>\n )}\n </ul>\n )}\n\n {operationId && (\n <div className=\"border bg-gray-100 rounded px-4 py-2 mt-2\">\n <div className=\"text-sm text-gray-700\">\n Operation ID\n <span className=\"bg-orange-600 text-white rounded text-xs ml-2 py-0 px-2\">\n {operationId}\n </span>\n </div>\n </div>\n )}\n {PluginManager && (\n <SlotRenderer\n slot={PluginSlot.OPERATION}\n context={{\n schema: props,\n }}\n pluginManager={pluginManager}\n />\n )}\n </>\n );\n};\n\nexport const OperationReplyInfo: React.FunctionComponent<Props> = (props) => {\n const { type = PayloadType.SEND, operation } = props;\n const [showMessages, setShowMessages] = useState(false);\n const [showChannel, setShowChannel] = useState(false);\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (reply === undefined) {\n return <></>;\n }\n\n const replyMessages = reply.messages();\n const explicitChannel = reply.channel();\n\n const replyAddress = reply.address()?.location();\n\n return (\n <div className=\"panel-item\">\n <div className=\"panel-item--center\">\n <div className=\"font-mono px-8 py-4\">\n <div className=\"border rounded\">\n <div\n className={`w-full ${\n type === PayloadType.REPLY\n ? 'bg-green-600 border-green-600'\n : 'bg-blue-600 border-blue-600'\n } text-sm rounded-t h-8 px-4 border text-white flex items-center`}\n >\n <strong>REPLY INFORMATION</strong>\n </div>\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2\" title={type}>\n REPLY CHANNEL INFORMATION\n </span>\n </h3>\n {explicitChannel?.address() ? (\n <div className=\"text-xs text-gray-700\">\n Reply will be provided via this designated address:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {explicitChannel.address()}{' '}\n </span>\n </div>\n ) : (\n replyAddress != null && (\n <div className=\"text-xs text-gray-700\">\n Reply will be directed to the address specified at this\n location:{' '}\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddress}\n </span>\n </div>\n )\n )}\n <div className=\"mt-2\">\n {explicitChannel && (\n <CollapseButton\n onClick={() => setShowChannel((prev) => !prev)}\n expanded={showChannel}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n View channel details\n </span>\n </CollapseButton>\n )}\n {explicitChannel && (\n <div\n className={`w-full mt-4 ${\n showChannel ? 'block' : 'hidden'\n }`}\n >\n <OperationReplyChannelInfo {...props} />{' '}\n </div>\n )}\n </div>\n </div>\n </div>\n <OperationReplyAddressInfo {...props} />\n {replyMessages.isEmpty() === false && (\n <div className=\"p-4\">\n <CollapseButton\n onClick={() => setShowMessages((prev) => !prev)}\n expanded={showMessages}\n >\n <span className=\"inline-block py-0.5 mr-1 text-gray-500 text-xs text-center rounded focus:outline-none\">\n Expected Reply{' '}\n {replyMessages.length > 1 ? 'Messages' : 'Message'}\n </span>\n </CollapseButton>\n <div\n className={`w-full mt-4 ${showMessages ? 'block' : 'hidden'}`}\n >\n {replyMessages.length > 1 ? (\n <div className=\"mt-2\">\n <ul>\n {replyMessages.all().map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <div className=\"mt-2\">\n <Message\n message={replyMessages.all()[0]}\n showExamples\n />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </div>\n\n <Extensions name=\"Operation Reply Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n\nexport const OperationReplyChannelInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n const reply = operation.reply();\n const channel = reply?.channel();\n const channelName = channel?.address() ?? '';\n\n const config = useConfig();\n const servers =\n typeof channel?.servers === 'function' && channel.servers().all();\n const parameters =\n channel?.parameters() !== undefined\n ? SchemaHelpers.parametersToSchema(channel.parameters())\n : undefined;\n\n if (!channel) {\n return <></>;\n }\n\n return (\n <div>\n {channel.address() && (\n <div className=\"mt-2 text-xs text-gray-700\">\n Address:{' '}\n <span className=\"border text-orange-600 rounded text-xs py-0 px-2\">\n {channel.address()}\n </span>\n </div>\n )}\n {channel.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{channel.description()}</Markdown>\n </div>\n )}\n {servers && servers.length > 0 ? (\n <div className=\"mt-2 text-sm\">\n <p>Available only on servers:</p>\n <ul className=\"flex flex-wrap leading-normal\">\n {servers.map((server) => (\n <li className=\"inline-block mt-2 mr-2\" key={server.id()}>\n <a\n href={`${window.location.pathname}#${CommonHelpers.getIdentifier(\n 'server-' + server.id(),\n config,\n )}`}\n className=\"border border-solid border-blue-300 hover:bg-blue-300 hover:text-blue-600 text-blue-500 font-bold no-underline text-xs rounded px-3 py-1 cursor-pointer\"\n >\n <span className=\"underline\">{server.id()}</span>\n </a>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n {channel.messages().all().length > 1 ? (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Messages:</span>\n <ul>\n {channel\n .messages()\n .all()\n .map((msg, idx) => (\n <li className=\"mt-4\" key={msg.id()}>\n <Message message={msg} index={idx} showExamples />\n </li>\n ))}\n </ul>\n </div>\n ) : (\n <div className=\"mt-2\">\n <span className=\"text-xs text-gray-700\">Message:</span>\n <div className=\"mt-2\">\n <Message message={channel.messages().all()[0]} showExamples />\n </div>\n </div>\n )}\n {parameters && (\n <div\n className=\"mt-2\"\n id={CommonHelpers.getIdentifier(\n `operation-${type}-${channelName}-parameters`,\n config,\n )}\n >\n <Schema schemaName=\"Parameters\" schema={parameters} expanded />\n </div>\n )}\n {channel.bindings() && (\n <div className=\"mt-2\">\n <Bindings name=\"Bindings\" bindings={channel.bindings()} />\n </div>\n )}\n </div>\n );\n};\n\nexport const OperationReplyAddressInfo: React.FunctionComponent<Props> = ({\n type = PayloadType.SEND,\n operation,\n}) => {\n if (type !== PayloadType.REPLY && type !== PayloadType.REQUEST) {\n return <></>;\n }\n const reply = operation.reply();\n if (!reply?.address) {\n return <></>;\n }\n const replyAddress = reply.address();\n\n if (!replyAddress) {\n return <></>;\n }\n\n const replyAddressLocation = replyAddress.location();\n\n return (\n <div className=\"flex\">\n <div\n className={`w-1 h-11 ${\n type === PayloadType.REPLY ? 'bg-green-600' : 'bg-blue-600'\n } mt-4`}\n />\n <div className=\"p-4\">\n <h3 className=\"text-xs\">\n <span className=\"mr-2 uppercase\" title={type}>\n REPLY address information\n </span>\n </h3>\n {replyAddressLocation && (\n <div className=\"text-xs text-gray-700\">\n REPLY will be sent to the address provided in:\n <span className=\"border text-orange-600 rounded text-xs ml-2 py-0 px-2\">\n {replyAddressLocation}\n </span>\n </div>\n )}\n {replyAddress.hasDescription() && (\n <div className=\"mt-2\">\n <Markdown>{replyAddress.description()}</Markdown>\n </div>\n )}\n <Extensions name=\"Operation Reply Address Extensions\" item={reply} />\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -72,12 +72,9 @@ var Sidebar = function () {
|
|
|
72
72
|
react_1.default.createElement("a", { className: "flex break-words no-underline text-gray-700 mt-2 hover:text-gray-900", href: "#schema-".concat(schema.id()), onClick: function () { return setShowSidebar(false); } },
|
|
73
73
|
react_1.default.createElement("div", { className: "break-all inline-block" }, schema.id()))));
|
|
74
74
|
}))));
|
|
75
|
-
var operationList = hasOperations && (react_1.default.createElement(
|
|
76
|
-
react_1.default.createElement("
|
|
77
|
-
|
|
78
|
-
react_1.default.createElement(OperationsList, null)),
|
|
79
|
-
showMessages && messagesList,
|
|
80
|
-
showSchemas && schemasList));
|
|
75
|
+
var operationList = hasOperations && (react_1.default.createElement("li", { className: "mb-3 mt-9" },
|
|
76
|
+
react_1.default.createElement("a", { className: "text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900", href: "#operations", onClick: function () { return setShowSidebar(false); } }, "Operations"),
|
|
77
|
+
react_1.default.createElement(OperationsList, null)));
|
|
81
78
|
return (react_1.default.createElement(SidebarContext.Provider, { value: { setShowSidebar: setShowSidebar } },
|
|
82
79
|
react_1.default.createElement("div", { className: "burger-menu rounded-full h-16 w-16 bg-white fixed bottom-16 right-8 flex items-center justify-center z-30 cursor-pointer shadow-md bg-teal-500", onClick: function () { return setShowSidebar(function (prev) { return !prev; }); }, "data-lol": showSidebar },
|
|
83
80
|
react_1.default.createElement("svg", { viewBox: "0 0 100 70", width: "40", height: "30", className: "fill-current text-gray-200" },
|
|
@@ -97,7 +94,9 @@ var Sidebar = function () {
|
|
|
97
94
|
asyncapi.servers().length > 0 && (react_1.default.createElement("li", { className: "mb-3 mt-9" },
|
|
98
95
|
react_1.default.createElement("a", { className: "text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900", href: "#servers", onClick: function () { return setShowSidebar(false); } }, "Servers"),
|
|
99
96
|
react_1.default.createElement(ServersList, null))),
|
|
100
|
-
operationList
|
|
97
|
+
operationList,
|
|
98
|
+
showMessages && messagesList,
|
|
99
|
+
showSchemas && schemasList))))));
|
|
101
100
|
};
|
|
102
101
|
exports.Sidebar = Sidebar;
|
|
103
102
|
var ServersList = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/containers/Sidebar/Sidebar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoD;AACpD,+CAAkD;AAClD,2CAAoD;AACpD,yCAA8C;AAE9C,iDAAuE;AAEvE,IAAM,cAAc,GAAG,eAAK,CAAC,aAAa,CAEvC;IACD,cAAc,EAAE,UAAC,KAAkD,IAAK,OAAA,KAAK,EAAL,CAAK;CAC9E,CAAC,CAAC;AAEI,IAAM,OAAO,GAA4B;;IACxC,IAAA,KAAgC,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAA9C,WAAW,QAAA,EAAE,cAAc,QAAmB,CAAC;IACtD,IAAM,QAAQ,GAAG,IAAA,kBAAO,GAAE,CAAC;IAC3B,IAAM,MAAM,GAAG,IAAA,oBAAS,GAAE,CAAC;IAE3B,IAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAM,IAAI,GAAG,MAAA,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,0CAAE,KAAK,EAAE,CAAC;IACtD,IAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;IACzC,IAAM,QAAQ,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,GAAG,GAAG,EAAE,CAAC;IAC9C,IAAM,OAAO,GAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,GAAG,GAAG,EAAE,CAAC;IAC5C,IAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IAEv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,OAAO,EAAE,cAAM,OAAA,SAAS,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,EAAL,CAAK,CAAC,EAA1B,CAA0B,EACzC,YAAY,EAAE;gBACZ,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY;aACjD;YAED,wCAAM,SAAS,EAAC,2CAA2C,IACxD,OAAO,CACH,CACQ;QACjB,sCAAI,SAAS,EAAE,UAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,6BAA0B,IACpE,QAAQ,CACN,CACD,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, { useState, useContext } from 'react';\nimport { CollapseButton } from '../../components';\nimport { useConfig, useSpec } from '../../contexts';\nimport { CommonHelpers } from '../../helpers';\nimport { PayloadType } from '../../types';\nimport { TagObject, filterObjectsByTags } from '../../helpers/sidebar';\n\nconst SidebarContext = React.createContext<{\n setShowSidebar: React.Dispatch<React.SetStateAction<boolean>>;\n}>({\n setShowSidebar: (value: boolean | ((prevValue: boolean) => boolean)) => value,\n});\n\nexport const Sidebar: React.FunctionComponent = () => {\n const [showSidebar, setShowSidebar] = useState(false);\n const asyncapi = useSpec();\n const config = useConfig();\n\n const info = asyncapi.info();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const logo = info.extensions().get('x-logo')?.value();\n const components = asyncapi.components();\n const messages = components?.messages().all();\n const schemas = components?.schemas().all();\n const hasOperations = asyncapi.operations().length > 0;\n\n const showMessages = config.show?.messages;\n const showSchemas = config.show?.schemas;\n\n const messagesList = messages?.length > 0 && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#messages\"\n onClick={() => setShowSidebar(false)}\n >\n Messages\n </a>\n <ul className=\"text-sm mt-2\">\n {messages.map((message, index) => (\n <li key={`menu-message-list-${message.name() ?? index}`}>\n <a\n className=\"flex break-words no-underline text-gray-700 mt-2 hover:text-gray-900\"\n href={`#message-${message.name() ?? message.id()}`}\n onClick={() => setShowSidebar(false)}\n >\n <div className=\"break-all inline-block\">{message.id()}</div>\n </a>\n </li>\n ))}\n </ul>\n </li>\n );\n\n const schemasList = schemas?.length > 0 && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#schemas\"\n onClick={() => setShowSidebar(false)}\n >\n Schemas\n </a>\n <ul className=\"text-sm mt-2\">\n {schemas.map((schema, index) => (\n <li key={`menu-message-list-${schema.id() ?? index}`}>\n <a\n className=\"flex break-words no-underline text-gray-700 mt-2 hover:text-gray-900\"\n href={`#schema-${schema.id()}`}\n onClick={() => setShowSidebar(false)}\n >\n <div className=\"break-all inline-block\">{schema.id()}</div>\n </a>\n </li>\n ))}\n </ul>\n </li>\n );\n\n const operationList = hasOperations && (\n <>\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#operations\"\n onClick={() => setShowSidebar(false)}\n >\n Operations\n </a>\n <OperationsList />\n </li>\n {showMessages && messagesList}\n {showSchemas && schemasList}\n </>\n );\n\n return (\n <SidebarContext.Provider value={{ setShowSidebar }}>\n <div\n className=\"burger-menu rounded-full h-16 w-16 bg-white fixed bottom-16 right-8 flex items-center justify-center z-30 cursor-pointer shadow-md bg-teal-500\"\n onClick={() => setShowSidebar((prev) => !prev)}\n data-lol={showSidebar}\n >\n <svg\n viewBox=\"0 0 100 70\"\n width=\"40\"\n height=\"30\"\n className=\"fill-current text-gray-200\"\n >\n <rect width=\"100\" height=\"10\" />\n <rect y=\"30\" width=\"100\" height=\"10\" />\n <rect y=\"60\" width=\"100\" height=\"10\" />\n </svg>\n </div>\n <div\n className={`${\n showSidebar ? 'block fixed w-full' : 'hidden'\n } sidebar relative w-64 max-h-screen h-full bg-gray-200 shadow z-20`}\n >\n <div\n className={`${\n showSidebar ? 'sidebar--wrapper' : ''\n } block fixed max-h-screen h-full font-sans px-4 pt-8 pb-16 overflow-y-auto bg-gray-200`}\n >\n <div className=\"sidebar--content\">\n <div>\n {logo ? (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n src={logo}\n alt={`${info.title()} logo, ${info.version()} version`}\n />\n ) : (\n <h1 className=\"text-2xl font-light\">\n {info.title()} {info.version()}\n </h1>\n )}\n </div>\n\n <ul className=\"text-sm mt-10 relative\">\n <li className=\"mb-3\">\n <a\n className=\"text-gray-700 no-underline hover:text-gray-900\"\n href=\"#introduction\"\n onClick={() => setShowSidebar(false)}\n >\n Introduction\n </a>\n </li>\n {asyncapi.servers().length > 0 && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#servers\"\n onClick={() => setShowSidebar(false)}\n >\n Servers\n </a>\n <ServersList />\n </li>\n )}\n {operationList}\n </ul>\n </div>\n </div>\n </div>\n </SidebarContext.Provider>\n );\n};\n\nconst ServersList: React.FunctionComponent = () => {\n const sidebarConfig = useConfig().sidebar;\n const asyncapi = useSpec();\n const servers = asyncapi.servers().all();\n const showServers = sidebarConfig?.showServers ?? 'byDefault';\n\n if (showServers === 'byDefault') {\n return (\n <ul className=\"text-sm mt-2\">\n {servers.map((server) => (\n <ServerItem serverName={server.id()} key={server.id()} />\n ))}\n </ul>\n );\n }\n\n let specTagNames: string[];\n if (showServers === 'bySpecTags') {\n specTagNames = (asyncapi.info().tags().all() ?? []).map((tag) =>\n tag.name(),\n );\n } else {\n const serverTagNamesSet = new Set<string>();\n servers.forEach((server) => {\n server.tags().forEach((t) => serverTagNamesSet.add(t.name()));\n });\n specTagNames = Array.from(serverTagNamesSet);\n }\n\n const serializedServers: TagObject[] = servers.map((server) => ({\n name: server.id(),\n tags: server.tags(),\n data: {},\n }));\n const { tagged, untagged } = filterObjectsByTags(\n specTagNames,\n serializedServers,\n );\n return (\n <ul className=\"text-sm mt-2\">\n {Array.from(tagged.entries()).map(([tag, taggedServers]) => (\n <li key={tag}>\n <ItemsByTagItem tagName={tag}>\n {taggedServers.map(({ name: serverName }) => (\n <ServerItem serverName={serverName} key={serverName} />\n ))}\n </ItemsByTagItem>\n </li>\n ))}\n {untagged.length > 0 ? (\n <li>\n <ItemsByTagItem tagName=\"Untagged\">\n {untagged.map(({ name: serverName }) => (\n <ServerItem serverName={serverName} key={serverName} />\n ))}\n </ItemsByTagItem>\n </li>\n ) : null}\n </ul>\n );\n};\n\ninterface OperationItemProps {\n label: string;\n type: PayloadType;\n operationHrefId: string;\n}\nconst OperationsList: React.FunctionComponent = () => {\n const config = useConfig();\n const sidebarConfig = config.sidebar;\n const asyncapi = useSpec();\n const operations = asyncapi.operations().all();\n const showOperations = sidebarConfig?.showOperations ?? 'byDefault';\n\n const processedOperations: TagObject<OperationItemProps>[] = operations.map(\n (operation) => {\n const operationChannel = operation.channels();\n const operationHrefId = CommonHelpers.getOperationIdentifier({\n operation,\n config,\n });\n const type = CommonHelpers.getOperationType(operation);\n\n const specV = asyncapi.version();\n const version = specV.localeCompare('2.6.0', undefined, {\n numeric: true,\n });\n let label = '';\n if (version === 0 || sidebarConfig?.useChannelAddressAsIdentifier) {\n // old version uses different labels for the operations\n const operationChannels = operationChannel.all();\n const channelAddress = operationChannels[0]?.address() ?? '';\n const operationSummary = operation.summary();\n label = operationSummary ?? channelAddress;\n } else {\n label = operation.id() ?? '';\n }\n return {\n name: `${type}-${operation.id()}`,\n tags: operation.tags(),\n data: {\n label,\n type,\n operationHrefId,\n },\n };\n },\n );\n\n if (showOperations === 'byDefault') {\n return (\n <ul className=\"text-sm mt-2\">\n {processedOperations.map(({ name, data }) => (\n <OperationItem key={name} {...data} />\n ))}\n </ul>\n );\n }\n\n let operationTagNames: string[];\n if (showOperations === 'bySpecTags') {\n operationTagNames = (asyncapi.info().tags().all() ?? []).map((tag) =>\n tag.name(),\n );\n } else {\n const operationTagNamesSet = new Set<string>();\n operations.forEach((operation) => {\n operation\n .tags()\n .all()\n .forEach((t) => operationTagNamesSet.add(t.name()));\n });\n operationTagNames = Array.from(operationTagNamesSet);\n }\n\n const { tagged, untagged } = filterObjectsByTags(\n operationTagNames,\n processedOperations,\n );\n return (\n <ul className=\"text-sm mt-2\">\n {Array.from(tagged.entries()).map(([tag, taggedOperations]) => (\n <li key={tag}>\n <ItemsByTagItem tagName={tag}>\n {taggedOperations.map(({ name, data }) => (\n <OperationItem key={name} {...data} />\n ))}\n </ItemsByTagItem>\n </li>\n ))}\n {untagged.length > 0 ? (\n <li>\n <ItemsByTagItem tagName=\"Untagged\">\n {untagged.map(({ name, data }) => (\n <OperationItem key={name} {...data} />\n ))}\n </ItemsByTagItem>\n </li>\n ) : null}\n </ul>\n );\n};\n\nconst OperationItem: React.FunctionComponent<OperationItemProps> = ({\n type,\n operationHrefId,\n label,\n}) => {\n const config = useConfig();\n const { setShowSidebar } = useContext(SidebarContext);\n const specV = useSpec().version();\n const version = specV.localeCompare('2.6.0', undefined, { numeric: true });\n const isAsyncAPIv2 = version === 0;\n const { typeLabel, backgroundColor } =\n CommonHelpers.getOperationDesignInformation({\n type,\n config,\n isAsyncAPIv2,\n });\n const bgColors = [\n 'bg-red-600',\n 'bg-orange-600',\n 'bg-green-600',\n 'bg-blue-600',\n ];\n\n return (\n <li key={`menu-operation-list-${operationHrefId}`}>\n <a\n className=\"flex no-underline text-gray-700 mb-2 hover:text-gray-900\"\n href={`#${operationHrefId}`}\n onClick={() => setShowSidebar(false)}\n >\n <strong\n className={`h-6 no-underline text-white uppercase p-1 mr-2 rounded text-xs ${bgColors.includes(backgroundColor) && backgroundColor}`}\n title={typeLabel}\n >\n {typeLabel}\n </strong>\n <span className=\"break-all inline-block\">{label}</span>\n </a>\n </li>\n );\n};\n\ninterface ServerItemProps {\n serverName: string;\n}\n\nconst ServerItem: React.FunctionComponent<ServerItemProps> = ({\n serverName,\n}) => {\n const { setShowSidebar } = useContext(SidebarContext);\n\n return (\n <li>\n <a\n className=\"flex no-underline text-gray-700 mb-2 hover:text-gray-900\"\n href={`#server-${serverName}`}\n onClick={() => setShowSidebar(false)}\n >\n <span className=\"break-all inline-block\">{serverName}</span>\n </a>\n </li>\n );\n};\n\ninterface ItemsByTagItemProps {\n tagName: string;\n children: React.ReactNode;\n}\n\nconst ItemsByTagItem: React.FunctionComponent<ItemsByTagItemProps> = ({\n tagName,\n children,\n}) => {\n const [expand, setExpand] = useState(false);\n\n return (\n <div>\n <CollapseButton\n onClick={() => setExpand((prev) => !prev)}\n chevronProps={{\n className: expand ? '-rotate-180' : '-rotate-90',\n }}\n >\n <span className=\"text-sm inline-block mt-1 font-extralight\">\n {tagName}\n </span>\n </CollapseButton>\n <ul className={`${expand ? 'block' : 'hidden'} text-sm mt-2 font-light`}>\n {children}\n </ul>\n </div>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/containers/Sidebar/Sidebar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoD;AACpD,+CAAkD;AAClD,2CAAoD;AACpD,yCAA8C;AAE9C,iDAAuE;AAEvE,IAAM,cAAc,GAAG,eAAK,CAAC,aAAa,CAEvC;IACD,cAAc,EAAE,UAAC,KAAkD,IAAK,OAAA,KAAK,EAAL,CAAK;CAC9E,CAAC,CAAC;AAEI,IAAM,OAAO,GAA4B;;IACxC,IAAA,KAAgC,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAA9C,WAAW,QAAA,EAAE,cAAc,QAAmB,CAAC;IACtD,IAAM,QAAQ,GAAG,IAAA,kBAAO,GAAE,CAAC;IAC3B,IAAM,MAAM,GAAG,IAAA,oBAAS,GAAE,CAAC;IAE3B,IAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE7B,IAAM,IAAI,GAAG,MAAA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AAE,kBAAW,UAAU,CAAE,EAC7B,OAAO,EAAE,cAAM,OAAA,cAAc,CAAC,KAAK,CAAC,EAArB,CAAqB;YAEpC,wCAAM,SAAS,EAAC,wBAAwB,IAAE,UAAU,CAAQ,CAC1D,CACD,CACN,CAAC;AACJ,CAAC,CAAC;AAOF,IAAM,cAAc,GAAiD,UAAC,EAGrE;QAFC,OAAO,aAAA,EACP,QAAQ,cAAA;IAEF,IAAA,KAAsB,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAApC,MAAM,QAAA,EAAE,SAAS,QAAmB,CAAC;IAE5C,OAAO,CACL;QACE,8BAAC,2BAAc,IACb,OAAO,EAAE,cAAM,OAAA,SAAS,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,EAAL,CAAK,CAAC,EAA1B,CAA0B,EACzC,YAAY,EAAE;gBACZ,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY;aACjD;YAED,wCAAM,SAAS,EAAC,2CAA2C,IACxD,OAAO,CACH,CACQ;QACjB,sCAAI,SAAS,EAAE,UAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,6BAA0B,IACpE,QAAQ,CACN,CACD,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, { useState, useContext } from 'react';\nimport { CollapseButton } from '../../components';\nimport { useConfig, useSpec } from '../../contexts';\nimport { CommonHelpers } from '../../helpers';\nimport { PayloadType } from '../../types';\nimport { TagObject, filterObjectsByTags } from '../../helpers/sidebar';\n\nconst SidebarContext = React.createContext<{\n setShowSidebar: React.Dispatch<React.SetStateAction<boolean>>;\n}>({\n setShowSidebar: (value: boolean | ((prevValue: boolean) => boolean)) => value,\n});\n\nexport const Sidebar: React.FunctionComponent = () => {\n const [showSidebar, setShowSidebar] = useState(false);\n const asyncapi = useSpec();\n const config = useConfig();\n\n const info = asyncapi.info();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const logo = info.extensions().get('x-logo')?.value();\n const components = asyncapi.components();\n const messages = components?.messages().all();\n const schemas = components?.schemas().all();\n const hasOperations = asyncapi.operations().length > 0;\n\n const showMessages = config.show?.messages;\n const showSchemas = config.show?.schemas;\n\n const messagesList = messages?.length > 0 && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#messages\"\n onClick={() => setShowSidebar(false)}\n >\n Messages\n </a>\n <ul className=\"text-sm mt-2\">\n {messages.map((message, index) => (\n <li key={`menu-message-list-${message.name() ?? index}`}>\n <a\n className=\"flex break-words no-underline text-gray-700 mt-2 hover:text-gray-900\"\n href={`#message-${message.name() ?? message.id()}`}\n onClick={() => setShowSidebar(false)}\n >\n <div className=\"break-all inline-block\">{message.id()}</div>\n </a>\n </li>\n ))}\n </ul>\n </li>\n );\n\n const schemasList = schemas?.length > 0 && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#schemas\"\n onClick={() => setShowSidebar(false)}\n >\n Schemas\n </a>\n <ul className=\"text-sm mt-2\">\n {schemas.map((schema, index) => (\n <li key={`menu-message-list-${schema.id() ?? index}`}>\n <a\n className=\"flex break-words no-underline text-gray-700 mt-2 hover:text-gray-900\"\n href={`#schema-${schema.id()}`}\n onClick={() => setShowSidebar(false)}\n >\n <div className=\"break-all inline-block\">{schema.id()}</div>\n </a>\n </li>\n ))}\n </ul>\n </li>\n );\n\n const operationList = hasOperations && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#operations\"\n onClick={() => setShowSidebar(false)}\n >\n Operations\n </a>\n <OperationsList />\n </li>\n );\n\n return (\n <SidebarContext.Provider value={{ setShowSidebar }}>\n <div\n className=\"burger-menu rounded-full h-16 w-16 bg-white fixed bottom-16 right-8 flex items-center justify-center z-30 cursor-pointer shadow-md bg-teal-500\"\n onClick={() => setShowSidebar((prev) => !prev)}\n data-lol={showSidebar}\n >\n <svg\n viewBox=\"0 0 100 70\"\n width=\"40\"\n height=\"30\"\n className=\"fill-current text-gray-200\"\n >\n <rect width=\"100\" height=\"10\" />\n <rect y=\"30\" width=\"100\" height=\"10\" />\n <rect y=\"60\" width=\"100\" height=\"10\" />\n </svg>\n </div>\n <div\n className={`${\n showSidebar ? 'block fixed w-full' : 'hidden'\n } sidebar relative w-64 max-h-screen h-full bg-gray-200 shadow z-20`}\n >\n <div\n className={`${\n showSidebar ? 'sidebar--wrapper' : ''\n } block fixed max-h-screen h-full font-sans px-4 pt-8 pb-16 overflow-y-auto bg-gray-200`}\n >\n <div className=\"sidebar--content\">\n <div>\n {logo ? (\n // eslint-disable-next-line @next/next/no-img-element\n <img\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n src={logo}\n alt={`${info.title()} logo, ${info.version()} version`}\n />\n ) : (\n <h1 className=\"text-2xl font-light\">\n {info.title()} {info.version()}\n </h1>\n )}\n </div>\n\n <ul className=\"text-sm mt-10 relative\">\n <li className=\"mb-3\">\n <a\n className=\"text-gray-700 no-underline hover:text-gray-900\"\n href=\"#introduction\"\n onClick={() => setShowSidebar(false)}\n >\n Introduction\n </a>\n </li>\n {asyncapi.servers().length > 0 && (\n <li className=\"mb-3 mt-9\">\n <a\n className=\"text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900\"\n href=\"#servers\"\n onClick={() => setShowSidebar(false)}\n >\n Servers\n </a>\n <ServersList />\n </li>\n )}\n {operationList}\n {showMessages && messagesList}\n {showSchemas && schemasList}\n </ul>\n </div>\n </div>\n </div>\n </SidebarContext.Provider>\n );\n};\n\nconst ServersList: React.FunctionComponent = () => {\n const sidebarConfig = useConfig().sidebar;\n const asyncapi = useSpec();\n const servers = asyncapi.servers().all();\n const showServers = sidebarConfig?.showServers ?? 'byDefault';\n\n if (showServers === 'byDefault') {\n return (\n <ul className=\"text-sm mt-2\">\n {servers.map((server) => (\n <ServerItem serverName={server.id()} key={server.id()} />\n ))}\n </ul>\n );\n }\n\n let specTagNames: string[];\n if (showServers === 'bySpecTags') {\n specTagNames = (asyncapi.info().tags().all() ?? []).map((tag) =>\n tag.name(),\n );\n } else {\n const serverTagNamesSet = new Set<string>();\n servers.forEach((server) => {\n server.tags().forEach((t) => serverTagNamesSet.add(t.name()));\n });\n specTagNames = Array.from(serverTagNamesSet);\n }\n\n const serializedServers: TagObject[] = servers.map((server) => ({\n name: server.id(),\n tags: server.tags(),\n data: {},\n }));\n const { tagged, untagged } = filterObjectsByTags(\n specTagNames,\n serializedServers,\n );\n return (\n <ul className=\"text-sm mt-2\">\n {Array.from(tagged.entries()).map(([tag, taggedServers]) => (\n <li key={tag}>\n <ItemsByTagItem tagName={tag}>\n {taggedServers.map(({ name: serverName }) => (\n <ServerItem serverName={serverName} key={serverName} />\n ))}\n </ItemsByTagItem>\n </li>\n ))}\n {untagged.length > 0 ? (\n <li>\n <ItemsByTagItem tagName=\"Untagged\">\n {untagged.map(({ name: serverName }) => (\n <ServerItem serverName={serverName} key={serverName} />\n ))}\n </ItemsByTagItem>\n </li>\n ) : null}\n </ul>\n );\n};\n\ninterface OperationItemProps {\n label: string;\n type: PayloadType;\n operationHrefId: string;\n}\nconst OperationsList: React.FunctionComponent = () => {\n const config = useConfig();\n const sidebarConfig = config.sidebar;\n const asyncapi = useSpec();\n const operations = asyncapi.operations().all();\n const showOperations = sidebarConfig?.showOperations ?? 'byDefault';\n\n const processedOperations: TagObject<OperationItemProps>[] = operations.map(\n (operation) => {\n const operationChannel = operation.channels();\n const operationHrefId = CommonHelpers.getOperationIdentifier({\n operation,\n config,\n });\n const type = CommonHelpers.getOperationType(operation);\n\n const specV = asyncapi.version();\n const version = specV.localeCompare('2.6.0', undefined, {\n numeric: true,\n });\n let label = '';\n if (version === 0 || sidebarConfig?.useChannelAddressAsIdentifier) {\n // old version uses different labels for the operations\n const operationChannels = operationChannel.all();\n const channelAddress = operationChannels[0]?.address() ?? '';\n const operationSummary = operation.summary();\n label = operationSummary ?? channelAddress;\n } else {\n label = operation.id() ?? '';\n }\n return {\n name: `${type}-${operation.id()}`,\n tags: operation.tags(),\n data: {\n label,\n type,\n operationHrefId,\n },\n };\n },\n );\n\n if (showOperations === 'byDefault') {\n return (\n <ul className=\"text-sm mt-2\">\n {processedOperations.map(({ name, data }) => (\n <OperationItem key={name} {...data} />\n ))}\n </ul>\n );\n }\n\n let operationTagNames: string[];\n if (showOperations === 'bySpecTags') {\n operationTagNames = (asyncapi.info().tags().all() ?? []).map((tag) =>\n tag.name(),\n );\n } else {\n const operationTagNamesSet = new Set<string>();\n operations.forEach((operation) => {\n operation\n .tags()\n .all()\n .forEach((t) => operationTagNamesSet.add(t.name()));\n });\n operationTagNames = Array.from(operationTagNamesSet);\n }\n\n const { tagged, untagged } = filterObjectsByTags(\n operationTagNames,\n processedOperations,\n );\n return (\n <ul className=\"text-sm mt-2\">\n {Array.from(tagged.entries()).map(([tag, taggedOperations]) => (\n <li key={tag}>\n <ItemsByTagItem tagName={tag}>\n {taggedOperations.map(({ name, data }) => (\n <OperationItem key={name} {...data} />\n ))}\n </ItemsByTagItem>\n </li>\n ))}\n {untagged.length > 0 ? (\n <li>\n <ItemsByTagItem tagName=\"Untagged\">\n {untagged.map(({ name, data }) => (\n <OperationItem key={name} {...data} />\n ))}\n </ItemsByTagItem>\n </li>\n ) : null}\n </ul>\n );\n};\n\nconst OperationItem: React.FunctionComponent<OperationItemProps> = ({\n type,\n operationHrefId,\n label,\n}) => {\n const config = useConfig();\n const { setShowSidebar } = useContext(SidebarContext);\n const specV = useSpec().version();\n const version = specV.localeCompare('2.6.0', undefined, { numeric: true });\n const isAsyncAPIv2 = version === 0;\n const { typeLabel, backgroundColor } =\n CommonHelpers.getOperationDesignInformation({\n type,\n config,\n isAsyncAPIv2,\n });\n const bgColors = [\n 'bg-red-600',\n 'bg-orange-600',\n 'bg-green-600',\n 'bg-blue-600',\n ];\n\n return (\n <li key={`menu-operation-list-${operationHrefId}`}>\n <a\n className=\"flex no-underline text-gray-700 mb-2 hover:text-gray-900\"\n href={`#${operationHrefId}`}\n onClick={() => setShowSidebar(false)}\n >\n <strong\n className={`h-6 no-underline text-white uppercase p-1 mr-2 rounded text-xs ${bgColors.includes(backgroundColor) && backgroundColor}`}\n title={typeLabel}\n >\n {typeLabel}\n </strong>\n <span className=\"break-all inline-block\">{label}</span>\n </a>\n </li>\n );\n};\n\ninterface ServerItemProps {\n serverName: string;\n}\n\nconst ServerItem: React.FunctionComponent<ServerItemProps> = ({\n serverName,\n}) => {\n const { setShowSidebar } = useContext(SidebarContext);\n\n return (\n <li>\n <a\n className=\"flex no-underline text-gray-700 mb-2 hover:text-gray-900\"\n href={`#server-${serverName}`}\n onClick={() => setShowSidebar(false)}\n >\n <span className=\"break-all inline-block\">{serverName}</span>\n </a>\n </li>\n );\n};\n\ninterface ItemsByTagItemProps {\n tagName: string;\n children: React.ReactNode;\n}\n\nconst ItemsByTagItem: React.FunctionComponent<ItemsByTagItemProps> = ({\n tagName,\n children,\n}) => {\n const [expand, setExpand] = useState(false);\n\n return (\n <div>\n <CollapseButton\n onClick={() => setExpand((prev) => !prev)}\n chevronProps={{\n className: expand ? '-rotate-180' : '-rotate-90',\n }}\n >\n <span className=\"text-sm inline-block mt-1 font-extralight\">\n {tagName}\n </span>\n </CollapseButton>\n <ul className={`${expand ? 'block' : 'hidden'} text-sm mt-2 font-light`}>\n {children}\n </ul>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePlugin = exports.PluginContext = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
exports.PluginContext = (0, react_1.createContext)(undefined);
|
|
6
|
+
function usePlugin() {
|
|
7
|
+
return (0, react_1.useContext)(exports.PluginContext);
|
|
8
|
+
}
|
|
9
|
+
exports.usePlugin = usePlugin;
|
|
10
|
+
//# sourceMappingURL=usePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlugin.js","sourceRoot":"","sources":["../../../src/contexts/usePlugin.ts"],"names":[],"mappings":";;;AAAA,+BAAkD;AAGrC,QAAA,aAAa,GAAG,IAAA,qBAAa,EACxC,SAAS,CACV,CAAC;AAEF,SAAgB,SAAS;IACvB,OAAO,IAAA,kBAAU,EAAC,qBAAa,CAAC,CAAC;AACnC,CAAC;AAFD,8BAEC","sourcesContent":["import { createContext, useContext } from 'react';\nimport { PluginManager } from '../helpers/pluginManager';\n\nexport const PluginContext = createContext<PluginManager | undefined>(\n undefined,\n);\n\nexport function usePlugin() {\n return useContext(PluginContext);\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluginManager = void 0;
|
|
4
|
+
var PluginManager = (function () {
|
|
5
|
+
function PluginManager(initialContext) {
|
|
6
|
+
this.plugins = new Map();
|
|
7
|
+
this.slotComponents = new Map();
|
|
8
|
+
this.eventListeners = new Map();
|
|
9
|
+
this.context = initialContext;
|
|
10
|
+
}
|
|
11
|
+
PluginManager.prototype.register = function (plugin) {
|
|
12
|
+
if (this.plugins.has(plugin.name)) {
|
|
13
|
+
console.warn("Plugin ".concat(plugin.name, " is already registered"));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var api = this.createPluginAPI(plugin);
|
|
17
|
+
plugin.install(api);
|
|
18
|
+
this.plugins.set(plugin.name, plugin);
|
|
19
|
+
};
|
|
20
|
+
PluginManager.prototype.unregister = function (pluginName) {
|
|
21
|
+
var plugin = this.plugins.get(pluginName);
|
|
22
|
+
if (!plugin) {
|
|
23
|
+
console.warn("Plugin \"".concat(pluginName, "\" not found"));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.plugins.delete(pluginName);
|
|
27
|
+
this.slotComponents.forEach(function (components) {
|
|
28
|
+
var index = components.findIndex(function (c) {
|
|
29
|
+
return c.pluginName === pluginName;
|
|
30
|
+
});
|
|
31
|
+
if (index > -1) {
|
|
32
|
+
components.splice(index, 1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
PluginManager.prototype.createPluginAPI = function (plugin) {
|
|
37
|
+
var _this = this;
|
|
38
|
+
return {
|
|
39
|
+
registerComponent: function (slot, component, options) {
|
|
40
|
+
var _a;
|
|
41
|
+
if (options === void 0) { options = {}; }
|
|
42
|
+
if (!_this.slotComponents.has(slot)) {
|
|
43
|
+
_this.slotComponents.set(slot, []);
|
|
44
|
+
}
|
|
45
|
+
var priority = (_a = options.priority) !== null && _a !== void 0 ? _a : 100;
|
|
46
|
+
_this.slotComponents.get(slot).push({
|
|
47
|
+
component: component,
|
|
48
|
+
priority: priority,
|
|
49
|
+
label: options.label,
|
|
50
|
+
pluginName: plugin === null || plugin === void 0 ? void 0 : plugin.name,
|
|
51
|
+
});
|
|
52
|
+
_this.slotComponents.get(slot).sort(function (a, b) { return b.priority - a.priority; });
|
|
53
|
+
},
|
|
54
|
+
onSpecLoaded: function (callback) {
|
|
55
|
+
_this.on('specLoaded', callback);
|
|
56
|
+
},
|
|
57
|
+
getContext: function () { return _this.context; },
|
|
58
|
+
on: function (eventName, callback) {
|
|
59
|
+
_this.on(eventName, callback);
|
|
60
|
+
},
|
|
61
|
+
off: function (eventName, callback) {
|
|
62
|
+
_this.off(eventName, callback);
|
|
63
|
+
},
|
|
64
|
+
emit: function (eventName, data) {
|
|
65
|
+
_this.emit(eventName, data);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
PluginManager.prototype.on = function (eventName, callback) {
|
|
70
|
+
if (!this.eventListeners.has(eventName)) {
|
|
71
|
+
this.eventListeners.set(eventName, new Set());
|
|
72
|
+
}
|
|
73
|
+
this.eventListeners.get(eventName).add(callback);
|
|
74
|
+
};
|
|
75
|
+
PluginManager.prototype.off = function (eventName, callback) {
|
|
76
|
+
var listeners = this.eventListeners.get(eventName);
|
|
77
|
+
if (listeners) {
|
|
78
|
+
listeners.delete(callback);
|
|
79
|
+
if (listeners.size === 0) {
|
|
80
|
+
this.eventListeners.delete(eventName);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
PluginManager.prototype.emit = function (eventName, data) {
|
|
85
|
+
var eventListeners = this.eventListeners.get(eventName);
|
|
86
|
+
if (eventListeners) {
|
|
87
|
+
eventListeners.forEach(function (callback) { return callback(data); });
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
PluginManager.prototype.listeners = function (eventName) {
|
|
91
|
+
var listeners = this.eventListeners.get(eventName);
|
|
92
|
+
return listeners ? Array.from(listeners) : [];
|
|
93
|
+
};
|
|
94
|
+
PluginManager.prototype.eventNames = function () {
|
|
95
|
+
return Array.from(this.eventListeners.keys());
|
|
96
|
+
};
|
|
97
|
+
PluginManager.prototype.getComponentsForSlot = function (slot) {
|
|
98
|
+
var _a;
|
|
99
|
+
return ((_a = this.slotComponents.get(slot)) !== null && _a !== void 0 ? _a : []).map(function (c) { return c.component; });
|
|
100
|
+
};
|
|
101
|
+
PluginManager.prototype.updateContext = function (updates) {
|
|
102
|
+
this.context = updates;
|
|
103
|
+
};
|
|
104
|
+
PluginManager.prototype.getPlugin = function (name) {
|
|
105
|
+
return this.plugins.get(name);
|
|
106
|
+
};
|
|
107
|
+
PluginManager.prototype.listPlugins = function () {
|
|
108
|
+
return Array.from(this.plugins.values()).map(function (p) { return ({
|
|
109
|
+
name: p.name,
|
|
110
|
+
version: p.version,
|
|
111
|
+
}); });
|
|
112
|
+
};
|
|
113
|
+
return PluginManager;
|
|
114
|
+
}());
|
|
115
|
+
exports.PluginManager = PluginManager;
|
|
116
|
+
//# sourceMappingURL=pluginManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,CAAC;IAED,kCAAU,GAAV;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,4CAAoB,GAApB,UACE,IAAgB;;QAEhB,OAAO,CAAC,MAAA,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,SAAS,EAAX,CAAW,CAAC,CAAC;IACvE,CAAC;IAED,qCAAa,GAAb,UAAc,OAAsB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,iCAAS,GAAT,UAAU,IAAY;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,mCAAW,GAAX;QACE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC;YACnD,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,EAHkD,CAGlD,CAAC,CAAC;IACN,CAAC;IACH,oBAAC;AAAD,CAAC,AA3ID,IA2IC;AAEQ,sCAAa","sourcesContent":["import {\n AsyncApiPlugin,\n ComponentSlotProps,\n EventListener,\n MessageBus,\n PluginAPI,\n PluginContext,\n PluginSlot,\n} from '../types';\n\nclass PluginManager implements MessageBus {\n private readonly plugins = new Map<string, AsyncApiPlugin>();\n private readonly slotComponents = new Map<\n PluginSlot,\n {\n component: React.ComponentType<ComponentSlotProps>;\n priority: number;\n label?: string;\n pluginName: string;\n }[]\n >();\n private readonly eventListeners = new Map<string, Set<EventListener>>();\n private context: PluginContext;\n\n constructor(initialContext: PluginContext) {\n this.context = initialContext;\n }\n\n register(plugin: AsyncApiPlugin): void {\n if (this.plugins.has(plugin.name)) {\n console.warn(`Plugin ${plugin.name} is already registered`);\n return;\n }\n\n const api = this.createPluginAPI(plugin);\n plugin.install(api);\n this.plugins.set(plugin.name, plugin);\n }\n\n unregister(pluginName: string): void {\n const plugin = this.plugins.get(pluginName);\n if (!plugin) {\n console.warn(`Plugin \"${pluginName}\" not found`);\n return;\n }\n\n this.plugins.delete(pluginName);\n\n this.slotComponents.forEach((components) => {\n const index = components.findIndex((c) => {\n return c.pluginName === pluginName;\n });\n if (index > -1) {\n components.splice(index, 1);\n }\n });\n }\n\n private createPluginAPI(plugin: AsyncApiPlugin): PluginAPI {\n return {\n registerComponent: (slot, component, options = {}) => {\n if (!this.slotComponents.has(slot)) {\n this.slotComponents.set(slot, []);\n }\n\n const priority = options.priority ?? 100;\n this.slotComponents.get(slot)!.push({\n component,\n priority,\n label: options.label,\n pluginName: plugin?.name,\n });\n\n this.slotComponents.get(slot)!.sort((a, b) => b.priority - a.priority);\n },\n\n onSpecLoaded: (callback) => {\n this.on('specLoaded', callback);\n },\n\n getContext: () => this.context,\n\n on: (eventName, callback) => {\n this.on(eventName, callback);\n },\n\n off: (eventName, callback) => {\n this.off(eventName, callback);\n },\n\n emit: (eventName, data) => {\n this.emit(eventName, data);\n },\n };\n }\n\n on(eventName: string, callback: (data: unknown) => void): void {\n if (!this.eventListeners.has(eventName)) {\n this.eventListeners.set(eventName, new Set());\n }\n this.eventListeners.get(eventName)!.add(callback);\n }\n\n off(eventName: string, callback: (data: unknown) => void): void {\n const listeners = this.eventListeners.get(eventName);\n if (listeners) {\n listeners.delete(callback);\n if (listeners.size === 0) {\n this.eventListeners.delete(eventName);\n }\n }\n }\n\n public emit(eventName: string, data: unknown): void {\n const eventListeners = this.eventListeners.get(eventName);\n if (eventListeners) {\n eventListeners.forEach((callback) => callback(data));\n }\n }\n\n listeners(eventName: string): EventListener[] {\n const listeners = this.eventListeners.get(eventName);\n return listeners ? Array.from(listeners) : [];\n }\n\n eventNames(): string[] {\n return Array.from(this.eventListeners.keys());\n }\n\n getComponentsForSlot(\n slot: PluginSlot,\n ): React.ComponentType<ComponentSlotProps>[] {\n return (this.slotComponents.get(slot) ?? []).map((c) => c.component);\n }\n\n updateContext(updates: PluginContext): void {\n this.context = updates;\n }\n\n getPlugin(name: string): AsyncApiPlugin | undefined {\n return this.plugins.get(name);\n }\n\n listPlugins(): { name: string; version: string }[] {\n return Array.from(this.plugins.values()).map((p) => ({\n name: p.name,\n version: p.version,\n }));\n }\n}\n\nexport { PluginManager };\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.hljs = exports.AsyncApiComponentWP = void 0;
|
|
6
|
+
exports.hljs = exports.AsyncApiComponentWP = exports.PluginSlot = void 0;
|
|
7
7
|
var AsyncApi_1 = __importDefault(require("./containers/AsyncApi/AsyncApi"));
|
|
8
8
|
var Standalone_1 = __importDefault(require("./containers/AsyncApi/Standalone"));
|
|
9
9
|
exports.AsyncApiComponentWP = Standalone_1.default;
|
|
10
|
+
var types_1 = require("./types");
|
|
11
|
+
Object.defineProperty(exports, "PluginSlot", { enumerable: true, get: function () { return types_1.PluginSlot; } });
|
|
10
12
|
var helpers_1 = require("./helpers");
|
|
11
13
|
Object.defineProperty(exports, "hljs", { enumerable: true, get: function () { return helpers_1.hljs; } });
|
|
12
14
|
exports.default = AsyncApi_1.default;
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,4EAA+D;AAC/D,gFAAmE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,4EAA+D;AAC/D,gFAAmE;AAe1D,8BAfF,oBAAmB,CAeE;AAX5B,iCAOiB;AAFf,mGAAA,UAAU,OAAA;AAIZ,qCAAiC;AAEH,qFAFrB,cAAI,OAEqB;AAClC,kBAAe,kBAAiB,CAAC","sourcesContent":["import AsyncApiComponent from './containers/AsyncApi/AsyncApi';\nimport AsyncApiComponentWP from './containers/AsyncApi/Standalone';\n\nexport { AsyncApiProps } from './containers/AsyncApi/AsyncApi';\nexport { ConfigInterface } from './config/config';\nexport {\n FetchingSchemaInterface,\n ExtensionComponentProps,\n AsyncApiPlugin,\n PluginAPI,\n PluginSlot,\n PluginContext,\n} from './types';\n\nimport { hljs } from './helpers';\n\nexport { AsyncApiComponentWP, hljs };\nexport default AsyncApiComponent;\n"]}
|
package/lib/cjs/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PayloadType = exports.isFetchingSchemaInterface = void 0;
|
|
3
|
+
exports.PluginSlot = exports.PayloadType = exports.isFetchingSchemaInterface = void 0;
|
|
4
4
|
function isFetchingSchemaInterface(schema) {
|
|
5
5
|
return schema.url !== undefined;
|
|
6
6
|
}
|
|
@@ -12,4 +12,9 @@ var PayloadType;
|
|
|
12
12
|
PayloadType["REQUEST"] = "request";
|
|
13
13
|
PayloadType["REPLY"] = "reply";
|
|
14
14
|
})(PayloadType = exports.PayloadType || (exports.PayloadType = {}));
|
|
15
|
+
var PluginSlot;
|
|
16
|
+
(function (PluginSlot) {
|
|
17
|
+
PluginSlot["OPERATION"] = "operation";
|
|
18
|
+
PluginSlot["INFO"] = "info";
|
|
19
|
+
})(PluginSlot = exports.PluginSlot || (exports.PluginSlot = {}));
|
|
15
20
|
//# sourceMappingURL=types.js.map
|
package/lib/cjs/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAeA,SAAgB,yBAAyB,CACvC,MAAmB;IAEnB,OAAQ,MAAkC,CAAC,GAAG,KAAK,SAAS,CAAC;AAC/D,CAAC;AAJD,8DAIC;AAYD,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB","sourcesContent":["import { AsyncAPIDocumentInterface, BaseModel } from '@asyncapi/parser';\n\nexport type PropsSchema =\n | string\n | FetchingSchemaInterface\n | AsyncAPIDocumentInterface\n | object;\n\nexport type NullableAsyncApi = AsyncAPIDocumentInterface | null;\n\nexport interface AsyncApiState {\n validatedSchema: NullableAsyncApi;\n error?: ErrorObject;\n}\n\nexport function isFetchingSchemaInterface(\n schema: PropsSchema,\n): schema is FetchingSchemaInterface {\n return (schema as FetchingSchemaInterface).url !== undefined;\n}\n\nexport interface FetchingSchemaInterface {\n url: string;\n requestOptions?: RequestInit;\n}\n\nexport interface ParserReturn {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nexport enum PayloadType {\n SEND = 'send',\n RECEIVE = 'receive',\n REQUEST = 'request',\n REPLY = 'reply',\n}\n\nexport interface MessageExample {\n name?: string;\n summary?: string;\n example: unknown;\n}\n\nexport interface ValidationError {\n title: string;\n location?: {\n jsonPointer: string;\n startLine: number;\n startColumn: number;\n startOffset: number;\n endLine: number;\n endColumn: number;\n endOffset: number;\n };\n}\n\nexport interface ErrorObject {\n type: string;\n title: string;\n detail?: string;\n parsedJSON?: unknown;\n validationErrors?: ValidationError[];\n location?: {\n startLine: number;\n startColumn: number;\n startOffset: number;\n };\n refs?: {\n title: string;\n jsonPointer: string;\n startLine: number;\n startColumn: number;\n startOffset: number;\n endLine: number;\n endColumn: number;\n endOffset: number;\n }[];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ExtensionComponentProps<V = any> {\n propertyName: string;\n propertyValue: V;\n document: AsyncAPIDocumentInterface;\n parent: BaseModel;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAeA,SAAgB,yBAAyB,CACvC,MAAmB;IAEnB,OAAQ,MAAkC,CAAC,GAAG,KAAK,SAAS,CAAC;AAC/D,CAAC;AAJD,8DAIC;AAYD,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,8BAAe,CAAA;AACjB,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAsDD,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,qCAAuB,CAAA;IACvB,2BAAa,CAAA;AACf,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB","sourcesContent":["import { AsyncAPIDocumentInterface, BaseModel } from '@asyncapi/parser';\n\nexport type PropsSchema =\n | string\n | FetchingSchemaInterface\n | AsyncAPIDocumentInterface\n | object;\n\nexport type NullableAsyncApi = AsyncAPIDocumentInterface | null;\n\nexport interface AsyncApiState {\n validatedSchema: NullableAsyncApi;\n error?: ErrorObject;\n}\n\nexport function isFetchingSchemaInterface(\n schema: PropsSchema,\n): schema is FetchingSchemaInterface {\n return (schema as FetchingSchemaInterface).url !== undefined;\n}\n\nexport interface FetchingSchemaInterface {\n url: string;\n requestOptions?: RequestInit;\n}\n\nexport interface ParserReturn {\n asyncapi?: AsyncAPIDocumentInterface;\n error?: ErrorObject;\n}\n\nexport enum PayloadType {\n SEND = 'send',\n RECEIVE = 'receive',\n REQUEST = 'request',\n REPLY = 'reply',\n}\n\nexport interface MessageExample {\n name?: string;\n summary?: string;\n example: unknown;\n}\n\nexport interface ValidationError {\n title: string;\n location?: {\n jsonPointer: string;\n startLine: number;\n startColumn: number;\n startOffset: number;\n endLine: number;\n endColumn: number;\n endOffset: number;\n };\n}\n\nexport interface ErrorObject {\n type: string;\n title: string;\n detail?: string;\n parsedJSON?: unknown;\n validationErrors?: ValidationError[];\n location?: {\n startLine: number;\n startColumn: number;\n startOffset: number;\n };\n refs?: {\n title: string;\n jsonPointer: string;\n startLine: number;\n startColumn: number;\n startOffset: number;\n endLine: number;\n endColumn: number;\n endOffset: number;\n }[];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ExtensionComponentProps<V = any> {\n propertyName: string;\n propertyValue: V;\n document: AsyncAPIDocumentInterface;\n parent: BaseModel;\n}\n\n// Plugin interface\n\nexport enum PluginSlot {\n OPERATION = 'operation',\n INFO = 'info',\n}\n\nexport interface PluginContext {\n schema?: PropsSchema;\n}\n\nexport interface ComponentSlotProps {\n context: PluginContext;\n onClose?: () => void;\n}\n\nexport interface AsyncApiPlugin {\n name: string;\n version: string;\n description?: string;\n\n install(api: PluginAPI): void;\n}\n\nexport type PluginInstance =\n | AsyncApiPlugin\n | React.ComponentType<ComponentSlotProps>;\n\nexport type EventListener = (...args: unknown[]) => void;\n\nexport interface MessageBus {\n on(eventName: string, callback: (data: unknown) => void): void;\n off(eventName: string, callback: (data: unknown) => void): void;\n emit(eventName: string, data: unknown): void;\n listeners(eventName: string): EventListener[];\n eventNames(): string[];\n}\n\nexport interface PluginAPI {\n registerComponent(\n slot: PluginSlot,\n component: React.ComponentType<ComponentSlotProps>,\n options?: { priority?: number; label?: string },\n ): void;\n\n onSpecLoaded(callback: (spec: unknown) => void): void;\n\n getContext(): PluginContext;\n\n on(eventName: string, callback: (data: unknown) => void): void;\n off(eventName: string, callback: (data: unknown) => void): void;\n emit(eventName: string, data: unknown): void;\n}\n"]}
|
|
@@ -27,10 +27,10 @@ var HiChevronRight = function (props) {
|
|
|
27
27
|
React.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" })));
|
|
28
28
|
};
|
|
29
29
|
export var CollapseButton = function (_a) {
|
|
30
|
-
var _b;
|
|
31
|
-
var chevronProps = _a.chevronProps,
|
|
32
|
-
return (React.createElement("button", __assign({}, rest, { className: "focus:
|
|
30
|
+
var _b, _c;
|
|
31
|
+
var chevronProps = _a.chevronProps, _d = _a.expanded, expanded = _d === void 0 ? false : _d, children = _a.children, rest = __rest(_a, ["chevronProps", "expanded", "children"]);
|
|
32
|
+
return (React.createElement("button", __assign({}, rest, { className: "focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 ".concat((_b = rest.className) !== null && _b !== void 0 ? _b : ''), type: "button" }),
|
|
33
33
|
React.createElement("div", { className: "inline-block" }, children),
|
|
34
|
-
React.createElement(HiChevronRight, __assign({}, chevronProps, { className: "inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ".concat(expanded ? '-rotate-90' : '', " ").concat((
|
|
34
|
+
React.createElement(HiChevronRight, __assign({}, chevronProps, { className: "inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ".concat(expanded ? '-rotate-90' : '', " ").concat((_c = chevronProps === null || chevronProps === void 0 ? void 0 : chevronProps.className) !== null && _c !== void 0 ? _c : '') }))));
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=CollapseButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapseButton.js","sourceRoot":"","sources":["../../../src/components/CollapseButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAOnE,IAAM,cAAc,GAAG,UAAC,KAAqC;IAArC,sBAAA,EAAA,UAAqC;IAAK,OAAA,CAEhE,sCACE,MAAM,EAAC,c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J,2CACM,IAAI,IACR,SAAS,EAAE,iEAA0D,MAAA,IAAI,CAAC,SAAS,mCAAI,EAAE,CAAE,EAC3F,IAAI,EAAC,QAAQ;QAEb,6BAAK,SAAS,EAAC,cAAc,IAAE,QAAQ,CAAO;QAC9C,oBAAC,cAAc,eACT,YAAY,IAChB,SAAS,EAAE,kIACT,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,cAC1B,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,mCAAI,EAAE,CAAE,IACnC,CACK,CACV,CAAA;CAAA,CAAC","sourcesContent":["import React, { ButtonHTMLAttributes, SVGAttributes } from 'react';\n\ninterface Props extends ButtonHTMLAttributes<HTMLButtonElement> {\n chevronProps?: SVGAttributes<SVGElement>;\n expanded?: boolean;\n}\n\nconst HiChevronRight = (props: SVGAttributes<SVGElement> = {}) => (\n // Copied from https://icon-sets.iconify.design/heroicons-solid/chevron-right/\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 20 20\"\n height=\"1em\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\nexport const CollapseButton: React.FunctionComponent<Props> = ({\n chevronProps,\n expanded = false,\n children,\n ...rest\n}) => (\n <button\n {...rest}\n className={`focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 ${rest.className ?? ''}`}\n type=\"button\"\n >\n <div className=\"inline-block\">{children}</div>\n <HiChevronRight\n {...chevronProps}\n className={`inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ${\n expanded ? '-rotate-90' : ''\n } ${chevronProps?.className ?? ''}`}\n />\n </button>\n);\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var SlotRenderer = function (_a) {
|
|
3
|
+
var slot = _a.slot, context = _a.context, pluginManager = _a.pluginManager;
|
|
4
|
+
if (!pluginManager) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
var components = pluginManager.getComponentsForSlot(slot);
|
|
8
|
+
if (!components || components.length === 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (React.createElement("div", { className: "asyncapi-react-plugin-slot-".concat(slot), "data-slot": slot }, components.map(function (Component, index) { return (React.createElement(React.Suspense, { key: "".concat(slot, "-").concat(index), fallback: React.createElement("div", null, "Loading plugin...") },
|
|
12
|
+
React.createElement(Component, { context: context }))); })));
|
|
13
|
+
};
|
|
14
|
+
export { SlotRenderer };
|
|
15
|
+
//# sourceMappingURL=PluginSlotRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginSlotRenderer.js","sourceRoot":"","sources":["../../../src/components/PluginSlotRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,IAAM,YAAY,GAAgC,UAAC,EAIlD;QAHC,IAAI,UAAA,EACJ,OAAO,aAAA,EACP,aAAa,mBAAA;IAEb,IAAI,CAAC,aAAa,EAAE;QAClB,OAAO,IAAI,CAAC;KACb;IAED,IAAM,UAAU,GAAG,aAAa,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE5D,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1C,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,6BAAK,SAAS,EAAE,qCAA8B,IAAI,CAAE,eAAa,IAAI,IAClE,UAAU,CAAC,GAAG,CAAC,UAAC,SAAS,EAAE,KAAK,IAAK,OAAA,CACpC,oBAAC,KAAK,CAAC,QAAQ,IACb,GAAG,EAAE,UAAG,IAAI,cAAI,KAAK,CAAE,EACvB,QAAQ,EAAE,qDAA4B;QAEtC,oBAAC,SAAS,IAAC,OAAO,EAAE,OAAO,GAAI,CAChB,CAClB,EAPqC,CAOrC,CAAC,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import React from 'react';\nimport { PluginManager } from '../helpers/pluginManager';\nimport { PluginContext, PluginSlot } from '../types';\n\ninterface SlotRendererProps {\n slot: PluginSlot;\n context: PluginContext;\n pluginManager?: PluginManager;\n}\n\nconst SlotRenderer: React.FC<SlotRendererProps> = ({\n slot,\n context,\n pluginManager,\n}) => {\n if (!pluginManager) {\n return null;\n }\n\n const components = pluginManager.getComponentsForSlot(slot);\n\n if (!components || components.length === 0) {\n return null;\n }\n\n return (\n <div className={`asyncapi-react-plugin-slot-${slot}`} data-slot={slot}>\n {components.map((Component, index) => (\n <React.Suspense\n key={`${slot}-${index}`}\n fallback={<div>Loading plugin...</div>}\n >\n <Component context={context} />\n </React.Suspense>\n ))}\n </div>\n );\n};\n\nexport { SlotRenderer };\n"]}
|
package/lib/esm/constants.js
CHANGED
|
@@ -66,4 +66,5 @@ export var EXPAND_ERROR_BUTTON_TEXT = 'Expand';
|
|
|
66
66
|
export var COLLAPSE_ERROR_BUTTON_TEXT = 'Collapse';
|
|
67
67
|
export var SECURITY_TEXT = 'Security';
|
|
68
68
|
export var URL_VARIABLES_TEXT = 'URL Variables';
|
|
69
|
+
export var PLUGINEVENTS = ['plugin:ready', 'plugin:error'];
|
|
69
70
|
//# sourceMappingURL=constants.js.map
|