Skip to content

Commit

Permalink
v3.24.0 feat: add getIconUnicode option. #204 c271be5
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 8, 2023
1 parent ee78113 commit debef61
Show file tree
Hide file tree
Showing 31 changed files with 555 additions and 520 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTORS.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions badges.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 coverage-summary.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{"total": {"lines":{"total":311,"covered":268,"skipped":0,"pct":86.17},"statements":{"total":336,"covered":282,"skipped":0,"pct":83.92},"functions":{"total":69,"covered":62,"skipped":0,"pct":89.85},"branches":{"total":208,"covered":132,"skipped":0,"pct":63.46},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
{"total": {"lines":{"total":317,"covered":274,"skipped":0,"pct":86.43},"statements":{"total":343,"covered":288,"skipped":0,"pct":83.96},"functions":{"total":68,"covered":61,"skipped":0,"pct":89.7},"branches":{"total":214,"covered":134,"skipped":0,"pct":62.61},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
,"/home/runner/work/svgtofont/svgtofont/src/cli.ts": {"lines":{"total":11,"covered":0,"skipped":0,"pct":0},"functions":{"total":2,"covered":0,"skipped":0,"pct":0},"statements":{"total":11,"covered":0,"skipped":0,"pct":0},"branches":{"total":6,"covered":0,"skipped":0,"pct":0}}
,"/home/runner/work/svgtofont/svgtofont/src/generate.ts": {"lines":{"total":36,"covered":35,"skipped":0,"pct":97.22},"functions":{"total":11,"covered":11,"skipped":0,"pct":100},"statements":{"total":41,"covered":40,"skipped":0,"pct":97.56},"branches":{"total":27,"covered":17,"skipped":0,"pct":62.96}}
,"/home/runner/work/svgtofont/svgtofont/src/index.ts": {"lines":{"total":125,"covered":111,"skipped":0,"pct":88.8},"functions":{"total":4,"covered":4,"skipped":0,"pct":100},"statements":{"total":135,"covered":117,"skipped":0,"pct":86.66},"branches":{"total":110,"covered":81,"skipped":0,"pct":73.63}}
,"/home/runner/work/svgtofont/svgtofont/src/log.ts": {"lines":{"total":13,"covered":10,"skipped":0,"pct":76.92},"functions":{"total":8,"covered":5,"skipped":0,"pct":62.5},"statements":{"total":17,"covered":11,"skipped":0,"pct":64.7},"branches":{"total":10,"covered":4,"skipped":0,"pct":40}}
,"/home/runner/work/svgtofont/svgtofont/src/utils.ts": {"lines":{"total":126,"covered":112,"skipped":0,"pct":88.88},"functions":{"total":44,"covered":42,"skipped":0,"pct":95.45},"statements":{"total":132,"covered":114,"skipped":0,"pct":86.36},"branches":{"total":55,"covered":30,"skipped":0,"pct":54.54}}
,"/home/runner/work/svgtofont/svgtofont/src/utils.ts": {"lines":{"total":132,"covered":118,"skipped":0,"pct":89.39},"functions":{"total":43,"covered":41,"skipped":0,"pct":95.34},"statements":{"total":139,"covered":120,"skipped":0,"pct":86.33},"branches":{"total":61,"covered":32,"skipped":0,"pct":52.45}}
}
8 changes: 4 additions & 4 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@
/* IE9*/
src: url("svgtofont.eot#iefix") format("embedded-opentype"),
/* IE6-IE8 */
url("svgtofont.woff2?1684204718098") format("woff2"),
url("svgtofont.woff?1684204718098") format("woff"),
url("svgtofont.woff2?1686241669018") format("woff2"),
url("svgtofont.woff?1686241669018") format("woff"),
/* chrome, firefox */
url("svgtofont.ttf?1684204718098") format("truetype"),
url("svgtofont.ttf?1686241669018") format("truetype"),
/* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url("svgtofont.svg#svgtofont?1684204718098") format("svg");
url("svgtofont.svg#svgtofont?1686241669018") format("svg");
/* iOS 4.1- */
}
.iconfont {
Expand Down
12 changes: 6 additions & 6 deletions example/svgtofont.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@font-face {
font-family: "svgtofont";
src: url('svgtofont.eot?t=1684204718076'); /* IE9*/
src: url('svgtofont.eot?t=1684204718076#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1684204718076") format("woff2"),
url("svgtofont.woff?t=1684204718076") format("woff"),
url('svgtofont.ttf?t=1684204718076') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1684204718076#svgtofont') format('svg'); /* iOS 4.1- */
src: url('svgtofont.eot?t=1686241668999'); /* IE9*/
src: url('svgtofont.eot?t=1686241668999#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1686241668999") format("woff2"),
url("svgtofont.woff?t=1686241668999") format("woff"),
url('svgtofont.ttf?t=1686241668999') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1686241668999#svgtofont') format('svg'); /* iOS 4.1- */
}

[class^="svgtofont-"], [class*=" svgtofont-"] {
Expand Down
Binary file modified example/svgtofont.eot
Binary file not shown.
12 changes: 6 additions & 6 deletions example/svgtofont.less
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {font-family: "svgtofont";
src: url('svgtofont.eot?t=1684204718076'); /* IE9*/
src: url('svgtofont.eot?t=1684204718076#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1684204718076") format("woff2"),
url("svgtofont.woff?t=1684204718076") format("woff"),
url('svgtofont.ttf?t=1684204718076') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1684204718076#svgtofont') format('svg'); /* iOS 4.1- */
src: url('svgtofont.eot?t=1686241668999'); /* IE9*/
src: url('svgtofont.eot?t=1686241668999#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1686241668999") format("woff2"),
url("svgtofont.woff?t=1686241668999") format("woff"),
url('svgtofont.ttf?t=1686241668999') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1686241668999#svgtofont') format('svg'); /* iOS 4.1- */
}

[class^="svgtofont-"], [class*=" svgtofont-"] {
Expand Down
12 changes: 6 additions & 6 deletions example/svgtofont.module.less
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {font-family: "svgtofont";
src: url('svgtofont.eot?t=1684204718076'); /* IE9*/
src: url('svgtofont.eot?t=1684204718076#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1684204718076") format("woff2"),
url("svgtofont.woff?t=1684204718076") format("woff"),
url('svgtofont.ttf?t=1684204718076') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1684204718076#svgtofont') format('svg'); /* iOS 4.1- */
src: url('svgtofont.eot?t=1686241668999'); /* IE9*/
src: url('svgtofont.eot?t=1686241668999#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1686241668999") format("woff2"),
url("svgtofont.woff?t=1686241668999") format("woff"),
url('svgtofont.ttf?t=1686241668999') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1686241668999#svgtofont') format('svg'); /* iOS 4.1- */
}

[class^="svgtofont-"], [class*=" svgtofont-"] {
Expand Down
12 changes: 6 additions & 6 deletions example/svgtofont.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {font-family: "svgtofont";
src: url('svgtofont.eot?t=1684204718076'); /* IE9*/
src: url('svgtofont.eot?t=1684204718076#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1684204718076") format("woff2"),
url("svgtofont.woff?t=1684204718076") format("woff"),
url('svgtofont.ttf?t=1684204718076') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1684204718076#svgtofont') format('svg'); /* iOS 4.1- */
src: url('svgtofont.eot?t=1686241668999'); /* IE9*/
src: url('svgtofont.eot?t=1686241668999#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1686241668999") format("woff2"),
url("svgtofont.woff?t=1686241668999") format("woff"),
url('svgtofont.ttf?t=1686241668999') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1686241668999#svgtofont') format('svg'); /* iOS 4.1- */
}

[class^="svgtofont-"], [class*=" svgtofont-"] {
Expand Down
12 changes: 6 additions & 6 deletions example/svgtofont.styl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {font-family: "svgtofont";
src: url('svgtofont.eot?t=1684204718076'); /* IE9*/
src: url('svgtofont.eot?t=1684204718076#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1684204718076") format("woff2"),
url("svgtofont.woff?t=1684204718076") format("woff"),
url('svgtofont.ttf?t=1684204718076') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1684204718076#svgtofont') format('svg'); /* iOS 4.1- */
src: url('svgtofont.eot?t=1686241668999'); /* IE9*/
src: url('svgtofont.eot?t=1686241668999#iefix') format('embedded-opentype'), /* IE6-IE8 */
url("svgtofont.woff2?t=1686241668999") format("woff2"),
url("svgtofont.woff?t=1686241668999") format("woff"),
url('svgtofont.ttf?t=1686241668999') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('svgtofont.svg?t=1686241668999#svgtofont') format('svg'); /* iOS 4.1- */
}

[class^="svgtofont-"], [class*=" svgtofont-"] {
Expand Down
Binary file modified example/svgtofont.ttf
Binary file not shown.
Binary file modified example/svgtofont.woff
Binary file not shown.
Binary file modified example/svgtofont.woff2
Binary file not shown.
11 changes: 9 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
}
}
}
customElements.define('github-corners', GithubCorners);</script><github-corners target="__blank" position="fixed" z-index="999" href="https://github.com/jaywcjlove/svgtofont.git"></github-corners><dark-mode permanent="true" style="position: fixed; top: 8px; left: 10px; z-index: 999;" dark="Dark" light="Light"></dark-mode><script>const t=document;const e="_dark_mode_theme_";const s="permanent";const o="colorschemechange";const i="permanentcolorscheme";const h="light";const r="dark";const n=(t,e,s=e)=>{Object.defineProperty(t,s,{enumerable:true,get(){const t=this.getAttribute(e);return t===null?"":t},set(t){this.setAttribute(e,t)}})};const c=(t,e,s=e)=>{Object.defineProperty(t,s,{enumerable:true,get(){return this.hasAttribute(e)},set(t){if(t){this.setAttribute(e,"")}else{this.removeAttribute(e)}}})};class a extends HTMLElement{static get observedAttributes(){return["mode",h,r,s]}LOCAL_NANE=e;constructor(){super();this.t()}connectedCallback(){n(this,"mode");n(this,r);n(this,h);c(this,s);const a=localStorage.getItem(e);if(a&&[h,r].includes(a)){this.mode=a;this.permanent=true}if(this.permanent&&!a){localStorage.setItem(e,this.mode)}const l=[h,r].includes(a);if(this.permanent&&a){this.o()}else{if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches){this.mode=r;this.o()}if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches){this.mode=h;this.o()}}if(!this.permanent&&!l){window.matchMedia("(prefers-color-scheme: light)").onchange=t=>{this.mode=t.matches?h:r;this.o()};window.matchMedia("(prefers-color-scheme: dark)").onchange=t=>{this.mode=t.matches?r:h;this.o()}}const d=new MutationObserver(((s,h)=>{this.mode=t.documentElement.dataset.colorMode;if(this.permanent&&l){localStorage.setItem(e,this.mode);this.i(i,{permanent:this.permanent})}this.h();this.i(o,{colorScheme:this.mode})}));d.observe(t.documentElement,{attributes:true});this.i(o,{colorScheme:this.mode});this.h()}attributeChangedCallback(t,s,o){if(t==="mode"&&s!==o&&[h,r].includes(o)){const t=localStorage.getItem(e);if(this.mode===t){this.mode=o;this.h();this.o()}else if(this.mode&&this.mode!==t){this.h();this.o()}}else if((t===h||t===r)&&s!==o){this.h()}if(t==="permanent"&&typeof this.permanent==="boolean"){this.permanent?localStorage.setItem(e,this.mode):localStorage.removeItem(e)}}o(){t.documentElement.setAttribute("data-color-mode",this.mode)}h(){this.icon.textContent=this.mode===h?"🌒":"🌞";this.text.textContent=this.mode===h?this.getAttribute(r):this.getAttribute(h)}t(){var s=this.attachShadow({mode:"open"});this.label=t.createElement("span");this.label.setAttribute("class","wrapper");this.label.onclick=()=>{this.mode=this.mode===h?r:h;if(this.permanent){localStorage.setItem(e,this.mode)}this.o();this.h()};s.appendChild(this.label);this.icon=t.createElement("span");this.label.appendChild(this.icon);this.text=t.createElement("span");this.label.appendChild(this.text);const o=`
customElements.define('github-corners', GithubCorners);</script><github-corners target="__blank" position="fixed" z-index="999" href="https://github.com/jaywcjlove/svgtofont.git"></github-corners><dark-mode style="position: fixed; top: 8px; left: 10px; z-index: 999;" dark="Dark" light="Light" permanent="true"></dark-mode><script>const t=document;const e="_dark_mode_theme_";const s="permanent";const o="colorschemechange";const i="permanentcolorscheme";const h="light";const r="dark";const n=(t,e,s=e)=>{Object.defineProperty(t,s,{enumerable:true,get(){const t=this.getAttribute(e);return t===null?"":t},set(t){this.setAttribute(e,t)}})};const c=(t,e,s=e)=>{Object.defineProperty(t,s,{enumerable:true,get(){return this.hasAttribute(e)},set(t){if(t){this.setAttribute(e,"")}else{this.removeAttribute(e)}}})};class a extends HTMLElement{static get observedAttributes(){return["mode",h,r,s]}LOCAL_NANE=e;constructor(){super();this.t()}connectedCallback(){n(this,"mode");n(this,r);n(this,h);c(this,s);const a=localStorage.getItem(e);if(a&&[h,r].includes(a)){this.mode=a;this.permanent=true}if(this.permanent&&!a){localStorage.setItem(e,this.mode)}const l=[h,r].includes(a);if(this.permanent&&a){this.o()}else{if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches){this.mode=r;this.o()}if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches){this.mode=h;this.o()}}if(!this.permanent&&!l){window.matchMedia("(prefers-color-scheme: light)").onchange=t=>{this.mode=t.matches?h:r;this.o()};window.matchMedia("(prefers-color-scheme: dark)").onchange=t=>{this.mode=t.matches?r:h;this.o()}}const d=new MutationObserver(((s,h)=>{this.mode=t.documentElement.dataset.colorMode;if(this.permanent&&l){localStorage.setItem(e,this.mode);this.i(i,{permanent:this.permanent})}this.h();this.i(o,{colorScheme:this.mode})}));d.observe(t.documentElement,{attributes:true});this.i(o,{colorScheme:this.mode});this.h()}attributeChangedCallback(t,s,o){if(t==="mode"&&s!==o&&[h,r].includes(o)){const t=localStorage.getItem(e);if(this.mode===t){this.mode=o;this.h();this.o()}else if(this.mode&&this.mode!==t){this.h();this.o()}}else if((t===h||t===r)&&s!==o){this.h()}if(t==="permanent"&&typeof this.permanent==="boolean"){this.permanent?localStorage.setItem(e,this.mode):localStorage.removeItem(e)}}o(){t.documentElement.setAttribute("data-color-mode",this.mode)}h(){this.icon.textContent=this.mode===h?"🌒":"🌞";this.text.textContent=this.mode===h?this.getAttribute(r):this.getAttribute(h)}t(){var s=this.attachShadow({mode:"open"});this.label=t.createElement("span");this.label.setAttribute("class","wrapper");this.label.onclick=()=>{this.mode=this.mode===h?r:h;if(this.permanent){localStorage.setItem(e,this.mode)}this.o();this.h()};s.appendChild(this.label);this.icon=t.createElement("span");this.label.appendChild(this.icon);this.text=t.createElement("span");this.label.appendChild(this.text);const o=`
[data-color-mode*='dark'], [data-color-mode*='dark'] body {
color-scheme: dark;
--color-theme-bg: #0d1117;
Expand Down Expand Up @@ -155,7 +155,7 @@
}
}
}
customElements.define('markdown-style', MarkdownStyle);</script><markdown-style style="max-width: 960px; margin: 0 auto 60px auto; padding: 8px" class="markdown-style">
customElements.define('markdown-style', MarkdownStyle);</script><markdown-style style="max-width: 960px; margin: 0 auto 60px auto; padding: 8px;" class="markdown-style">
<p align="center">
<a href="https://github.com/jaywcjlove/svgtofont/">
<img src="https://user-images.githubusercontent.com/1680273/106147487-dfb22880-61b2-11eb-8462-4f443a4c2201.png" alt="SVG To Font">
Expand Down Expand Up @@ -590,6 +590,13 @@ <h3 id="startunicode"><a class="anchor" aria-hidden="true" tabindex="-1" href="#
<p>Type: <code>Number</code><br>Default value: <code>0xea01</code></p>
</blockquote>
<p>unicode start number</p>
<h3 id="geticonunicode"><a class="anchor" aria-hidden="true" tabindex="-1" href="#geticonunicode"><span class="octicon octicon-link"></span></a>getIconUnicode</h3>
<p>Get Icon Unicode</p>
<pre class="language-ts"><code class="language-ts code-highlight"><span class="code-line line-number" line="1">getIconUnicode<span class="token operator">?</span><span class="token operator">:</span> <span class="token punctuation">(</span>name<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> unicode<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">,</span> startUnicode<span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span>
</span><span class="code-line line-number" line="2"> <span class="token operator">=></span> <span class="token punctuation">[</span><span class="token builtin">string</span><span class="token punctuation">,</span> <span class="token builtin">number</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
</span></code><div onclick="copied(this)" data-code="getIconUnicode?: (name: string, unicode: string, startUnicode: number)
=> [string, number];
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
<h3 id="usenameasunicode"><a class="anchor" aria-hidden="true" tabindex="-1" href="#usenameasunicode"><span class="octicon octicon-link"></span></a>useNameAsUnicode</h3>
<blockquote>
<p>Type: <code>Boolean</code><br>Default value: <code>false</code></p>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/cli.ts.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ <h1><a href="index.html">All files</a> cli.ts</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-05-16T02:38:36.911Z
at 2023-06-08T16:27:48.045Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/generate.ts.html
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ <h1><a href="index.html">All files</a> generate.ts</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-05-16T02:38:36.911Z
at 2023-06-08T16:27:48.045Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
Loading

0 comments on commit debef61

Please sign in to comment.