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

fix(widgets): export @deck.gl/widgets/stylesheet.css #8863

Merged
merged 3 commits into from May 2, 2024

Conversation

atmorling
Copy link
Contributor

Closes #8862

Change List

  • Adds export of widget stylesheet in package.json
  • Removes non-existent container prop from zoom-widget documentation (unrelated, can split into individual PR if preferred)

Disclaimer

I've tested the import case with the test/apps/widget example, I have not tested the style case, mainly because I'm not 100% sure on the best way to do so, happy to take guidance on testing that without having to publish.

@coveralls
Copy link

Coverage Status

coverage: 89.83%. remained the same
when pulling ad60c8d on atmorling:widgets
into a9acdf8 on visgl:master.

Copy link
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

No docs? How are users supposed to find out?

@chrisgervang
Copy link
Collaborator

Which docs are you referring to? Importing the stylesheet is documented in the widgets modules.

@ibgreen
Copy link
Collaborator

ibgreen commented May 2, 2024

Which docs are you referring to? Importing the stylesheet is documented in the widgets modules.

OK if this is just a bug fix and not a new export path, then it could help if PR title would be prefixed with something like "fix(widgets): ..."

For another PR: Reviewing the docs I found this mentioned in the module overview page but not the Widget class docs, it possibly be worth a mention there or a link to where it is stated.

@chrisgervang chrisgervang changed the title Export @deck.gl/widgets/stylesheet.css foxExport @deck.gl/widgets/stylesheet.css May 2, 2024
@chrisgervang chrisgervang changed the title foxExport @deck.gl/widgets/stylesheet.css fix(widgets): export @deck.gl/widgets/stylesheet.css May 2, 2024
@chrisgervang
Copy link
Collaborator

Good call. Updated the title, and I'll update the commit message as well.

The core and widget modules are designed to isolated, so I'm hesitant to link to it from core. This CSS file should only be necessary when you're using the widgets shipped in the official widget modules, and Widgets class is only to be used when someone creating a custom widget, in which case they're responsible for writing your own styles.

Do you think some clarification is necessary?

@chrisgervang chrisgervang merged commit 44e971d into visgl:master May 2, 2024
4 checks passed
@ibgreen
Copy link
Collaborator

ibgreen commented May 3, 2024

Do you think some clarification is necessary?

Nah. I was really just trying to show my support for and interest in the widget effort by adding a review.

All sounds good.

},
"./stylesheet.css": {
"import": "./dist/stylesheet.css",
"style": "./dist/stylesheet.css"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can't find any documentation about this field. I do see some libraries set the top-level style field, though, like bootstrap. Maybe that is what we need?

Copy link
Collaborator

@donmccurdy donmccurdy May 3, 2024

Choose a reason for hiding this comment

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

Perhaps default could replace both import and style here? I believe this change is currently fine for ESM users but may break for CJS users. The subset of bundler configs that are still using CJS but are new enough to import stylesheets might be small.

I'm having trouble finding information on package.json#style but I think the idea is that it resolves things like imports within PostCSS modules:

@import "some-stylesheet-package";

.foo {
  background: orange;
}

A bundler may also inline your dependencies' style fields by default, but may not:

parcel-bundler/parcel#432

Copy link
Collaborator

Choose a reason for hiding this comment

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

@atmorling could you point us to where found this solution? Maybe this style tag should be removed if it doesn't seem to do anything.

I can go either way on the top-level style since it doesn't seem standardized, though I'm leaning towards doing what can be tested (add a post-css test app?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found it in a webpack guide on package.json documentation, but you're right, it doesn't appear in Node's documentation at all. It should probably be removed.

Pessimistress pushed a commit that referenced this pull request May 6, 2024
* remove container from zoom-widget docs

* add export for @deck.gl/widgets stylesheet
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.

[Bug] Widget stylesheet not exported properly
6 participants