From a409d56ae53c771d1d004e977c8f3d3fa9883624 Mon Sep 17 00:00:00 2001 From: xiaofan_yu Date: Thu, 11 Sep 2025 20:09:19 +0800 Subject: [PATCH 1/3] feat(docs): add awesome page --- astro.config.mjs | 34 +++++++++++++----------- src/components/Header/Header.astro | 5 ++++ src/components/Resources/Resources.astro | 19 +++++++++++++ src/components/Resources/resources.css | 10 +++++++ src/pages/awesome.astro | 10 +++++++ 5 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 src/components/Resources/Resources.astro create mode 100644 src/components/Resources/resources.css create mode 100644 src/pages/awesome.astro diff --git a/astro.config.mjs b/astro.config.mjs index 5e90c437c..8297363b1 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -2,6 +2,7 @@ import { defineConfig } from 'astro/config'; import react from "@astrojs/react"; import starlight from "@astrojs/starlight"; import starlightTypeDoc, { typeDocSidebarGroup } from 'starlight-typedoc'; +import fs from 'node:fs' import sitemap from '@astrojs/sitemap'; @@ -47,20 +48,23 @@ export default defineConfig({ './src/layouts/colorvars.css', ], plugins: [ - // Generate the documentation. - starlightTypeDoc({ - entryPoints: ['./fabric.js/fabric.ts'], - tsconfig: './fabric.js/typedoc.config.json', - typeDoc: { - plugin: ['typedoc-plugin-no-inherit'], - readme: 'none', - gitRemote: 'https://github.com/fabricjs/fabric.js/blob', - entryFileName: 'index.md', - includeVersion: true, - sourceLinkExternal: true, - sourceLinkTemplate: 'https://github.com/fabricjs/fabric.js/blob/{gitRevision}/{path}#L{line}', - }, - }), - ], + // Generate the documentation only if local sources exist. + // This avoids dev crashes when `fabric.js` sources are not checked out. + (fs.existsSync(new URL('./fabric.js/fabric.ts', import.meta.url)) && + fs.existsSync(new URL('./fabric.js/typedoc.config.json', import.meta.url))) && + starlightTypeDoc({ + entryPoints: ['./fabric.js/fabric.ts'], + tsconfig: './fabric.js/typedoc.config.json', + typeDoc: { + plugin: ['typedoc-plugin-no-inherit'], + readme: 'none', + gitRemote: 'https://github.com/fabricjs/fabric.js/blob', + entryFileName: 'index.md', + includeVersion: true, + sourceLinkExternal: true, + sourceLinkTemplate: 'https://github.com/fabricjs/fabric.js/blob/{gitRevision}/{path}#L{line}', + }, + }), + ].filter(Boolean), }), react(), sitemap()], }); \ No newline at end of file diff --git a/src/components/Header/Header.astro b/src/components/Header/Header.astro index de5b36b6c..2d382f556 100644 --- a/src/components/Header/Header.astro +++ b/src/components/Header/Header.astro @@ -25,6 +25,11 @@ Api specs +
  • + + Awesome + +
  • Team diff --git a/src/components/Resources/Resources.astro b/src/components/Resources/Resources.astro new file mode 100644 index 000000000..da142d024 --- /dev/null +++ b/src/components/Resources/Resources.astro @@ -0,0 +1,19 @@ +--- +import './resources.css'; +const links = [ + { + link: 'https://github.com/cs-open/react-fabric', + description: ' - A high-extensibility library with a composite style, built with React', + name: '@cs-open/react-fabric', + }, + +] +--- +
    +

    Resources

    +
    +
    \ No newline at end of file diff --git a/src/components/Resources/resources.css b/src/components/Resources/resources.css new file mode 100644 index 000000000..bbf73f526 --- /dev/null +++ b/src/components/Resources/resources.css @@ -0,0 +1,10 @@ +#resources { + display: flex; + flex-direction: column; + align-items: center; + justify-items: center; + +} +#resources .resource-label{ + color: var(--primary-color) +} \ No newline at end of file diff --git a/src/pages/awesome.astro b/src/pages/awesome.astro new file mode 100644 index 000000000..338ea0f96 --- /dev/null +++ b/src/pages/awesome.astro @@ -0,0 +1,10 @@ +--- +import Layout from '../layouts/Layout.astro'; +import Resources from '../components/Resources/Resources.astro'; +--- + + +
    + +
    +
    From 6eb50d14528f6872b3f7ccf25681e64efdf8962b Mon Sep 17 00:00:00 2001 From: xiaofan_yu Date: Thu, 11 Sep 2025 20:12:40 +0800 Subject: [PATCH 2/3] feat(docs): add awesome page --- src/components/Resources/Resources.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Resources/Resources.astro b/src/components/Resources/Resources.astro index da142d024..1c7bec5d0 100644 --- a/src/components/Resources/Resources.astro +++ b/src/components/Resources/Resources.astro @@ -13,7 +13,7 @@ const links = [

    Resources

      { - links.map((link) => ()=> (
    • {link.name}  {link.description}
    • )) + links.map((link) => (
    • {link.name}  {link.description}
    • )) }
    \ No newline at end of file From e0e67c221f161a797167ff46d6f1493e59c7fe31 Mon Sep 17 00:00:00 2001 From: yxf <740652572@qq.com> Date: Thu, 11 Sep 2025 23:31:41 +0800 Subject: [PATCH 3/3] feat(docs): rename awesome to resource --- src/components/Header/Header.astro | 4 +-- src/components/Resources/Resources.astro | 34 +++++++++++++++--------- src/pages/awesome.astro | 10 ------- src/pages/resources.astro | 13 +++++++++ 4 files changed, 36 insertions(+), 25 deletions(-) delete mode 100644 src/pages/awesome.astro create mode 100644 src/pages/resources.astro diff --git a/src/components/Header/Header.astro b/src/components/Header/Header.astro index 2d382f556..7e2ed0773 100644 --- a/src/components/Header/Header.astro +++ b/src/components/Header/Header.astro @@ -26,8 +26,8 @@
  • - - Awesome + + Resources
  • diff --git a/src/components/Resources/Resources.astro b/src/components/Resources/Resources.astro index 1c7bec5d0..f701f1f5e 100644 --- a/src/components/Resources/Resources.astro +++ b/src/components/Resources/Resources.astro @@ -1,19 +1,27 @@ --- import './resources.css'; const links = [ - { - link: 'https://github.com/cs-open/react-fabric', - description: ' - A high-extensibility library with a composite style, built with React', - name: '@cs-open/react-fabric', - }, - -] + { + link: 'https://github.com/cs-open/react-fabric', + description: + ' - A high-extensibility library with a composite style, built with React', + name: '@cs-open/react-fabric', + }, +]; --- +

    Resources

    -
      - { - links.map((link) => (
    • {link.name}  {link.description}
    • )) - } -
    -
    \ No newline at end of file + + diff --git a/src/pages/awesome.astro b/src/pages/awesome.astro deleted file mode 100644 index 338ea0f96..000000000 --- a/src/pages/awesome.astro +++ /dev/null @@ -1,10 +0,0 @@ ---- -import Layout from '../layouts/Layout.astro'; -import Resources from '../components/Resources/Resources.astro'; ---- - - -
    - -
    -
    diff --git a/src/pages/resources.astro b/src/pages/resources.astro new file mode 100644 index 000000000..f19b654b8 --- /dev/null +++ b/src/pages/resources.astro @@ -0,0 +1,13 @@ +--- +import Layout from '../layouts/Layout.astro'; +import ResourcesList from '../components/Resources/Resources.astro'; +--- + + +
    + +
    +