Progress on docs

This commit is contained in:
Aria Minaei 2021-09-04 17:08:51 +02:00
parent c189bb2662
commit 5d63ce4f3e
7 changed files with 63 additions and 49 deletions

View file

@ -56,11 +56,20 @@ module.exports = {
],
},
],
// sidebarDepth: 4,
sidebar: [
{
title: 'Guide',
children: ['/getting-started'],
},
{
title: 'API',
path: '/api/',
path: '/api',
// sidebarDepth: 2,
children: ['/api/core/', '/api/studio/'],
},
{
title: 'Support',
children: ['/support', '/faq'],
},
],
lastUpdated: 'Last Updated',
@ -73,39 +82,19 @@ module.exports = {
editLinkText: 'Edit this page on Github',
},
plugins: [
[
'vuepress-plugin-typedoc',
{
entryPoints: [
path.join(pathToMonorepo, './theatre/core/dist/index.d.ts'),
],
tsconfig: path.join(pathToMonorepo, './theatre/tsconfig.json'),
out: 'api/core',
// sidebar: {
// fullNames: true,
// parentCategory: 'api',
// },
readme: 'none',
hideInPageTOC: true,
categorizeByGroup: false,
},
],
// [
// 'vuepress-plugin-typedoc',
// {
// entryPoints: [
// path.join(pathToMonorepo, './theatre/studio/src/index.ts'),
// ],
// tsconfig: path.join(pathToMonorepo, './theatre/tsconfig.json'),
// out: 'api/studio',
// // sidebar: {
// // fullNames: true,
// // parentCategory: 'api',
// // },
// readme: 'none',
// hideInPageTOC: true,
// categorizeByGroup: false,
// },
// ],
// ...['core', 'studio'].map((which) => [
// 'vuepress-plugin-typedoc',
// {
// entryPoints: [
// path.join(pathToMonorepo, `./theatre/${which}/src/index.ts`),
// ],
// tsconfig: path.join(pathToMonorepo, `./theatre/tsconfig.json`),
// out: `api/${which}`,
// sidebar: null,
// readme: `none`,
// // hideInPageTOC: true,
// // categorizeByGroup: false,
// },
// ]),
],
}

View file

@ -1,8 +0,0 @@
---
title: API
---
# API
* [`@theatre/core`](./api/core)
* [`@theatre/studio`](./api/studio)

1
docs/api/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*/*

8
docs/api/README.md Normal file
View file

@ -0,0 +1,8 @@
---
title: API
---
# API
* [`@theatre/core`](./core)
* [`@theatre/studio`](./studio)

View file

@ -42,7 +42,7 @@ export function getProject(id: string, config: IProjectConfig = {}): IProject {
throw new Error(
`You seem to have called Theatre.getProject("${id}", config) twice, with different config objects. ` +
`This is disallowed because changing the config of a project on the fly can lead to hard-to-debug issues.\n\n` +
`You can fix this by either calling Theatre.getProject() once per project-id,` +
`You can fix this by either calling Theatre.getProject() once per projectId,` +
` or calling it multiple times but with the exact same config.`,
)
}

View file

@ -1,3 +1,9 @@
/**
* Theatre comes in two packages: `@theatre/core` (the library) and
* `@theatre/studio` (the editor). This package is the core library.
*
* @module \@theatre/core
*/
export * from './coreExports'
export type {
IProject,

View file

@ -6,19 +6,37 @@ import {validateName} from '@theatre/shared/utils/sanitizers'
import {validateAndSanitiseSlashedPathOrThrow} from '@theatre/shared/utils/slashedPaths'
import type {$IntentionalAny} from '@theatre/shared/utils/types'
export type IProjectConfig = Partial<{
state: $IntentionalAny
}>
/**
* A project's config object (currently the only point of configuration is the project's state)
*/
export type IProjectConfig = {
/**
* The state of the project, as [exported](https://docs.theatrejs.com/export.html) by the studio.
*/
state?: $IntentionalAny
}
/**
* A Theatre project
*/
export interface IProject {
readonly type: 'Theatre_Project_PublicAPI'
/**
* If `@theatre/studio` is used, this promise would resolve when studio has loaded
* the state of the project into memory.
*
* If `@theatre/studio` is not used, this promise is already resolved.
*/
readonly ready: Promise<void>
/**
* Shows whether the project is ready to be used.
* Better to use IProject.ready, which is a promise that will
* Better to use {@link IProject.ready}, which is a promise that would
* resolve when the project is ready.
*/
readonly isReady: boolean
/**
* The project's address
*/
readonly address: ProjectAddress
sheet(sheetId: string, instanceId?: string): ISheet
}