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

Icons #30

Merged
merged 15 commits into from
Nov 12, 2023
Merged

Icons #30

merged 15 commits into from
Nov 12, 2023

Conversation

alexkazik
Copy link
Contributor

@alexkazik alexkazik commented Sep 13, 2023

As discussed in #29, here is the MR.

This comes in two parts.

I've included your first comments (from my repo).
Thanks for the response!

I've tested it some, but another test and set of eyes would be helpful.

First part

This MR with three commits:

  • Add icons to to the project
  • Use the new icons
  • Deprecate util::include_cdn_icons

The last is only a logical followup of the first, it can be moved into part two (or just some time later) if you prefer.

Second part

A commit with breaking changes:
alexkazik@5368bba

Since this is a breaking change, it requires a version bump to 0.6 (currently it's 0.5.18).

And that is why it will be a separate MR.

(Edit: if yew 0.21 has some breaking changes then the the version of yew-bootstrap has also to be raised to at least 0.6.)

@alexkazik
Copy link
Contributor Author

After thinking about it a bit more: Should I just delete icons2 since it's less helpful than I thought?

@alexkazik
Copy link
Contributor Author

I just noticed that icons v1.11.0 is out, should I update the first commit, add a new one with the update or ignore it for now?

@isosphere
Copy link
Owner

I just noticed that icons v1.11.0 is out, should I update the first commit, add a new one with the update or ignore it for now?

I'd just ignore it for now; there are some new icons there, but we don't need to be in a rush to support them

@alexkazik
Copy link
Contributor Author

Yew 0.21 is out, and the icons require another impl, which is not available in 0.20.
Should I add it to this MR or should be merged for 0.20 first?

@isosphere
Copy link
Owner

isosphere commented Sep 29, 2023

Upstream Yew

Given than you introduce a breaking change, we might as well update this to Yew 0.21. Better one big expected change than two.

yew-bootstrap builds and tests fine on Yew 0.21, but you have to run cargo update first due to yewstack/yew#3366.

PR Changes

I swear I edited your README.md somewhere to clarify it for new users/quick start, but I can't find that anywhere. Does this ring a bell to you? 😅.

New Version

I think the versioning of our crate is currently an ugly mess, see #23. I might want to not use 0.6 as the next version and instead do something massively different so it makes more sense going forward.

@isosphere isosphere mentioned this pull request Sep 29, 2023
@isosphere isosphere added this to the 2023Q4R1 milestone Sep 29, 2023
@isosphere isosphere linked an issue Sep 29, 2023 that may be closed by this pull request
@alexkazik
Copy link
Contributor Author

alexkazik commented Sep 29, 2023

I've updated this RP and added the yew update (edit: though it's incomplete, I can remove it) and also ToHtml for BI.

Yes it rings a bell, it's here: alexkazik/yew-bootstrap-icons#1 and I've included many things but not all since it's now structured a bit different.

Should I remove the example icons2 (and rename icons1 to icons) since it's as helpful as I initially thought?

Edit: I like the 0.6+y0.21-b5.3 or similar for the versioning. Interestingly enough semver.org says that behind the plus only [0-9A-Za-z-] is allowed (and thus no dot) but shows 1.0.0-beta+exp.sha.5114f85 as an example (with dot).

@isosphere
Copy link
Owner

isosphere commented Oct 3, 2023

I've tucked into your branch here, but it looks like I can't get your examples/icons1 to compile:

   Compiling icons1 v0.1.0 (C:\Users\Matt\Documents\Development\Rust\yew-bootstrap\examples\icons1)
error[E0277]: `yew_bootstrap::icons::BI` doesn't implement `std::fmt::Display`
 --> icons1\src\main.rs:7:44
  |
7 |         <h1>{"I"}<span style="color: red">{BI::HEART_FILL}</span>{BI::GEAR_FILL}</h1>
  |                                            --^^^^^^^^^^^^
  |                                            |
  |                                            `yew_bootstrap::icons::BI` cannot be formatted with the default formatter
  |                                            required by a bound introduced by this call
  |
  = help: the trait `std::fmt::Display` is not implemented for `yew_bootstrap::icons::BI`
  = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
  = note: required for `yew_bootstrap::icons::BI` to implement `ToString`
  = note: required for `VNode` to implement `From<yew_bootstrap::icons::BI>`
  = note: required for `yew_bootstrap::icons::BI` to implement `Into<VNode>`
  = note: 2 redundant requirements hidden
  = note: required for `yew_bootstrap::icons::BI` to implement `Into<NodeSeq<yew_bootstrap::icons::BI, VNode>>`

error[E0277]: `yew_bootstrap::icons::BI` doesn't implement `std::fmt::Display`
 --> icons1\src\main.rs:7:67
  |
7 |         <h1>{"I"}<span style="color: red">{BI::HEART_FILL}</span>{BI::GEAR_FILL}</h1>
  |                                                                   --^^^^^^^^^^^
  |                                                                   |
  |                                                                   `yew_bootstrap::icons::BI` cannot be formatted with the default formatter
  |                                                                   required by a bound introduced by this call
  |
  = help: the trait `std::fmt::Display` is not implemented for `yew_bootstrap::icons::BI`
  = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
  = note: required for `yew_bootstrap::icons::BI` to implement `ToString`
  = note: required for `VNode` to implement `From<yew_bootstrap::icons::BI>`
  = note: required for `yew_bootstrap::icons::BI` to implement `Into<VNode>`
  = note: 2 redundant requirements hidden
  = note: required for `yew_bootstrap::icons::BI` to implement `Into<NodeSeq<yew_bootstrap::icons::BI, VNode>>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `icons1` (bin "icons1") due to 2 previous errors
2023-10-03T23:16:19.760046Z ERROR  error
error from HTML pipeline

Caused by:
    0: error from asset pipeline
    1: error during cargo build execution
    2: cargo call returned a bad status

Your icons2 also fails to compile, for a different reason (use of relative paths, I think):

~/Documents/Development/Rust/yew-bootstrap/examples/icons2> trunk serve                                                                                                     
10/03/2023 08:19:17 PMError: error taking canonical path to [watch].ignore "static/bootstrap-icons-v1.10.5" in "\\\\?\\C:\\Users\\Matt\\Documents\\Development\\Rust\\yew-bootstrap\\examples\\icons2\\Trunk.toml"

Caused by:
    The system cannot find the file specified. (os error 2)

packages/yew-bootstrap builds fine, though.

@isosphere isosphere modified the milestones: 0.6.0, 0.7.0 Oct 3, 2023
@isosphere
Copy link
Owner

I'm going to push the Yew 0.21 change immediately as 0.6.0. I am happy to jump right to 0.7.0 immediately after we do that with limited delay; I think this is best for our end-users using semantic versioning.

@alexkazik
Copy link
Contributor Author

I had a different problem (couldn't build yew-0.21) first (all examples).
Then I did a cargo update.
And afterwards I had no problem building all examples (including mine).

Since the Cargo.lock file is not in the repo I can't reproduce your problem.
It is recommended to add the lock file for binaries (the examples) to repos.

And jonhoo also adds then to his libraries so that the CI jobs can work with it. Which is what I have adopted.

I've pushed the changes on the new main.
Also I've removed the icons2 example (I'll re-add it if you want, but I think it's not a good idea).

@isosphere
Copy link
Owner

isosphere commented Oct 4, 2023

Please don't use force push, it messes up source trees external to your own. Let the git history be messy!

#8 (comment)

@alexkazik
Copy link
Contributor Author

I'm sorry - I'm used to fix it until it's right.

@isosphere isosphere self-requested a review October 19, 2023 17:28
@isosphere
Copy link
Owner

Hey @alexkazik; I've made some edits. Please review my changes and correct me if necessary. Otherwise, I'd be happy to proceed with merging and releasing as 0.7.0.

@alexkazik
Copy link
Contributor Author

Looks good. Though now I'm wondering if the LICENSE should be added to BIFiles as well (and thus also be in the dist of the application)?
If yes, I can put a commit with that together.

@isosphere
Copy link
Owner

Looks good. Though now I'm wondering if the LICENSE should be added to BIFiles as well (and thus also be in the dist of the application)?
If yes, I can put a commit with that together.

I think you're right; binary distributions must have the license as well.

We might have to include several licenses one day, I wonder how we can do that without losing clarity about why each license is included. Folders, I guess?

@alexkazik
Copy link
Contributor Author

I've added a few things to a new branch, and are happy to move them here if you want:
/~https://github.com/alexkazik/yew-bootstrap/commits/icons-license

  • add license to BIFiles (and copy)
  • fix clippy warnings
  • remove BI::empty/default

I've added BI::empty as a shortcut for myself. I don't know if it's a good idea to support an icon and no icon in one.
When removed you have to use Option which looks more matching but probably makes it harder to work with: you have to unwrap_or yourself.
Alternative: feature flag to enable empty
Alternative: support a second type, one with one without empty (BI+BINonEmpty or BI+BIE(mpty))
As removing empty is a breaking change I wanted to bring it up now.

@alexkazik
Copy link
Contributor Author

I've added a few more commits to the icons-license branch:

  • Fix typo
  • TESTING! use upcoming yew !TESTING
  • Replace ToHtml implementation with IntoPropValue

The first is just to remove an unbalanced backtick.

Then yew is removing the ToHtml trait (already in master).
The one commit uses the current version and the other fixes the icons implementation for it.

Please tell me which I should add to this PR (or you can pick them yourself).

@isosphere
Copy link
Owner

I've added a few more commits to the icons-license branch:

* Fix typo

* TESTING! use upcoming yew !TESTING

* Replace ToHtml implementation with IntoPropValue

The first is just to remove an unbalanced backtick.

Then yew is removing the ToHtml trait (already in master). The one commit uses the current version and the other fixes the icons implementation for it.

Please tell me which I should add to this PR (or you can pick them yourself).

Please do not add a change in the yew dependency to this PR; one PR per "thing" please. The license change, clippy warnings, typo fixes, and the removal of BI::empty seem worthy.

@alexkazik
Copy link
Contributor Author

I've added the mentioned commits to this RP.

The upcoming yew changes are now on icons-upcoming-yew, for later.

@isosphere
Copy link
Owner

I've added the mentioned commits to this RP.

The latest commits I see attached to this PR are on Oct 29, 2023; might have forgotten to push?

@alexkazik
Copy link
Contributor Author

The latest commits I see attached to this PR are on Oct 29, 2023;

Thats all right - they are that old ;-)

@isosphere isosphere merged commit bb19075 into isosphere:main Nov 12, 2023
1 check passed
@isosphere
Copy link
Owner

Thank you for your contribution! This has been published as version 0.7.0.

@alexkazik alexkazik deleted the icons branch November 12, 2023 08:20
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.

Icons
2 participants