diff --git a/packages/docgen/support/generate-pkg-md.mjs b/packages/docgen/support/generate-pkg-md.mjs index 3777638..f34d246 100644 --- a/packages/docgen/support/generate-pkg-md.mjs +++ b/packages/docgen/support/generate-pkg-md.mjs @@ -5,11 +5,7 @@ const generateComponentDoc = (docs) => ` ${docs.description || ''} -- **Type** - - \`\`\` - Component - \`\`\` +- **Type**: \`Component\` ### Props @@ -19,35 +15,30 @@ ${(docs.props || []).map(prop => ` ${prop.description || ''} ${prop.type ? ` -- **Type** - \`\`\` - ${prop.type.name} - \`\`\` +- **Type** \`${prop.type.name}\` ` : ''} ${prop.defaultValue ? ` -- **Default value** - \`\`\` - ${prop.defaultValue.value} - \`\`\` +- **Default value** \`${prop.defaultValue.value}\` ` : ''} `).join('\n')} `; +const generateMembersDocs = (children) => children ? ` +- **Members** +${(children) + .map((child) => ` - **${child.name}**: \`${child.type?.name}\``) + .join('\n')} +` : ''; + const generateTSDocs = (docs) => ` ## ${docs.name}${docs.typeParameters ? getTypeParamString(docs.typeParameters) : ''} ${docs.comment?.shortText || ''} -- **Type** - \`\`\` - ${docs.kindString} - \`\`\` +- **Type** \`${docs.kindString}\` -- **Members** -${(docs.children || []) - .map((child) => ` - **${child.name}**: \`${child.type?.name}\``) - .join('\n')} +${generateMembersDocs(docs.children)} `; const generateChildren = ( diff --git a/packages/docs/lib/.vitepress/config.ts b/packages/docs/lib/.vitepress/config.ts index a67c2db..b030674 100644 --- a/packages/docs/lib/.vitepress/config.ts +++ b/packages/docs/lib/.vitepress/config.ts @@ -18,7 +18,7 @@ export default defineConfig({ { text: 'Guide', activeMatch: '^/guide/', - link: '/guide/introduction' + link: '/guide/why' }, { text: 'API', @@ -35,22 +35,18 @@ export default defineConfig({ text: 'Getting Started', children: [ { text: 'Why Schlechtenburg?', link: '/guide/why' }, - { text: 'Examples', link: '/guide/examples' }, { text: 'Installation', link: '/guide/installation' }, + { text: 'Examples', link: '/guide/examples' }, ], } ], '/api/': [ { text: 'API', - children: [ - { text: '@schlechtenburg/standalone', link: '/api/@schlechtenburg/standalone' }, - { text: '@schlechtenburg/core', link: '/api/@schlechtenburg/core' }, - { text: '@schlechtenburg/layout', link: '/api/@schlechtenburg/layout' }, - { text: '@schlechtenburg/heading', link: '/api/@schlechtenburg/heading' }, - { text: '@schlechtenburg/paragraph', link: '/api/@schlechtenburg/paragraph' }, - { text: '@schlechtenburg/image', link: '/api/@schlechtenburg/image' }, - ], + children: DOCS_PACKAGES.map((name) => ({ + text: `@schlechtenburg/${name}`, + link: `/api/@schlechtenburg/${name}`, + })), } ], '/': false, diff --git a/packages/docs/lib/api/@schlechtenburg/core.md b/packages/docs/lib/api/@schlechtenburg/core.md index d450ebe..c7a67b9 100644 --- a/packages/docs/lib/api/@schlechtenburg/core.md +++ b/packages/docs/lib/api/@schlechtenburg/core.md @@ -4,38 +4,34 @@ The mode the Schlechtenburg editor is currently in -- **Type** - ``` - Enumeration - ``` +- **Type** `Enumeration` + - **Members** - **Edit**: `undefined` - **View**: `undefined` + ## IBlockData<T> Schlechtenburg inputs and outputs a plain JS Object that can be JSON stringified. This is the interface type for that data structure. `T` will be the data type of the specific block being -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **data**: `T` - **id**: `string` - **name**: `string` + ## IBlockDefinition<T> Any Block that you create -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **edit**: `Component` @@ -44,26 +40,21 @@ Any Block that you create - **name**: `string` - **view**: `Component` + ## IBlockLibrary Schlechtenburg maintains a library of blocks that are available -- **Type** - ``` - Interface - ``` +- **Type** `Interface` -- **Members** ## IBlockProps<T> Any Block that you create -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **blockId**: `string` @@ -75,14 +66,13 @@ Any Block that you create - **onRemoveSelf**: `OnRemoveSelfCb` - **onUpdate**: `OnUpdateSelfCb` + ## ISbMainProps -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **availableBlocks**: `undefined` @@ -90,15 +80,14 @@ Any Block that you create - **mode**: `SbMode` - **onUpdate**: `OnUpdateBlockCb` + ## ITreeNode Schlechtenburg keeps track of the rendered block tree. This is useful for e.g. the tree select component in the editor header. -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **children**: `undefined` @@ -106,88 +95,61 @@ This is useful for e.g. the tree select component in the editor header. - **id**: `string` - **name**: `string` + ## OnActivateNextCb -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## OnActivatePreviousCb -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## OnAppendBlockCb -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## OnPrependBlockCb -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## OnRemoveSelfCb -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## OnUpdateBlockCb -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## OnUpdateSelfCb<T> -- **Type** - ``` - Type alias - ``` +- **Type** `Type alias` -- **Members** ## SbBlock @@ -195,11 +157,7 @@ This is useful for e.g. the tree select component in the editor header. Displays a Schlechtenburg block either the mode of the schlechtenburg instance. You can use this to display child blocks inside your own blocks. -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -209,10 +167,7 @@ You can use this to display child blocks inside your own blocks. The state for the block. -- **Type** - ``` - IBlockData - ``` +- **Type** `IBlockData` @@ -223,16 +178,10 @@ The state for the block. Called when the block should be updated. -- **Type** - ``` - OnUpdateBlockCb - ``` +- **Type** `OnUpdateBlockCb` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -242,16 +191,10 @@ Called when the block should be updated. Called when a sibling block should be inserted before the block -- **Type** - ``` - OnPrependBlockCb - ``` +- **Type** `OnPrependBlockCb` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -261,16 +204,10 @@ Called when a sibling block should be inserted before the block Called when a sibling block should be inserted after the block -- **Type** - ``` - OnAppendBlockCb - ``` +- **Type** `OnAppendBlockCb` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -280,16 +217,10 @@ Called when a sibling block should be inserted after the block Called when the block should be removed -- **Type** - ``` - OnRemoveSelfCb - ``` +- **Type** `OnRemoveSelfCb` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -299,16 +230,10 @@ Called when the block should be removed Called when the previous sibling block should be activated -- **Type** - ``` - OnActivatePreviousCb - ``` +- **Type** `OnActivatePreviousCb` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -318,16 +243,10 @@ Called when the previous sibling block should be activated Called when the next sibling block should be activated -- **Type** - ``` - OnActivateNextCb - ``` +- **Type** `OnActivateNextCb` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -336,11 +255,7 @@ Called when the next sibling block should be activated -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -350,16 +265,10 @@ Called when the next sibling block should be activated -- **Type** - ``` - string - ``` +- **Type** `string` -- **Default value** - ``` - null - ``` +- **Default value** `null` @@ -369,16 +278,10 @@ Called when the next sibling block should be activated -- **Type** - ``` - func - ``` +- **Type** `func` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -388,16 +291,10 @@ Called when the next sibling block should be activated -- **Type** - ``` - func - ``` +- **Type** `func` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -407,16 +304,10 @@ Called when the next sibling block should be activated -- **Type** - ``` - func - ``` +- **Type** `func` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -425,11 +316,7 @@ Called when the next sibling block should be activated -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -439,16 +326,10 @@ Called when the next sibling block should be activated -- **Type** - ``` - func - ``` +- **Type** `func` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -458,11 +339,7 @@ Called when the next sibling block should be activated A placeholder for a block. Displays a placeholder for a block, allowing the user to select a block to insert. -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -472,16 +349,10 @@ Displays a placeholder for a block, allowing the user to select a block to inser Called when the user picked a block that should be inserted here. -- **Type** - ``` - func - ``` +- **Type** `func` -- **Default value** - ``` - () => {} - ``` +- **Default value** `() => {}` @@ -490,11 +361,7 @@ Called when the user picked a block that should be inserted here. A button in the schlechtenburg theme -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -504,23 +371,15 @@ A button in the schlechtenburg theme -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## SbSelect A select input in the schlechtenburg theme -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -530,11 +389,7 @@ A select input in the schlechtenburg theme Toolbar in the schlechtenburg theme -- **Type** - - ``` - Component - ``` +- **Type**: `Component` ### Props @@ -544,141 +399,92 @@ Toolbar in the schlechtenburg theme -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## SymBlockDimensions -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## SymBlockLibrary -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## SymEditorDimensions -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## SymMode -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## blockProps -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## model -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## generateBlockId -- **Type** - ``` - Function - ``` +- **Type** `Function` -- **Members** ## useActivation -- **Type** - ``` - Function - ``` +- **Type** `Function` -- **Members** ## useBlockSizing -- **Type** - ``` - Function - ``` +- **Type** `Function` -- **Members** ## useDynamicBlocks -- **Type** - ``` - Function - ``` +- **Type** `Function` -- **Members** ## useResizeObserver -- **Type** - ``` - Function - ``` - -- **Members** \ No newline at end of file +- **Type** `Function` \ No newline at end of file diff --git a/packages/docs/lib/api/@schlechtenburg/heading.md b/packages/docs/lib/api/@schlechtenburg/heading.md index 47871e9..0734f7a 100644 --- a/packages/docs/lib/api/@schlechtenburg/heading.md +++ b/packages/docs/lib/api/@schlechtenburg/heading.md @@ -4,47 +4,33 @@ -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **align**: `string` - **level**: `number` - **value**: `string` + ## default -- **Type** - ``` - Property - ``` +- **Type** `Property` -- **Members** ## name -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## getDefaultData -- **Type** - ``` - Function - ``` - -- **Members** \ No newline at end of file +- **Type** `Function` \ No newline at end of file diff --git a/packages/docs/lib/api/@schlechtenburg/image.md b/packages/docs/lib/api/@schlechtenburg/image.md index 7e01bca..96dce2b 100644 --- a/packages/docs/lib/api/@schlechtenburg/image.md +++ b/packages/docs/lib/api/@schlechtenburg/image.md @@ -4,47 +4,33 @@ -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **alt**: `string` - **description**: `IBlockData` - **src**: `string` + ## default -- **Type** - ``` - Property - ``` +- **Type** `Property` -- **Members** ## name -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## getDefaultData -- **Type** - ``` - Function - ``` - -- **Members** \ No newline at end of file +- **Type** `Function` \ No newline at end of file diff --git a/packages/docs/lib/api/@schlechtenburg/layout.md b/packages/docs/lib/api/@schlechtenburg/layout.md index dcd7cd0..1aff448 100644 --- a/packages/docs/lib/api/@schlechtenburg/layout.md +++ b/packages/docs/lib/api/@schlechtenburg/layout.md @@ -4,46 +4,32 @@ -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **children**: `undefined` - **orientation**: `string` + ## default -- **Type** - ``` - Property - ``` +- **Type** `Property` -- **Members** ## name -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## getDefaultData -- **Type** - ``` - Function - ``` - -- **Members** \ No newline at end of file +- **Type** `Function` \ No newline at end of file diff --git a/packages/docs/lib/api/@schlechtenburg/paragraph.md b/packages/docs/lib/api/@schlechtenburg/paragraph.md index 2cb8a50..7d677d6 100644 --- a/packages/docs/lib/api/@schlechtenburg/paragraph.md +++ b/packages/docs/lib/api/@schlechtenburg/paragraph.md @@ -4,46 +4,32 @@ -- **Type** - ``` - Interface - ``` +- **Type** `Interface` + - **Members** - **align**: `string` - **value**: `string` + ## default -- **Type** - ``` - Property - ``` +- **Type** `Property` -- **Members** ## name -- **Type** - ``` - Variable - ``` +- **Type** `Variable` -- **Members** ## getDefaultData -- **Type** - ``` - Function - ``` - -- **Members** \ No newline at end of file +- **Type** `Function` \ No newline at end of file diff --git a/packages/docs/lib/api/@schlechtenburg/standalone.md b/packages/docs/lib/api/@schlechtenburg/standalone.md index 936609d..926bc50 100644 --- a/packages/docs/lib/api/@schlechtenburg/standalone.md +++ b/packages/docs/lib/api/@schlechtenburg/standalone.md @@ -4,9 +4,4 @@ -- **Type** - ``` - Function - ``` - -- **Members** \ No newline at end of file +- **Type** `Function` \ No newline at end of file diff --git a/packages/docs/lib/guide/introduction.md b/packages/docs/lib/guide/introduction.md deleted file mode 100644 index 4de752e..0000000 --- a/packages/docs/lib/guide/introduction.md +++ /dev/null @@ -1,3 +0,0 @@ -# Introduction - - diff --git a/packages/docs/lib/index.md b/packages/docs/lib/index.md index bd14e88..fc5f665 100644 --- a/packages/docs/lib/index.md +++ b/packages/docs/lib/index.md @@ -1,5 +1,6 @@ # Yet another WYSIWYG editor @@ -11,9 +12,9 @@ It inputs and outputs a tree of JSON-serializable data. This is still in the Proof-of-concept phase.