Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document swapFunctions of astro:transitions/client #9084

Merged
merged 9 commits into from
Aug 28, 2024
Merged

Conversation

martrapp
Copy link
Member

@martrapp martrapp commented Aug 14, 2024

Description (required)

In 4.8.0 10908 we introduced building blocks for custom swap() functions. Up to now we didn't properly document and export them. We first wanted to see if they worked. They did.

This PR is intended to discuss and close this technical debt.

For Astro version: 4.15.0. See astro PR 11708.

Copy link

netlify bot commented Aug 14, 2024

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 1420df9
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/66ccfbec781c900008b9e8c0
😎 Deploy Preview https://deploy-preview-9084--astro-docs-2.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.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented Aug 14, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/view-transitions.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@martrapp martrapp marked this pull request as draft August 14, 2024 20:02
@sarah11918 sarah11918 added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) labels Aug 14, 2024
@martrapp martrapp marked this pull request as ready for review August 15, 2024 04:29
@sarah11918 sarah11918 added the minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah! label Aug 16, 2024
@sarah11918 sarah11918 added this to the 4.15 milestone Aug 16, 2024
@sarah11918
Copy link
Member

I'm wondering whether we should have a nice API entry for swapFunctions here: https://docs.astro.build/en/reference/api-reference/#viewtransitions- ?

Since it's something we import from astro:transitions, it feels like there should be a reference item for it?

@martrapp
Copy link
Member Author

I'm wondering whether we should have ...

Yes, definitively. It could be part of #7961! But i would not add it to the API section before the events. You use the custom swap functions to redefine the swap function of the event object.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

OK, so I am now really feeling the lack of a section in API reference for astro:transitions 😄 But for now, for this addition, I think we can do this, then separately let's get a new section in the API reference page and we'll come back here and link to a proper full reference of all these things!

src/content/docs/en/guides/view-transitions.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/view-transitions.mdx Outdated Show resolved Hide resolved
martrapp and others added 3 commits August 22, 2024 19:03
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
@martrapp
Copy link
Member Author

Thank you very much for your help Sarah! There is a reason why Astro Docs have such a good reputation 💜

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Thanks for the helpful polish on this, @martrapp ! Approving for docs! (Wait, this is docs...)

};

...
ev.swap = () => mySwap(ev.newDocument);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ev.swap = () => mySwap(ev.newDocument);
event.swap = () => mySwap(event.newDocument);

Last tiny tiny thing: assuming that ev stands for event, we generally prefer to write these words out in full as they can help people who aren't used to standard abbreviations. This would be my preference, if correct!

Copy link
Member Author

@martrapp martrapp Aug 22, 2024

Choose a reason for hiding this comment

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

Good one! I had used ev for consistency with the rest of the page. Now everything is consistent again ;-)

Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

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

LGTM @martrapp, good work! 💜

@sarah11918 sarah11918 changed the base branch from main to 4.15.0 August 26, 2024 22:04
@sarah11918 sarah11918 added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label Aug 26, 2024
@sarah11918 sarah11918 merged commit 6842b93 into 4.15.0 Aug 28, 2024
10 checks passed
@sarah11918 sarah11918 deleted the mt/swapFunctions branch August 28, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants