Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
be633923
Unverified
Commit
be633923
authored
3 years ago
by
Patrizio Bekerle
Browse files
Options
Downloads
Patches
Plain Diff
Remove obsolete icon code
parent
473e9f8c
No related branches found
No related tags found
No related merge requests found
Pipeline
#44726
failed
3 years ago
Stage: test
Stage: deploy
Stage: e2e
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/common/src/icon.js
+0
-83
0 additions, 83 deletions
packages/common/src/icon.js
with
0 additions
and
83 deletions
packages/common/src/icon.js
+
0
−
83
View file @
be633923
import
{
html
,
LitElement
,
css
}
from
'
lit-element
'
;
import
{
html
,
LitElement
,
css
}
from
'
lit-element
'
;
// import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
// import {until} from 'lit-html/directives/until.js';
import
*
as
commonUtils
from
'
../utils.js
'
;
import
*
as
commonUtils
from
'
../utils.js
'
;
import
{
name
as
pkgName
}
from
'
./../package.json
'
;
import
{
name
as
pkgName
}
from
'
./../package.json
'
;
// // Use in case the icon fails to load
// const errorIcon = `
// <svg version="1.1" id="Layer_2_1_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
// viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
// <g>
// <path d="M38.2,98.7c-1.1,0-2.2-0.6-2.8-1.6c-0.5-0.8-0.6-1.8-0.3-2.6l8.9-37.8H24.5c-1.2,0-2.2-0.6-2.8-1.5c-0.6-1-0.7-2.2-0.1-3.2
// l0.2-0.3L54.9,3.1c0.9-1.6,2.3-1.8,2.8-1.8c1.1,0,2.2,0.6,2.8,1.6c0.5,0.8,0.6,1.7,0.3,2.6l-6.9,30.4L75.6,36
// c1.1,0,2.2,0.6,2.8,1.5c0.6,1,0.7,2.2,0.1,3.2l-0.2,0.3L40.8,97.4l-0.2,0.2C40.3,97.9,39.5,98.7,38.2,98.7z M28.6,51.2h18.1
// c1.8,0,3.2,1.5,3.2,3.4v0.3l-6.8,29l28.2-42.4l-20.3-0.1c-1.8,0-3.2-1.5-3.2-3.4v-0.3l5-21.9L28.6,51.2z M75.5,41.5
// C75.5,41.5,75.5,41.5,75.5,41.5L75.5,41.5z M51.1,35.9L51.1,35.9C51.2,35.9,51.1,35.9,51.1,35.9z"/>
// </g>
// </svg>
// `;
// function getCSSVariable(name) {
// let value = window.getComputedStyle(document.documentElement).getPropertyValue(name);
//
// if (!value) {
// return null;
// }
//
// return value.replaceAll('"', '').replaceAll('\'', '').trim();
// }
export
function
getIconSVGURL
(
name
)
{
export
function
getIconSVGURL
(
name
)
{
// const varName = '--dbp-override-icon-' + name;
// const cssVarValue = getCSSVariable(varName);
// const iconBasePath = getCSSVariable('--dbp-icon-base-path');
// // console.log("varName", varName);
// // console.log("cssVarValue", cssVarValue);
// // console.log("iconBasePath", iconBasePath);
//
// // check if we want to override the icon
// if (cssVarValue) {
// let path = cssVarValue;
//
// // try to take care of relative paths
// if (!path.startsWith('/') && !path.startsWith('http://') && !path.startsWith('https://') && iconBasePath) {
// path = iconBasePath + path;
// }
//
// // console.log("path", path);
//
// return path;
// }
return
commonUtils
.
getAssetURL
(
pkgName
,
'
icons/
'
+
encodeURI
(
name
)
+
'
.svg
'
);
return
commonUtils
.
getAssetURL
(
pkgName
,
'
icons/
'
+
encodeURI
(
name
)
+
'
.svg
'
);
}
}
...
@@ -71,39 +24,6 @@ export function getIconCSS(name) {
...
@@ -71,39 +24,6 @@ export function getIconCSS(name) {
`
;
`
;
}
}
// async function getSVGTextElement(name) {
// const iconURL = getIconSVGURL(name);
// // console.log("iconURL: " + iconURL);
//
// const response = await fetch(iconURL);
// if (!response.ok) {
// return unsafeHTML(errorIcon);
// }
// let text = await response.text();
// if (text.indexOf('<svg') === -1) {
// return unsafeHTML(errorIcon);
// }
// text = text.slice(text.indexOf('<svg'));
// return unsafeHTML(text);
// }
// const iconCache = {};
// /**
// * Avoid lots of requests in case an icon is used multiple times on the same page.
// *
// * @param {string} name
// */
// async function getSVGTextElementCached(name) {
// if (iconCache[name] === undefined) {
// let promise = getSVGTextElement(name);
// iconCache[name] = promise;
// return promise;
// } else {
// return iconCache[name];
// }
// }
/**
/**
* For icon names see https://lineicons.com
* For icon names see https://lineicons.com
*/
*/
...
@@ -148,13 +68,10 @@ export class Icon extends LitElement {
...
@@ -148,13 +68,10 @@ export class Icon extends LitElement {
render
()
{
render
()
{
const
iconURL
=
getIconSVGURL
(
this
.
name
);
const
iconURL
=
getIconSVGURL
(
this
.
name
);
const
iconPart
=
this
.
name
.
trim
().
replaceAll
(
"
"
,
""
);
const
iconPart
=
this
.
name
.
trim
().
replaceAll
(
"
"
,
""
);
// console.log("iconURL", iconURL);
// console.log("iconPart", iconPart);
return
html
`
return
html
`
<style>
<style>
#svg {
#svg {
/*background-image: var(--dbp-override-icon-
${
iconPart
}
, url(
${
iconURL
}
));*/
-webkit-mask-image: var(--dbp-override-icon-
${
iconPart
}
, url(
${
iconURL
}
));
-webkit-mask-image: var(--dbp-override-icon-
${
iconPart
}
, url(
${
iconURL
}
));
mask-image: var(--dbp-override-icon-
${
iconPart
}
, url(
${
iconURL
}
));
mask-image: var(--dbp-override-icon-
${
iconPart
}
, url(
${
iconURL
}
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment