@stoplight/elements-dev-portal 3.0.12-beta-0.1 → 3.0.13

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 (107) hide show
  1. package/{dist/index.esm.js → index.esm.js} +2 -2
  2. package/{dist/index.js → index.js} +2 -2
  3. package/{dist/index.mjs → index.mjs} +2 -2
  4. package/package.json +17 -71
  5. package/{dist/types.d.ts → types.d.ts} +0 -1
  6. package/version.d.ts +1 -0
  7. package/{dist/web-components.min.js → web-components.min.js} +1 -1
  8. package/.storybook/main.js +0 -6
  9. package/.storybook/manager.js +0 -1
  10. package/.storybook/preview.jsx +0 -46
  11. package/dist/LICENSE +0 -190
  12. package/dist/README.md +0 -22
  13. package/dist/package.json +0 -51
  14. package/dist/version.d.ts +0 -1
  15. package/jest.config.js +0 -10
  16. package/src/__fixtures__/branches.json +0 -28
  17. package/src/__fixtures__/node-content.json +0 -257
  18. package/src/__fixtures__/table-of-contents.json +0 -144
  19. package/src/components/BranchSelector/BranchSelector.spec.tsx +0 -61
  20. package/src/components/BranchSelector/BranchSelector.stories.tsx +0 -41
  21. package/src/components/BranchSelector/BranchSelector.tsx +0 -50
  22. package/src/components/BranchSelector/index.tsx +0 -1
  23. package/src/components/DevPortalProvider/index.tsx +0 -25
  24. package/src/components/Forbidden.tsx +0 -11
  25. package/src/components/Loading.tsx +0 -9
  26. package/src/components/NodeContent/NodeContent.spec.tsx +0 -128
  27. package/src/components/NodeContent/NodeContent.stories.tsx +0 -60
  28. package/src/components/NodeContent/NodeContent.tsx +0 -235
  29. package/src/components/NodeContent/index.tsx +0 -1
  30. package/src/components/NotFound.tsx +0 -11
  31. package/src/components/Search/Search.stories.tsx +0 -151
  32. package/src/components/Search/Search.tsx +0 -161
  33. package/src/components/Search/SearchOverlay.tsx +0 -88
  34. package/src/components/Search/index.tsx +0 -1
  35. package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -68
  36. package/src/components/TableOfContents/TableOfContents.tsx +0 -54
  37. package/src/components/TableOfContents/index.tsx +0 -1
  38. package/src/components/UpgradeToStarter.tsx +0 -22
  39. package/src/consts.ts +0 -32
  40. package/src/containers/StoplightProject.spec.tsx +0 -78
  41. package/src/containers/StoplightProject.stories.tsx +0 -28
  42. package/src/containers/StoplightProject.tsx +0 -269
  43. package/src/handlers/__tests__/getBranches.test.ts +0 -30
  44. package/src/handlers/__tests__/getNodeContent.test.ts +0 -35
  45. package/src/handlers/__tests__/getNodes.test.ts +0 -38
  46. package/src/handlers/__tests__/getTableOfContents.test.ts +0 -34
  47. package/src/handlers/__tests__/getWorkspace.test.ts +0 -30
  48. package/src/handlers/getBranches.ts +0 -27
  49. package/src/handlers/getNodeContent.ts +0 -53
  50. package/src/handlers/getNodes.ts +0 -69
  51. package/src/handlers/getTableOfContents.ts +0 -30
  52. package/src/handlers/getWorkspace.ts +0 -27
  53. package/src/hooks/__tests__/dataFetching.spec.tsx +0 -42
  54. package/src/hooks/useGetBranches.ts +0 -17
  55. package/src/hooks/useGetNodeContent.ts +0 -24
  56. package/src/hooks/useGetNodes.ts +0 -34
  57. package/src/hooks/useGetTableOfContents.ts +0 -17
  58. package/src/hooks/useGetWorkspace.tsx +0 -13
  59. package/src/index.ts +0 -25
  60. package/src/styles.css +0 -1
  61. package/src/types.ts +0 -85
  62. package/src/version.ts +0 -2
  63. package/src/web-components/__stories__/StoplightProject.stories.tsx +0 -33
  64. package/src/web-components/components.ts +0 -19
  65. package/src/web-components/index.ts +0 -3
  66. package/tsconfig.build.json +0 -18
  67. package/tsconfig.json +0 -7
  68. package/web-components.config.js +0 -1
  69. /package/{dist/components → components}/BranchSelector/BranchSelector.d.ts +0 -0
  70. /package/{dist/components → components}/BranchSelector/BranchSelector.spec.d.ts +0 -0
  71. /package/{dist/components → components}/BranchSelector/BranchSelector.stories.d.ts +0 -0
  72. /package/{dist/components → components}/BranchSelector/index.d.ts +0 -0
  73. /package/{dist/components → components}/DevPortalProvider/index.d.ts +0 -0
  74. /package/{dist/components → components}/Forbidden.d.ts +0 -0
  75. /package/{dist/components → components}/Loading.d.ts +0 -0
  76. /package/{dist/components → components}/NodeContent/NodeContent.d.ts +0 -0
  77. /package/{dist/components → components}/NodeContent/NodeContent.spec.d.ts +0 -0
  78. /package/{dist/components → components}/NodeContent/NodeContent.stories.d.ts +0 -0
  79. /package/{dist/components → components}/NodeContent/index.d.ts +0 -0
  80. /package/{dist/components → components}/NotFound.d.ts +0 -0
  81. /package/{dist/components → components}/Search/Search.d.ts +0 -0
  82. /package/{dist/components → components}/Search/Search.stories.d.ts +0 -0
  83. /package/{dist/components → components}/Search/SearchOverlay.d.ts +0 -0
  84. /package/{dist/components → components}/Search/index.d.ts +0 -0
  85. /package/{dist/components → components}/TableOfContents/TableOfContents.d.ts +0 -0
  86. /package/{dist/components → components}/TableOfContents/TableOfContents.stories.d.ts +0 -0
  87. /package/{dist/components → components}/TableOfContents/index.d.ts +0 -0
  88. /package/{dist/components → components}/UpgradeToStarter.d.ts +0 -0
  89. /package/{dist/consts.d.ts → consts.d.ts} +0 -0
  90. /package/{dist/containers → containers}/StoplightProject.d.ts +0 -0
  91. /package/{dist/containers → containers}/StoplightProject.spec.d.ts +0 -0
  92. /package/{dist/containers → containers}/StoplightProject.stories.d.ts +0 -0
  93. /package/{dist/handlers → handlers}/getBranches.d.ts +0 -0
  94. /package/{dist/handlers → handlers}/getNodeContent.d.ts +0 -0
  95. /package/{dist/handlers → handlers}/getNodes.d.ts +0 -0
  96. /package/{dist/handlers → handlers}/getTableOfContents.d.ts +0 -0
  97. /package/{dist/handlers → handlers}/getWorkspace.d.ts +0 -0
  98. /package/{dist/hooks → hooks}/useGetBranches.d.ts +0 -0
  99. /package/{dist/hooks → hooks}/useGetNodeContent.d.ts +0 -0
  100. /package/{dist/hooks → hooks}/useGetNodes.d.ts +0 -0
  101. /package/{dist/hooks → hooks}/useGetTableOfContents.d.ts +0 -0
  102. /package/{dist/hooks → hooks}/useGetWorkspace.d.ts +0 -0
  103. /package/{dist/index.d.ts → index.d.ts} +0 -0
  104. /package/{dist/styles.min.css → styles.min.css} +0 -0
  105. /package/{dist/web-components → web-components}/components.d.ts +0 -0
  106. /package/{dist/web-components → web-components}/index.d.ts +0 -0
  107. /package/{dist/web-components.min.js.LICENSE.txt → web-components.min.js.LICENSE.txt} +0 -0
@@ -1,34 +0,0 @@
1
- import fetchMock from 'jest-fetch-mock';
2
-
3
- import { getTableOfContents } from '../getTableOfContents';
4
-
5
- describe('getTableOfContents', () => {
6
- beforeEach(() => {
7
- fetchMock.resetMocks();
8
- localStorage.clear();
9
- });
10
-
11
- it('should URI encode the parameters in the request URL', async () => {
12
- fetchMock.mockResolvedValue(
13
- new Response('{}', {
14
- status: 200,
15
- statusText: 'OK',
16
- headers: [],
17
- }),
18
- );
19
-
20
- await getTableOfContents({
21
- projectId: 'some/slash',
22
- branchSlug: 'test+branch',
23
- });
24
-
25
- expect(fetchMock).toBeCalledWith(
26
- 'https://stoplight.io/api/v1/projects/some%2Fslash/table-of-contents?branch=test%2Bbranch',
27
- {
28
- headers: expect.objectContaining({
29
- 'Stoplight-Elements-Version': expect.any(String),
30
- }),
31
- },
32
- );
33
- });
34
- });
@@ -1,30 +0,0 @@
1
- import fetchMock from 'jest-fetch-mock';
2
-
3
- import { getWorkspace } from '../getWorkspace';
4
-
5
- describe('getWorkspace', () => {
6
- beforeEach(() => {
7
- fetchMock.resetMocks();
8
- localStorage.clear();
9
- });
10
-
11
- it('should URI encode the parameters in the request URL', async () => {
12
- fetchMock.mockResolvedValue(
13
- new Response('{}', {
14
- status: 200,
15
- statusText: 'OK',
16
- headers: [],
17
- }),
18
- );
19
-
20
- await getWorkspace({
21
- projectIds: ['some/slash'],
22
- });
23
-
24
- expect(fetchMock).toBeCalledWith('https://stoplight.io/api/v1/projects/some%2Fslash', {
25
- headers: expect.objectContaining({
26
- 'Stoplight-Elements-Version': expect.any(String),
27
- }),
28
- });
29
- });
30
- });
@@ -1,27 +0,0 @@
1
- import { Branches } from '../types';
2
- import { appVersion } from '../version';
3
-
4
- export const getBranches = async ({
5
- projectId,
6
- platformUrl = 'https://stoplight.io',
7
- platformAuthToken,
8
- }: {
9
- projectId: string;
10
- platformUrl?: string;
11
- platformAuthToken?: string;
12
- }): Promise<Branches> => {
13
- const encodedProjectId = encodeURIComponent(projectId);
14
- const response = await fetch(`${platformUrl}/api/v1/projects/${encodedProjectId}/branches`, {
15
- headers: {
16
- 'Stoplight-Elements-Version': appVersion,
17
- ...(platformAuthToken && { Authorization: `Bearer ${platformAuthToken}` }),
18
- },
19
- });
20
- const data = await response.json();
21
-
22
- if (!response.ok) {
23
- throw new Error(data);
24
- }
25
-
26
- return data;
27
- };
@@ -1,53 +0,0 @@
1
- import { Node } from '../types';
2
- import { appVersion } from '../version';
3
-
4
- export class ResponseError extends Error {
5
- code: number;
6
-
7
- constructor(message: string, responseCode: number) {
8
- super(message);
9
- this.name = 'ResponseError';
10
- this.code = responseCode;
11
- }
12
- }
13
-
14
- export const getNodeContent = async ({
15
- nodeSlug,
16
- projectId,
17
- branchSlug,
18
- platformUrl = 'https://stoplight.io',
19
- platformAuthToken,
20
- }: {
21
- nodeSlug: string;
22
- projectId: string;
23
- branchSlug?: string;
24
- platformUrl?: string;
25
- platformAuthToken?: string;
26
- }): Promise<Node> => {
27
- const encodedNodeSlug = encodeURIComponent(nodeSlug);
28
- const encodedProjectId = encodeURIComponent(projectId);
29
- const encodedBranchSlug = branchSlug ? encodeURIComponent(branchSlug) : '';
30
- const branchQuery = encodedBranchSlug ? `?branch=${encodedBranchSlug}` : '';
31
- const response = await fetch(
32
- `${platformUrl}/api/v1/projects/${encodedProjectId}/nodes/${encodedNodeSlug}${branchQuery}`,
33
- {
34
- headers: {
35
- 'Stoplight-Elements-Version': appVersion,
36
- ...(platformAuthToken && { Authorization: `Bearer ${platformAuthToken}` }),
37
- },
38
- },
39
- );
40
- const data = await response.json();
41
-
42
- if (!response.ok) {
43
- if (response.status === 402) {
44
- throw new ResponseError('Payment Required', response.status);
45
- } else if (response.status === 403) {
46
- throw new ResponseError('Forbidden', response.status);
47
- } else {
48
- throw new ResponseError('Something went wrong', response.status);
49
- }
50
- }
51
-
52
- return data;
53
- };
@@ -1,69 +0,0 @@
1
- import { NodeSearchResult } from '../types';
2
- import { appVersion } from '../version';
3
-
4
- export const getNodes = async ({
5
- workspaceId,
6
- branchSlug,
7
- projectIds,
8
- search,
9
- platformUrl = 'https://stoplight.io',
10
- platformAuthToken,
11
- }: {
12
- workspaceId?: string;
13
- branchSlug?: string;
14
- projectIds?: string[];
15
- search?: string;
16
- platformUrl?: string;
17
- platformAuthToken?: string;
18
- }): Promise<NodeSearchResult[]> => {
19
- const queryParams = [];
20
- let fetchedWorkspaceId = workspaceId || '';
21
-
22
- if (!workspaceId && projectIds?.length) {
23
- const encodedProjectId = encodeURIComponent(projectIds[0]);
24
- const response = await fetch(`${platformUrl}/api/v1/projects/${encodedProjectId}`, {
25
- headers: {
26
- 'Stoplight-Elements-Version': appVersion,
27
- ...(platformAuthToken && { Authorization: `Bearer ${platformAuthToken}` }),
28
- },
29
- });
30
- const data = await response.json();
31
- fetchedWorkspaceId = data.workspace.id;
32
- }
33
-
34
- if (projectIds && projectIds.length) {
35
- queryParams.push(
36
- ...projectIds.map((projectId, index) => {
37
- const encodedProjectId = encodeURIComponent(projectId);
38
- return `project_ids[${index}]=${encodedProjectId}`;
39
- }),
40
- );
41
- }
42
-
43
- if (search) {
44
- const encodedSearch = encodeURIComponent(search);
45
- queryParams.push(`search=${encodedSearch}`);
46
- }
47
-
48
- if (branchSlug) {
49
- const encodedBranchSlug = encodeURIComponent(branchSlug);
50
- queryParams.push(`branch=${encodedBranchSlug}`);
51
- }
52
-
53
- const query = queryParams.length ? `?${queryParams.join('&')}` : '';
54
-
55
- const encodedWorkspaceId = encodeURIComponent(fetchedWorkspaceId);
56
- const response = await fetch(`${platformUrl}/api/v1/workspaces/${encodedWorkspaceId}/nodes${query}`, {
57
- headers: {
58
- 'Stoplight-Elements-Version': appVersion,
59
- ...(platformAuthToken && { Authorization: `Bearer ${platformAuthToken}` }),
60
- },
61
- });
62
- const data = await response.json();
63
-
64
- if (!response.ok) {
65
- throw new Error(data);
66
- }
67
-
68
- return data;
69
- };
@@ -1,30 +0,0 @@
1
- import { ProjectTableOfContents } from '../types';
2
- import { appVersion } from '../version';
3
-
4
- export const getTableOfContents = async ({
5
- projectId,
6
- branchSlug,
7
- platformUrl = 'https://stoplight.io',
8
- platformAuthToken,
9
- }: {
10
- projectId: string;
11
- branchSlug?: string;
12
- platformUrl?: string;
13
- platformAuthToken?: string;
14
- }): Promise<ProjectTableOfContents> => {
15
- const encodedProjectId = encodeURIComponent(projectId);
16
- const encodedBranchSlug = branchSlug ? encodeURIComponent(branchSlug) : '';
17
- const branchQuery = encodedBranchSlug ? `?branch=${encodedBranchSlug}` : '';
18
- const response = await fetch(`${platformUrl}/api/v1/projects/${encodedProjectId}/table-of-contents${branchQuery}`, {
19
- headers: {
20
- 'Stoplight-Elements-Version': appVersion,
21
- ...(platformAuthToken && { Authorization: `Bearer ${platformAuthToken}` }),
22
- },
23
- });
24
- const data = await response.json();
25
-
26
- if (!response.ok) {
27
- throw new Error(data);
28
- }
29
- return data;
30
- };
@@ -1,27 +0,0 @@
1
- import { Workspace } from '../types';
2
- import { appVersion } from '../version';
3
-
4
- export const getWorkspace = async ({
5
- projectIds,
6
- platformUrl = 'https://stoplight.io',
7
- platformAuthToken,
8
- }: {
9
- projectIds: string[];
10
- platformUrl?: string;
11
- platformAuthToken?: string;
12
- }): Promise<Workspace> => {
13
- const encodedProjectId = encodeURIComponent(projectIds[0]);
14
- const response = await fetch(`${platformUrl}/api/v1/projects/${encodedProjectId}`, {
15
- headers: {
16
- 'Stoplight-Elements-Version': appVersion,
17
- ...(platformAuthToken && { Authorization: `Bearer ${platformAuthToken}` }),
18
- },
19
- });
20
- const data = await response.json();
21
-
22
- if (!response.ok) {
23
- throw new Error(data);
24
- }
25
-
26
- return data;
27
- };
@@ -1,42 +0,0 @@
1
- import '@testing-library/jest-dom';
2
-
3
- import { act, renderHook } from '@testing-library/react-hooks';
4
- import fetchMock from 'jest-fetch-mock';
5
- import * as React from 'react';
6
-
7
- import { DevPortalProvider } from '../../components/DevPortalProvider';
8
- import { useGetBranches } from '../useGetBranches';
9
- import { useGetNodeContent } from '../useGetNodeContent';
10
- import { useGetNodes } from '../useGetNodes';
11
- import { useGetTableOfContents } from '../useGetTableOfContents';
12
-
13
- describe('data fetching', () => {
14
- beforeEach(() => {
15
- fetchMock.mockResponse(() => Promise.resolve({ status: 200 }));
16
- fetchMock.enableMocks();
17
- });
18
-
19
- afterEach(() => {
20
- fetchMock.disableMocks();
21
- });
22
-
23
- it.each<[string, Function, Record<string, string>]>([
24
- ['useGetTableOfContents', useGetTableOfContents, { projectId: 'id' }],
25
- ['useGetBranches', useGetBranches, { projectId: 'id' }],
26
- ['useGetNodeContent', useGetNodeContent, { projectId: 'id', nodeSlug: 'node' }],
27
- ['useGetNodes', useGetNodes, { search: 'search', workspaceId: 'id' }],
28
- ])('includes authorization header when auth token is present in context for %s', async (_, hook, args) => {
29
- const { waitFor } = renderHook(() => hook(args), {
30
- wrapper: ({ children }) => <DevPortalProvider platformAuthToken="secret">{children}</DevPortalProvider>,
31
- });
32
-
33
- await act(async () => {
34
- await waitFor(() => expect(fetchMock).toHaveBeenCalled());
35
- });
36
- const requestInit = fetchMock.mock.calls[0][1]!;
37
-
38
- const headers = new Headers(requestInit.headers);
39
-
40
- expect(headers.get('Authorization')).toBe('Bearer secret');
41
- });
42
- });
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- import { useQuery } from 'react-query';
3
-
4
- import { PlatformContext } from '../components/DevPortalProvider';
5
- import { devPortalCacheKeys } from '../consts';
6
- import { getBranches } from '../handlers/getBranches';
7
-
8
- export function useGetBranches({ projectId }: { projectId: string }) {
9
- const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
10
- return useQuery(
11
- [...devPortalCacheKeys.branchesList(projectId), platformUrl, isLoggedIn],
12
- () => getBranches({ projectId, platformUrl, platformAuthToken }),
13
- {
14
- enabled: projectId ? true : false,
15
- },
16
- );
17
- }
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
- import { useQuery } from 'react-query';
3
-
4
- import { PlatformContext } from '../components/DevPortalProvider';
5
- import { devPortalCacheKeys } from '../consts';
6
- import { getNodeContent } from '../handlers/getNodeContent';
7
-
8
- export function useGetNodeContent({
9
- nodeSlug,
10
- projectId,
11
- branchSlug,
12
- }: {
13
- nodeSlug: string;
14
- projectId: string;
15
- branchSlug?: string;
16
- }) {
17
- const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
18
-
19
- return useQuery(
20
- [...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug ?? '', nodeSlug), platformUrl, isLoggedIn],
21
- () => getNodeContent({ nodeSlug, projectId, branchSlug, platformUrl, platformAuthToken }),
22
- { enabled: nodeSlug && projectId ? true : false },
23
- );
24
- }
@@ -1,34 +0,0 @@
1
- import * as React from 'react';
2
- import { useQuery } from 'react-query';
3
- import { useDebounce } from 'use-debounce';
4
-
5
- import { PlatformContext } from '../components/DevPortalProvider';
6
- import { devPortalCacheKeys } from '../consts';
7
- import { getNodes } from '../handlers/getNodes';
8
-
9
- export function useGetNodes({
10
- search,
11
- workspaceId,
12
- projectIds,
13
- branch,
14
- pause,
15
- }: {
16
- search: string;
17
- workspaceId?: string;
18
- projectIds?: string[];
19
- branch?: string;
20
- pause?: boolean;
21
- }) {
22
- const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
23
- const [debounceSearch] = useDebounce(search, 500);
24
- return useQuery(
25
- [
26
- ...devPortalCacheKeys.searchNodes({ projectIds, branchSlug: branch, workspaceId, search: debounceSearch }),
27
- platformUrl,
28
- isLoggedIn,
29
- ],
30
- () =>
31
- getNodes({ workspaceId, projectIds, branchSlug: branch, search: debounceSearch, platformUrl, platformAuthToken }),
32
- { enabled: !pause, keepPreviousData: true },
33
- );
34
- }
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- import { useQuery } from 'react-query';
3
-
4
- import { PlatformContext } from '../components/DevPortalProvider';
5
- import { devPortalCacheKeys } from '../consts';
6
- import { getTableOfContents } from '../handlers/getTableOfContents';
7
-
8
- export function useGetTableOfContents({ projectId, branchSlug }: { projectId: string; branchSlug?: string }) {
9
- const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
10
- return useQuery(
11
- [...devPortalCacheKeys.branchTOC(projectId, branchSlug ?? ''), platformUrl, isLoggedIn],
12
- () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }),
13
- // Here projectId cHJqOjA is an encoded value of zero,
14
- // hence avoiding the graphql call for invalid project id
15
- { enabled: projectId && projectId !== 'cHJqOjA' ? true : false },
16
- );
17
- }
@@ -1,13 +0,0 @@
1
- import * as React from 'react';
2
- import { useQuery } from 'react-query';
3
-
4
- import { PlatformContext } from '../components/DevPortalProvider';
5
- import { devPortalCacheKeys } from '../consts';
6
- import { getWorkspace } from '../handlers/getWorkspace';
7
-
8
- export function useGetWorkspace({ projectIds }: { projectIds: string[] }) {
9
- const { platformUrl, platformAuthToken } = React.useContext(PlatformContext);
10
- return useQuery([...devPortalCacheKeys.searchNodes({ projectIds }), platformUrl, platformAuthToken], () =>
11
- getWorkspace({ projectIds, platformUrl, platformAuthToken }),
12
- );
13
- }
package/src/index.ts DELETED
@@ -1,25 +0,0 @@
1
- export type { BranchSelectorProps } from './components/BranchSelector';
2
- export { BranchSelector } from './components/BranchSelector';
3
- export type { DevPortalProviderProps } from './components/DevPortalProvider';
4
- export { DevPortalProvider } from './components/DevPortalProvider';
5
- export type { NodeContentProps } from './components/NodeContent';
6
- export { NodeContent } from './components/NodeContent';
7
- export type { SearchProps } from './components/Search';
8
- export { Search, SearchResults } from './components/Search';
9
- export type { TableOfContentsProps } from './components/TableOfContents';
10
- export { TableOfContents } from './components/TableOfContents';
11
- export { devPortalCacheKeys } from './consts';
12
- export type { StoplightProjectProps } from './containers/StoplightProject';
13
- export { StoplightProject } from './containers/StoplightProject';
14
- export { getBranches } from './handlers/getBranches';
15
- export { getNodeContent, ResponseError } from './handlers/getNodeContent';
16
- export { getNodes } from './handlers/getNodes';
17
- export { getTableOfContents } from './handlers/getTableOfContents';
18
- export { getWorkspace } from './handlers/getWorkspace';
19
- export { useGetBranches } from './hooks/useGetBranches';
20
- export { useGetNodeContent } from './hooks/useGetNodeContent';
21
- export { useGetNodes } from './hooks/useGetNodes';
22
- export { useGetTableOfContents } from './hooks/useGetTableOfContents';
23
- export { useGetWorkspace } from './hooks/useGetWorkspace';
24
- export type { ProjectTableOfContents } from './types';
25
- export type { Branch, Node, NodeSearchResult } from './types';
package/src/styles.css DELETED
@@ -1 +0,0 @@
1
- @import '../../elements-core/src/styles.css';
package/src/types.ts DELETED
@@ -1,85 +0,0 @@
1
- import { TableOfContentsItem } from '@stoplight/elements-core';
2
-
3
- export type Branch = {
4
- id: number;
5
- slug: string;
6
- is_default: boolean;
7
- is_published: boolean;
8
- name?: string;
9
- };
10
-
11
- export type Branches = {
12
- items: Branch[];
13
- };
14
-
15
- export type ProjectTableOfContents = {
16
- items: TableOfContentsItem[];
17
- hide_powered_by?: boolean;
18
- collapseTableOfContents?: boolean;
19
- };
20
-
21
- export type Node = NodeSummary & {
22
- data: any;
23
- links: {
24
- mock_url?: string;
25
- /**
26
- * @deprecated use export_original_file_url instead
27
- */
28
- export_url?: string;
29
- /**
30
- * The URL to export the original file. This is not a bundled output, meaning references are left in place.
31
- */
32
- export_original_file_url?: string;
33
- /**
34
- * The URL to export a bundled form of the file. Bundling means references are copied into the output file.
35
- */
36
- export_bundled_file_url?: string;
37
- };
38
- outbound_edges: NodeEdge[];
39
- inbound_edges: NodeEdge[];
40
- disableProps?: any;
41
- };
42
-
43
- export type NodeSummary = {
44
- id: string;
45
- type: string;
46
- uri: string;
47
- slug: string;
48
- title: string;
49
- summary: string;
50
- project_id: string;
51
- branch_id: string;
52
- branch_node_id: number;
53
- branch: string;
54
- };
55
-
56
- export type NodeEdge = {
57
- id: string;
58
- type: string;
59
- uri: string;
60
- slug: string;
61
- title: string;
62
- };
63
-
64
- export type NodeSearchResult = NodeSummary & {
65
- highlighted: {
66
- name: string | null;
67
- summary: string | null;
68
- data: string | null;
69
- };
70
- project_slug: string;
71
- project_name: string;
72
- node_id: number;
73
- };
74
-
75
- export type Workspace = {
76
- id: string;
77
- name: string;
78
- slug: string;
79
- default_branch_id: string;
80
- workspace: {
81
- id: string;
82
- name: string;
83
- slug: string;
84
- };
85
- };
package/src/version.ts DELETED
@@ -1,2 +0,0 @@
1
- // auto-updated during build
2
- export const appVersion = '3.0.12-beta-0.1';
@@ -1,33 +0,0 @@
1
- import '../index';
2
-
3
- import { Story } from '@storybook/react';
4
- import React from 'react';
5
-
6
- declare global {
7
- namespace JSX {
8
- interface IntrinsicElements {
9
- 'elements-stoplight-project': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
10
- }
11
- }
12
- }
13
-
14
- const Template: Story = (props: any) => <elements-stoplight-project {...props} />;
15
-
16
- export default {
17
- title: 'web-components/StoplightProject',
18
- argTypes: {
19
- projectId: { control: 'text' },
20
- platformUrl: { control: 'text' },
21
- router: {
22
- control: { type: 'inline-radio', options: ['history', 'hash', 'memory'] },
23
- defaultValue: 'history',
24
- },
25
- },
26
- };
27
-
28
- export const defaultProject = Template.bind({});
29
- defaultProject.storyName = "Stoplight's Demo workspace";
30
- defaultProject.args = {
31
- projectId: 'cHJqOjYwNjYx',
32
- platformUrl: 'https://stoplight.io',
33
- };
@@ -1,19 +0,0 @@
1
- import { createElementClass } from '@stoplight/elements-core';
2
-
3
- import { StoplightProject } from '../containers/StoplightProject';
4
-
5
- export const StoplightProjectElement = createElementClass(StoplightProject, {
6
- projectId: { type: 'string', defaultValue: '' },
7
- hideTryIt: { type: 'boolean' },
8
- hideServerInfo: { type: 'boolean' },
9
- hideSecurityInfo: { type: 'boolean' },
10
- hideMocking: { type: 'boolean' },
11
- hideExport: { type: 'boolean' },
12
- basePath: { type: 'string' },
13
- staticRouterPath: { type: 'string' },
14
- router: { type: 'string' },
15
- platformUrl: { type: 'string' },
16
- collapseTableOfContents: { type: 'boolean' },
17
- tryItCredentialsPolicy: { type: 'string' },
18
- tryItCorsProxy: { type: 'string' },
19
- });
@@ -1,3 +0,0 @@
1
- import { StoplightProjectElement } from './components';
2
-
3
- window.customElements.define('elements-stoplight-project', StoplightProjectElement);
@@ -1,18 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": [
4
- "src"
5
- ],
6
- "exclude": [
7
- "**/__*__/**"
8
- ],
9
- "compilerOptions": {
10
- "baseUrl": "./",
11
- "outDir": "dist",
12
- "moduleResolution": "node",
13
- "paths": {
14
- "@stoplight/elements-core": ["../elements-core/dist"],
15
- "@stoplight/elements-core/*": ["../elements-core/dist/*"]
16
- }
17
- }
18
- }
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
-
4
- "include": ["src"],
5
-
6
- "exclude": ["**/__fixtures__/**", "**/__stories__/**", "**/__tests__/**"]
7
- }
@@ -1 +0,0 @@
1
- module.exports = require('../../web-components.webpack.config');
File without changes
File without changes
File without changes