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

Chore: [Tentative] fix: SVG in HTML <img> compatibility #35

Merged
merged 7 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions assets/templates/template.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg01.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ mod Component {

data.append(' id=\\"SDG1\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62 62\\"><rect fill=\\"#');
data.append('\\"0 0 62 62\\"><rect fill=\\"%23');
data.append('ea1d2d\\" width=\\"62\\" height');
data.append('=\\"62\\"/><g fill=\\"#fff\\"><');
data.append('=\\"62\\"/><g fill=\\"%23fff\\"><');
data.append('path d=\\"M5.46,7.83c-.11.06-.4');
data.append('2.18-.94.37s-.68.23-.79.28V6.78');
data.append('A10.81,10.81,0,0,0,5,6.19a3.93,');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg02.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG2\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 61.93 61.93\\"><rect fil');
data.append('l=\\"#d19f2a\\" width=\\"61.93');
data.append('l=\\"%23d19f2a\\" width=\\"61.93');
data.append('\\" height=\\"61.93\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5,15.61');
data.append('=\\"%23fff\\"><path d=\\"M5,15.61');
data.append('l2.86-4.42L8,10.93a10.38,10.38,');
data.append('0,0,0,.81-1.4A2.77,2.77,0,0,0,9');
data.append('.11,8.3a1.51,1.51,0,0,0-.22-.87');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg03.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG3\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 61.92 61.92\\"><rect fil');
data.append('l=\\"#2d9a47\\" width=\\"61.92');
data.append('l=\\"%232d9a47\\" width=\\"61.92');
data.append('\\" height=\\"61.92\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.65,16');
data.append('=\\"%23fff\\"><path d=\\"M5.65,16');
data.append('.46a4.1,4.1,0,0,1-.74-2.63v-.41');
data.append('H7.15v.39a3.07,3.07,0,0,0,.22,1');
data.append('.3.76.76,0,0,0,.74.39.73.73,0,0');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg04.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG4\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 61.93 61.93\\"><rect fil');
data.append('l=\\"#c22033\\" width=\\"61.93');
data.append('l=\\"%23c22033\\" width=\\"61.93');
data.append('\\" height=\\"61.93\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M8.29,14');
data.append('=\\"%23fff\\"><path d=\\"M8.29,14');
data.append('.4H4.73V12.62L7.81,5.39h2.52v7.');
data.append('3h1.18V14.4H10.33v2.79h-2Zm0-1.');
data.append('71v-5l-1.79,5Z\\"/><path d=\\"M');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg05.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG5\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 61.84 61.84\\"><rect fil');
data.append('l=\\"#ef412a\\" width=\\"61.84');
data.append('l=\\"%23ef412a\\" width=\\"61.84');
data.append('\\" height=\\"61.84\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M6.2,16.');
data.append('=\\"%23fff\\"><path d=\\"M6.2,16.');
data.append('93a2.14,2.14,0,0,1-.92-1.22,6.4');
data.append(',6.4,0,0,1-.25-2H7.21a4.36,4.36');
data.append(',0,0,0,.19,1.48.75.75,0,0,0,.75');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg06.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG6\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 61.31 61.31\\"><rect fil');
data.append('l=\\"#00add8\\" width=\\"61.31');
data.append('l=\\"%2300add8\\" width=\\"61.31');
data.append('\\" height=\\"61.31\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M42,24.7');
data.append('=\\"%23fff\\"><path d=\\"M42,24.7');
data.append('6a.28.28,0,0,0-.2-.08H19.45a.28');
data.append('.28,0,0,0-.2.08.29.29,0,0,0-.06');
data.append('.21L23,47.68a.27.27,0,0,0,.26.2');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg07.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG7\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.02 62.02\\"><rect fil');
data.append('l=\\"#fdb714\\" width=\\"62.02');
data.append('l=\\"%23fdb714\\" width=\\"62.02');
data.append('\\" height=\\"62.02\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M8.3,7.1');
data.append('=\\"%23fff\\"><path d=\\"M8.3,7.1');
data.append('2H5.09V5.39h5.42V6.87L8,17.22H5');
data.append('.82Z\\"/><path d=\\"M16.22,5.39');
data.append('h.88L18,9.91h-.77l-.18-1.05h-.7');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg08.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG8\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.23 62.23\\"><rect fil');
data.append('l=\\"#8f1838\\" width=\\"62.23');
data.append('l=\\"%238f1838\\" width=\\"62.23');
data.append('\\" height=\\"62.23\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M4.87,15');
data.append('=\\"%23fff\\"><path d=\\"M4.87,15');
data.append('.13a4,4,0,0,1,.35-1.73,2.27,2.2');
data.append('7,0,0,1,1-1.08,3,3,0,0,1-.88-1.');
data.append('07,3.58,3.58,0,0,1-.33-1.61,3.1');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg09.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG9\\" xmlns=\\"http://w');
data.append('ww.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 61.85 61.85\\"><rect fil');
data.append('l=\\"#f36e24\\" width=\\"61.85');
data.append('l=\\"%23f36e24\\" width=\\"61.85');
data.append('\\" height=\\"61.85\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.74,16');
data.append('=\\"%23fff\\"><path d=\\"M5.74,16');
data.append('.58A3.29,3.29,0,0,1,5,14.32v-.1');
data.append('7H7.16a2.58,2.58,0,0,0,.17,1.13');
data.append('.7.7,0,0,0,.69.34.68.68,0,0,0,.');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg10.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG10\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.15 62.15\\"><rect fil');
data.append('l=\\"#e01a83\\" width=\\"62.15');
data.append('l=\\"%23e01a83\\" width=\\"62.15');
data.append('\\" height=\\"62.15\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.42,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.42,7.');
data.append('75c-.11,0-.42.18-.94.36s-.67.23');
data.append('-.78.28V6.71a8.7,8.7,0,0,0,1.21');
data.append('-.59,4.05,4.05,0,0,0,1-.71H7.68');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg11.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG11\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.05 62.05\\"><rect fil');
data.append('l=\\"#f99d25\\" width=\\"62.05');
data.append('l=\\"%23f99d25\\" width=\\"62.05');
data.append('\\" height=\\"62.05\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.41,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.41,7.');
data.append('73c-.11.06-.42.18-.94.37l-.77.2');
data.append('8V6.7a9.24,9.24,0,0,0,1.2-.59,3');
data.append('.87,3.87,0,0,0,1-.71H7.67V17.23');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg12.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG12\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.08 62.08\\"><rect fil');
data.append('l=\\"#cd8b2a\\" width=\\"62.08');
data.append('l=\\"%23cd8b2a\\" width=\\"62.08');
data.append('\\" height=\\"62.08\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.32,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.32,7.');
data.append('74a8.25,8.25,0,0,1-.93.36c-.41.');
data.append('14-.67.23-.78.28V6.7a10.48,10.4');
data.append('8,0,0,0,1.21-.58,4.31,4.31,0,0,');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg13.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG13\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.11 62.11\\"><rect fil');
data.append('l=\\"#48773c\\" width=\\"62.11');
data.append('l=\\"%2348773c\\" width=\\"62.11');
data.append('\\" height=\\"62.11\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.5,7.7');
data.append('=\\"%23fff\\"><path d=\\"M5.5,7.7');
data.append('4c-.11.06-.42.18-.94.37l-.77.27');
data.append('V6.7A9,9,0,0,0,5,6.12,4,4,0,0,0');
data.append(',6,5.4H7.76V17.24H5.5Z\\"/><pat');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg14.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG14\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.06 62.06\\"><rect fil');
data.append('l=\\"#007dbb\\" width=\\"62.06');
data.append('l=\\"%23007dbb\\" width=\\"62.06');
data.append('\\" height=\\"62.06\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.32,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.32,7.');
data.append('73a8.3,8.3,0,0,1-.93.37c-.41.14');
data.append('-.67.23-.78.28V6.7a9.28,9.28,0,');
data.append('0,0,1.21-.59,4.26,4.26,0,0,0,1-');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg15.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG15\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.07 62.07\\"><rect fil');
data.append('l=\\"#40ae49\\" width=\\"62.07');
data.append('l=\\"%2340ae49\\" width=\\"62.07');
data.append('\\" height=\\"62.07\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.29,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.29,7.');
data.append('74a8.25,8.25,0,0,1-.93.36c-.41.');
data.append('14-.67.23-.78.28V6.7a9.75,9.75,');
data.append('0,0,0,1.21-.58,4.31,4.31,0,0,0,');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg16.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG16\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.06 62.06\\"><rect fil');
data.append('l=\\"#00558a\\" width=\\"62.06');
data.append('l=\\"%2300558a\\" width=\\"62.06');
data.append('\\" height=\\"62.06\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.32,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.32,7.');
data.append('74c-.11,0-.42.18-.93.36s-.67.23');
data.append('-.78.28V6.7a9.28,9.28,0,0,0,1.2');
data.append('1-.59,4.26,4.26,0,0,0,1-.71H7.5');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sdgs/sdg17.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ mod Component {
data.append(' id=\\"SDG17\\" xmlns=\\"http://');
data.append('www.w3.org/2000/svg\\" viewBox=');
data.append('\\"0 0 62.13 62.13\\"><rect fil');
data.append('l=\\"#1a3668\\" width=\\"62.13');
data.append('l=\\"%231a3668\\" width=\\"62.13');
data.append('\\" height=\\"62.13\\"/><g fill');
data.append('=\\"#fff\\"><path d=\\"M5.41,7.');
data.append('=\\"%23fff\\"><path d=\\"M5.41,7.');
data.append('74a9.74,9.74,0,0,1-.93.37c-.41.');
data.append('14-.67.23-.78.28V6.71a10.78,10.');
data.append('78,0,0,0,1.21-.59,3.8,3.8,0,0,0');
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sft/border.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ mod Component {

data.append(' ><rect width=\\"');
data.append('312\\" height=\\"356\\" x=\\"2');
data.append('\\" y=\\"2\\" stroke=\\"url(#border');
data.append(')\\" stroke-linejoin=\\"round\\"');
data.append('\\" y=\\"2\\" stroke=\\"url(%23bord');
data.append('er)\\" stroke-linejoin=\\"round\\"');
data.append(' stroke-opacity=\\"');
data.append(props.stroke_opacity);
data.append('\\" stroke');
Expand Down
2 changes: 1 addition & 1 deletion src/components/component/sft/border_v2.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mod Component {

data.append('><rect width=\\"312\\" height=\\');
data.append('"356\\" x=\\"2\\" y=\\"2\\" str');
data.append('oke=\\"url(#border_gradient)\\"');
data.append('oke=\\"url(%23border_gradient)\\"');
data.append(' stroke-linejoin=\\"round\\" st');
data.append('roke-opacity=\\"');
data.append(props.stroke_opacity);
Expand Down
4 changes: 2 additions & 2 deletions src/components/component/sft/progress_bar.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod Component {
data.append(color);
},
Stroke::Gradient(gradient) => {
data.append('url(#a)');
data.append('url(%23a)');
need_defs = true;
},
}
Expand Down Expand Up @@ -104,7 +104,7 @@ mod Component {
data.append(color);
},
Stroke::Gradient(gradient) => {
data.append('url(#b)');
data.append('url(%23b)');
need_defs = true;
},
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/component/sft/status.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ impl DefaultProperties of Default<Properties> {
y: Option::None,
status: array!['Upcoming'].span(),
r1_width: 85,
c_fill: '#8CA5FF',
c_fill: '%238CA5FF',
c_opacity: '.9',
t_fill: '#97ACFA',
r2_stroke: '#8994F5',
t_fill: '%2397ACFA',
r2_stroke: '%238994F5',
r2_stroke_opacity: '.3',
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ mod Component {
data.append('h=\\"');
data.append(props.r1_width.to_ascii());
data.append('\\" height=\\"22\\" fill');
data.append('=\\"#1F2128\\" fill-opacity=\\"');
data.append('=\\"%231F2128\\" fill-opacity=\\"');
data.append('.2\\" rx=\\"11\\"/><circle cx=');
data.append('\\"10\\" cy=\\"11\\" r=\\"3\\"');
data.append(' fill=\\"');
Expand Down
10 changes: 9 additions & 1 deletion src/metadata/common/models.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ use alexandria_ascii::ToAsciiArrayTrait;

use metadata::interfaces::component_provider::IComponentProviderDispatcher;

#[derive(Default, Copy, Drop)]
type Shortstring = felt252;
#[derive(Default, Copy, Drop)]
type String = Span<Shortstring>;

impl DefaultSpan<T, impl D: Default<T>, impl D: Drop<T>> of Default<Span<T>> {
fn default() -> Span<T> {
array![].span()
}
}

#[derive(Copy, Drop)]
struct StorageData {
component_provider: IComponentProviderDispatcher,
Expand Down Expand Up @@ -79,7 +87,7 @@ impl AssetSizeToStringImpl of ToString<AssetSize> {
}
}

#[derive(Copy, Drop)]
#[derive(Copy, Drop, Default)]
struct ProjectStaticData {
name: String,
description: String,
Expand Down
Loading