This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0
wcui/src/icon.js

35 lines
5.7 KiB
JavaScript

/**
* svg图标
* @author yutent<yutent@doui.cc>
* @date 2019/07/08 11:17:58
*/
'use strict'
function appendSVGDOM() {
var container,
svg,
str =
'<svg><symbol id="icon-editor-bold" viewBox="0 0 1024 1024"><path d="M576 661.333H426.667v-128H576c35.413 0 64 28.587 64 64 0 35.414-28.587 64-64 64m-149.333-384h128c35.413 0 64 28.587 64 64 0 35.414-28.587 64-64 64h-128m238.933 55.04C706.987 431.36 736 384 736 341.333c0-96.426-74.667-170.666-170.667-170.666H298.667V768H599.04c89.6 0 158.293-72.533 158.293-161.707 0-64.853-36.693-120.32-91.733-145.92z" ></path></symbol><symbol id="icon-editor-image" viewBox="0 0 1024 1024"><path d="M554.667 384h234.666L554.667 149.333V384M256 85.333h341.333l256 256v512c0 46.934-38.4 85.334-85.333 85.334H256c-47.36 0-85.333-38.4-85.333-85.334V170.667A85.038 85.038 0 0 1 256 85.333m0 768h512V512L597.333 682.667 512 597.333l-256 256M341.333 384C294.4 384 256 422.4 256 469.333c0 46.934 38.4 85.334 85.333 85.334 46.934 0 85.334-38.4 85.334-85.334 0-46.933-38.4-85.333-85.334-85.333z" ></path></symbol><symbol id="icon-editor-align-justify" viewBox="0 0 1024 1024"><path d="M128 128h768v85.333H128V128m0 170.667h768V384H128v-85.333m0 170.666h768v85.334H128v-85.334M128 640h768v85.333H128V640m0 170.667h768V896H128v-85.333z" ></path></symbol><symbol id="icon-editor-align-left" viewBox="0 0 1024 1024"><path d="M128 128h768v85.333H128V128m0 170.667h512V384H128v-85.333m0 170.666h768v85.334H128v-85.334M128 640h512v85.333H128V640m0 170.667h768V896H128v-85.333z" ></path></symbol><symbol id="icon-editor-link" viewBox="0 0 1024 1024"><path d="M879.2 131.6c-103-95.5-264.1-88-361.4 11.2L474.7 184c-13.1 13.1-3.7 35.6 13.1 37.5 26.2 1.9 52.4 7.5 78.7 15 7.5 1.9 16.9 0 22.5-5.6l9.4-9.4c54.3-54.3 142.3-59.9 198.5-11.2 63.7 54.3 65.5 151.7 7.5 209.7L662 562.3c-18.7 18.7-41.2 30-63.7 37.5-30 7.5-61.8 5.6-89.9-5.6-16.9-7.5-33.7-16.9-48.7-31.8-7.5-7.5-13.1-15-18.7-24.3-7.5-13.1-24.3-15-33.7-3.7l-52.4 52.4c-7.5 7.5-7.5 18.7-1.9 28.1 7.5 11.2 16.9 20.6 26.2 30 13.1 13.1 30 26.2 44.9 35.6 26.2 16.9 56.2 28.1 86.1 33.7 58.1 11.2 121.7 1.9 174.2-26.2 20.6-11.2 41.2-26.2 58.1-43.1l142.3-142.3c104.9-103.2 101.2-271.8-5.6-371zM534.7 803.9l-39.3-5.6s-26.2-5.6-39.3-11.2c-7.5-1.9-16.9 0-22.5 5.6l-9.4 9.4c-54.3 54.3-142.3 59.9-198.5 11.2-63.7-54.3-65.5-151.7-7.5-209.7l142.3-142.3c18.7-18.7 41.2-30 63.7-37.5 30-7.5 61.8-5.6 89.9 5.6 16.9 7.5 33.7 16.9 48.7 31.8 7.5 7.5 13.1 15 18.7 24.3 7.5 13.1 24.3 15 33.7 3.7l52.4-52.4c7.5-7.5 7.5-18.7 1.9-28.1-7.5-11.2-16.9-20.6-26.2-30-13.1-13.1-28.1-26.2-44.9-35.6-26.2-16.9-56.2-28.1-88-33.7-58.1-11.2-121.7-1.9-174.2 26.2-20.6 11.2-41.2 26.2-58.1 43.1L141.4 515.5c-99.3 99.3-106.7 260.3-11.2 361.4C229.5 985.5 398 987.4 501 884.4l46.8-46.8c13.1-9.4 3.7-31.9-13.1-33.7z" ></path></symbol><symbol id="icon-editor-list-numbers" viewBox="0 0 1024 1024"><path d="M298.667 554.667H896v-85.334H298.667m0 341.334H896v-85.334H298.667m0-426.666H896v-85.334H298.667m-213.334 256h76.8l-76.8 89.6v38.4h128v-42.666h-76.8l76.8-89.6v-38.4h-128M128 341.333h42.667V170.667H85.333v42.666H128m-42.667 512h85.334v21.334H128v42.666h42.667v21.334H85.333v42.666h128V682.667h-128v42.666z" ></path></symbol><symbol id="icon-editor-italic" viewBox="0 0 1024 1024"><path d="M426.667 170.667v128h94.293L375.04 640H256v128h341.333V640H503.04l145.92-341.333H768v-128H426.667z" ></path></symbol><symbol id="icon-editor-strikethrough" viewBox="0 0 1024 1024"><path d="M898.719 512v70.312H744.383c35.156 75.235 33.398 281.25-219.024 281.25-292.851 1.758-281.601-228.515-281.601-228.515l139.57 1.758c1.055 118.476 111.094 118.476 132.89 117.07 22.5-1.758 106.524-1.406 113.204-83.672 2.812-38.32-35.86-67.5-78.047-87.89H125.281V512H898.72M772.508 367.508l-139.922-1.055s5.976-97.383-115.313-97.734c-121.289-0.703-110.742 77.343-110.742 87.187 1.407 9.844 11.953 58.36 105.469 81.563H290.867S168.172 200.867 467.703 160.437c306.211-42.187 305.508 207.774 304.805 207.07z" ></path></symbol><symbol id="icon-editor-underline" viewBox="0 0 1024 1024"><path d="M232 872h560v-80H232v80m280-160c132.4 0 240-107.6 240-240V152H652v320c0 77.2-62.8 140-140 140s-140-62.8-140-140V152H272v320c0 132.4 107.6 240 240 240z" ></path></symbol><symbol id="icon-editor-align-center" viewBox="0 0 1024 1024"><path d="M128 128h768v85.333H128V128m170.667 170.667h426.666V384H298.667v-85.333M128 469.333h768v85.334H128v-85.334M298.667 640h426.666v85.333H298.667V640M128 810.667h768V896H128v-85.333z" ></path></symbol><symbol id="icon-editor-list-bulleted" viewBox="0 0 1024 1024"><path d="M298.667 213.333v85.334H896v-85.334M298.667 554.667H896v-85.334H298.667m0 341.334H896v-85.334H298.667m-128-14.08c-31.574 0-56.747 25.6-56.747 56.747s25.6 56.747 56.747 56.747c31.146 0 56.746-25.6 56.746-56.747s-25.173-56.747-56.746-56.747m0-519.253c-35.414 0-64 28.587-64 64s28.586 64 64 64c35.413 0 64-28.587 64-64s-28.587-64-64-64m0 256c-35.414 0-64 28.587-64 64s28.586 64 64 64c35.413 0 64-28.587 64-64s-28.587-64-64-64z" ></path></symbol><symbol id="icon-editor-align-right" viewBox="0 0 1024 1024"><path d="M128 128h768v85.333H128V128m256 170.667h512V384H384v-85.333M128 469.333h768v85.334H128v-85.334M384 640h512v85.333H384V640M128 810.667h768V896H128v-85.333z"></path></symbol></svg>'
container = document.createElement('div')
container.innerHTML = str
svg = container.querySelector('svg')
svg.setAttribute('aria-hidden', 'true')
svg.style.cssText = 'overflow:hidden;position: absolute;width:0;height:0'
document.head.appendChild(svg)
}
export default !(function(params) {
if (~['complete', 'loaded', 'interactive'].indexOf(document.readyState)) {
setTimeout(appendSVGDOM, 0)
} else {
var loadedEvent = function() {
document.removeEventListener('DOMContentLoaded', loadedEvent, false)
appendSVGDOM()
}
document.addEventListener('DOMContentLoaded', loadedEvent, false)
}
})()
wcui是一套基于`Web Components`的UI组件库, 宗旨是追求简单、实用、不花哨。
JavaScript 95.2%
CSS 4.8%