Skip to content

Final JS docs fixes and launch #501

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

Merged
merged 10 commits into from
Sep 14, 2021
Merged

Final JS docs fixes and launch #501

merged 10 commits into from
Sep 14, 2021

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Sep 14, 2021

  • Replace home-page-specific language toggle with the new global one.

  • Replace the separate JavaScript vs TypeScript "Hello World" Playground examples with a unified one. I'm keeping the JS output hand-rolled for this example for now, because the static properties block isn't in the perfect position, and this is a very prominent example. Will fix in [ts-transformers] Improve position of static properties and add blank line lit#2159 as followup.

  • Fix home page highlight positions when in JS mode. This actually broke in Convert static styles/properties getter to class fields #495 where I forgot to update the ranges for the yellow-highlight effect.

  • Added a check for generated samples that have lost or re-ordered playground fold/hide comments. This should help detect weird cases that might need hand-rolling going forward.

  • Hand-roll two examples that are losing fold comments, and move one comment to be trailing so that it's not lost, that I found via the above check. Filed [ts-transformers] Some comments are not preserved lit#2158 to hopefully address in the transformers in the future.

  • Remove some unnecessary TypeScript vs JavaScript language, and add a few more switchable samples.

  • Remove jsSamples mod feature flag to launch JS docs.

Fixes #332
Fixes #490

@github-actions
Copy link

github-actions bot commented Sep 14, 2021

A live preview of this PR will be available at the URL(s) below.
The latest URL will be appended to this comment on each push.
Each build takes ~5-10 minutes, and will 404 until finished.

https://pr501-755ed87---lit-dev-5ftespv5na-uc.a.run.app/
https://pr501-c79bd65---lit-dev-5ftespv5na-uc.a.run.app/

@aomarks aomarks force-pushed the final-js-stuff branch 2 times, most recently from e07e535 to 3b738b6 Compare September 14, 2021 22:02
Base automatically changed from change-guard to main September 14, 2021 22:08
Copy link
Contributor

@justinfagnani justinfagnani left a comment

Choose a reason for hiding this comment

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

🎉

@@ -42,7 +42,7 @@ Some things to note:
* Lit’s [expressive, declarative templates](/docs/templates/overview/) (utilizing JavaScript tagged template literals) make it easy to describe how a component should be rendered.
* [Reactive properties](/docs/components/properties/) represent a component’s public API and/or internal state; your component automatically re-renders whenever a reactive property changes.
* [Styles](/docs/components/styles) are scoped by default, keeping your CSS selectors simple and ensuring that your component’s styling won’t pollute (or be polluted by) the surrounding context.
* This example is in TypeScript, but TypeScript is 100% optional–Lit works great in JavaScript, too.
* Lit works great in vanilla JavaScript, or you can use TypeScript for more even better ergonomics by using decorators and strong types.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe "strong types" -> "type declarations"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@justinfagnani
Copy link
Contributor

Thanks for the easy-to-review commits!

@@ -42,7 +42,7 @@ Some things to note:
* Lit’s [expressive, declarative templates](/docs/templates/overview/) (utilizing JavaScript tagged template literals) make it easy to describe how a component should be rendered.
* [Reactive properties](/docs/components/properties/) represent a component’s public API and/or internal state; your component automatically re-renders whenever a reactive property changes.
* [Styles](/docs/components/styles) are scoped by default, keeping your CSS selectors simple and ensuring that your component’s styling won’t pollute (or be polluted by) the surrounding context.
* This example is in TypeScript, but TypeScript is 100% optional–Lit works great in JavaScript, too.
* Lit works great in vanilla JavaScript, or you can use TypeScript for more even better ergonomics by using decorators and strong types.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: "for more even better"

Copy link
Member Author

Choose a reason for hiding this comment

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

But it is more even better!

(Fixed.)

Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz left a comment

Choose a reason for hiding this comment

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

Code looks good. Did some manual testing on home page, tutorial & playground.

Nit: You can undo the language change clear which leaves you in the opposite language. Fine as a follow up.

@aomarks
Copy link
Member Author

aomarks commented Sep 14, 2021

Nit: You can undo the language change clear which leaves you in the opposite language. Fine as a follow up.

Oh yeah, that's very related to a bug that I've been meaning to address for a long time! You can actually undo between files too, which is totally weird! It's because we use a single CodeMirror instance for each Playground, and just swap out the code + language highlight mode. We need to either manage undo history and swap those in and out too if possible, otherwise maintain a separate CodeMirror instance for each file: google/playground-elements#154

@aomarks aomarks merged commit e2d7fd3 into main Sep 14, 2021
@aomarks aomarks deleted the final-js-stuff branch September 14, 2021 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify home-page JS/TS switch with samples switch JavaScript docs with TS/JS switch
3 participants