Skip to content

Commit

Permalink
Merge branch 'main_o'
Browse files Browse the repository at this point in the history
  • Loading branch information
isosphere committed Jun 29, 2024
2 parents 1d80ba9 + a9443f8 commit b8c3b80
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/icons/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "icons"
version = "0.1.0"
version = "0.2.0"
authors = ["ALeX Kazik <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -10,4 +10,4 @@ yew = { version = "0.21", features = ["csr"] }
yew-bootstrap = { path = "../../packages/yew-bootstrap" }

[[bin]]
name = "copy-bootstrap-icons"
name = "include-bootstrap-icons"
2 changes: 1 addition & 1 deletion examples/icons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ A copy of `bootstrap-icons` is included and should change only rarely. `trunk` d

```html
<base data-trunk-public-url />
<link rel="stylesheet" href="bootstrap-icons-v1.10.5/bootstrap-icons.css" />
<link rel="stylesheet" href="bootstrap-icons-v1.11.3/bootstrap-icons.css" />
<link data-trunk rel="rust" data-bin="name-of-app" />
```

Expand Down
4 changes: 2 additions & 2 deletions examples/icons/Trunk.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[[hooks]]
stage = "build"
stage = "post_build"
command = "cargo"
command_arguments = ["run", "--bin", "copy-bootstrap-icons"]
command_arguments = ["run", "--bin", "include-bootstrap-icons"]
2 changes: 1 addition & 1 deletion examples/icons/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<base data-trunk-public-url/>
<meta charset="utf-8"/>
<title>Yew App</title>
<link rel="stylesheet" href="bootstrap-icons-v1.10.5/bootstrap-icons.css"/>
<!include-bootstrap-icons>
<link data-trunk rel="rust" data-bin="icons"/>
</head>
</html>
13 changes: 0 additions & 13 deletions examples/icons/src/bin/copy-bootstrap-icons.rs

This file was deleted.

27 changes: 27 additions & 0 deletions examples/icons/src/bin/include-bootstrap-icons.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::path::PathBuf;
use yew_bootstrap::icons::BIFiles;

fn main() -> Result<(), std::io::Error> {
let staging_dir = PathBuf::from(
std::env::var("TRUNK_STAGING_DIR").expect("Environment variable TRUNK_STAGING_DIR"),
);

let path = staging_dir.join(BIFiles::NAME);
if !path.is_dir() {
std::fs::create_dir(&path)?;
}
BIFiles::copy(&path)?;

let path = staging_dir.join("index.html");
let index = std::fs::read_to_string(&path)?;
let index = index.replace(
"<!include-bootstrap-icons>",
&format!(
r#"<link rel="stylesheet" href="bootstrap-icons-{}/bootstrap-icons.css"/>"#,
BIFiles::VERSION
),
);
std::fs::write(&path, index)?;

Ok(())
}
2 changes: 1 addition & 1 deletion packages/yew-bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yew-bootstrap"
version = "0.10.0"
version = "0.10.1"
authors = ["Matthew Scheffel <[email protected]>", "Foorack <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*!
* Bootstrap Icons v1.10.5 (https://icons.getbootstrap.com/)
* Copyright 2019-2023 The Bootstrap Authors
* Bootstrap Icons v1.11.3 (https://icons.getbootstrap.com/)
* Copyright 2019-2024 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE)
*/

@font-face {
font-display: block;
font-family: "bootstrap-icons";
src: url("./fonts/bootstrap-icons.woff2?1fa40e8900654d2863d011707b9fb6f2") format("woff2"),
url("./fonts/bootstrap-icons.woff?1fa40e8900654d2863d011707b9fb6f2") format("woff");
src: url("./fonts/bootstrap-icons.woff2?dd67030699838ea613ee6dbda90effa6") format("woff2"),
url("./fonts/bootstrap-icons.woff?dd67030699838ea613ee6dbda90effa6") format("woff");
}

.bi::before,
Expand Down Expand Up @@ -1979,3 +1979,100 @@ url("./fonts/bootstrap-icons.woff?1fa40e8900654d2863d011707b9fb6f2") format("wof
.bi-sina-weibo::before { content: "\f8ca"; }
.bi-tencent-qq::before { content: "\f8cb"; }
.bi-wikipedia::before { content: "\f8cc"; }
.bi-alphabet-uppercase::before { content: "\f2a5"; }
.bi-alphabet::before { content: "\f68a"; }
.bi-amazon::before { content: "\f68d"; }
.bi-arrows-collapse-vertical::before { content: "\f690"; }
.bi-arrows-expand-vertical::before { content: "\f695"; }
.bi-arrows-vertical::before { content: "\f698"; }
.bi-arrows::before { content: "\f6a2"; }
.bi-ban-fill::before { content: "\f6a3"; }
.bi-ban::before { content: "\f6b6"; }
.bi-bing::before { content: "\f6c2"; }
.bi-cake::before { content: "\f6e0"; }
.bi-cake2::before { content: "\f6ed"; }
.bi-cookie::before { content: "\f6ee"; }
.bi-copy::before { content: "\f759"; }
.bi-crosshair::before { content: "\f769"; }
.bi-crosshair2::before { content: "\f794"; }
.bi-emoji-astonished-fill::before { content: "\f795"; }
.bi-emoji-astonished::before { content: "\f79a"; }
.bi-emoji-grimace-fill::before { content: "\f79b"; }
.bi-emoji-grimace::before { content: "\f7a0"; }
.bi-emoji-grin-fill::before { content: "\f7a1"; }
.bi-emoji-grin::before { content: "\f7a6"; }
.bi-emoji-surprise-fill::before { content: "\f7a7"; }
.bi-emoji-surprise::before { content: "\f7ac"; }
.bi-emoji-tear-fill::before { content: "\f7ad"; }
.bi-emoji-tear::before { content: "\f7b2"; }
.bi-envelope-arrow-down-fill::before { content: "\f7b3"; }
.bi-envelope-arrow-down::before { content: "\f7b8"; }
.bi-envelope-arrow-up-fill::before { content: "\f7b9"; }
.bi-envelope-arrow-up::before { content: "\f7be"; }
.bi-feather::before { content: "\f7bf"; }
.bi-feather2::before { content: "\f7c4"; }
.bi-floppy-fill::before { content: "\f7c5"; }
.bi-floppy::before { content: "\f7d8"; }
.bi-floppy2-fill::before { content: "\f7d9"; }
.bi-floppy2::before { content: "\f7e4"; }
.bi-gitlab::before { content: "\f7e5"; }
.bi-highlighter::before { content: "\f7f8"; }
.bi-marker-tip::before { content: "\f802"; }
.bi-nvme-fill::before { content: "\f803"; }
.bi-nvme::before { content: "\f80c"; }
.bi-opencollective::before { content: "\f80d"; }
.bi-pci-card-network::before { content: "\f8cd"; }
.bi-pci-card-sound::before { content: "\f8ce"; }
.bi-radar::before { content: "\f8cf"; }
.bi-send-arrow-down-fill::before { content: "\f8d0"; }
.bi-send-arrow-down::before { content: "\f8d1"; }
.bi-send-arrow-up-fill::before { content: "\f8d2"; }
.bi-send-arrow-up::before { content: "\f8d3"; }
.bi-sim-slash-fill::before { content: "\f8d4"; }
.bi-sim-slash::before { content: "\f8d5"; }
.bi-sourceforge::before { content: "\f8d6"; }
.bi-substack::before { content: "\f8d7"; }
.bi-threads-fill::before { content: "\f8d8"; }
.bi-threads::before { content: "\f8d9"; }
.bi-transparency::before { content: "\f8da"; }
.bi-twitter-x::before { content: "\f8db"; }
.bi-type-h4::before { content: "\f8dc"; }
.bi-type-h5::before { content: "\f8dd"; }
.bi-type-h6::before { content: "\f8de"; }
.bi-backpack-fill::before { content: "\f8df"; }
.bi-backpack::before { content: "\f8e0"; }
.bi-backpack2-fill::before { content: "\f8e1"; }
.bi-backpack2::before { content: "\f8e2"; }
.bi-backpack3-fill::before { content: "\f8e3"; }
.bi-backpack3::before { content: "\f8e4"; }
.bi-backpack4-fill::before { content: "\f8e5"; }
.bi-backpack4::before { content: "\f8e6"; }
.bi-brilliance::before { content: "\f8e7"; }
.bi-cake-fill::before { content: "\f8e8"; }
.bi-cake2-fill::before { content: "\f8e9"; }
.bi-duffle-fill::before { content: "\f8ea"; }
.bi-duffle::before { content: "\f8eb"; }
.bi-exposure::before { content: "\f8ec"; }
.bi-gender-neuter::before { content: "\f8ed"; }
.bi-highlights::before { content: "\f8ee"; }
.bi-luggage-fill::before { content: "\f8ef"; }
.bi-luggage::before { content: "\f8f0"; }
.bi-mailbox-flag::before { content: "\f8f1"; }
.bi-mailbox2-flag::before { content: "\f8f2"; }
.bi-noise-reduction::before { content: "\f8f3"; }
.bi-passport-fill::before { content: "\f8f4"; }
.bi-passport::before { content: "\f8f5"; }
.bi-person-arms-up::before { content: "\f8f6"; }
.bi-person-raised-hand::before { content: "\f8f7"; }
.bi-person-standing-dress::before { content: "\f8f8"; }
.bi-person-standing::before { content: "\f8f9"; }
.bi-person-walking::before { content: "\f8fa"; }
.bi-person-wheelchair::before { content: "\f8fb"; }
.bi-shadows::before { content: "\f8fc"; }
.bi-suitcase-fill::before { content: "\f8fd"; }
.bi-suitcase-lg-fill::before { content: "\f8fe"; }
.bi-suitcase-lg::before { content: "\f8ff"; }
.bi-suitcase::before { content: "\f900"; }
.bi-suitcase2-fill::before { content: "\f901"; }
.bi-suitcase2::before { content: "\f902"; }
.bi-vignette::before { content: "\f903"; }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019-2023 The Bootstrap Authors
Copyright (c) 2019-2024 The Bootstrap Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/yew-bootstrap/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::path::Path;

fn bootstrap_icons<W: Write>(output: &mut W) -> Result<()> {
let mut sorted_icons = BTreeMap::new();
for ln in include_str!("bootstrap-icons-v1.10.5/bootstrap-icons.css").lines() {
for ln in include_str!("bootstrap-icons-v1.11.3/bootstrap-icons.css").lines() {
if let Some(ln) = ln.strip_prefix(".bi-") {
if let Some((lower_kebab_case, _)) = ln.split_once("::before") {
if !lower_kebab_case.is_empty() {
Expand Down
35 changes: 25 additions & 10 deletions packages/yew-bootstrap/src/icons/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
//!
//! ```html
//! <base data-trunk-public-url />
//! <link rel="stylesheet" href="bootstrap-icons-v1.10.5/bootstrap-icons.css" />
//! <link rel="stylesheet" href="bootstrap-icons-v1.11.3/bootstrap-icons.css" />
//! <link data-trunk rel="rust" data-bin="name-of-app" />
//! ```
//!
Expand Down Expand Up @@ -205,12 +205,25 @@ pub struct BIFiles {
pub license: &'static str,
}

/// allows compile time concatenation with other strings to make const 'static str
macro_rules! version {
() => {
"v1.11.3"
};
}
/// provides a resuable path to the bootstrap-icons files that we can make const 'static str with
macro_rules! path {
() => {
concat!("../../bootstrap-icons-", version!(), "/")
};
}

impl BIFiles {
/// Version of the package.
pub const VERSION: &'static str = "v1.10.5";
pub const VERSION: &'static str = version!();

/// Name of the package.
pub const NAME: &'static str = "bootstrap-icons-v1.10.5";
pub const NAME: &'static str = concat!("bootstrap-icons-", version!());

/// All bootstrap-icons files.
///
Expand All @@ -221,20 +234,22 @@ impl BIFiles {
/// ```
/// (That way it will be an error if a file is added/removed.)
pub const FILES: Self = Self {
css: include_str!("../../bootstrap-icons-v1.10.5/bootstrap-icons.css"),
font_woff: include_bytes!("../../bootstrap-icons-v1.10.5/fonts/bootstrap-icons.woff"),
font_woff2: include_bytes!("../../bootstrap-icons-v1.10.5/fonts/bootstrap-icons.woff2"),
license: include_str!("../../bootstrap-icons-v1.10.5/fonts/LICENSE"),
css: include_str!(concat!(path!(), "bootstrap-icons.css")),
font_woff: include_bytes!(concat!(path!(), "fonts/bootstrap-icons.woff")),
font_woff2: include_bytes!(concat!(path!(), "fonts/bootstrap-icons.woff2")),
license: include_str!(concat!(path!(), "fonts/LICENSE")),
};

/// Load the bootstrap-icons files from the official cdn.
///
/// Call `BIFiles::cdn()` inside the `html!{}` returned by your application.
pub const fn cdn() -> VNode {
VNode::VRaw(VRaw {
html: AttrValue::Static(
r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">"#,
),
html: AttrValue::Static(concat!(
r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@"#,
version!(),
r#"/font/bootstrap-icons.css">"#
)),
})
}

Expand Down

0 comments on commit b8c3b80

Please sign in to comment.