Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

docs: import demos#245

Merged
JaimeTorrealba merged 2 commits intomainfrom
242-docs-use-imported-code-snippets-where-possible
Oct 5, 2023
Merged

docs: import demos#245
JaimeTorrealba merged 2 commits intomainfrom
242-docs-use-imported-code-snippets-where-possible

Conversation

@andretchen0
Copy link
Copy Markdown
Contributor

@andretchen0 andretchen0 commented Oct 5, 2023

This closes #242 .

  • Since the demo source wasn't written to be viewed directly, there was often more code in them than absolutely necessary. I tried to take as much out as I could while maintaining the look of the demo – e.g., removing <TresCanvas v-bind="gl" /> and gl object and replacing it with <TresCanvas clear-color="#333">, or removing refs. I don't think that's noticeable for the most part, but let me know if I went too far.
  • In a few places, I couldn't shorten the demos and maintain the visual effects or functionality, so I left the copy/pasted source code snippets. BackdropDemo.vue is one instance. (Note that it is possible to include a VSCode-style region, but I didn't want to complicate things. Only whole files are imported at the moment.)
  • Ideally, code highlighting would be specified in the.vue demo files, not in the .md files. That's possible with the current system. But when the .vue files are parsed for rendering, they throw an error if used within a Vue component, e.g.:
<Box
   color="orange" // [!code hl]
   :size="1"
/>

Highlighting a component over multiple lines is a really common case for us. Since that breaks the demos, to keep things consistent, I left all highlighting in the .md files. That looks like this:

<<< @/.vitepress/theme/components/HtmlOccludeDemo.vue{2,6,19,28}

Above the lines 2, 6, 19, and 28 are highlighted.

@andretchen0 andretchen0 linked an issue Oct 5, 2023 that may be closed by this pull request
4 tasks
@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 5, 2023

Deploy Preview for cientos-tresjs ready!

Name Link
🔨 Latest commit 10aa11f
🔍 Latest deploy log https://app.netlify.com/sites/cientos-tresjs/deploys/651f26779b6efe0008d469d4
😎 Deploy Preview https://deploy-preview-245--cientos-tresjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@andretchen0 andretchen0 marked this pull request as ready for review October 5, 2023 17:21
Copy link
Copy Markdown
Member

@JaimeTorrealba JaimeTorrealba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this PR, solutions like this help us to scale more

I know is not specially fun but avoid a lot of typos problems

🙏🏼

Comment thread docs/components.d.ts Outdated
@JaimeTorrealba
Copy link
Copy Markdown
Member

And don't worry about the moment, we can use the '<<< @/.vitepress' Format.

This is already a great DX change for us. We could always go back to this later

@JaimeTorrealba
Copy link
Copy Markdown
Member

I approved already, but before merge, let me know when you delete the .d.ts file please

@JaimeTorrealba JaimeTorrealba merged commit 0ed1870 into main Oct 5, 2023
@andretchen0
Copy link
Copy Markdown
Contributor Author

Thank you so much for this PR, solutions like this help us to scale more

I know is not specially fun but avoid a lot of typos problems

I don't mind. It's better than trying to keep a copy of the demos in sync.

The next big missing piece for me is the props section of the docs. It'd really be great if those tables could be pulled from the components. I think most of the component have JSDocs for the props.

Ideas are welcome! 😀

@andretchen0 andretchen0 deleted the 242-docs-use-imported-code-snippets-where-possible branch October 5, 2023 21:18
@JaimeTorrealba
Copy link
Copy Markdown
Member

Yes, as you can see we're a small numbers of maintainers here, a cientos was basically maintained just by me (Alvaro helps a lot, but he has other pkgs too, and Tino is full focus on the post-processing pkg)

So your addition is really appreciated, we could talk about how improve the pkg and the DX (not only do components)

Also, about another pkg for the ecosystem, I send to you a discussion in Discord about other future pkg

If you want, I'm available for discussing more on discord :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: use imported code snippets where possible

2 participants