Skip to content

Get blueprint namespace directly from blueprintjs #182

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

Closed
wants to merge 14 commits into from
Closed

Get blueprint namespace directly from blueprintjs #182

wants to merge 14 commits into from

Conversation

casperOne
Copy link

@casperOne casperOne commented Mar 26, 2022

Fixes #181

Changes proposed in this pull request:

Update OptionalBlueprint to set the blueprint namespace constant using a from the Classes type exported from blueprint.

Confirmed that it is available in both 3.0 and 4.0:

https://github.com/palantir/blueprint/blob/develop/packages/core/src/common/classes.ts#L316
https://github.com/palantir/blueprint/blob/%40blueprintjs/core%403.54.0/packages/core/src/common/classes.ts#L322

Reviewers should focus on:

The buttons being sized correctly in react mosaic when using blueprintjs 4.0 and react mosaic 5.0

@casperOne casperOne changed the title Bp namespace from blueprintjs Get blueprint namespace directly from blueprintjs Mar 26, 2022
import type { IconNames } from '@blueprintjs/icons';
import classNames from 'classnames';
import _ from 'lodash';
import * as React from 'react';

// Performs a top level import of blueprint and gets the classes.
async function getBluePrintClasses() {
Copy link
Owner

Choose a reason for hiding this comment

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

Keeping it optional would be nice - why did you end up removing this? Lack of support in build tools?

Copy link
Author

Choose a reason for hiding this comment

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

Top level async statements are not supported when the target is es2017; the library would have to be bumped up to es2020 in order to take advantage of that.

Without top level awaits (and support for import to be called as a function), this approach wouldn't work.

If you're willing to have the module/lib updated to es2020, I'd be happy to make that change and include this back into the PR.

@casperOne
Copy link
Author

I'm going to pull this back and create a clean PR which addresses the bp3 issue.

If you'd like a PR around loading this dynamically, I'll do that, separately, but it will require a lot of upgrading to the build tooling, which obfuscates the issue.

@casperOne casperOne closed this Mar 26, 2022
@casperOne casperOne deleted the bp-namespace-from-blueprintjs branch March 26, 2022 22:43
@nomcopter
Copy link
Owner

I appreciate all the action here - I'm working on adding blueprintNamespace as a prop to Mosaic which should make this possible while still being able to target Blueprint v4

@nomcopter
Copy link
Owner

Should have a release today

@casperOne
Copy link
Author

@nomcopter appreciated, thanks!

TBH, I like this solution, allowing us to define it in code, but I wasn't sure if that was in the spirit that you intend for the library

@nomcopter
Copy link
Owner

Yeah it would be nice to do it automatically with proper optional dependencies or by just requiring blueprint but build tooling support for the former is obnoxious and restrictive downstream and the latter complicates things for those that don't want it. Appreciate the thorough issues and PR!

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.

React mosaic 5.0 with Blueprintjs 4.0 has window buttons that are too big
2 participants