hass-fontawesome/fontawesome-pro.patch
2019-11-26 09:38:14 +01:00

140 lines
4.6 KiB
Diff

diff --git a/custom_components/fontawesome/__init__.py b/custom_components/fontawesome/__init__.py
index 7534066..e72e552 100644
--- a/custom_components/fontawesome/__init__.py
+++ b/custom_components/fontawesome/__init__.py
@@ -11,6 +11,8 @@ ICON_FILES = {
'regular': 'far.js',
'solid': 'fas.js',
'brands': 'fab.js',
+ 'light': 'fal.js',
+ 'duotone': 'fad.js',
}
async def async_setup(hass, config):
diff --git a/custom_components/fontawesome/config_flow.py b/custom_components/fontawesome/config_flow.py
index e2bf5ac..2007411 100644
--- a/custom_components/fontawesome/config_flow.py
+++ b/custom_components/fontawesome/config_flow.py
@@ -42,6 +42,14 @@ class FontawesomeEditFlow(config_entries.OptionsFlow):
"brands",
default=self.config_entry.options.get("brands", False),
): bool,
+ vol.Optional(
+ "light",
+ default=self.config_entry.options.get("light", False),
+ ): bool,
+ vol.Optional(
+ "duotone",
+ default=self.config_entry.options.get("duotone", False),
+ ): bool,
}
)
)
\ No newline at end of file
diff --git a/js/fab.js b/js/fab.js
index 2aae5d5..7131118 100644
--- a/js/fab.js
+++ b/js/fab.js
@@ -1,4 +1,4 @@
-import txt from "@fortawesome/fontawesome-free/sprites/brands.svg"
+import txt from "@fortawesome/fontawesome-pro/sprites/brands.svg"
const iconset = document.createElement("ha-iconset-svg");
iconset.name="fab";
iconset.size="1024";
diff --git a/js/fad.js b/js/fad.js
new file mode 100644
index 0000000..77fab15
--- /dev/null
+++ b/js/fad.js
@@ -0,0 +1,6 @@
+import txt from "@fortawesome/fontawesome-pro/sprites/duotone.svg"
+const iconset = document.createElement("ha-iconset-svg");
+iconset.name="fad";
+iconset.size="1024";
+iconset.innerHTML = txt.replace(/\<symbol/g, '<g').replace(/\<\/symbol\>/g, '</g>');
+document.body.appendChild(iconset);
diff --git a/js/fal.js b/js/fal.js
new file mode 100644
index 0000000..ce948d0
--- /dev/null
+++ b/js/fal.js
@@ -0,0 +1,6 @@
+import txt from "@fortawesome/fontawesome-pro/sprites/light.svg"
+const iconset = document.createElement("ha-iconset-svg");
+iconset.name="fal";
+iconset.size="1024";
+iconset.innerHTML = txt.replace(/\<symbol/g, '<g').replace(/\<\/symbol\>/g, '</g>');
+document.body.appendChild(iconset);
diff --git a/js/far.js b/js/far.js
index 78445a7..a1c8acb 100644
--- a/js/far.js
+++ b/js/far.js
@@ -1,4 +1,4 @@
-import txt from "@fortawesome/fontawesome-free/sprites/regular.svg"
+import txt from "@fortawesome/fontawesome-pro/sprites/regular.svg"
const iconset = document.createElement("ha-iconset-svg");
iconset.name="far";
iconset.size="1024";
diff --git a/js/fas.js b/js/fas.js
index 97bd01c..3e4a307 100644
--- a/js/fas.js
+++ b/js/fas.js
@@ -1,4 +1,4 @@
-import txt from "@fortawesome/fontawesome-free/sprites/solid.svg"
+import txt from "@fortawesome/fontawesome-pro/sprites/solid.svg"
const iconset = document.createElement("ha-iconset-svg");
iconset.name="fas";
iconset.size="1024";
diff --git a/package.json b/package.json
index 4d501f5..76f1335 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,6 @@
"webpack-cli": "^3.3.10"
},
"dependencies": {
- "@fortawesome/fontawesome-free": "^5.11.2"
+ "@fortawesome/fontawesome-pro": "^5.11.2"
}
}
diff --git a/webpack.config.js b/webpack.config.js
index 1d7eb2e..ddcbff7 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -37,4 +37,20 @@ module.exports = [
},
...common,
},
+ {
+ entry: './js/fal.js',
+ output: {
+ filename: 'custom_components/fontawesome/data/fal.js',
+ path: path.resolve(__dirname)
+ },
+ ...common,
+ },
+ {
+ entry: './js/fad.js',
+ output: {
+ filename: 'custom_components/fontawesome/data/fad.js',
+ path: path.resolve(__dirname)
+ },
+ ...common,
+ },
];
diff --git a/custom_components/fontawesome/.translations/en.json b/custom_components/fontawesome/.translations/en.json
index 84b9633..d1d0e16 100644
--- a/custom_components/fontawesome/.translations/en.json
+++ b/custom_components/fontawesome/.translations/en.json
@@ -13,7 +13,9 @@
"data": {
"regular": "Include Regular icons (far:)",
"solid": "Include Solid icons (fas:)",
- "brands": "Include Brand icons (fab:)"
+ "brands": "Include Brand icons (fab:)",
+ "light": "Include Light icons (fal:)",
+ "duotone": "Include Duotone icons (fad:)"
}
}
}