@jpmorganchase/elemental-dev-portal 1.0.0 → 2.2.1

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 (96) hide show
  1. package/components/BranchSelector/BranchSelector.d.ts +7 -0
  2. package/components/BranchSelector/BranchSelector.spec.d.ts +15 -0
  3. package/components/BranchSelector/BranchSelector.stories.d.ts +29 -0
  4. package/components/DevPortalProvider/index.d.ts +7 -0
  5. package/components/Forbidden.d.ts +1 -0
  6. package/components/Loading.d.ts +1 -0
  7. package/components/NodeContent/NodeContent.d.ts +17 -0
  8. package/components/NodeContent/NodeContent.spec.d.ts +1 -0
  9. package/components/NodeContent/NodeContent.stories.d.ts +43 -0
  10. package/components/NotFound.d.ts +1 -0
  11. package/components/Search/Search.d.ts +13 -0
  12. package/components/Search/Search.stories.d.ts +33 -0
  13. package/components/TableOfContents/TableOfContents.d.ts +12 -0
  14. package/components/TableOfContents/TableOfContents.stories.d.ts +36 -0
  15. package/components/UpgradeToStarter.d.ts +1 -0
  16. package/consts.d.ts +28 -0
  17. package/containers/StoplightProject.d.ts +13 -0
  18. package/containers/StoplightProject.spec.d.ts +1 -0
  19. package/containers/StoplightProject.stories.d.ts +45 -0
  20. package/handlers/getBranches.d.ts +6 -0
  21. package/handlers/getNodeContent.d.ts +12 -0
  22. package/handlers/getNodes.d.ts +9 -0
  23. package/handlers/getTableOfContents.d.ts +7 -0
  24. package/handlers/getWorkspace.d.ts +6 -0
  25. package/hooks/useGetBranches.d.ts +3 -0
  26. package/hooks/useGetNodeContent.d.ts +5 -0
  27. package/hooks/useGetNodes.d.ts +7 -0
  28. package/hooks/useGetTableOfContents.d.ts +4 -0
  29. package/hooks/useGetWorkspace.d.ts +3 -0
  30. package/index.esm.js +682 -0
  31. package/index.js +726 -0
  32. package/index.mjs +682 -0
  33. package/package.json +17 -70
  34. package/styles.min.css +1 -0
  35. package/types.d.ts +65 -0
  36. package/version.d.ts +1 -0
  37. package/web-components/components.d.ts +1 -0
  38. package/web-components/index.d.ts +1 -0
  39. package/web-components.min.js +2 -0
  40. package/web-components.min.js.LICENSE.txt +187 -0
  41. package/.storybook/main.js +0 -1
  42. package/.storybook/manager.js +0 -1
  43. package/.storybook/preview.jsx +0 -46
  44. package/jest.config.js +0 -10
  45. package/src/__fixtures__/branches.json +0 -26
  46. package/src/__fixtures__/node-content.json +0 -257
  47. package/src/__fixtures__/table-of-contents.json +0 -144
  48. package/src/components/BranchSelector/BranchSelector.spec.tsx +0 -63
  49. package/src/components/BranchSelector/BranchSelector.stories.tsx +0 -41
  50. package/src/components/BranchSelector/BranchSelector.tsx +0 -50
  51. package/src/components/DevPortalProvider/index.tsx +0 -19
  52. package/src/components/Forbidden.tsx +0 -11
  53. package/src/components/Loading.tsx +0 -9
  54. package/src/components/NodeContent/NodeContent.spec.tsx +0 -54
  55. package/src/components/NodeContent/NodeContent.stories.tsx +0 -60
  56. package/src/components/NodeContent/NodeContent.tsx +0 -171
  57. package/src/components/NotFound.tsx +0 -11
  58. package/src/components/Search/Search.stories.tsx +0 -73
  59. package/src/components/Search/Search.tsx +0 -133
  60. package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -54
  61. package/src/components/TableOfContents/TableOfContents.tsx +0 -51
  62. package/src/components/UpgradeToStarter.tsx +0 -22
  63. package/src/consts.ts +0 -32
  64. package/src/containers/StoplightProject.spec.tsx +0 -78
  65. package/src/containers/StoplightProject.stories.tsx +0 -28
  66. package/src/containers/StoplightProject.tsx +0 -213
  67. package/src/handlers/__tests__/getBranches.test.ts +0 -30
  68. package/src/handlers/__tests__/getNodeContent.test.ts +0 -35
  69. package/src/handlers/__tests__/getNodes.test.ts +0 -38
  70. package/src/handlers/__tests__/getTableOfContents.test.ts +0 -34
  71. package/src/handlers/__tests__/getWorkspace.test.ts +0 -30
  72. package/src/handlers/getBranches.ts +0 -27
  73. package/src/handlers/getNodeContent.ts +0 -53
  74. package/src/handlers/getNodes.ts +0 -69
  75. package/src/handlers/getTableOfContents.ts +0 -30
  76. package/src/handlers/getWorkspace.ts +0 -27
  77. package/src/hooks/__tests__/dataFetching.spec.tsx +0 -42
  78. package/src/hooks/useGetBranches.ts +0 -17
  79. package/src/hooks/useGetNodeContent.ts +0 -24
  80. package/src/hooks/useGetNodes.ts +0 -34
  81. package/src/hooks/useGetTableOfContents.ts +0 -15
  82. package/src/hooks/useGetWorkspace.tsx +0 -13
  83. package/src/styles.css +0 -1
  84. package/src/types.ts +0 -81
  85. package/src/version.ts +0 -2
  86. package/src/web-components/__stories__/StoplightProject.stories.tsx +0 -33
  87. package/src/web-components/components.ts +0 -17
  88. package/src/web-components/index.ts +0 -3
  89. package/tsconfig.build.json +0 -18
  90. package/tsconfig.json +0 -7
  91. package/web-components.config.js +0 -1
  92. /package/{src/components/BranchSelector/index.tsx → components/BranchSelector/index.d.ts} +0 -0
  93. /package/{src/components/NodeContent/index.tsx → components/NodeContent/index.d.ts} +0 -0
  94. /package/{src/components/Search/index.tsx → components/Search/index.d.ts} +0 -0
  95. /package/{src/components/TableOfContents/index.tsx → components/TableOfContents/index.d.ts} +0 -0
  96. /package/{src/index.ts → index.d.ts} +0 -0
@@ -1,38 +0,0 @@
1
- import fetchMock from 'jest-fetch-mock';
2
-
3
- import { getNodes } from '../getNodes';
4
-
5
- describe('getNodes', () => {
6
- beforeEach(() => {
7
- fetchMock.resetMocks();
8
- localStorage.clear();
9
- });
10
-
11
- describe('with a provided workspace identifier', () => {
12
- it('should URI encode the parameters in the request URL', async () => {
13
- fetchMock.mockResolvedValue(
14
- new Response('{}', {
15
- status: 200,
16
- statusText: 'OK',
17
- headers: [],
18
- }),
19
- );
20
-
21
- await getNodes({
22
- workspaceId: 'my?workspace',
23
- projectIds: ['some/slash'],
24
- branchSlug: 'test+branch',
25
- search: 'a?special&search',
26
- });
27
-
28
- expect(fetchMock).toBeCalledWith(
29
- 'https://stoplight.io/api/v1/workspaces/my%3Fworkspace/nodes?project_ids[0]=some%2Fslash&search=a%3Fspecial%26search&branch=test%2Bbranch',
30
- {
31
- headers: expect.objectContaining({
32
- 'Stoplight-Elements-Version': expect.any(String),
33
- }),
34
- },
35
- );
36
- });
37
- });
38
- });
@@ -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 { Branch } 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<Branch[]> => {
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 } = React.useContext(PlatformContext);
10
- return useQuery(
11
- [...devPortalCacheKeys.branchesList(projectId), platformUrl, platformAuthToken],
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 } = React.useContext(PlatformContext);
18
-
19
- return useQuery(
20
- [...devPortalCacheKeys.branchNodeDetails(projectId, branchSlug ?? '', nodeSlug), platformUrl, platformAuthToken],
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 } = 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
- platformAuthToken,
29
- ],
30
- () =>
31
- getNodes({ workspaceId, projectIds, branchSlug: branch, search: debounceSearch, platformUrl, platformAuthToken }),
32
- { enabled: !pause, keepPreviousData: true },
33
- );
34
- }
@@ -1,15 +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 } = React.useContext(PlatformContext);
10
- return useQuery(
11
- [...devPortalCacheKeys.branchTOC(projectId, branchSlug ?? ''), platformUrl, platformAuthToken],
12
- () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }),
13
- { enabled: projectId ? true : false },
14
- );
15
- }
@@ -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/styles.css DELETED
@@ -1 +0,0 @@
1
- @import '../../elements-core/src/styles.css';
package/src/types.ts DELETED
@@ -1,81 +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
- projectId: number;
9
- name?: string;
10
- };
11
-
12
- export type ProjectTableOfContents = {
13
- items: TableOfContentsItem[];
14
- hide_powered_by?: boolean;
15
- collapseTableOfContents?: boolean;
16
- };
17
-
18
- export type Node = NodeSummary & {
19
- data: any;
20
- links: {
21
- mock_url?: string;
22
- /**
23
- * @deprecated use export_original_file_url instead
24
- */
25
- export_url?: string;
26
- /**
27
- * The URL to export the original file. This is not a bundled output, meaning references are left in place.
28
- */
29
- export_original_file_url?: string;
30
- /**
31
- * The URL to export a bundled form of the file. Bundling means references are copied into the output file.
32
- */
33
- export_bundled_file_url?: string;
34
- };
35
- outbound_edges: NodeEdge[];
36
- inbound_edges: NodeEdge[];
37
- };
38
-
39
- export type NodeSummary = {
40
- id: string;
41
- type: string;
42
- uri: string;
43
- slug: string;
44
- title: string;
45
- summary: string;
46
- project_id: string;
47
- branch_id: string;
48
- branch_node_id: number;
49
- branch: string;
50
- };
51
-
52
- export type NodeEdge = {
53
- id: string;
54
- type: string;
55
- uri: string;
56
- slug: string;
57
- title: string;
58
- };
59
-
60
- export type NodeSearchResult = NodeSummary & {
61
- highlighted: {
62
- name: string | null;
63
- summary: string | null;
64
- data: string | null;
65
- };
66
- project_slug: string;
67
- project_name: string;
68
- node_id: number;
69
- };
70
-
71
- export type Workspace = {
72
- id: string;
73
- name: string;
74
- slug: string;
75
- default_branch_id: string;
76
- workspace: {
77
- id: string;
78
- name: string;
79
- slug: string;
80
- };
81
- };
package/src/version.ts DELETED
@@ -1,2 +0,0 @@
1
- // auto-updated during build
2
- export const appVersion = '1.10.2';
@@ -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,17 +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
- hideMocking: { type: 'boolean' },
9
- hideExport: { type: 'boolean' },
10
- basePath: { type: 'string' },
11
- staticRouterPath: { type: 'string' },
12
- router: { type: 'string' },
13
- platformUrl: { type: 'string' },
14
- collapseTableOfContents: { type: 'boolean' },
15
- tryItCredentialsPolicy: { type: 'string' },
16
- tryItCorsProxy: { type: 'string' },
17
- });
@@ -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